/* ──────────────────────────────────────────────────────────
   Swift Grid — Base Styles
   Shared across both themes. Loaded after Tailwind. Contains:
   · Self-hosted @font-face rules
   · Global reset nudges / focus ring / selection
   · Scrollbar styling
   · Shared animations (sg-reveal, pulse-dot)
   · prefers-reduced-motion guards
   ────────────────────────────────────────────────────────── */

/* ─── Fonts (self-hosted, font-display: swap) ─── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/Inter-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Inter-Italic.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/JetBrainsMono-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/JetBrainsMono-SemiBold.woff2') format('woff2');
}

/* ─── Document defaults ─── */
html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sg-font-sans);
  background-color: var(--sg-dark);
  color: var(--sg-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--sg-selection, rgba(119, 106, 248, 0.40));
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Scrollbar ─── */
*::-webkit-scrollbar        { width: 10px; height: 10px; }
*::-webkit-scrollbar-track  { background: var(--sg-dark); }
*::-webkit-scrollbar-thumb  { background: #2a3a4a; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #38495a; }

/* ─── Reveal-on-scroll (shared) ─── */
.sg-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--sg-dur-slow) ease, transform var(--sg-dur-slow) ease;
}
.sg-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ─── Slider (shared; high specificity so Tailwind .grid can't override) ─── */
[data-sg-slider] > .sg-slide            { display: none; }
[data-sg-slider] > .sg-slide.is-active  { display: block; }

/* ─── Pulse dot (shared indicator) ─── */
@keyframes sg-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0   rgba(var(--sg-accent-rgb) / 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(var(--sg-accent-rgb) / 0);   }
}
.pulse-dot { animation: sg-pulse-dot 2s ease-in-out infinite; }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .sg-reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ─── Theme toggle (header + footer mirror) ─── */
.sg-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sg-border);
  font-family: var(--sg-font-mono);
  font-size: 11px;
  line-height: 1;
}
.sg-theme-toggle__btn {
  appearance: none;
  background: transparent;
  color: var(--sg-text-muted);
  border: 0;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--sg-dur-fast) ease, background-color var(--sg-dur-fast) ease;
  letter-spacing: 0.02em;
}
.sg-theme-toggle__btn:hover { color: var(--sg-text); }
.sg-theme-toggle__btn[aria-pressed="true"] {
  color: #fff;
  background: var(--sg-accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}
[data-theme="back"] .sg-theme-toggle__btn[aria-pressed="true"] {
  background: var(--sg-green);
  color: #0B1218;
}
