/* =========================================================
   WORDLE LEAGUE — shell
   Reset, typography, site header/footer, buttons, forms, modals.
   ========================================================= */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }

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

::selection { background: var(--game); color: var(--game-ink); }

/* ---------- layout primitives ---------- */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack       { display: flex; flex-direction: column; }
.stack-2     { gap: var(--s-2); }
.stack-3     { gap: var(--s-3); }
.stack-4     { gap: var(--s-4); }
.stack-5     { gap: var(--s-5); }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  margin: 0;
}

.kicker {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.kicker b { color: var(--game); font-weight: 700; }

.lede {
  font-size: var(--step-1);
  color: var(--fg-muted);
  max-width: 54ch;
  margin: 0;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Giant vertical wordmark used as page structure */
.spine {
  position: absolute;
  left: calc(var(--gutter) * -1 + 0.25rem);
  top: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.8;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--line-strong);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  user-select: none;
  pointer-events: none;
}
@media (max-width: 1100px) { .spine { display: none; } }

/* ---------- site header ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 60px;
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}
.wordmark span { color: var(--game); }

.navlinks {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.navlinks a, .navlinks button {
  color: var(--fg-muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  transition: color 0.18s var(--ease);
}
.navlinks a:hover, .navlinks button:hover { color: var(--fg); }
.navlinks a[aria-current="page"] { color: var(--game); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
              border-color 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn--primary { background: var(--game); color: var(--game-ink); }
.btn--primary:hover:not([disabled]) { background: var(--accent-hot); }

.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn--ghost:hover:not([disabled]) { border-color: var(--game); color: var(--game); }

.btn--block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field > label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.input, .select {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  transition: border-color 0.18s var(--ease);
}
.input::placeholder { color: var(--fg-faint); }
.input:focus, .select:focus { border-color: var(--game); outline: none; }

.select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* ---------- inline notice (replaces alert()) ---------- */
.notice {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  padding: 0.65rem 0.8rem;
  border-left: 2px solid var(--game);
  background: var(--bg-hover);
  color: var(--fg);
}
.notice[hidden] { display: none; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--s-3);
  background: rgba(3, 4, 6, 0.82);
  backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal__panel {
  width: 100%;
  max-width: 380px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.modal__panel h2 {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: var(--step-2);
  line-height: 1;
  margin: 0;
}

/* ---------- footer ---------- */
.sitefoot {
  border-top: 1px solid var(--line);
  margin-top: var(--s-7);
}
.sitefoot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: space-between;
  padding-block: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  text-transform: uppercase;
}
.sitefoot a { color: var(--fg-muted); text-decoration: none; }
.sitefoot a:hover { color: var(--game); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
