/* =========================================================================
   Dragonfruit Society — Arcade
   Tokens, reset and shared utilities are copied verbatim from DESIGNSYSTEM.md
   (§4, §5, §7–§9). Everything below the "ARCADE" banner is site-specific and
   built only from these tokens.
   ========================================================================= */

@font-face {
  font-family: 'Hanken Grotesk Variable';
  src: url('../fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  /* ---- color — warm neutrals + one deep-violet accent ---- */
  --bg: #fbf9f5;
  --bg-sunk: #f2ede3;
  --bg-raised: #ffffff;
  --ink: #1a1714;
  --ink-soft: #6b635b;
  --ink-faint: #9a9089;
  --line: #e4ddd1;
  --line-strong: #d5ccbc;
  --accent: #23005a;
  --accent-soft: #efe9f7;
  --accent-ink: #fbf9f5;

  /* ---- type ---- */
  --font-sans: 'Hanken Grotesk Variable', 'Hanken Grotesk', -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.25rem + 1vw, 1.9rem);
  --step-3:  clamp(1.85rem, 1.5rem + 1.75vw, 2.7rem);
  --step-4:  clamp(2.3rem, 1.7rem + 3vw, 3.8rem);
  --step-5:  clamp(2.9rem, 1.9rem + 5vw, 5.5rem);
  --step-6:  clamp(3.4rem, 1.8rem + 8vw, 7.5rem);

  /* ---- space ---- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --sp-10: 8rem;
  --sp-11: 10rem;

  /* ---- layout ---- */
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --measure: 62ch;
  --content: 1280px;
  --wide: 1520px;

  --radius: 4px;
  --radius-lg: 10px;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.55s;
}

/* ---- reset & base (DESIGNSYSTEM.md §5) ---- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 380;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }

p { margin: 0 0 var(--sp-4); }

a { color: inherit; text-decoration: none; }

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

ul, ol { margin: 0; padding: 0; list-style: none; }

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

[hidden] { display: none !important; }

/* ---- layout utilities (§6) ---- */
.wrap {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--wide { max-width: var(--wide); }
.measure { max-width: var(--measure); }
.stack > * + * { margin-top: var(--sp-4); }

/* ---- typographic components (§7) ---- */
.eyebrow {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 380;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- link — sliding underline (§8) ---- */
.link-underline {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur) var(--ease), color 0.2s ease;
  padding-bottom: 2px;
}
.link-underline:hover,
.link-underline:focus-visible {
  background-size: 100% 1.5px;
  color: var(--accent);
}
.link-underline[aria-current="page"] {
  background-size: 100% 1.5px;
  color: var(--accent);
}

/* ---- button — pill (§8) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.7em 1.3em;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
    border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-2px);
}
.btn--solid { background: var(--ink); color: var(--accent-ink); }
.btn--solid:hover { background: var(--accent); }

/* ---- arrow link (§8) ---- */
.arrow-link {
  font-weight: 500;
  transition: color 0.25s var(--ease);
}
.arrow-link span { display: inline-block; transition: transform 0.35s var(--ease); }
.arrow-link:hover { color: var(--accent); }
.arrow-link:hover span { transform: translateX(0.3em); }

/* ---- scroll reveal (§9) ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
  animation-timing-function: var(--ease);
}

/* ---- skip link (§8) ---- */
.skip-link {
  position: fixed; top: 0; left: 0;
  padding: 0.6em 1em;
  background: var(--accent); color: var(--accent-ink);
  font-size: var(--step--1);
  transform: translateY(-120%);
  transition: transform 0.2s var(--ease);
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); }

/* ---- header (§8) ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.site-header[data-scrolled] { border-bottom-color: var(--line); }
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding-block: var(--sp-4);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-size: calc(var(--step-0) * 1.6);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark b { font-weight: 500; }
.wordmark__logo {
  height: 1.8rem;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.wordmark .wordmark__sub {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
}
@media (max-width: 600px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
}

/* ---- footer (§8) ---- */
.site-footer {
  margin-top: var(--sp-11);
  border-top: 1px solid var(--line);
  padding-block: var(--sp-9) var(--sp-7);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-7);
}
.site-footer__cta { font-size: var(--step-3); }
.site-footer__meta {
  text-align: right;
  font-size: var(--step--1);
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-end;
}
.site-footer__social { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-2); }
@media (max-width: 640px) {
  .site-footer__meta { text-align: left; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* =========================================================================
   ARCADE — site-specific components (tokens only, no new colours)
   ========================================================================= */

main { display: block; }

/* ---- hero ---- */
.hero {
  padding-top: var(--sp-8);
  padding-bottom: var(--sp-7);
}
.hero__statement {
  font-size: var(--step-4);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 22ch;
  margin: var(--sp-4) 0 var(--sp-6);
}
.hero__lede { max-width: 54ch; }

/* ---- section head ---- */
.section {
  padding-top: var(--sp-7);
  border-top: 1px solid var(--line);
}
.section > .eyebrow { display: block; margin-bottom: var(--sp-3); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

/* ---- games grid ---- */
.games {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}
@media (max-width: 720px) { .games { grid-template-columns: 1fr; } }

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
.game-card:hover,
.game-card:focus-within {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}
.game-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-sunk);
  overflow: hidden;
}
.game-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease);
}
.game-card:hover .game-card__media img { transform: scale(1.035); }
.game-card__badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.3em 0.7em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}
.game-card__badge--soon { background: var(--bg-raised); color: var(--ink-soft); border: 1px solid var(--line-strong); }
.game-card__body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.game-card__title-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.game-card__title { font-size: var(--step-2); font-weight: 500; letter-spacing: -0.02em; }
.game-card__meta { font-size: var(--step--1); color: var(--ink-faint); white-space: nowrap; }
.game-card__tagline { color: var(--ink-soft); font-size: var(--step-0); }
.game-card__cta { margin-top: auto; padding-top: var(--sp-3); font-size: var(--step-0); }
.game-card[aria-disabled="true"] { opacity: 0.62; }
.game-card[aria-disabled="true"]:hover { transform: none; }

/* ---- about ---- */
.about__statement {
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 24ch;
  margin-bottom: var(--sp-5);
}

/* =========================================================================
   PLAY PAGE — the game console window + expand / minimise / fullscreen
   ========================================================================= */

.play {
  padding-top: var(--sp-7);
  padding-bottom: var(--sp-7);
}
.play__head { margin-bottom: var(--sp-5); }
.play__title { font-size: var(--step-4); margin-bottom: var(--sp-3); }
.play__tagline { max-width: 60ch; }
.play__back { display: inline-block; margin-bottom: var(--sp-5); font-size: var(--step--1); font-weight: 500; letter-spacing: 0.02em; }

/* The console: a framed "small window" the game lives in by default. */
.console {
  --console-max: 1040px;
  position: relative;
  width: 100%;
  max-width: var(--console-max);
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 var(--bg-raised) inset;
}
.console__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0d1220; /* matches the game's own boot background */
}

/* Toolbar pinned to the top-right of the console. Always visible so the
   expand / fullscreen / exit affordances are never hidden; it dims slightly
   when the pointer isn't near it. */
.console__bar {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  display: flex;
  gap: var(--sp-2);
  z-index: 3;
  opacity: 0.72;
  transition: opacity 0.25s var(--ease);
}
.console:hover .console__bar,
.console:focus-within .console__bar,
.console.is-expanded .console__bar { opacity: 1; }

.console__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.45em 0.8em;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--accent-ink) 22%, transparent);
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.console__btn:hover { background: var(--accent); transform: translateY(-1px); }
.console__btn svg { width: 1em; height: 1em; display: block; }

/* Expanded state: the console leaves the page flow and fills the viewport. */
.console.is-expanded {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
  z-index: 9999;
}
body.console-expanded { overflow: hidden; }

/* Native fullscreen: the browser handles sizing; keep it edge-to-edge. */
.console:fullscreen { width: 100vw; height: 100vh; max-width: none; aspect-ratio: auto; border-radius: 0; border: 0; }
.console:fullscreen .console__frame { position: absolute; inset: 0; }

/* Hint strip shown under the small console. */
.console-hint {
  max-width: 1040px;
  margin: var(--sp-3) auto 0;
  font-size: var(--step--1);
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.console.is-expanded ~ .console-hint { display: none; }

/* ---- generic "not found" game ---- */
.play__missing { text-align: center; padding-block: var(--sp-9); }
.play__missing .eyebrow { display: block; margin-bottom: var(--sp-3); }
