/* ============================================================
   Base — reset, typography, utilities
   ============================================================ */

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

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

body {
  background-color: var(--bg);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a      { color: inherit; text-decoration: none; }
img    { max-width: 100%; display: block; }
ul     { list-style: none; }
button { cursor: pointer; }

input, select, textarea, button { font-family: inherit; font-size: inherit; }

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

/* ── Container ───────────────────────────────────────────────── */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Typography scale ────────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7.5vw, 5.8rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--txt);
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--txt);
}

h3 {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--txt);
}

h4 { font-size: 0.95rem; font-weight: 600; color: var(--txt); }

p { color: var(--txt-2); line-height: 1.8; }

/* ── Gradient text ───────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(130deg, var(--accent-light) 0%, var(--accent) 60%, var(--accent-deep) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Section label (mono dot + uppercase) ────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--txt-3);
}

.section-label::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Fade-in animation (scroll-triggered via IntersectionObserver) ── */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Code syntax highlight spans ────────────────────────────── */
.ck { color: var(--accent); }           /* keyword   — amber      */
.ci { color: var(--txt); }              /* identifier — white/dark */
.co { color: var(--txt-3); }            /* operator   — muted      */
.cs { color: #4ade80; }                 /* string     — green      */
.cm { color: var(--txt-3); opacity:.7; }/* comment    — dim muted  */
.cf { color: #60a5fa; }                 /* function   — blue-400   */

/* Light theme — darker variants for readability on pale bg */
[data-theme="light"] .cs { color: #16a34a; }
[data-theme="light"] .cf { color: #2563eb; }
[data-theme="light"] .cm { opacity: 0.9; }

/* ── Hero entrance animation (CSS, fires on page load) ──────── */
.hero-reveal {
  opacity: 0;
  transform: translateY(22px);
  animation: heroReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* Slides in from the right — for the code card */
.hero-reveal-right {
  opacity: 0;
  transform: translateX(36px);
  animation: heroRevealRight 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.35s;
}

@keyframes heroRevealRight {
  to { opacity: 1; transform: translateX(0); }
}

.delay-0 { animation-delay: 0s; }
.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.24s; }
.delay-3 { animation-delay: 0.38s; }
.delay-4 { animation-delay: 0.52s; }
.delay-5 { animation-delay: 0.68s; }
.delay-6 { animation-delay: 0.84s; }

/* ── Pulse dot (available indicator) ────────────────────────── */
.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.4s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
