/* --------------------------------------------------------------------------
   TbsRace base: design tokens, reset, typography and global accessibility.
   -------------------------------------------------------------------------- */

:root {
  --bg: #0a0a09;
  --bg-soft: #0f0e0b;
  --card: #14130f;
  --card-soft: #191711;
  --card-strong: #1f1c15;

  --text: #f4ede1;
  --muted: #a9a295;
  --muted-2: #8d867a;

  --gold: #d8b44a;
  --gold-bright: #e9c95f;
  --gold-deep: #a9862a;
  --green: #3ed19b;
  --blue: #6b9df8;
  --coral: #ff7d67;
  --lavender: #b59cff;

  --line: rgba(244, 237, 225, 0.09);
  --line-strong: rgba(244, 237, 225, 0.17);
  --line-gold: rgba(216, 180, 74, 0.35);

  --gold-wash: rgba(216, 180, 74, 0.11);
  --green-wash: rgba(62, 209, 155, 0.1);
  --coral-wash: rgba(255, 125, 103, 0.1);

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.22);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;

  --header-h: 72px;
  --container: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(1100px 720px at 12% -12%, rgba(216, 180, 74, 0.09), transparent 62%),
    radial-gradient(900px 640px at 108% 2%, rgba(107, 157, 248, 0.055), transparent 58%),
    radial-gradient(900px 700px at 50% 112%, rgba(216, 180, 74, 0.035), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(244, 237, 225, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 237, 225, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(1.95rem, 4.2vw, 3rem);
}

h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

::selection {
  background: rgba(216, 180, 74, 0.32);
  color: #fffaf0;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #0d0c09;
}

::-webkit-scrollbar-thumb {
  background: #2c2820;
  border: 2px solid #0d0c09;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3b352a;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--gold);
  color: #171204;
  font-weight: 600;
  transition: transform 160ms var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.noscript-note {
  max-width: 560px;
  margin: 24px auto;
  padding: 14px 18px;
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-sm);
  background: var(--gold-wash);
  color: var(--text);
  text-align: center;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   File-protocol notice, rendered by js/env-check.js
   -------------------------------------------------------------------------- */

.file-mode {
  background:
    radial-gradient(700px 500px at 50% 25%, rgba(216, 180, 74, 0.1), transparent 65%),
    var(--bg);
}

.file-mode-main {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
}

.file-mode-card {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}

.file-mode-card .brand {
  margin-bottom: 6px;
}

.file-mode-card h1 {
  font-size: clamp(1.45rem, 3.4vw, 1.9rem);
  line-height: 1.15;
}

.file-mode-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.file-mode-card .file-mode-note {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.82rem;
}

.file-mode-card pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
  color: var(--gold-bright);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
