/* ============================================================
   PAIRAVI BOOK HOUSE — Base (reset + element defaults + layout)
   ============================================================ */

/* ---- Large-screen & TV scaling ----
   Type & spacing are rem-based, so nudging the root font-size scales the whole
   UI proportionally for big monitors and television browsers, while the
   container widens so content fills the space without becoming a thin column. */
@media (min-width: 1700px) { :root { --container: 1340px; --container-wide: 1560px; } }
@media (min-width: 2200px) { html { font-size: 18px; } :root { --container: 1560px; --container-wide: 1840px; } }
@media (min-width: 2800px) { html { font-size: 21px; } :root { --container: 1820px; --container-wide: 2200px; } }

/* ---- Modern reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
  font-feature-settings: "kern", "liga";
  /* theme transition */
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

img, picture, video { display: block; max-width: 100%; height: auto; }
/* SVGs are icons by default — never let them balloon to intrinsic size.
   Component rules (.btn svg, .icon-btn svg, etc.) override this. */
svg { display: block; flex: none; width: 1.2em; height: 1.2em; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--color-link); text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---- Typography defaults ---- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.012em; color: var(--color-text); }
h4, h5, h6 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-snug); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p { max-width: var(--measure); }
strong, b { font-weight: 600; }
cite, em, i { font-style: italic; }
small { font-size: var(--fs-caption); }

::selection { background: var(--color-accent-tint); color: var(--color-text); }

/* ---- Focus visibility (a11y) ---- */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px;
  background: var(--color-primary); color: var(--color-on-primary);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-md);
  z-index: var(--z-toast); font-family: var(--font-ui); font-weight: 600;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); }

/* ---- Bilingual: Devanagari face swap when lang=ne ---- */
:lang(ne), [lang="ne"] {
  --font-display: "Noto Serif Devanagari", Georgia, serif;
  --font-body: "Noto Serif Devanagari", Georgia, serif;
  --font-ui: "Mukta", system-ui, sans-serif;
  line-height: var(--lh-loose);
}

/* ============================================================
   Layout utilities
   ============================================================ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: clamp(var(--space-7), 5vw, var(--space-9)); }
.section--tight { padding-block: var(--space-7); }
.section--alt { background: var(--color-surface-alt); }
.section--sunk { background: var(--color-surface-sunk); }

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }

.grid { display: grid; gap: var(--space-5); }
.flow-grid { display: grid; gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }

/* Visually hidden but screen-reader available */
.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;
}

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.measure { max-width: var(--measure); }
.no-scroll { overflow: hidden; }

/* ---- Eyebrow / kicker ---- */
.eyebrow {
  font-family: var(--font-ui); font-size: var(--fs-caption);
  text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600;
  color: var(--color-accent-strong); display: inline-flex; align-items: center; gap: var(--space-2);
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.6; }

/* ---- Section header ---- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-6); flex-wrap: wrap; }
.section-head h2 { max-width: 18ch; }
.section-head .link-more { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-ui); color: var(--color-primary); display: inline-flex; align-items: center; gap: var(--space-2); }
.section-head .link-more svg { transition: transform var(--dur-fast) var(--ease-out); }
.section-head .link-more:hover svg { transform: translateX(4px); }

/* ---- Fleuron divider ---- */
.divider-fleuron { display: flex; align-items: center; justify-content: center; gap: var(--space-4); color: var(--color-text-muted); margin-block: var(--space-7); }
.divider-fleuron::before, .divider-fleuron::after { content: ""; height: 1px; flex: 1; max-width: 120px; background: var(--color-border-strong); }

/* ============================================================
   Scroll-reveal (progressive enhancement)
   Elements get [data-reveal]; JS adds .is-visible.
   ============================================================ */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: 80ms; }
[data-reveal-delay="2"] { transition-delay: 160ms; }
[data-reveal-delay="3"] { transition-delay: 240ms; }
[data-reveal-delay="4"] { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* prevent transition flash on theme load */
.preload * { transition: none !important; }
