/* Martin Bouvet — portfolio. Editorial × terminal. No build step. */
:root {
  --bg: #f6f1e7;
  --bg-2: #efe7d8;
  --ink: #1b1813;
  --ink-2: #4a443a;
  --mute: #8a8274;
  --line: #d9cfbd;
  --accent: #c2410c;
  --accent-2: #ea7a2e;
  --ok: #3f7d4e;
  --card: #fbf8f2;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --max: 1160px;
  --gutter: clamp(18px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e0b; --bg-2: #17140f; --ink: #f1ebdf; --ink-2: #c4bcad; --mute: #857d6f;
    --line: #2c2720; --accent: #f0883e; --accent-2: #ffa657; --ok: #7ee787; --card: #16130f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #100e0b; --bg-2: #17140f; --ink: #f1ebdf; --ink-2: #c4bcad; --mute: #857d6f;
  --line: #2c2720; --accent: #f0883e; --accent-2: #ffa657; --ok: #7ee787; --card: #16130f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); }
.kicker {
  font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.mute { color: var(--mute); }

/* nav */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 16px; }
.brand { font: 600 14px var(--mono); text-decoration: none; }
.brand b { color: var(--accent); }
.nav ul { display: flex; gap: clamp(12px, 2.4vw, 28px); list-style: none; margin: 0; padding: 0; font-size: 14px; }
.nav ul a { text-decoration: none; color: var(--ink-2); }
.theme-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font: 14px var(--mono);
}
@media (max-width: 640px) { .nav ul li.hide-s { display: none; } }

/* hero */
.hero { padding-block: clamp(48px, 9vw, 120px) clamp(40px, 6vw, 80px); }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; margin: 0; }
.hero h1 { font-size: clamp(46px, 7.4vw, 104px); line-height: .98; margin-block: 18px 26px; }
.hero h1 em { color: var(--accent); }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); max-width: 36em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px;
  font: 500 14px var(--mono); text-decoration: none; border: 1px solid var(--ink);
}
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* dial */
.dial-box { position: relative; }
.dial { width: 100%; max-width: 460px; margin-inline: auto; }
.dial .ring { fill: none; stroke: var(--line); }
.dial .night { fill: none; stroke: var(--ink); opacity: .07; }
.dial .tick { stroke: var(--mute); }
.dial .hour { font: 11px var(--mono); fill: var(--mute); }
.dial .job { fill: var(--accent); }
.dial .job-arc { fill: none; stroke: var(--accent); stroke-linecap: round; }
.dial .hand { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.dial .center { font: 400 34px var(--serif); fill: var(--ink); }
.dial .center-sub { font: 11px var(--mono); fill: var(--mute); letter-spacing: .1em; }
.dial .pulse { fill: var(--accent); opacity: .25; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .35; } to { transform: scale(3); opacity: 0; } }
.legend { list-style: none; padding: 0; margin: 18px auto 0; max-width: 460px; font: 12.5px/1.5 var(--mono); color: var(--ink-2); }
.legend li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); }
.legend time { color: var(--accent); min-width: 5.5em; }
.legend li.live time::after { content: " ●"; color: var(--ok); }

/* numbers */
/* status line: the control-room signal, in the page's own voice */
.status-line { display: inline-flex; align-items: center; gap: 9px; }
.status-line .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent);
  animation: ping 3.2s ease-out infinite;
}
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { .status-line .dot { animation: none; } }

.numbers { border-block: 1px solid var(--line); background: var(--bg-2); }
.status-note { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 22px; }
.status-note span { font: 11px/1.5 var(--mono); color: var(--mute); letter-spacing: .04em; }
.numbers b[data-k="ci"], .numbers b[data-k="ship"] { font-size: clamp(26px, 3vw, 36px); }
.numbers b[data-k="ci"] { color: var(--ok); }
.numbers .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.numbers div { padding: 26px 18px; border-left: 1px solid var(--line); }
.numbers div:first-child { border-left: 0; }
.numbers b { display: block; font: 400 clamp(34px, 4vw, 48px)/1 var(--serif); }
.numbers span { font: 12px var(--mono); color: var(--mute); }
@media (max-width: 720px) {
  .numbers .wrap { grid-template-columns: repeat(2, 1fr); }
  .numbers div:nth-child(3) { border-left: 0; }
  .numbers div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* sections */
section.block { padding-block: clamp(64px, 9vw, 120px); }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 40px; }
.sec-head h2 { font-size: clamp(36px, 5vw, 64px); line-height: 1; margin-top: 12px; }
.sec-head p { max-width: 30em; color: var(--ink-2); margin: 0; }

/* case cards */
.cases { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.case {
  grid-column: span 3; position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: clamp(22px, 3vw, 32px); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; text-decoration: none; overflow: hidden;
  transition: transform .25s ease, border-color .25s ease;
}
.case:hover { transform: translateY(-3px); border-color: var(--accent); color: inherit; }
.case.wide { grid-column: span 6; }
.case.third { grid-column: span 2; }
@media (max-width: 880px) { .case, .case.third { grid-column: span 6; } }
.case h3 { font-size: clamp(28px, 3vw, 40px); line-height: 1.05; }
.case p { margin: 0; color: var(--ink-2); }
.case .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { font: 11.5px var(--mono); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.tag.live { border-color: var(--ok); color: var(--ok); }
.case .num { position: absolute; right: 22px; top: 18px; font: 12px var(--mono); color: var(--mute); }
.case .arrow { font: 13px var(--mono); color: var(--accent); }
.case-art { height: 150px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.case-art svg { width: 100%; height: 100%; }

/* business strip */
.biz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 880px) { .biz { grid-template-columns: 1fr; } }
.biz article { border-top: 2px solid var(--ink); padding-top: 18px; }
.biz h3 { font-size: 28px; margin-bottom: 8px; }
.biz p { color: var(--ink-2); margin: 0 0 10px; }

/* other work */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filters button {
  font: 12.5px var(--mono); padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.other { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.other li { display: grid; grid-template-columns: 1.1fr 2fr auto; gap: 18px; padding: 16px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.other li b { font-weight: 600; }
.other li span { color: var(--ink-2); font-size: 15px; }
.other li a { font: 12.5px var(--mono); white-space: nowrap; }
@media (max-width: 720px) { .other li { grid-template-columns: 1fr; gap: 4px; } }

/* about */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); }
@media (max-width: 880px) { .about { grid-template-columns: 1fr; } }
.about .big { font: 400 clamp(28px, 3.4vw, 44px)/1.15 var(--serif); margin: 0; }
.about .big em { color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.timeline li { display: grid; grid-template-columns: 7em 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline time { font: 12.5px var(--mono); color: var(--accent); }

footer { border-top: 1px solid var(--line); padding-block: 40px; font: 13px var(--mono); color: var(--mute); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* case study pages */
.cs-hero { padding-block: clamp(48px, 8vw, 100px) 40px; border-bottom: 1px solid var(--line); }
.cs-hero h1 { font-size: clamp(44px, 7vw, 92px); line-height: 1; margin-block: 14px 20px; }
.cs-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 36px; border-top: 1px solid var(--line); }
.cs-facts div { padding: 16px 16px 0 0; }
.cs-facts dt { font: 11.5px var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.cs-facts dd { margin: 6px 0 0; font-size: 15px; }
@media (max-width: 720px) { .cs-facts { grid-template-columns: repeat(2, 1fr); } }
.cs-body { display: grid; grid-template-columns: 220px 1fr; gap: clamp(24px, 5vw, 72px); padding-block: 56px 96px; }
@media (max-width: 880px) { .cs-body { grid-template-columns: 1fr; } .cs-toc { display: none; } }
.cs-toc { position: sticky; top: 90px; align-self: start; font: 13px/2 var(--mono); }
.cs-toc a { text-decoration: none; color: var(--mute); display: block; }
.cs-toc a:hover { color: var(--accent); }
.prose { max-width: 42em; }
.prose h2 { font-size: clamp(30px, 3.6vw, 44px); margin: 56px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); font-size: 17px; }
.prose strong { color: var(--ink); }
.prose ul { padding-left: 1.2em; }
.diagram { margin: 26px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow-x: auto; }
.diagram svg { min-width: 560px; }
.diagram .box { fill: var(--bg-2); stroke: var(--line); }
.diagram .box.hot { stroke: var(--accent); }
.diagram text { font: 12px var(--mono); fill: var(--ink); }
.diagram .sub { fill: var(--mute); font-size: 10.5px; }
.diagram .edge { stroke: var(--accent); fill: none; stroke-width: 1.5; marker-end: url(#arr); }
.diagram marker path { fill: var(--accent); }
.callout { border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 26px 0; font: 400 24px/1.35 var(--serif); color: var(--ink); }
.signals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0; }
.signals div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.signals b { display: block; font: 400 34px/1 var(--serif); color: var(--accent); }
.signals span { font: 12px var(--mono); color: var(--mute); }
@media (max-width: 720px) { .signals { grid-template-columns: 1fr 1fr; } }
/* Where a number came from, under the numbers it explains. */
.src { font: 11.5px/1.6 var(--mono); color: var(--mute); margin: -8px 0 26px; }
/* a date must break before it, never inside it */
.nb { white-space: nowrap; }
.next-cs { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-block: 32px; font: 14px var(--mono); }

/* reveal */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dial .pulse { animation: none; }
  html { scroll-behavior: auto; }
}

/* fixes: grid children may shrink; legend wraps; callout beats .prose p */
.hero-grid > *, .about > *, .cs-body > * { min-width: 0; }
.hero h1 { overflow-wrap: break-word; }
.legend li span { min-width: 0; overflow-wrap: anywhere; }
.prose .callout { font: 400 clamp(22px, 2.4vw, 28px)/1.3 var(--serif); color: var(--ink); }
.other li { grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) 4.5em; }
.other li a { text-align: right; }
@media (max-width: 720px) { .other li { grid-template-columns: 1fr; } .other li a { text-align: left; } }
@media (max-width: 480px) { .nav ul { gap: 14px; } .legend time { min-width: 4.6em; } }

/* reading progress */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 20; transition: width .1s linear; }
@media (prefers-reduced-motion: reduce) { .progress { transition: none; } }
