/* =========================================================
   Idea Folding — origami, paper, measured adversarial weight
   ========================================================= */

:root {
  --paper: #F4EAD3;
  --paper-2: #EFE3C4;
  --paper-3: #E3D4A9;
  --fold: #D8C69A;
  --crease: #A68B4E;
  --ink: #1B1611;
  --ink-2: #2D2620;
  --sumi: #0E0B08;
  --vermilion: #C94F3C;
  --vermilion-2: #A73B2C;
  --gold: #C99A2E;
  --gold-2: #B28624;
  --indigo: #2B3A67;
  --text: #2D2620;
  --text-dim: #6B5D45;
  --rule: rgba(27, 22, 17, 0.12);
  --rule-strong: rgba(27, 22, 17, 0.25);
  --max: 1180px;
  --narrow: 820px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--paper);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-family: 'Fraunces', Georgia, serif; font-weight: 400; }
h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 400; }
em { font-style: italic; color: var(--vermilion); }
strong { color: var(--ink); font-weight: 600; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 100; }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: rgba(244, 234, 211, 0.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 44px; height: 44px; }
.brand-word { font-family: 'Fraunces', serif; font-weight: 500; letter-spacing: -0.01em; font-size: 20px; color: var(--ink); }
.dot-sep { color: var(--vermilion); font-weight: 700; margin: 0 1px; }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--text-dim); font-family: 'Space Grotesk', sans-serif; letter-spacing: 0.02em; }
.nav-links a { position: relative; transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--ink); }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -6px; height: 1px; background: var(--vermilion); transition: right .3s var(--ease); }
.nav-links a:hover::after { right: 0; }

@media (max-width: 720px) {
  .nav { padding: 14px 20px; }
  .nav-links { display: none; }
}

/* ---- Hero ---- */
.hero {
  position: relative; overflow: hidden;
  padding: 120px 32px 120px;
  min-height: 88vh;
  display: flex; align-items: center;
}
.paper-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.paper-bg svg { width: 100%; height: 100%; }
.paper-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(27,22,17,0.04) 1px, transparent 1px),
    radial-gradient(rgba(27,22,17,0.03) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 1px;
  opacity: 0.6;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; width: 100%;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 900px) { .hero-inner { grid-template-columns: 1fr; gap: 32px; } }
.hero-inner > :nth-child(-n+3) { grid-column: 1; }
.hero-inner .molecule-figure { grid-column: 2; grid-row: 1 / span 4; }
@media (max-width: 900px) {
  .hero-inner > :nth-child(-n+3) { grid-column: 1; }
  .hero-inner .molecule-figure { grid-column: 1; grid-row: auto; }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--crease); margin: 0 0 28px;
}
.eyebrow.light { color: rgba(244, 234, 211, 0.7); }
.eyebrow .tick { width: 14px; height: 2px; background: var(--vermilion); }

h1 {
  font-size: clamp(40px, 5.6vw, 72px);
  line-height: 1.0;
  margin-bottom: 32px;
  max-width: 14ch;
  letter-spacing: -0.025em;
}
h1 .emph {
  color: var(--vermilion); font-style: italic; font-weight: 500;
  display: inline-block;
}

.lede {
  font-size: clamp(16px, 1.15vw, 19px);
  max-width: 52ch; color: var(--text); line-height: 1.65;
  margin-bottom: 36px;
}

.cta-row { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500; font-size: 14px; letter-spacing: 0.03em;
  padding: 14px 22px; border-radius: 2px;
  transition: transform .2s var(--ease), background .2s var(--ease), color .2s var(--ease), box-shadow .3s var(--ease);
}
.cta.primary { background: var(--ink); color: var(--paper); box-shadow: 0 6px 20px -8px rgba(27,22,17,0.5); }
.cta.primary:hover { transform: translateY(-2px); background: var(--vermilion); box-shadow: 0 12px 30px -10px rgba(201,79,60,0.6); }
.cta.primary.large { font-size: 16px; padding: 18px 28px; }
.cta.ghost { color: var(--ink); border: 1px solid var(--rule-strong); }
.cta.ghost:hover { border-color: var(--ink); background: rgba(27,22,17,0.04); }
.cta::after { content: "→"; transition: transform .25s var(--ease); }
.cta:hover::after { transform: translateX(3px); }

.molecule-figure {
  margin: 0;
  justify-self: center; align-self: center;
  max-width: 380px;
  text-align: center;
  filter: drop-shadow(0 20px 40px rgba(27,22,17,0.18));
}
.molecule-figure img { width: 100%; height: auto; }
.molecule-figure figcaption {
  font-size: 13px; color: var(--text-dim); line-height: 1.55;
  max-width: 36ch; margin: 20px auto 0;
  font-style: italic;
}
.cap-code {
  display: inline-block; font-family: 'JetBrains Mono', monospace;
  background: var(--ink); color: var(--gold);
  padding: 2px 8px; border-radius: 3px;
  font-size: 11px; letter-spacing: 0.08em; font-style: normal;
  margin-right: 6px;
}

@media (max-width: 640px) {
  .hero { padding: 80px 20px 60px; }
}

/* ---- Sections ---- */
.section { padding: 120px 32px; position: relative; }
.section.paper {
  background:
    linear-gradient(135deg, var(--paper-2) 0%, var(--paper-3) 100%);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.section.paper::before,
.section.paper::after {
  content: ""; position: absolute; left: 0; right: 0; height: 40px;
  pointer-events: none;
}
.section.paper::before { top: 0; background: linear-gradient(180deg, rgba(27,22,17,0.05), transparent); }
.section.paper::after { bottom: 0; background: linear-gradient(0deg, rgba(27,22,17,0.05), transparent); }
.section.ink {
  background: var(--ink);
  color: var(--paper);
}
.section.ink h2, .section.ink h3 { color: var(--paper); }
.section.ink strong { color: var(--gold); }
.section.ink em { color: var(--vermilion); }
.section.ink p { color: rgba(244, 234, 211, 0.82); }

.wrap { max-width: var(--max); margin: 0 auto; position: relative; z-index: 1; }
.wrap.narrow { max-width: var(--narrow); }

h2 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12; margin-bottom: 32px; max-width: 22ch;
  letter-spacing: -0.02em;
}

.prose {
  font-size: 18px; line-height: 1.7; color: var(--text);
  max-width: 70ch; margin-bottom: 1.4em;
}
.section.ink .prose { color: rgba(244, 234, 211, 0.85); }

.xref { color: var(--vermilion); border-bottom: 1px solid rgba(201,79,60,0.4); padding-bottom: 1px; transition: border-color .2s; }
.xref:hover { border-color: var(--vermilion); }
.section.ink .xref { color: var(--gold); border-bottom-color: rgba(201,154,46,0.4); }
.section.ink .xref:hover { border-color: var(--gold); }

/* Code block */
.code-block {
  margin: 56px 0 0;
  background: var(--ink);
  border-radius: 2px;
  padding: 28px 32px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 14px;
  line-height: 1.65;
  color: #E8DBB0;
  overflow-x: auto;
  box-shadow: 0 20px 50px -20px rgba(27,22,17,0.5);
  position: relative;
}
.code-block::before {
  content: "idea-folding.py"; position: absolute;
  top: 10px; right: 16px;
  font-size: 10px; letter-spacing: 0.2em;
  color: rgba(244, 234, 211, 0.4);
  text-transform: uppercase;
}
.code-block pre { margin: 0; }
.code-block code { color: inherit; font-family: inherit; }
.code-block .cmt { color: #6B5D45; font-style: italic; }
.code-block .kw  { color: #C94F3C; font-weight: 500; }
.code-block .fn  { color: #C99A2E; }
.code-block .op  { color: #E8DBB0; }

/* Roles */
.role-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin-top: 56px;
}
@media (max-width: 1000px) { .role-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .role-grid { grid-template-columns: 1fr; } }

.role {
  padding: 28px; background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--rule);
  border-radius: 2px;
  position: relative;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.role:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -20px rgba(27,22,17,0.25); }
.role-num {
  font-family: 'Fraunces', serif; font-size: 46px; font-weight: 300;
  color: var(--vermilion); line-height: 1; margin-bottom: 20px;
  letter-spacing: -0.03em;
}
.role h3 {
  font-family: 'Fraunces', serif; font-weight: 500; font-size: 22px;
  margin-bottom: 6px; letter-spacing: -0.01em;
}
.role-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--crease); margin-bottom: 14px;
}
.role p:last-child { font-size: 14px; color: var(--text); margin: 0; line-height: 1.6; }

.role.keystone { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.role.keystone h3 { color: var(--gold); }
.role.keystone .role-num { color: var(--gold); }
.role.keystone .role-tag { color: var(--paper-2); opacity: 0.7; }
.role.keystone p:last-child { color: rgba(244, 234, 211, 0.82); }

/* Stat row */
.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 40px; margin: 64px 0;
  padding: 40px 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}
.stat-row > div { text-align: center; }
.stat {
  display: block;
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: clamp(40px, 5vw, 72px);
  letter-spacing: -0.03em; color: var(--vermilion);
  line-height: 1; margin-bottom: 10px;
}
.stat-label {
  display: block; font-family: 'Space Grotesk', sans-serif;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); line-height: 1.4;
}
@media (max-width: 720px) { .stat-row { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; } }

/* Engage */
.engage-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px;
  margin-top: 56px;
}
@media (max-width: 720px) { .engage-grid { grid-template-columns: 1fr; } }
.engage-card {
  padding: 32px;
  background: rgba(244, 234, 211, 0.04);
  border: 1px solid rgba(244, 234, 211, 0.12);
  border-radius: 2px;
}
.engage-card h3 {
  font-family: 'Space Grotesk', sans-serif; font-size: 13px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px;
}
.engage-card p { font-size: 15px; color: rgba(244,234,211,0.82); margin: 0; line-height: 1.65; }

.contact {
  margin-top: 56px; padding: 48px; text-align: center;
  border: 1px dashed rgba(244, 234, 211, 0.25);
  border-radius: 2px;
}
.fine { font-size: 13px; color: rgba(244,234,211,0.6); margin-top: 18px; font-style: italic; }

/* Footer */
.foot { padding: 64px 32px; border-top: 1px solid var(--rule); background: var(--paper-2); }
.foot-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 48px; align-items: start; }
.foot-brand { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.foot-brand strong { color: var(--ink); font-family: 'Fraunces', serif; font-weight: 500; font-size: 18px; }
.foot-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.foot-label { font-family: 'Space Grotesk', sans-serif; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--crease); margin: 0 0 10px; }
.foot-cols a { color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.foot-cols a:hover { border-color: var(--vermilion); }
.foot-muted { color: var(--text-dim); font-size: 14px; font-style: italic; }
.foot-fine { grid-column: 1 / -1; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--text-dim); letter-spacing: 0.04em; font-style: italic; }

@media (max-width: 800px) { .foot-inner { grid-template-columns: 1fr; } .foot-cols { grid-template-columns: 1fr; gap: 20px; } }

/* Entrance motion */
@media (prefers-reduced-motion: no-preference) {
  h1, .lede, .cta-row, .molecule-figure {
    animation: riseIn 900ms var(--ease) both;
  }
  .lede { animation-delay: 120ms; }
  .cta-row { animation-delay: 220ms; }
  .molecule-figure { animation: floatIn 1200ms var(--ease) both; }
  @keyframes riseIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes floatIn {
    from { opacity: 0; transform: translateY(20px) rotate(-2deg); }
    to { opacity: 1; transform: translateY(0) rotate(0); }
  }
}
