/* ── johan_u · design tokens ─────────────────────────────────────────────
   Light is the base. Dark is redefined twice: once for system preference
   (unless the visitor explicitly chose light) and once for the toggle,
   so the switch wins in both directions.                                */

:root {
  --bg:          #FDFBF7;
  --surface:     #FFFFFF;
  --surface-2:   #F6F1EA;
  --ink:         #16202B;
  --ink-2:       #3D4954;
  --muted:       #6B7680;
  --accent:      #B4530F;
  --accent-2:    #8F4109;
  --accent-soft: #FAEEE2;
  --line:        #E8DFD5;
  --line-soft:   #F0E9E1;
  --shadow:      0 1px 2px rgba(22,32,43,.04), 0 14px 32px -18px rgba(22,32,43,.28);
  --shadow-lift: 0 2px 4px rgba(22,32,43,.05), 0 22px 46px -20px rgba(22,32,43,.34);

  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

  --wrap: 1060px;
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #10141A;
    --surface:     #161C23;
    --surface-2:   #1D242C;
    --ink:         #ECEFF3;
    --ink-2:       #C4CCD5;
    --muted:       #8C97A3;
    --accent:      #F08A3C;
    --accent-2:    #FFA662;
    --accent-soft: #2B1D12;
    --line:        #29313A;
    --line-soft:   #212831;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 14px 32px -18px rgba(0,0,0,.7);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 22px 46px -20px rgba(0,0,0,.8);
  }
}

:root[data-theme="dark"] {
  --bg:          #10141A;
  --surface:     #161C23;
  --surface-2:   #1D242C;
  --ink:         #ECEFF3;
  --ink-2:       #C4CCD5;
  --muted:       #8C97A3;
  --accent:      #F08A3C;
  --accent-2:    #FFA662;
  --accent-soft: #2B1D12;
  --line:        #29313A;
  --line-soft:   #212831;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 14px 32px -18px rgba(0,0,0,.7);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 22px 46px -20px rgba(0,0,0,.8);
}

/* ── base ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

::selection { background: var(--accent); color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 16px; z-index: 100;
  border-radius: 0 0 var(--r-sm) 0; font-size: 14px; font-weight: 600;
}
.skip:focus { left: 0; color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ── header ────────────────────────────────────────────────────────────── */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.head-in {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}

.wordmark {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--ink);
  margin-right: auto;
  white-space: nowrap;
}
.wordmark:hover { color: var(--ink); }
.wordmark .us { color: var(--accent); }



.nav { display: flex; align-items: center; gap: 4px; }

.nav a {
  font-size: 14.5px; font-weight: 500; color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px;
  transition: background-color .16s ease, color .16s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.theme-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  cursor: pointer; padding: 0;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun  { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

/* ── typography ────────────────────────────────────────────────────────── */

.eyebrow {
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--accent);
  margin: 0 0 22px;
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0; line-height: 1.16; }

.display {
  font-size: clamp(2.6rem, 6.4vw, 4.1rem);
  letter-spacing: -1.6px;
  margin-bottom: 20px;
}
h2 { font-size: clamp(1.55rem, 3.1vw, 2.05rem); letter-spacing: -.7px; }
h3 { font-size: 1.12rem; letter-spacing: -.3px; line-height: 1.34; }

p { margin: 0 0 18px; color: var(--ink-2); }
p:last-child { margin-bottom: 0; }

.lede { font-size: 1.14rem; line-height: 1.66; color: var(--ink-2); }
.lede strong { color: var(--ink); font-weight: 600; }

.section { padding: 76px 0; }
.section + .section { border-top: 1px solid var(--line-soft); }

/* ── hero ──────────────────────────────────────────────────────────────── */

.hero { padding: 92px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% 50% auto -20%;
  height: 420px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
}
.hero > * { position: relative; }

.hero-kicker {
  font-family: var(--mono); font-size: 13px; color: var(--muted);
  letter-spacing: .2px; margin: 0 0 18px;
}
.hero-kicker b { color: var(--accent); font-weight: 500; }

.hero .lede { max-width: 62ch; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: -.1px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-2); color: #fff; box-shadow: var(--shadow-lift); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 15px; height: 15px; }

/* ── facts strip ───────────────────────────────────────────────────────── */

.facts {
  display: grid; gap: 1px; margin-top: 58px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden;
}
.fact { background: var(--bg); padding: 22px 24px; }
.fact dt {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 7px;
}
.fact dd { margin: 0; font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.42; }
.fact dd span { display: block; font-size: 13.5px; font-weight: 400; color: var(--muted); margin-top: 3px; }

/* ── cards ─────────────────────────────────────────────────────────────── */

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px 26px 24px;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }

.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.card h3 { margin: 0; }
.card .when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.card p { font-size: 15px; line-height: 1.58; margin: 0 0 16px; }
.card .tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .3px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.tag.hot { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }

.card.feature { grid-column: 1 / -1; }
@media (min-width: 780px) {
  .card.feature { display: grid; grid-template-columns: 1.3fr .82fr; gap: 40px; align-items: start; padding: 34px; }
}

.spec { border-left: 1px solid var(--line); padding-left: 26px; }
@media (max-width: 779px) {
  .spec { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 22px; margin-top: 4px; }
}
.spec dl { margin: 0; display: grid; gap: 16px; }
.spec dt {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 4px;
}
.spec dd { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.spec .tags { margin-top: 24px; }

/* ── list blocks ───────────────────────────────────────────────────────── */

.split { display: grid; gap: 40px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .split { grid-template-columns: 260px 1fr; gap: 56px; } }

.roadmap { list-style: none; margin: 0; padding: 0; }
.roadmap li {
  display: grid; grid-template-columns: 26px 1fr; gap: 14px;
  padding: 15px 0; border-bottom: 1px solid var(--line-soft);
}
.roadmap li:last-child { border-bottom: 0; }
.roadmap .n { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-top: 4px; }
.roadmap b { display: block; font-size: 15.5px; font-weight: 600; color: var(--ink); }
.roadmap span { font-size: 14.5px; color: var(--muted); }

/* ── about page ────────────────────────────────────────────────────────── */

.portrait-wrap { position: relative; }
.portrait {
  width: 100%; height: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  aspect-ratio: 3 / 4; object-fit: cover; object-position: center 58%;
}
.portrait-cap {
  margin-top: 14px; font-size: 13px; color: var(--muted);
  font-family: var(--mono); line-height: 1.5;
}

.about-grid { display: grid; gap: 44px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .about-grid { grid-template-columns: 340px 1fr; gap: 62px; }
  .portrait-wrap { position: sticky; top: 92px; }
  /* A pinned portrait taller than the window pushes the face below the fold,
     so cap it to the visible height and anchor the crop on the face. */
  .portrait { max-height: calc(100vh - 200px); }
}

.prose h2 { margin: 42px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose p { max-width: 68ch; }

.pull {
  margin: 34px 0; padding: 22px 26px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0;
  font-family: var(--serif); font-size: 1.16rem; line-height: 1.52; color: var(--ink);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }

/* ── footer ────────────────────────────────────────────────────────────── */

.site-foot { border-top: 1px solid var(--line); padding: 54px 0 64px; margin-top: 20px; }
.foot-in { display: flex; flex-wrap: wrap; gap: 30px 56px; align-items: flex-start; }
.foot-col h4 {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--muted); margin: 0 0 12px; font-family: var(--sans);
}
.foot-col a, .foot-col p { display: block; font-size: 14.5px; margin: 0 0 7px; color: var(--ink-2); }
.foot-col a:hover { color: var(--accent); }
.foot-note { width: 100%; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line-soft);
             font-size: 13px; color: var(--muted); font-family: var(--mono); }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .hero { padding: 62px 0 52px; }
  .section { padding: 58px 0; }
  .nav a { padding: 7px 9px; font-size: 14px; }
}

/* ── projects page ─────────────────────────────────────────────────────── */

.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.jump a {
  font-size: 13px; font-weight: 600; letter-spacing: .1px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
  transition: border-color .16s ease, color .16s ease, background-color .16s ease;
}
.jump a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.proj { padding: 70px 0; border-top: 1px solid var(--line-soft); scroll-margin-top: 84px; }

.proj-num {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 1.4px; color: var(--accent); text-transform: uppercase;
}
.proj h2 { margin: 10px 0 8px; }
.proj-sub { font-size: 1.05rem; color: var(--ink-2); margin: 0 0 16px; max-width: 60ch; }

.proj-meta {
  display: flex; flex-wrap: wrap; gap: 6px 0;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  padding-bottom: 22px; border-bottom: 1px solid var(--line-soft); margin-bottom: 28px;
}
.proj-meta span { padding-right: 16px; margin-right: 16px; border-right: 1px solid var(--line); }
.proj-meta span:last-child { border-right: 0; margin-right: 0; padding-right: 0; }

.proj-body { display: grid; gap: 38px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 920px) { .proj-body { grid-template-columns: 1fr 1fr; gap: 50px; } }
.proj-body p { font-size: 16px; }

.h-min {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted);
  margin: 0 0 8px;
}
.h-min + p { margin-bottom: 22px; }

.lesson {
  border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 var(--r) var(--r) 0; padding: 18px 22px; margin-top: 4px;
}
.lesson .h-min { color: var(--accent); }
.lesson p { margin: 0; font-size: 15.5px; }

.shots { display: grid; gap: 11px; grid-template-columns: repeat(2, 1fr); align-items: start; }
.shot { margin: 0; }

/* height:auto is required — the width/height attributes on <img> are mapped to
   CSS width/height, and a used height would otherwise override aspect-ratio. */
.shot img {
  width: 100%; height: auto;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface-2); aspect-ratio: 4 / 3; object-fit: cover;
}
.shot.tall img { aspect-ratio: 3 / 4; }
.shot.wide { grid-column: 1 / -1; }
.shot.wide img { aspect-ratio: 16 / 10; }

/* Diagrams and interface screenshots are never cropped: they keep their own
   proportions, because a cropped diagram is a wrong diagram. */
.shot.natural img { aspect-ratio: auto; object-fit: contain; }
.shot figcaption { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }

.proj .tags { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 7px; }

@media (max-width: 620px) {
  /* Two-up thumbnails get too small to read on a phone. */
  .shots { grid-template-columns: 1fr; gap: 14px; }
  .proj { padding: 52px 0; }
  .proj-meta span { border-right: 0; padding-right: 0; margin-right: 0; width: 100%; }
}
