/* =============================================================================
   KilusNa — BASE THEME
   reset · typography · focus · selection · scrollbars · reduced-motion
   ============================================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  /* guards against any stray element forcing a horizontal page scrollbar */
  overflow-x: clip;
}

body {
  min-height: 100vh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
}

img,
svg,
video { display: block; max-width: 100%; }

svg { flex-shrink: 0; }

input,
button,
textarea,
select { font: inherit; color: inherit; }

button { background: none; border: none; cursor: pointer; }

a { color: var(--accent-text); text-decoration: none; }

ul,
ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: var(--fs-h2); line-height: 1.25; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-title); line-height: 1.4; }
h4 { font-size: var(--fs-h4); }

p { text-wrap: pretty; }

hr {
  border: none;
  border-top: 1px solid var(--border);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ----- Placeholders ------------------------------------------------------- */
::placeholder {
  color: var(--faint);
  opacity: 1;
}

/* ----- Focus --------------------------------------------------------------
   Buttons/links get a visible 2px --accent-text outline + offset (bronze in
   light, gold in dark — 5.93:1 / 12.06:1 on --card); form controls swap their
   border to --accent-text and take the --ring halo, both ≥3:1 on every surface
   they sit on. A gold outline/halo is invisible on a light page (1.55:1), so
   gold never carries focus in light. */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent-text);
  box-shadow: var(--ring);
}

/* ----- Screen-reader utility --------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ----- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  z-index: 300;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-btn);
  font-size: var(--fs-sm);
  font-weight: 600;
  transform: translateY(-150%);
  transition: transform .15s ease;
}

.skip-link:focus-visible {
  transform: none;
  outline-offset: 3px;
}

/* ----- Scrollbars (thin, themed, used by nav/drawer/modal scrollers) ------ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--faint);
  border: 2px solid var(--bg);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ----- Motion ------------------------------------------------------------- */
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
