/* =========================================================
   base.css — CodingDEV.RU
   Переменные тем, сброс, контейнер, кнопки, .reveal
   ========================================================= */

/* ============ СВЕТЛАЯ ТЕМА ============ */
:root, [data-theme="light"] {
  --bg: #F7F8FA;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F3F7;
  --surface-3: #E8EBF0;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-2: rgba(255, 255, 255, 0.5);

  --border: #E4E7EC;
  --border-2: #D0D5DD;

  --text: #0F172A;
  --text-2: #344054;
  --muted: #667085;
  --muted-2: #98A2B3;

  --accent: #1E40AF;
  --accent-2: #3B82F6;
  --accent-soft: rgba(59, 130, 246, 0.08);
  --accent-border: rgba(59, 130, 246, 0.15);

  --green: #10B981;
  --green-soft: #D1FAE5;
  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, 0.1);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.1);
  --purple: #8B5CF6;
  --cyan: #06B6D4;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, 0.18);

  --header-bg: rgba(255, 255, 255, 0.75);
  --header-bg-scrolled: rgba(255, 255, 255, 0.95);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  --container-max: 1200px;
  --container-pad: 24px;
  --header-height: 64px;

  color-scheme: light;
}

/* ============ ТЁМНАЯ ТЕМА ============ */
[data-theme="dark"] {
  --bg: #0B0D12;
  --bg-2: #101319;
  --surface: #161A22;
  --surface-2: #1F232C;
  --surface-3: #262B36;
  --surface-glass: rgba(20, 26, 42, 0.6);
  --surface-glass-2: rgba(20, 26, 42, 0.4);

  --border: #262B36;
  --border-2: #363D4A;

  --text: #F1F3F7;
  --text-2: #C7CCD6;
  --muted: #8A93A2;
  --muted-2: #5E6675;

  --accent: #60A5FA;
  --accent-2: #60A5FA;
  --accent-soft: rgba(96, 165, 250, 0.1);
  --accent-border: rgba(96, 165, 250, 0.25);

  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #F87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --purple: #A78BFA;
  --cyan: #22D3EE;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.7);

  --header-bg: rgba(11, 15, 26, 0.75);
  --header-bg-scrolled: rgba(11, 15, 26, 0.95);

  color-scheme: dark;
}

/* ============ СБРОС ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ ПЛАВНАЯ СМЕНА ТЕМЫ ============ */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition:
          background-color 0.4s ease,
          border-color 0.4s ease,
          color 0.3s ease,
          fill 0.3s ease !important;
}

/* ============ КОНТЕЙНЕР ============ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  position: relative;
}

/* ============ КНОПКИ ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn .arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translateX(2px); }

/* ============ REVEAL ============ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
  transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
  animation: forceReveal 0.01s 2.5s forwards;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
  animation: none;
}
@keyframes forceReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ============ АНИМАЦИИ ============ */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.05); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ СКРОЛЛБАР ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::selection { background: rgba(59, 130, 246, 0.2); color: var(--text); }

/* ============ ДОСТУПНОСТЬ ============ */
*:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ============ АДАПТИВ КОНТЕЙНЕРА ============ */
@media (max-width: 1100px) {
  :root { --container-max: 100%; --container-pad: 20px; }
}
@media (max-width: 900px) {
  :root { --container-pad: 18px; --header-height: 60px; }
}
@media (max-width: 720px) {
  :root { --container-pad: 16px; --header-height: 58px; }
}
@media (max-width: 480px) {
  :root { --container-pad: 14px; }
}
@media (max-width: 360px) {
  :root { --container-pad: 12px; }
}