@import url('./fonts.css');

/* ============================================================================
   Tokens
   Warm near-black rather than blue-black; a single amber accent used sparingly.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Petrol: a deep blue-green ink, never neutral black. */
  --ink-0: #0c0d10;
  --ink-1: #101216;
  --ink-2: #16191e;
  --ink-3: #1c2027;
  --ink-4: #242932;
  --ink-5: #2e343f;

  --line-1: #1e222a;
  --line-2: #2a3039;
  --line-3: #3a424f;

  --text-1: #e9ecf1;
  --text-2: #9aa3b2;
  --text-3: #6b7383;

  /* One warm accent against the cold base - the whole point of the scheme. */
  --accent: #6e8bff;
  --accent-soft: #1a2140;
  --accent-line: #3a4a8f;
  /* Rose rather than another orange, so destructive never reads as accent. */
  --danger: #ff6b81;

  --font-display: 'Literata', Georgia, 'Times New Roman', serif;
  --font-ui: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Generously rounded - floating chrome reads as soft physical panels. */
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-panel: 0 10px 34px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.03) inset;

  --dur: 130ms;
  --ease: cubic-bezier(0.32, 0.08, 0.24, 1);
}

/* ============================================================================
   Reset
   ========================================================================== */

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

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--ink-1);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

/* The `hidden` attribute must win over any component's own display rule. */
[hidden] { display: none !important; }

h1, h2, h3, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
a { color: inherit; }

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

::selection {
  background: var(--accent-soft);
  color: var(--text-1);
}

/* ============================================================================
   Screen grain + vignette
   Sits above everything, ignores pointer events, and stays faint enough that
   the drawing surface reads clean.
   ========================================================================== */

.screen-fx {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

.screen-fx::before {
  content: '';
  position: absolute;
  inset: -50%;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.screen-fx::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(115% 85% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}

/* Grain is dialled back over the canvas so it never fights with fine strokes. */
body.is-board .screen-fx::before { opacity: 0.03; }

@media (prefers-reduced-motion: no-preference) {
  .screen-fx::before { animation: grain-drift 7s steps(6) infinite; }
}

@keyframes grain-drift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 1%); }
  100% { transform: translate(0, 0); }
}

/* ============================================================================
   Shared atoms
   ========================================================================== */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.field {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--ink-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  transition: border-color var(--dur) var(--ease);
}

.field::placeholder { color: var(--text-3); }
.field:hover { border-color: var(--line-3); }

.field:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(110, 139, 255, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--ink-3);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn:hover { background: var(--ink-4); border-color: var(--line-3); }
.btn:active { background: var(--ink-2); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1024;
  font-weight: 600;
}

.btn-primary:hover { background: #8aa1ff; border-color: #8aa1ff; }
.btn-primary:active { background: #5a78ea; }

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