/* ==========================================================================
   Drăcșani — "Modern, cu fir tradițional"
   Design tokens and components: see docs/requirements.md, Part A.
   ========================================================================== */

/* ---------- A2. Colour tokens ---------- */
:root {
  --bg: #FBFAF7;
  --surface: #FFFFFF;
  --surface-alt: #F3EFE7;
  --ink: #191715;
  --muted: #6A625A;
  --line: #E6E0D6;
  --red: #B3171E;
  --red-strong: #8E1117;
  --wheat: #C9962E;
  --forest: #3F5A3A;
  --on-photo: #FFFFFF;
  --header-bg: rgb(255 255 255 / 0.85);
  --shadow-rest: 0 1px 2px rgb(25 23 21 / 0.06);
  --shadow-lift: 0 12px 32px rgb(25 23 21 / 0.12);

  /* motifs: red stitches follow --motif-red, black stitches follow currentColor */
  --motif-red: var(--red);

  /* ---------- A3. Typography ---------- */
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-story: "Literata", Georgia, serif;
  --fs-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --fs-small: 0.875rem;
  --fs-eyebrow: 0.75rem;
  --fs-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
  --fs-h2: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  --fs-title: clamp(2.25rem, 6vw, 4.5rem);
  --fs-hero: clamp(3rem, 10vw, 7.5rem);

  /* ---------- A5. Spacing, radii ---------- */
  --s-1: 4px; --s-2: 8px; --s-3: 16px; --s-4: 24px; --s-5: 32px;
  --s-6: 48px; --s-7: 64px; --s-8: 96px; --s-9: 128px;
  --radius: 14px;
  --radius-pill: 999px;
  --gutter: clamp(16px, 4vw, 48px);
  --content: 1240px;
  --section-gap: clamp(64px, 9vw, 128px);
  --topstrip-h: 32px;
  --header-h: 68px;
  --band-h: 35px;          /* whole band: 27px pattern + 2×1px padding + 2×2px border + 2×1px margin */

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141211;
    --surface: #1D1A18;
    --surface-alt: #24201D;
    --ink: #F2EEE8;
    --muted: #A89F95;
    --line: #35302C;
    --red: #E0484E;
    --red-strong: #F06A6F;
    --wheat: #D8AE52;
    --forest: #8FB287;
    --header-bg: rgb(29 26 24 / 0.85);
    --shadow-rest: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lift: 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--band-h) + 16px); }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; font-optical-sizing: auto; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--s-3); top: -100px; z-index: 100;
  background: var(--red); color: #fff; padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-pill); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s-2); }

.container { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- A4. Motifs ---------- */
/* patterns:start - generated by tools/build-motifs.ps1 */
:root {
  --band-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='9' viewBox='0 0 16 9' shape-rendering='crispEdges'%3E%3Cpath d='M4 0h1v1h-1zM12 0h1v1h-1zM3 1h1v1h-1zM5 1h1v1h-1zM2 2h1v1h-1zM6 2h1v1h-1zM1 3h1v1h-1zM7 3h1v1h-1zM0 4h1v1h-1zM8 4h1v1h-1zM1 5h1v1h-1zM7 5h1v1h-1zM2 6h1v1h-1zM6 6h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1zM4 8h1v1h-1zM12 8h1v1h-1z'/%3E%3C/svg%3E");
  --band-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='9' viewBox='0 0 16 9' shape-rendering='crispEdges'%3E%3Cpath d='M9 1h1v1h-1zM15 1h1v1h-1zM10 2h1v1h-1zM14 2h1v1h-1zM4 3h1v1h-1zM11 3h1v1h-1zM13 3h1v1h-1zM3 4h3v1h-3zM12 4h1v1h-1zM4 5h1v1h-1zM11 5h1v1h-1zM13 5h1v1h-1zM10 6h1v1h-1zM14 6h1v1h-1zM9 7h1v1h-1zM15 7h1v1h-1z'/%3E%3C/svg%3E");
}
/* patterns:end */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.motif { width: 1em; height: 1em; flex: none; color: var(--ink); }
.motif--lg { width: 96px; height: 96px; }

/* A4.2 Stitch rule: a thin row of red crosses, drawn as a mask so it follows the theme */
.stitch-rule {
  display: block;
  width: 144px; height: 8px;
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l5 5M6.5 1.5l-5 5' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") left center / 12px 8px repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l5 5M6.5 1.5l-5 5' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") left center / 12px 8px repeat-x;
}
.stitch-rule--center { margin-inline: auto; }

/* A4.2 Stitch band: rhombus + cross (from trad_01), red and ink layers */
.stitch-band { position: relative; height: 27px; width: 100%; }
.stitch-band::before, .stitch-band::after {
  content: ""; position: absolute; inset: 0;
  -webkit-mask-size: 48px 27px; mask-size: 48px 27px;
  -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
  -webkit-mask-position: center; mask-position: center;
}
.stitch-band::before { background: var(--red); -webkit-mask-image: var(--band-red); mask-image: var(--band-red); }
.stitch-band::after { background: var(--ink); -webkit-mask-image: var(--band-ink); mask-image: var(--band-ink); }

/* A4.3 Stitch-in: rules "stitch themselves" left to right when revealed */
.js .stitch-rule[data-stitch] { background: linear-gradient(to right, var(--red) 50%, transparent 50%) 100% 0 / 200% 100% no-repeat; transition: background-position 600ms var(--ease); }
.js .stitch-rule[data-stitch].is-in { background-position: 0 0; }

/* ---------- A6.1 Top strip ---------- */
.topstrip {
  height: var(--topstrip-h);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.8125rem;
  display: flex; align-items: center;
}
.topstrip .container { display: flex; align-items: center; gap: var(--s-2); }
.topstrip svg { width: 14px; height: 14px; color: var(--forest); flex: none; }
.topstrip .addr-short { display: none; }
@media (max-width: 600px) {
  .topstrip .addr-full { display: none; }
  .topstrip .addr-short { display: inline; }
}

/* ---------- A6.1 Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
          backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms, box-shadow 200ms;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .motif { width: 30px; height: 30px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; line-height: 1; }

/* ---------- A6.2 Menu ---------- */
.nav-list { display: flex; align-items: center; gap: clamp(12px, 1.6vw, 28px); list-style: none; padding: 0; }
.nav-list a {
  position: relative; display: block; padding: 6px 0;
  font-weight: 500; font-size: 0.975rem; text-decoration: none;
  transition: color 150ms;
}
.nav-list a:hover { color: var(--red); }
.nav-list a[aria-current="page"] { color: var(--red); }

/* Desktop: each item shows its section motif centered under the label.
   The current page's motif is in full colour; the others are faded and light up on hover. */
@media (min-width: 961px) {
  .nav-list a { display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; padding: 4px 0 0; }
  .nav-list .motif {
    width: 14px; height: 14px;
    color: var(--muted); --motif-red: var(--muted);
    opacity: 0.45;
    transition: opacity 200ms, color 200ms, transform 300ms var(--ease);
  }
  .nav-list a:hover .motif, .nav-list a:focus-visible .motif { opacity: 1; color: var(--ink); --motif-red: var(--red); }
  .nav-list a[aria-current="page"] .motif { opacity: 1; color: var(--ink); --motif-red: var(--red); }
  .nav-list a:hover .motif { transform: rotate(45deg); }
}

.nav-toggle { display: none; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; }
.nav-toggle svg { width: 24px; height: 24px; }
.nav-toggle:hover { background: var(--surface-alt); }
.drawer-foot { display: none; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; z-index: 61; position: relative; }
  .site-nav {
    position: fixed; inset: 0; z-index: 60;
    background: var(--bg);
    padding: calc(var(--header-h) + var(--s-5)) var(--gutter) var(--s-5);
    display: flex; flex-direction: column; justify-content: space-between;
    overflow-y: auto;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 250ms var(--ease), transform 250ms var(--ease), visibility 0s linear 250ms;
  }
  .site-nav.is-open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list li { border-bottom: 1px solid var(--line); }
  .nav-list a {
    display: flex; align-items: center; gap: var(--s-3);
    padding: 14px 0;
    font-family: var(--font-display); font-weight: 600; font-size: 2rem; letter-spacing: -0.02em;
  }
  .nav-list .motif { display: block; width: 28px; height: 28px; }
  .drawer-foot { display: block; margin-top: var(--s-5); color: var(--muted); font-size: var(--fs-small); }
  body.nav-open { overflow: hidden; }
  /* Without JS the menu stays visible as a plain list */
  .no-js .site-nav { position: static; visibility: visible; opacity: 1; transform: none; padding: 0; background: none; }
  .no-js .nav-toggle { display: none; }
  .no-js .site-header { height: auto; position: static; }
  .no-js .site-header .container { flex-direction: column; align-items: flex-start; padding-block: var(--s-3); }
  .no-js .nav-list { flex-direction: row; flex-wrap: wrap; gap: var(--s-3); }
  .no-js .nav-list li { border: 0; }
  .no-js .nav-list a { font-family: var(--font-ui); font-size: 1rem; padding: 0; }
  .no-js .nav-list .motif, .no-js .drawer-foot { display: none; }
}

/* ---------- Section header (eyebrow, title, stitch rule, intro) ---------- */
.page-head { padding-block: clamp(48px, 7vw, 96px) var(--s-6); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .motif { width: 18px; height: 18px; }
.eyebrow .num { color: var(--wheat); }
.page-title { font-size: var(--fs-title); margin-top: var(--s-3); }
.page-head .stitch-rule { margin-block: var(--s-4); }
.intro { max-width: 65ch; font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); color: var(--muted); line-height: 1.7; }
.intro strong { color: var(--ink); font-weight: 600; }

.section { padding-bottom: var(--section-gap); }
.section-title { font-size: var(--fs-h2); }
.section-head { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-6); }
.section-head .stitch-rule { width: 96px; }

/* ---------- A6.3 Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  height: 80vh; min-height: 480px; max-height: 900px;
  color: var(--on-photo);
  isolation: isolate;
}
.hero-media { position: absolute; inset: -6% 0 -6% 0; z-index: -2; will-change: transform; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgb(12 10 9 / 0.78) 0%, rgb(12 10 9 / 0.35) 45%, rgb(12 10 9 / 0.05) 75%),
    linear-gradient(to right, rgb(12 10 9 / 0.35), transparent 60%);
}
.hero-content { position: absolute; left: 0; right: 0; bottom: calc(var(--band-h) + clamp(32px, 6vw, 72px)); }
.hero .eyebrow { color: rgb(255 255 255 / 0.85); }
.hero-title { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.035em; line-height: 0.95; margin-top: var(--s-3); }
.hero-tagline { margin-top: var(--s-4); max-width: 34ch; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem); line-height: 1.45; color: rgb(255 255 255 / 0.92); }
.hero-cue {
  display: inline-flex; align-items: center; gap: var(--s-2); margin-top: var(--s-5);
  padding: 10px 18px; border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; text-decoration: none; font-weight: 600; font-size: var(--fs-small);
  transition: background 200ms;
}
.hero-cue:hover { background: rgb(255 255 255 / 0.24); }
.hero-cue svg { width: 16px; height: 16px; animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.hero .stitch-band { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bg); }
@media (max-width: 600px) { .hero { height: 70vh; min-height: 440px; } }

/* ---------- A6.4 Founding story ---------- */
.founding { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; padding-top: var(--section-gap); }
.founding-aside { display: flex; flex-direction: column; gap: var(--s-4); position: sticky; top: calc(var(--header-h) + var(--band-h) + 32px); }
.founding-aside .motif--lg { width: clamp(72px, 10vw, 128px); height: clamp(72px, 10vw, 128px); }
.founding-text {
  font-family: var(--font-story); font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.3rem); line-height: 1.8;
  padding-left: clamp(16px, 3vw, 32px); border-left: 2px solid var(--red);
}
.founding-text p::first-letter, .dropcap::first-letter {
  float: left; font-family: var(--font-display); font-weight: 700; color: var(--red);
  font-size: 3.6em; line-height: 0.82; padding: 0.06em 0.1em 0 0;
}
.attribution { margin-top: var(--s-4); padding-left: clamp(16px, 3vw, 32px); font-size: var(--fs-small); color: var(--muted); }
@media (max-width: 760px) {
  .founding { grid-template-columns: 1fr; }
  .founding-aside { position: static; flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- A6.5 Cards: shared ---------- */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-rest);
  transition: transform 300ms var(--ease), box-shadow 300ms var(--ease), border-color 300ms;
  container-type: inline-size;
}
.card-media { position: relative; overflow: hidden; background: var(--surface-alt); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
@media (hover: hover) {
  .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
  .card:hover .card-media img { transform: scale(1.04); }
  .card:hover .card-motif { transform: rotate(45deg); }
}
.card:focus-within { box-shadow: var(--shadow-lift); }
.card-motif { transition: transform 500ms var(--ease); }
.card a { text-decoration: none; }
/* whole-card link: the title link stretches over the card */
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card a:focus-visible { outline: none; }
.card:has(a:focus-visible) { outline: 2px solid var(--red); outline-offset: 3px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: var(--radius-pill);
  background: var(--surface-alt); color: var(--muted);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
}
.chip .motif { width: 14px; height: 14px; }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-small); color: var(--red); }
.more svg { width: 16px; height: 16px; transition: transform 250ms var(--ease); }
.card:hover .more svg { transform: translateX(4px); }

/* ---------- Section cards (home, bento) ---------- */
.bento {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(320px, 30vw, 400px);
}
.bento .card--wide { grid-column: span 2; }
.section-card { border: 0; color: var(--on-photo); background: #221e1b; }
.section-card .card-media { position: absolute; inset: 0; }
.section-card::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to top, rgb(12 10 9 / 0.85) 0%, rgb(12 10 9 / 0.45) 45%, rgb(12 10 9 / 0) 75%);
}
.section-card .card-top { position: absolute; top: var(--s-3); left: var(--s-3); z-index: 1; }
.section-card .chip { background: rgb(255 255 255 / 0.92); color: #191715; }
.section-card .chip .motif { color: #191715; --motif-red: #B3171E; }
.section-card .card-body { position: relative; z-index: 1; margin-top: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.section-card h3 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); }
.section-card p { color: rgb(255 255 255 / 0.88); font-size: 0.975rem; line-height: 1.5; max-width: 42ch; }
.section-card .more { color: #fff; }
.section-card .card-media--motif { display: grid; place-items: center; background: var(--surface-alt); }
.section-card .card-media--motif .motif { width: 55%; height: 55%; opacity: 0.9; }

@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 340px; }
}
@media (max-width: 600px) {
  .bento {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; grid-auto-rows: 420px;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) var(--s-3);
    scroll-padding-inline: var(--gutter); scrollbar-width: none;
  }
  .bento::-webkit-scrollbar { display: none; }
  .bento .card { scroll-snap-align: start; }
  .bento .card--wide { grid-column: auto; }
}

/* ---------- Gallery cards (masonry) ---------- */
.gallery { columns: 4 260px; column-gap: var(--s-4); }
.gallery-card { break-inside: avoid; margin-bottom: var(--s-4); display: block; width: 100%; }
.gallery-open { display: block; width: 100%; padding: 0; cursor: zoom-in; }
.gallery-open .card-media { display: block; }
.gallery-card .card-media img { aspect-ratio: auto; }
.gallery-card:hover figcaption, .gallery-card:focus-within figcaption { opacity: 1; transform: none; }
.gallery-card:hover .zoom, .gallery-card:focus-within .zoom { opacity: 1; }
.gallery-open:focus-visible { outline: none; }
.gallery-card:has(.gallery-open:focus-visible) { outline: 2px solid var(--red); outline-offset: 3px; }
.gallery-card figcaption { pointer-events: none; }
.gallery-card figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: var(--s-5) var(--s-3) var(--s-3);
  background: linear-gradient(to top, rgb(12 10 9 / 0.75), transparent);
  color: #fff; font-weight: 600; font-size: 0.95rem;
  opacity: 0; transform: translateY(6px);
  transition: opacity 250ms var(--ease), transform 250ms var(--ease);
}
.gallery-card:hover figcaption, .gallery-card:focus-visible figcaption { opacity: 1; transform: none; }
@media (hover: none) { .gallery-card figcaption { opacity: 1; transform: none; } }
.gallery-card .zoom {
  position: absolute; top: var(--s-2); right: var(--s-2); z-index: 1;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(255 255 255 / 0.9); color: #191715; opacity: 0; transition: opacity 200ms;
}
.gallery-card .zoom svg { width: 16px; height: 16px; }
.gallery-card:hover .zoom, .gallery-card:focus-visible .zoom { opacity: 1; }
.gallery-card:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- Story cards ---------- */
.story-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.story-card .card-media { aspect-ratio: 4 / 3; }
.story-card .card-body { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); flex: 1; }
.story-card h3 { font-size: var(--fs-h3); line-height: 1.15; }
.story-card .more { margin-top: auto; }
.story-card .media-link { display: block; height: 100%; }

/* B8. Motif card: stories without an image */
.motif-art {
  width: 100%; height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 38%, transparent 38.5%),
    var(--surface-alt);
}
.motif-art .motif { width: 34%; height: auto; aspect-ratio: 1; }
.motif-art--wide .motif { width: 22%; }

/* ---------- Empty state / noscript ---------- */
.empty-state, .noscript-note {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-5); border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); background: var(--surface);
}
.empty-state .motif { width: 32px; height: 32px; }

/* ---------- A6.6 Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(12 10 9 / 0.88);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #fff;
  display: grid; grid-template-rows: 1fr auto; place-items: center;
  opacity: 0; transition: opacity 250ms var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox-stage { width: 100%; height: 100%; display: grid; place-items: center; padding: clamp(56px, 8vw, 80px) clamp(8px, 8vw, 96px) 0; min-height: 0; }
.lightbox-img {
  max-width: 100%; max-height: calc(100vh - 170px); width: auto; height: auto; object-fit: contain;
  border-radius: 8px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.5);
}
.lightbox-caption { padding: var(--s-4) var(--gutter) var(--s-5); text-align: center; display: flex; flex-direction: column; gap: 4px; }
.lightbox-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; }
.lightbox-count { font-size: var(--fs-small); color: rgb(255 255 255 / 0.7); font-variant-numeric: tabular-nums; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.2);
  transition: background 200ms;
}
.lb-btn:hover { background: rgb(255 255 255 / 0.25); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: var(--s-3); right: var(--s-3); }
.lb-prev { left: var(--s-3); top: 50%; transform: translateY(-50%); }
.lb-next { right: var(--s-3); top: 50%; transform: translateY(-50%); }
.lb-btn:focus-visible { outline-color: #fff; }
@media (max-width: 600px) { .lb-prev, .lb-next { top: auto; bottom: var(--s-4); transform: none; } }
body.lightbox-open { overflow: hidden; }

/* ---------- A6.7 Story reader ---------- */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70; height: 8px; pointer-events: none;
}
.reading-progress::before, .reading-progress span {
  content: ""; position: absolute; inset: 0; display: block;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M2 1.5l5 5M7 1.5l-5 5' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") left center / 10px 8px repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M2 1.5l5 5M7 1.5l-5 5' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") left center / 10px 8px repeat-x;
}
.reading-progress::before { background: var(--line); }
.reading-progress span { background: var(--red); clip-path: inset(0 calc(100% - var(--progress, 0%)) 0 0); }

.story { padding-top: clamp(32px, 5vw, 64px); }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: var(--fs-small); color: var(--muted); }
.breadcrumb a { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb .motif { width: 16px; height: 16px; }
.story-header { max-width: 820px; margin-inline: auto; text-align: center; padding-block: var(--s-6) var(--s-5); }
.story-header .breadcrumb { justify-content: center; }
.story-title { font-size: clamp(2rem, 1.4rem + 3vw, 3.75rem); margin-top: var(--s-4); }
.story-header .stitch-rule { margin: var(--s-4) auto; width: 96px; }
.story-meta { color: var(--muted); font-size: var(--fs-small); }
.story-cover { width: fit-content; max-width: min(1040px, 100%); margin: 0 auto var(--s-6); border-radius: var(--radius); overflow: hidden; background: var(--surface-alt); }
.story-cover img { width: auto; max-width: 100%; max-height: min(62vh, 620px); object-fit: contain; }
.story-body {
  max-width: 65ch; margin-inline: auto;
  font-family: var(--font-story); font-size: clamp(1.075rem, 1rem + 0.3vw, 1.2rem); line-height: 1.85;
}
.story-body > * + * { margin-top: 1.1em; }
.story-body p { hyphens: auto; }
.story-body h2, .story-body h3, .story-body h4 { font-size: 1.5rem; margin-top: 1.8em; }
.story-text { white-space: pre-wrap; tab-size: 2em; -moz-tab-size: 2em; }
.story-text--poem { font-style: normal; padding-left: clamp(0px, 4vw, 32px); }
.story-body figure { margin-block: 2em; }
.story-body figure img { margin-inline: auto; border-radius: var(--radius); cursor: zoom-in; max-height: 70vh; width: auto; }
.story-body figure button { display: block; margin-inline: auto; padding: 0; border-radius: var(--radius); }
.story-body a { color: var(--red); }
.story-body ul, .story-body ol { padding-left: 1.4em; }
.story-end { max-width: 65ch; margin: var(--s-6) auto 0; display: flex; justify-content: center; }
.story-end .stitch-rule { width: 72px; }
.back-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 12px 20px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; font-weight: 600; font-size: var(--fs-small);
  transition: border-color 200ms, color 200ms;
}
.back-link:hover { border-color: var(--red); color: var(--red); }
.back-link svg { width: 16px; height: 16px; }
.story-actions { display: flex; justify-content: center; margin-top: var(--s-6); }
.related { padding-top: var(--section-gap); }
.story-error { max-width: 560px; margin: var(--s-8) auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-4); }
.story-error .motif { width: 72px; height: 72px; }

/* ---------- A6.8 Footer ---------- */
.site-footer { margin-top: var(--section-gap); background: var(--surface-alt); }
.site-footer .stitch-band { background: var(--bg); }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s-6);
  padding-block: var(--s-7) var(--s-6);
}
.footer-grid h2 { font-family: var(--font-ui); font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-3); }
.footer-brand .brand .motif { width: 36px; height: 36px; }
.footer-brand .brand-name { font-size: 2rem; }
.footer-brand address { font-style: normal; margin-top: var(--s-3); color: var(--muted); line-height: 1.7; }
.footer-nav { list-style: none; padding: 0; columns: 2; column-gap: var(--s-4); }
.footer-nav a { display: inline-block; padding: 3px 0; text-decoration: none; }
.footer-nav a:hover { color: var(--red); }
.footer-meta { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); color: var(--muted); font-size: var(--fs-small); }
.to-top {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 10px 16px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--fs-small); text-decoration: none;
}
.to-top:hover { border-color: var(--red); color: var(--red); }
.to-top svg { width: 16px; height: 16px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: var(--s-5); } }

/* ---------- A4.3 / A6.5 Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); transition-delay: var(--delay, 0ms); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- A6.9 Page transitions ---------- */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
.topstrip { view-transition-name: topstrip; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; }

/* ---------- NFR-9 Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .stitch-rule[data-stitch] { background: var(--red); }
  .hero-media { transform: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- Print ---------- */
@media print {
  .topstrip, .site-header, .site-footer, .reading-progress, .hero-cue, .story-actions, .related { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Small helpers ---------- */
.founding-aside .section-title { margin-top: var(--s-3); }
.story-loading { text-align: center; padding-block: var(--s-8); color: var(--muted); font-size: var(--fs-small); }
.story-cover button { display: block; width: 100%; padding: 0; cursor: zoom-in; }
.story-cover img { display: block; }
.founding { padding-bottom: var(--section-gap); }
.section-card::before {
  background: linear-gradient(to top, rgb(12 10 9 / 0.92) 0%, rgb(12 10 9 / 0.6) 40%, rgb(12 10 9 / 0.1) 72%, rgb(12 10 9 / 0) 100%);
}
.section-card h3, .section-card p { text-shadow: 0 1px 12px rgb(0 0 0 / 0.35); }

/* The blur lives on a pseudo-element: backdrop-filter on .site-header itself would make it
   the containing block of the fixed mobile drawer and trap the drawer inside the header bar. */
.site-header { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
          backdrop-filter: blur(12px) saturate(1.4);
}
.hero-title, .page-title, .section-title, .story-title, .brand-name, .lightbox-title {
  font-family: var(--font-display); font-optical-sizing: auto;
}
.hero-title, .page-title, .section-title, .story-title { font-weight: 650; letter-spacing: -0.02em; line-height: 1.05; }
.hero-title { font-weight: 700; letter-spacing: -0.035em; line-height: 0.95; }

/* Stitch band under the menu, on every page (part of the sticky header) */
.site-header { height: auto; border-bottom: 0; }
.site-header .container { height: var(--header-h); }
.site-header::before { bottom: 0; }
.stitch-band {
  box-sizing: content-box;
  height: 27px;
  padding-block: 1px;
  border-block: 2px solid var(--ink);
  margin-block: 1px;
  background-clip: padding-box;
}
.stitch-band::before, .stitch-band::after { inset: 1px 0; }
.stitch-band--header { background: var(--bg); }
.site-header.is-scrolled .stitch-band--header { box-shadow: 0 6px 12px -8px rgb(25 23 21 / 0.18); }
.no-js .site-header .container { height: auto; }
