/* Reset + element defaults for /app/ */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 650; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4, h5, h6 { font-size: var(--text-base); }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

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

img, video { max-width: 100%; height: auto; }

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

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

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }

input, textarea, select { font: inherit; color: var(--text); }

/* iOS WebKit auto-zooms into any form field with a font-size under 16px and
   often fails to zoom back out on blur, leaving the page zoomed/cropped
   (header stuck under the URL bar). --text-base is ~15.3px, so on phone-size
   screens keep every field at 16px and the zoom never triggers. */
@media (max-width: 1023px) {
  input, textarea, select { font-size: 16px; }
}

textarea { resize: none; }

::placeholder { color: var(--text-faint); opacity: 1; }

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

/* subtle themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
*::-webkit-scrollbar-track { background: transparent; }

mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 2px; }

/* The hidden attribute must always win, even over display:flex/grid rules */
[hidden] { display: none !important; }

/* utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.small { font-size: var(--text-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
