/* ============================================================
   base.css — Modern reset + base element styling
   ============================================================ */

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

* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  /* App feel: no browser pull-to-refresh / scroll chaining in standalone */
  overscroll-behavior-y: none;
}

/* App feel: don't let chrome (nav/buttons) be text-selected or long-press-callout. */
.sidebar, .topbar, .bottomnav, .btn, .icon-btn, .nav-item, .chip, .tab { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

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

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { line-height: var(--lh-tight); font-weight: var(--fw-bold); color: var(--text); }
h1 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { line-height: var(--lh-relaxed); }

ul, ol { padding-left: 1.25rem; }
li { line-height: var(--lh-relaxed); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.85em; }

hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

/* Accessible focus — visible only for keyboard users */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Selection */
::selection { background: var(--c-accent-200); color: var(--c-slate-900); }
[data-theme="dark"] ::selection { background: var(--c-accent-700); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--c-slate-400); background-clip: content-box; }

/* Screen-reader only */
.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 */
.skip-link {
  position: absolute; left: var(--sp-4); top: -60px; z-index: var(--z-toast);
  background: var(--accent); color: #fff; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md); transition: top var(--t-base);
}
.skip-link:focus { top: var(--sp-4); text-decoration: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
