@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f2f5f4;
  --tint: #e6ecea;
  --ink: #0c2430;
  --muted: #475d66;
  --line: #c7d3d0;
  --link: #0b5a70;
  --harbour: #123b4a;
  --harbour-ink: #eef4f2;
  --marigold: #f0ac1b;
  --warn-ink: #8a5c00;
  --warn-fill: #fbe6b4;
  --ok: #0f7b6c;
  --ok-fill: #cdebe3;
  --display: "Bricolage", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --text: "Newsreader", Charter, "Iowan Old Style", Georgia, serif;
  --max: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1a22;
    --tint: #0f2630;
    --ink: #e9f0ee;
    --muted: #9db1b6;
    --line: #21404c;
    --link: #86d3e0;
    --harbour: #0f2d39;
    --warn-ink: #f5b93a;
    --warn-fill: #3a2d0b;
    --ok: #4fd1ad;
    --ok-fill: #0f3b33;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1a22;
  --tint: #0f2630;
  --ink: #e9f0ee;
  --muted: #9db1b6;
  --line: #21404c;
  --link: #86d3e0;
  --harbour: #0f2d39;
  --warn-ink: #f5b93a;
  --warn-fill: #3a2d0b;
  --ok: #4fd1ad;
  --ok-fill: #0f3b33;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 19px/1.62 var(--text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, dt, .btn, .brand, nav a, .r-fact, .r-kind, figcaption, .when { font-family: var(--display); }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
p { margin: 0 0 1em; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 28px; }
.top nav a { color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 500; }
.top nav a:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--marigold); text-decoration-thickness: 3px; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }

/* hero */
.hero { padding: 84px 0 56px; }
h1 {
  margin: 0;
  max-width: 17em;
  font-weight: 640;
  font-size: clamp(2.8rem, 7.4vw, 6.4rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
  font-stretch: 92%;
}
.tagline { margin: 22px 0 0; max-width: 24em; font-family: var(--display); font-weight: 500; font-size: clamp(1.3rem, 2.4vw, 1.9rem); line-height: 1.3; letter-spacing: -0.015em; color: var(--muted); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 64px; margin-top: 48px; align-items: start; }
.lead { font-size: 1.28rem; line-height: 1.55; color: var(--ink); max-width: 34em; margin-bottom: 28px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.btn { display: inline-block; padding: 12px 22px; border: 1.5px solid var(--ink); border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.btn:hover { background: var(--tint); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--harbour); }
.facts { margin: 0; border-top: 1.5px solid var(--ink); }
.facts > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
dt { font-weight: 600; font-size: 15px; color: var(--muted); }
dd { margin: 0; }
.facts dd { font-size: 18px; line-height: 1.4; }

/* hero diagram */
.trace { margin: 64px 0 0; }
.trace-svg { width: 100%; height: auto; display: block; overflow: visible; }
.trace-svg text { font-family: var(--display); font-size: 17px; font-weight: 600; fill: var(--ink); }
.trace-svg .node rect { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.trace-svg .route { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 0; stroke-linecap: round; }
.trace-svg .r-fall { stroke: var(--ok); stroke-width: 3; }
.trace-svg .n-a rect { fill: var(--warn-fill); stroke: var(--marigold); stroke-width: 2.5; }
.trace-svg .n-b rect { fill: var(--ok-fill); stroke: var(--ok); stroke-width: 2.5; }
.trace-svg .n-ok rect { fill: var(--ok-fill); stroke: var(--ok); stroke-width: 2.5; }
.trace-svg .tag { font-size: 15px; font-weight: 600; }
.trace-svg .tag-fail { fill: var(--warn-ink); }
.trace-svg .tag-fb, .trace-svg .tag-ok { fill: var(--ok); }
.trace-svg .dot { display: none; fill: var(--ink); }
.trace figcaption { margin-top: 18px; max-width: 46em; font-size: 16px; line-height: 1.5; color: var(--muted); font-family: var(--text); }

@media (prefers-reduced-motion: no-preference) {
  .trace-svg .route { animation: draw 0.55s ease-out both; }
  .trace-svg .r-main { animation-delay: 0.2s; }
  .trace-svg .r-main.r2 { animation-delay: 0.75s; }
  .trace-svg .r-main.r3 { animation-delay: 1.2s; animation-duration: 0.7s; }
  .trace-svg .r-fall { animation-delay: 2.5s; }
  .trace-svg .r-fall.r5 { animation-delay: 3.2s; }
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

  .trace-svg .n-a rect { animation: fail 0.35s ease-out 2.0s both; }
  @keyframes fail { from { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; } to { fill: var(--warn-fill); stroke: var(--marigold); stroke-width: 2.5; } }
  .trace-svg .n-b rect { animation: good 0.35s ease-out 3.2s both; }
  .trace-svg .n-ok rect { animation: good 0.35s ease-out 3.9s both; }
  @keyframes good { from { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; } to { fill: var(--ok-fill); stroke: var(--ok); stroke-width: 2.5; } }
  .trace-svg .tag { animation: show 0.3s ease-out both; }
  .trace-svg .tag-fail { animation-delay: 2.1s; }
  .trace-svg .tag-fb { animation-delay: 3.3s; }
  .trace-svg .tag-ok { animation-delay: 4.0s; }
  @keyframes show { from { opacity: 0; } to { opacity: 1; } }

  .trace-svg .dot { display: block; opacity: 0; offset-rotate: 0deg; }
  .trace-svg .d1 {
    offset-path: path("M140 80 H620");
    animation: move 1.8s linear 0.2s both, blink 1.8s linear 0.2s both;
  }
  .trace-svg .d2 {
    offset-path: path("M450 108 C450 190 520 190 620 190 L760 190 C850 190 870 80 940 80");
    animation: move 1.5s ease-in-out 2.5s both, blink 1.5s linear 2.5s both;
    fill: var(--ok);
  }
  @keyframes move { from { offset-distance: 0%; } to { offset-distance: 100%; } }
  @keyframes blink { 0% { opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { opacity: 0; } }
}

/* sections */
.block { padding: 88px 0; }
.block.tint { background: var(--tint); }
h2 { font-weight: 640; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 14px; }
.section-intro { color: var(--muted); max-width: 36em; margin: 0 0 40px; font-size: 1.1rem; }

/* selected work */
.rows { border-bottom: 1.5px solid var(--ink); }
.row { position: relative; display: grid; grid-template-columns: 1.05fr 1.6fr 1fr; gap: 40px; padding: 30px 12px; border-top: 1.5px solid var(--ink); align-items: start; }
.row:hover { background: var(--tint); }
.r-name h3 { margin: 0 0 6px; font-weight: 640; font-size: 1.7rem; line-height: 1.12; letter-spacing: -0.02em; }
.r-name a { color: var(--ink); text-decoration: none; }
.r-name a::after { content: ""; position: absolute; inset: 0; }
.row:hover .r-name a { text-decoration: underline; text-decoration-color: var(--marigold); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.r-kind { margin: 0; font-size: 15px; color: var(--muted); }
.r-sum { margin: 0; font-size: 1.05rem; line-height: 1.55; }
.r-fact { margin: 0; padding-left: 14px; border-left: 4px solid var(--marigold); font-weight: 560; font-size: 1.05rem; line-height: 1.35; }

/* more work */
.otrack { margin-top: 48px; }
.otrack-head { display: grid; grid-template-columns: 1.05fr 2.6fr; gap: 40px; margin-bottom: 8px; align-items: baseline; }
.otrack-head h3 { margin: 0; font-size: 1.35rem; font-weight: 640; letter-spacing: -0.015em; }
.otrack-head p { margin: 0; color: var(--muted); font-size: 1rem; }
.orows { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.orow { display: grid; grid-template-columns: 1.05fr 2.2fr 0.8fr 3rem; gap: 40px; padding: 16px 0; border-top: 1px solid var(--line); align-items: baseline; }
.orow h4 { margin: 0; font-size: 1.1rem; font-weight: 620; letter-spacing: -0.01em; }
.orow p { margin: 0; font-size: 1rem; line-height: 1.5; }
.o-tags { font-family: var(--display); font-size: 14px; color: var(--muted); }
.orow a { font-family: var(--display); font-weight: 600; font-size: 15px; justify-self: end; }

/* about */
.about { display: grid; grid-template-columns: 1.15fr 1fr; gap: 80px; align-items: start; }
.about-copy p { font-size: 1.12rem; max-width: 34em; }
.skills { margin: 36px 0 0; border-top: 1.5px solid var(--ink); }
.skills > div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.skills dd { font-size: 1rem; line-height: 1.5; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { padding: 0 0 30px 22px; border-left: 3px solid var(--line); position: relative; }
.timeline li:first-child { border-left-color: var(--marigold); }
.timeline .when { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.timeline h3 { margin: 0 0 6px; font-size: 1.2rem; font-weight: 620; letter-spacing: -0.01em; }
.timeline p { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--muted); }

/* contact */
.contact { background: var(--harbour); color: var(--harbour-ink); padding: 96px 0; }
.contact h2 { max-width: 16em; font-size: clamp(2rem, 4.4vw, 3.6rem); letter-spacing: -0.03em; margin-bottom: 28px; }
.contact-line { margin: 0 0 20px; font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 3vw, 2.3rem); letter-spacing: -0.02em; }
.contact-line a { color: var(--harbour-ink); text-decoration-color: var(--marigold); text-decoration-thickness: 4px; text-underline-offset: 8px; }
.contact-sub { margin: 0; color: #c1d3d3; font-size: 1.05rem; }
.contact-sub a { color: var(--harbour-ink); }

/* footer */
.foot { padding: 26px 0; color: var(--muted); font-family: var(--display); font-size: 15px; border-top: 1px solid var(--line); }
.foot-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-links { display: flex; gap: 22px; }
.foot a { color: var(--ink); }

/* case study */
.case { padding-top: 36px; padding-bottom: 96px; }
.crumb { margin: 0 0 40px; font-family: var(--display); font-size: 15px; font-weight: 500; }
.case-head h1 { font-size: clamp(2.2rem, 5vw, 4rem); max-width: 14em; }
.case-head .lead { margin: 22px 0 0; max-width: 36em; }
.case-grid { display: grid; grid-template-columns: 300px 1fr; gap: 72px; margin-top: 56px; align-items: start; }
.case-meta { position: sticky; top: 92px; border-top: 1.5px solid var(--ink); }
.case-meta dl { margin: 0; }
.case-meta dl > div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.case-meta dt { margin-bottom: 3px; }
.case-meta dd { font-size: 16px; line-height: 1.45; }
.case-body { max-width: 40em; }
.case-body h2 { font-size: 1.7rem; margin: 52px 0 14px; letter-spacing: -0.02em; }
.case-body h2:first-child { margin-top: 0; }
.case-body p, .built li { font-size: 1.1rem; }
.built { padding-left: 1.2em; margin: 0 0 1em; }
.built li { margin-bottom: 0.8em; padding-left: 0.2em; }
.built li::marker { color: var(--marigold); }
.decisions { margin: 0; border-top: 1.5px solid var(--ink); }
.decisions > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.decisions dt { font-size: 1.1rem; color: var(--ink); margin-bottom: 4px; }
.decisions dd { font-size: 1.05rem; color: var(--muted); }
.note { color: var(--muted); font-size: 1rem; border-left: 4px solid var(--line); padding-left: 14px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 88px; border-top: 1.5px solid var(--ink); padding-top: 28px; }
.pager a { text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 620; font-size: 1.25rem; }
.pager a:hover { text-decoration: underline; text-decoration-color: var(--marigold); text-decoration-thickness: 3px; }
.pager a:last-child { text-align: right; }
.pager span { display: block; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.tags { display: none; }

@media (max-width: 900px) {
  .hero-grid, .about, .case-grid { grid-template-columns: 1fr; gap: 40px; }
  .case-meta { position: static; }
  .row { grid-template-columns: 1fr; gap: 12px; padding: 26px 0; }
  .row:hover { background: none; }
  .otrack-head { grid-template-columns: 1fr; gap: 4px; }
  .orow { grid-template-columns: 1fr auto; gap: 4px 16px; }
  .orow p { grid-column: 1 / -1; grid-row: 2; }
  .o-tags { grid-column: 1; grid-row: 3; }
  .orow a { grid-column: 2; grid-row: 1; }
}
@media (max-width: 640px) {
  body { font-size: 18px; }
  .wrap { padding: 0 20px; }
  .hero { padding: 52px 0 36px; }
  .block { padding: 60px 0; }
  .top nav { gap: 18px; }
  .trace { margin-top: 44px; }
  .trace-svg text { font-size: 26px; }
  .trace-svg .tag { font-size: 24px; }
  .skills > div { grid-template-columns: 1fr; gap: 2px; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
  .pager { grid-template-columns: 1fr; }
  .pager a:last-child { text-align: left; }
}
@media (max-width: 420px) { .top nav a:nth-child(2) { display: none; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.cv-links { margin: 0 0 14px; font-size: 1.05rem; color: var(--harbour-ink); }
.cv-links a { color: var(--harbour-ink); text-decoration-color: var(--marigold); text-decoration-thickness: 2px; text-underline-offset: 4px; font-weight: 600; }
