/* Coşan wireframe — shared tokens (mid-fi) */

/* ───── Macron fix for Fraunces ─────────────────────────────────────────
   The Fraunces slice Google Fonts serves *with the SOFT axis* has a broken
   macron: in ā ī ū (and the other composites below) the macron is drawn
   about a quarter-em too far right, so it lands on the next letter —
   "Ilāhī" renders as "Ilaħi‾", "Ḥadīth" as "Ḥadiŧh". No font-feature or
   variation setting fixes it; the same Fraunces *without* the SOFT axis
   is correct. So we load that build under a second family name and route
   only the affected code points to it. Everything else (including all
   dot-below letters: Ḥ ṣ ḍ ṭ ẓ) keeps the full SOFT-capable Fraunces.
   SOFT is a subtle terminal-softness axis; losing it on these few letters
   is invisible next to a struck-through neighbour.
   ───────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "FrauncesDia";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/fraunces/v38/6NU78FyLNQOQZAnv9bYEvDiIdE9Ea92uemAk_WBq8U_9v0c2Wa0KxCFTeP2Xz5fU8w.woff2) format("woff2");
  unicode-range: U+0100-0101, U+0112-0113, U+012A-012B, U+014C-014D, U+016A-016B, U+0178, U+01D5-01D6, U+01DE-01DF, U+01E2-01E3, U+01EC-01ED, U+022A-022D, U+0232-0233, U+1E20-1E21, U+1E26-1E27, U+1E38-1E39, U+1E4E-1E4F, U+1E5C-1E5D, U+1E7A-1E7B, U+1E84-1E85, U+1E8C-1E8D, U+1E97;
}
@font-face {
  font-family: "FrauncesDia";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/fraunces/v38/6NU58FyLNQOQZAnv9ZwNjucMHVn85Ni7emAe9lKqZTnbB-gzTK0K1ChjdPeQ7ZXk8kD6.woff2) format("woff2");
  unicode-range: U+0100-0101, U+0112-0113, U+012A-012B, U+014C-014D, U+016A-016B, U+0178, U+01D5-01D6, U+01DE-01DF, U+01E2-01E3, U+01EC-01ED, U+022A-022D, U+0232-0233, U+1E20-1E21, U+1E26-1E27, U+1E38-1E39, U+1E4E-1E4F, U+1E5C-1E5D, U+1E7A-1E7B, U+1E84-1E85, U+1E8C-1E8D, U+1E97;
}

:root {
  --bg: #FAFAF7;
  --bg-warm: #F2EEE3;
  --bg-deep: #E8E3D5;
  --ink: #0F0F0F;
  --ink-soft: #2A2825;
  --gray-warm: #6B6B68;
  --gray-light: #B8B5AB;
  --hairline: #E2DFD4;
  --gold: #B89968;
  --gold-deep: #9A7F50;

  --serif: "FrauncesDia", "Fraunces", Georgia, serif;
  --sans: "Hanken Grotesk", -apple-system, system-ui, sans-serif;
}

/* Reset inside each artboard */
.cw-frame, .cw-frame * { box-sizing: border-box; }
.cw-frame {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.65;
  position: relative;
}
.cw-frame.dark { background: var(--ink); color: var(--bg); }

/* Subtle grain placeholder hint (not full noise — keep wireframe clean) */
.cw-frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0,0,0,.012) 1px, transparent 1px);
  background-size: 3px 3px; opacity: .6;
}

/* Typography helpers */
.eyebrow {
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; font-weight: 500; color: var(--gray-warm);
}
.eyebrow-ink { color: var(--ink); }
.eyebrow-light { color: var(--gray-light); }

.serif { font-family: var(--serif); }
.italic { font-style: italic; }

/* hairline */
.hr { height: 1px; background: var(--hairline); border: 0; }
.hr-ink { background: var(--ink); }
.hr-gold { background: var(--gold); }

/* Image placeholder — diagonal hatch */
.ph {
  background-color: var(--ink-soft);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255,255,255,0.04) 0 1px,
    transparent 1px 8px
  );
  position: relative;
  overflow: hidden;
}
.ph-light {
  background-color: var(--bg-warm);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(15,15,15,0.05) 0 1px,
    transparent 1px 8px
  );
}
.ph-label {
  position: absolute; left: 12px; bottom: 10px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10px; letter-spacing: 0.04em; color: var(--gray-light);
  text-transform: uppercase;
}
.ph .ph-label { color: rgba(255,255,255,0.55); }
.ph-light .ph-label { color: var(--gray-warm); }

/* Gold link underline */
.gold-u {
  color: var(--gold); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px; background-repeat: no-repeat;
  background-position: 0 100%;
}

/* Door card hover (decorative) */
.door {
  border-top: 1px solid var(--hairline);
  padding: 28px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
}

/* Filter chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--hairline);
  font-family: var(--sans); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-soft); background: transparent;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Big quote mark */
.qmark {
  font-family: var(--serif); font-style: italic;
  color: var(--gold); font-size: 96px; line-height: 0.7;
  display: block;
}

/* Hide native scrollbar inside frames */
.cw-frame::-webkit-scrollbar { display: none; }

/* ────────────────────────────────────────────────────────
   Nav link hover — gold underline sweep + subtle lift
   ──────────────────────────────────────────────────────── */
.cw-nav-link {
  position: relative;
  transition: color 250ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cw-nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cw-nav-link[data-active="true"]::after { transform: scaleX(1); }
.cw-nav-link:hover::after { transform: scaleX(1); }
.cw-nav-link:hover { color: var(--gold) !important; }

.cw-icon-btn:hover {
  transform: rotate(-12deg);
}
.cw-icon-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent) !important;
  border-color: var(--gold) !important;
}

/* ────────────────────────────────────────────────────────
   Dark theme — body background only. Pages opt-in by passing
   dark={true} from useTheme(); they read tokens via inline
   styles so variable swap doesn't break the forced-dark Voice.
   ──────────────────────────────────────────────────────── */
html[data-theme="dark"] {
  --bg: #0F0F0F;
  --bg-warm: #15130F;
  --bg-deep: #1B1813;
  --ink: #FAFAF7;
  --ink-soft: rgba(250,250,247,0.84);
  --gray-warm: rgba(250,250,247,0.62);
  --gray-light: rgba(250,250,247,0.42);
  --hairline: rgba(255,255,255,0.10);
}
html[data-theme="dark"] body { background: #0F0F0F; color: #FAFAF7; }
html[data-theme="dark"] .pp-page { background: #0F0F0F; color: #FAFAF7; }
html[data-theme="dark"] .cw-frame { background: #0F0F0F; color: #FAFAF7; }
html[data-theme="dark"] .cw-frame.dark { background: #0F0F0F; color: #FAFAF7; }

.cw-foot-link:hover { color: var(--gold) !important; }

@keyframes cwFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ──────────────────────────────────────────────────────────
   HI-FI additions — refined motion, grain, portrait, hover
   ────────────────────────────────────────────────────────── */

/* Grain overlay — SVG noise, opacity 0.045, multiply */
.hf-grain {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  opacity: 0.055;
  mix-blend-mode: multiply;
}
.cw-frame.dark .hf-grain { mix-blend-mode: screen; opacity: 0.08; }

/* Sophisticated portrait — duotone gradient + photographic silhouette */
.hf-portrait {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 35% 25%, #2A2620 0%, #181612 38%, #0A0908 78%);
}
.hf-portrait::after {
  /* faint film vignette */
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.18) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.28) 100%);
  pointer-events: none;
}
.hf-portrait svg {
  position: absolute; left: 50%; bottom: 0;
  transform: translateX(-50%);
  height: 100%; width: auto;
  filter: drop-shadow(0 2px 18px rgba(0,0,0,0.4));
}
.hf-portrait-label {
  position: absolute; left: 18px; bottom: 16px; z-index: 3;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.38);
}
.hf-portrait-cap {
  position: absolute; right: 18px; bottom: 16px; z-index: 3;
  font-family: var(--serif); font-style: italic; font-size: 11px;
  color: rgba(255,255,255,0.42);
  font-variation-settings: "opsz" 9, "SOFT" 100;
}

/* Staged entry — runs once on mount */
@keyframes hfRise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes hfFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes hfRule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.hf-rise { animation: hfRise 900ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.hf-fade { animation: hfFade 1400ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.hf-rule {
  animation: hfRule 1100ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: left center;
}

/* Scroll-reveal (toggled by IntersectionObserver in landing-hifi.jsx) */
.hf-reveal {
  opacity: 0; transform: translate3d(0, 22px, 0);
  transition: opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.hf-reveal.is-in { opacity: 1; transform: none; }

/* Door — hi-fi hover (full-row accent fill + lift + arrow nudge) */
.hf-door {
  display: grid; align-items: baseline;
  position: relative; cursor: pointer;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1), color 350ms ease;
  isolation: isolate;
}
.hf-door::before {
  content: ""; position: absolute;
  left: -24px; right: -24px; top: 0; bottom: 0;
  background: var(--accent, var(--gold));
  transform: scaleX(0); transform-origin: left center;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
}
.hf-door:hover::before { transform: scaleX(1); }
.hf-door:hover { transform: translateX(6px); }
.hf-door:hover, .hf-door:hover * { color: #FAFAF7 !important; }
.hf-door .hf-arrow {
  display: inline-block;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
}
.hf-door:hover .hf-arrow { transform: translateX(8px); }
.hf-cover-title-block {
  padding: 0 4px;
}

/* Gold underline animation on inline links */
.hf-link {
  color: inherit; text-decoration: none; position: relative;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0% 1px; background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 350ms cubic-bezier(0.22, 1, 0.36, 1), color 250ms;
}
.hf-link:hover { background-size: 100% 1px; color: var(--gold); }

/* Numbered eyebrow with leading rule */
.hf-eyebrow-rule {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; font-weight: 500; color: var(--gray-warm);
}
.hf-eyebrow-rule::before {
  content: ""; width: 28px; height: 1px; background: var(--gold);
}

/* ───── Library hi-fi: cover card hover ───── */
.hf-cover {
  position: relative; transform: translateZ(0);
  transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 450ms cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}
.hf-cover:hover {
  transform: translateY(-6px);
  box-shadow:
    0 1px 0 rgba(0,0,0,0.04),
    0 28px 60px -22px rgba(20, 16, 8, 0.28),
    0 8px 14px -10px rgba(20, 16, 8, 0.18);
}
.hf-cover .hf-cover-glint {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: overlay;
}
.hf-cover:hover .hf-cover-glint { transform: translateX(100%); }
.hf-cover .hf-cover-meta {
  margin-top: 14px;
  transition: color 250ms;
}
.hf-cover-title {
  position: relative; display: inline;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0% 1px; background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
.hf-cover:hover .hf-cover-title { background-size: 100% 1px; }

/* ───── Voice hi-fi: animated waveform + play button ───── */
@keyframes hfWave {
  0%, 100% { transform: scaleY(0.18); }
  50%      { transform: scaleY(1); }
}
@keyframes hfPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 18px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
.hf-play-pulse {
  animation: hfPulse 2400ms ease-out infinite;
}
.hf-wave {
  display: flex; align-items: center; gap: 3px; height: 48px;
}
.hf-wave > i {
  display: block; width: 2px; height: 100%;
  background: currentColor;
  transform-origin: center;
  animation: hfWave 1200ms cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes hfTranscriptSweep {
  0%   { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.hf-transcript-sweep mark {
  background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--accent) 32%, transparent) 50%, transparent 100%);
  background-size: 220% 100%;
  background-position: 100% 0;
  color: inherit; padding: 1px 4px; border-radius: 2px;
  animation: hfTranscriptSweep 6s ease-in-out infinite alternate;
}

/* ───── Life hi-fi: parallax-ish year + ken burns ───── */
@keyframes hfKenBurns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.08) translate(-1.5%, -2%); }
}
.hf-kenburns {
  animation: hfKenBurns 12s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-play-state: paused;
}
.hf-reveal.is-in .hf-kenburns { animation-play-state: running; }

@keyframes hfYearDigitIn {
  from { opacity: 0; transform: translate3d(0, 0.3em, 0); }
  to   { opacity: 1; transform: none; }
}
.hf-year { display: inline-flex; overflow: hidden; }
.hf-year > span {
  display: inline-block; opacity: 0;
  animation: hfYearDigitIn 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hf-reveal.is-in .hf-year > span { animation-name: hfYearDigitIn; }
