/* Colors are chosen to meet WCAG 2.2 AA contrast (4.5:1 for text) in both themes. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #4a5360;        /* 7.6:1 on --surface */
  --border: #d5dae1;
  --accent: #0f5f73;       /* hero band; white text on it is 7.4:1 */
  --link: #0b5c70;         /* 7.4:1 on --surface */
  --tag-bg: #e8eef2;
  --tag-text: #1f3a44;     /* 10:1 on --tag-bg */
  --focus: #c2410c;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 2px 8px rgb(16 24 40 / 6%);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --text: #e8ebef;
    --muted: #b3bcc7;      /* 9:1 on --surface */
    --border: #2e3640;
    --accent: #0f5f73;
    --link: #7fd0e3;       /* 9.6:1 on --surface */
    --tag-bg: #24303a;
    --tag-text: #cfe3ea;   /* 10:1 on --tag-bg */
    --focus: #fb923c;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 10;
  background: var(--surface); color: var(--text); padding: 0.6rem 1rem;
  border: 2px solid var(--focus); border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.nav-links { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 0.5rem 0.25rem; }
.nav-links a:hover { color: var(--text); text-decoration: underline; }

/* Hero */
.hero { background: var(--accent); color: #fff; text-align: center; padding: 3rem 0 3.25rem; }
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
.lede { margin: 0 auto; max-width: 42rem; font-size: 1.1rem; color: #fff; }

/* Grid */
#projects { padding: 2.5rem 0 3rem; }
#projects:focus { outline: none; }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.card:hover, .card:focus-within { transform: translateY(-2px); box-shadow: 0 6px 20px rgb(16 24 40 / 12%); }

.media { position: relative; aspect-ratio: 16 / 9; background: var(--tag-bg); border-bottom: 1px solid var(--border); }
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.media video { opacity: 0; transition: opacity 200ms ease; }
.card.playing .media video { opacity: 1; }

.body { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem 1.25rem 1.25rem; flex: 1; }
.body h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.body h2 a { color: var(--text); text-decoration: none; }
.body h2 a:hover { text-decoration: underline; }
.body > p { margin: 0; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.tags li { background: var(--tag-bg); color: var(--tag-text); font-size: 0.8rem; padding: 0.15rem 0.55rem; border-radius: 999px; }

.links { display: flex; gap: 1.25rem; margin-top: auto !important; padding-top: 0.35rem; }
.links a { font-weight: 600; padding: 0.25rem 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 0; color: var(--muted); }
.footer-inner p { margin: 0; }
.social { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.social a { color: var(--muted); display: inline-flex; padding: 0.5rem; border-radius: 6px; }
.social a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .card, .media video { transition: none; }
  .card:hover, .card:focus-within { transform: none; }
}

/* 404 page */
.not-found { min-height: 100vh; display: grid; place-content: center; }
.not-found a { color: #fff; }
