/* ==========================================================================
   Zorix — Design Tokens (vanilla CSS)
   Source of truth for the visual redesign of zorixvpn.site.

   Usage in index.html (when ready):
     <link rel="stylesheet" href="/tokens.css?v=YYYYMMDD" />
   nginx/aiohttp must serve this file from web_ui/ or /opt/zorixvpn/design/.

   Migration strategy: canonical names below + legacy aliases (--bg, --accent…)
   so existing CSS keeps working while styles are updated section by section.
   ========================================================================== */

:root {
  /* ---- Background ---- */
  --bg-primary: #0A0E14;
  --bg-secondary: #10151D;
  --bg-tertiary: #161C26;

  /* ---- Borders ---- */
  --border-subtle: #1F2733;
  --border-default: #2A3441;

  /* ---- Accents ---- */
  --accent-primary: #2FD8C9;
  --accent-primary-hover: #4EE8DA;
  --accent-secondary: #3B82F6;

  /* ---- Text ---- */
  --text-primary: #F4F6F8;
  --text-secondary: #9AA5B1;
  --text-tertiary: #5B6472;

  /* ---- Status ---- */
  --success: #2FD897;
  --warning: #E8B339;
  --error: #E8515A;

  /* ---- Brand mark (logo cross — keep separate from semantic error red) ---- */
  --brand-mark: #FF3B3B;
  --brand-mark-deep: #E01E1E;

  /* ---- Typography ----
     Sora + JetBrains Mono are already loaded in index.html. */
  --font-sans: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --text-hero-size: 56px;
  --text-hero-lh: 1.1;
  --text-hero-weight: 600;

  --text-h1-size: 40px;
  --text-h1-lh: 1.15;
  --text-h1-weight: 600;

  --text-h2-size: 28px;
  --text-h2-lh: 1.2;
  --text-h2-weight: 600;

  --text-h3-size: 20px;
  --text-h3-lh: 1.3;
  --text-h3-weight: 600;

  --text-body-size: 16px;
  --text-body-lh: 1.6;
  --text-body-weight: 400;

  --text-small-size: 14px;
  --text-small-lh: 1.5;
  --text-small-weight: 400;

  --text-caption-size: 12px;
  --text-caption-lh: 1.4;
  --text-caption-weight: 500;
  --text-caption-tracking: 0.04em;

  /* ---- Spacing (8px grid) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  --space-9: 128px;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-glow-accent: 0 0 24px rgba(47, 216, 201, 0.15);

  /* ---- Motion (CSS only — no Framer) ---- */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 320ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ========================================================================
     Legacy aliases — map names already used in index.html to new tokens.
     Replace ad-hoc :root blocks in index.html with this file, then delete
     duplicate definitions. Until then, link tokens.css BEFORE inline styles.
     ======================================================================== */

  /* Block 1 names (login / apps section) */
  --bg: var(--bg-primary);
  --bg-2: var(--bg-secondary);
  --panel: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
  --panel-border: color-mix(in srgb, var(--accent-primary) 14%, transparent);
  --panel-border-strong: color-mix(in srgb, var(--accent-primary) 28%, transparent);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --muted-soft: var(--text-tertiary);
  --accent: var(--accent-primary);
  --accent-2: var(--accent-secondary);
  --accent-glow: var(--shadow-glow-accent);
  --ok: var(--success);
  --warn: var(--warning);
  --bad: var(--error);
  --chip: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  --chip-border: color-mix(in srgb, var(--accent-primary) 25%, transparent);
  --card-radius: var(--radius-lg);
  --input-radius: var(--radius-sm);
  --btn-radius: var(--radius-md);

  /* Block 2 names (cabinet / draft layer) */
  --surface: var(--bg-secondary);
  --surface-2: var(--bg-tertiary);
  --border: var(--border-subtle);
  --border-hi: var(--border-default);
  --txt: var(--text-primary);
  --txt-2: var(--text-secondary);
  --txt-3: var(--text-tertiary);
  --swiss: var(--brand-mark);
  --swiss-deep: var(--brand-mark-deep);
  --green: var(--success);
  --amber: var(--warning);
  --radius: var(--radius-lg);
  /* --radius-sm already defined above (6px); legacy 14px → use --radius-md until refactored */
}

/* Typography utilities */
.text-hero {
  font-family: var(--font-sans);
  font-size: var(--text-hero-size);
  line-height: var(--text-hero-lh);
  font-weight: var(--text-hero-weight);
}

.text-h1 {
  font-family: var(--font-sans);
  font-size: var(--text-h1-size);
  line-height: var(--text-h1-lh);
  font-weight: var(--text-h1-weight);
}

.text-h2 {
  font-family: var(--font-sans);
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-lh);
  font-weight: var(--text-h2-weight);
}

.text-h3 {
  font-family: var(--font-sans);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-lh);
  font-weight: var(--text-h3-weight);
}

.text-body {
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  line-height: var(--text-body-lh);
  font-weight: var(--text-body-weight);
}

.text-small {
  font-family: var(--font-sans);
  font-size: var(--text-small-size);
  line-height: var(--text-small-lh);
  font-weight: var(--text-small-weight);
}

.text-caption {
  font-family: var(--font-sans);
  font-size: var(--text-caption-size);
  line-height: var(--text-caption-lh);
  font-weight: var(--text-caption-weight);
  letter-spacing: var(--text-caption-tracking);
  text-transform: uppercase;
}

.text-mono {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Design-system components — prefixed ds- to avoid clashing with existing
   .btn / .card / .input in index.html until those blocks are migrated.
   ========================================================================== */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-body-size);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast);
}

.ds-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

.ds-btn-primary {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.ds-btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow-accent);
}

.ds-btn-secondary {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-primary);
}

.ds-btn-secondary:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.ds-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color var(--transition-base);
}

.ds-card:hover {
  border-color: color-mix(in srgb, var(--accent-primary) 40%, transparent);
}

.ds-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  transition: border-color var(--transition-base);
}

.ds-input::placeholder {
  color: var(--text-tertiary);
}

.ds-input:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
}

.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-caption-size);
  font-weight: var(--text-caption-weight);
  letter-spacing: var(--text-caption-tracking);
  text-transform: uppercase;
}

.ds-badge-success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.ds-badge-warning { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.ds-badge-error   { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
