/* Local @font-face declarations for offline CSP compliance (M6-01) */

/* Hanken Grotesk */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/HankenGrotesk-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Inter-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Inter-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Inter-Cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Inter-CyrillicExt.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/Inter-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/Inter-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/Inter-Cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/Inter-CyrillicExt.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/Inter-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/Inter-LatinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/Inter-Cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/Inter-CyrillicExt.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* Design tokens for Mini App. See .ai/DESIGN_SYSTEM.md.
 * NOTE (REVIEW BUG-009): Aurora intentionally uses a FIXED brand palette
 * (defined below), NOT Telegram themeParams (--tg-theme-*). Light/dark is
 * switched via the [data-theme] attribute set by js/theme.js (derived from
 * Telegram colorScheme, a saved preference, or OS prefers-color-scheme).
 * To instead adopt the user's per-chat Telegram theme colors, map the
 * --color-* tokens to var(--tg-theme-*, <fallback>) here AND update
 * DESIGN_SYSTEM.md — that is a design decision left to a human.
 */

:root,
[data-theme=light] {
  color-scheme: light dark;

  /* Color roles - Violet Palette (light theme) */
  --color-bg: #e5ebf0;
  --color-surface: #ffffff;
  --color-surface-container-low: #ffffff;
  --color-header: rgba(255, 255, 255, 0.9);
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-text-subtitle: var(--color-text-muted);
  --color-link: #6b38d4;
  --color-primary: #6b38d4;
  --color-gradient-primary: linear-gradient(135deg, #6b38d4 0%, #b4136d 100%);
  --color-primary-text: #ffffff;
  --color-border: rgba(0, 0, 0, 0.05);
  --color-error: #f43f5e;

  --color-success: #00c758;
  --color-warning: #f59e0b;
  --color-warning-text: #92400e;

  /* Glowing variables */
  --glow-opacity-purple: rgba(168, 85, 247, 0.12);
  --glow-opacity-pink: rgba(244, 63, 94, 0.08);
  --glow-opacity-amber: rgba(245, 158, 11, 0.05);

  --color-secondary-container: rgba(244, 63, 94, 0.1);
  --color-on-secondary-container: #f43f5e;

  /* Tinted variants — semi-transparent. */
  --color-primary-tint: rgba(168, 85, 247, 0.12);
  --color-error-tint: rgba(244, 63, 94, 0.12);
  --color-success-tint: rgba(0, 199, 88, 0.12);
  --color-warning-tint: rgba(245, 158, 11, 0.14);

  --color-progress-bg: rgba(0, 0, 0, 0.05);
  --card-highlight: transparent;

  /* Typography. */
  --font-system: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;

  --text-display-xl: 48px;
  --text-display-lg: 32px;
  --text-h1: 28px;
  --text-h2: 24px;
  --text-h3: 20px;
  --text-body-lg: 18px;
  --text-body: 16px;
  --text-body-sm: 14px;
  --text-caption: 12px;

  /* Spacing scale (DESIGN_SYSTEM §3). */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius. */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 24px rgba(168, 85, 247, 0.08);
  --shadow-btn: 0 4px 12px rgba(0, 0, 0, 0.25);

  /* Motion (DESIGN_SYSTEM §7). */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Aurora design tokens (AURORA_IMPLEMENTATION_PLAN.md §1.4).
   * Extend the existing violet palette; do not redefine pre-Aurora vars. */
  --aurora-color-brand-primary: #5B5BF5;
  --aurora-color-brand-secondary: #8B5CF6;
  --aurora-color-brand-energy: #C026D3;
  --aurora-color-secure: #10B981;
  --aurora-color-warn: #F59E0B;
  --aurora-color-danger: #EF4444;
  --aurora-radius-card: 20px;
  --aurora-radius-button: 14px;
  --aurora-shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.15);
  --aurora-gradient-brand: linear-gradient(135deg, #5B5BF5 0%, #8B5CF6 50%, #C026D3 100%);

  /* Recommended card specific colors and badge gradient */
  --color-recommended-traffic: var(--color-text);
  --color-recommended-name-bg: var(--color-primary-tint);
  --color-recommended-name-text: var(--color-primary);
  --color-gradient-badge: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
}

[data-theme=dark] {
  /* Color roles - ShieldVPN Palette (dark theme) */
  --color-bg: #000000;
  --color-surface: #1A1D26;
  --color-surface-container-low: #1A1D26;
  --color-header: rgba(15, 17, 23, 0.95);
  --color-text: #F4F7F9;
  --color-text-muted: #aeb5c7;
  --color-text-subtitle: var(--color-text-muted);
  --color-link: #6b38d4;
  --color-primary: #6b38d4;
  --color-gradient-primary: linear-gradient(135deg, #6b38d4 0%, #b4136d 100%);
  --color-primary-text: #ffffff;
  --color-border: #32394a;
  --color-error: #ba1a1a;

  --color-success: #00c758;
  --color-warning: #f59e0b;
  --color-warning-text: #fef3c7;

  /* Glowing variables */
  --glow-opacity-purple: rgba(107, 56, 212, 0.15);
  --glow-opacity-pink: rgba(180, 19, 109, 0.1);
  --glow-opacity-amber: rgba(245, 158, 11, 0.08);

  --color-secondary-container: rgba(180, 19, 109, 0.18);
  --color-on-secondary-container: #b4136d;

  /* Tinted variants — semi-transparent. */
  --color-primary-tint: rgba(107, 56, 212, 0.16);
  --color-error-tint: rgba(186, 26, 26, 0.16);
  --color-success-tint: rgba(0, 199, 88, 0.16);
  --color-warning-tint: rgba(245, 158, 11, 0.16);
  --color-overlay: rgba(0, 0, 0, 0.6);

  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.5);
  --shadow-btn: 0 0 12px rgba(255, 255, 255, 0.2);
  --color-progress-bg: rgba(255, 255, 255, 0.1);
  --card-highlight: rgba(255, 255, 255, 0.03);

  --aurora-color-brand-primary: #6b38d4;
  --aurora-color-brand-secondary: #b4136d;
  --aurora-radius-card: 16px;
  --aurora-radius-button: 12px;
  --aurora-shadow-soft: 0 0 20px rgba(107, 56, 212, 0.15);
  --aurora-gradient-brand: linear-gradient(135deg, #6b38d4 0%, #b4136d 100%);

  /* Recommended card specific colors and badge gradient */
  --color-recommended-traffic: #e9ddff;
  --color-recommended-name-bg: rgba(180, 19, 109, 0.15);
  --color-recommended-name-text: #ffb0cd;
  --color-gradient-badge: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    /* Fallback/Default system dark mode matching our dark theme */
    --color-bg: #0F1117;
    --color-surface: #1A1D26;
    --color-surface-container-low: #1A1D26;
    --color-header: rgba(15, 17, 23, 0.95);
    --color-text: #F4F7F9;
    --color-text-muted: #aeb5c7;
    --color-text-subtitle: var(--color-text-muted);
    --color-link: #6b38d4;
    --color-primary: #6b38d4;
    --color-gradient-primary: linear-gradient(135deg, #6b38d4 0%, #b4136d 100%);
    --color-primary-text: #ffffff;
    --color-border: #32394a;
    --color-error: #ba1a1a;

    --color-success: #00c758;
    --color-warning: #f59e0b;
    --color-warning-text: #fef3c7;

    --glow-opacity-purple: rgba(107, 56, 212, 0.15);
    --glow-opacity-pink: rgba(180, 19, 109, 0.1);
    --glow-opacity-amber: rgba(245, 158, 11, 0.08);

    --color-secondary-container: rgba(180, 19, 109, 0.18);
    --color-on-secondary-container: #b4136d;

    --color-primary-tint: rgba(107, 56, 212, 0.16);
    --color-error-tint: rgba(186, 26, 26, 0.16);
    --color-success-tint: rgba(0, 199, 88, 0.16);
    --color-warning-tint: rgba(245, 158, 11, 0.16);
    --color-overlay: rgba(0, 0, 0, 0.6);

    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.5);
    --shadow-btn: 0 0 12px rgba(255, 255, 255, 0.2);
    --color-progress-bg: rgba(255, 255, 255, 0.1);
    --card-highlight: rgba(255, 255, 255, 0.03);

    --aurora-color-brand-primary: #6b38d4;
    --aurora-color-brand-secondary: #b4136d;
    --aurora-radius-card: 16px;
    --aurora-radius-button: 12px;
    --aurora-shadow-soft: 0 0 20px rgba(107, 56, 212, 0.95);
    --aurora-gradient-brand: linear-gradient(135deg, #6b38d4 0%, #b4136d 100%);

    /* Recommended card specific colors and badge gradient */
    --color-recommended-traffic: #e9ddff;
    --color-recommended-name-bg: rgba(180, 19, 109, 0.15);
    --color-recommended-name-text: #ffb0cd;
    --color-gradient-primary: linear-gradient(135deg, #b4136d 0%, #6b38d4 100%);
    --color-gradient-secondary: linear-gradient(135deg, #ba1a1a 0%, #d97706 100%);
    --color-gradient-badge: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-normal: 0ms;
    --transition-slow: 0ms;
  }
}

/* Ambient Glow Backdrop */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.glow-blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: normal;
  pointer-events: none;
}

.glow-blob--purple {
  background: radial-gradient(circle, var(--glow-opacity-purple) 0%, transparent 70%);
  top: -10%;
  left: -15%;
  width: min(500px, 80vw);
  height: min(500px, 80vw);
  filter: blur(100px);
  animation: float-slow-1 25s ease-in-out infinite alternate;
}

.glow-blob--pink {
  background: radial-gradient(circle, var(--glow-opacity-pink) 0%, transparent 70%);
  bottom: -10%;
  right: -15%;
  width: min(600px, 90vw);
  height: min(600px, 90vw);
  filter: blur(110px);
  animation: float-slow-2 30s ease-in-out infinite alternate -5s;
}

.glow-blob--amber {
  background: radial-gradient(circle, var(--glow-opacity-amber) 0%, transparent 70%);
  top: 40%;
  left: 30%;
  width: min(400px, 70vw);
  height: min(400px, 70vw);
  filter: blur(90px);
  animation: float-slow-3 22s ease-in-out infinite alternate -10s;
}

@keyframes float-slow-1 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(40px, 30px) scale(1.1);
  }
}

@keyframes float-slow-2 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-30px, -40px) scale(1.05);
  }
}

@keyframes float-slow-3 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(20px, -30px) scale(1.15);
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-toggle-btn:hover {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn__icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: transform var(--transition-normal);
}

/* Light mode: show moon icon (click to switch to dark) */
[data-theme="light"] .theme-toggle-btn__icon {
  -webkit-mask-image: url('/icons/moon.svg');
  mask-image: url('/icons/moon.svg');
}

/* Dark mode: show sun icon (click to switch to light) */
[data-theme="dark"] .theme-toggle-btn__icon {
  -webkit-mask-image: url('/icons/sun.svg');
  mask-image: url('/icons/sun.svg');
}