/* ---------- Tokens ---------- */
:root {
  --paper: #f3f5f2;        /* cool lab-bench white */
  --ink: #1d2528;
  --muted: #586569;
  --rule: #d4dad5;
  --accent: #1f6b50;       /* solder-mask green */
  --accent-ink: #ffffff;

  --screen: #0b0f11;
  --shell: #1f6b50;        /* Player1 shell in solder-mask green */
  --shell-dark: #164e3a;
  --amber: #f4a51c;

  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1080px;
  --text: 62ch;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -48px; padding: 8px 12px;
  background: var(--ink); color: var(--paper); z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.wordmark { font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.site-header nav { display: flex; gap: 22px; }
.site-header nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-header nav a:hover { color: var(--accent); }

/* ---------- Intro ---------- */
.intro { padding: 64px 0 24px; }
.intro h1 {
  margin: 0 0 18px;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.lede { max-width: 32ch; font-size: clamp(1.2rem, 2.2vw, 1.45rem); line-height: 1.45; margin: 0 0 14px; }
.status { color: var(--muted); margin: 0 0 26px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

.button {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border: 1.5px solid var(--accent);
}
.button:hover { background: #18573f; border-color: #18573f; }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.quiet:hover { background: var(--ink); color: var(--paper); }

/* ---------- Player1 console ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 56px; align-items: start; }
.intro-text { padding-top: 12px; }

.console { margin: 0; }
.device {
  position: relative;
  padding: 22px 22px 26px;
  border-radius: 28px 28px 44px 28px;
  background: linear-gradient(160deg, #2a7a5c 0%, var(--shell) 45%, var(--shell-dark) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.25), 0 22px 40px -24px rgba(17,52,39,.8);
  outline-offset: 4px;
}
.device:focus-visible { outline: 3px solid var(--ink); }
.device-screen {
  aspect-ratio: 1;
  padding: 10px;
  background: #0a0d0f;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px #050607, inset 0 6px 18px rgba(0,0,0,.7);
}
.device-screen canvas { width: 100%; height: 100%; display: block; }

.device-brand {
  margin: 12px 2px 14px;
  font-weight: 700; font-style: italic; letter-spacing: 0.01em;
  color: rgba(240, 248, 243, .85); font-size: 1.05rem;
}

.device-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }

.dpad { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); }
.dp { border: 0; padding: 0; background: #1b2022; cursor: pointer; box-shadow: 0 3px 0 #0b0e0f; }
.dp:active, .dp.down-held { transform: translateY(2px); box-shadow: 0 1px 0 #0b0e0f; }
.dp.up { grid-area: 1 / 2; border-radius: 6px 6px 0 0; }
.dp.left { grid-area: 2 / 1; border-radius: 6px 0 0 6px; }
.dp.center { grid-area: 2 / 2; background: #1b2022; box-shadow: 0 3px 0 #0b0e0f; }
.dp.right { grid-area: 2 / 3; border-radius: 0 6px 6px 0; }
.dp.down { grid-area: 3 / 2; border-radius: 0 0 6px 6px; }

.select {
  justify-self: center;
  font: inherit; font-size: 0.72rem; font-weight: 600; color: rgba(240,248,243,.8);
  background: #1b2022; border: 0; border-radius: 999px; padding: 6px 12px;
  box-shadow: 0 2px 0 #0b0e0f; cursor: pointer;
}
.select:active { transform: translateY(1px); box-shadow: none; }

.ab { display: flex; gap: 10px; transform: rotate(-18deg); }
.ab button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.9rem; color: #3a1d00;
  background: radial-gradient(circle at 35% 30%, #ffd27a, var(--amber) 70%);
  box-shadow: 0 4px 0 #9c5a00;
}
.ab .btn-b { margin-top: 18px; }
.ab button:active { transform: translateY(3px); box-shadow: 0 1px 0 #9c5a00; }
.device button:focus-visible { outline: 3px solid #f4f6f2; outline-offset: 2px; }

.carts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 16px; }
.cart {
  font-family: var(--mono); font-size: 0.78rem; text-align: center;
  padding: 6px 2px 6px 4px; cursor: pointer;
  background: #e2e6df; color: var(--ink);
  border: 1px solid #c3c9c1; border-left: 4px solid #9aa39b; border-radius: 4px 6px 6px 4px;
}
.cart:hover { border-left-color: var(--accent); }
.cart[aria-pressed="true"] { background: var(--ink); color: #f4f6f2; border-color: var(--ink); border-left-color: var(--amber); }
.cart-help { margin: 10px 0 0; font-size: 0.9rem; color: var(--ink); min-height: 1.5em; }
.console figcaption { margin-top: 6px; font-size: 0.9rem; color: var(--muted); }

/* ---------- Work ---------- */
.work { padding: 72px 0 24px; }
h2 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 28px; }

.project {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}
.project:last-child { border-bottom: 1px solid var(--rule); }

.thumb {
  aspect-ratio: 10 / 7;
  background: var(--screen);
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
}
.thumb canvas { width: 100%; height: 100%; display: block; }
.thumb { aspect-ratio: 1; max-width: 220px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.project-text { max-width: var(--text); }
.project h3 { margin: 0; font-size: 1.45rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.project h3 span { display: block; font-size: 1.05rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.meta { margin: 8px 0 12px; font-size: 0.92rem; color: var(--muted); }
.project-text > p { margin-top: 0; }

.facts { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li {
  font-size: 0.88rem; font-weight: 500; padding: 4px 10px;
  border-radius: 6px; background: #e4e9e4; color: var(--ink);
}

.play {
  font: inherit; font-size: 0.92rem; font-weight: 600;
  background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.play:hover { text-decoration-thickness: 2px; }

/* ---------- Experience ---------- */
.experience { padding: 56px 0 72px; }
.timeline { margin: 0; }
.timeline .row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-top: 1px solid var(--rule); }
.timeline dt { font-weight: 600; }
.timeline dd { margin: 0; max-width: var(--text); }
.timeline dd p { margin: 0 0 6px; }
.role { font-weight: 500; }
.role span { display: block; font-weight: 400; font-size: 0.92rem; color: var(--muted); }
@media (min-width: 720px) { .role span { display: inline; margin-left: 10px; } }

.tools-title { font-size: 1.15rem; font-weight: 600; margin: 40px 0 12px; }
.tools { margin: 0; display: grid; gap: 8px; }
.tools div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 16px; }
.tools dt { font-weight: 600; }
.tools dd { margin: 0; }

.pub { margin: 32px 0 0; color: var(--muted); font-size: 0.95rem; max-width: var(--text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 22px 0; font-size: 0.92rem; color: var(--muted); }
.footer-row p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 36px; }
  .console { max-width: 380px; }
  .project { grid-template-columns: 1fr; gap: 18px; }
  .thumb { max-width: 180px; }
  .timeline .row { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .intro { padding: 40px 0 16px; }
  .site-header nav { gap: 14px; }
  .site-header nav a { font-size: 0.95rem; }
  .device { padding: 16px 16px 20px; }
  .tools div { grid-template-columns: 1fr; gap: 0; }
}
