/* =============================================================
   Base — Reset + Global Defaults
   Depends on: tokens.css (must be imported first)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Marcellus&family=Marcellus+SC&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ---- Box model reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Hidden attribute — !important beats any display class ---- */
[hidden] { display: none !important; }

/* ---- HTML ---- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  color-scheme: light;
}

/* ---- Body ---- */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--border2) var(--surface); }

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

/* ---- Selection ---- */
::selection {
  background-color: var(--accent-dim);
  color: var(--brand);
}

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

img { object-fit: cover; }

/* ---- Links ---- */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--accent); }

/* ---- Headings ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* ---- Paragraphs ---- */
p {
  color: var(--text2);
  line-height: var(--leading-relaxed);
  max-width: 65ch;
}

/* ---- Lists ---- */
ul, ol { list-style: none; }

/* ---- Horizontal Rule ---- */
hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* ---- Forms — base reset ---- */
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

button { cursor: pointer; }

textarea { resize: vertical; }

/* ---- Code ---- */
code, pre, kbd {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

pre {
  overflow-x: auto;
  padding: var(--space-4);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---- Table ---- */
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

/* ---- Utility: visually-hidden (for screen readers) ---- */
.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;
}

/* ---- Utility: container ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
