/*
 * Blockfall website: tokens, fonts, resets and the few shared building blocks (container,
 * eyebrow, card, button, form field). Dark only, in the game's palette (docs/design.md).
 * Components and pages use only these tokens.
 */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/space-grotesk-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
}

:root {
  color-scheme: dark;

  /* The game's colours (flutter-app/lib/theme/tokens.dart) */
  --bg: #0b0e1a;
  --surface: #161b30;
  --surface-2: #1d2340;
  --ink: #eef1ff;
  --muted: #8a92b2;
  --primary: #5eead4;
  --primary-hover: #76edda;
  --primary-text: #5eead4;
  --on-primary: #06221e;
  --chip: #1d2340;
  --good: #5eead4;
  --bad: #ff6b6b;
  --amber: #ffc857;
  --line: #232a45;
  --track: #2d3555;
  --avatar-from: #a78bfa;
  --avatar-to: #4cc9f0;
  --shadow: 0 10px 30px rgb(94 234 212 / 14%);
  --shadow-primary: 0 8px 30px rgb(94 234 212 / 33%);

  /* The pieces (not the classic guideline colours) */
  --piece-i: #38bdf8;
  --piece-o: #fb923c;
  --piece-t: #f472b6;
  --piece-s: #a3e635;
  --piece-z: #fb7185;
  --piece-j: #818cf8;
  --piece-l: #facc15;

  --display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --text: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --radius-card: 18px;
  --radius-button: 16px;
  --radius-tile: 14px;
  --radius-board: 10px;
  --radius-block: 4px;

  --gutter: clamp(16px, 5vw, 40px);
  --column: 1120px;
  --focus-ring: 0 0 0 3px var(--bg), 0 0 0 5px var(--primary);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--text);
  overflow-x: clip;
}

main {
  flex: 1;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

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

a {
  color: var(--primary-text);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

/* Layout */

.container {
  width: min(100% - 2 * var(--gutter), var(--column));
  margin-inline: auto;
}

/* The small uppercase label of the game (AppText.label) */

.eyebrow {
  font: 600 12px/1.4 var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-text);
}

/* Cards: the game's AppCard */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

/* Buttons: the game's PrimaryButton and GhostButton */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font: 600 16px/1.2 var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms ease, background-color 150ms ease, border-color 150ms ease;
}

.button:active {
  transform: scale(0.97);
}

.button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.button--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-primary);
}

.button--primary:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}

.button--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button--secondary:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.button--danger {
  background: var(--surface);
  border-color: var(--bad);
  color: var(--bad);
}

.button--danger:hover {
  background: var(--surface-2);
  color: var(--bad);
}

.button__icon {
  width: 20px;
  height: 20px;
}

/* Form fields (contact form, new password) */

.field {
  display: grid;
  gap: 6px;
}

.field__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field__label {
  font: 600 14px/1.4 var(--text);
}

.field__input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
}

.field__input:hover {
  border-color: var(--track);
}

.field__input:focus-visible {
  border-color: var(--primary);
  border-radius: 12px;
}

.field__input[aria-invalid] {
  border-color: var(--bad);
}

.field__hint,
.field__counter {
  font-size: 13px;
  color: var(--muted);
}

.field__counter {
  font-variant-numeric: tabular-nums;
}

.field__error {
  font-size: 14px;
  color: var(--bad);
}

.form-status {
  font-size: 15px;
  color: var(--muted);
}

.form-status:empty {
  display: none;
}

.form-status[data-tone='good'] {
  color: var(--good);
}

.form-status[data-tone='bad'] {
  color: var(--bad);
}

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