/* =====================================================================
   PORTFOLIO — case-study pages (shared)
   Terracotta DS tokens via design-system/styles.css (linked first).
   Reasoning-led, diagram-anchored long-form. One serif italic-terracotta
   word per headline. Neutral surfaces (warm/cold), terracotta for punch.
   ===================================================================== */
:root{
  --accent: var(--terracotta);
  --accent-dark: var(--terracotta-600);
  --muted: var(--earth);
  --rule: var(--border-subtle);
  --tint: var(--terracotta-200);
  --paper: var(--surface-warm);
  --surface: var(--surface-raised);
  --cool: var(--mist);
  --font: var(--font-sans);
  --serif: var(--font-serif);
  --ease: var(--ease-standard);
  --maxw: var(--container-max);   /* UNIFIED with the main page (1120) — same column width on every page.
                                     Text stays capped at its reading measure (like the main page); heroes + grids
                                     refit to fill the wider column (device beside capped text, feature grid 3-up). */
}
*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{ margin:0; background:var(--paper); color:var(--ink); font-family:var(--font);
  line-height:1.65; -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
a{ color:inherit; }
.wrap{ max-width:var(--maxw); margin:0 auto; padding:0 clamp(1.25rem,5vw,2rem); }
.eyebrow{ font-size:.74rem; font-weight:700; text-transform:uppercase; letter-spacing:.18em; color:var(--accent); margin:0; }

/* ---------- top bar ---------- */
/* identical to the main page's nav (fixed, transparent → blur on scroll, brand + links) */
#nav{ position:fixed; inset:0 0 auto 0; z-index:50; padding:1.15rem 0;
  transition:background .4s var(--ease), box-shadow .4s var(--ease); }   /* constant height — the on-scroll shrink jumped the header (esp. with reduced motion) */
#nav.scrolled{ background:rgba(250,248,246,.82); backdrop-filter:saturate(140%) blur(10px);
  -webkit-backdrop-filter:saturate(140%) blur(10px); box-shadow:0 1px 0 var(--rule); }
.nav-inner{ display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.brand{ font-family:var(--serif); font-size:1.2rem; font-weight:600; letter-spacing:.2px; text-decoration:none; }
.nav-links{ display:flex; align-items:center; gap:1.6rem; }
.nav-links a{ font-size:.86rem; text-decoration:none; color:var(--ink); opacity:.8; transition:opacity .25s var(--ease); }
.nav-links a:hover{ opacity:1; }
.nav-cta{ border:1px solid var(--rule); border-radius:999px; padding:.42rem .9rem !important; opacity:1 !important;
  transition:border-color .25s var(--ease), background .25s var(--ease); }
.nav-cta:hover{ border-color:var(--ink); }
.nav-links a.active{ opacity:1; color:var(--accent); }
.nav-links a.nav-cta.active{ color:var(--accent); border-color:var(--accent); }
@media(max-width:680px){ .nav-links a:not(.nav-cta){ display:none; } }

/* ---------- hero / header ---------- */
.chero{ padding:clamp(6.5rem,11vh,8.5rem) 0 clamp(2.8rem,5vh,4rem); }   /* top clears the fixed nav + breathing room */
.chero .eyebrow{ margin-bottom:1.1rem; }
.chero h1{ font-family:var(--serif); font-weight:500; font-size:clamp(2.4rem,6vw,4rem);
  line-height:1.04; letter-spacing:-.01em; margin:0 0 1rem; }
.chero h1 em{ font-style:italic; color:var(--accent); }
.chero .ctx{ font-family:var(--font-mono); font-size:.68rem; letter-spacing:.1em; text-transform:uppercase;
  color:var(--muted); margin:0 0 1.6rem; }
.chero .lead{ font-family:var(--serif); font-weight:400; font-size:clamp(1.2rem,2.2vw,1.6rem);
  line-height:1.5; color:var(--ink); max-width:36ch; margin:0; }

/* fact sheet */
.facts{ display:grid; grid-template-columns:repeat(4,1fr); gap:1.4rem;
  margin:clamp(3.2rem,6vw,4.6rem) 0 0; padding-top:1.9rem; border-top:1px solid var(--rule); }
.fact{ display:flex; flex-direction:column; gap:.35rem; }
.fact .k{ font-family:var(--font-mono); font-size:.58rem; letter-spacing:.16em; text-transform:uppercase; color:var(--accent); }
.fact .v{ font-size:.92rem; color:var(--ink); line-height:1.42; }
@media(max-width:640px){ .facts{ grid-template-columns:1fr 1fr; gap:1.4rem 1.2rem; } }

/* recreated / fictional note */
.cnote{ display:inline-flex; align-items:center; gap:.55rem; margin:1.6rem 0 0;
  font-family:var(--font-mono); font-size:.64rem; letter-spacing:.02em; color:var(--accent-dark);
  background:var(--terracotta-50); border:1px solid var(--terracotta-100); border-radius:999px; padding:.42rem .85rem; }
.cnote::before{ content:""; width:6px; height:6px; border-radius:50%; background:var(--accent); flex:none; }

/* ---------- big process figure ---------- */
.cfig{ background:var(--surface); border:1px solid var(--rule); border-radius:18px;
  padding:clamp(1.5rem,4vw,3rem); box-shadow:0 18px 48px rgba(31,25,21,.05);
  margin:clamp(2.4rem,6vw,3.6rem) 0; }
.cfig svg{ width:100%; height:auto; display:block; }
.cfig figcaption{ font-family:var(--font-mono); font-size:.64rem; letter-spacing:.04em; color:var(--muted); margin:1.2rem 0 0; text-align:center; }
/* secondary (in-section) figure — lighter chrome than the hero diagram */
.cfig.sm{ padding:clamp(1.3rem,3vw,2.2rem); margin:clamp(2rem,5vw,3rem) 0; box-shadow:0 10px 28px rgba(31,25,21,.04); }
.dg-box-adv{ fill:var(--terracotta-50); stroke:var(--terracotta-300); stroke-width:1.5; stroke-dasharray:5 3; }
.dg-dot-lg{ fill:var(--terracotta-500); stroke:var(--terracotta-100); stroke-width:4; }
.dg-t-sub{ font-family:var(--font-mono); font-size:10px; letter-spacing:.4px; fill:var(--earth); }

/* ---------- body sections ---------- */
.csec{ margin:clamp(2.2rem,6vw,3.4rem) 0; }
.csec h2{ font-family:var(--serif); font-weight:500; font-size:clamp(1.5rem,3vw,2.1rem);
  line-height:1.12; letter-spacing:-.01em; margin:0 0 1rem; }
.csec h2 em{ font-style:italic; color:var(--accent); }
.csec p{ font-size:1.02rem; color:var(--earth); line-height:1.72; margin:0 0 1.1rem; max-width:64ch; }
.csec p:last-child{ margin-bottom:0; }
.csec strong{ color:var(--ink); font-weight:600; }
.csec ul{ margin:.2rem 0 1.1rem; padding-left:0; list-style:none; max-width:64ch; }
.csec li{ position:relative; padding-left:1.4rem; font-size:1.02rem; color:var(--earth); line-height:1.65; margin-bottom:.7rem; }
.csec li::before{ content:""; position:absolute; left:0; top:.6em; width:6px; height:6px; border-radius:50%; background:var(--accent); }
.csec li b{ color:var(--ink); font-weight:600; }

/* pull-quote */
.pullquote{ font-family:var(--serif); font-style:italic; font-weight:400; font-size:clamp(1.4rem,2.8vw,2rem);
  line-height:1.4; color:var(--ink); text-align:center; max-width:30ch; margin:clamp(2.4rem,6vw,3.4rem) auto;
  position:relative; padding-top:1.6rem; }
.pullquote::before{ content:""; position:absolute; top:0; left:50%; transform:translateX(-50%); width:40px; height:2px; background:var(--accent); }
.pullquote em{ font-style:italic; color:var(--accent); }

/* outcome highlight */
.outcome{ background:var(--stone); border-radius:16px; padding:clamp(1.7rem,3.5vw,2.4rem) clamp(1.8rem,4vw,2.8rem);
  margin:clamp(2.6rem,6vw,3.6rem) 0;
  display:grid; grid-template-columns:0.5fr 1.5fr; column-gap:clamp(1.8rem,4vw,3.4rem); align-items:start; }
.outcome .eyebrow{ font-family:var(--serif); font-weight:500; font-size:clamp(1.5rem,3vw,2.1rem);
  line-height:1.12; letter-spacing:-.01em; text-transform:none; color:var(--ink); margin:0; }
.outcome .big{ font-family:var(--serif); font-weight:400; font-size:clamp(1.08rem,1.5vw,1.3rem);
  line-height:1.55; color:var(--ink); margin:0; max-width:62ch; }
@media(max-width:640px){ .outcome{ grid-template-columns:1fr; } .outcome .eyebrow{ margin:0 0 .7rem; } }
.outcome .big em{ font-style:italic; color:var(--accent); }

/* draft marker */
.cdraft{ font-size:.8rem; font-style:italic; color:var(--muted); margin:2.2rem 0 0; padding-top:1.1rem; border-top:1px solid var(--rule); }

/* ---------- next-case nav ---------- */
.cnext{ display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap;
  border-top:1px solid var(--rule); padding:clamp(2.2rem,6vw,3.2rem) 0; }
.cnext a{ text-decoration:none; }
.cnext .lab{ font-family:var(--font-mono); font-size:.6rem; letter-spacing:.16em; text-transform:uppercase; color:var(--muted); display:block; margin-bottom:.4rem; }
.cnext .ttl{ font-family:var(--serif); font-size:1.3rem; color:var(--ink); display:inline-flex; align-items:center; gap:.55rem; transition:color .25s var(--ease); }
.cnext .ttl em{ font-style:italic; color:var(--accent); }
.cnext .next{ text-align:right; margin-left:auto; }
.cnext a:hover .ttl{ color:var(--accent); }
.cnext .arr{ color:var(--accent); transition:transform .25s var(--ease); }
.cnext a:hover .next .arr{ transform:translateX(4px); }

/* ---------- shared diagram language (mirrors index.html) ---------- */
.dg-box{ fill:var(--surface-raised); stroke:var(--warm-400); stroke-width:1.5; }
.dg-box-ac{ fill:var(--terracotta-50); stroke:var(--terracotta-300); stroke-width:1.5; }
.dg-line{ stroke:var(--warm-400); stroke-width:1.5; fill:none; }
.dg-arrow{ fill:var(--warm-400); }
.dg-dot{ fill:var(--terracotta-500); }
.dg-t{ font-family:var(--font-sans); font-size:13px; font-weight:500; fill:var(--ink); }
.dg-tm{ font-family:var(--font-sans); font-size:12px; fill:var(--earth); }
.dg-cap{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.8px; fill:var(--earth); }
.dg-mono{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.8px; fill:var(--terracotta-600); }

/* ---------- footer (terracotta) ---------- */
footer{ background:var(--terracotta-500); padding:2.2rem 0; margin-top:1rem; }
.foot-inner{ max-width:var(--maxw); margin:0 auto; padding:0 clamp(1.25rem,5vw,2rem);
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:1rem; align-items:baseline; }
.foot-inner .fname{ font-family:var(--serif); font-size:1.05rem; color:var(--text-on-accent); }
.foot-note a{ color:var(--text-on-accent); text-decoration:underline; text-underline-offset:2px; font-size:.82rem; }

/* ---------- motion ---------- */
@keyframes riseIn{ from{opacity:0; transform:translateY(24px);} to{opacity:1; transform:none;} }
.reveal{ opacity:0; transform:translateY(26px); transition:opacity .85s var(--ease-out), transform .85s var(--ease-out); }
.reveal.in{ opacity:1; transform:none; }
/* Reduced motion = gentle, not frozen: keep in-place fades/colour/shadow + smooth
   scroll; only drop the slide-up travel on scroll-reveals. (mirrors index.html) */
@media(prefers-reduced-motion:reduce){
  .reveal:not(.in){ transform:none !important; }
}
