/* The pebblebox.games site (spec/v0.5/spec.md): the home page, /account, /privacy and /terms. Brand tokens come from
   core/tokens.css, copied next to this file by the build. Night Slate (dark) is the default whatever the OS prefers
   (theme.js sets data-theme="light" for Paper); this file's :root block comes after tokens.css, so it wins over
   tokens.css's system-setting rule. Styles only through this file or the CSSOM: the pages run under a strict CSP. */
:root {
  color-scheme: dark;
  --gc-surface: #1a1d24;
  --gc-panel: #242833;
  --gc-text: #f0e8da;
  --gc-accent: #a9c1ea;
  --gc-moon-edge: transparent;
  --site-muted: color-mix(in srgb, var(--gc-text) 78%, var(--gc-surface));
  --site-line: color-mix(in srgb, var(--gc-text) 22%, transparent);
  --site-cta-bg: #f2b66d;
  --site-cta-text: #161b22;
  --site-card-bg: var(--gc-panel);
  --site-card-text: var(--gc-text);
  --site-card-muted: var(--site-muted);
  --site-focus: var(--gc-accent);
}

:root[data-theme="light"] {
  color-scheme: light;
  --gc-surface: #f4ecdf;
  --gc-panel: #fffaf1;
  --gc-text: #1d2730;
  --gc-accent: #2c5878;
  --gc-moon-edge: #1d2730;
  --site-muted: color-mix(in srgb, var(--gc-text) 80%, var(--gc-surface));
  --site-cta-bg: #2c5878;
  --site-cta-text: #fffaf1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--gc-surface);
  color: var(--gc-text);
  font: 1rem/1.6 var(--gc-font-body);
}

a {
  color: var(--gc-accent);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--site-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--gc-font-display);
  line-height: 1.2;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--gc-panel);
  color: var(--gc-text);
  border-radius: 0.5rem;
}

.skip-link:focus {
  top: 0.5rem;
}

/* Header and footer */
.site-header {
  border-bottom: 1px solid var(--site-line);
}

.site-header-inner,
.site-footer-inner,
main.narrow,
.band,
.hero {
  width: 100%;
  max-width: 67.5rem;
  margin-left: auto;
  margin-right: auto;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.9rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
  font: 700 1.15rem/1 var(--gc-font-display);
}

.brand-mark {
  width: 40px;
  height: 40px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  order: 3;
  width: 100%;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  color: var(--site-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--gc-text);
  text-decoration: underline;
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 40rem) {
  .site-nav {
    order: 0;
    width: auto;
  }
}

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--site-line);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  padding: 1rem 1rem 2.5rem;
  font-size: 0.95rem;
}

.site-footer-inner a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--site-muted);
}

.site-footer-note {
  margin-left: auto;
  color: var(--site-muted);
}

/* Privacy, terms and the account page */
main.narrow {
  max-width: 44rem;
  padding: 0.5rem 1rem 0;
}

main.narrow h1 {
  font-size: 1.9rem;
  margin: 1.25rem 0 0.25rem;
}

main.narrow h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
}

.updated {
  margin-top: 0;
  opacity: 0.8;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--gc-text) 20%, transparent);
}

/* Home page */
.hero {
  width: calc(100% - 2rem);
  position: relative;
  display: flex;
  align-items: center;
  min-height: 30rem;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 1.5rem;
  background: #0f1230;
  color: #f0e8da;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 78% 50%;
}

/* The overlay keeps the live headline readable over the image in both themes. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10, 12, 30, 0.9) 0%, rgba(10, 12, 30, 0.74) 55%, rgba(10, 12, 30, 0.1) 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  max-width: 34rem;
  padding: 2rem 1.5rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  line-height: 1.05;
}

.hero p {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: #f0e8da;
}

@media (min-width: 48rem) {
  .hero {
    min-height: 26rem;
  }

  .hero::before {
    background: linear-gradient(90deg, rgba(10, 12, 30, 0.92) 0%, rgba(10, 12, 30, 0.8) 38%, rgba(10, 12, 30, 0) 68%);
  }

  .hero-copy {
    align-self: center;
    padding: 2rem 3rem;
  }
}

.band {
  padding: 3.5rem 1rem 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--site-muted);
}

.band h2 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--site-muted);
}

.card {
  padding: 1.25rem 1.5rem;
  border-radius: 1.25rem;
  background: var(--gc-panel);
  color: var(--gc-text);
}

:root[data-theme="light"] .card {
  border: 1px solid var(--site-line);
}

.shelf,
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 56rem) {
  .shelf,
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.steps .card h3,
.steps .card p {
  margin: 0;
}

.steps .card p {
  margin-top: 0.5rem;
  color: var(--site-muted);
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.5rem;
  border-radius: 1.5rem;
  background: var(--site-card-bg);
  color: var(--site-card-text);
}

/* Light theme: a stone-colored card with a darker moon. The stone is set per card by the shelf (--card-stone). */
:root[data-theme="light"] .game-card {
  --site-card-bg: var(--card-stone);
  --site-card-text: var(--gc-on-stone);
  --site-card-muted: var(--gc-on-stone);
  --site-focus: var(--gc-on-stone);
  border: none;
}

.game-card .moon-wrap {
  margin-bottom: 0.75rem;
}

.game-card h3 {
  margin: 0;
  font-size: 1.6rem;
}

.game-card .tagline {
  margin: 0 0 0.75rem;
  color: var(--site-card-muted);
}

.game-card .preview-chip {
  align-self: flex-start;
  margin: 0 0 0.5rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.85rem;
}

.game-card .button {
  align-self: flex-start;
  margin-top: auto;
}

:root[data-theme="light"] .game-card .button {
  background: var(--gc-on-stone);
  color: #fffaf1;
  border-color: var(--gc-on-stone);
}

.shelf-empty {
  margin: 0 0 1rem;
  font-size: 1.125rem;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--site-line);
  border-radius: 1.25rem;
  color: var(--site-muted);
}

.slots .slot-moons {
  display: flex;
  gap: 0.25rem;
  opacity: 0.55;
}

.slots p {
  margin: 0;
}

.about {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}

@media (min-width: 56rem) {
  .about {
    grid-template-columns: 1.2fr 1fr;
  }
}

.about p {
  color: var(--site-muted);
}

.about-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.about-card p {
  margin: 0;
  font: 600 1.35rem/1.3 var(--gc-font-display);
  color: var(--gc-text);
}

/* The account page (/account). Every control is at least 44 px tall and keeps a visible focus ring; rows wrap
   to fit 390 px. Colors come only from the --gc-* tokens. */
.panel {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--gc-text) 35%, transparent);
  border-radius: 1rem;
  background: var(--gc-panel);
  overflow-wrap: anywhere;
}

.panel h2 {
  margin: 0 0 0.5rem;
}

.panel h2:focus-visible {
  outline: 3px solid var(--gc-accent);
  outline-offset: 2px;
}

.signed-in-as {
  margin: 0.5rem 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--gc-surface);
  color: var(--gc-text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  color: var(--gc-accent);
  font-weight: 600;
}

/* Destructive: words and weight carry it, not color alone. */
.button-danger {
  border-width: 2px;
  font-weight: 700;
}

.button:focus-visible,
.input:focus-visible {
  outline: 3px solid var(--gc-accent);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.field {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
}

.input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 16rem;
  min-height: 2.75rem;
  padding: 0.5rem;
  border: 1px solid var(--gc-text);
  border-radius: 0.5rem;
  background: var(--gc-surface);
  color: var(--gc-text);
  font: inherit;
  letter-spacing: 0.1em;
}

.notice {
  margin: 0.75rem 0 0;
}

.notice-error {
  font-weight: 600;
}

.notice-empty {
  margin: 0;
}

.small {
  font-size: 0.9rem;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0;
}

.games li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.game-moon {
  flex: none;
  width: 44px;
  height: 44px;
}

.game-text {
  display: flex;
  flex-direction: column;
}

.game-title {
  font-weight: 700;
}

.game-played {
  font-size: 0.9rem;
}

.back {
  margin: 2rem 0 0;
}

/* Site buttons: after .button so they win. */
.button-cta {
  background: var(--site-cta-bg);
  color: var(--site-cta-text);
  border-color: var(--site-cta-bg);
  font-weight: 600;
}

.button-quiet {
  background: transparent;
}

.button-large {
  min-height: 3.25rem;
  padding: 0.5rem 1.5rem;
  font-size: 1.05rem;
}

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