/* ============================================================
   PlexMesh — design system
   Warm-paper editorial DNA + Exo-Ape cinematic rhythm.
   Bright/dark alternating. Shared by index + /works/*.
   ============================================================ */

:root {
  /* paper + ink (bright sections) */
  --bg:        #F5F0E7;
  --bg-warm:   #EFE8DB;
  --bg-card:   #FCF8F0;
  --bg-bright: #F8F6F1;

  --ink:       #0B0B0C;
  --ink-soft:  #1E1E1C;
  --ink-mid:   #59574F;
  --ink-light: #8C8A80;

  --line:      #DBD3C2;
  --line-soft: #E7E0D0;

  /* dark sections */
  --dark:      #0C0B0A;
  --dark-2:    #131210;
  --darker:    #070707;
  --on-dark:        #F4EFE6;
  --on-dark-soft:   rgba(244, 239, 230, 0.66);
  --on-dark-line:   rgba(244, 239, 230, 0.16);

  /* signal */
  --accent:      #C53A26;
  --accent-deep: #9E2C1B;
  --accent-warm: #E0732B;
  --accent-soft: rgba(197, 58, 38, 0.08);
  --cool:        #2B49C9;

  --aurora: radial-gradient(60% 80% at 14% 10%, rgba(224,115,43,0.30) 0%, transparent 58%),
            radial-gradient(50% 70% at 86% 4%, rgba(197,58,38,0.20) 0%, transparent 55%),
            radial-gradient(80% 90% at 72% 100%, rgba(43,73,201,0.16) 0%, transparent 60%);
  --iris:   linear-gradient(115deg, #E0732B 0%, #C53A26 36%, #C24FB0 70%, #6E7DF0 100%);

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-body:    'Inter', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 1320px;
  --pad: clamp(22px, 6vw, 96px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); position: relative; z-index: 2; }
.full { padding: 0 var(--pad); position: relative; z-index: 2; }

/* paper grain — only on bright body */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.45; mix-blend-mode: multiply;
  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.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================
   NAV — mix-blend-difference (reads over dark + bright)
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(20px, 3vw, 40px) var(--pad);
  mix-blend-mode: difference; color: #fff; pointer-events: none;
}
.nav a, .nav button { pointer-events: auto; }
.logo {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em; text-transform: uppercase; text-decoration: none; color: #fff;
}
.logo-mark { width: 20px; height: 20px; position: relative; }
.logo-mark::before, .logo-mark::after {
  content: ''; position: absolute; inset: 0; border: 1.5px solid #fff; border-radius: 2px;
  transition: transform 0.5s var(--ease);
}
.logo-mark::after { transform: rotate(45deg); }
.logo:hover .logo-mark::after { transform: rotate(135deg); }

.nav-links { display: flex; gap: clamp(20px, 2.5vw, 40px); align-items: center; }
.nav-links a {
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 400;
  position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 1px;
  background: #fff; transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-burger span { width: 24px; height: 2px; background: #fff; transition: 0.3s var(--ease); }

/* mobile menu (shared) */
.mobile-menu { position: fixed; inset: 0; z-index: 98; background: var(--dark); color: var(--on-dark); padding: 110px 28px 40px; transform: translateY(-100%); transition: transform 0.5s var(--ease); display: flex; flex-direction: column; gap: 2px; }
.mobile-menu.open { transform: none; }
.mobile-menu a { font-family: var(--font-display); font-size: 34px; font-weight: 500; letter-spacing: -0.03em; text-decoration: none; color: var(--on-dark); padding: 14px 0; border-bottom: 1px solid var(--on-dark-line); }
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 15px 24px; font-family: var(--font-body); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--bg); border-radius: 999px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 5px 6px 0 var(--accent); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); box-shadow: 5px 6px 0 var(--cool); }
.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* circular arrow link (Exo-Ape style) */
.arrow-link {
  display: inline-flex; align-items: center; gap: 16px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; color: inherit; cursor: pointer;
}
.arrow-link .circle {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid currentColor;
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
  transition: background 0.5s var(--ease), color 0.5s var(--ease), transform 0.5s var(--ease);
  flex: none;
}
.arrow-link .label { position: relative; }
.arrow-link .label::after {
  content: ''; position: absolute; bottom: -3px; left: 0; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease);
}
.arrow-link:hover .label::after { transform: scaleX(1); }
.arrow-link:hover .circle { transform: rotate(45deg); }
.arrow-link.on-bright:hover .circle { background: var(--ink); color: var(--bg); }
.arrow-link.on-dark:hover .circle { background: var(--on-dark); color: var(--dark); }

/* ============================================================
   SECTION SCAFFOLD
   ============================================================ */
section { position: relative; z-index: 2; }
.dark-section { background: var(--dark); color: var(--on-dark); position: relative; z-index: 2; }

.micro {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-mid);
}
.dark-section .micro { color: var(--on-dark-soft); }
.micro .glyph { color: var(--accent); font-size: 13px; }

.section-h {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 86px);
  font-weight: 600; line-height: 0.98; letter-spacing: -0.04em; color: var(--ink);
}
.section-h .italic, .italic { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--accent); }
.dark-section .section-h { color: var(--on-dark); }

.lede { font-size: 18px; line-height: 1.6; color: var(--ink-soft); max-width: 60ch; }
.dark-section .lede { color: var(--on-dark-soft); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   FOOTER (near-black, big)
   ============================================================ */
.footer { background: var(--darker); color: var(--on-dark); padding: clamp(80px,12vh,160px) 0 56px; position: relative; z-index: 2; overflow: hidden; }
.footer-glow { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background: radial-gradient(50% 60% at 80% 0%, rgba(224,115,43,0.18) 0%, transparent 60%); }
.footer .container { position: relative; z-index: 2; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: end; margin-bottom: clamp(48px,8vh,96px); }
.footer-big { font-family: var(--font-display); font-size: clamp(48px,10vw,150px); font-weight: 600; line-height: 0.85; letter-spacing: -0.05em; }
.footer-big .italic { color: var(--accent-warm); }
.footer-pitch { font-size: 16px; line-height: 1.6; color: var(--on-dark-soft); max-width: 40ch; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; padding-top: 40px; border-top: 1px solid var(--on-dark-line); }
.footer-col h4 { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(244,239,230,0.45); margin-bottom: 18px; }
.footer-col a, .footer-col p { display: block; font-size: 15px; color: var(--on-dark-soft); text-decoration: none; margin-bottom: 10px; transition: color 0.2s ease; line-height: 1.5; }
.footer-col a:hover { color: var(--on-dark); }
.footer-base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: clamp(40px,7vh,80px); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: rgba(244,239,230,0.4); }

/* language switcher (in nav) */
.lang { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,0.5); border-radius: 999px; padding: 5px 12px; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.lang:hover { background: #fff; color: #000; }
.lang::after { display: none; }

/* ============================================================
   FIELD DATA FIREWALL — pipeline demo (raw -> Work Graph -> Mandate)
   shared dark-section component
   ============================================================ */
.pipe { margin-top: 60px; border: 1px solid var(--on-dark-line); border-radius: 12px; padding: 30px 32px; background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)); }
.pipe-cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-dark-soft); margin-bottom: 24px; display: flex; gap: 10px; align-items: center; }
.pipe-cap .glyph { color: var(--accent-warm); }
.pipe-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 16px; align-items: stretch; }
.pipe-arrow { color: var(--accent-warm); font-size: 22px; align-self: center; }
.pipe-stage { display: flex; flex-direction: column; gap: 14px; }
.pstage-box { min-height: 152px; flex: 1; border: 1px solid var(--on-dark-line); border-radius: 9px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.pstage-box.raw { background: linear-gradient(135deg,#241a13,#14100c); }
.pstage-box.raw .redact { position: absolute; background: rgba(224,140,90,0.22); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); border: 1px solid rgba(224,140,90,0.45); border-radius: 3px; }
.pstage-box.raw .r1 { left: 14%; top: 20%; width: 36%; height: 22%; }
.pstage-box.raw .r2 { right: 12%; top: 30%; width: 28%; height: 32%; }
.pstage-box.raw .r3 { left: 22%; bottom: 16%; width: 44%; height: 18%; }
.pstage-box.raw .scan { position: absolute; inset: 0; background: linear-gradient(transparent, rgba(224,140,90,0.10), transparent); height: 40%; animation: pscan 3.4s var(--ease) infinite; }
@keyframes pscan { 0% { transform: translateY(-120%); } 100% { transform: translateY(320%); } }
.pstage-tag { position: absolute; bottom: 10px; left: 12px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; color: rgba(244,239,230,0.55); }
.pstage-box.graph { background: rgba(255,255,255,0.02); }
.pstage-box.graph svg { width: 90%; height: auto; overflow: visible; }
.pstage-box.mandate { background: rgba(255,255,255,0.02); flex-direction: column; gap: 10px; align-items: flex-start; padding: 20px 22px; justify-content: center; }
.mandate-row { font-family: var(--font-mono); font-size: 12px; color: var(--on-dark-soft); display: flex; gap: 9px; align-items: center; }
.mandate-row .ck { color: #5FE39B; }
.pstage-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.03em; color: var(--on-dark-soft); }
.pstage-label b { color: var(--accent-warm); font-weight: 500; }
.pmini-path { stroke: rgba(224,140,90,0.55); stroke-width: 1.5; fill: none; stroke-dasharray: 900; stroke-dashoffset: 900; transition: stroke-dashoffset 2s var(--ease); }
.pipe.in .pmini-path { stroke-dashoffset: 0; }
.pmini-node { fill: var(--dark); stroke: var(--accent-warm); stroke-width: 1.5; }
@media (max-width: 760px) {
  .pipe-flow { grid-template-columns: 1fr; }
  .pipe-arrow { transform: rotate(90deg); justify-self: center; }
}

/* ============================================================
   PROJECT DETAIL PAGE (/works/*.html)
   ============================================================ */
.case { padding: clamp(120px,16vh,180px) 0 40px; }
.case-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-mid); text-decoration: none; margin-bottom: 48px; transition: color 0.2s ease;
}
.case-back:hover { color: var(--accent); }
.case-back .arrow { transition: transform 0.2s var(--ease); }
.case-back:hover .arrow { transform: translateX(-4px); }
.case-role {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-mid); margin-bottom: 22px;
}
.case-role .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.case-role.live .dot { background: #2D8A4E; box-shadow: 0 0 0 3px rgba(45,138,78,0.15); }
.case-title { font-family: var(--font-display); font-size: clamp(54px,11vw,150px); font-weight: 600; letter-spacing: -0.05em; line-height: 0.88; margin-bottom: 16px; }
.case-layer { font-family: var(--font-serif); font-style: italic; font-size: clamp(22px,3vw,36px); color: var(--accent); margin-bottom: 36px; }
.case-lede { font-size: 21px; line-height: 1.5; color: var(--ink-soft); max-width: 60ch; }
.case-band { margin: 56px 0 0; height: clamp(220px,40vw,500px); position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 44px; border-radius: 6px; }
.case-band::before { content:''; position:absolute; inset:0; }
.case-band .mono { position: absolute; top: -10px; right: 24px; font-family: var(--font-serif); font-style: italic; font-size: clamp(180px,32vw,460px); line-height: 1; color: rgba(255,255,255,0.13); }
.case-band .caption { position: relative; z-index: 2; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: rgba(255,255,255,0.85); }
.case-meta { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); margin: 56px 0; background: var(--bg-card); }
.case-meta div { padding: 26px 28px; border-right: 1px solid var(--line); }
.case-meta div:last-child { border-right: none; }
.case-meta dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-light); margin-bottom: 10px; }
.case-meta dd { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.case-section { padding: clamp(48px,8vh,80px) 0; border-top: 1px solid var(--line); }
.case-section:first-of-type { border-top: none; }
.case-cols { display: grid; grid-template-columns: 0.5fr 1.2fr; gap: 64px; align-items: start; }
.case-cols h2 { font-family: var(--font-display); font-size: clamp(26px,3vw,40px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.04; }
.case-cols h2 .italic { color: var(--accent); }
.case-prose p { font-size: 17px; line-height: 1.72; color: var(--ink-soft); margin-bottom: 18px; }
.case-prose strong { color: var(--ink); font-weight: 600; }
.case-prose ul { list-style: none; margin: 8px 0 18px; }
.case-prose li { font-size: 17px; line-height: 1.6; color: var(--ink-soft); padding-left: 26px; position: relative; margin-bottom: 12px; }
.case-prose li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }
.case-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 16px 0; }
.case-stat { border: 1px solid var(--line); background: var(--bg-card); padding: 30px 26px; }
.case-stat .n { font-family: var(--font-display); font-size: 42px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin-bottom: 8px; }
.case-stat .l { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-mid); }
.case-next { border-top: 1px solid var(--line); padding: clamp(56px,9vh,90px) 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.case-next .label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-light); margin-bottom: 8px; }
.case-next a.big { font-family: var(--font-display); font-size: clamp(30px,5vw,60px); font-weight: 700; letter-spacing: -0.04em; text-decoration: none; color: var(--ink); transition: color 0.2s ease; }
.case-next a.big:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE BASE
   ============================================================ */
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .case-meta { grid-template-columns: 1fr 1fr; }
  .case-meta div:nth-child(2) { border-right: none; }
  .case-cols { grid-template-columns: 1fr; gap: 24px; }
  .case-stats { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
}
