/* ═══════════════════════════════════════════════════════════════════════════
   base.css — Personica base styles
   Imports tokens.css. Sets up reset, typography, global utilities.
   ═══════════════════════════════════════════════════════════════════════════ */

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

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light dark;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background-color: var(--clr-bg);
  color:            var(--clr-text);
  font-family:      var(--font-body);
  font-size:        var(--text-base);
  line-height:      var(--leading-base);
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--dur-slow) var(--ease-out),
              color            var(--dur-slow) var(--ease-out);
}

main {
  flex: 1;
}

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

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

button { cursor: pointer; }

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

a {
  color: var(--clr-accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

a:hover { opacity: 0.8; }

a:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

ul, ol { list-style: none; }

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

h1, h2, h3, h4, h5, h6 {
  font-family:  var(--font-display);
  font-weight:  800;
  line-height:  var(--leading-tight);
  color:        var(--clr-text);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl)); }
h2 { font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl)); }
h3 { font-size: clamp(var(--text-xl),  2.5vw, var(--text-2xl)); }
h4 { font-size: var(--text-xl);  font-weight: 700; }
h5 { font-size: var(--text-lg);  font-weight: 600; }
h6 { font-size: var(--text-base);font-weight: 600; }

p {
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}

p + p { margin-top: var(--sp-4); }

strong { font-weight: 600; color: var(--clr-text); }

em { font-style: italic; }

code, kbd {
  font-family: var(--font-mono);
  font-size:   0.875em;
  background:  var(--clr-surface-2);
  border:      1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding:     0.1em 0.35em;
}

/* ── Selection ───────────────────────────────────────────────────────────── */

::selection {
  background: color-mix(in srgb, var(--clr-accent) 20%, transparent);
  color:      var(--clr-text);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background:    var(--clr-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-muted); }

/* ── Focus ───────────────────────────────────────────────────────────────── */

:focus-visible {
  outline:        2px solid var(--clr-accent);
  outline-offset: 3px;
}

/* ── Global 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;
}

.skip-link {
  position:   absolute;
  top:        var(--sp-3);
  left:       var(--sp-3);
  z-index:    var(--z-toast);
  padding:    var(--sp-2) var(--sp-4);
  background: var(--clr-text);
  color:      var(--clr-bg);
  font:       600 var(--text-sm)/1 var(--font-body);
  border-radius: var(--radius-md);
  transform:  translateY(-120%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.container {
  max-width:     var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--section-py);
}

.section--alt {
  background: var(--clr-surface);
}

/* ── Theme transition ────────────────────────────────────────────────────── */
/* Applied by theme.js when switching themes to avoid flash */
.theme-transitioning * {
  transition: background-color var(--dur-slow) var(--ease-out),
              border-color     var(--dur-slow) var(--ease-out),
              color            var(--dur-slow) var(--ease-out) !important;
}
