/* ==========================================================================
   Base — Reset, Typography, Layout, Buttons, Utilities
   ========================================================================== */

/* ── Reset ────────────────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: normal;
  color: var(--foreground);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Subtle paper texture overlay ──────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ── Ambient gold glow ─────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 134, 11, 0.02) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

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

img {
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--foreground);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background-color: rgba(184, 134, 11, 0.12);
  color: var(--foreground);
}

/* ── Typography ──────────────────────────────────────────────────────── */

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }

.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ── Layout ──────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

@media (max-width: 480px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

main {
  min-height: 100vh;
}

/* ── Sections ────────────────────────────────────────────────────────── */

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
  position: relative;
}

.section--lg {
  padding-top: var(--space-32);
  padding-bottom: var(--space-32);
}

.section--surface {
  background-color: var(--bg-surface);
}

.section--secondary {
  background-color: var(--bg-secondary);
}

.section__label {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-4);
  display: inline-block;
}

.section__title {
  font-size: var(--text-display);
  font-weight: 500;
  margin-bottom: var(--space-4);
  max-width: 22ch;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-16);
}

/* ── Grid System ─────────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid--4,
  .grid--3,
  .grid--2 { grid-template-columns: 1fr; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  height: 44px;
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--duration) var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

@media (max-width: 640px) {
  .btn {
    white-space: normal;
    text-align: center;
    max-width: 100%;
    line-height: 1.3;
    height: auto;
    min-height: 44px;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
}

/* Primary — Blue filled */
.btn--primary {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 16px var(--accent-glow);
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

/* Secondary — Outlined */
.btn--secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background-color: var(--accent-muted);
}

/* Ghost — No border */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 0 var(--space-4);
}

.btn--ghost:hover {
  color: var(--accent-hover);
  background-color: var(--accent-subtle);
}

/* Size variants */
.btn--sm {
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  height: 52px;
  padding: 0 var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* Button with arrow */
.btn .btn-arrow {
  transition: transform var(--duration-base) var(--ease-out);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ── Links ───────────────────────────────────────────────────────────── */

.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-border);
  transition: color var(--duration-fast) var(--ease-out),
              text-decoration-color var(--duration-fast) var(--ease-out);
}

.link:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* ── Badges ──────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  border: 1px solid;
}

.badge--assess {
  color: var(--cat-assess);
  background-color: var(--cat-assess-muted);
  border-color: rgba(124, 92, 183, 0.20);
}

.badge--build {
  color: var(--cat-build);
  background-color: var(--cat-build-muted);
  border-color: rgba(184, 134, 11, 0.20);
}

.badge--operate {
  color: var(--cat-operate);
  background-color: var(--cat-operate-muted);
  border-color: rgba(45, 106, 79, 0.20);
}

/* ── Dividers ────────────────────────────────────────────────────────── */

.divider {
  border: none;
  height: 1px;
  background-color: var(--border);
}

/* ── Scroll Reveal ───────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out),
              transform 0.6s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── Utility ─────────────────────────────────────────────────────────── */

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

.text-center { text-align: center; }
.text-left { text-align: left; }

.mx-auto { margin-left: auto; margin-right: auto; }

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }

  .section--lg {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }

  .section__title {
    font-size: var(--text-3xl);
  }

  .section__subtitle {
    font-size: var(--text-base);
  }

  .btn {
    height: 48px;
  }

  .btn--lg {
    height: 52px;
    width: 100%;
  }
}
