/* ============================================================
   LEGIBLE TRACES — design system layer (loads after _legacy.css)
   Palette A "Void & Gold" · fluid type · art atmosphere · motion
   ============================================================ */

:root{
  /* --- surfaces: four luminance steps, never flat --- */
  --void:#0A0C16;
  --surface-1:#10131F;
  --surface-2:#171B2B;
  --surface-3:#1E2438;
  --panel:var(--surface-1);

  /* --- text tiers --- */
  --ink:#ECE4D3;
  --ink-2:#B9C2DC;
  --muted:#9A93B5;

  /* --- accents --- */
  --gold:#E0B25A;
  --gold-bright:#F0C877;
  --blue:#7FB2E6;
  --blue-soft:#A9CCEE;
  --line:rgba(185,194,220,.16);
  --line-strong:rgba(185,194,220,.28);

  /* --- section accent (re-themed per section) --- */
  --accent:var(--gold);
  --tint:#7FB2E6;

  /* --- fluid type scale (Perfect Fourth) --- */
  --t--1:clamp(.83rem,.80rem + .15vw,.94rem);
  --t-0:clamp(1.05rem,1.00rem + .25vw,1.20rem);
  --t-1:clamp(1.40rem,1.30rem + .50vw,1.60rem);
  --t-2:clamp(1.86rem,1.70rem + .80vw,2.13rem);
  --t-3:clamp(2.48rem,2.20rem + 1.4vw,2.84rem);
  --t-4:clamp(3.30rem,2.80rem + 2.5vw,3.79rem);
  --t-5:clamp(4.40rem,3.50rem + 4.5vw,5.05rem);

  --measure:68ch;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

body{ background:var(--void); font-size:var(--t-0); line-height:1.65; }

/* ---------- ART ATMOSPHERE ---------------------------------
   Art is accent, never subject. Every artwork is desaturated,
   duotone-tinted toward the section accent, and sits behind a
   scrim so text contrast is never in doubt.
   ---------------------------------------------------------- */
.art-layer{
  position:absolute; inset:0; overflow:hidden; z-index:0;
  pointer-events:none; isolation:isolate;
}
.art-layer img{
  width:100%; height:100%; object-fit:cover; display:block;
  filter:grayscale(.92) contrast(1.05) brightness(.55);
  opacity:.30;
}
.art-layer::after{                       /* duotone wash */
  content:""; position:absolute; inset:0;
  background:linear-gradient(150deg,
      color-mix(in srgb,var(--tint) 55%,transparent),
      color-mix(in srgb,var(--accent) 22%,transparent));
  mix-blend-mode:color; opacity:.85;
}
.art-layer::before{                      /* scrim — guarantees legibility */
  content:""; position:absolute; inset:0; z-index:2;
  background:
    linear-gradient(180deg,var(--void) 0%,rgba(10,12,22,.55) 28%,
                    rgba(10,12,22,.72) 65%,var(--void) 100%);
}
.art-quiet img{ opacity:.16; }
.art-veil img{ opacity:.10; }

/* section header carrying art */
.section-hero{
  position:relative; isolation:isolate; overflow:hidden;
  padding:clamp(64px,11vw,132px) 24px clamp(38px,6vw,64px);
  border-bottom:1px solid var(--line);
}
.section-hero > :not(.art-layer){ position:relative; z-index:3; }
.section-hero .kicker{ color:var(--accent); }
.section-hero h1{ font-size:var(--t-3); margin:.12em 0 .3em; }
.section-hero .standfirst{
  max-width:60ch; margin:0 auto; color:var(--ink-2);
  font-size:var(--t-1); line-height:1.45; font-style:italic;
}
.section-hero.center{ text-align:center; }

/* small inline art accent (never dominant) */
.art-accent{
  position:relative; border-radius:10px; overflow:hidden;
  border:1px solid var(--line); isolation:isolate;
}
.art-accent img{
  display:block; width:100%; height:100%; object-fit:cover;
  filter:grayscale(.9) brightness(.6); opacity:.55;
}
.art-accent::after{
  content:""; position:absolute; inset:0;
  background:linear-gradient(160deg,
    color-mix(in srgb,var(--tint) 60%,transparent),
    color-mix(in srgb,var(--accent) 25%,transparent));
  mix-blend-mode:color;
}

/* ---------- PER-SECTION IDENTITY --------------------------
   One system; the accent + tint shift by section.
   ---------------------------------------------------------- */
[data-section="theory"]     { --accent:#E0B25A; --tint:#5C7FD0; }
[data-section="series"]     { --accent:#E5BC72; --tint:#7C93D8; }
[data-section="turning"]    { --accent:#E8C98A; --tint:#6FA8B8; }
[data-section="scientific"] { --accent:#CFE0F2; --tint:#4E7BB5; }
[data-section="artwork"]    { --accent:#E0B25A; --tint:#8C7BC4; }
[data-section="pathways"]   { --accent:#E9BE79; --tint:#4F97A3; }
[data-section="book"]       { --accent:#E0B25A; --tint:#5C7FD0; }
[data-section="archive"]    { --accent:#E0B25A; --tint:#6C86C6; }
[data-section="credits"]    { --accent:#E0B25A; --tint:#8C7BC4; }

/* Turning Toward lifts its floor — calmer, never a void */
[data-section="turning"] body,
body[data-section="turning"]{ background:#0D1119; }
[data-section="turning"] .page,
[data-section="turning"] .prose{ --line:rgba(185,200,220,.20); }

/* ---------- TYPE REFINEMENTS ------------------------------ */
h1,h2,h3{ letter-spacing:-.012em; }
h1{ font-size:var(--t-3); line-height:1.12; }
h2{ font-size:var(--t-2); line-height:1.2; }
h3{ font-size:var(--t-1); line-height:1.3; }
.prose{ max-width:var(--measure); }
.prose p{ font-size:var(--t-0); line-height:1.68; }
.prose p + p{ margin-top:1.05em; }
.kicker{
  font-family:var(--mono); font-size:.66rem; letter-spacing:.2em;
  text-transform:uppercase; color:var(--muted);
}
.pubdate,.book-meta{ font-family:var(--mono); }

/* drop cap on the opening paragraph of a work page */
.prose > .hook + p::first-letter{
  float:left; font-family:"Fraunces",serif; font-size:3.05em;
  line-height:.86; padding:.06em .10em 0 0; color:var(--accent);
}

/* ---------- LINKS & BUTTONS ------------------------------- */
a{ color:var(--blue-soft); }
a:hover{ color:var(--gold-bright); }
.prose a{
  text-decoration:none; border-bottom:1px solid var(--line-strong);
  transition:border-color .18s ease,color .18s ease;
}
.prose a:hover{ border-color:var(--accent); }
:focus-visible{ outline:2px solid var(--gold); outline-offset:3px; border-radius:3px; }

/* ---------- CARD / LIST POLISH ---------------------------- */
.doi-list li{
  border-top:1px solid var(--line); padding:13px 0;
  transition:background .2s ease;
}
.doi-list li:hover{ background:linear-gradient(90deg,rgba(224,178,90,.05),transparent); }
.doi-list .t a{ border-color:transparent; }
.doi-list .t a:hover{ border-color:var(--accent); color:var(--accent); }

.announce{
  border:1px solid var(--line); border-left:3px solid var(--accent);
  border-radius:11px; padding:22px 24px; margin:0 0 18px;
  background:linear-gradient(180deg,var(--surface-1),rgba(16,19,31,0));
}
.announce-label{ font-family:var(--mono); color:var(--accent); }

/* ---------- GALLERY WALL (On ——ing index) ----------------- */
.wall{
  display:grid; gap:14px; margin-top:30px;
  grid-template-columns:repeat(auto-fill,minmax(190px,1fr));
}
.wall a{
  position:relative; display:block; aspect-ratio:3/4; overflow:hidden;
  border:1px solid var(--line); border-radius:10px; text-decoration:none;
  isolation:isolate; background:var(--surface-2);
  transition:transform .28s ease,border-color .28s ease;
}
.wall a:hover{ transform:translateY(-4px); border-color:var(--accent); }
.wall img{
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  filter:grayscale(.92) brightness(.5); opacity:.5;
  transition:opacity .3s ease,filter .3s ease;
}
.wall a:hover img{ opacity:.72; filter:grayscale(.55) brightness(.6); }
.wall .lbl{
  position:absolute; inset:auto 0 0 0; z-index:3; padding:14px 14px 13px;
  background:linear-gradient(180deg,transparent,rgba(10,12,22,.93) 55%);
  font-family:"Fraunces",serif; font-size:1.02rem; color:var(--ink); line-height:1.22;
}
.wall .lbl small{
  display:block; font-family:var(--mono); font-size:.6rem; letter-spacing:.14em;
  color:var(--muted); margin-top:5px; text-transform:uppercase;
}
.wall a::after{
  content:""; position:absolute; inset:0; z-index:2;
  background:linear-gradient(160deg,
    color-mix(in srgb,var(--tint) 62%,transparent),
    color-mix(in srgb,var(--accent) 22%,transparent));
  mix-blend-mode:color;
}

/* ---------- CREDITS PAGE ---------------------------------- */
.credit-grid{
  display:grid; gap:18px; margin-top:26px;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
}
.credit-item{ border:1px solid var(--line); border-radius:10px; overflow:hidden;
  background:var(--surface-1); }
.credit-item .thumb{ position:relative; aspect-ratio:4/3; overflow:hidden; }
.credit-item img{ width:100%; height:100%; object-fit:cover; display:block; }
.credit-item .cap{ padding:12px 14px 14px; font-size:.82rem; line-height:1.45; color:var(--ink-2); }
.credit-item .cap b{ color:var(--ink); font-weight:400; font-family:"Fraunces",serif; }
.credit-item .cap span{ display:block; font-family:var(--mono); font-size:.6rem;
  letter-spacing:.12em; text-transform:uppercase; color:var(--muted); margin-top:6px; }
.pullquote{
  max-width:56ch; margin:34px auto; padding:22px 0 22px 26px;
  border-left:2px solid var(--accent);
  font-family:"Fraunces",serif; font-size:var(--t-1); line-height:1.4;
  color:var(--ink); font-style:italic;
}
.pullquote cite{
  display:block; margin-top:12px; font-family:var(--mono); font-style:normal;
  font-size:.66rem; letter-spacing:.14em; text-transform:uppercase; color:var(--muted);
}

/* ---------- SCROLL REVEAL --------------------------------- */
@media (prefers-reduced-motion:no-preference){
  .reveal{ opacity:0; transform:translateY(16px);
    transition:opacity .7s cubic-bezier(.22,.61,.36,1),transform .7s cubic-bezier(.22,.61,.36,1); }
  .reveal.in{ opacity:1; transform:none; }
}
@media (prefers-reduced-motion:reduce){
  .reveal{ opacity:1 !important; transform:none !important; }
  *,*::before,*::after{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* motion toggle */
.motion-toggle{
  position:fixed; right:14px; bottom:14px; z-index:70;
  font-family:var(--mono); font-size:.58rem; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted); background:rgba(16,19,31,.82); border:1px solid var(--line);
  border-radius:20px; padding:7px 12px; cursor:pointer;
  -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
}
.motion-toggle:hover{ color:var(--gold); border-color:var(--gold); }
body.no-motion .art-layer img{ opacity:.20; }
@media(max-width:900px){ .motion-toggle{ bottom:76px; } }

/* ---------- RESPONSIVE ------------------------------------ */
@media(max-width:640px){
  .wall{ grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
  .section-hero{ padding:56px 20px 34px; }
  .prose > .hook + p::first-letter{ font-size:2.6em; }
}

/* quiet veil behind a work page's opening block */
.work-veil{ position:relative; height:0; }
.work-veil .art-layer{ position:fixed; inset:0 0 auto 0; height:56vh; z-index:0; }
.work-veil .art-layer::before{
  background:linear-gradient(180deg,rgba(10,12,22,.62) 0%,rgba(10,12,22,.86) 45%,var(--void) 100%);
}
main{ position:relative; z-index:1; }

/* essay subtitle inside a wall tile */
.wall .lbl .sub{
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  font-family:"EB Garamond",serif; font-style:italic; font-size:.76rem; line-height:1.32;
  color:var(--ink-2); margin-top:6px; opacity:0; max-height:0;
  transition:opacity .25s ease, max-height .25s ease;
}
.wall a:hover .sub, .wall a:focus-visible .sub{ opacity:.92; max-height:3.2em; }

/* ============================================================
   v2 — corrections after first review
   ============================================================ */

/* --- art visibility: bring it into view, keep text safe --- */
.art-layer img{
  filter:grayscale(.78) contrast(1.06) brightness(.70);
  opacity:.54;
}
.art-layer::before{
  background:
    linear-gradient(180deg,rgba(10,12,22,.62) 0%,rgba(10,12,22,.28) 26%,
                    rgba(10,12,22,.40) 62%,var(--void) 100%);
}
.art-layer::after{ opacity:.72; }
.art-quiet img{ opacity:.34; }
.art-veil img{ opacity:.36; }
body.no-motion .art-layer img{ opacity:.42; }

/* --- reveal: VISIBLE by default, animates in when observed --- */
.reveal{ opacity:1; transform:none; }
@keyframes rise{
  from{ opacity:0; transform:translateY(28px) scale(.985); }
  to  { opacity:1; transform:none; }
}
@media (prefers-reduced-motion:no-preference){
  body:not(.no-motion) .reveal.in{
    animation:rise .85s cubic-bezier(.22,.61,.36,1) both;
    animation-delay:calc(var(--i,0) * 65ms);
  }
}

/* --- hero: shorter, with slow drift + parallax --- */
.section-hero{ padding:clamp(48px,7vw,88px) 24px clamp(30px,4.5vw,52px); }
.section-hero .art-layer{ will-change:transform; transform:translateY(calc(var(--py,0) * 1px)); }
@keyframes drift{
  from{ transform:scale(1.05) translate3d(0,0,0); }
  to  { transform:scale(1.14) translate3d(-1.6%,-1.2%,0); }
}
@media (prefers-reduced-motion:no-preference){
  body:not(.no-motion) .section-hero .art-layer img,
  body:not(.no-motion) .work-veil .art-layer img{
    animation:drift 36s ease-in-out infinite alternate;
  }
}

/* --- work-page veil: anchored, not fixed; parallaxed --- */
.work-veil{ position:absolute; inset:0 0 auto 0; height:min(58vh,540px); z-index:0; pointer-events:none; }
.work-veil .art-layer{ position:absolute; inset:0; height:100%;
  transform:translateY(calc(var(--py,0) * 1px)); will-change:transform; }
.work-veil .art-layer::before{
  background:linear-gradient(180deg,rgba(10,12,22,.58) 0%,rgba(10,12,22,.42) 40%,var(--void) 100%);
}
main{ position:relative; }
.page{ position:relative; z-index:1; }

/* --- series wall: full width --- */
.wall-h{ font-family:"Fraunces",serif; font-weight:400; font-size:var(--t-1); margin:38px 0 6px; }
.wall-h small{ font-family:var(--mono); font-size:.62rem; letter-spacing:.16em; text-transform:uppercase;
  color:var(--muted); margin-left:12px; }
.wall{ grid-template-columns:repeat(auto-fill,minmax(212px,1fr)); gap:16px; margin-top:18px; }
.wall a{ box-shadow:0 10px 30px rgba(0,0,0,.35); }
.wall a:hover{ box-shadow:0 18px 44px rgba(0,0,0,.5); }
.wall .lbl{ font-size:1.06rem; }
.wall img{ opacity:.62; filter:grayscale(.72) brightness(.58); }
.wall a:hover img{ opacity:.85; filter:grayscale(.30) brightness(.68); }

/* --- scientific theory: cards --- */
.sci-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:20px; margin-top:28px; }
.sci-card{ display:flex; flex-direction:column; border:1px solid var(--line); border-radius:12px;
  overflow:hidden; background:var(--surface-1); transition:transform .28s ease,border-color .28s ease; }
.sci-card:hover{ transform:translateY(-3px); border-color:var(--line-strong); }
.sci-card .art-accent{ aspect-ratio:16/7; border:0; border-radius:0; }
.sci-card .art-accent img{ opacity:.68; filter:grayscale(.7) brightness(.62); }
.sci-card .body{ padding:20px 22px 22px; flex:1; display:flex; flex-direction:column; }
.sci-card h2{ font-size:var(--t-1); margin:0 0 10px; line-height:1.25; }
.sci-card h2 a{ color:var(--ink); text-decoration:none; border:0; }
.sci-card h2 a:hover{ color:var(--accent); }
.sci-card p{ font-size:.94rem; line-height:1.58; margin:0; flex:1; color:var(--ink-2); }
.readrow{ display:flex; align-items:center; gap:14px; margin-top:18px; flex-wrap:wrap; }
.readrow .visit{ margin:0; }
.readrow .pubdate{ margin:0; }

/* --- artwork page: framed pieces --- */
.gallery .art, .gallery figure{ position:relative; }
.gallery img{ border:1px solid var(--line-strong); border-radius:6px; padding:10px;
  background:var(--surface-2); box-shadow:0 26px 60px rgba(0,0,0,.6); box-sizing:border-box; }
.gallery figure:hover img{ border-color:rgba(224,178,90,.5); }

/* --- section hero on the home page banner --- */
.hero{ position:relative; isolation:isolate; }
.hero img{ will-change:transform; transform:translateY(calc(var(--py,0) * .6px)); }

@media(max-width:640px){
  .wall{ grid-template-columns:repeat(2,1fr); gap:10px; }
  .work-veil{ height:44vh; }
}

/* ---- hard guarantee: art layers are never in document flow ---- */
.section-hero .art-layer, .work-veil .art-layer, .art-accent .art-layer{
  position:absolute !important; inset:0 !important; height:100% !important; width:100% !important;
}
.art-layer img{ position:absolute; inset:0; width:100%; height:100%; }
/* index banner: re-assert the intended height (a stray merged rule set it to auto) */
.hero img{ height:clamp(220px,42vw,460px); object-fit:cover; object-position:center 42%; }

/* ============================================================
   v4 — background heroes, home banner as background, sizing
   ============================================================ */
.section-hero{
  min-height:clamp(380px,54vh,600px);
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  padding:clamp(40px,5vw,72px) 24px;
}
.section-hero > :not(.art-layer){ max-width:64ch; }
.section-hero .art-layer img{ opacity:.58; filter:grayscale(.74) contrast(1.05) brightness(.72); }

/* home: the landscape is the background the intro sits on */
.home-hero{ min-height:clamp(560px,86vh,860px); justify-content:center; text-align:center; }
.home-hero .art-layer img{ opacity:.70; filter:grayscale(.18) contrast(1.04) brightness(.62); object-position:center 46%; }
.home-hero .art-layer::after{ opacity:.35; }          /* keep the real colour of the rock */
.home-hero .art-layer::before{
  background:linear-gradient(180deg,rgba(10,12,22,.35) 0%,rgba(10,12,22,.30) 40%,
                             rgba(10,12,22,.62) 75%,var(--void) 100%);
}
.home-hero .badge{ margin:0 auto 18px; position:relative; z-index:3; }
.home-hero .intro{ position:relative; z-index:3; margin:0; }
.home-hero .intro h1{ font-size:var(--t-5); }
.home-hero .intro .lede{ color:var(--ink); }
.hero{ display:none; }                                   /* legacy banner block retired */

@media(max-width:700px){
  .section-hero{ min-height:clamp(300px,46vh,440px); }
  .home-hero{ min-height:clamp(480px,78vh,700px); }
}
