/* Page frame: reset, header, navigation, footer. Layout uses logical
   properties (inline/block, start/end) so it flips between RTL and LTR. */

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

body {
  margin: 0;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

/* [hidden] must win over the display values set on components. */
[hidden] { display: none !important; }

h1 { font-size: 1.6rem; line-height: 1.3; margin-block: 0.5rem; }
.lead { color: var(--muted); margin-block-start: 0; }
.hint { color: var(--muted); font-size: 0.875rem; margin-block: 0.25rem 0.5rem; }

.container {
  inline-size: 100%;
  max-inline-size: 64rem;
  margin-inline: auto;
  padding: 1.5rem 1rem 3rem;
  flex: 1;
}
.container.wide { max-inline-size: 68rem; }

/* ---- header ---- */
.site-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  padding-block: 0.6rem;
  padding-inline: 1rem;
  background: var(--surface);
  border-block-end: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-ink);
  text-decoration: none;
}
.brand-logo { inline-size: 2rem; block-size: 2rem; flex: none; }

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  min-inline-size: 0;
  overflow-x: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-block: 0.3rem;
  padding-inline: 0.85rem;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
a.nav-item:hover { background: var(--surface-2); }
.nav-item.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.nav-item.soon { color: var(--muted); font-weight: 400; cursor: not-allowed; }

.header-tools { display: flex; align-items: center; gap: 0.5rem; margin-inline-start: auto; }
.header-tools form { margin: 0; }

/* Phones: the navigation drops to its own scrollable row. */
@media (max-width: 44rem) {
  .main-nav { order: 3; flex-basis: 100%; }
}

/* ---- theme toggle ---- */
.icon-btn {
  inline-size: 2.3rem;
  block-size: 2.3rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { inline-size: 1.1rem; block-size: 1.1rem; }

/* ---- footer ---- */
.site-footer {
  padding-block: 1rem;
  padding-inline: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-block-start: 1px solid var(--border);
}
.site-footer a { color: inherit; }
.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* The cookie banner (games/_consent.html): fixed at the bottom until the visitor chooses. Below the
   game page's alert box (z-index 30) so a draw offer is never hidden by it. */
.consent {
  position: fixed;
  inset-block-end: 0.75rem;
  inset-inline: 0.75rem;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  max-inline-size: 44rem;
  margin-inline: auto;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.consent[hidden] { display: none; }
.consent p { margin: 0; flex: 1 1 16rem; }
.consent-actions { display: flex; gap: 0.5rem; }
.site-footer p { margin: 0; max-inline-size: 64rem; margin-inline: auto; }
