:root {
  --paper: #F2F2F1;
  --paper-2: #E8E8E6;
  --ink: #0A0A0A;
  --ink-2: #4D4D4B;
  --rule: #D3D3D0;
  --accent: #22B527;
  --accent-ink: #13801A; /* darker green for small text, readable on light grey */
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --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: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 34px; height: 14px; fill: var(--ink); }
.brand-mark .accent { fill: var(--accent); }
.top nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px); font-size: 15px; }
.top nav a { text-decoration: none; color: var(--ink-2); }
.top nav a:hover { color: var(--ink); }
.top nav .nav-cta { color: var(--ink); padding: 7px 14px; border: 1px solid var(--ink); border-radius: 999px; transition: background .2s, color .2s; }
.top nav .nav-cta:hover { background: var(--ink); color: var(--paper); }

/* Hero */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(56px, 11vw, 140px) var(--gutter) clamp(56px, 8vw, 104px);
}
.eyebrow { margin: 0 0 clamp(24px, 4vw, 44px); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.hero-title { font-size: clamp(34px, 7vw, 96px); line-height: 1; letter-spacing: -0.035em; }
.hero-title .line { display: block; }
.hero-title .line:last-of-type { text-align: right; }
.connector { position: relative; display: block; height: clamp(28px, 5vw, 56px); margin: clamp(10px, 2vw, 22px) 0; }
.connector svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.connector line { stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.node { position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--ink); }
.node-a { left: 0; }
.node-b { right: 0; background: var(--accent); }

.hero-foot {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 28px;
  margin-top: clamp(40px, 6vw, 72px); padding-top: 28px; border-top: 1px solid var(--rule);
}
.lede { margin: 0; max-width: 34ch; font-size: clamp(19px, 1.9vw, 23px); line-height: 1.4; color: var(--ink-2); }
.button {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 24px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 500;
  transition: background .2s, transform .2s;
}
.button:hover { background: var(--accent); }
.button span { transition: transform .2s; }
.button:hover span { transform: translateX(4px); }

/* Sections */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(56px, 8vw, 104px) var(--gutter); border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: 64px 1fr; align-items: baseline; margin-bottom: clamp(32px, 5vw, 56px); }
.num { font-size: 13px; color: var(--accent-ink); font-weight: 600; letter-spacing: .08em; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.1; }

.steps { list-style: none; margin: 0; padding: 0 0 0 64px; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 3vw, 48px); counter-reset: s; }
.steps li { counter-increment: s; padding-top: 20px; border-top: 2px solid var(--ink); }
.steps li::before { content: counter(s, decimal-leading-zero); display: block; font: italic 400 40px/1 var(--serif); color: var(--accent-ink); margin-bottom: 18px; }
.steps h3 { font-size: 21px; margin-bottom: 10px; }
.steps p { margin: 0; color: var(--ink-2); }

.index { margin-left: 64px; border-top: 1px solid var(--ink); }
.row {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 24px; align-items: baseline;
  padding: clamp(22px, 3vw, 34px) 0; border-bottom: 1px solid var(--rule);
  transition: background .25s, padding .25s;
}
.row h3 { font-size: clamp(24px, 2.8vw, 34px); line-height: 1.1; }
.side { margin: 0; color: var(--ink); }
.side span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); margin-bottom: 4px; }
.row:hover { background: var(--paper-2); padding-left: 16px; padding-right: 16px; }
.aside { margin: 28px 0 0 64px; color: var(--ink-2); }
.aside a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 4px; }

.ledger { list-style: none; margin: 0 0 0 64px; padding: 0; border-top: 1px solid var(--ink); }
.ledger li {
  display: grid; grid-template-columns: minmax(180px, 1fr) 2fr auto; gap: 24px; align-items: baseline;
  padding: 26px 0; border-bottom: 1px solid var(--rule);
}
.figure { font: 400 clamp(40px, 5vw, 64px)/1 var(--serif); letter-spacing: -0.02em; }
.figure small { display: block; margin-top: 6px; font: 500 12px/1 var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.desc { font-size: 19px; max-width: 46ch; }
.tag { font-size: 13px; padding: 4px 12px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
.note { margin: 20px 0 0 64px; font-size: 14px; color: var(--ink-2); }

/* Contact */
.contact {
  background: var(--ink); color: var(--paper);
  padding: clamp(72px, 11vw, 140px) max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
}
.contact h2 { font-size: clamp(36px, 6vw, 80px); line-height: 1.02; letter-spacing: -0.035em; max-width: 14ch; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: clamp(40px, 6vw, 64px) 0; max-width: 820px; }
.contact-grid h3 { font-size: 18px; margin-bottom: 8px; }
.contact-grid p { margin: 0; color: #B9B5AC; }
.mail {
  display: inline-block; font: italic 400 clamp(30px, 5.4vw, 72px)/1.1 var(--serif);
  text-decoration: none; color: var(--paper); overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 3px no-repeat;
  transition: background-size .35s ease;
  padding-bottom: 6px;
}
.mail:hover, .mail:focus-visible { background-size: 100% 3px; }
.sig { margin: 24px 0 0; color: #8D8A83; font-size: 15px; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding: 24px var(--gutter); background: var(--ink); color: #8D8A83; font-size: 14px;
  border-top: 1px solid #2C2F35;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--paper); }

/* Motion (only when JS confirms motion is welcome) */
.motion .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease var(--d, 0ms), transform .7s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); }
.motion .reveal.in { opacity: 1; transform: none; }
.motion .connector line { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1.4s cubic-bezier(.6,0,.2,1) .35s forwards; }
.motion .node { transform: scale(0); animation: pop .4s ease forwards; }
.motion .node-a { animation-delay: .25s; }
.motion .node-b { animation-delay: 1.6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* Layout breakpoints */
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; padding-left: 0; }
  .index, .ledger, .aside, .note { margin-left: 0; }
  .section-head { grid-template-columns: 48px 1fr; }
  .row { grid-template-columns: 1fr 1fr; }
  .row h3 { grid-column: 1 / -1; }
  .ledger li { grid-template-columns: 1fr auto; }
  .ledger .desc { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top nav a:not(.nav-cta) { display: none; }
  .hero-title .line:last-of-type { text-align: left; }
  .row { grid-template-columns: 1fr; gap: 14px; }
  .row:hover { padding-left: 0; padding-right: 0; background: none; }
  .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .button { width: 100%; justify-content: center; }
  .desc { font-size: 17px; }
}
.hero-title em { white-space: nowrap; }
.hero-title { max-width: 16ch; }
.hero > .connector { margin: clamp(32px, 5vw, 56px) 0 0; }
.ledger li { padding: 20px 0; }
.ledger .figure { font-size: clamp(34px, 3.8vw, 48px); }
.ledger .desc { font-size: 18px; }
@media (min-width: 901px) {
  .ledger li { grid-template-columns: 220px 1fr 160px; }
  .ledger .tag { justify-self: end; }
}

/* Case-study boxes */
.work-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px 32px; margin-bottom: clamp(32px, 5vw, 48px); }
.work-head .section-head { margin-bottom: 0; }
.count { font-family: var(--serif); font-style: italic; color: var(--ink-2); font-weight: 400; }
.work-intro { margin: 12px 0 0; max-width: 46ch; color: var(--ink-2); }
.filters { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--rule); border-radius: 999px; }
.filters button {
  font: 500 14px/1 var(--sans); color: var(--ink-2); background: none; border: 0;
  padding: 10px 16px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.cases {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
}
.case {
  position: relative; display: flex; flex-direction: column;
  min-height: 300px; padding: 28px 28px 32px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  background: var(--paper); transition: background .25s;
}
.case::before {
  content: ""; position: absolute; top: -1px; left: -1px; height: 2px; width: 34%;
  background: var(--ink); transition: width .45s cubic-bezier(.2,.7,.2,1), background .25s;
}
.case:nth-child(3n+2)::before { width: 22%; }
.case:nth-child(3n)::before { width: 12%; }
.case:hover { background: #F8F8F7; }
.case:hover::before { width: calc(100% + 1px); background: var(--accent); }
.case[hidden] { display: none; }

.case-meta { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 auto; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.case-head { margin: 40px 0 0; }
.case-intro .case-head { font: 400 clamp(28px, 2.6vw, 34px)/1.08 var(--serif); letter-spacing: -0.01em; max-width: 13ch; }
.case-result .case-head { font-size: clamp(44px, 4.6vw, 64px); line-height: 1; font-weight: 500; letter-spacing: -0.04em; }
.case-desc { margin: 16px 0 0; color: var(--ink-2); max-width: 30ch; font-size: 16px; }

.case-cta { background: var(--ink); color: var(--paper); text-decoration: none; }
.case-cta::before { background: var(--accent); }
.case-cta:hover { background: #24272D; }
.case-cta .case-meta, .case-cta .case-desc { color: #B9B5AC; }
.case-cta .case-head { font: italic 400 clamp(30px, 2.8vw, 38px)/1.05 var(--serif); max-width: 11ch; }
.case-cta .case-desc span { display: inline-block; transition: transform .2s; }
.case-cta:hover .case-desc span { transform: translateX(4px); }

@media (max-width: 960px) { .cases { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .cases { grid-template-columns: 1fr; }
  .case { min-height: 0; padding: 24px 20px 28px; }
  .case-head { margin-top: 28px; }
  .filters { width: 100%; }
  .filters button { flex: 1; padding: 10px 8px; }
}
.case-intro .case-head { max-width: 16ch; }
.case-result .case-head small { font-size: .42em; letter-spacing: -0.01em; font-weight: 500; color: var(--ink-2); }

/* Green accent + booking */
.brand .scale { color: var(--accent-ink); }
.top nav .nav-cta { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 500; }
.top nav .nav-cta:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.button:hover { background: var(--accent); color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.button-ghost { background: none; color: var(--ink); border: 1px solid var(--ink); }
.button-ghost:hover { background: var(--ink); color: var(--paper); }
.contact .mail { background-image: linear-gradient(var(--accent), var(--accent)); }
.call { margin: 28px 0 0; font-size: 18px; color: #B9B5AC; }
.call a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; text-decoration-thickness: 2px; }
.call a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .hero-actions { width: 100%; }
  .top nav .nav-email { display: none; }
}
.hero-foot { align-items: center; }
.hero-actions { gap: 12px 36px; }
.text-link {
  font-size: 17px; font-weight: 500; text-decoration: none; padding: 4px 0 3px;
  border-bottom: 1.5px solid var(--ink); transition: border-color .2s, color .2s;
}
.text-link span { display: inline-block; margin-left: 4px; color: var(--accent-ink); transition: transform .2s; }
.text-link:hover { border-color: var(--accent); }
.text-link[href="#work"]:hover span { transform: translateY(3px); }
.text-link:not([href="#work"]):hover span { transform: translateX(4px); }
/* One typeface across all case boxes */
.case-intro .case-head, .case-cta .case-head {
  font: 500 clamp(24px, 2.2vw, 28px)/1.15 var(--sans); letter-spacing: -0.02em; max-width: 18ch;
}
