/* ==========================================================================
   Projects — shared stylesheet
   One file, no build step, no external fonts. Edit freely.
   ========================================================================== */

:root {
  --bg:          #0a0c13;
  --bg-raised:   #12151f;
  --card:        #161a26;
  --card-hover:  #1c2130;
  --line:        #262c3d;
  --line-bright: #3a4258;

  --text:        #e8ebf5;
  --text-dim:    #9aa3bd;
  /* #656e8a was only 3.4:1 on the card surface — below WCAG AA for body text.
     Cards swap to --card-hover on hover/focus, so that surface counts too:
     this clears 4.5:1 on all four (bg 6.75, bg-raised 6.29, card 6.00,
     card-hover 5.54). */
  --text-faint:  #8f97b4;

  --games:       #4de0d0;
  --games-deep:  #1d9c93;
  --projects:    #f5b544;
  --projects-deep: #c8861a;
  --live:        #5ee08a;

  --radius:      16px;
  --radius-lg:   22px;
  --maxw:        1100px;

  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.4), 0 18px 44px rgba(0,0,0,.5);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* --- reset-ish ----------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }

/* Aurora wash behind everything. Fixed so it doesn't scroll away. */
body::before {
  content: "";
  position: fixed;
  inset: -20vh -10vw auto;
  height: 90vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 52% at 18% 0%,  rgba(77,224,208,.16), transparent 70%),
    radial-gradient(42% 48% at 82% 6%,  rgba(245,181,68,.13), transparent 70%),
    radial-gradient(40% 40% at 50% 30%, rgba(122,92,255,.13), transparent 70%);
  filter: blur(10px);
}

/* --- layout -------------------------------------------------------------- */

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

.section { padding: 56px 0; }
.section + .section { padding-top: 8px; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 15px;
  background: linear-gradient(140deg, var(--games), var(--projects));
  box-shadow: 0 3px 12px rgba(77,224,208,.28);
}

.topnav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* 44px minimum on every tap target — these get used by children on phones,
   where a 36px pill is a genuinely hard thing to hit. */
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: .93rem;
  font-weight: 550;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}

.topnav a:hover { color: var(--text); background: rgba(255,255,255,.05); }

.topnav a[aria-current="page"] {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255,255,255,.04);
}

/* --- hero ---------------------------------------------------------------- */

.hero { padding: 40px 0 20px; }

.hero h1 {
  font-size: clamp(2.3rem, 7vw, 3.9rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
}

.hero h1 .accent {
  background: linear-gradient(100deg, var(--games), var(--projects));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.16rem);
  max-width: 56ch;
  margin: 0;
}

/* --- section headings ---------------------------------------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-head h2 {
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  font-weight: 750;
}

.section-head .count {
  font-size: .82rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

.section-head .more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  font-size: .92rem;
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 550;
}

.section-head .more:hover { color: var(--games); }

.lede { color: var(--text-dim); margin: -8px 0 24px; max-width: 62ch; }

/* --- card grid ----------------------------------------------------------- */

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s, box-shadow .18s, background .18s;
}

a.card:hover, a.card:focus-visible {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: color-mix(in srgb, var(--games) 45%, var(--line));
  box-shadow: var(--shadow-lift);
}

/* The cards ARE the site's navigation, so they must show keyboard focus.
   A lift alone is not a focus indicator. */
:focus-visible {
  outline: 3px solid var(--games);
  outline-offset: 3px;
  border-radius: 4px;
}

a.card:focus-visible { outline-offset: 2px; }

/* Skip link — first tab stop, visible only when focused. */
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 0 0 12px 12px;
  background: var(--games);
  color: #04211f;
  font-weight: 700;
  text-decoration: none;
  transition: top .15s;
}

.skip:focus { top: 0; }

.card-art {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(150deg, #1b2030, #10131d);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

/* Positioned out of the grid flow: an in-flow image at height:100% makes the
   row size to the image instead, which quietly defeats the aspect-ratio and
   lets a tall portrait poster stretch the card. */
.card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Project thumbnails are often portrait artwork rather than landscape
   screenshots, and `cover` crops the top and bottom clean off. Fit the whole
   image instead and let the card background show around it. */
.card.project .card-art { background: #0e1017; }
.card.project .card-art img { object-fit: contain; padding: 8px; }

/* Emoji fallback art when a game has no thumbnail yet */
.card-art .glyph {
  font-size: 3.4rem;
  line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.5));
}

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  color: var(--text-dim);
  font-size: .93rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--text-faint);
  padding-top: 4px;
}

.by {
  font-weight: 650;
  color: var(--games);
  font-size: .8rem;
}

/* --- pills / badges ------------------------------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .02em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}

.pill-playable { color: var(--games); border-color: color-mix(in srgb, var(--games) 40%, transparent); background: color-mix(in srgb, var(--games) 10%, transparent); }
.pill-soon     { color: var(--text-faint); border-style: dashed; }
.pill-live     { color: var(--live);  border-color: color-mix(in srgb, var(--live) 40%, transparent); background: color-mix(in srgb, var(--live) 10%, transparent); }
.pill-building { color: var(--projects); border-color: color-mix(in srgb, var(--projects) 40%, transparent); background: color-mix(in srgb, var(--projects) 10%, transparent); }
.pill-paused   { color: var(--text-faint); }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

.pill-live .dot { animation: pulse 2.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* --- project cards (wider, amber accent) --------------------------------- */

.grid-projects { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

a.card.project:hover, a.card.project:focus-visible {
  border-color: color-mix(in srgb, var(--projects) 45%, var(--line));
}

.card.project .by { color: var(--projects); }

/* --- game detail page ---------------------------------------------------- */

.stage {
  position: relative;
  background: #05070c;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}

.stage iframe {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  background: #05070c;
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
  font-size: .84rem;
  color: var(--text-faint);
  flex-wrap: wrap;
}

.stage-bar .spacer { margin-left: auto; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: .93rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}

.btn:hover { background: rgba(255,255,255,.08); transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--games), var(--games-deep));
  border-color: transparent;
  color: #04211f;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* --- prose / notes ------------------------------------------------------- */

.prose { max-width: 68ch; color: var(--text-dim); }
.prose h2 { color: var(--text); margin: 34px 0 12px; font-size: 1.3rem; }
.prose h3 { color: var(--text); margin: 26px 0 8px; font-size: 1.05rem; }
.prose p  { margin: 0 0 14px; }
.prose ul { margin: 0 0 14px; padding-left: 20px; }
.prose li { margin-bottom: 7px; }
.prose strong { color: var(--text); font-weight: 650; }
.prose code {
  font-family: var(--mono);
  font-size: .87em;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
}
.prose pre {
  font-family: var(--mono);
  font-size: .84rem;
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.55;
  color: var(--text);
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose a { color: var(--games); text-decoration-color: color-mix(in srgb, var(--games) 40%, transparent); text-underline-offset: 3px; }

/* --- panels / stats ------------------------------------------------------ */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 20px; }

.panel h3 { margin-bottom: 12px; font-size: 1.06rem; }

.stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 650;
  margin-bottom: 4px;
}

.stat .value {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat .sub { font-size: .78rem; color: var(--text-faint); }

/* --- timeline ------------------------------------------------------------ */

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }

.timeline::before {
  content: "";
  position: absolute;
  left: 4px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--projects), transparent);
  opacity: .4;
}

.timeline li { position: relative; margin-bottom: 18px; }

.timeline li::before {
  content: "";
  position: absolute;
  left: -22px; top: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--projects);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--projects) 18%, transparent);
}

.timeline .when {
  display: block;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 650;
}

.timeline .what { color: var(--text); font-weight: 550; }
.timeline .note { color: var(--text-dim); font-size: .92rem; }

/* --- figure -------------------------------------------------------------- */

figure { margin: 0 0 22px; }

figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
}

figcaption {
  color: var(--text-faint);
  font-size: .84rem;
  margin-top: 10px;
  text-align: center;
}

/* --- empty / error states ------------------------------------------------ */

.notice {
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  color: var(--text-dim);
  background: rgba(255,255,255,.02);
}

.notice strong { color: var(--text); }

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-lg);
  height: 260px;
  border: 1px solid var(--line);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* --- footer -------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 26px 0 40px;
  color: var(--text-faint);
  font-size: .86rem;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--text-dim);
  /* Underlined so the links aren't distinguished by colour alone. */
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--text-dim) 45%, transparent);
  text-underline-offset: 3px;
}
.foot a:hover { color: var(--text); }
.foot .spacer { margin-left: auto; }

/* --- back link ----------------------------------------------------------- */

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 7px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 550;
  margin-bottom: 18px;
}

.back:hover { color: var(--text); }

/* --- page title block ---------------------------------------------------- */

.page-head { padding: 24px 0 28px; }

.page-head h1 {
  font-size: clamp(1.9rem, 5.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-head .tagline { color: var(--text-dim); max-width: 62ch; margin: 0; }

.page-head .meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .section { padding: 38px 0; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .grid-projects { grid-template-columns: 1fr; }
  .stage iframe { height: 64vh; }
  .panel { padding: 18px 16px; }
  /* Brand + 3 nav items don't fit one row on a phone, and letting the nav
     wrap tucked it under the brand. Stack them instead. */
  .topbar { padding: 14px 0; flex-direction: column; align-items: flex-start; gap: 12px; }
  .topnav { margin-left: 0; width: 100%; gap: 4px; }
  .topnav a { padding: 6px 12px; font-size: .9rem; }
  .card-art { aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- game page extras ----------------------------------------------------- */

/* Controls above the frame rather than below it, so keyboard users meet them
   before tabbing into the game. */
.stage-bar-top {
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.page-head .by {
  color: var(--games);
  font-weight: 650;
  font-size: .9rem;
  margin: 8px 0 0;
}

.page-head .by:empty { display: none; }

/* <main> is focusable only so the skip link can move focus there, not just
   scroll. It should never show a focus ring of its own. */
main:focus { outline: none; }
