/* Fluent Systems — paper, ink and one cobalt accent. Instrument Serif for display, Inter for text.
   All fonts self-hosted: the site makes no third-party requests. */
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f2eee5;
  --paper-2: #e9e3d6;
  --ink: #161513;
  --ink-2: #3d3a34;
  --muted: #6b665c;
  --rule: #cfc7b6;
  --accent: #2238d1;          /* cobalt — 8.1:1 on paper */
  --accent-ink: #1a2ca8;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
svg { display: block; max-width: 100%; }

.wrap { width: min(1200px, 100% - 3rem); margin-inline: auto; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--ink); color: var(--paper); padding: .5rem .9rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; background: rgba(242, 238, 229, .92);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--rule); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.wordmark { font-family: var(--serif); font-size: 1.6rem; line-height: 1; text-decoration: none; letter-spacing: -.01em; margin: 0; }
.nav { display: flex; align-items: center; gap: 2rem; font-size: .95rem; }
.nav a { text-decoration: none; position: relative; }
.nav a:not(.nav-cta)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.nav a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta { border: 1px solid var(--ink); padding: .5rem .95rem; transition: background-color .25s, color .25s; }
.nav-cta:hover { background: var(--ink); color: var(--paper); }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(3.2rem, 7.4vw, 6.6rem); line-height: .95; margin-bottom: 2rem; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(2.4rem, 4.6vw, 3.8rem); line-height: 1; margin-bottom: 2.6rem; }
h3 { font-size: 2rem; line-height: 1; margin-bottom: .9rem; }
.lead { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.5; color: var(--ink-2); max-width: 32rem; margin: 0 0 2.4rem; }
.label { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 2rem; }
.caption { font-size: .82rem; color: var(--muted); margin-top: .8rem; }

.button {
  display: inline-flex; align-items: center; gap: .7rem;
  background: var(--ink); color: var(--paper); text-decoration: none;
  padding: 1rem 1.4rem; font-weight: 500; letter-spacing: .01em;
  transition: background-color .25s;
}
.button::after { content: "→"; transition: transform .3s var(--ease); }
.button:hover { background: var(--accent); }
.button:hover::after { transform: translateX(4px); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3.5rem, 8vw, 7rem) 0 clamp(4rem, 8vw, 6rem); border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.drawing { margin: 0; }

/* technical drawing */
.drawing svg { width: 100%; height: auto; }
.frame { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.ticks path, .dim path { fill: none; stroke: var(--ink); stroke-width: 1; }
.wire path { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.route { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.joint circle { fill: var(--ink); }
.box rect, .hub rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.hub rect { fill: var(--ink); }
.hub text { fill: var(--paper); font: 400 22px var(--serif); }
.hub text.sub { font: 500 10px var(--sans); letter-spacing: .12em; text-transform: uppercase; fill: #b9b2a2; }
.box text { font: 500 13px var(--sans); fill: var(--ink); }
.box-accent rect { fill: var(--accent); stroke: var(--accent); }
.box-accent text { fill: #fff; }
.dim text, .tblock text { font: 500 9.5px var(--sans); letter-spacing: .14em; text-transform: uppercase; fill: var(--muted); }
.tblock rect { fill: none; stroke: var(--ink); stroke-width: 1; }
.packet {
  fill: var(--accent);
  offset-path: path("M150 92 H230 V200 H262 H362 H410 V330 H420");
  animation: travel 4.5s cubic-bezier(.45, 0, .25, 1) infinite;
}
@keyframes travel { 0% { offset-distance: 0%; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }

/* lines draw themselves in when the figure appears */
.js .drawing .draw { stroke-dasharray: 600; stroke-dashoffset: 600; transition: stroke-dashoffset 1.8s var(--ease) .3s; }
.js .drawing.in .draw { stroke-dashoffset: 0; }
.js .drawing .route { transition-delay: 1.2s; }

/* ---------- Sections ---------- */
.section { padding: clamp(4.5rem, 9vw, 8rem) 0; border-bottom: 1px solid var(--rule); }
.split { display: grid; grid-template-columns: 180px 1fr; gap: 2rem; }
.section-no { font-family: var(--serif); font-size: 1.4rem; margin: .4rem 0 0; color: var(--muted); }
.section-no::after { content: ""; display: block; width: 36px; height: 1px; background: currentColor; margin-top: .7rem; }

/* problem: ruled list */
.ruled { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.ruled li {
  display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; align-items: baseline;
  padding: 1.6rem 0; border-bottom: 1px solid var(--rule);
  font-size: clamp(1.25rem, 2.1vw, 1.6rem); line-height: 1.35; max-width: 52rem;
}
.ruled .n { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 1.4rem; }

/* how: ink band with three columns */
.section-ink { background: var(--ink); color: var(--paper); border-bottom-color: var(--ink); }
.section-ink .section-no { color: #9a9385; }
.columns { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #4a463f; }
.columns li { padding: 2rem 2rem 0 0; }
.columns li + li { padding-left: 2rem; border-left: 1px solid #4a463f; }
.columns h3 { font-size: clamp(2.2rem, 3.6vw, 3rem); }
.columns li:nth-child(2) h3 { font-style: italic; color: #9aa7ff; }
.columns p { margin: 0; color: #cfc9bc; max-width: 22rem; }

/* examples */
.examples { display: grid; gap: 0; border-top: 1px solid var(--ink); }
.example { display: grid; grid-template-columns: minmax(0, 1.05fr) 1fr; gap: 2rem; padding: 2rem 0; border-bottom: 1px solid var(--rule); align-items: center; transition: background-color .3s; }
.example p { margin: 0; font-size: 1.12rem; color: var(--ink-2); max-width: 30rem; }
.ex-flow { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; font-size: .9rem !important; color: var(--ink) !important; }
.ex-flow span { border: 1px solid var(--ink); padding: .45rem .7rem; background: var(--paper); white-space: nowrap; }
.ex-flow span.hl { background: var(--accent); border-color: var(--accent); color: #fff; }
.ex-flow i { width: 26px; height: 1px; background: var(--ink); position: relative; }
.ex-flow i::after { content: ""; position: absolute; right: 0; top: -3px; border: 3.5px solid transparent; border-left: 6px solid var(--ink); border-right: 0; }
.example:hover .ex-flow i { animation: nudge .6s var(--ease); }
@keyframes nudge { 50% { transform: translateX(3px); } }

/* about */
.section-tint { background: var(--paper-2); }
.about { display: grid; grid-template-columns: 300px 1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.photo { margin: 0; }
.photo-frame {
  position: relative; aspect-ratio: 4 / 5; background: #d9d1c0;
  display: grid; place-items: center; overflow: hidden;
}
.photo-frame::before, .photo-frame::after { content: ""; position: absolute; width: 18px; height: 18px; border: 1px solid var(--ink); }
.photo-frame::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.photo-frame::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.photo-ph { font-size: .82rem; color: var(--muted); background: var(--paper); padding: .3rem .5rem; }
.about-text { font-size: clamp(1.15rem, 1.7vw, 1.4rem); line-height: 1.55; margin: 0; max-width: 40rem; }

/* contact */
.contact h2.big { font-size: clamp(3.4rem, 9vw, 7.5rem); line-height: .9; margin-bottom: 1.8rem; }
.email {
  font-family: var(--serif); font-size: clamp(1.7rem, 4.4vw, 3.4rem); line-height: 1.1;
  color: var(--accent); text-decoration: none; word-break: break-word;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size .45s var(--ease); padding-bottom: .1em;
}
.email:hover { background-size: 0 1px; background-position: 100% 100%; }

/* footer */
.site-footer { padding: 3rem 0 3.5rem; font-size: .9rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 180px 1fr auto; gap: 2rem; align-items: baseline; }
.footer-grid p { margin: 0; }
.site-footer .wordmark { font-size: 1.3rem; color: var(--ink); }
.ph { background: #f1dfa8; color: #5a4300; padding: .05em .3em; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .d1 { transition-delay: .07s; } .js .d2 { transition-delay: .14s; } .js .d3 { transition-delay: .21s; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 1rem; }
  .columns { grid-template-columns: 1fr; }
  .columns li, .columns li + li { padding: 1.6rem 0; border-left: 0; border-bottom: 1px solid #4a463f; }
  .example { grid-template-columns: 1fr; gap: 1rem; }
  .about { grid-template-columns: 1fr; }
  .photo { max-width: 280px; }
  .footer-grid { grid-template-columns: 1fr; gap: .6rem; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 2.2rem); }
  .nav a:not(.nav-cta) { display: none; }
  .ruled li { grid-template-columns: 2.6rem 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .drawing .draw { stroke-dashoffset: 0; }
}

/* ---------- Plain pages ---------- */
.prose { max-width: 720px; }
.prose h1 { font-size: clamp(2.8rem, 6vw, 4.4rem); margin-bottom: 1.6rem; }
.prose p { font-size: 1.15rem; color: var(--ink-2); }
