/* ============================================================
   PORTFOLIO — "Quiet Engineering"
   Editorial · paper-warm · SPC-restrained
   Shared design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* paper + ink */
  --paper:        #F5F2EC;
  --paper-card:   #FBFAF6;
  --paper-sunk:   #EFEBE2;
  --ink:          #18170F;
  --ink-soft:     #34322A;
  --muted:        #76726A;
  --faint:        #9E998F;
  --line:         #E4DFD4;
  --line-strong:  #D4CDBE;
  --white:        #FFFFFF;

  /* accent — deep muted forest */
  --accent:       #1E6E4E;
  --accent-deep:  #154E37;
  --accent-tint:  #E8EFE9;

  /* dark band */
  --ink-bg:       #14130D;
  --ink-bg-2:     #1E1C14;
  --on-ink:       #ECE8DE;
  --on-ink-muted: #9C9788;
  --on-ink-line:  #322F25;
  --on-ink-accent:#7FC9A4;

  /* type */
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Hanken Grotesk', system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  --maxw: 1400px;
  --gutter: clamp(22px, 5vw, 76px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { max-width: 1360px; margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.eyebrow .dot { color: var(--accent); }

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

h1, h2, h3, h4 { margin: 0; font-weight: 400; letter-spacing: -0.01em; }

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 6.6vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.022em;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.018em;
}

.lede {
  font-size: clamp(19px, 2vw, 23px);
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 400;
}

.measure { max-width: 64ch; }
.measure-sm { max-width: 48ch; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background:
    radial-gradient(130% 320% at 16% -130%, rgba(47,138,94,0.32), transparent 62%),
    #14130D;
  border-bottom: 1px solid rgba(255,250,244,0.1);
}
.nav .brand{ color: var(--on-ink); }
.nav .wm-word{ display:inline-flex; align-items:center; font-family:var(--sans); font-weight:700; font-size:18px; letter-spacing:0.13em; text-transform:uppercase; color:var(--on-ink); line-height:1; }
.nav .wm-word .apexA{ width:0.6em; height:0.7em; margin:0 0.02em; display:inline-block; overflow:visible; }
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
  height: 68px; display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em;
}
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--ink); position: relative; flex: none;
}
.brand .mark::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -42%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 9px solid var(--accent);
}
.nav-links { display: flex; align-items: center; gap: clamp(18px, 3vw, 38px); }
.nav-links a {
  font-size: 14.5px; color: rgba(236,232,222,0.80); font-weight: 500;
  position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1.5px; width: 0;
  background: var(--accent); transition: width 0.28s ease;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--on-ink); }
.nav-links a.nav-cta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  border: 1px solid rgba(255,250,244,0.4); border-radius: 100px;
  padding: 9px 20px; color: var(--on-ink) !important; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.nav-cta::after { display: none; }
.nav-cta:hover { background: var(--on-ink); color: var(--ink-bg) !important; border-color: var(--on-ink); }

@media (max-width: 640px){
  .nav-links { gap: 16px; }
  .nav-links .hide-sm { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-size: 14.5px; font-weight: 600;
  padding: 13px 22px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform 0.18s ease, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(20,19,13,0.5); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn .arr { transition: transform 0.2s ease; }
.btn:hover .arr { transform: translateX(3px); }

/* ---------- index rows (work list) ---------- */
.index { border-top: 1px solid var(--line-strong); }
.row {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 26px;
  align-items: baseline; padding: 30px 8px 30px 4px;
  border-bottom: 1px solid var(--line);
  position: relative; transition: padding 0.3s ease;
}
.row:hover { padding-left: 18px; }
.row::before {
  content: ""; position: absolute; left: -4px; right: -4px; top: 0; bottom: 0;
  background: var(--paper-card); opacity: 0; transition: opacity 0.3s ease; z-index: -1;
  border-radius: 4px;
}
.row:hover::before { opacity: 1; }
.row-num { font-family: var(--mono); font-size: 13px; color: var(--faint); padding-top: 6px; }
.row-main { display: flex; flex-direction: column; gap: 7px; }
.row-title {
  font-family: var(--serif); font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.05; letter-spacing: -0.015em;
}
.row-desc { font-size: 16px; color: var(--muted); max-width: 52ch; line-height: 1.45; }
.row-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 3px; }
.row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; text-align: right; padding-top: 6px; }
.row-year { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.row-arrow {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: grid; place-items: center; transition: all 0.28s ease; color: var(--ink);
}
.row:hover .row-arrow { background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(-45deg); }

@media (max-width: 720px){
  .row { grid-template-columns: 36px 1fr; gap: 16px; }
  .row-meta { grid-column: 2; align-items: flex-start; flex-direction: row; text-align: left; }
  .row-arrow { display: none; }
}

/* ---------- chips ---------- */
.chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line-strong); border-radius: 100px;
  padding: 4px 11px; background: transparent; white-space: nowrap;
}
.chip-solid { background: var(--accent-tint); border-color: transparent; color: var(--accent-deep); }
.chip-green { background: #DCEFE0; border-color: transparent; color: var(--accent-deep); }

/* ---------- section frame ---------- */
.section { padding: clamp(64px, 9vw, 130px) 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 44px; flex-wrap: wrap;
}
.section-head .label-col { display: flex; flex-direction: column; gap: 16px; }
.rule { height: 1px; background: var(--line-strong); border: 0; margin: 0; }

/* ---------- dark band ---------- */
.band-dark { background: var(--ink-bg); color: var(--on-ink); }
.band-dark .eyebrow { color: var(--on-ink-muted); }
.band-dark .eyebrow .dot { color: var(--on-ink-accent); }
.band-dark .rule { background: var(--on-ink-line); }

/* ---------- stats ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px; background: var(--on-ink-line);
  border: 1px solid var(--on-ink-line); border-radius: 6px; overflow: hidden;
}
.stat { background: var(--ink-bg); padding: 34px 28px; }
.stat-num {
  font-family: var(--serif); font-size: clamp(40px, 5vw, 60px);
  line-height: 1; letter-spacing: -0.02em; color: var(--on-ink);
}
.stat-num .unit { font-size: 0.5em; color: var(--on-ink-accent); }
.stat-label { margin-top: 12px; font-size: 14px; color: var(--on-ink-muted); line-height: 1.4; }

/* ---------- footer ---------- */
.footer { background: var(--ink-bg); color: var(--on-ink); padding: clamp(60px, 8vw, 100px) 0 40px; }
.footer .rule { background: var(--on-ink-line); }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: end; padding-bottom: 48px; }
.footer-cta { font-family: var(--serif); font-size: clamp(32px, 4.4vw, 56px); line-height: 1.02; letter-spacing: -0.02em; }
.footer-links { display: flex; flex-direction: column; gap: 12px; }
.footer-links a { color: var(--on-ink-muted); font-size: 15px; display: inline-flex; align-items: center; gap: 8px; transition: color 0.2s, gap 0.2s; width: fit-content; }
.footer-links a:hover { color: var(--on-ink); gap: 12px; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn-call { display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 14.5px; font-weight: 600; padding: 13px 22px; border-radius: 100px; background: var(--on-ink-accent); color: var(--ink-bg); border: 1px solid var(--on-ink-accent); transition: transform 0.18s ease, box-shadow 0.2s; }
.btn-call:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(0,0,0,0.7); }
.btn-nl { display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 14.5px; font-weight: 600; padding: 13px 22px; border-radius: 100px; background: transparent; color: var(--on-ink); border: 1px solid var(--on-ink-line); transition: background 0.2s, border-color 0.2s; }
.btn-nl:hover { background: #1b1a22; border-color: var(--on-ink-muted); }
.btn-call .arr, .btn-nl .arr { transition: transform 0.2s ease; }
.btn-call:hover .arr, .btn-nl:hover .arr { transform: translateX(3px); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 28px; }
.footer-bottom span { font-family: var(--mono); font-size: 12px; color: var(--on-ink-muted); letter-spacing: 0.03em; }
@media (max-width: 720px){ .footer-top { grid-template-columns: 1fr; } }

/* ---------- reveal animation ----------
   Base state is VISIBLE (robust for print/PDF/no-JS/screenshots).
   JS adds .is-hidden ONLY to elements below the initial viewport,
   then removes it on scroll. Above-the-fold never hides. */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1); }
  .reveal.is-hidden { opacity: 0; transform: translateY(20px); }
}

/* ---------- utility ---------- */
.tags-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.center { text-align: center; }
hr.hair { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ============================================================
   CASE STUDY / DETAIL PAGE COMPONENTS
   ============================================================ */
.cs-back { padding: 26px var(--gutter) 0; }
.cs-back a { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; transition: gap 0.2s, color 0.2s; }
.cs-back a:hover { color: var(--ink); gap: 12px; }

.cs-hero { padding: clamp(28px, 4vw, 48px) 0 clamp(34px, 5vw, 60px); }
.cs-hero .cat { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.cs-title { font-family: var(--serif); font-size: clamp(38px, 6vw, 76px); line-height: 0.98; letter-spacing: -0.022em; max-width: 16ch; }
.cs-dek { font-size: clamp(19px, 2vw, 23px); line-height: 1.5; color: var(--ink-soft); max-width: 60ch; margin-top: 26px; }
.cs-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }

.cs-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 40px; }
.cs-meta .m { background: var(--paper); padding: 20px 22px; }
.cs-meta .mk { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.cs-meta .mv { margin-top: 8px; font-size: 15px; color: var(--ink); line-height: 1.35; font-weight: 500; }

/* confidentiality / sanitized-data notice */
.cs-conf { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 13px 16px; border: 1px dashed var(--line-strong); border-radius: 9px; background: var(--paper-card); max-width: 70ch; }
.cs-conf .lk { flex: none; margin-top: 1px; color: var(--accent-deep); }
.cs-conf .lk svg { display: block; }
.cs-conf p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.cs-conf p b { color: var(--ink-soft); font-weight: 600; }
.vt-demo { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-ink-accent); border: 1px solid color-mix(in srgb, var(--on-ink-accent) 42%, transparent); border-radius: 100px; padding: 3px 9px; white-space: nowrap; }

/* viz feature frame */
.viz-feature { background: var(--ink-bg); border-radius: 14px; overflow: hidden; border: 1px solid var(--on-ink-line); }
.viz-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--on-ink-line); }
.viz-bar .dots { display: flex; gap: 7px; }
.viz-bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--on-ink-line); display: block; }
.viz-bar .vt { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--on-ink-muted); text-transform: uppercase; }
.viz-cap { font-size: 14px; color: var(--muted); margin-top: 16px; font-style: italic; font-family: var(--serif); }

/* body prose */
.cs-body { display: grid; grid-template-columns: 200px 1fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
.cs-body .cs-sticky { position: sticky; top: 92px; }
.cs-body .cs-sticky .eyebrow { display: block; }
.cs-sec { margin-bottom: clamp(40px, 6vw, 72px); }
.cs-sec:last-child { margin-bottom: 0; }
.cs-sec h3 { font-family: var(--serif); font-size: clamp(24px, 3vw, 34px); line-height: 1.05; letter-spacing: -0.016em; margin-bottom: 20px; max-width: 22ch; }
.cs-sec p { font-size: 18px; line-height: 1.62; color: var(--ink-soft); margin: 0 0 18px; max-width: 64ch; }
.cs-sec p strong { font-weight: 600; color: var(--ink); }
.cs-sec p em { font-style: italic; color: var(--accent); }
.cs-sec ul { margin: 0 0 18px; padding: 0; list-style: none; max-width: 64ch; }
.cs-sec ul li { position: relative; padding: 10px 0 10px 26px; font-size: 17px; line-height: 1.5; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.cs-sec ul li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cs-sec ul li strong { color: var(--ink); font-weight: 600; }

@media (max-width: 760px){ .cs-body { grid-template-columns: 1fr; } .cs-body .cs-sticky { position: static; } }

/* pull quote */
.pull { border-left: 3px solid var(--accent); padding: 6px 0 6px 26px; margin: 30px 0; }
.pull p { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 28px); line-height: 1.32; color: var(--ink); font-style: italic; max-width: 30ch; }
.pull .src { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted); margin-top: 14px; font-style: normal; }

/* impact stat row on paper */
.impact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1px; background: var(--line); border:1px solid var(--line); border-radius: 8px; overflow: hidden; }
.impact { background: var(--paper-card); padding: 30px 26px; }
.impact .in { font-family: var(--serif); font-size: clamp(36px,4.4vw,52px); line-height:1; letter-spacing:-0.02em; color: var(--ink); }
.impact .in .u { color: var(--accent); font-size: 0.6em; }
.impact .il { margin-top: 12px; font-size: 14px; color: var(--muted); line-height: 1.45; }

/* talks list */
.talks { border-top: 1px solid var(--line-strong); }
.talk { display: grid; grid-template-columns: 130px 1fr auto; gap: 24px; padding: 22px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.talk .ty { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.talk .tmain .tt { font-size: 17.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.talk .tmain .tv { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.talk .tk { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-deep); background: var(--accent-tint); padding: 4px 10px; border-radius: 100px; white-space: nowrap; align-self: center; }
@media (max-width: 640px){ .talk { grid-template-columns: 1fr; gap: 6px; } .talk .tk { justify-self: start; } }

/* next project */
.nextproj { display: block; padding: clamp(40px,6vw,72px) var(--gutter); }
.nextproj .np-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-ink-muted); }
.nextproj .np-t { font-family: var(--serif); font-size: clamp(30px,4.4vw,54px); line-height: 1.02; letter-spacing: -0.02em; color: var(--on-ink); margin-top: 14px; display: inline-flex; align-items: center; gap: 18px; transition: gap 0.25s; }
.nextproj:hover .np-t { gap: 30px; }
.nextproj .np-t .arr { color: var(--on-ink-accent); }

/* ============================================================
   VIDEO / GIF PLAYER (real product frames)
   ============================================================ */
.vplayer { background:#08070b; position:relative; }
.vp-stage { position:relative; width:100%; aspect-ratio: 2553 / 1197; background:#0c0b10; overflow:hidden; }
.vp-stage img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:top center; opacity:0; transition:opacity .55s ease; }
.vp-stage img.on { opacity:1; }
.vp-controls { display:flex; align-items:center; gap:14px; padding:11px 16px; background:#0e0d12; border-top:1px solid var(--on-ink-line); }
.vp-play { width:34px; height:34px; border-radius:50%; border:1px solid var(--on-ink-line); background:transparent; color:var(--on-ink); display:grid; place-items:center; cursor:pointer; flex:none; transition:background .2s; font-size:13px; }
.vp-play:hover { background:#1b1a22; }
.vp-track { flex:1; height:4px; background:#2a2933; border-radius:4px; overflow:hidden; cursor:pointer; }
.vp-fill { height:100%; width:0; background:var(--on-ink-accent); }
.vp-time { font-family:var(--mono); font-size:11px; color:var(--on-ink-muted); white-space:nowrap; }
.vp-caption { padding:13px 16px; background:#0e0d12; border-top:1px solid var(--on-ink-line); font-size:13.5px; color:var(--on-ink-muted); display:flex; gap:10px; align-items:baseline; min-height:46px; }
.vp-caption b { color:var(--on-ink); font-weight:600; }
.vp-caption .ix { font-family:var(--mono); font-size:11px; color:var(--on-ink-accent); flex:none; }

/* ============================================================
   SPC-STYLE SKETCHES (loose, multi-color line art)
   ============================================================ */
.sk-stroke { fill:none; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.sk-blue { stroke:#3b5bd9; } .sk-orange { stroke:#e8654f; } .sk-green { stroke:#2f9e6e; }
.sk-gold { stroke:#e0a221; } .sk-ink { stroke:#46443c; }
.sk-fill-gold { fill:#e9b62f; } .sk-fill-blue{fill:#3b5bd9;} .sk-fill-green{fill:#2f9e6e;} .sk-fill-orange{fill:#e8654f;}
.sk-figure { border:1px solid var(--line); border-radius:12px; background:
   linear-gradient(0deg, var(--paper-card), var(--paper-card)); padding:20px 22px 16px; margin:6px 0 26px; }
.sk-figure svg { width:100%; height:auto; display:block; }
.sk-figure figcaption { font-family:var(--mono); font-size:11px; letter-spacing:0.03em; color:var(--muted); margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.sk-figure figcaption b { color:var(--ink-soft); font-weight:500; }
/* sketch placed beside prose */
.sk-side { float:right; width:300px; margin:0 0 18px 28px; }
@media (max-width: 720px){ .sk-side { float:none; width:100%; margin:6px 0 24px; } }
.sk-grid-dot { fill:#e9b62f; opacity:.5; }
