/* BuyCoded — base.css : LOCKED dark design system + reset + typography.
   Single source of truth. Legacy --color-* / --navy-* / --blue-* names are
   retained as aliases pointing at the new dark palette so existing class names
   auto-restyle without rewriting every selector. */

:root {
  /* ============================================================
     === LOCKED DARK PALETTE (do not extend without explicit decision) ===
     ============================================================ */

  /* Surfaces (deepest → most-elevated) */
  --bg:#0b0f1a;
  --surface:#0f1629;
  --surface-2:#141d33;
  --surface-3:#1b2643;

  /* Borders */
  --border:#232e4a;
  --border-subtle:#1a2236;
  --border-strong:#2c3a5e;

  /* Text (WCAG AA on --bg / --surface) */
  --text:#e8edf7;
  --text-soft:#aab3c5;
  --text-muted:#6b7689;
  --text-inverse:#e8edf7; /* legacy alias for "light text" — kept for footer/dark-section rules */

  /* SINGLE accent */
  --accent:#4f8eff;
  --accent-hover:#6ba0ff;
  --accent-soft:rgba(79,142,255,.14);
  --accent-glow:rgba(79,142,255,.30);

  /* Semantic (sparing) */
  --success:#34d399;
  --warning:#fbbf24;
  --danger:#f87171;
  --info:#4f8eff;
  --star:#fbbf24;
  --verified:#34d399;
  --featured:#fbbf24;

  /* Radii */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:20px; --r-full:999px;

  /* Shadows (tuned for dark) */
  --sh-sm:0 1px 2px rgba(0,0,0,.40);
  --sh-md:0 8px 24px rgba(0,0,0,.45);
  --sh-lg:0 20px 50px rgba(0,0,0,.55);
  --sh-blue:0 8px 24px rgba(79,142,255,.30);
  --sh-glow:0 0 0 1px var(--border), 0 8px 30px rgba(79,142,255,.18);

  /* Spacing (base-8) */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:24px;
  --s-6:32px; --s-8:48px; --s-10:64px; --s-12:96px;

  /* Type */
  --font:'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --fs-xs:.75rem; --fs-sm:.875rem; --fs-base:1rem; --fs-lg:1.125rem;
  --fs-xl:1.375rem; --fs-2xl:1.75rem; --fs-3xl:2.25rem; --fs-4xl:3rem;
  --lh-tight:1.2; --lh-normal:1.55; --lh-relaxed:1.75;
  --maxw:1240px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* ============================================================
     === Legacy aliases (existing class names use these — remapped) ===
     ============================================================ */

  /* Old navy chrome scale → dark surfaces */
  --navy-900: var(--surface);     /* was #0f1629; header/footer/hero bg */
  --navy-800: var(--surface-2);
  --navy-700: var(--surface-3);
  --navy-600: var(--border-strong);

  /* Old blue scale → accent + tints */
  --blue-600: var(--accent-hover);
  --blue-500: var(--accent);
  --blue-400: #7aa9ff;
  --blue-100: var(--accent-soft);
  --blue-50:  rgba(79,142,255,.08);

  /* Old --color-* utility names */
  --color-brand:        var(--accent);
  --color-brand-dark:   var(--accent-hover);
  --color-brand-soft:   var(--accent-soft);
  --color-brand-tint:   rgba(79,142,255,.20);
  --color-ink:          var(--text);
  --color-text:         var(--text-soft);
  --color-muted:        var(--text-muted);
  --color-line:         var(--border);
  --color-bg:           var(--surface);
  --color-bg-soft:      var(--surface-2);
  --color-success:      var(--success);
  --color-danger:       var(--danger);

  /* Spacing aliases */
  --space-xxs: var(--s-1);
  --space-xs:  var(--s-2);
  --space-sm:  var(--s-3);
  --space-md:  var(--s-4);
  --space-lg:  var(--s-5);
  --space-xl:  var(--s-6);
  --space-2xl: var(--s-8);
  --space-3xl: var(--s-10);

  /* Radius aliases */
  --radius-sm:   var(--r-sm);
  --radius-md:   var(--r-md);
  --radius-lg:   var(--r-lg);
  --radius-xl:   var(--r-xl);
  --radius-pill: var(--r-full);

  /* Shadow aliases */
  --shadow-sm: var(--sh-sm);
  --shadow-md: var(--sh-md);
  --shadow-lg: var(--sh-lg);

  --font-sans: var(--font);
  --container-max: var(--maxw);
}

/* === Global reset === */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; scroll-behavior: smooth; background: var(--bg); }

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Default link = accent. Inline links get an underline; nav/CTA links rely on their button class. */
a { color: var(--accent); text-decoration: none; transition: color 160ms var(--ease); }
a:hover { color: var(--accent-hover); }
p a, .prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
p a:hover, .prose a:hover { text-decoration-thickness: 2px; }

/* Headings — near-white on dark, body weight */
h1, h2, h3, h4, h5 {
  font-family: var(--font);
  color: var(--text);
  margin: 0 0 0.5em;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  font-weight: 700;
}
h1 { font-size: clamp(2rem, 4.2vw, var(--fs-4xl)); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 2.8vw, var(--fs-2xl)); letter-spacing: -0.016em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-base); }

p { margin: 0 0 1em; color: var(--text-soft); }

strong { font-weight: 600; color: var(--text); }
small { font-size: var(--fs-sm); color: var(--text-muted); }

ul, ol { padding-left: 1.2em; margin: 0 0 1em; color: var(--text-soft); }
li { margin-bottom: 4px; }

code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
code {
  background: var(--surface-2);
  color: var(--text);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
}
pre {
  background: var(--surface-2);
  color: var(--text);
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}
pre code { background: transparent; padding: 0; border: 0; }

button { font-family: inherit; }

/* === Layout helpers === */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--s-5);
}
@media (min-width: 768px) { .container { padding-inline: var(--s-6); } }

.narrow { max-width: 760px; margin-inline: auto; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.lead {
  font-size: var(--fs-lg);
  color: var(--text-soft);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--s-5);
}

.section { padding-block: var(--s-10); }
@media (max-width: 768px) { .section { padding-block: var(--s-8); } }
.section-pad-top-0 { padding-top: 0; }

/* === Skip link === */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  z-index: 1000;
  border-radius: 0 0 var(--r-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* === Selection + focus === */
::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 3px solid rgba(79,142,255,.55);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* === Scrollbar (subtle dark) === */
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

/* === Reveal-on-scroll progressive enhancement === */
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 420ms var(--ease), transform 420ms var(--ease);
}
[data-reveal].is-revealed { opacity: 1; transform: none; }

/* === Skeleton shimmer === */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Prose (rendered long_description container) === */
.prose {
  color: var(--text-soft);
  line-height: var(--lh-relaxed);
  font-size: var(--fs-base);
}
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3, .prose h4 {
  color: var(--text);
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}
.prose h3 { font-size: var(--fs-lg); }
.prose h4 { font-size: var(--fs-base); }
.prose p { color: var(--text-soft); margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; color: var(--text-soft); }
.prose ul li, .prose ol li { margin: 4px 0; line-height: var(--lh-relaxed); }
.prose strong { color: var(--text); }
.prose em { color: var(--text); font-style: italic; }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.prose a:hover { color: var(--accent-hover); }
.prose code {
  background: var(--surface-2);
  color: var(--text);
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  font-size: .9em;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4);
  overflow-x: auto;
}
.prose blockquote {
  margin: 1em 0;
  padding: var(--s-3) var(--s-5);
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  background: var(--surface-2);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
