/* =============================================
   MANNA INSTITUTE — Base & Typography
   ============================================= */

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

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

html.font-large {
  font-size: 22px;
}

body {
  font-family: var(--font-ui);
  background: var(--color-bg-mesh);
  background-attachment: fixed;
  color: var(--color-ink);
  min-height: 100dvh;
  min-width: 320px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Focus rings ── */
:focus-visible {
  outline: 3px solid rgba(228, 167, 47, 0.55);
  outline-offset: 2px;
}

/* ── Typography scale ── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.1;
  color: var(--color-ink);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700; }

p { color: var(--color-stone); line-height: 1.7; }

a {
  color: var(--color-pine);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-leaf); }

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

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

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

textarea {
  resize: vertical;
  field-sizing: content;
}

sup {
  margin-right: 0.2em;
  color: var(--color-pine);
  font-family: var(--font-ui);
  font-size: 0.58em;
  font-weight: 800;
  vertical-align: super;
}

/* ── Utility: visually hidden ── */
.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;
}

/* ── Utility: truncate ── */
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ── Eyebrow label ── */
.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-leaf);
  margin-bottom: 4px;
}

.bible-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--color-ink);
  transition: font-size 0.2s ease, color 0.2s ease;
}

.bible-text sup {
  font-size: 0.58em;
  color: var(--color-pine);
  font-weight: 800;
}

/* ── Reader Themes ── */
body.theme-dark {
  --color-bg-mesh: #111111;
  --color-ink: #e5e7eb;
  --color-surface: rgba(255, 255, 255, 0.08);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-pine: #4ade80; /* Brighter for dark mode */
}

body.theme-sepia {
  --color-bg-mesh: #f4ecd8;
  --color-ink: #433422;
  --color-surface: rgba(255, 255, 255, 0.4);
  --color-border: rgba(67, 52, 34, 0.15);
}

body.font-sans .bible-text {
  font-family: var(--font-ui);
}

body.font-serif .bible-text {
  font-family: var(--font-heading);
}

/* ── Loading spinner ── */
.loading-screen {
  display: grid;
  place-items: center;
  min-height: 55vh;
  text-align: center;
  gap: var(--space-3);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(74, 148, 105, 0.2);
  border-top-color: var(--color-leaf);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-fade-in { animation: fade-in 0.3s ease both; }
.anim-scale-in { animation: scale-in 0.25s ease both; }

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