/* thesetdecorator.com — mobile-first, theme-driven. */

:root {
  --bg: #0e0e0e;
  --fg: #f1ece2;
  --muted: #b8ad99;
  --accent: #c9a96e;
  --rule: rgba(255,255,255,0.08);
  --card: #181613;
  --cleared: #6ea36e;
  --cols: 260px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui: 'Inter', system-ui, sans-serif;
  --rad-card: 14px;
  --rad-pill: 999px;
  --pad-section: 1.5rem;
}

/* Theme bands driven by the four sliders. */
[data-theme="period"]        { --bg:#f4ece0; --fg:#1d1612; --muted:#5b4a3a; --accent:#7a3b2e; --card:#fffdf6; --rule:rgba(0,0,0,0.08); }
[data-theme="regency"]       { --bg:#f7eedf; --fg:#1d1812; --muted:#6a5947; --accent:#9a6b3a; --card:#fffcef; --rule:rgba(0,0,0,0.08); }
[data-theme="mid-century"]   { --bg:#0d3b3d; --fg:#f6ecd1; --muted:#bfae84; --accent:#d97742; --card:#13494b; --rule:rgba(255,255,255,0.1); }
[data-theme="new-hollywood"] { --bg:#1b1208; --fg:#f3e2c4; --muted:#b59867; --accent:#d49a3b; --card:#241808; --rule:rgba(255,255,255,0.08); }
[data-theme="film-noir"]     { --bg:#0e0e0e; --fg:#f1ece2; --muted:#b8ad99; --accent:#c9a96e; --card:#181613; }
[data-theme="contemporary"]  { --bg:#fafafa; --fg:#111; --muted:#6b6b6b; --accent:#1e6cff; --card:#fff; --rule:rgba(0,0,0,0.08); }
[data-theme="brutalist"]     { --bg:#101010; --fg:#fff; --muted:#888; --accent:#ff3300; --card:#1a1a1a; --font-display:'Inter',sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }

a { color: var(--fg); }
.btn, button.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--rad-pill);
  color: var(--fg);
  background: transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--bg); }
.btn:hover { background: var(--accent); color: var(--bg); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit; color: var(--fg);
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 0.5rem 0.7rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Header — GUCCI top bar pattern: hamburger left, wordmark centered, account right.
   FIXED (not sticky) so it survives ancestors that have overflow:hidden /
   contain / transform — those break sticky silently. Pinned at the top of
   the viewport on every page; body gets a matching padding-top so content
   never underlaps. 3-column grid keeps the wordmark optically centered
   regardless of the left/right slot widths. */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--bg); z-index: 50;
  gap: 0.6rem;
}
/* Header height that body reserves space for. Mobile breakpoint at the
   bottom of this file overrides --header-h so we don't waste vertical
   room on phones. Pages whose header floats transparently over a hero
   (home page) get an override via :has() so the hero is full-bleed. */
:root { --header-h: 80px; }
body { padding-top: var(--header-h); }
body:has(> .site-header.over-hero) { padding-top: 0; }
.site-header > .site-nav { position: absolute; }
/* GUCCI 3-column top bar: [≡ MENU]  ·  the set decorator  ·  [account]
   Implemented via grid-column on the children — no order: tricks needed.
   The wordmark stays optically centered no matter how wide the side slots
   grow (e.g. when JS injects an "ACCOUNT" label later). */
.logo {
  grid-column: 2; justify-self: center;
  font-size: 1.5rem;
  /* Rotating accent per session — main.js sets --logo-accent at boot from
     a 6-color cinematic palette and stashes the pick in sessionStorage so
     it stays stable across navigation. Falls back to --accent (burgundy)
     if JS is off. Standing rule: brand display = domain stem (no TLD,
     no fake names) — only the COLOR rotates, the text stays "The Set
     Decorator". */
  color: var(--logo-accent, var(--accent));
  text-decoration: none;
  font-family: var(--font-display); font-weight: 700;
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 48px; padding: 6px 0; /* WCAG 2.5.5 — 48px tap target */
  letter-spacing: .01em;
  transition: color .25s ease;
}
/* Glyph hidden by default in the Gucci layout — wordmark is the mark.
   A rotating-color monogram will come back here in the next iteration
   (graphic-designer skill review pending Steve sign-off on the palette). */
.logo svg, .logo img { display: none; }
.logo.has-glyph svg, .logo.has-glyph img { width: 36px; height: 36px; display: block; }
.logo-mark { display: none; } /* legacy ◐ mark — now drawn by SVG */
/* Hamburger — Gucci ≡ MENU is the universal default. 3 hairline bars +
   uppercase letterspaced "MENU" label, top-left of the grid. The label is
   injected by main.js at boot so 32 existing .html files don't need touching. */
.hamburger {
  grid-column: 1; justify-self: start;
  background: transparent; border: 0; cursor: pointer;
  height: 48px; min-width: 88px; width: auto;
  display: inline-flex; flex-direction: row; align-items: center;
  justify-content: center; gap: 10px; padding: 8px 14px;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}
.hamburger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hamburger:hover .hamburger-label { color: var(--accent); }
/* Legacy markup: three sibling <span>s inside .hamburger become the bars.
   New markup wraps them in .hamburger-bars + adds .hamburger-label sibling. */
.hamburger > span { display: block; height: 1px; width: 22px; background: var(--fg); border-radius: 2px; }
/* 3 hairline bars stacked. Explicit height + flex-shrink:0 on the spans
   so the column-flex doesn't crush them to 0 (inline-flex column with no
   height + default flex-shrink:1 = collapses to 1px tall container). */
.hamburger .hamburger-bars {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 22px; height: 14.5px; flex-shrink: 0;
}
.hamburger .hamburger-bars span {
  display: block; width: 22px; height: 1.5px;
  background: var(--fg); border-radius: 1px; flex-shrink: 0;
}
.hamburger .hamburger-label {
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--fg);
  transition: color .15s;
}
/* Account icon — Gucci-style line-art bust silhouette, far right of the bar.
   Click → /account (placeholder route until real auth lands). currentColor
   so it inherits palette including over-hero white state. */
.account-link {
  grid-column: 3; justify-self: end;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; min-width: 48px; padding: 8px 14px;
  color: var(--fg); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.account-link:hover, .account-link:focus-visible { color: var(--accent); }
.account-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.account-link svg { width: 22px; height: 22px; display: block; stroke: currentColor; }
/* Icon-only by debate-team-fast consensus 2026-05-13 — no "ACCOUNT" label.
   Gucci's own account glyph is silent. A bust silhouette is unambiguous
   on its own; the hamburger keeps its "MENU" label because three bars
   alone are ambiguous (hamburger / grid / settings). */
@media (max-width: 700px) {
  .account-link { min-width: 44px; padding: 8px 10px; }
}

/* Gucci header: pinned over the hero, transparent until you scroll. */
.site-header.over-hero {
  position: fixed; top: 0; left: 0; right: 0;
  background: transparent; border-bottom: 0;
  z-index: 20;
  transition: background .25s ease, border-color .25s ease;
}
.site-header.over-hero .logo,
.site-header.over-hero .hamburger-label,
.site-header.over-hero .hamburger span,
.site-header.over-hero .hamburger-bars span,
.site-header.over-hero .account-link,
.site-header.over-hero .account-link-label { color: #fff; }
.site-header.over-hero .hamburger > span,
.site-header.over-hero .hamburger-bars span { background: #fff; }
.site-header.over-hero.scrolled {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.site-header.over-hero.scrolled .logo,
.site-header.over-hero.scrolled .hamburger-label,
.site-header.over-hero.scrolled .account-link,
.site-header.over-hero.scrolled .account-link-label { color: var(--fg); }
.site-header.over-hero.scrolled .hamburger > span,
.site-header.over-hero.scrolled .hamburger-bars span { background: var(--fg); }
/* Nav opens as a dropdown panel anchored to the upper-LEFT (matches the
   Gucci layout where the hamburger is also upper-left). The 16 items always
   live inside this drawer — never spill into a horizontal strip. Tick
   2026-05-12 fix: explicit overflow-y so the long list scrolls inside the
   drawer instead of running off the viewport. */
.site-nav {
  position: absolute; top: 100%; left: 0; right: auto;
  min-width: min(280px, 92vw);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--bg); padding: 1rem 1.25rem;
  border: 1px solid var(--rule); border-top: 0;
  border-bottom-right-radius: var(--rad-card);
  display: flex !important; flex-direction: column !important; gap: 0.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  order: 2;
  z-index: 12;
}
/* The [hidden] attribute must beat display:flex above — otherwise the nav
   shows all the time and the hamburger toggle is a no-op. */
.site-nav[hidden] { display: none !important; }
.site-nav a { text-decoration: none; font-weight: 500; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--rule); }
.site-nav a:last-child { border-bottom: 0; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); }

/* Hero */
.hero {
  position: relative;
  min-height: 60vh;
  display: grid; place-items: end start;
  padding: 1.5rem;
  overflow: hidden;
}
.hero-image {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.8)),
    radial-gradient(circle at 30% 30%, #2c1a0b, #0e0e0e 70%);
  background-size: cover; background-position: center;
}
[data-theme="contemporary"] .hero-image { background: linear-gradient(180deg, rgba(255,255,255,0), rgba(0,0,0,0.4)), radial-gradient(circle at 30% 30%, #e0d3bc, #cfc4a8 70%); }
.hero-wordmark { position: relative; max-width: 30ch; z-index: 1; }
.hero-wordmark h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  margin: 0 0 0.4rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.hero-tagline { margin: 0; color: var(--muted); font-size: 1rem; }

/* Rails */
.rail { display: grid; gap: 1rem; padding: var(--pad-section); }
.rail-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--rad-card);
  padding: 1.25rem;
}
.rail-card h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 0.5rem; }
.rail-card p { color: var(--muted); margin: 0 0 1rem; }

/* Slider panel */
.theme-panel { padding: var(--pad-section); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.theme-panel h2 { font-family: var(--font-display); margin: 0 0 0.4rem; }
.slider-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1rem; }
.slider-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.slider-grid input[type=range] { width: 100%; accent-color: var(--accent); }
.slider-grid output { color: var(--fg); font-weight: 500; }

/* Recent + generic grid sections */
.recent, .section { padding: var(--pad-section); }
.rail-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.rail-header h2 { font-family: var(--font-display); margin: 0; }
.grid-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Card grid */
.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(var(--cols), 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-img { aspect-ratio: 4 / 5; background: #1a1a1a center/cover no-repeat; position: relative; overflow: hidden; }
.card-img.video { aspect-ratio: 16 / 9; }
/* Universal hover-preview: 3x3 tile-repeat of the same image reveals seamless-pattern structure.
   Excludes .video (which already uses ::after for the play arrow). Matches wallco-ai pattern
   (reference: wallco-ai/public/css/site.css:347-385). */
.card-img:not(.video)::after{content:"";position:absolute;inset:0;background-image:var(--card-bg,none);background-repeat:repeat;background-size:33.33% 33.33%;background-position:center;opacity:0;transition:opacity 360ms ease;pointer-events:none}
.card:hover .card-img:not(.video)::after,.design-card:hover .card-img:not(.video)::after,.card-link:focus-visible .card-img:not(.video)::after{opacity:1}
@media (prefers-reduced-motion: reduce){.card-img:not(.video)::after{transition:none}}
.card-source-badge {
  position: absolute; bottom: 8px; left: 8px; z-index: 2;
  padding: 2px 7px; border-radius: 4px;
  font: 600 9px/1.4 var(--font-ui, system-ui); letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.62); color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
}
.card-artist-link {
  background: transparent; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 2px; transition: text-decoration-color 0.12s;
}
.card-artist-link:hover, .card-artist-link:focus-visible {
  text-decoration-color: var(--accent); color: var(--accent);
  outline: none;
}
.active-pill {
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  padding: 0.32rem 0.65rem 0.32rem 0.75rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 999px;
  font: 500 0.8rem var(--font-ui, system-ui); letter-spacing: 0.02em;
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.active-pill:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.active-pill-key { font-size: 0.7rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.06em; }
.active-pill:hover .active-pill-key { opacity: 0.85; }
.active-pill-x { font-size: 0.78rem; opacity: 0.55; margin-left: 0.15rem; }
.active-pill:hover .active-pill-x { opacity: 1; }
.card-img.video::after {
  content: '▶'; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,0.85); font-size: 2.6rem; text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.card-body { padding: 0.85rem; }
.card-body h3 { margin: 0 0 0.25rem; font-size: 1rem; line-height: 1.25; }
.card-body p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.card-body p.file-meta { margin: 0.25rem 0 0.5rem; color: var(--muted); font-size: 0.72rem; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.02em; opacity: 0.85; }
.pill {
  display: inline-block; padding: 0.18rem 0.55rem; border-radius: var(--rad-pill);
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em;
  background: var(--cleared); color: #0f1f10; margin-top: 0.4rem;
}
.pill.editorial { background: #d9b14e; color: #2a1e08; }
.pill.handoff { background: #4f6f9a; color: #f0f6ff; }

/* Filter rail (used on /catalog, /sdsa, /videos, /vintage) */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: var(--pad-section);
}
.filter-rail {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--rad-card);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.85rem;
  position: sticky; top: 80px;
}
.filter-rail h3 { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 1.1rem; }
.filter-rail label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }

/* Collapsible filter rail — mobile defaults closed, desktop CSS force-opens via @media below. */
.filter-collapse { display: contents; }
.filter-collapse > .filter-summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 0.85rem; margin: -0.25rem 0 0.25rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  font: 600 0.95rem var(--font-ui, var(--font-display, system-ui)); color: var(--fg);
}
.filter-collapse > .filter-summary::-webkit-details-marker { display: none; }
.filter-collapse .filter-summary-label { font-family: var(--font-display); font-size: 1.05rem; }
.filter-collapse .filter-badge {
  padding: 1px 8px; background: var(--accent); color: var(--bg);
  font: 10px var(--font-ui); border-radius: 999px; letter-spacing: .04em; font-weight: 600;
}
.filter-collapse .filter-clear {
  padding: 3px 9px; background: transparent; border: 1px solid var(--rule); color: var(--muted);
  font: 11px var(--font-ui); border-radius: 6px; cursor: pointer; letter-spacing: .04em;
  margin-left: auto;
}
.filter-collapse .filter-chevron {
  margin-left: auto; transition: transform 0.18s ease; color: var(--muted); font-size: 0.85rem;
}
.filter-collapse[open] .filter-chevron { transform: rotate(180deg); }
/* When summary has a Clear-all visible, chevron sits after it (margin-left:auto on .filter-clear pushes both right). */
.filter-collapse .filter-clear + .filter-chevron { margin-left: 0.4rem; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: none; place-items: center; padding: 1rem; z-index: 100;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--card); color: var(--fg); border-radius: var(--rad-card);
  max-width: 720px; width: 100%; max-height: 90vh; overflow: auto;
  border: 1px solid var(--rule);
}
.modal header { display: flex; justify-content: space-between; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule); }
.modal header h2 { margin: 0; font-family: var(--font-display); font-size: 1.4rem; }
.modal .close { background: transparent; border: 0; color: var(--fg); font-size: 1.4rem; cursor: pointer; }
.modal main { padding: 1.25rem; display: grid; gap: 1rem; }
.modal img { border-radius: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.8rem; font-size: 0.9rem; }
.kv dt { color: var(--muted); }

/* Forms (print flow) */
.flow { display: grid; gap: 1rem; padding: var(--pad-section); }
.flow .step { background: var(--card); border: 1px solid var(--rule); border-radius: var(--rad-card); padding: 1.25rem; }
.flow .step h3 { font-family: var(--font-display); margin: 0 0 0.6rem; }
.options { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.options label { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; }
.options input[type=radio] { accent-color: var(--accent); }

/* Stories (magazine) */
.stories-list { display: grid; gap: 1.25rem; padding: var(--pad-section); }
.story-card {
  display: grid; grid-template-columns: 1fr; gap: 0.5rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--rad-card);
  padding: 1.25rem;
}
.story-card h3 { font-family: var(--font-display); margin: 0; font-size: 1.35rem; }
.story-card .dek { color: var(--muted); margin: 0; }
.story-card .meta { font-size: 0.8rem; color: var(--muted); }
.story-body { max-width: 70ch; margin: 0 auto; padding: var(--pad-section); }
.story-body h1 { font-family: var(--font-display); }
.story-body p { line-height: 1.7; font-size: 1.05rem; }

/* Credit wall — film titles whose pieces we've documented (above footer). */
.credit-wall {
  background: var(--bg);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 2rem 1rem;
  max-width: 1280px;
  margin: 0 auto;
}
.credit-wall-eyebrow {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.credit-wall-lede {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--fg);
  margin: 0 auto 1.25rem;
  max-width: 60ch;
  line-height: 1.5;
}
.credit-wall-titles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 0.85rem;
  row-gap: 0.4rem;
}
.credit-wall-titles .ttl {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap;
}
.credit-wall-titles .sep {
  color: var(--rule);
  font-size: 0.95rem;
  user-select: none;
}
.credit-wall-more {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule);
  padding-bottom: 0.15rem;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
}
.credit-wall-more:hover { color: var(--fg); }

/* Footer */
footer { padding: 2rem 1.5rem; text-align: center; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--rule); }

/* Visually hidden (for sr-only labels) */
.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; }

/* Breakpoints */
@media (min-width: 720px) {
  .slider-grid { grid-template-columns: repeat(2, 1fr); }
  .rail { grid-template-columns: repeat(2, 1fr); }
  /* On wider screens keep the hamburger-driven dropdown rather than force-showing every tab. */
  .layout { grid-template-columns: 240px 1fr; }
  /* Desktop: filter rail is always expanded; hide the summary toggle entirely. */
  .filter-collapse > .filter-summary { display: none; }
  .filter-collapse > :not(.filter-summary) { display: revert; }
}
@media (min-width: 1080px) {
  .slider-grid { grid-template-columns: repeat(4, 1fr); }
  .rail { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 3rem; min-height: 70vh; }
  .story-card { grid-template-columns: 1fr 240px; align-items: start; }
  .layout { grid-template-columns: 280px 1fr; }
}

/* ───────── Floating-window manager ───────── */

#wm-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
}
.fwindow {
  position: absolute;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
  display: flex; flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  min-width: 320px; min-height: 240px;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}
.fwindow.dragging { box-shadow: 0 36px 90px rgba(0,0,0,0.6); transform: scale(1.01); cursor: grabbing; }
.fwindow.merge-target { outline: 2px solid var(--accent); outline-offset: -2px; }

.fwindow-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0));
  border-bottom: 1px solid var(--rule);
  padding: 0.45rem 0.6rem 0.45rem 0.85rem;
  user-select: none;
  cursor: grab;
  gap: 0.5rem;
}
.fwindow-header:active { cursor: grabbing; }

.fwindow-tabs {
  display: flex; gap: 0.25rem; flex-wrap: nowrap; overflow-x: auto;
  flex: 1; min-width: 0;
}
.fwindow-tabs::-webkit-scrollbar { height: 6px; }

.fwindow-tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.85rem; font-weight: 500;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer; white-space: nowrap;
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis;
}
.fwindow-tab:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.fwindow-tab.active { color: var(--fg); background: rgba(255,255,255,0.08); border-color: var(--rule); }
.fwindow-tab-close {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  color: var(--muted); font-size: 0.9rem; line-height: 1;
  cursor: pointer;
}
.fwindow-tab-close:hover { background: rgba(255,255,255,0.12); color: var(--fg); }

.fwindow-controls { display: flex; gap: 0.2rem; flex-shrink: 0; }
.fwindow-btn {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 1rem; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-grid; place-items: center;
}
.fwindow-btn:hover { background: rgba(255,255,255,0.08); color: var(--fg); }
.fwindow-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.fwindow-body {
  flex: 1; overflow: auto;
  padding: 1rem 1.1rem;
}
.fwindow-body img { border-radius: 10px; }

.fwindow-resize {
  position: absolute; right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 60%, transparent 60%, transparent 70%, var(--muted) 70%, var(--muted) 80%, transparent 80%);
  opacity: 0.5;
}
.fwindow-resize:hover { opacity: 1; }

/* Edge dock hint overlay */
#wm-dock-hint {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 49;
}
#wm-dock-hint.wm-dock-hint-left   { background: linear-gradient(90deg, rgba(201,169,110,0.18) 0%, rgba(201,169,110,0) 30%); }
#wm-dock-hint.wm-dock-hint-right  { background: linear-gradient(-90deg, rgba(201,169,110,0.18) 0%, rgba(201,169,110,0) 30%); }
#wm-dock-hint.wm-dock-hint-top    { background: linear-gradient(180deg, rgba(201,169,110,0.18) 0%, rgba(201,169,110,0) 30%); }
#wm-dock-hint.wm-dock-hint-bottom { background: linear-gradient(0deg,   rgba(201,169,110,0.18) 0%, rgba(201,169,110,0) 30%); }

/* Touch fallback — turn floating windows into a vertical scrolling stack */
.wm-touch .fwindow {
  position: relative !important;
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: auto !important; max-height: 90vh;
  margin: 1rem 0;
  box-shadow: none;
  border-radius: 12px;
}
.wm-touch #wm-layer {
  position: fixed; inset: auto 0 0 0;
  height: 100vh; overflow-y: auto;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  pointer-events: auto;
  padding: 1rem;
}
.wm-touch #wm-layer:empty { display: none; }
.wm-touch .fwindow-resize, .wm-touch .fwindow-header { cursor: default; }

/* Window-manager toolbar (Tile / Close-All / Compare) */
.wm-toolbar {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.25rem;
}
.wm-toolbar .btn { padding: 0.35rem 0.8rem; font-size: 0.8rem; border-radius: 999px; }

/* Compare-mode hint */
.compare-mode .card { outline-offset: -2px; }
.compare-mode .card:hover { outline: 2px dashed var(--accent); }

/* WCAG 2.4.1 — Skip to main content (first focusable on every page).
   Canonical clip-rect sr-only pattern. The previous transform-based hide
   was leaking into normal flow on some bands (visible "Skip to main
   content" text at the top of the page). This pattern is bulletproof
   because clip + clip-path force zero render box regardless of band CSS. */
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  background: var(--accent, #c9a96e);
  color: var(--bg, #1a1814);
  z-index: 99999;
  font: 13px/1.2 var(--font-ui, system-ui, sans-serif);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  position: fixed;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  width: auto; height: auto;
  padding: 10px 18px; margin: 0;
  overflow: visible;
  clip: auto; clip-path: none;
  border-radius: 6px;
  outline: 2px solid var(--bg, #1a1814);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Mobile fixes — TSD-wide responsive rules. Most pages render in a single
   column at narrow widths already; these tune touch targets, kill wasted
   vertical space, and make filter forms breathe.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root {
    --pad-section: 1rem;
    --rad-card: 12px;
  }
  /* Hero takes 40vh on mobile instead of 60vh — frees a screen of content */
  .hero { min-height: 40vh; padding: 1.25rem; }
  .hero-wordmark h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .hero-tagline { font-size: 0.92rem; line-height: 1.4; }

  /* Header gets a little tighter so it doesn't eat real estate */
  .site-header { padding: 0.75rem 1rem; }
  .logo { font-size: 1.3rem; gap: 0.4rem; }
  .logo svg { width: 30px; height: 30px; }
  /* Mobile header is shorter — shrink the body offset to match. */
  :root { --header-h: 64px; }

  /* All form inputs hit 48px min-height on mobile (Apple HIG + WCAG 2.5.5).
     Padding bumped so placeholder text actually fits. */
  input, select, textarea {
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    font-size: 16px;   /* Prevents iOS Safari auto-zoom on focus */
  }
  input[type=range] { min-height: auto; padding: 0; }
  input[type=checkbox], input[type=radio] { min-height: auto; }
  .btn, button.btn, button.primary, button[type=submit] {
    min-height: 48px;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
  }

  /* Rails / card grids: stack to 2 columns max on mobile, never 3+ */
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .card-body { padding: 0.7rem; }
  .card-body h3 { font-size: 0.95rem; }
  .card-body p { font-size: 0.78rem; }

  /* Sections: tighter padding so we see more content per scroll */
  .rail, .section { padding: 1.25rem 1rem; }
  .rail-header h2 { font-size: 1.45rem; }

  /* Step grids (3-column "How it works") collapse to single column */
  .flow { grid-template-columns: 1fr; }

  /* Filter rows in forms: stack labels full-width, prevent input cramping */
  .step label, .step .col, .filters > * { flex-basis: 100% !important; min-width: 0; }
  .step > div[style*="display:flex"], .step > div[style*="display: flex"] {
    flex-direction: column;
    align-items: stretch;
  }

  /* Modals: more screen real estate on mobile */
  .modal-back > .modal, .modal-back > div { padding: 18px !important; max-width: 100% !important; }

  /* Tables (if any) get horizontal scroll instead of squishing */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Phone — extra-narrow tweak (small iPhone SE, etc.) */
@media (max-width: 380px) {
  .hero-wordmark h1 { font-size: 1.7rem; }
  .card-grid { grid-template-columns: 1fr; }
  .logo span { display: none; }   /* drop wordmark text, keep SVG */
}

/* WCAG 2.3.3 — prefers-reduced-motion shotgun.
   Neutralizes all transitions + keyframe animations site-wide for OS-level
   reduce-motion users. Animations still fire (state still changes) but don't
   visually animate. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .skip-link { transition: none; }
}
