/* =====================================================
   base.css — Payniva Design System
   Variables, Reset, Typography, Layout Utilities
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ============ DESIGN TOKENS ============ */
:root {
  --navy:         #0A1628;
  --obsidian:     #06090F;
  --warm-white:   #F5F3EE;
  --amber:        #C9973A;
  --slate:        #3B4A60;
  --danger:       #C0392B;
  --border:       #1C2B40;
  --border-light: #263B57;
  --text-dim:     #8A9BBE;
  --green:        #2A9D5C;
  --blue:         #2D6BE4;

  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  --container-max:  1240px;
  --section-pad:    100px;
  --section-pad-sm: 60px;

  --transition:      0.22s ease;
  --transition-slow: 0.45s ease;
}

/* ============ RESET ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  text-size-adjust: 100%;
}

body {
  background-color: var(--navy);
  color: var(--warm-white);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.1;
  color: var(--warm-white);
}
h1 { font-size: clamp(2.25rem, 5vw, 4.25rem);  letter-spacing: -0.035em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.625rem); letter-spacing: -0.025em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.625rem);  letter-spacing: -0.015em; }
h4 { font-size: 1.125rem; letter-spacing: -0.01em; }
h5 { font-size: 0.9375rem; font-weight: 600; }

p {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.75;
}

a {
  color: var(--amber);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.75; }

strong { color: var(--warm-white); font-weight: 600; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--amber);
  background: rgba(201, 151, 58, 0.08);
  padding: 0.1em 0.4em;
  border: 1px solid rgba(201, 151, 58, 0.2);
}

/* ============ LAYOUT ============ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.container--narrow {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 2rem;
}

section { padding: var(--section-pad) 0; }
section.section--sm { padding: var(--section-pad-sm) 0; }

.bg-obsidian { background-color: var(--obsidian); }
.bg-navy     { background-color: var(--navy); }

.border-top    { border-top:    1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

/* ============ SECTION LABELS & HEADERS ============ */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1.5px;
  background: var(--amber);
  flex-shrink: 0;
}

.section-sub {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 580px;
  line-height: 1.75;
  margin-bottom: 3rem;
}

.section-header { margin-bottom: 3.5rem; }

.section-header--center { text-align: center; }
.section-header--center .section-label  { justify-content: center; }
.section-header--center .section-sub    { margin-left: auto; margin-right: auto; }

/* ============ DOT GRID BACKGROUND ============ */
.bg-dots {
  background-image: radial-gradient(circle, #1C2B40 1px, transparent 1px);
  background-size: 26px 26px;
}

/* ============ UTILITIES ============ */
.text-amber  { color: var(--amber) !important; }
.text-dim    { color: var(--text-dim) !important; }
.text-danger { color: var(--danger) !important; }
.text-green  { color: var(--green) !important; }
.text-white  { color: var(--warm-white) !important; }
.text-mono   { font-family: var(--font-mono); }

.d-flex          { display: flex; }
.align-center    { align-items: center; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap       { flex-wrap: wrap; }
.gap-sm  { gap: 0.75rem; }
.gap-md  { gap: 1.5rem; }
.gap-lg  { gap: 2.5rem; }

.mt-sm { margin-top: 0.75rem; }
.mt-md { margin-top: 1.5rem; }
.mt-lg { margin-top: 2.5rem; }
.mb-md { margin-bottom: 1.5rem; }
.mb-lg { margin-bottom: 2.5rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ============ LIGHT THEME OVERRIDES ============ */
[data-theme="light"] {
  --navy:         #EEF2F8;
  --obsidian:     #FFFFFF;
  --warm-white:   #0D1F3C;
  --border:       #D4DCE9;
  --border-light: #E4EAF3;
  --text-dim:     #4A5C78;
  --slate:        #6B7DA0;
}

[data-theme="light"] body {
  background-color: var(--navy);
  color: var(--warm-white);
}

[data-theme="light"] .bg-dots {
  background-image: radial-gradient(circle, #C8D4E5 1px, transparent 1px);
}

[data-theme="light"] code {
  background: rgba(201, 151, 58, 0.06);
}

/* ============ THEME TOGGLE BUTTON ============ */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--amber); }

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { pointer-events: none; }

[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"]  .theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }

@media (max-width: 768px) {
  :root { --section-pad: 64px; --section-pad-sm: 40px; }
  .container { padding: 0 1.25rem; }
}
