/* ============================================================
   SKYLERYAPS — identity + system
   Type:  Space Grotesk (display / wordmark)  +  Schibsted Grotesk (UI/body)
   Theme: light + dark, both first-class
   Tweak-driven vars set on :root inline by JS:
     --accent (brand action color), --r (corner radius), data-cover, data-theme
   ============================================================ */

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

:root {
  /* type */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-ui: "Schibsted Grotesk", system-ui, sans-serif;
  --font-tile: "Bricolage Grotesque", system-ui, sans-serif;  /* baked default (was tweakable) */

  /* tweakable identity (overridden inline by JS) */
  --accent: #B8F03C;          /* signature lime */
  --accent-ink: #14140F;      /* text that sits ON the accent */
  --r: 16px;                  /* corner radius */
  --r-sm: calc(var(--r) * 0.55);

  /* mechanic color-coding */
  --m-tier:  #FF5D9E;
  --m-match: #2FC6F0;
  --m-slide: #FFAE2E;
  --m-tf:    #38D08A;
  --m-custom:#9B7BFF;

  /* easing */
  --pop: cubic-bezier(.34,1.56,.64,1);
}

/* ---- LIGHT (default) ---- */
:root, [data-theme="light"] {
  --bg:        #F7F7F2;
  --bg-2:      #EFEFE8;
  --surface:   #FFFFFF;
  --surface-2: #FBFBF7;
  --ink:       #14141A;
  --ink-2:     #55555F;
  --ink-3:     #8A8A93;
  --line:      #E6E6DD;
  --line-2:    #D8D8CD;
  --shadow:    0 1px 2px rgba(20,20,26,.05), 0 8px 24px -12px rgba(20,20,26,.18);
  --shadow-lg: 0 2px 4px rgba(20,20,26,.06), 0 24px 60px -22px rgba(20,20,26,.30);
  --scrim:     rgba(20,20,26,.42);
  --cover-ink: #14141A;
}

/* ---- DARK ---- */
[data-theme="dark"] {
  --bg:        #0D0D10;
  --bg-2:      #111115;
  --surface:   #17171C;
  --surface-2: #1D1D23;
  --ink:       #F4F4F0;
  --ink-2:     #A6A6B0;
  --ink-3:     #6E6E78;
  --line:      #26262E;
  --line-2:    #32323C;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 30px 70px -24px rgba(0,0,0,.8);
  --scrim:     rgba(0,0,0,.62);
  --cover-ink: #0B0B0D;
}

html, body { margin: 0; height: 100%; }
body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* page scaffolding */
.app { min-height: 100%; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ============================================================
   HEADER
   ============================================================ */
.hdr {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.hdr-in { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 14px; }

/* wordmark */
.brand { display: inline-flex; align-items: center; gap: 0; background: none; border: 0; padding: 6px 8px 6px 0; margin: 0; }
.brand .mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1;
}
.brand .mark .yap { color: var(--ink); position: relative; }
.brand .dot {
  display: inline-block; width: .42em; height: .42em; margin-left: .12em;
  border-radius: 50%; background: var(--accent);
  vertical-align: baseline;
  transition: transform .4s var(--pop);
}
.brand:hover .dot { transform: translateY(-3px) scale(1.18); }

.hdr-actions { display: flex; align-items: center; gap: 6px; }
.socials { display: flex; align-items: center; gap: 4px; }

/* icon button */
.iconbtn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.iconbtn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.iconbtn:active { transform: scale(.92); }
.iconbtn svg { width: 18px; height: 18px; display: block; }

.divider-v { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; }

/* theme toggle pill */
.theme-toggle {
  position: relative; width: 60px; height: 34px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  display: inline-flex; align-items: center; padding: 3px; flex: none;
  transition: background-color .25s, border-color .25s;
}
.theme-toggle .knob {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  transform: translateX(0);
  transition: transform .4s var(--pop), background-color .25s;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
[data-theme="dark"] .theme-toggle .knob { transform: translateX(26px); }
.theme-toggle .knob svg { width: 15px; height: 15px; }

/* ============================================================
   LANDING
   ============================================================ */
main { flex: 1 0 auto; }
.catalog { padding: 30px 0 64px; }

.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 6px 0 22px; flex-wrap: wrap; }
.catalog-head h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em;
  font-size: clamp(26px, 4vw, 38px); margin: 0; line-height: 1.02;
}
.catalog-head .count {
  font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: var(--surface);
}

/* mechanic filter row */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 600; font-size: 13.5px;
  padding: 8px 14px; border-radius: 999px; line-height: 1;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line);
  transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip:active { transform: scale(.95); }
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--mc, var(--ink-3)); flex: none; }
.chip .n { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.chip.active { color: var(--ink); border-color: transparent;
  background: color-mix(in srgb, var(--mc, var(--ink)) 16%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mc, var(--ink)) 55%, transparent); }
.chip.active .n { color: var(--ink-2); }
.chip.all.active { background: var(--ink); color: var(--bg); box-shadow: none; }
.chip.all.active .n { color: color-mix(in srgb, var(--bg) 65%, var(--ink)); }

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

/* ============================================================
   GAME CARD  (the reusable unit)
   ============================================================ */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  transition: transform .22s var(--pop), box-shadow .22s, border-color .22s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }

/* cover — generated entirely from CSS, keyed to mechanic color */
.cover {
  position: relative; display: block; aspect-ratio: 5 / 3; overflow: hidden;
  background: var(--mc);
  color: var(--cover-ink);
  isolation: isolate;
}
.cover .cover-grad { position: absolute; inset: 0; background:
   radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--mc) 100%, #fff 22%), transparent 60%),
   radial-gradient(120% 120% at 100% 100%, color-mix(in srgb, var(--mc) 100%, #000 18%), transparent 70%);
}
.cover .pattern { position: absolute; inset: 0; opacity: .9; mix-blend-mode: soft-light; }
[data-cover="solid"] .cover .pattern { display: none; }
[data-cover="minimal"] .cover .cover-grad { opacity: .35; }
[data-cover="minimal"] .cover .pattern { opacity: .5; }

.cover .cover-title {
  position: absolute; inset: auto 16px 14px 16px; z-index: 2;
  font-family: var(--font-tile); font-weight: 700; letter-spacing: -.025em;
  font-size: 22px; line-height: 1.04; color: var(--cover-ink);
  text-wrap: balance;
}
[data-cover="minimal"] .cover .cover-title { font-size: 21px; }

/* mechanic tag chip */
.tag {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  padding: 5px 10px 5px 8px; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
}
.tag .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--mc); flex: none; }
.cover .tag { position: absolute; top: 12px; left: 12px; z-index: 2;
  background: color-mix(in srgb, var(--cover-ink) 88%, transparent); color: var(--surface);
  border-color: transparent; backdrop-filter: blur(2px); }
[data-theme="dark"] .cover .tag { background: color-mix(in srgb, #000 70%, transparent); color: #fff; }

.card-body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.tagline { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.4; flex: 1; }

.spoiler {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  margin: 0; font-size: 11.5px; color: var(--ink-3); font-weight: 500;
}
.spoiler svg { width: 13px; height: 13px; }

.card-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 600; font-size: 14px; border-radius: var(--r-sm);
  border: 1px solid transparent; padding: 10px 14px; line-height: 1;
  transition: transform .12s, background .18s, border-color .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn-play { background: var(--accent); color: var(--accent-ink); flex: 1;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 70%, #000 30%) inset; }
.btn-play:hover { box-shadow: 0 6px 18px -8px var(--accent); }
.btn-play svg { width: 15px; height: 15px; }
.btn-watch { background: transparent; color: var(--ink-2); border-color: var(--line-2); padding: 10px 12px; }
.btn-watch:hover { color: var(--ink); border-color: var(--ink-3); }
.btn-watch svg { width: 16px; height: 16px; color: #FF0033; }

/* no-video / coming-soon state */
.card.is-soon .cover { filter: saturate(.5); }
.card.is-soon .cover .cover-grad { opacity: .25; }
.soon-flag {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 11.5px; color: var(--ink-3); font-weight: 600;
  border: 1px dashed var(--line-2); border-radius: 999px; padding: 5px 11px;
}
.soon-flag .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }

/* ============================================================
   PLAY PAGE
   ============================================================ */
.playview { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-2); }
/* play-page header reuses the .hdr shell so it matches the landing header */
.playhdr-in {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 68px; gap: 12px;
}
.playhdr-in .left { justify-self: start; }
.playhdr-in .center { justify-self: center; min-width: 0; }
.playhdr-in .right { justify-self: end; display: flex; align-items: center; gap: 6px; }
.play-title {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em;
  font-size: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 46vw;
}
.play-title .play-mech { font-size: 11.5px; color: var(--ink-2); font-family: var(--font-ui); font-weight: 600; display: block; margin-top: 1px; }

.backlink, .watchlink {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.backlink:hover, .watchlink:hover { color: var(--ink); border-color: var(--ink-3); }
.backlink:active, .watchlink:active { transform: scale(.96); }
.backlink svg { width: 16px; height: 16px; }
.watchlink { color: #fff; background: #FF0033; border-color: transparent; }
.watchlink:hover { color: #fff; filter: brightness(1.06); }
.watchlink svg { width: 17px; height: 17px; }
.backlink .lbl, .watchlink .lbl { display: inline; }

/* framed game stage */
.stage { flex: 1; display: grid; place-items: center; padding: 24px; min-height: 0; }
.frame {
  width: 100%; max-width: 1080px;
  height: min(calc(100vh - 68px - 48px), 780px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px;
  box-shadow: var(--shadow-lg); overflow: hidden; position: relative;
}
.frame-note {
  position: absolute; bottom: 10px; left: 0; right: 0; text-align: center;
  font-size: 11px; color: var(--ink-3); pointer-events: none;
}

/* ============================================================
   EMAIL POPUP
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: var(--scrim); backdrop-filter: blur(3px);
  animation: fade .25s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 26px 24px 22px; position: relative; text-align: left;
  animation: pop .42s var(--pop) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.modal .x {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center;
}
.modal .x:hover { color: var(--ink); border-color: var(--line-2); }
.modal .x svg { width: 16px; height: 16px; }
.modal .peek { font-size: 30px; line-height: 1; }
.modal h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 21px; margin: 12px 0 6px; }
.modal p { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.modal form { display: flex; flex-direction: column; gap: 9px; }
.modal input {
  height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--ink); font-family: inherit; font-size: 15px; padding: 0 14px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.modal input::placeholder, .modal textarea::placeholder { color: var(--ink-3); }
.modal input:focus, .modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.modal .submit { height: 46px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; }
.modal .submit:hover { filter: brightness(1.03); }
.modal .dismiss { background: none; border: 0; color: var(--ink-3); font-size: 12.5px; padding: 4px; align-self: center; text-decoration: underline; text-underline-offset: 2px; }
.modal .dismiss:hover { color: var(--ink-2); }
.modal .thanks { text-align: center; padding: 8px 0 4px; }
.modal .thanks .big { font-size: 34px; }

/* ============================================================
   SHARE / OG PREVIEW
   ============================================================ */
.og-card {
  width: 600px; max-width: 100%; aspect-ratio: 1200 / 630;
  border-radius: 18px; overflow: hidden; position: relative; isolation: isolate;
  background: var(--mc); color: var(--cover-ink); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
}
.og-card .og-grad { position: absolute; inset: 0; background:
   radial-gradient(110% 90% at 6% 4%, color-mix(in srgb, var(--mc) 100%, #fff 24%), transparent 58%),
   radial-gradient(120% 120% at 100% 100%, color-mix(in srgb, var(--mc) 100%, #000 22%), transparent 72%); }
.og-card .og-pattern { position: absolute; inset: 0; mix-blend-mode: soft-light; opacity: .9; }
.og-inner { position: absolute; inset: 0; z-index: 2; padding: 7% 8%; display: flex; flex-direction: column; justify-content: space-between; }
.og-top { display: flex; align-items: center; justify-content: space-between; }
.og-brand { font-family: var(--font-display); font-weight: 700; font-size: 3.4cqw; letter-spacing: -.02em; }
.og-card { container-type: inline-size; }
.og-title { font-family: var(--font-tile); font-weight: 700; letter-spacing: -.03em; font-size: 7cqw; line-height: .98; text-wrap: balance; }
.og-bottom { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 2.9cqw; }
.og-url { opacity: .85; }
.og-tag { background: color-mix(in srgb, var(--cover-ink) 90%, transparent); color: var(--surface); padding: .5cqw 2cqw; border-radius: 999px; font-size: 2.7cqw; }
[data-theme="dark"] .og-tag { background: rgba(0,0,0,.7); color: #fff; }

/* ============================================================
   FOOTER
   ============================================================ */
.ftr { border-top: 1px solid var(--line); padding: 26px 0 34px; flex-shrink: 0; }
.ftr-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ftr .mini-mark { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.ftr .mini-mark .dot { width: .4em; height: .4em; }
.ftr-links { display: flex; align-items: center; gap: 18px; color: var(--ink-2); font-size: 13px; }
.ftr-links a:hover { color: var(--ink); }
.ftr-socials { display: flex; gap: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .hdr-in { height: 60px; }
  .brand .mark { font-size: 22px; }
  .iconbtn { width: 36px; height: 36px; }
  .theme-toggle { width: 54px; height: 31px; }
  .theme-toggle .knob { width: 23px; height: 23px; }
  [data-theme="dark"] .theme-toggle .knob { transform: translateX(23px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); gap: 14px; }
  .catalog { padding: 22px 0 48px; }
  .play-title { max-width: 40vw; }
  .backlink .lbl, .watchlink .lbl { display: none; }
  .backlink, .watchlink { padding: 0 11px; }
  .stage { padding: 12px; }
  .frame { height: calc(100vh - 68px - 24px); border-radius: 16px; }
}

@media (min-width: 560px) and (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* collapse social icons on small screens into a compact set */
.socials .collapsible { display: inline-flex; }
@media (max-width: 480px) {
  .socials .collapsible { display: none; }
  .hdr-actions { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* The [hidden] attribute must win over .overlay/.watchlink display rules,
   otherwise modals show stacked on load and trap the page. */
[hidden] { display: none !important; }
