/* Ember Games: site styles.
   Palette is a coal bed: charred darks, ash text, and heat (ember -> glow) used
   only where something is "lit": actions, new games, and hover. */

/* Self-hosted fonts (SIL Open Font License, see assets/fonts/). Latin subset, variable weight. */
@font-face {
  font-family: "Big Shoulders Display";
  src: url("../fonts/big-shoulders-display-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --coal: #140c09;
  --char: #22150f;
  --char-2: #2e1d15;
  --ash: #ede3da;
  --ash-dim: #a8968a;
  --ember: #ff5b24;
  --glow: #ffb23e;
  --line: rgba(237, 227, 218, 0.1);

  --font-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --font-body: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--coal);
  color: var(--ash);
  font: 400 1rem/1.6 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-bottom: 4rem; }

img, svg { display: block; max-width: 100%; }
a { color: var(--glow); }
a:hover { color: var(--ash); }

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 50;
  background: var(--glow);
  color: var(--coal);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(20, 12, 9, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ash);
  text-decoration: none;
  flex-shrink: 0;
}
.logo__mark { width: 28px; height: 28px; }
.logo__word {
  font: 900 1.6rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.logo__word span { color: var(--ash-dim); margin-left: 0.2em; }

.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--ash-dim);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.25rem 0;
}
.site-nav a:hover { color: var(--ash); }

@media (max-width: 560px) {
  .logo__word span { display: none; }
  .site-nav { gap: 1rem; font-size: 0.95rem; }
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ash-dim);
  font-size: 0.9rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
  padding-block: 2rem;
}
.site-footer p { margin: 0; }
.site-footer__brand { flex: 1 1 260px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.site-footer a { color: var(--ash-dim); text-decoration: none; }
.site-footer a:hover { color: var(--ash); }

/* ---------- type & shared bits ---------- */

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--glow);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 999px;
  font: 700 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.button svg { width: 16px; height: 16px; }

.button--hot {
  background: linear-gradient(180deg, var(--glow), var(--ember));
  color: var(--coal);
  box-shadow: 0 10px 30px -8px rgba(255, 91, 36, 0.7);
}
.button--hot:hover {
  color: var(--coal);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -8px rgba(255, 178, 62, 0.8);
}

.button--ghost {
  background: var(--char);
  color: var(--ash);
  border: 1px solid var(--line);
  min-height: 42px;
  padding: 0 1rem;
  font-size: 0.9rem;
}
.button--ghost:hover { background: var(--char-2); color: var(--ash); }

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.badge--new { background: var(--ember); color: var(--coal); }

/* ---------- home intro: the page's h1, kept quiet above the hero ---------- */

.home-intro { padding-top: clamp(1.25rem, 3vw, 2rem); }
.home-intro__title {
  margin: 0;
  font: 700 1rem/1.5 var(--font-body);
  color: var(--ash);
}
.home-intro__sub { margin: 0; line-height: 1.5; color: var(--ash-dim); }
.home-intro + .hero { padding-top: clamp(1.25rem, 3.5vw, 2.5rem); }

.home-about p { max-width: 68ch; margin: 0 0 1rem; color: var(--ash-dim); }

/* ---------- hero: the featured game on a coal bed ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
  isolation: isolate;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.hero__art {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 178, 62, 0.25);
  box-shadow: 0 30px 60px -20px rgba(255, 91, 36, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
  aspect-ratio: 16 / 9;
  background: var(--char);
  transition: transform 0.3s ease;
}
.hero__art:hover { transform: translateY(-4px); }
.hero__art img { width: 100%; height: 100%; object-fit: cover; }

.hero__title {
  margin: 0 0 0.75rem;
  font: 900 clamp(3.5rem, 9vw, 7rem)/0.85 var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, var(--ash) 45%, var(--glow) 80%, var(--ember));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__desc {
  margin: 0 0 1.75rem;
  max-width: 34ch;
  font-size: 1.125rem;
  color: var(--ash-dim);
}

/* The signature: a slow-burning bed of coals under the hero. */
.coalbed {
  position: absolute;
  inset: auto -10% -40% -10%;
  height: 75%;
  z-index: -1;
  background:
    radial-gradient(30% 45% at 22% 70%, rgba(255, 91, 36, 0.55), transparent 70%),
    radial-gradient(25% 40% at 55% 80%, rgba(255, 178, 62, 0.35), transparent 70%),
    radial-gradient(35% 50% at 82% 65%, rgba(255, 91, 36, 0.45), transparent 70%),
    radial-gradient(60% 60% at 50% 100%, rgba(180, 40, 10, 0.5), transparent 75%);
  filter: blur(30px);
  animation: smoulder 7s ease-in-out infinite alternate;
}

@keyframes smoulder {
  0%   { opacity: 0.75; transform: translateX(0) scaleY(1); }
  50%  { opacity: 1;    transform: translateX(-2%) scaleY(1.08); }
  100% { opacity: 0.85; transform: translateX(2%) scaleY(0.96); }
}

@media (max-width: 800px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__desc { max-width: none; }
}

/* ---------- shelves, chips, grid, cards ---------- */

.shelf { margin-top: 3rem; }

.shelf__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.shelf__head .shelf__title { margin: 0; }

.shelf__title {
  margin: 0 0 1.25rem;
  font: 900 2rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.shelf__count {
  font: 500 1rem/1 var(--font-body);
  color: var(--ash-dim);
  margin-left: 0.4rem;
  vertical-align: 0.35em;
}

.chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 1.5rem;
}
.shelf__head .chips { margin-bottom: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--char);
  color: var(--ash-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.chip:hover { color: var(--ash); border-color: rgba(237, 227, 218, 0.25); }
.chip.is-active { background: var(--ash); color: var(--coal); border-color: var(--ash); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}
.grid--row {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: minmax(250px, 300px);
  overflow-x: auto;
  padding-bottom: 1.5rem;
  scroll-snap-type: x mandatory;
}
.grid--row > * { scroll-snap-align: start; }

/* Cards are lit from underneath. New games ("hot") glow at rest; everything glows on hover. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--char);
  border: 1px solid var(--line);
  color: var(--ash);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.card::after {
  content: "";
  position: absolute;
  inset: auto 0 -40% 0;
  height: 70%;
  z-index: -1;
  background: radial-gradient(60% 60% at 50% 100%, rgba(255, 91, 36, 0.55), rgba(255, 178, 62, 0.12) 55%, transparent 75%);
  opacity: 0;
  transform: translateY(20%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.card--hot::after { opacity: 0.55; transform: translateY(10%); }
.card:hover, .card:focus-visible {
  color: var(--ash);
  transform: translateY(-4px);
  border-color: rgba(255, 178, 62, 0.35);
}
.card:hover::after, .card:focus-visible::after { opacity: 1; transform: translateY(0); }

.card__thumb {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--char-2);
  overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; }

.card__body { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 1rem 1.1rem; }
.card__meta { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ash-dim); }
.card__title { font: 900 1.6rem/1.05 var(--font-display); text-transform: uppercase; }
.card__desc {
  font-size: 0.92rem;
  color: var(--ash-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- play page ---------- */

.play { padding-top: 1rem; }

.crumbs { font-size: 0.9rem; color: var(--ash-dim); margin-bottom: 1rem; }
.crumbs a { color: var(--ash-dim); text-decoration: none; }
.crumbs a:hover { color: var(--ash); }

.play__layout { display: grid; gap: 2rem; }
.play__layout:has(.play__side .ad-slot) { grid-template-columns: minmax(0, 1fr) 300px; }
.play__side:not(:has(.ad-slot)) { display: none; }
@media (max-width: 1100px) {
  .play__layout:has(.play__side .ad-slot) { grid-template-columns: minmax(0, 1fr); }
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - var(--header-h) - 8rem);
  width: 100%;
  margin-inline: auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #05030b;
  border: 1px solid var(--line);
  box-shadow: 0 40px 80px -40px rgba(255, 91, 36, 0.45);
}
.stage__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage__rotate { display: none; }

@media (max-width: 700px) and (orientation: portrait) {
  .stage { aspect-ratio: 4 / 3; margin-inline: calc(-1 * var(--gutter)); width: auto; border-radius: 0; border-inline: 0; }
  /* Portrait games (like Sudoku) get a tall stage on phones instead of a letterbox. */
  .stage[data-orientation="portrait"] { aspect-ratio: 5 / 7; }
  .stage[data-orientation="landscape"] { margin-bottom: 1.75rem; overflow: visible; }
  .stage[data-orientation="landscape"] .stage__rotate {
    display: block;
    position: absolute;
    left: 0; right: 0; bottom: -1.75rem;
    margin: 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--ash-dim);
  }
}

/* Fallback "full screen" for browsers without the Fullscreen API (iPhone Safari). */
.stage.is-immersive {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 0;
  border: 0;
}
.stage.is-immersive .stage__rotate { display: none; }
.stage:fullscreen { max-height: none; aspect-ratio: auto; border-radius: 0; border: 0; }
.stage__exit {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 12, 9, 0.7);
  color: var(--ash);
  font: 500 0.8rem/1 var(--font-body);
  cursor: pointer;
}
.stage.is-immersive .stage__exit { display: block; }
body.has-immersive { overflow: hidden; }

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}
.stage-bar__title {
  margin: 0;
  font: 900 clamp(2rem, 5vw, 3rem)/1 var(--font-display);
  text-transform: uppercase;
}

.about-game { max-width: 68ch; margin-top: 1.5rem; }
.about-game p { margin: 0 0 1rem; }
.about-game__lede { font-size: 1.15rem; color: var(--ash); }
.about-game__meta { font-size: 0.85rem; color: var(--ash-dim); }

/* The play page write-up (games/<slug>/about.html): crawlable text, kept quiet under the game. */
.game-guide { margin-top: 2rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.game-guide h2 {
  margin: 2rem 0 0.6rem;
  font: 900 1.5rem/1.1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.game-guide p, .game-guide ul { margin: 0 0 1rem; }
.game-guide ul { padding-left: 1.25rem; }
.game-guide li { margin-bottom: 0.4rem; }
.game-guide li::marker { color: var(--ash-dim); }
.game-guide strong { font-weight: 700; }

/* Reserved ad space: fixed heights so ads never push content around when they load. */
.ad-slot { display: block; margin-block: 1.5rem; background: transparent; }
.ad-slot--below-game { min-height: 100px; }
.ad-slot--home-mid { min-height: 100px; margin-inline: auto; max-width: calc(var(--wrap) + 2 * var(--gutter)); padding-inline: var(--gutter); }
.ad-slot--sidebar { min-height: 600px; position: sticky; top: calc(var(--header-h) + 1rem); margin-top: 0; }

/* ---------- category / static pages ---------- */

.page-head { padding-block: 2.5rem 1.5rem; max-width: 60ch; }
.page-head__title {
  margin: 0 0 0.5rem;
  font: 900 clamp(2.75rem, 7vw, 4.5rem)/0.95 var(--font-display);
  text-transform: uppercase;
}
.page-head__desc { margin: 0; color: var(--ash-dim); font-size: 1.1rem; }

.prose { max-width: 68ch; padding-top: 2.5rem; }
.prose h1 { margin-bottom: 1.5rem; }
.prose h2 { margin: 2rem 0 0.5rem; font: 900 1.6rem/1.1 var(--font-display); text-transform: uppercase; }
.prose p, .prose ul { margin: 0 0 1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose .updated { color: var(--ash-dim); font-size: 0.9rem; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
