/* Larkcade portal (apps/portal/docs/00_DESIGN.md).
   §7 (2026-09-25) is the colour direction: an arcade, not a gallery wall. Dark
   indigo ground, real game art on every card, category colours, and cards that
   come alive on hover — lift, glow in the game's own accent, the art zooms and
   a gameplay clip takes over where one exists. Every page (home, legal, 404)
   shares this sheet. */

/* --- tokens ----------------------------------------------------------------- */

:root,
:root[data-theme="light"] {
  --bg: #F5F3FF;
  --bg-glow: #E7E1FF;
  --surface: #FFFFFF;
  --surface-raised: #EFEDFF;
  --ink: #1B1D33;
  --ink-dim: #555A7A; /* 6.3:1 on --surface, 5.6:1 on --surface-raised */
  --line: #DAD6F2;
  --shadow: rgba(40, 30, 110, 0.14);

  /* The portal's own colour: a warm-to-cool sweep, used for the wordmark,
     the intro heading and the featured Play button. */
  --brand-1: #F29A00;
  --brand-2: #E8336D;
  --brand-3: #5B5BF0;
  --on-brand: #FFFFFF;

  /* Category colours — icon tiles in the sidebar, the chip on each card.
     Light values darkened so white glyphs and the text chips keep 4.5:1. */
  --on-cat: #FFFFFF; /* ≥4.5:1 on every light --cat-* (lowest: daily 4.6) */
  --cat-all: #5B5BF0;
  --cat-daily: #B35210;
  --cat-puzzle: #1F6FD1;
  --cat-arcade: #C4267A;
  --cat-strategy: #C8333A;
  --cat-defense: #227A3F;
  --cat-idle: #5A7A12;
  --cat-typing: #7050D8;
}

:root[data-theme="dark"] {
  --bg: #0F1020;
  --bg-glow: #221E4A;
  --surface: #1A1C33;
  --surface-raised: #25284A;
  --ink: #F4F3FF;
  --ink-dim: #A9ADCB; /* 8.1:1 on --surface, 6.9:1 on --surface-raised */
  --line: #2E3257;
  --shadow: rgba(0, 0, 0, 0.45);
  --brand-1: #FFB547;
  --brand-2: #FF5E8A;
  --brand-3: #8B8CFF;
  --on-brand: #140F24;
  --on-cat: #140F24; /* white on these reaches only 1.5–2.9:1; this ink gets 6.5–12.2 */
  --cat-all: #8B8CFF;
  --cat-daily: #FF8A3D;
  --cat-puzzle: #4DA3FF;
  --cat-arcade: #FF5CB0;
  --cat-strategy: #FF6B6B;
  --cat-defense: #4CD97B;
  --cat-idle: #B4E04A;
  --cat-typing: #A78BFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1020;
    --bg-glow: #221E4A;
    --surface: #1A1C33;
    --surface-raised: #25284A;
    --ink: #F4F3FF;
    --ink-dim: #A9ADCB;
    --line: #2E3257;
    --shadow: rgba(0, 0, 0, 0.45);
    --brand-1: #FFB547;
    --brand-2: #FF5E8A;
    --brand-3: #8B8CFF;
    --on-brand: #140F24;
    --on-cat: #140F24;
    --cat-all: #8B8CFF;
    --cat-daily: #FF8A3D;
    --cat-puzzle: #4DA3FF;
    --cat-arcade: #FF5CB0;
    --cat-strategy: #FF6B6B;
    --cat-defense: #4CD97B;
    --cat-idle: #B4E04A;
    --cat-typing: #A78BFF;
  }
}

/* Each card glows in its own game's accent (the vivid half of each pair the
   games claim in their docs/02_UI.md), so a card matches the game it opens.
   One value serves both themes: it is only ever a ring and a glow, never text. */
.card[data-accent="ember"] { --accent: #FF6B35; }
.card[data-accent="lapis"] { --accent: #4F8BFF; }
.card[data-accent="teal"] { --accent: #2EC4B6; }
.card[data-accent="leaf"] { --accent: #8CBF4A; }
.card[data-accent="ultraviolet"] { --accent: #A071FF; }
.card[data-accent="wine"] { --accent: #E0587A; }
.card[data-accent="green"] { --accent: #6BBF3E; }
.card[data-accent="violet"] { --accent: #9B7BFF; }
.card[data-accent="lagoon"] { --accent: #2AB3C9; }

/* --- base ------------------------------------------------------------------- */

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 320px;
  background:
    radial-gradient(1200px 520px at 15% -10%, var(--bg-glow), transparent 70%),
    radial-gradient(900px 480px at 110% 10%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, ui-rounded, sans-serif;
  line-height: 1.5;
}

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

:where(a, button):focus-visible {
  outline: 3px solid var(--brand-3);
  outline-offset: 3px;
}

/* --- header (every page) ------------------------------------------------------ */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wordmark-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  color: #FFFFFF;
}

.mark svg {
  width: 100%;
  height: 100%;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.header-pitch {
  flex: 1;
  color: var(--ink-dim);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

#theme-toggle {
  flex: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms, transform 120ms;
}

#theme-toggle:hover {
  background: var(--surface-raised);
  transform: rotate(20deg);
}

/* --- page frame (legal pages, 404) ------------------------------------------ */

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  padding: 48px 0;
  text-align: center;
}

.hero h1 {
  display: inline-block;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 900;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2), var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h2 {
  margin-top: 8px;
  font-size: 1.5rem;
  font-weight: 800;
}

.hero a {
  color: var(--ink);
  font-weight: 700;
}

.hero p {
  margin-top: 12px;
  color: var(--ink-dim);
  text-wrap: balance;
}

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

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 24px;
}

.home main {
  max-width: none;
  padding: 24px 0 48px;
}

.sidebar {
  position: sticky;
  top: 69px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms;
}

.nav-link:hover,
.nav-link[aria-current] {
  background: var(--surface);
}

.nav-link[aria-current] {
  box-shadow: inset 3px 0 0 var(--cat);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--cat);
  color: var(--on-cat);
  transition: transform 150ms;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-link:hover .nav-icon {
  transform: scale(1.1) rotate(-6deg);
}

.nav-label {
  flex: 1;
}

.nav-count {
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--ink-dim);
  font-size: 0.75rem;
  text-align: center;
}

/* --- intro ------------------------------------------------------------------ */

.intro {
  margin-bottom: 20px;
}

.intro h1 {
  display: inline-block; /* the gradient spans the word, not the whole row */
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2), var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro h2 {
  margin-top: 4px;
  font-size: 1.25rem;
  font-weight: 800;
}

.intro p {
  margin-top: 2px;
  color: var(--ink-dim);
}

/* --- cards --------------------------------------------------------------------- */

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

.card {
  --lift: -6px;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 180ms cubic-bezier(.2, .9, .3, 1.3), box-shadow 180ms;
  isolation: isolate;
}

.card[hidden] {
  display: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(var(--lift)) scale(1.03);
  box-shadow:
    0 0 0 3px var(--accent),
    0 14px 34px color-mix(in srgb, var(--accent) 45%, transparent);
  z-index: 1;
}

.card:focus-visible {
  outline: none; /* the accent ring above is the focus indicator, and it is thicker */
}

.card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: color-mix(in srgb, var(--accent) 25%, var(--surface));
}

.card-media img,
.card-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease, opacity 200ms;
}

.card-media video {
  opacity: 0;
}

.card:hover .card-media img,
.card:focus-visible .card-media img {
  transform: scale(1.08);
}

.card.is-previewing .card-media video {
  opacity: 1;
}

/* A game with no art yet: its glyph on an accent tile, as the old card did. */
.card-media--glyph {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, var(--surface)), var(--surface));
  color: #FFFFFF;
}

.card-media--glyph svg {
  width: 38%;
  height: 38%;
}

.card-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  padding: 12px 14px 14px;
}

.card-title {
  font-size: 1.0625rem;
  font-weight: 800;
}

.card-cat {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--cat);
  color: var(--on-cat);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.card-pitch {
  grid-column: 1 / -1;
  color: var(--ink-dim);
  font-size: 0.875rem;
  line-height: 1.4;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-new {
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  color: #1A0F12;
}

/* --- featured ---------------------------------------------------------------- */

.featured {
  margin-bottom: 32px;
}

.card--featured {
  --lift: -4px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(420px 260px at 100% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    var(--surface);
}

.card--featured:hover,
.card--featured:focus-visible {
  transform: translateY(var(--lift)) scale(1.01);
}

.card--featured .card-media {
  border-radius: 0;
}

.card--featured .card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding: 28px;
}

.card--featured .card-title {
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  line-height: 1.05;
}

.card--featured .card-pitch {
  font-size: 1.05rem;
  color: var(--ink);
}

.card--featured .card-cat {
  order: -1;
}

.card-play {
  margin-top: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  color: #1A0F12;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand-2) 45%, transparent);
  transition: transform 150ms;
}

.card--featured:hover .card-play {
  transform: scale(1.06);
}

/* --- shelf ---------------------------------------------------------------------- */

.shelf {
  scroll-margin-top: 84px;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.shelf-title {
  font-size: 1.375rem;
  font-weight: 900;
}

.shelf-count {
  color: var(--ink-dim);
  font-size: 0.875rem;
  font-weight: 600;
}

/* --- coming soon ---------------------------------------------------------------- */

.soon {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.soon span:not(.soon-label) {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
}

.soon-label {
  font-weight: 700;
}

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

.footer {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 32px 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.footer-nav {
  margin-bottom: 8px;
}

.footer-nav a {
  color: var(--ink-dim);
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--ink);
}

/* --- legal pages ------------------------------------------------------------------ */

.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 0;
}

.legal h1 {
  font-size: 2rem;
  font-weight: 900;
}

.legal-updated {
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.legal h2 {
  margin-top: 32px;
  font-size: 1.125rem;
  font-weight: 800;
}

.legal p,
.legal ul {
  margin-top: 12px;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 6px;
}

.legal a {
  color: var(--ink);
}

.legal code {
  background: var(--surface-raised);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.contact-email {
  margin-top: 20px;
  font-size: 1.25rem;
  font-weight: 700;
}

/* --- narrow screens -------------------------------------------------------------------- */

/* The sidebar becomes a row of category chips under the header. */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 16px;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 0 4px;
    scrollbar-width: none;
  }

  .nav-link {
    flex: none;
    padding: 6px 12px 6px 6px;
    background: var(--surface);
    border-radius: 999px;
  }

  .nav-link[aria-current] {
    box-shadow: inset 0 0 0 2px var(--cat);
  }

  .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
  }

  .nav-count {
    display: none;
  }

  .card--featured {
    grid-template-columns: minmax(0, 1fr);
  }

  .card--featured .card-body {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 10px 16px;
  }

  .header-pitch {
    display: none;
  }

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

  .card-pitch {
    display: none;
  }

  .card--featured .card-pitch {
    display: block;
  }

  .card-title {
    font-size: 0.95rem;
    line-height: 1.25;
  }

  /* Two columns of cards leave no room beside the title: the chip goes under. */
  .card-body {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 6px;
    padding: 10px 12px 12px;
  }
}

/* --- reduced motion --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 50ms !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .card:focus-visible,
  .card:hover .card-media img,
  .card:focus-visible .card-media img,
  .card--featured:hover .card-play,
  .nav-link:hover .nav-icon,
  #theme-toggle:hover {
    transform: none;
  }
}
