/* Original palette, system font, reset, and layout in plain CSS. */
:root {
  --background: hsl(60 2% 87%);
  --foreground: hsl(240 10% 3.9%);
  --primary: hsl(240 5.9% 10%);
  --border: hsl(240 5.9% 90%);
}

*, *::before, *::after {
  box-sizing: border-box;
  border: 0 solid var(--border);
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-feature-settings: normal;
  font-variation-settings: normal;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  line-height: inherit;
  background: var(--background);
  color: var(--foreground);
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: inherit; }
strong { font-weight: bolder; }
img { display: block; vertical-align: middle; max-width: 100%; height: auto; }
button {
  font: inherit;
  font-feature-settings: inherit;
  font-variation-settings: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.site-header, .footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header { padding: 1rem; }
h1, h3 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--primary);
  text-underline-offset: 4px;
  transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.button:hover { text-decoration: underline; }
.button:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--foreground);
}
.contact-button, .close-button { padding: 0.5rem 1rem; }
.icon-button { width: 2.5rem; }
.header-actions img { width: 1rem; height: 1rem; }

.section {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}
.section > h2 {
  margin: 2rem 0;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project-image, .project-info { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.project-image img, .demo-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.5rem;
}
.project-info { text-align: left; }
.project-info h3 { color: #111827; }
.project-info p { color: #374151; }
.project-links { display: flex; flex-direction: column; margin-top: 0.5rem; }
.project-links > a + a { margin-top: 0.5rem; }
.project-links a { color: #3b82f6; text-decoration: underline; }
.project-links a:hover { color: #1d4ed8; }

.demo { position: relative; }
.demo-image { width: 100%; aspect-ratio: 4 / 3; }
.demo-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgb(0 0 0 / 50%);
  border-radius: 0.5rem;
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.demo:hover .demo-overlay, .demo:focus-visible .demo-overlay { opacity: 1; }
.demo-caption { padding: 1rem; color: white; text-align: center; }

.site-footer { margin-top: 2rem; padding: 1rem; background: #1f2937; color: white; }
.footer-content { width: 100%; margin: 0 auto; padding: 0 2rem; }
.footer-content p { font-size: 0.875rem; line-height: 1.25rem; }
.footer-content img { width: 1.5rem; height: 1.5rem; }

/* Native HTML dialog: Contact, Close, Escape, focus trapping and restoration. */
html:has(dialog[open]) { overflow: hidden; }
dialog {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 32rem;
  max-height: calc(100% - 2rem);
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  color: var(--foreground);
  background: var(--background);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%);
}
dialog[open] { display: grid; gap: 1rem; animation: dialog-in 150ms cubic-bezier(0.4, 0, 0.2, 1); }
dialog::backdrop { background: rgb(0 0 0 / 80%); animation: fade-in 150ms cubic-bezier(0.4, 0, 0.2, 1); }
.dialog-header { display: flex; flex-direction: column; text-align: center; }
.dialog-header h2 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
.dialog-header p { margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.25rem; color: hsl(240 3.8% 46.1%); }
.dialog-footer { display: flex; flex-direction: column-reverse; margin: 0; }
.close-button { color: hsl(0 0% 98%); background: var(--primary); }
.close-button:hover { background: hsl(240 5.9% 10% / 90%); text-decoration: none; }

@media (min-width: 640px) {
  dialog { border-radius: 0.5rem; }
  .dialog-header { text-align: left; }
  .dialog-footer { flex-direction: row; justify-content: flex-end; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .button, .demo-overlay { transition: none; }
  dialog[open], dialog::backdrop { animation: none; }
}
