/* ============================================================
   The Bible API - Global Styles
   Bible/Catholic-inspired: elegant, serene, typographic
   ============================================================ */

:root {
  /* Colors - Light theme (parchment) */
  --color-bg: #faf8f3;
  --color-bg-elevated: #ffffff;
  --color-bg-alt: #f2ede1;
  --color-text: #2c2416;
  --color-text-muted: #6b5d48;
  --color-border: #e4dcc8;
  --color-primary: #8b6f47;
  --color-primary-hover: #705838;
  --color-accent: #c9a876;
  --color-code-bg: #f6f1e6;
  --color-code-text: #2c2416;

  /* Typography */
  --font-serif: "Cormorant Garamond", "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Monaco", monospace;

  /* Spacing & layout */
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(44, 36, 22, 0.06);
  --shadow-md: 0 4px 16px rgba(44, 36, 22, 0.08);
  --shadow-lg: 0 12px 40px rgba(44, 36, 22, 0.12);
  --max-width: 1180px;
  --header-height: 72px;
  --page-top-offset: calc(var(--header-height) + clamp(1.25rem, 3vw, 2.5rem));

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.5s;
}

/* Prevent flash/flicker of theme transition on initial page load */
html.theme-preload,
html.theme-preload *,
html.theme-preload *::before,
html.theme-preload *::after {
  transition: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}

[data-theme="dark"] {
  --color-bg: #1a1612;
  --color-bg-elevated: #231e18;
  --color-bg-alt: #221d16;
  --color-text: #f0ebe0;
  --color-text-muted: #a89c83;
  --color-border: #3a3226;
  --color-primary: #c9a876;
  --color-primary-hover: #d9bb87;
  --color-accent: #e0c489;
  --color-code-bg: #15110c;
  --color-code-text: #f0ebe0;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Prevent unintended horizontal scrolling across all pages.
     Using clip instead of hidden to avoid breaking position:sticky
     in descendant elements (overflow:hidden creates a scroll container
     that interferes with sticky positioning). */
  overflow-x: clip;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  /* Defensive: prevent any child overflow from causing page-level scroll.
     Using clip instead of hidden to preserve position:sticky behavior
     in descendants (overflow:hidden creates a scroll container that
     breaks sticky positioning). */
  overflow-x: clip;
  max-width: 100%;
}
img,
svg {
  max-width: 100%;
  display: block;
}
/* Defensive: prevent <pre>/<code> from breaking layout on any page */
pre,
code {
  max-width: 100%;
}
pre {
  overflow-x: auto;
}
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
}
h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}
h3 {
  font-size: 1.25rem;
  font-family: var(--font-sans);
  font-weight: 600;
}
p {
  margin: 0 0 1em;
}
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--color-code-text);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 1000;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 8px;
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Header & Nav ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
  /* position: fixed establishes a positioned context so absolutely-
     positioned children (e.g. .scroll-progress) anchor to header edges. */
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
  color: var(--color-primary-hover);
}
.brand-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}
.brand-text {
  color: var(--color-text);
}

.site-nav {
  display: flex;
  align-items: center;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  color: var(--color-text);
  border-radius: var(--radius);
  font-weight: 500;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.nav-list a:hover {
  background: var(--color-bg-alt);
  text-decoration: none;
  color: var(--color-primary);
}
.nav-list a[aria-current="page"] {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  color: var(--color-text);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.theme-toggle:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: transparent !important;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: transparent !important;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------- Hero ---------- */
/* Homepage hero must sit flush under the fixed navbar.
   `body.home main` supplies padding-top equal to --header-height,
   so .hero itself must NOT add an extra top margin.
   Only an internal breathing gap is applied via padding-top. */
.hero {
  position: relative;
  margin-top: 0;
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  overflow: hidden;
}
.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-primary);
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--color-primary);
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.hero-title {
  max-width: 22ch;
  margin: 0 auto 1.25rem;
}
.hero-title em {
  color: var(--color-primary);
  font-style: italic;
}
.hero-lead {
  max-width: 58ch;
  margin: 0 auto 2.25rem;
  font-size: 1.125rem;
  color: var(--color-text-muted);
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}
.hero-decor {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 800px 400px at 50% 0%,
      color-mix(in srgb, var(--color-accent) 18%, transparent) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 600px 300px at 50% 100%,
      color-mix(in srgb, var(--color-primary) 12%, transparent) 0%,
      transparent 70%
    );
  z-index: 1;
  pointer-events: none;
}

/* ---------- Code window ---------- */
.hero-code {
  max-width: 720px;
  margin: 0 auto;
}
.code-window {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  text-align: left;
}
.code-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--color-code-bg) 80%, var(--color-border));
  border-bottom: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-r {
  background: #e06c75;
}
.dot-y {
  background: #e5c07b;
}
.dot-g {
  background: #98c379;
}
.code-title {
  margin-left: auto;
  font-family: var(--font-mono);
}
.code-window pre {
  margin: 0;
  padding: 1.25rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--color-code-text);
}
.code-window pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.c-prompt {
  color: var(--color-accent);
}
.c-out {
  color: var(--color-text-muted);
  display: block;
  margin-top: 0.5em;
}
.c-k {
  color: var(--color-primary);
}
.c-s {
  color: #7c9a5e;
}
.c-n {
  color: #c08552;
}
[data-theme="dark"] .c-s {
  color: #a8c48a;
}
[data-theme="dark"] .c-n {
  color: #e5c07b;
}

.copy-btn {
  margin-left: auto;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.copy-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.copy-btn.copied {
  background: #7c9a5e;
  color: #fff;
  border-color: #7c9a5e;
}

/* ---------- Sections ---------- */
.section-title {
  text-align: center;
  margin-bottom: 0.5rem;
}
.section-lead {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 3rem;
}

/* ---------- Features ---------- */
.features {
  padding: 5rem 0;
  background: var(--color-bg-alt);
}
.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}
.feature {
  padding: 2rem 1.75rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}
.feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}
.feature-icon {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
  margin-bottom: 1rem;
}
.feature h3 {
  margin-bottom: 0.5rem;
}
.feature p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ---------- Endpoints ---------- */
.endpoints {
  padding: 5rem 0 6rem;
}
.endpoint-list {
  list-style: none;
  padding: 0;
  margin: 0 0 3rem;
  display: grid;
  gap: 0.75rem;
}
.endpoint {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}
.endpoint:hover {
  border-color: var(--color-primary);
  transform: translateX(4px);
}
.method {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.endpoint code {
  font-size: 0.88rem;
  background: transparent;
  padding: 0;
}
.endpoint .desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: right;
}
.cta {
  text-align: center;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2.5rem 0 2rem;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  text-align: center;
}
.footer-inner p {
  margin: 0;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}
.footer-links a {
  color: var(--color-text-muted);
  font-weight: 500;
  transition: color 0.2s ease;
}
.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--color-primary);
  text-decoration: underline;
}
.footer-brand {
  font-weight: 500;
  color: var(--color-text);
}
.footer-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-muted);
  opacity: 0.9;
  margin: 0;
}
@media (min-width: 720px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
  .footer-inner .footer-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
  }
  .footer-links {
    justify-content: flex-end;
  }
}

/* ---------- Licensing page ---------- */
.licensing-main {
  padding-top: var(--page-top-offset);
  padding-bottom: clamp(4rem, 8vw, 6rem);
}
.licensing-container {
  max-width: 780px;
}
.licensing-main > .container > header {
  margin-bottom: clamp(2rem, 4vw, 3rem);
  padding-top: 0.5rem;
}
.licensing-main > .container > header h1 {
  margin-top: 0.75rem;
}
.licensing-main > .container > header .lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 60ch;
}
.licensing-main section {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--color-border);
}
.licensing-main section:last-of-type {
  border-bottom: none;
}
.licensing-main section h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
}
.licensing-main section h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary);
}
.license-group {
  padding: 1.25rem 1.25rem;
  margin-top: 1rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.license-group h3 {
  margin-top: 0;
}
.license-group ul {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.25rem;
}
.license-group ul li {
  line-height: 1.65;
}
.license-group ul li code {
  font-size: 0.9em;
}
.license-group p {
  margin: 0.5rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
.licensing-footnote {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-primary);
  border-radius: 4px;
}

/* ---------- Docs licensing callout ---------- */
.docs-license-callout {
  margin-top: 1rem;
}
.docs-license-callout .btn {
  margin-top: 0.25rem;
}

/* ---------- Contact form ---------- */
.contact-main {
  padding-top: var(--page-top-offset);
  padding-bottom: clamp(4rem, 8vw, 6rem);
}
.contact-container {
  max-width: 620px;
}
.contact-container header {
  text-align: center;
  margin-bottom: 3rem;
}
.contact-container .lead {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}
.contact-form {
  display: grid;
  gap: 1.25rem;
  padding: 2rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.form-row {
  display: grid;
  gap: 0.5rem;
}
.form-row label {
  font-weight: 500;
  font-size: 0.9rem;
}
.req {
  color: #c75b4b;
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.form-row textarea {
  resize: vertical;
  min-height: 140px;
}
.hidden-field {
  position: absolute;
  left: -9999px;
}
.form-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  min-height: 1.2em;
}
.field-error {
  font-size: 0.82rem;
  color: #c75b4b;
  min-height: 1em;
  line-height: 1.3;
}
[data-theme="dark"] .field-error {
  color: #e08b7c;
}
.form-row input.has-error,
.form-row textarea.has-error {
  border-color: #c75b4b;
  box-shadow: 0 0 0 3px color-mix(in srgb, #c75b4b 18%, transparent);
}

/* ---------- 404 page ---------- */
.notfound-main {
  padding-top: var(--page-top-offset);
  padding-bottom: 6rem;
  text-align: center;
}
.notfound-container {
  max-width: 600px;
}
.notfound-code {
  font-family: var(--font-serif);
  font-size: clamp(6rem, 15vw, 10rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
  margin: 0 0 0.5rem;
  opacity: 0.25;
}
.notfound-verse {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--color-text-muted);
  border-left: 3px solid var(--color-primary);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 2rem auto;
  max-width: 520px;
  text-align: left;
}
.notfound-verse cite {
  display: block;
  font-style: normal;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-primary);
}
.notfound-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Page top spacing (universal) ---------- */
.page-top-spacer {
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

/* Ensure anchor-linked sections are never hidden under the fixed navbar.
   Uses the same --page-top-offset token so anchor targets line up with
   the visual top-spacing of every page. */
section[id] {
  scroll-margin-top: var(--page-top-offset);
}

/* ----------------------------------------------------------------
   Universal page top-spacing system (SINGLE SOURCE OF TRUTH).

   The .site-header is position: fixed and overlays the viewport, so
   every <main> must clear the full header. We split behavior into
   two cases:

   1. Homepage (body.home main)
      Must be flush under the navbar (NO visible gap). We reserve
      exactly --header-height so the hero's own padding-top provides
      the internal breathing space.

   2. All other pages
      Must never hide the page eyebrow/header under the navbar. We
      reserve --page-top-offset (= --header-height + breathing room).

   Every page-specific .X-main class (docs-main, playground-main,
   etc.) inherits this value. They MUST only override padding-bottom,
   never padding-top, and MUST NOT use shorthand `padding: X Y` that
   would clobber the rule.
   ---------------------------------------------------------------- */

/* Prevent first-child margin from collapsing upward and creating
   a gap between the navbar and the first content section. */
main {
  display: flow-root;
}

/* Homepage: flush under the fixed navbar, zero visible gap. */
body.home main {
  padding-top: var(--header-height);
}

/* All other pages: reserve header height + breathing room so that
   page eyebrows / headers are always fully visible below the navbar. */
body:not(.home) main,
.docs-main,
.playground-main,
.contact-main,
.snippets-main,
.status-main,
.a11y-main,
.licensing-main,
.notfound-main {
  padding-top: var(--page-top-offset);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, #1a1612 55%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2rem 1.75rem 1.75rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: scale(0.92);
  opacity: 0;
  transition:
    transform 0.3s var(--ease),
    opacity 0.3s ease;
}
.modal-overlay.is-open .modal-card {
  transform: scale(1);
  opacity: 1;
}
.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: color-mix(in srgb, #7c9a5e 18%, transparent);
  color: #5a7a42;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme="dark"] .modal-icon {
  background: color-mix(in srgb, #a8c48a 18%, transparent);
  color: #a8c48a;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
  color: var(--color-text);
}
.modal-body {
  margin: 0 0 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--color-text-muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

/* ---------- Focus states ---------- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-list {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.25rem;
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition:
      transform 0.25s ease,
      opacity 0.25s ease;
  }
  .nav-list.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-list a {
    padding: 0.75rem 1rem;
  }
  .endpoint {
    grid-template-columns: auto 1fr;
  }
  .endpoint .desc {
    grid-column: 1 / -1;
    text-align: left;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
