/* ============================================================
   Pixel / Editorial — design system
   Palette: warm paper, ink, two accents. Nothing else.
   ============================================================ */

:root {
  --paper:      #f2efe6;
  --paper-2:    #eae6d9;
  --paper-3:    #e2ddcd;
  --ink:        #16140f;
  --ink-soft:   #403b2e;
  --muted:      #6b6350;
  --line:       #d6d0bf;
  --accent:     #e4572e;
  --accent-ink: #b93f1c;
  --teal:       #3f8f9e;

  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto,
             "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo,
               Consolas, "Liberation Mono", monospace;

  --wrap: 1160px;
  --pad: clamp(20px, 5vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain — pure CSS, no image request */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .035;
  background-image:
    repeating-linear-gradient(0deg,  #000 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 3px);
  background-size: 3px 3px, 3px 3px;
}

img, canvas { display: block; max-width: 100%; }
canvas.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: 12px; top: -100px;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font: 600 .85rem/1 var(--font-mono);
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ── micro type ───────────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  font: 500 .72rem/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dot {
  width: 7px; height: 7px;
  background: var(--accent);
  box-shadow: 3px 3px 0 0 var(--accent-ink);
  flex: none;
  animation: blink 3.2s steps(1) infinite;
}

@keyframes blink {
  0%, 92%, 100% { opacity: 1; }
  94%, 98%     { opacity: .25; }
}

h1, h2, h3 { font-weight: 620; letter-spacing: -.028em; text-wrap: balance; margin: 0; }

h2 {
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.9rem);
  line-height: 1.06;
}

/* ── buttons ─────────────────────────────────────────────── */

.btn {
  --btn-bg: transparent;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--ink);
  font: 600 .9rem/1 var(--font-ui);
  letter-spacing: -.005em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background-color .18s var(--ease), color .18s var(--ease);
}

.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 0 var(--ink); }
.btn:active { transform: translate(0, 0); box-shadow: 0 0 0 0 var(--ink); }

.btn--solid { --btn-bg: var(--ink); color: var(--paper); }
.btn--solid:hover { box-shadow: 4px 4px 0 0 var(--accent); }

/* ── nav ─────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}

@supports (backdrop-filter: blur(4px)) {
  .nav { backdrop-filter: blur(8px) saturate(1.1); }
}

.nav--scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}

.nav__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font: 600 .95rem/1 var(--font-mono);
  letter-spacing: -.02em;
}

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: contain;
  transition: transform .25s var(--ease);
  flex: none;
}
.brand:hover .brand__mark { transform: rotate(-5deg) scale(1.04); }

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
  font: 500 .85rem/1 var(--font-mono);
}

.nav__links a {
  position: relative;
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: 6px;
  transition: color .18s var(--ease);
}

/* numbered nav labels, the reference's clearest structural idea */
.nav__num {
  font-size: .68em;
  color: #5f5747;
  margin-right: .5em;
  font-variant-numeric: tabular-nums;
  transition: color .18s var(--ease);
}

.nav__links a:hover .nav__num { color: var(--accent-ink); }

/* local time — a small sign of life, top right */
.nav__clock {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  font: 500 .74rem/1 var(--font-mono);
  color: #5f5747;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nav__clock-city { color: #6b6353; }
.nav__clock time { color: var(--ink-soft); }

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s var(--ease);
}

.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); }

.nav__cta {
  padding: 9px 15px !important;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink) !important;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.nav__cta::after { display: none; }
.nav__cta:hover { background: var(--ink); color: var(--paper) !important; }

/* ── hero ────────────────────────────────────────────────── */

.hero { padding-block: clamp(48px, 8vw, 104px) clamp(56px, 9vw, 116px); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

/* The headline spans the full measure, and each of the two sentences is meant
   to read as one line: "Curious about how intelligence works." / "Careful
   about how it's built."

   That first sentence measures ~16.3x the font size, so the type has to be
   sized against the measure or it either wraps raggedly or overflows its own
   box. The vw coefficient is picked so the sentence fits at every width down
   to ~760px: at 1440px the cap of 4rem gives 1041px inside a 1048px measure.
   Below ~760px it is wider than the column at any legible size, so the copy
   wraps naturally there instead. */
.hero__intro { margin-bottom: clamp(30px, 4vw, 46px); }

.hero__title {
  font-size: clamp(2.5rem, 6vw - .4rem, 4rem);
  line-height: 1.04;
  margin-bottom: 26px;
  max-width: none;
}

.hero__lede {
  max-width: 46ch;
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-size: clamp(1rem, .95rem + .35vw, 1.125rem);
}

.hero__lede strong { color: var(--ink); font-weight: 620; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* stats */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 48px);
  margin: 42px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.stat dt {
  font: 500 .68rem/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat dd {
  margin: 0;
  font: 620 1.65rem/1 var(--font-ui);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* hero art */
.hero__art { margin: 0; }

/* centre the scene on phones, where it is narrower than the column */
@media (max-width: 900px) {
  .hero__art { justify-self: center; width: 100%; max-width: 100%; }
  .hero__art .scene { margin-inline: auto; }
}

/* On phones the scene only reaches a whole-number scale of 1x (180px) inside
   the padded column, which leaves it looking stranded in white space. Let the
   art bleed to the viewport edges so a 2x (360px) scale fits instead — still
   crisp, and it reads as a deliberate full-width plate. Below ~500px that is
   the difference between a 180px thumbnail and a 360px hero image. */
@media (max-width: 560px) {
  .hero__art {
    width: calc(100% + var(--pad) * 2);
    max-width: none;
    margin-inline: calc(var(--pad) * -1);
  }
  /* the plate bleeds, but the caption stays aligned with the text column */
  .hero__caption { padding-inline: var(--pad); }
}

.scene {
  /* pinch the canvas to a whole pixel ratio so blocks stay square on phones.
     --scene-scale is set by JS to the integer that best fills the column,
     falling back to 1 when scripting is off. */
  width: calc(180px * var(--scene-scale, 1));
  max-width: 100%;
  height: auto;
  aspect-ratio: 180 / 150;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 2px;
  display: block;
}

.hero__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  font: 500 .72rem/1 var(--font-mono);
  color: var(--muted);
  letter-spacing: .04em;
}

.hero__caption em { font-style: italic; color: var(--ink-soft); }

.pixbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease),
              background-color .18s var(--ease);
}
.pixbtn:hover { color: var(--ink); border-color: var(--ink); background: var(--paper-2); }
.pixbtn canvas { width: 10px; height: 10px; }

/* ── sections ────────────────────────────────────────────── */

.section { padding-block: clamp(56px, 8vw, 104px); }

.section--alt {
  background: var(--paper-2);
  border-block: 1px solid var(--line);
}

/* availability pill — states the ask before the reader has to guess */
.avail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 26px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: #faf8f2;
  font: 500 .72rem/1 var(--font-mono);
  letter-spacing: .02em;
  color: var(--ink-soft);
}

.avail__dot {
  width: 6px;
  height: 6px;
  background: #2f9e5f;
  box-shadow: 0 0 0 3px rgb(47 158 95 / .18);
  animation: avail-pulse 2.6s var(--ease) infinite;
}

@keyframes avail-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgb(47 158 95 / .18); }
  50%      { box-shadow: 0 0 0 5px rgb(47 158 95 / .07); }
}

/* the toolchain, grouped by problem */
.stack {
  margin: 0;
  border-top: 1px solid var(--line);
}

.stack__row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.stack__row dt {
  font: 500 .74rem/1.5 var(--font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}

.stack__row dd {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.stack__row dd span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #faf8f2;
  font: 500 .8rem/1.35 var(--font-ui);
  color: var(--ink-soft);
}

.stack__note {
  margin: 30px 0 0;
  max-width: 62ch;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.stack__note-key {
  font: 500 .7rem/1 var(--font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-right: 10px;
}

.section__head { max-width: 62ch; margin-bottom: clamp(34px, 5vw, 56px); }

.section__sub {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.0125rem;
  max-width: 56ch;
}

/* ── projects ────────────────────────────────────────────── */

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding-block: clamp(26px, 3.4vw, 36px);
  border-bottom: 1px solid var(--line);
}

.project__link { text-decoration: none; display: block; }

.project__top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.project h3 {
  font-size: clamp(1.3rem, 1.1rem + .7vw, 1.7rem);
  transition: color .2s var(--ease);
}

.project__arrow {
  font-size: 1.1rem;
  color: var(--accent);
  transform: translate(-4px, 4px);
  opacity: 0;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}

.project__link:hover .project__arrow { opacity: 1; transform: translate(0, 0); }
.project__link:hover h3 { color: var(--accent-ink); }

.project__desc {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: .975rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.tags li {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--muted);
  font: 500 .69rem/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.project__art {
  margin: 0;
  justify-self: end;
  width: 190px;
  max-width: 100%;
}

.project__art canvas,
.project__art img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  display: block;
}

.project__art img { object-fit: cover; }

.project__art canvas.drawn:hover,
.project__art img:hover {
  transform: translate(-3px, -3px);
  box-shadow: 5px 5px 0 0 var(--ink);
}

/* ── the network showpiece ───────────────────────────────── */

.net {
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(56px, 8vw, 100px);
  border-block: 1px solid #2a2620;
  position: relative;
  overflow: hidden;
}

/* faint pixel grid behind the panel */
.net::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg,  rgba(255,255,255,.028) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.028) 0 1px, transparent 1px 12px);
}

.net .wrap { position: relative; }

.net__head {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  margin-bottom: clamp(30px, 4vw, 48px);
}

.eyebrow--inv { color: #8d8a7c; }

.net h2 {
  font-size: clamp(1.8rem, 1.1rem + 2.6vw, 3rem);
  line-height: 1.04;
  letter-spacing: -.032em;
  color: var(--paper);
}

.net__lede {
  margin: 0;
  color: #a9a496;
  font-size: .975rem;
  line-height: 1.65;
  max-width: 54ch;
}

.net__stage {
  position: relative;
  border: 1px solid #2a2620;
  background: #0e1215;
  border-radius: 2px;
  overflow: hidden;
}

.net__canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 180;
  display: block;
}

.net__hud {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  background: rgba(10, 13, 16, .82);
  border: 1px solid #24313a;
  border-radius: 2px;
  font: 500 .64rem/1.35 var(--font-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #5f7783;
  pointer-events: none;
}

.net__hud-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
}

.net__hud-row span:last-child { color: #c3d6dd; }

.net__ok { color: #8fd0a8 !important; }
.net__loss { color: var(--accent) !important; }

.net__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.pixbtn--inv {
  border-color: #3a352c;
  color: #b9b3a3;
  font: 500 .72rem/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 13px;
}

.pixbtn--inv:hover {
  color: var(--paper);
  border-color: var(--paper);
  background: #1c1a15;
}

.net__note {
  margin: 0 0 0 auto;
  font: 400 .68rem/1.4 var(--font-mono);
  color: #8a8474;
  max-width: 34ch;
}

@media (max-width: 860px) {
  .net__head { grid-template-columns: 1fr; align-items: start; }
  .net__note { margin-left: 0; max-width: none; }
  .net__hud { top: 8px; right: 8px; padding: 7px 9px; font-size: .58rem; }
}

@media (max-width: 520px) {
  .net__hud { display: none; }
}

/* ── flagship project ────────────────────────────────────── */

.flagship {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: start;
  padding: clamp(26px, 3.5vw, 40px);
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: 2px;
  margin-bottom: clamp(38px, 5vw, 56px);
  position: relative;
}

/* corner ticks — a nod to editor crop marks */
.flagship::before,
.flagship::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  background: var(--accent);
}
.flagship::before { top: -1px; left: -1px; }
.flagship::after { bottom: -1px; right: -1px; }

.flagship__label {
  margin: 0 0 12px;
  font: 500 .68rem/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.flagship__title {
  font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.6rem);
  letter-spacing: -.035em;
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.flagship__fa {
  font-size: .62em;
  color: var(--muted);
  font-weight: 400;
  direction: rtl;
}

.flagship__desc {
  margin: 0 0 24px;
  max-width: 56ch;
  color: var(--ink-soft);
}

/* Four metrics sit as a balanced 2x2 rather than 3 + 1 orphan */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  list-style: none;
  margin: 0 0 24px;
  padding: 18px 0;
  border-block: 1px solid var(--line);
}

.metrics__v {
  display: block;
  font: 620 1.02rem/1.2 var(--font-mono);
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.metrics__k {
  display: block;
  font: 400 .68rem/1.3 var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.flagship__detail {
  margin: 0 0 4px;
  max-width: 56ch;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: .93rem;
  line-height: 1.6;
}

.flagship__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 22px 0 0;
  font: 500 .84rem/1 var(--font-mono);
}

.flagship__links a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}

.flagship__links a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

.flagship__art { margin: 0; }

.flagship__art canvas,
.flagship__art img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--paper-2);
  display: block;
}

.flagship__art img { object-fit: cover; }

.flagship__art figcaption {
  margin-top: 10px;
  font: 400 .68rem/1.4 var(--font-mono);
  color: var(--muted);
  letter-spacing: .03em;
}

.more {
  margin: clamp(30px, 4vw, 44px) 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: .92rem;
  color: var(--muted);
  max-width: 70ch;
}

.more a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.more a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

@media (max-width: 900px) {
  .flagship { grid-template-columns: 1fr; }
  .flagship__art { max-width: 300px; }
}

@media (max-width: 560px) {
  .metrics { grid-template-columns: 1fr; gap: 12px; }
  .metrics li { display: flex; align-items: baseline; gap: 12px; }
  .metrics__v { margin-bottom: 0; }
}

/* ── about ───────────────────────────────────────────────── */

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.about__body h2 { margin-bottom: 24px; max-width: 24ch; }
.about__body p { color: var(--ink-soft); max-width: 60ch; }

.about__side { display: grid; gap: 14px; }

.card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
}

.card__label {
  margin: 0 0 8px;
  font: 500 .68rem/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__value { margin: 0; font-size: .95rem; color: var(--ink-soft); }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.links a {
  display: inline-block;
  font: 500 .9rem/1.4 var(--font-mono);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.links a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ── contact ─────────────────────────────────────────────── */

.contact {
  position: relative;
  padding-block: clamp(64px, 9vw, 120px);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.contact__in { position: relative; }

.contact h2 { max-width: 20ch; }
.contact__sub { max-width: 46ch; }

.contact .eyebrow { color: #908a78; }

.contact h2 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.4rem);
  line-height: 1.02;
  margin-bottom: 18px;
  letter-spacing: -.035em;
}

.contact__sub {
  margin: 0 0 34px;
  max-width: 46ch;
  color: #b8b1a0;
}

.contact .btn { border-color: #4a4536; color: var(--paper); }
.contact .btn:hover { box-shadow: 4px 4px 0 0 var(--paper); }
.contact .btn--solid { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.contact .btn--solid:hover { box-shadow: 4px 4px 0 0 var(--paper); }

.contact__art { margin: 44px 0 0; }
.contact__art canvas { width: 36px; height: 36px; opacity: .9; }

/* the address itself, under the buttons */
.contact__addr {
  margin: 20px 0 0;
  font: 500 .82rem/1.4 var(--font-mono);
  letter-spacing: .02em;
}

.contact__addr a {
  color: #8f8a7a;
  text-decoration: none;
  border-bottom: 1px solid #3a352c;
  padding-bottom: 2px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}

.contact__addr a:hover { color: var(--paper); border-bottom-color: var(--paper); }

/* ── footer ──────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-block: 26px;
}

.footer__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 500 .75rem/1.5 var(--font-mono);
  color: var(--muted);
}

.footer p { margin: 0; }
.footer__meta { color: #6f6857; }

/* ── reveal on scroll ────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    translate: 0 16px;
    transition: opacity .65s var(--ease), translate .65s var(--ease);
    transition-delay: var(--d, 0ms);
  }
  .js .reveal.in { opacity: 1; translate: 0 0; }
}

/* ── responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__art { order: -1; max-width: 460px; }
  .about__grid { grid-template-columns: 1fr; }
  .stack__row { grid-template-columns: 1fr; gap: 10px; padding: 16px 0; }
}

/* ── mobile: two-row header ──────────────────────────────────
   Row 1: logo + Tehran clock, pushed to the edges.
   Row 2: the five links, full width, spread edge to edge.

   The wrap is driven purely by source order + flex-basis, so the desktop
   layout (logo | links | clock on one line) needs no extra markup. */
@media (max-width: 768px) {
  .nav__in {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0;
    min-height: 0;
    padding-block: 8px 2px;
  }

  .brand { order: 1; gap: 8px; flex: none; }
  .brand__mark { width: 32px; height: 32px; border-radius: 7px; }
  .brand__txt { font-size: .78rem; }

  /* the clock moves up beside the logo instead of being dropped */
  .nav__clock { order: 2; display: inline-flex; }

  .nav__links {
    order: 3;
    flex: 1 0 100%;
    justify-content: space-between;
    gap: 0;
    font-size: .72rem;
    padding-block: 2px;
    /* the row is a single line at every phone width now, so it never
       needs to scroll — and space-between can do its job */
    overflow: visible;
  }

  .nav__links a {
    padding: 9px 6px;      /* ~34px tap target */
    white-space: nowrap;
    flex: none;
  }
  .nav__cta { padding: 8px 10px !important; }

  /* the index numbers stay — they carry the reading order. They are dropped
     only under 390px, where the five labels alone already fill the row. */
  .nav__num { margin-right: .35em; }
}

@media (max-width: 390px) {
  .nav__links { font-size: .68rem; }
  .nav__num { display: none; }
  .nav__links a { padding: 9px 4px; }
  .nav__cta { padding: 8px 8px !important; }
}

@media (max-width: 768px) {
  /* ── compact project cards ── */
  .flagship { grid-template-columns: 1fr; }
  .flagship__art {
    max-width: 200px;
    width: 100%;
    margin-inline: auto;
    justify-self: center;
  }

  .project {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 14px;
    align-items: start;
    padding-block: 22px;
  }
  .project__art {
    width: 64px;
    justify-self: end;
    align-self: start;
  }
  .project__art canvas,
  .project__art img { aspect-ratio: 1; }
  .project__desc { font-size: .9rem; }
  .project__top { margin-bottom: 8px; }
  .tags { margin-top: 12px; }
}

@media (max-width: 640px) {
  .stats { gap: 18px 32px; margin-top: 34px; }
  .stat dd { font-size: 1.4rem; }
  body::before { opacity: .025; }

  /* inline text links are ~17px tall, too small to hit with a thumb.
     The border stays where it is; only the hit area grows. */
  .flagship__links a,
  .links a,
  .more a,
  .contact__addr a {
    display: inline-block;
    padding-block: 10px;
  }
  .flagship__links { gap: 10px 20px; }
}

/* the wordmark now stays on every phone width, sitting between the logo and
   the clock. It shrinks rather than disappearing, so row 1 keeps its
   logo · name · time reading order at 320px. */
@media (max-width: 400px) {
  .brand { gap: 7px; }
  .brand__txt { font-size: .7rem; letter-spacing: -.03em; }
}

/* ── print ───────────────────────────────────────────────── */

@media print {
  body::before, .nav, .contact__art, .pixbtn { display: none !important; }
  .contact { background: none; color: var(--ink); }
  .reveal { opacity: 1 !important; translate: none !important; }
}
