
/* =========================================
   APEX F1 — BASE STYLES
   File: css/base.css
   ========================================= */

/* 1. Design tokens */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg: #0b0d10;
  --panel: #15181e;
  --panel-hover: #1c2028;
  --input-bg: #20242c;

  /* Brand */
  --red: #e10600;
  --red-hover: #c90000;
  --red-soft: #321817;

  /* Text */
  --text: #f5f6f8;
  --muted: #9399a5;
  --text-disabled: #656b76;

  /* Borders */
  --line: #292d35;
  --line-strong: #3a404b;

  /* Status */
  --success: #45d483;
  --warning: #f5bd4f;
  --danger: #ff7772;
  --info: #70b7ff;

  /* Typography */
  --font-main: Arial, Helvetica, sans-serif;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 19px;
  --text-xl: 25px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Borders and effects */
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-panel: 0 4px 16px rgb(0 0 0 / 15%);

  /* Layout */
  --content-width: 1350px;
  --page-gutter: 5%;
  --header-height: 76px;

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-normal: 220ms ease;
}

/* 2. Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;

  background: var(--bg);
  color: var(--text);

  font-family: var(--font-main);
  font-size: var(--text-base);
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 3. Default typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: clamp(25px, 4vw, 38px);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: 17px;
}

p {
  margin: 0;
}

small {
  font-size: var(--text-sm);
}

strong {
  font-weight: 700;
}

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

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

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

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 4. Selection */
::selection {
  background: var(--red);
  color: #ffffff;
}

/* 5. Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--bg);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--bg);
}

*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* 6. Shared text utilities */
.muted {
  color: var(--muted);
}

.text-primary {
  color: var(--text);
}

.text-red {
  color: var(--red);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.text-info {
  color: var(--info);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* 7. Focus accessibility */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

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

/* 8. Common states */
.hidden {
  display: none !important;
}

.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;
}

/* 9. Responsive base */
@media (max-width: 800px) {
  :root {
    --page-gutter: 4%;
    --space-8: 24px;
  }
}

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