/* ===========================================================
   Santhiago Collection — gallery
   Theme tokens. Two color systems switched via [data-theme].
   =========================================================== */

:root,
[data-theme="light"] {
  --bg: #faf8f5;
  --bg-elev: #ffffff;
  --bg-soft: #f0ebe3;
  --ink: #1a1612;
  --ink-soft: #4a4540;
  --ink-mute: #7d7770;
  --line: #d8d2c8;
  --accent: #8b6f47;
  --accent-soft: #c4a87d;
  --shadow: 0 2px 20px rgba(50, 35, 20, 0.06);
  --shadow-lg: 0 8px 40px rgba(50, 35, 20, 0.10);
}

[data-theme="dark"] {
  --bg: #0e0d0c;
  --bg-elev: #1a1815;
  --bg-soft: #221f1c;
  --ink: #ece6dd;
  --ink-soft: #b8b0a4;
  --ink-mute: #7d7770;
  --line: #2e2a26;
  --accent: #c4a87d;
  --accent-soft: #d9c4a0;
  --shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light dark; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;          /* defensive: prevent any horizontal scroll */
  transition: background 220ms ease, color 220ms ease;
}
body * { min-width: 0; }       /* keep all children within body */

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Typography ---------- */
.serif { font-family: 'Cormorant Garamond', 'Times New Roman', serif; }
h1, h2, h3, .display { font-family: 'Cormorant Garamond', 'Times New Roman', serif; font-weight: 500; letter-spacing: -0.01em; word-break: break-word; }
h1 { font-size: clamp(2.2rem, 8vw, 4.5rem); margin: 0 0 0.5em; line-height: 1.05; }
h2 { font-size: clamp(1.5rem, 6vw, 2.5rem); margin: 0 0 0.5em; line-height: 1.1; }
h3 { font-size: 1.5rem; margin: 0 0 0.3em; }
p  { overflow-wrap: anywhere; }
.eyebrow {
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-mute);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  /* Use a fully-opaque background + blur layered on top. The blur kicks in
     where supported (modern browsers) for that frosted-glass feel, but the
     solid background underneath guarantees text is always readable. */
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  /* Browsers without backdrop-filter get a fully solid header */
  .site-header { background: var(--bg); }
}
/* When the user scrolls, push the opacity up and add a stronger shadow */
.site-header.is-scrolled,
.site-header.has-solid {
  background: color-mix(in srgb, var(--bg) 98%, transparent);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}
.site-header__inner {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
}
.brand { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; flex-shrink: 1; }
.brand a { display: inline-flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.brand__name {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 1.4rem; font-weight: 500; letter-spacing: -0.005em;
  white-space: nowrap;
  /* uses the display serif (Cormorant Garamond) — the same typeface used
     for artwork titles throughout the site, so the brand feels like part
     of the editorial design rather than UI chrome */
}
.nav { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  font-size: 0.85rem; letter-spacing: 0.06em;
  color: var(--ink-soft); position: relative;
  padding: 0.3rem 0;
}
.nav a:hover, .nav a.is-active { color: var(--ink); }
.nav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--accent);
}
.theme-toggle {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink); cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 200ms ease, background 200ms ease;
}
.theme-toggle:hover { background: var(--bg-soft); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="dark"]  .theme-toggle .moon { display: none; }

/* Hamburger menu — only on mobile */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;          /* no border around the hamburger */
  color: var(--ink); cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 200ms ease, transform 200ms ease;
}
.nav-toggle:hover { background: var(--bg-soft); }
.nav-toggle svg { width: 18px; height: 18px; }

/* Close button inside the mobile overlay — only visible on mobile */
.nav-close {
  display: none;        /* hidden by default; shown in mobile media query */
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--ink-mute);
  cursor: pointer;
  width: 40px; height: 40px;
  padding: 0;
  align-items: center; justify-content: center;
  transition: background 180ms ease, color 180ms ease;
}
.nav-close:hover { background: var(--bg-soft); color: var(--ink); }
.nav-close svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-close span { display: none; }        /* hide "Close" label — icon only */

/* On narrow screens: hide inline nav, show hamburger; nav becomes a full-screen overlay */
@media (max-width: 720px) {
  .site-header__inner { padding: 0.85rem 1rem; gap: 0.5rem; flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; }

  /* Full-screen overlay nav */
  .nav {
    position: fixed;
    inset: 0;
    z-index: 90;             /* under the hamburger toggle but above page content */
    width: 100vw;
    height: 100vh;
    background: var(--bg);
    display: none;            /* hidden by default */
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 5rem 1.5rem 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav.is-open {
    display: flex;
    animation: nav-fade-in 220ms ease-out;
  }
  @keyframes nav-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .nav a {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    padding: 1.1rem 0.25rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    width: 100%;
    color: var(--ink);
    line-height: 1.1;
  }
  .nav a:last-of-type { border-bottom: 1px solid var(--line); }
  .nav a.is-active { color: var(--accent); }
  .nav a.is-active::after { display: none; }
  .nav .theme-toggle {
    margin: 1.75rem 0 0;
    align-self: flex-start;
    width: 44px; height: 44px;
  }
  .nav .theme-toggle svg { width: 18px; height: 18px; }

  /* Bring the header above the overlay so the close button is reachable */
  .site-header { z-index: 100; }
  .site-header__inner { background: transparent; }

  /* Animate hamburger icon swap */
  .nav-toggle .icon-close { display: none; }
  .nav-toggle.is-open .icon-open { display: none; }
  .nav-toggle.is-open .icon-close { display: block; }

  /* Close button inside the overlay — visible on mobile only */
  .nav-close { display: inline-flex; }

  /* When nav is open, dim the rest of the page content so the menu is the focus */
  body.nav-open main { display: none; }
}

/* ---------- Hero (home) ---------- */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 4rem 1.25rem 3rem;
  display: grid;
  /* 12-column grid so we can place items explicitly on desktop:
     - col 1-5:  lead text (eyebrow, h1, lede)
     - col 6-12: meta grid (below the lead on mobile; beside it on desktop)
     - col 6-12: portrait (below the meta on mobile; right column on desktop)
     - col 1-12: artist bio (full-width band, below all on mobile) */
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem 2rem;
  align-items: start;
}
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding: 3rem 1.25rem 2rem; gap: 1.75rem; }
}

/* Desktop layout: explicit placement.
   Mobile layout: HTML order is the desired order, so no overrides needed. */
@media (min-width: 801px) {
  .hero__lead  { grid-column: 1 / span 5; grid-row: 1; }
  .hero__meta  { grid-column: 1 / span 5; grid-row: 2; align-self: start; }
  .hero__art   { grid-column: 6 / span 7; grid-row: 1 / span 2; }
  .artist-bio  { grid-column: 1 / -1;    grid-row: 3; margin-top: 0.5rem; }
}
.hero__title { margin: 0; }
.hero__lede { color: var(--ink-soft); font-size: 1.05rem; max-width: 36ch; margin: 1.25rem 0; }
.hero__meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem 1.5rem;
  margin-top: 1.75rem; padding-top: 1.75rem; border-top: 1px solid var(--line);
}
.hero__meta dt { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); margin: 0; }
.hero__meta dd { margin: 0.25rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.hero__art {
  position: relative;
  /* no fixed aspect — let the painting's natural aspect determine box size */
  min-height: 320px;
  background: var(--bg-soft);
  border-radius: 4px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.hero__art img { width: 100%; height: auto; display: block; }

/* Artist bio block — sits inside the hero, directly below the meta grid,
   on the left of the portrait on desktop and directly above it on mobile. */
.artist-bio {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.artist-bio p { color: var(--ink-soft); font-size: 0.98rem; max-width: 60ch; line-height: 1.65; }
.artist-bio a { color: var(--accent); }
.artist-bio a:hover { color: var(--ink); }

/* Pull-quote styling — serif italic, with a left accent rule and large
   opening quotation mark for editorial weight */
.artist-quote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.25rem;
  border-left: 3px solid var(--accent);
}
.artist-quote p {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

/* ---------- Section title ---------- */
.section-title { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 1rem; display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.section-title h2 { margin: 0; }

/* ---------- Category cards (home) ---------- */
.cat-grid {
  max-width: 1200px; margin: 0 auto; padding: 0 1.25rem 3rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem;
}
@media (max-width: 480px) { .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; padding: 0 1rem 2rem; } }
.cat-card {
  position: relative;
  /* no forced aspect ratio — let the painting's natural aspect determine card height */
  min-height: 280px;
  border-radius: 4px; overflow: hidden;
  background: var(--bg-soft);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 350ms ease, box-shadow 350ms ease;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.cat-card img { width: 100%; height: auto; display: block; transition: transform 600ms ease; }
.cat-card:hover img { transform: scale(1.04); }
.cat-card__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 55%);
  display: flex; align-items: flex-end;
  padding: 1.25rem;
  pointer-events: none;        /* let clicks pass through to the <a> */
}
.cat-card__title { color: #fff; font-family: 'Cormorant Garamond', serif; font-size: clamp(1.2rem, 4vw, 1.8rem); margin: 0; line-height: 1.05; }
.cat-card__count { color: rgba(255,255,255,0.75); font-size: 0.72rem; letter-spacing: 0.1em; margin-top: 0.3rem; text-transform: uppercase; }
@media (max-width: 480px) {
  .cat-card { min-height: 200px; }
  .cat-card__overlay { padding: 0.85rem; }
}

/* ---------- Gallery grid (category pages) ---------- */
.gallery {
  max-width: 1400px; margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  columns: 3 320px; column-gap: 1.25rem;
}
@media (max-width: 800px) { .gallery { columns: 1; padding: 1.5rem 1.25rem 3rem; column-gap: 0; } }
@media (min-width: 800px) and (max-width: 1100px) { .gallery { columns: 2; } }
.tile {
  break-inside: avoid; margin-bottom: 2.5rem;        /* big gap between tiles so the caption clearly belongs to the image above it */
  display: block; cursor: pointer;
  border-radius: 4px; overflow: hidden;
  /* no background — let the page bg show through in the tiny gaps the image
     can't fill (e.g. when the image aspect ratio leaves a sliver of padding
     under the caption) */
  transition: transform 350ms ease;
}
.tile:hover { transform: translateY(-2px); }
.tile img { width: 100%; display: block; }
.tile__cap {
  font-size: 0.78rem; color: var(--ink-mute);
  padding: 0.85rem 0.4rem 0.25rem;        /* clear gap above + below + sides */
  letter-spacing: 0.04em;
  line-height: 1.45;
  /* the bottom padding is small because the bigger tile margin below
     provides the actual visual separation between this caption and
     the next painting */
}
.tile__cap strong { color: var(--ink); font-weight: 500; display: block; font-family: 'Cormorant Garamond', serif; font-size: 1rem; word-break: break-word; }
.tile__cap em { font-style: normal; color: var(--ink-mute); }

/* ---------- Detail page (single painting) ---------- */
.detail {
  max-width: 1100px; margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem;
  align-items: start;
}
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; gap: 1.75rem; padding: 1.5rem 1.25rem 3rem; } }
.detail__img {
  background: var(--bg-soft); border-radius: 4px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
}
.detail__img img { width: 100%; height: auto; display: block; }
.detail__meta { min-width: 0; }
.detail__meta h1 { margin: 0; font-size: clamp(1.75rem, 7vw, 3rem); }
.detail__cat { font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem; }
.detail__medium { color: var(--ink-soft); font-size: 1rem; margin: 1rem 0 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.detail__nav {
  display: flex; gap: 0.75rem; justify-content: space-between; align-items: stretch;
  margin-top: 1rem; flex-wrap: wrap;
}
.detail__nav a {
  flex: 1 1 auto; min-width: 0;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.85rem; letter-spacing: 0.04em;
  text-align: center;
  transition: background 200ms, border-color 200ms, color 200ms;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.detail__nav a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.detail__nav .disabled { opacity: 0.35; pointer-events: none; }
.detail__back { display: inline-block; font-size: 0.8rem; letter-spacing: 0.06em; color: var(--ink-mute); margin-bottom: 1.25rem; }
.detail__back:hover { color: var(--ink); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.92);
  display: none; align-items: center; justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; box-shadow: 0 10px 60px rgba(0,0,0,0.5); }
.lightbox__close {
  position: absolute; top: 1rem; right: 1.5rem;
  background: transparent; border: 0; color: #fff;
  font-size: 2rem; cursor: pointer; line-height: 1;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.lightbox__close:hover { background: rgba(255,255,255,0.1); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1200px; margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
  gap: 2.5rem; justify-content: start;
}
@media (max-width: 700px) { .site-footer { grid-template-columns: 1fr; gap: 1.75rem; } }
.site-footer h4 { font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); margin: 0 0 1rem; font-family: 'Inter', sans-serif; font-weight: 500; }
.site-footer p, .site-footer a { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.7; overflow-wrap: anywhere; }
.site-footer a:hover { color: var(--accent); }
/* Subjects are nested under their collection in the footer site map. */
.site-footer .footer-subject { padding-left: 0.9rem; }
.site-footer a.is-active { color: var(--accent); }
.copyright { max-width: 1200px; margin: 0 auto; padding: 1.25rem; color: var(--ink-mute); font-size: 0.78rem; letter-spacing: 0.04em; border-top: 1px solid var(--line); }

/* ---------- Page intro (for category pages) ---------- */
.page-intro { max-width: 1000px; margin: 0 auto; padding: 4rem 1.25rem 1.5rem; }
.page-intro h1 { margin: 0 0 1rem; }
.page-intro p { color: var(--ink-soft); font-size: 1.02rem; max-width: 65ch; }

/* ---------- Breadcrumbs ----------
   The full address of the current page. Every level is a link, the last one
   is the current page. This is the primary "always get back" mechanism. */
.breadcrumbs { border-bottom: 1px solid var(--line); background: var(--bg); }
.breadcrumbs__inner {
  max-width: 1200px; margin: 0 auto; padding: 0.7rem 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  font-size: 0.78rem; color: var(--ink-mute);
}
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .is-current { color: var(--ink); font-weight: 500; }
.breadcrumbs__sep { opacity: 0.45; }

/* ---------- Collection tabs ----------
   Sibling navigation inside one collection. Only rendered when a collection
   actually has subjects, so a flat collection shows no empty bar. */
.col-tabs { border-bottom: 1px solid var(--line); background: var(--bg); }
.col-tabs__inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.25rem;
}
.col-tabs a {
  font-size: 0.85rem; color: var(--ink-mute);
  padding: 0.7rem 0.8rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.col-tabs a:hover { color: var(--ink); }
.col-tabs a.is-active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }

/* ---------- Collection list (home + collections index) ----------
   One row per collection, cover on the left. A list rather than a card grid
   so it looks the same whether the artist has one collection or twenty. */
.col-list {
  max-width: 1200px; margin: 0 auto; padding: 0 1.25rem 3.5rem;
  display: grid; gap: 1.5rem;
}
.col-card {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.75rem; align-items: center;
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--line);
}
.col-card:last-child { border-bottom: 0; padding-bottom: 0; }
.col-card__cover {
  border-radius: 4px; overflow: hidden; background: var(--bg-soft);
  box-shadow: var(--shadow); aspect-ratio: 1 / 1;
}
.col-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.col-card__title {
  font-family: 'Cormorant Garamond', serif; font-weight: 500;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem); line-height: 1.1; margin: 0 0 0.35rem;
}
.col-card:hover .col-card__title { color: var(--accent); }
.col-card__meta {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
}
.col-card__blurb { color: var(--ink-soft); margin: 0.7rem 0 0; max-width: 52ch; font-size: 0.95rem; }
.col-card__more { display: inline-block; margin-top: 0.9rem; font-size: 0.85rem; color: var(--accent); }
@media (max-width: 640px) {
  .col-card { grid-template-columns: 120px 1fr; gap: 1.1rem; }
}

/* ---------- Small text helpers ---------- */
.text-link { color: var(--accent); font-size: 0.9rem; }
.text-link:hover { color: var(--ink); }
.back-link {
  display: inline-block; font-size: 0.8rem; letter-spacing: 0.06em;
  color: var(--ink-mute); margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--ink); }
.page-count {
  color: var(--ink-mute); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; margin: 1rem 0 0;
}
.prose { max-width: 68ch; margin: 0 auto; padding: 0 1.25rem 4rem; }
.prose p { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.75; }
.prose .artist-quote { margin-top: 2rem; }
.contact-line { font-size: 1.05rem; }
.contact-line a { color: var(--accent); }
.contact-line a:hover { color: var(--ink); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Extra-tight phone tweaks (≤ 420px) ---------- */
@media (max-width: 420px) {
  .brand__sub { display: none; }                /* hide "Collection · 2000–2004" subtitle on tiny screens */
  .nav { gap: 0.85rem; }
  .nav a { font-size: 0.78rem; }
  .hero { padding-top: 2rem; }
  .hero__lede { font-size: 1rem; }
  .detail__nav a { font-size: 0.78rem; padding: 0.6rem 0.7rem; }
  .tile__cap strong { font-size: 0.95rem; }
}

/* ===========================================================
   Accessibility additions
   =========================================================== */

/* Skip link — hidden until focused via keyboard tab.
   WCAG 2.4.1 Bypass Blocks. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  z-index: 200;
  text-decoration: none;
  border-bottom-right-radius: 4px;
  transition: top 200ms ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Universal :focus-visible — high-contrast outline for keyboard users.
   Replaces default browser outlines (which some browsers only show on
   keyboard focus, inconsistently). WCAG 2.4.7. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Specific elements that should not have the outline (icon buttons, text inputs) */
.theme-toggle:focus-visible,
.nav-toggle:focus-visible,
.nav-close:focus-visible {
  outline-offset: 4px;
}

/* Honor the user's system theme preference when no localStorage value is set
   AND JS hasn't run yet. Provides a smoother first-paint experience. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e0d0c;
    --bg-soft: #221f1c;
    --bg-elev: #1a1815;
    --ink: #ece6dd;
    --ink-soft: #b8b0a4;
    --ink-mute: #7d7770;
    --line: #2e2a26;
    --accent: #c4a87d;
    --accent-soft: #d9c4a0;
    --shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  }
}

/* Skip-link target — make <main id="main"> focusable but invisible until
   programmatically focused, so the skip link works correctly. */
#main:focus {
  outline: none;
}

/* Make sure the <main> element doesn't inherit a focus outline when scrolled
   to via the skip link */
main:focus-visible {
  outline: none;
}

/* Visually-hidden but accessible to screen readers (used for off-screen
   labels and descriptions) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
