/* danysaad.com — design tokens + base styles.
   SITE v4 «NOCTURNE» (Addendum 26, 2026-07-10): Direction B applied
   site-wide — full-bleed rooms, one idea per viewport, glass panels,
   cinematic dark theme. LIGHT is the DEFAULT on an OFF-WHITE base
   (26.2 amends Addendum 24's "warm cream"); dark is B's charcoal
   night translation. Accent = SOFT ELEGANT GREEN (R1) — default =
   SAUGE BRUMEUSE pending the operator's G1 pick
   (GREEN_PROPOSAL_2026-07-10.md; swap = this token block only).
   Brass/gold/beige/brown are DEAD (R1). Typography: Instrument Serif
   (display, italic voice) · Inter w/ tabular-nums (UI/data) ·
   JetBrains Mono (metrics). Fonts vendored (zero runtime egress).
   Theme init/toggle = the ruled Base.astro inline script; the ONLY
   other client JS is the scroll-expansion hero island (ruled
   exception 26.7, hero-scoped). */

:root {
  color-scheme: light; /* Dany: light-only cream/emerald, 2026-09-04 */
  /* ---- LIGHT (default) — off-white gallery at daylight ---- */
  --paper: #f5ecd9;
  --paper-raised: #fff8e9;
  --paper-recessed: #eee3cd;
  --ink: #073d31;         /* body text — ~15.7:1 on paper */
  --ink-2: #395b4e;       /* secondary — ~7.4:1 */
  --ink-3: #4b6555;       /* muted, labels — ≥4.8:1 on every light surface (AA; darkened from #7a766c 2026-07-12, audit) */
  --accent: #007353;      /* sauge brumeuse — CTAs, data-positives (G1 pending) */
  --accent-line: #00563e; /* hover / decorative rules */
  --hairline: #d5cfb8;
  --glass-bg: rgb(245 236 217 / 0.96); /* header chrome — 0.55→0.88 so nav ink holds ≥4.5:1 over dark media (audit 2026-07-12) */
  --glass-border: rgb(28 27 24 / 0.12);
  --scrim: rgb(12 12 14 / 0.4);
  --grid-line: rgb(28 27 24 / 0.05);
  --grain-opacity: 0.035;
  /* room-media set grade (R3: the sequence reads as ONE set) */
  --room-grade-sat: 0.92;
  --room-veil: rgb(245 244 240 / 0.06);

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
  --measure: 62ch;
  --container: 1180px;
  --gap: clamp(3.5rem, 9vw, 7.5rem); /* section rhythm — enormous negative space */
}

/* ---- DARK — B's cinematic charcoal (keep in step with the no-JS block) ---- */
:root[data-theme='dark'] {
  --paper: #0b0b0d;
  --paper-raised: #141417;
  --paper-recessed: #0e0e11;
  --ink: #efece4;
  --ink-2: #b6b1a5;
  --ink-3: #857f72;
  --accent: #a3bca4;      /* sauge, moonlit (G1 pending) */
  --accent-line: #c9d9c9;
  --hairline: rgb(255 255 255 / 0.09);
  --glass-bg: rgb(14 14 17 / 0.85);
  --glass-border: rgb(244 242 237 / 0.14);
  --scrim: rgb(0 0 0 / 0.5);
  --grid-line: rgb(255 255 255 / 0.045);
  --grain-opacity: 0.05;
  --room-grade-sat: 0.88;
  --room-veil: rgb(11 11 13 / 0.12);
}

/* No-JS visitors: honor the system preference (the inline script
   overrides this by always stamping data-theme). Values duplicate the
   dark set above — keep in step. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) {
    --paper: #0b0b0d;
    --paper-raised: #141417;
    --paper-recessed: #0e0e11;
    --ink: #efece4;
    --ink-2: #b6b1a5;
    --ink-3: #857f72;
    --accent: #a3bca4;
    --accent-line: #c9d9c9;
    --hairline: rgb(255 255 255 / 0.09);
    --glass-bg: rgb(14 14 17 / 0.85);
    --glass-border: rgb(244 242 237 / 0.14);
    --scrim: rgb(0 0 0 / 0.5);
    --grid-line: rgb(255 255 255 / 0.045);
    --grain-opacity: 0.05;
    --room-grade-sat: 0.88;
    --room-veil: rgb(11 11 13 / 0.12);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

img, svg, video { max-width: 100%; height: auto; display: block; }

/* theme-conditional assets (logo + paired room media) */
:root[data-theme='dark'] .light-only { display: none; }
:root:not([data-theme='dark']) .dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) .light-only { display: none; }
  :root:not([data-theme='light']):not([data-theme='dark']) .dark-only { display: block; }
}

/* ---------- type scale — B's display voice (serif, italic accents) ---------- */

h1, h2, h3, .display {
  font-family: var(--serif);
  font-weight: 400; /* Instrument Serif ships one weight */
  font-synthesis-style: none; /* the italic voice is the REAL italic face or nothing — never faux-oblique (audit 2026-07-12) */
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); font-style: italic; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-style: italic; }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.55rem); }

p { max-width: var(--measure); color: var(--ink); }
.lede { font-size: 1.15rem; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* small-caps letterspaced kicker (SectionLabel is the primitive form) */
.kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kicker::before {
  content: '';
  display: inline-block;
  width: 1.6rem;
  height: 1px;
  background: var(--accent-line);
  vertical-align: middle;
  margin-right: 0.6rem;
}

a {
  color: inherit;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  transition: color 150ms ease-out, text-decoration-color 150ms ease-out;
}
a:hover { color: var(--accent); }

/* ---------- layout primitives ---------- */

.container { width: min(var(--container), 92vw); margin-inline: auto; }
.band { padding-block: var(--gap); }
.band + .band { border-top: 1px solid var(--hairline); }
.band--recessed { background: var(--paper-recessed); }
.band--raised { background: var(--paper-raised); }

/* Addendum 28: on subsection pages, every second band carries a SLEEK
   TEXTURE on the black (dark) / off-white (light) ground — a fine
   diagonal weave + soft sheen, pure CSS, deliberately near-subliminal.
   PROPOSED pattern pending the operator's reference ("I'll tag you"):
   swapping it = these two background-image lines only. */
.band--recessed {
  background-image:
    repeating-linear-gradient(115deg,
      var(--weave-line) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, var(--weave-sheen), transparent 60%);
}
:root { --weave-line: rgb(28 27 24 / 0.030); --weave-sheen: rgb(255 255 255 / 0.25); }
:root[data-theme='dark'] { --weave-line: rgb(244 242 237 / 0.035); --weave-sheen: rgb(255 255 255 / 0.02); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) {
    --weave-line: rgb(244 242 237 / 0.035); --weave-sheen: rgb(255 255 255 / 0.02);
  }
}

.grid-2 { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: start; }
.grid-3 { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }

.stack > * + * { margin-top: 1.1rem; }
.stack-lg > * + * { margin-top: 2rem; }

/* ---------- surface utilities ---------- */

.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.gridlines {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
}

/* ---------- THE ROOM GRAMMAR (Direction B, site-wide) ----------
   One room = one viewport-scale full-bleed media surface + one glass
   panel carrying a single ruled line. Interior page headers are short
   rooms; the home sequence is full rooms. */

.room {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
}
.room--short { min-height: 72svh; }
.room--header { min-height: 62svh; }
.room-media,
.room-media img,
.room-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* set grade (R1/R3): every room's media runs through the same veil so
   the sequence palettes hand off instead of clashing */
.room-media img, .room-media video { filter: saturate(var(--room-grade-sat)); }
.room-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--room-veil);
  pointer-events: none;
}
/* slow gallery pan on stills */
@media (prefers-reduced-motion: no-preference) {
  .room-media img { animation: room-pan 36s ease-in-out infinite alternate; }
  @keyframes room-pan {
    from { transform: scale(1); }
    to { transform: scale(1.07); }
  }
  /* WCAG 2.2.2 pause affordance: attending to a room (hover / focus
     within its panel) rests its ambient pan (audit 2026-07-12) */
  .room:hover .room-media img,
  .room:focus-within .room-media img { animation-play-state: paused; }
}
.room-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(8 8 10 / 0.2) 0%, rgb(8 8 10 / 0.08) 45%, rgb(8 8 10 / 0.6) 100%);
}
/* glass panel — copy floats on the media, fixed light ink both themes
   (the media below is photographic; paper tokens don't apply) */
.room-panel {
  position: relative;
  margin: clamp(1.4rem, 4vw, 3.5rem);
  max-width: 34rem;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  background: rgb(10 10 12 / 0.6); /* 0.45→0.6: contrast floor ≥5:1 for the fixed light ink even over bright footage (audit 2026-07-12) */
  backdrop-filter: blur(10px);
  border: 1px solid rgb(244 242 237 / 0.14);
  color: #f4f2ed;
  display: grid;
  gap: 0.9rem;
}
.room-panel p, .room-panel h1 { color: #f4f2ed; }
.panel-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
}
.room-panel .panel-label { color: #cfd9cb; }
:root[data-theme='dark'] .room-panel .panel-label { color: var(--accent); }
.panel-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.22;
  text-wrap: balance;
}
.panel-link {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: #dfe7db;
  justify-self: start;
  /* WCAG 2.5.8 hit area without moving the glyphs (audit 2026-07-12) */
  display: inline-block;
  padding: 0.6rem 0.75rem;
  margin: -0.6rem -0.75rem;
}
.panel-link:hover { text-decoration: underline; text-underline-offset: 4px; color: #fff; }

/* scroll-driven fade-up — pure CSS, progressive */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rise {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 42%;
    }
    @keyframes rise {
      from { opacity: 0; transform: translateY(2.2rem); }
      to { opacity: 1; transform: none; }
    }
  }
}

/* ---------- ROOM TRANSITIONS (R3 — operator vetoes at G3) ----------
   The home sequence carries data-rooms="<treatment>"; /gates/ renders
   all three on samples. Default applied: crossfade. */

/* T1 CROSSFADE ZONE — each room's media bleeds into the next through
   a soft gradient mask at the seam (progressive: plain cut without
   mask support) */
[data-rooms='crossfade'] .room + .room .room-media {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14svh);
  mask-image: linear-gradient(180deg, transparent 0, #000 14svh);
  top: -14svh;
  height: calc(100% + 14svh);
}
[data-rooms='crossfade'] .room { overflow: visible; }
[data-rooms='crossfade'] .room + .room { margin-top: -14svh; padding-top: 14svh; }
/* panels clear the incoming room's seam zone */
[data-rooms='crossfade'] .room:not(:last-child) .room-panel { margin-bottom: calc(14svh + 1.4rem); }

/* T2 BREATHING GAP — a quiet paper interstice between rooms; the
   gallery wall shows between frames */
[data-rooms='breath'] .room + .room { margin-top: clamp(4rem, 14svh, 9rem); }
[data-rooms='breath'] .room { border-block: 1px solid var(--hairline); }

/* T3 PARALLAX OVERLAP — the next room's media enters at depth-speed
   (progressive: needs scroll-timeline; falls back to plain cuts) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    [data-rooms='parallax'] .room-media img,
    [data-rooms='parallax'] .room-media video {
      height: 118%;
      top: -9%;
      animation: room-parallax linear both;
      animation-timeline: view();
    }
    @keyframes room-parallax {
      from { transform: translateY(-4.5%) scale(1.02); }
      to { transform: translateY(4.5%) scale(1.02); }
    }
    /* pan and parallax both move the still — parallax wins in T3 */
    [data-rooms='parallax'] .room-media img { animation-name: room-parallax; }
  }
}

/* ---------- disclosure (decompression expandables) ---------- */

.disclosure {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  max-width: var(--measure);
}
.disclosure summary {
  cursor: pointer;
  list-style: none;
  padding-block: 0.8rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 150ms ease-out;
}
.disclosure summary:hover { color: var(--accent-line); }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: ' +'; }
.disclosure[open] summary::after { content: ' −'; }
.disclosure > *:not(summary) { padding-block: 0.2rem 1.2rem; }
/* the decompression EASES open instead of snapping — pure CSS,
   progressive (interpolate-size, Chromium 131+; older engines keep
   the instant toggle). Audit 2026-07-12. */
@media (prefers-reduced-motion: no-preference) {
  .disclosure { interpolate-size: allow-keywords; }
  .disclosure::details-content {
    height: 0;
    overflow: clip;
    transition: height 240ms cubic-bezier(0.16, 1, 0.3, 1), content-visibility 240ms allow-discrete;
  }
  .disclosure[open]::details-content { height: auto; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.8rem;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--ink-2); }
.btn--accent { border-color: var(--accent); color: var(--accent); }
.btn--accent:hover { background: var(--accent); color: var(--paper); }

/* ---------- forms (FUNNEL_SPEC §2 contract) ---------- */

.form { display: grid; gap: 1rem; max-width: 34rem; }
.form label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); display: grid; gap: 0.35rem; }
.form input[type='text'], .form input[type='email'], .form select, .form textarea {
  font: inherit;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-2);
  align-items: start;
}
.consent input[type='checkbox'] { margin-top: 0.25rem; width: 1rem; height: 1rem; }

/* ---------- draft ribbon (SITE.draft — removed at cutover) ---------- */

.draft-ribbon {
  background: var(--ink);
  color: var(--paper);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.45rem 1rem;
  position: relative;
  z-index: 60;
}

/* ---------- accessibility ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
