/* ExcelGames website shell. Same calm palette as the games, light and dark. */

:root {
  --bg: #f3efe7;
  --surface: #fcfaf5;
  --raised: #ffffff;
  --ink: #33302b;
  --ink-soft: #6f695e;
  --line: #ddd6c8;
  --line-strong: #8d8677;
  --accent: #3d7a8c;
  --accent-ink: #fcfaf5;
  --accent-soft: #dcebee;
  --link: #36717f; /* the accent, a shade darker: 4.5:1 for small text on the page */
  --good: #4d7636;
  --shadow: 0 1px 2px rgba(60, 50, 30, .06), 0 8px 24px rgba(60, 50, 30, .08);
  --radius: 14px;
  --header-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1d1f;
    --surface: #24272a;
    --raised: #2c3033;
    --ink: #e5e0d6;
    --ink-soft: #a29d93;
    --line: #393d41;
    --line-strong: #77726a;
    --accent: #7fb9cb;
    --accent-ink: #1b1d1f;
    --accent-soft: #2a3d44;
    --link: #7fb9cb;
    --good: #9cc47f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1d1f;
  --surface: #24272a;
  --raised: #2c3033;
  --ink: #e5e0d6;
  --ink-soft: #a29d93;
  --line: #393d41;
  --line-strong: #77726a;
  --accent: #7fb9cb;
  --accent-ink: #1b1d1f;
  --accent-soft: #2a3d44;
  --link: #7fb9cb;
  --good: #9cc47f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

button { font: inherit; color: inherit; }

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

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  z-index: 10;
}
.skip:focus { top: 8px; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header and footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  margin-right: auto;
}
.brand svg { width: 28px; height: 28px; flex: none; }

.site-nav { display: flex; align-items: center; gap: 4px; }

.site-nav a {
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 550;
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--ink); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.site-footer {
  margin-top: auto;
  padding: 28px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Home ---------- */

.hero { padding: 56px 0 28px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.01em; }
.hero p { margin: 0; max-width: 40em; color: var(--ink-soft); font-size: 18px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px;
  padding: 12px 0 56px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card:hover :is(h2, h3) { text-decoration: underline; text-underline-offset: 3px; }

.card-art {
  display: block;
  aspect-ratio: 16 / 10;
  border-bottom: 3px solid var(--card-accent, var(--accent));
  background: #f3efe7; /* thumbnails are drawn on the light paper colour */
}
.card-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.card :is(h2, h3) { margin: 0; font-size: 20px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; padding: 0; list-style: none; }
.chips li {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
}

/* ---------- Game page ---------- */

.game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 24px 0 16px;
}
.game-head .titles { margin-right: auto; min-width: 0; }
.back { display: inline-block; margin-bottom: 4px; color: var(--ink-soft); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }
.game-head h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.game-head p { margin: 2px 0 0; color: var(--ink-soft); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--line-strong); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn kbd { font: inherit; font-size: 12px; color: var(--ink-soft); padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }

.stage {
  height: max(var(--min-h, 560px), calc(100dvh - var(--header-h) - 120px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.stage:fullscreen { border: 0; border-radius: 0; }

.info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  padding: 28px 0 48px;
}

.panel {
  min-width: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel h2 { margin: 0 0 10px; font-size: 18px; }
.panel p { margin: 0 0 10px; }
.panel .muted, .muted { color: var(--ink-soft); font-size: 14px; }
.panel ol { margin: 0; padding-left: 20px; }
.panel li + li { margin-top: 6px; }

.facts { margin: 4px 0 16px; padding: 0; list-style: none; font-size: 14px; color: var(--ink-soft); }
.facts li { display: flex; gap: 8px; }
.facts li + li { margin-top: 4px; }
.facts li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: var(--accent); }

.score-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
.score-tabs button {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}
.score-tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.scores { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.scores th { padding: 4px 6px; color: var(--ink-soft); font-weight: 550; text-align: left; border-bottom: 1px solid var(--line); }
.scores td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.scores .num { text-align: right; }
.scores tr.latest td { background: var(--accent-soft); font-weight: 650; }
.scores-empty { margin: 8px 0 12px; color: var(--ink-soft); font-size: 14px; }
.toast:empty { display: none; }
.toast { margin: 8px 0 0; color: var(--good); font-size: 14px; font-weight: 600; }

.more { padding: 0 0 56px; }
.more h2 { margin: 0 0 14px; font-size: 20px; }
.more .cards { padding: 0; }

/* Quick hide: only the game (now showing its work sheet) is left, filling the window. */
body.covered > :not(main), body.covered main > :not(.wrap), body.covered .wrap > :not(.stage) { display: none !important; }
body.covered .stage {
  position: fixed;
  inset: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  z-index: 100;
}

/* ---------- Text pages ---------- */

.prose { max-width: 42em; padding: 48px 0 64px; }
.prose h1 { margin: 0 0 16px; font-size: 32px; line-height: 1.2; }
.prose h2 { margin: 28px 0 8px; font-size: 20px; }
.prose p, .prose li { color: var(--ink); }
.prose ul { padding-left: 22px; }

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .info .panel:first-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .site-header .wrap { gap: 4px; }
  .brand { gap: 6px; font-size: 17px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 6px 6px; font-size: 15px; }
  .icon-btn { flex: none; }
  .hero { padding: 36px 0 16px; }
  .info { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .game-head h1 { font-size: 26px; }
  .stage { height: max(var(--min-h, 560px), calc(100dvh - var(--header-h) - 24px)); border-radius: 10px; }
  .fullscreen-btn { display: none; } /* phones: the game already fills the width */
}

/* The smallest phones: the logo alone links home, so the header fits down to 320 wide. */
@media (max-width: 359px) {
  .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } /* still its link's name */
}

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