/* =========================================================================
   base.css — reset, typography, body, scrollbar, utilities
   Depends on: tokens.css
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-body);
  background-color: var(--page-bg);
  background-image: var(--aurora-bg);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

/* -------------------------------- Typography ---------------------------- */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  color: var(--text-primary);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); font-weight: 600; }
h6 { font-size: var(--text-md); font-weight: 600; }

p {
  margin: 0 0 1em;
  line-height: var(--leading-normal);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

p:last-child { margin-bottom: 0; }

a {
  color: var(--primary-hover);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--primary-deep);
}

strong, b {
  color: var(--text-primary);
  font-weight: 600;
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

ul, ol {
  margin: 0 0 1em;
  padding-left: 1.2em;
  line-height: var(--leading-normal);
}

li { margin-bottom: 0.3em; }

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

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

/* -------------------------------- Focus --------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* -------------------------------- Scrollbar ----------------------------- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--storm);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* -------------------------------- Selection ----------------------------- */

::selection {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

/* -------------------------------- Utilities ----------------------------- */

.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;
}

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

.text-muted  { color: var(--text-muted); }
.text-faint  { color: var(--text-faint); }
.text-body   { color: var(--text-body); }
.text-primary{ color: var(--text-primary); }
.text-invert { color: var(--text-invert); }

.text-grad {
  background: var(--text-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.font-normal { font-weight: 400; }
.font-med    { font-weight: 500; }
.font-semi   { font-weight: 600; }
.font-bold   { font-weight: 700; }

.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); }

.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-40 { margin-bottom: 40px; }
.mb-48 { margin-bottom: 48px; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }

.hidden        { display: none !important; }
.show-on-mobile{ display: none; }
.hide-on-mobile{ display: initial; }

@media (max-width: 899px) {
  .show-on-mobile { display: initial; }
  .hide-on-mobile { display: none !important; }
}

/* Skip to content link for keyboard users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: var(--z-modal);
  padding: 10px 16px;
  background: var(--primary-deep);
  color: var(--white);
  border-radius: var(--r-btn);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: 16px;
  color: var(--white);
}

/* Reveal animation utility (paired with reveal.js) */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
