/* ==========================================================================
   Bible Study Platform — mobile-first design system
   Breakpoints: base (mobile) → 640px (tablet) → 1024px (desktop)
   ========================================================================== */

:root {
  --ink: #171412;
  --ink-soft: #4a423c;
  --ink-faint: #837870;
  --paper: #fbf9f6;
  --surface: #ffffff;
  --line: #e7e0d7;
  --accent: #7a4b2a;
  --accent-soft: #f3e9df;
  --accent-strong: #5c3720;
  --gold: #b88a3e;
  --ok: #2f6f4f;
  --warn: #9a6b12;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(23, 20, 18, .06), 0 2px 8px rgba(23, 20, 18, .05);
  --shadow: 0 4px 16px rgba(23, 20, 18, .09), 0 12px 40px rgba(23, 20, 18, .07);
  --shadow-lg: 0 20px 60px rgba(23, 20, 18, .22);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-h: 60px;
  --wrap: 1120px;
  --read: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2ede7;
    --ink-soft: #c6bcb2;
    --ink-faint: #928880;
    --paper: #16130f;
    --surface: #1f1b17;
    --line: #322c25;
    --accent: #d9a273;
    --accent-soft: #2c231b;
    --accent-strong: #eebd93;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 4px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.no-scroll { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.stack > * + * { margin-top: 16px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; /* allow flex children to shrink below their content width */
}

.brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;      /* the fix: without this the name can never compress */
  flex: 0 1 auto;    /* shrink before the nav does */
  font-family: var(--serif);
  font-size: clamp(.95rem, 3.2vw, 1.15rem);
  font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
  white-space: nowrap;
}
/* The text half of the brand - truncates rather than wrapping out of the bar */
.brand > span:not(.brand-mark) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Optional: wrap the tail of a long brand name in <span class="brand-long">
   to hide it on phones and show it from tablet width up. */
.brand-long { display: none; }
@media (min-width: 640px) { .brand-long { display: inline; } }

.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff; font-size: .95rem;
}

.site-nav {
  margin-left: auto;
  flex: none;        /* never let the nav collapse or wrap */
  display: flex; align-items: center; gap: 2px;
}
.site-nav a {
  padding: 8px 10px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; color: var(--ink-soft);
  white-space: nowrap;
}
@media (min-width: 640px) {
  .site-header .wrap { gap: 16px; }
  .site-nav { gap: 4px; }
  .site-nav a { padding: 8px 12px; }
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

/* -------------------------------------------------------------------- hero */

.hero {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1200px 340px at 15% -40%, var(--accent-soft), transparent 70%),
    var(--paper);
}
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.12; letter-spacing: -.02em; margin: 0 0 10px;
}
.hero p { margin: 0; color: var(--ink-soft); max-width: 54ch; font-size: 1.02rem; }

/* ------------------------------------------------------------------ filters */

.filters {
  position: sticky; top: var(--header-h); z-index: 40;
  padding: 12px 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.filters .wrap { display: flex; flex-direction: column; gap: 10px; }

.search-field { position: relative; display: flex; }
.search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.search-field input {
  width: 100%; padding: 12px 14px 12px 42px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-sm);
}
.search-field input:focus { border-color: var(--accent); outline: none; }

.chip-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none; padding: 8px 14px; min-height: 38px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft);
  font-size: .86rem; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ------------------------------------------------------------------- cards */

.grid {
  display: grid; gap: 18px;
  grid-template-columns: 1fr;
  padding: 26px 0 60px;
}

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card a { text-decoration: none; color: inherit; }

.card-cover { aspect-ratio: 16 / 9; background: var(--accent-soft); object-fit: cover; width: 100%; }
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); display: flex; gap: 8px; align-items: center;
}
.card h3 { font-family: var(--serif); font-size: 1.22rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.card-meta {
  margin-top: auto; padding-top: 10px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-size: .8rem; color: var(--ink-faint);
}

.tag {
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: .74rem; font-weight: 600;
}

/* ------------------------------------------------------------- study page */

.study-hero { padding: 32px 0 20px; }
.study-hero .wrap { max-width: var(--read); }
.study-hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.8rem, 5.6vw, 2.7rem); line-height: 1.15;
  letter-spacing: -.02em; margin: 10px 0 12px;
}
.study-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--ink-faint); font-size: .86rem; }

.study-body {
  width: min(100% - 32px, var(--read)); margin-inline: auto;
  padding-bottom: 60px;
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; color: var(--ink);
}
.study-body h2 { font-size: 1.5rem; line-height: 1.25; margin: 2em 0 .5em; letter-spacing: -.01em; }
.study-body h3 { font-size: 1.25rem; margin: 1.6em 0 .4em; }
.study-body p { margin: 0 0 1.15em; }
.study-body ul, .study-body ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.study-body li { margin-bottom: .4em; }
.study-body blockquote {
  margin: 1.6em 0; padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft); font-style: italic;
}
.study-body img { border-radius: var(--radius); margin: 1.6em 0; }
.study-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }

/* ----------------------------------------------- scripture citation marks */

.scripture-ref {
  display: inline;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  /* Generous touch target without breaking the line box (NFR 4.1) */
  padding: .22em .38em;
  margin: 0 -.06em;
  border-radius: 6px;
  background: var(--accent-soft);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  transition: background .15s, color .15s;
}
.scripture-ref:hover,
.scripture-ref:focus-visible {
  background: var(--accent);
  color: #fff;
  text-decoration-color: transparent;
}
.scripture-ref::after {
  content: "";
  display: inline-block;
  width: .62em; height: .62em;
  margin-left: .3em;
  vertical-align: -.02em;
  background: currentColor;
  opacity: .65;
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v16H4zM13 4h7v16h-7z' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v16H4zM13 4h7v16h-7z' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Desktop hover preview (FR-19) */
.verse-peek {
  position: absolute; z-index: 80;
  width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: var(--sans); font-size: .9rem; line-height: 1.55;
  color: var(--ink-soft);
  opacity: 0; transform: translateY(4px) scale(.98);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
}
.verse-peek.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.verse-peek .peek-ref { font-weight: 700; color: var(--accent-strong); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.verse-peek .peek-more { margin-top: 8px; font-size: .78rem; color: var(--ink-faint); }

/* --------------------------------------------- scripture modal / sheet ---- */

.sheet-backdrop {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 90;
  background: rgba(23, 20, 18, .45);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .2s ease;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.verse-sheet {
  pointer-events: none;
  position: fixed; z-index: 100;
  left: 0; right: 0; bottom: 0;
  max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.verse-sheet.is-open { transform: translateY(0); pointer-events: auto; }
.verse-sheet.is-dragging { transition: none; }

.sheet-grab {
  width: 44px; height: 4px; margin: 10px auto 2px;
  border-radius: 999px; background: var(--line); flex: none;
}

.sheet-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h2 {
  font-family: var(--serif); font-size: 1.22rem; margin: 0; letter-spacing: -.01em;
}
.sheet-title .sheet-translation {
  font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.sheet-close {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--paper); color: var(--ink-soft);
  font-size: 1.1rem; cursor: pointer;
}
.sheet-close:hover { background: var(--accent-soft); color: var(--accent-strong); }

.sheet-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 10px 20px 0; scrollbar-width: none;
}
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tabs .chip { font-size: .8rem; min-height: 34px; }

.sheet-body {
  padding: 16px 20px 26px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  font-family: var(--serif); font-size: 1.06rem; line-height: 1.7;
}
.passage + .passage { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.passage h3 {
  font-family: var(--sans); font-size: .76rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 8px;
}
.verse-line { margin: 0 0 .6em; }
.verse-num {
  font-family: var(--sans); font-size: .68em; font-weight: 700;
  color: var(--accent); vertical-align: .35em; margin-right: .35em;
}
.sheet-empty { color: var(--ink-faint); font-family: var(--sans); font-size: .92rem; }

/* ------------------------------------------------------- series navigation */

.series-nav {
  width: min(100% - 32px, var(--read)); margin: 0 auto 60px;
  display: grid; gap: 12px; grid-template-columns: 1fr;
}
.series-nav a {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); color: inherit;
}
.series-nav a:hover { border-color: var(--accent); text-decoration: none; }
.series-nav .dir { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.series-nav .ttl { font-family: var(--serif); font-size: 1.05rem; }
.series-nav .next { text-align: right; }

/* --------------------------------------------------------- buttons & forms */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: inherit; font-size: .94rem; font-weight: 600;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }
.btn-danger { background: transparent; border-color: #d6c0c0; color: #a33; }
.btn-danger:hover { background: #fdf2f2; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font: inherit; font-size: .96rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field .hint { font-size: .78rem; color: var(--ink-faint); }

.notice {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .9rem; border: 1px solid var(--line); background: var(--surface);
}
.notice.error { border-color: #e3bcbc; background: #fdf3f3; color: #8c2f2f; }
.notice.success { border-color: #bcdccb; background: #f2faf5; color: var(--ok); }

.empty-state {
  padding: 60px 20px; text-align: center; color: var(--ink-faint);
}
.empty-state h2 { font-family: var(--serif); color: var(--ink); margin: 0 0 8px; }

.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 40%, var(--surface)) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: var(--radius); min-height: 220px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ admin */

.admin-shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.admin-main { padding: 22px 0 80px; }

.admin-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.admin-bar h1 { font-family: var(--serif); font-size: 1.35rem; margin: 0; flex: 1; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th {
  text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:hover td { background: var(--accent-soft); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .03em;
}
.status-pill.published { background: #e8f4ed; color: var(--ok); }
.status-pill.draft { background: #fbf1dd; color: var(--warn); }

.editor-layout { display: grid; gap: 20px; grid-template-columns: 1fr; }

.editor-toolbar {
  position: sticky; top: var(--header-h); z-index: 30;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 8px; margin-bottom: -1px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.tool {
  min-width: 38px; height: 38px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--ink-soft); font: inherit; font-size: .88rem; cursor: pointer;
}
.tool:hover { background: var(--accent-soft); color: var(--accent-strong); }
.tool.is-primary { background: var(--accent); color: #fff; font-weight: 600; }
.tool.is-primary:hover { background: var(--accent-strong); color: #fff; }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.editor-surface {
  min-height: 420px; padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--serif); font-size: 1.06rem; line-height: 1.72;
  outline: none;
}
.editor-surface:focus { border-color: var(--accent); }
.editor-surface p { margin: 0 0 1em; }
.editor-surface[data-empty="true"]::before {
  content: attr(data-placeholder); color: var(--ink-faint); pointer-events: none;
}
/* Tagged spans are clearly visible while editing (FR-14) */
.editor-surface .scripture-ref {
  background: #fdf3c8;
  color: #6b4b12;
  border-bottom: 2px solid var(--gold);
  text-decoration: none;
}
.editor-surface .scripture-ref::after { opacity: .5; }

.side-panel {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  height: fit-content;
}
.side-panel h2 { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin: 0; }

.ref-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.ref-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); font-size: .86rem;
}
.ref-item .ref-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tagging dialog */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(23, 20, 18, .5); backdrop-filter: blur(3px);
  display: grid; place-items: end center;
}
@media (min-width: 640px) { .dialog-backdrop { place-items: center; } }

.dialog {
  width: min(100%, 520px);
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0));
}
@media (min-width: 640px) { .dialog { border-radius: var(--radius-lg); } }
.dialog h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 4px; }
.dialog .dialog-sub { color: var(--ink-faint); font-size: .88rem; margin: 0 0 18px; }
.dialog-rows { display: flex; flex-direction: column; gap: 10px; }
.dialog-row { display: flex; gap: 8px; align-items: flex-start; }
.dialog-row input { flex: 1; }
.dialog-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.dialog-actions .spacer { flex: 1; }

.ref-preview {
  margin-top: 12px; padding: 12px 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--serif); font-size: .95rem; line-height: 1.6; color: var(--ink-soft);
  max-height: 160px; overflow-y: auto;
}
.ref-preview .miss { color: #a33; font-family: var(--sans); font-size: .85rem; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120%);
  z-index: 120; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow); transition: transform .25s cubic-bezier(.32,.72,0,1);
}
.toast.is-open { transform: translate(-50%, 0); }

.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0 40px;
  color: var(--ink-faint); font-size: .85rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.site-footer .spacer { flex: 1; }

/* ------------------------------------------------------------- breakpoints */

@media (min-width: 640px) {
  body { font-size: 17px; }
  .wrap { width: min(100% - 48px, var(--wrap)); }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .filters .wrap { flex-direction: row; align-items: center; }
  .search-field { max-width: 340px; }
  .chip-row { flex: 1; }
  .series-nav { grid-template-columns: 1fr 1fr; }
  .study-body { font-size: 1.15rem; }
  .dialog-actions .spacer { display: block; }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 64px 0 44px; }
  .editor-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .admin-main { padding-top: 32px; }

  /* Centred dialog on large screens instead of a bottom sheet (NFR 4.1) */
  .verse-sheet {
    left: 50%; bottom: auto; top: 50%;
    width: min(880px, calc(100vw - 64px));
    max-height: 85vh;
    border-radius: var(--radius-lg);
    transform: translate(-50%, -46%) scale(.97);
    opacity: 0;
    transition: transform .22s cubic-bezier(.32,.72,0,1), opacity .18s ease;
  }
  .verse-sheet.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-grab { display: none; }
  .sheet-head { padding: 22px 32px 18px; }
  .sheet-title h2 { font-size: 1.65rem; }
  .sheet-body { padding: 24px 32px 32px; font-size: 1.3rem; line-height: 1.8; }
  .passage h3 { font-size: .9rem; }
  .sheet-close { width: 48px; height: 48px; font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .filters, .series-nav, .site-footer, .verse-sheet, .sheet-backdrop { display: none !important; }
  .scripture-ref { background: none; color: inherit; }
  .scripture-ref::after { display: none; }
}
