/* ============================================================================
   Buldhana District Forest — Base layer
   Reset, document defaults, native element styling, typographic primitives,
   accessibility utilities, layout helpers. Loads after tokens.css.
   ========================================================================== */

/* ---------- Modern reset -------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* JS accessibility control overrides this inline; default = 100% = 16px */
  font-size: 100%;
  tab-size: 4;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

:target { scroll-margin-top: 6rem; }

/* ---------- Typographic scale ------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); font-weight: var(--weight-semibold); }
h4 { font-size: var(--text-h4); font-weight: var(--weight-semibold); }

p, li, dd, dt, figcaption, blockquote {
  text-wrap: pretty;
}

a {
  text-decoration-thickness: max(1px, 0.06em);
  text-underline-offset: 0.18em;
}
/* Link colours are declared at ZERO specificity (:where) so every link
   COMPONENT — nav, buttons, cards, footer, breadcrumbs, sidebar — overrides
   them for ALL states, including :visited, without needing its own guard.
   Only unclassed content links (e.g. inside .prose, tables, alerts) actually
   pick these up. This is what stops visited nav links going purple. */
:where(a:link) { color: var(--color-link); }
:where(a:visited) { color: var(--color-link-visited); }
:where(a:hover) { color: var(--color-link-hover); }

/* Belt-and-braces: force every link component back to its own colour for the
   :visited state too, in case a stale cached stylesheet is still in play. */
.bf-topbar a:visited,
.bf-nav__link:visited,
.bf-footer a:visited,
.card__title a:visited,
.notice__title a:visited,
.side-nav a:visited,
.quicklink:visited,
.data-table a:visited,
.admin-sidebar__nav a:visited,
.admin-sidebar__foot a:visited { color: inherit; }
.btn:visited { color: var(--btn-fg); }
.link-arrow:visited,
.breadcrumb a:visited,
.pagination a:visited { color: var(--color-link); }

strong, b { font-weight: var(--weight-semibold); }

small { font-size: var(--text-small); }

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

hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ---------- Focus — one visible, consistent ring everywhere ------------ */

:focus { outline: none; }              /* suppress UA default …            */

:focus-visible {                        /* … reinstate only for keyboard    */
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
  box-shadow: 0 0 0 calc(var(--focus-ring-width) + 2px) var(--color-focus-ink);
}

/* Elements on dark brand surfaces keep the yellow ring but drop the dark halo */
.on-brand :focus-visible,
.bf-topbar :focus-visible,
.bf-footer :focus-visible {
  box-shadow: 0 0 0 1px var(--color-focus-ink);
}

/* ---------- Accessibility utilities ----------------------------------- */

.visually-hidden {
  position: absolute !important;
  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 {
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  z-index: var(--z-skiplink);
  transform: translateY(-160%);
  background: var(--color-focus);
  color: var(--color-focus-ink);
  font-weight: var(--weight-bold);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* Respect users who reduce motion — disable transitions/animations broadly */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Layout primitives ---------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: 820px; }

.section {
  padding-block: var(--section-gap);
}
.section--sunken { background: var(--color-surface-sunken); }
.section--brand {
  background: var(--color-surface-brand);
  color: var(--color-text-on-brand);
}
.section--tight { padding-block: var(--space-8); }

.stack > * + * { margin-top: var(--flow, var(--space-4)); }
.stack--lg { --flow: var(--space-6); }
.stack--sm { --flow: var(--space-2); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, var(--space-3));
  align-items: var(--cluster-align, center);
}

.grid {
  display: grid;
  gap: var(--grid-gap, var(--space-5));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-7); }
.prose h3 { margin-top: var(--space-6); }
.prose ul, .prose ol { padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose blockquote {
  border-left: 4px solid var(--color-accent);
  padding: var(--space-2) 0 var(--space-2) var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-body-lg);
  color: var(--color-text-muted);
}
.prose--serif { font-family: var(--font-serif); }

/* ---------- Text helpers ------------------------------------------- */

.overline {
  display: inline-block;
  font-size: var(--text-overline);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-overline);
  text-transform: uppercase;
  color: var(--color-action);
}
.text-muted { color: var(--color-text-muted); }
.text-small { font-size: var(--text-small); }
.text-caption { font-size: var(--text-caption); color: var(--color-text-subtle); }
.lead {
  font-size: var(--text-body-lg);
  line-height: var(--leading-loose);
  color: var(--color-text-muted);
}

/* ---------- Section heading pattern ------------------------------- */

.section-head {
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}
.section-head h2 { margin-top: var(--space-1); }
.section-head p { margin-top: var(--space-2); color: var(--color-text-muted); }

/* Decorative leaf rule under section headings (subtle, not decorative-heavy) */
.rule-accent {
  width: 3rem;
  height: 3px;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
}
