/* projects.playtesting.dev
   Palette matches the harness diagrams: teal = knows the game, amber = a model,
   violet = the operator. Light and dark follow the visitor's system setting;
   the diagrams swap to their dark versions the same way. */

:root {
  --bg: #EDF1F2;
  --surface: #FBFCFC;       /* same as the light diagrams' background */
  --surface-2: #F2F5F6;
  --ink: #13242B;
  --ink-2: #3A4C54;
  --muted: #5E7179;
  --rule: #D2DCE0;
  --rule-strong: #A8B8BE;
  --accent: #00899C;
  --accent-ink: #00717F;    /* teal dark enough for text links */
  --amber: #C0680E;
  --violet: #7353BA;
  --code-bg: #E3EAEC;
  --gb-bg: #F7F9F2;
  --gb-ink: #1D2B1F;
  --shadow: rgba(0, 60, 70, .40);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-pixel: "Pixelify Sans", "JetBrains Mono", monospace;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1417;
    --surface: #141C21;     /* same as the dark diagrams' background */
    --surface-2: #1A242A;
    --ink: #E2EAED;
    --ink-2: #B4C3C9;
    --muted: #8B9EA6;
    --rule: #25333A;
    --rule-strong: #3E5059;
    --accent: #1C9AAA;
    --accent-ink: #5CC8D6;
    --amber: #CF7D22;
    --violet: #8F72DD;
    --code-bg: #1D282E;
    --gb-bg: #DDE4D8;
    --gb-ink: #18241A;
    --shadow: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--f-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body:has(dialog[open]) { overflow: hidden; }
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }

/* ---------- top bar ---------- */
.site-bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 500 21px/1 var(--f-pixel);
  letter-spacing: .01em;
}
.brand b { font-weight: 500; color: var(--accent); }
.brand img { width: 28px; height: 28px; image-rendering: pixelated; }
.bar-link {
  font: 600 14.5px/1 var(--f-display);
  color: var(--ink-2);
  text-decoration: none;
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}
.bar-link:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- the Game Boy text box ---------- */
.gb {
  position: relative;
  font: 500 clamp(22px, 3.4vw, 32px)/1.45 var(--f-pixel);
  letter-spacing: .02em;
  color: var(--gb-ink);
  background: var(--gb-bg);
  border: 4px solid var(--gb-ink);
  border-radius: 10px;
  box-shadow: inset 0 0 0 4px var(--gb-bg), inset 0 0 0 7px var(--gb-ink);
  padding: 22px 60px 30px 28px;
}
.gb p { margin: 0; }
.gb::after {
  content: "\25BC";
  position: absolute;
  right: 22px;
  bottom: 14px;
  font-size: .5em;
  animation: gb-blink 1.1s steps(2, start) infinite;
}
@keyframes gb-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .gb::after { animation: none; } }

/* ---------- home ---------- */
.hero {
  padding-block: clamp(32px, 7vw, 84px) clamp(28px, 5vw, 56px);
  display: grid;
  gap: 16px;
  justify-items: start;
}
.hero h1 {
  font: 780 clamp(52px, 9vw, 104px)/.92 var(--f-display);
  letter-spacing: -.035em;
  margin: 18px 0 0;
}
.lede {
  font: 400 clamp(18px, 2.2vw, 22px)/1.55 var(--f-body);
  color: var(--ink-2);
  max-width: 52ch;
  margin: 0;
}
.section-label {
  font: 700 12px/1 var(--f-display);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.cards { display: grid; gap: 24px; padding-bottom: 80px; }
.card-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.card-link:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: 0 14px 34px -22px var(--shadow);
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) { .card-link, .card-link:hover { transition: none; transform: none; } }
.card-media { background: #11181C; }
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-body {
  padding: clamp(22px, 3.2vw, 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  font: 500 13px/1.4 var(--f-mono);
  color: var(--muted);
}
.pill {
  font: 700 11px/1 var(--f-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding: 5px 8px;
  border-radius: 999px;
}
.card-title {
  font: 760 clamp(26px, 3.4vw, 36px)/1.08 var(--f-display);
  letter-spacing: -.02em;
  margin: 0;
  text-wrap: balance;
}
.card-desc { font: 400 18px/1.55 var(--f-body); color: var(--ink-2); margin: 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tags li {
  font: 500 12.5px/1 var(--f-display);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  background: var(--surface-2);
  padding: 7px 10px;
  border-radius: 999px;
}
.card-cta { font: 650 15.5px/1 var(--f-display); color: var(--accent-ink); margin-top: 6px; }
@media (max-width: 780px) {
  .card-link { grid-template-columns: 1fr; }
  .card-media { display: grid; place-items: center; padding: 18px; }
  .card-media img { width: auto; height: auto; max-width: 100%; max-height: 300px; border-radius: 6px; }
}

/* ---------- post ---------- */
.post-head {
  max-width: calc(700px + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) var(--gutter) 30px;
}
.kicker {
  font: 700 12.5px/1 var(--f-display);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 16px;
}
.post-head h1 {
  font: 780 clamp(34px, 5.6vw, 56px)/1.04 var(--f-display);
  letter-spacing: -.028em;
  margin: 0 0 18px;
  text-wrap: balance;
}
.dek { font: 400 clamp(19px, 2.2vw, 22px)/1.5 var(--f-body); color: var(--ink-2); margin: 0 0 20px; }
.byline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.byline { font: 500 13.5px/1.5 var(--f-mono); color: var(--muted); margin: 0; }
.byline > * { white-space: nowrap; } /* wrap between the parts, not inside them */
.byline-row .share-list { margin-inline: -7px; } /* line the icons up with the text edges */

/* text column with room for wider figures and the gallery */
.prose {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, 160px)
    [text-start] min(700px, 100% - 2 * var(--gutter))
    [text-end] minmax(0, 160px)
    [wide-end] minmax(var(--gutter), 1fr)
    [full-end];
  font: 400 19px/1.72 var(--f-body);
  padding-bottom: 80px;
}
.prose > * { grid-column: text; }
.prose > .wide { grid-column: wide; }
.prose p { margin: 0 0 1.1em; }
.prose h2 {
  font: 730 clamp(27px, 3.4vw, 34px)/1.15 var(--f-display);
  letter-spacing: -.018em;
  margin: 1.9em 0 .55em;
  text-wrap: balance;
}
.prose h3 { font: 700 clamp(21px, 2.4vw, 24px)/1.25 var(--f-display); margin: 1.6em 0 .45em; }
.prose h2:first-child { margin-top: .8em; }
.anchor {
  color: var(--rule-strong);
  text-decoration: none;
  font-weight: 500;
  opacity: 0;
  transition: opacity .15s ease;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.prose strong { font-weight: 650; color: var(--ink); }
.prose code {
  font: 500 .8em/1 var(--f-mono);
  background: var(--code-bg);
  padding: .16em .4em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.prose li { margin: .55em 0; padding-left: .2em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin: .4em 0 1.6em;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--amber);
  border-radius: 12px;
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--ink-2);
}
.prose blockquote p { margin: 0; }
.post-end { margin-top: 2.4em; font: 600 16px/1.4 var(--f-display); }

/* share buttons: icons by the byline, named buttons at the end */
.share-list { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0; padding: 0; }
.share-list > li { margin: 0; padding: 0; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 14.5px/1 var(--f-display);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.share-btn:hover { color: var(--accent-ink); background: var(--surface); border-color: var(--rule); }
.share-btn svg { flex: none; display: block; }
.share-btn .i-check, .share-btn.copied .i-link { display: none; }
.share-btn.copied .i-check { display: block; }
.share-btn.copied { color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { .share-btn { transition: none; } }

.share-end {
  margin: 1.2em 0 2em;
  padding: 20px 22px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.prose .share-end .share-title {
  font: 700 19px/1.3 var(--f-display);
  letter-spacing: -.01em;
  margin: 0 0 14px;
}
.prose .share-end .share-list { gap: 8px; margin: 0; padding: 0; }
.share-list.labelled .share-btn {
  height: 40px;
  padding: 0 15px 0 13px;
  border-color: var(--rule);
  background: var(--surface-2);
  color: var(--ink-2);
}
.share-list.labelled .share-btn:hover { border-color: var(--accent); color: var(--ink); }
.share-list.labelled .share-btn.copied { border-color: var(--accent); color: var(--accent-ink); }

/* diagrams */
.figure { margin: .6em 0 1.8em; }
.figure .frame {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
}
.figure img { display: block; width: 100%; height: auto; }

/* gallery: a sliding strip, one image at a time */
.slider { --slide-h: clamp(320px, 62vh, 560px); margin: .4em 0 1.8em; }
.slider-stage { position: relative; }
.slider-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.slider-track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) { .slider-track { scroll-behavior: auto; } }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.slide-media {
  display: grid;
  grid-template: 100% / 100%;
  place-items: center;
  height: var(--slide-h);
  background: #10171B;
  border-radius: 14px;
  overflow: hidden;
  cursor: zoom-in;
}
.slide-media img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  max-height: var(--slide-h);
  object-fit: contain;
}
.slide figcaption { font: 400 15.5px/1.5 var(--f-display); color: var(--ink-2); padding: 12px 4px 0; }
.slider-btn {
  position: absolute;
  top: calc(var(--slide-h) / 2 - 22px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(20, 28, 33, .82);
  color: #fff;
  cursor: pointer;
}
.slider-btn:hover { background: rgba(44, 60, 70, .95); }
.slider-btn.prev { left: 12px; }
.slider-btn.next { right: 12px; }
.slider-count {
  position: absolute;
  top: 12px;
  right: 12px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9, 13, 15, .72);
  color: #E2EAED;
  font: 600 12.5px/1 var(--f-mono);
  pointer-events: none;
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(12px, 3vw, 32px);
  border: 0;
  background: rgba(9, 13, 15, .94);
  color: #E2EAED;
  overflow: hidden;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(9, 13, 15, .6); }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 12px; max-width: min(1400px, 100%); }
.lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  width: auto;
  height: auto;
  border-radius: 10px;
}
.lightbox figcaption { font: 400 15px/1.5 var(--f-display); color: #C9D5DA; max-width: 72ch; text-align: center; }
.lb-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(20, 28, 33, .85);
  color: #fff;
  font: 400 28px/1 var(--f-display);
  cursor: pointer;
}
.lb-btn:hover { background: rgba(44, 60, 70, .95); }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: calc(50% - 22px); }
.lb-next { right: 14px; top: calc(50% - 22px); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

/* ---------- footer, 404 ---------- */
.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font: 500 13.5px/1.5 var(--f-display); }
.site-foot p { margin: 0; padding-block: 24px 36px; }
.not-found { padding-block: clamp(48px, 10vw, 120px); display: grid; gap: 22px; justify-items: start; }
.not-found p { margin: 0; font: 400 20px/1.5 var(--f-body); color: var(--ink-2); }
