:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --ink: #102a22;
  --ink-2: #3d5249;
  --muted: #6d7c74;
  --line: rgba(16, 42, 34, 0.14);
  --gold: #f2c94c;
  --rust: #d9512c;
  --sage: #cfdccf;
  --white: #fbf9f4;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 22px;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* faint paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.06 0 0 0 0 0.16 0 0 0 0 0.13 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -0.02em; }
h1 em, h2 em { font-style: italic; color: var(--ink-2); }
p { margin: 0; }
a { color: inherit; }
.mono { font-family: var(--mono); }
.label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 22px; text-decoration: none; letter-spacing: -0.01em;
}
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-mark path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { line-height: 1; }
.brand-name small {
  display: block; margin-top: 4px;
  font: 500 9px var(--mono); letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted);
}
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--ink-2); transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta {
  color: var(--white); background: var(--ink);
  padding: 9px 16px; border-radius: 999px;
}
.nav-links .nav-cta:hover { color: var(--gold); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 16px/1 var(--sans);
  padding: 16px 24px; border-radius: 999px;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .2s, background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--rust); transform: translateY(-2px); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(48px, 9vw, 120px) var(--gutter) clamp(56px, 8vw, 100px);
  display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center;
}
.hero h1 { font-size: clamp(46px, 7.4vw, 104px); line-height: 0.98; margin-bottom: 28px; }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); max-width: 34em; margin-bottom: 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.ledger {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(16, 42, 34, 0.35);
  transform: rotate(1.5deg);
  position: relative;
}
.ledger::after {
  /* stacked sheet behind */
  content: ""; position: absolute; inset: 12px -10px -12px 10px; z-index: -1;
  background: var(--sage); border-radius: var(--radius); transform: rotate(-4deg);
}
.ledger-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.tag { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; background: var(--paper-2); padding: 4px 8px; border-radius: 6px; }
.ledger-kpi { display: flex; flex-direction: column; margin: 22px 0 10px; }
.kpi-big { font-family: var(--serif); font-size: 56px; line-height: 1; letter-spacing: -0.03em; }
.kpi-big small { font-size: 20px; color: var(--muted); letter-spacing: 0; }
.ledger-chart { width: 100%; height: 90px; display: block; margin: 8px 0 18px; }
.ledger-chart .line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 1.8s .4s cubic-bezier(.6,.1,.2,1) forwards; }
.ledger-chart .area { fill: var(--gold); opacity: 0; animation: fade .8s 1.6s forwards; }
.ledger-rows { margin: 0; border-top: 1px solid var(--line); }
.ledger-rows div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.ledger-rows div:last-child { border-bottom: 0; padding-bottom: 0; }
.ledger-rows dt { color: var(--ink-2); }
.ledger-rows dd { margin: 0; font-family: var(--mono); font-size: 14px; }
.ledger-rows .up { color: #1f7a4d; }
.ledger-rows .down { color: var(--rust); }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: .35; } }

/* ---------- marquee strip ---------- */
.strip { background: var(--ink); color: var(--paper); overflow: hidden; padding: 18px 0; }
.strip-track { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.strip span { font-family: var(--serif); font-style: italic; font-size: 26px; padding: 0 28px; white-space: nowrap; display: flex; align-items: center; gap: 56px; }
.strip span::after { content: "✦"; font-style: normal; font-size: 14px; color: var(--gold); margin-right: -28px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.services, .bento-wrap, .contact { max-width: var(--max); margin: 0 auto; padding: clamp(72px, 10vw, 140px) var(--gutter) 0; }
.section-head { margin-bottom: clamp(36px, 5vw, 64px); }
.section-head h2, .contact h2 { font-size: clamp(36px, 5.2vw, 68px); line-height: 1.02; max-width: 14em; }

/* services list */
.service-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.service {
  display: grid; grid-template-columns: 80px 1fr 1.2fr; gap: 24px; align-items: baseline;
  padding: 30px 0; border-bottom: 1px solid var(--line);
  position: relative; transition: padding .35s ease;
}
.service::before {
  content: ""; position: absolute; inset: 0 calc(var(--gutter) * -0.5); z-index: -1;
  background: var(--paper-2); border-radius: 14px; opacity: 0; transition: opacity .3s;
}
.service:hover { padding-left: 14px; }
.service:hover::before { opacity: 1; }
.service-num { font-size: 13px; color: var(--rust); }
.service h3 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.1; }
.service p { color: var(--ink-2); }

/* ---------- bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(200px, auto);
  gap: 16px;
}
.tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; flex-direction: column; gap: 12px;
  overflow: hidden; position: relative;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s;
}
.tile:hover { transform: translateY(-4px); box-shadow: 0 24px 40px -28px rgba(16,42,34,.45); }
.tile h3 { font-size: 28px; line-height: 1.1; }
.tile p { color: var(--ink-2); }
.tile-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tile-dark .label { color: var(--gold); }
.tile-accent { background: var(--gold); border-color: var(--gold); }
.tile-accent .label { color: var(--ink-2); }

.tile-scenario { grid-column: span 7; grid-row: span 2; }
.tile-operator { grid-column: span 5; grid-row: span 2; justify-content: space-between; }
.tile-sources  { grid-column: span 5; }
.tile-board    { grid-column: span 3; }
.tile-units    { grid-column: span 4; }
.tile-close    { grid-column: span 12; flex-direction: row; align-items: center; justify-content: space-between; gap: 32px; }

/* scenario */
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 4px; }
.seg button {
  font: 500 13px var(--sans); color: var(--ink-2);
  background: none; border: 0; padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s;
}
.seg button[aria-selected="true"] { background: var(--ink); color: var(--white); }
.scenario-chart { position: relative; margin-top: auto; padding-top: 16px; }
.scenario-chart svg { width: 100%; height: 220px; display: block; }
.grid line { stroke: var(--line); stroke-dasharray: 3 5; }
.s-line { fill: none; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; transition: d .7s cubic-bezier(.6,.1,.2,1); }
.s-area { fill: var(--sage); opacity: .7; transition: d .7s cubic-bezier(.6,.1,.2,1); }
.scenario-readout {
  position: absolute; top: 16px; right: 0;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
  display: flex; flex-direction: column; align-items: flex-end;
}
.scenario-readout .kpi-big { font-size: 40px; }

/* operator */
.statement { font-family: var(--serif); font-size: clamp(28px, 3vw, 40px); line-height: 1.12; color: var(--paper) !important; letter-spacing: -0.015em; }
.tile-operator .small { color: var(--sage); font-size: 15px; max-width: 26em; }

/* sources */
.chips { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font: 13px var(--mono); padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); transition: background .2s, color .2s; }
.tile-sources:hover .chips li:nth-child(odd) { background: var(--ink); color: var(--paper); }

/* board pack */
.pages { position: relative; height: 70px; margin-top: auto; }
.pages span {
  position: absolute; bottom: 0; left: 0; width: 64px; height: 78px; background: var(--white); border-radius: 6px;
  box-shadow: 0 6px 14px -8px rgba(16,42,34,.5); transition: transform .4s cubic-bezier(.2,.8,.2,1);
  background-image: linear-gradient(var(--line) 2px, transparent 2px); background-size: 100% 12px; background-position: 0 14px;
}
.pages span:nth-child(1) { transform: rotate(-8deg); }
.pages span:nth-child(2) { transform: rotate(-2deg) translateX(18px); }
.pages span:nth-child(3) { transform: rotate(5deg) translateX(36px); }
.tile-board:hover .pages span:nth-child(1) { transform: rotate(-14deg) translateX(-4px); }
.tile-board:hover .pages span:nth-child(3) { transform: rotate(10deg) translateX(58px); }

/* unit bars */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 120px; margin-top: auto; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.bar span { display: block; height: 0; background: var(--ink); border-radius: 6px 6px 2px 2px; transition: height 1s cubic-bezier(.2,.8,.2,1); }
.bar:nth-child(2) span { background: var(--rust); }
.bar em { font-style: normal; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tile-units.in .bar span { height: var(--h); }

/* close checklist */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.checks li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.checks li::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: var(--sage) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' stroke='%23102a22' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
}

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: start; padding-bottom: clamp(72px, 10vw, 120px); }
.contact-copy > p { color: var(--ink-2); margin-top: 22px; max-width: 28em; }
.contact-details { list-style: none; padding: 0; margin: 36px 0 0; border-top: 1px solid var(--line); }
.contact-details li { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.contact-details a { font-family: var(--serif); font-size: 26px; text-decoration: none; }
.contact-details a:hover { color: var(--rust); }

.contact-form {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 0; }
.field legend { margin-bottom: 8px; }
input:not([type="checkbox"]), textarea {
  font: 16px var(--sans); color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px;
  transition: border-color .2s, box-shadow .2s; width: 100%;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 55%, transparent); }
.field.invalid input, .field.invalid textarea { border-color: var(--rust); }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-block; font-size: 14px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); transition: all .2s; }
.pick input:checked + span { background: var(--ink); color: var(--white); border-color: var(--ink); }
.pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--gold); }
.contact-form .btn { align-self: flex-start; }
.form-note { font-size: 14px; color: var(--ink-2); min-height: 1.4em; }
.form-note.error { color: var(--rust); }

/* ---------- footer ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px var(--gutter); border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.hero .reveal:nth-child(2) { transition-delay: .08s; }
.hero .reveal:nth-child(3) { transition-delay: .16s; }
.hero .reveal:nth-child(4) { transition-delay: .24s; }
.hero .ledger.reveal { transition-delay: .3s; }
.ledger.reveal.in { transform: rotate(1.5deg); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .ledger { max-width: 460px; }
  .service { grid-template-columns: 56px 1fr; }
  .service p { grid-column: 2; }
  .tile-scenario, .tile-operator { grid-column: span 12; grid-row: auto; }
  .tile-sources { grid-column: span 12; }
  .tile-board, .tile-units { grid-column: span 6; }
  .tile-close { flex-direction: column; align-items: flex-start; }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .brand { font-size: 20px; }
  .service { grid-template-columns: 1fr; gap: 8px; padding: 24px 0; }
  .service p { grid-column: 1; }
  .service:hover { padding-left: 0; }
  .tile { padding: 22px; }
  .tile-board, .tile-units { grid-column: span 12; }
  .scenario-chart svg { height: 180px; }
  .scenario-readout { position: static; align-items: flex-start; margin-bottom: 8px; border: 0; padding: 0; background: none; }
  .ledger { transform: none; }
  .ledger.reveal.in { transform: none; }
  .ledger::after { inset: 10px -6px -10px 6px; }
  .strip span { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .ledger-chart .line { stroke-dashoffset: 0; }
  .ledger-chart .area { opacity: .35; }
}
