/* =========================================================================
   BibleTelling Stories: shared styles
   Order: 1 fonts · 2 tokens · 3 base · 4 header · 5 hero · 6 portals
          7 views + fly-out · 8 footer · 9 reduced motion
   Mobile-first: base rules target phones; min-width queries add on top.
   Brand tokens match bibletelling.org so the two sites feel like family.
   ========================================================================= */

/* ---------- 1. Fonts (local; fall back to Georgia / system sans) ---------- */
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora/Lora-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora/Lora-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Norms";
  src: url("../fonts/norms/TTNorms-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
  /* Brand (fixed) */
  --brown: #473118;
  --beige: #fffcf1;
  --red: #c10f18;
  --gold: #c99a00;
  --taupe: #867663;

  /* Derived */
  --red-dark: #9e0c13;
  --ink: #1c1309;                 /* near-black brown: photo shading, dark surfaces */
  --gold-light: #f1cf63;          /* gold that reads on dark photos */
  --line-soft: rgb(71 49 24 / 0.12);

  /* Type */
  --font-body: "Lora", Georgia, "Times New Roman", serif;
  --font-head: "Norms", system-ui, "Segoe UI", Roboto, Arial, sans-serif;

  /* Layout */
  --max: 1200px;
  --pad: 1rem;
  --radius: 22px;
  --gap: 0.75rem;

  /* Header (shrinks with --h, 0 → 1, set by header.js) */
  --logo: 46px;
  --logo-min: 36px;
  --bar-pad: 0.75rem;
  --bar-pad-min: 0.35rem;
  --float: 0.5rem;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}
@media (min-width: 768px) {
  :root { --pad: 2rem; --gap: 1.25rem; }
}
@media (min-width: 1100px) {
  :root { --logo: 58px; --logo-min: 42px; }
}

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--beige);
  color: var(--brown);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 0.5em;
}
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 0.2em; }
ul[role="list"] { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 3px solid var(--brown);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--brown);
  color: var(--beige);
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

/* Button: red is for calls to action only */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8em 1.75em;
  border: 0;                 /* <button>s get a grey UA border otherwise */
  background: var(--red);
  color: #fff;
  font-size: inherit;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 6px 18px -8px rgb(193 15 24 / 0.65);
  transition: background-color 0.2s, transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.btn:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgb(193 15 24 / 0.75); }

/* ---------- 4. Header ----------
   Fixed over the hero. At --h 0 it is a clear band (beige text on the dark
   photo). Scrolling lifts it into a floating, frosted-beige, rounded bar with
   a fine gold edge, and the logo shrinks. Past halfway (.is-solid) the text
   turns brown. Below 1100px the six sections sit behind a Menu button.
   Without JS: the header sits over the hero and the nav is a scrolling row. */
.site-header {
  --h: 0;
  position: absolute;
  inset: 0 0 auto;
  z-index: 40;
  padding: calc(var(--float) * var(--h)) calc(var(--float) * var(--h)) 0;
  color: var(--beige);
}
.js .site-header { position: fixed; }

/* Soft shade at the very top so beige text reads on any photo; fades out as the bar appears */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 -2.5rem;
  background: linear-gradient(rgb(28 19 9 / 0.55), rgb(28 19 9 / 0));
  opacity: calc(1 - var(--h));
  pointer-events: none;
}

.site-header__bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  max-width: calc(var(--max) + 2 * var(--pad));
  margin-inline: auto;
  padding: calc(var(--bar-pad) - (var(--bar-pad) - var(--bar-pad-min)) * var(--h)) var(--pad);
  border-radius: calc(var(--h) * 2rem);
  background: rgb(255 252 241 / calc(var(--h) * 0.88));
  box-shadow:
    inset 0 0 0 1px rgb(201 154 0 / calc(var(--h) * 0.45)),
    0 14px 34px -16px rgb(71 49 24 / calc(var(--h) * 0.5));
  -webkit-backdrop-filter: blur(calc(var(--h) * 14px)) saturate(1.2);
  backdrop-filter: blur(calc(var(--h) * 14px)) saturate(1.2);
}
.site-header.is-solid,
.nav-open .site-header { color: var(--brown); }
.site-header { transition: color 0.3s; }

.site-header__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: auto;
  text-decoration: none;
}
.site-header__logo img {
  height: calc(var(--logo) - (var(--logo) - var(--logo-min)) * var(--h));
  width: auto;
  filter: drop-shadow(0 3px 6px rgb(28 19 9 / calc(0.35 * (1 - var(--h)))));
}
.site-header__wordmark {
  font-family: var(--font-head);
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-left: 0.6rem;
  border-left: 1px solid currentColor;
  line-height: 1.1;
}

/* Menu button (JS only, below 1100px) */
.nav-toggle { display: none; }
.js .nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0 0.95rem 0 0.8rem;
  background: rgb(255 252 241 / 0.12);
  border: 1px solid rgb(255 252 241 / 0.35);
  border-radius: 999px;
  color: inherit;
  font: 500 0.9375rem var(--font-head);
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}
.js .is-solid .nav-toggle,
.js.nav-open .nav-toggle { background: transparent; border-color: rgb(71 49 24 / 0.25); }
.nav-toggle__lines { display: grid; gap: 4px; }
.nav-toggle__lines span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.35s var(--ease-out), opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__lines span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__lines span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__lines span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Nav: no-JS phones get a scrolling row of pills under the logo */
.site-nav {
  flex-basis: 100%;
  font-family: var(--font-head);
}
.site-nav__list {
  display: flex;
  gap: 0.4rem;
  margin: 0;
  padding: 0.5rem 0 0.25rem;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  white-space: nowrap;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid rgb(255 252 241 / 0.3);
  transition: background-color 0.25s, border-color 0.25s, color 0.25s;
}
.site-nav__link:hover { background: rgb(255 252 241 / 0.14); }
.is-solid .site-nav__link { border-color: transparent; }
.is-solid .site-nav__link:hover { background: rgb(201 154 0 / 0.14); }
.site-header :focus-visible { outline-color: var(--gold); }
.site-header.is-solid :focus-visible, .nav-open .site-header :focus-visible { outline-color: var(--brown); }

/* JS phones/tablets: the nav is a beige panel that drops from the bar.
   A grid row animating 0fr → 1fr animates "height: auto". */
@media (max-width: 1099.98px) {
  .js .site-nav {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows 0.45s var(--ease-out), visibility 0s 0.45s;
  }
  .js .site-nav__list {
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }
  .js.nav-open .site-nav { grid-template-rows: 1fr; visibility: visible; transition-delay: 0s; }
  .js.nav-open .site-header__bar {
    background: rgb(255 252 241 / 0.97);
    border-radius: 0 0 1.5rem 1.5rem;
    box-shadow: inset 0 0 0 1px rgb(201 154 0 / 0.45), 0 18px 40px -18px rgb(71 49 24 / 0.55);
  }
  .js.nav-open .site-header.is-solid .site-header__bar { border-radius: 1.5rem; }
  .js .site-nav__list li:first-child { margin-top: 0.75rem; border-top: 1px solid var(--line-soft); }
  .js .site-nav__link {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 0 0.25rem;
    font-size: 1.125rem;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
  }
  .js .site-nav__list li:last-child .site-nav__link { border-bottom: 0; margin-bottom: 0.5rem; }
  .js .site-nav__link::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-top: 2px solid var(--gold);
    border-right: 2px solid var(--gold);
    transform: rotate(45deg);
    transition: transform 0.25s var(--ease-out);
  }
  .js .site-nav__link:hover { background: transparent; color: var(--red); }
  .js .site-nav__link:hover::after { transform: translateX(3px) rotate(45deg); }
}

/* Desktop: logo left, six section pills right */
@media (min-width: 1100px) {
  .site-header__bar { flex-wrap: nowrap; }
  .js .nav-toggle { display: none; }
  .site-nav { flex-basis: auto; }
  .site-nav__list { gap: 0.15rem; padding: 0; overflow: visible; }
  .site-nav__link { padding: 0 0.85rem; font-size: 0.9375rem; border-color: transparent; position: relative; }
  /* Gold thread grows under the hovered section */
  .site-nav__link::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.55rem;
    height: 2px;
    border-radius: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transition: transform 0.35s var(--ease-out);
  }
  .site-nav__link:hover::after { transform: scaleX(1); }
  .site-nav__link:hover { background: transparent; }
  .is-solid .site-nav__link:hover { background: transparent; }
}

/* ---------- 5. Hero ----------
   The open Bible in a dark room. Opening shot: the photo settles from a slow
   push-in out of the dark while a warm gold light rises over the pages and
   sweeps once across the headline. */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  /* A full screen of photo, plus the fade below the fold: the hand-off into
     the page only appears once you start scrolling */
  min-height: calc(100vh + var(--fade));
  min-height: calc(100svh + var(--fade));
  overflow: hidden;
  background: var(--ink);
  color: var(--beige);
  isolation: isolate;
  --fade: clamp(7rem, 22vh, 13rem);   /* depth of the soft hand-off into the page */
}
/* The dark photo melts into the beige page below: an eased ramp (more stops
   near the bottom) so there is no visible band. */
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--fade);
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    rgb(255 252 241 / 0) 0%,
    rgb(255 252 241 / 0.04) 18%,
    rgb(255 252 241 / 0.14) 35%,
    rgb(255 252 241 / 0.32) 52%,
    rgb(255 252 241 / 0.56) 68%,
    rgb(255 252 241 / 0.8) 83%,
    rgb(255 252 241 / 0.94) 93%,
    var(--beige) 100%);
}
.hero__media { position: absolute; inset: 0; z-index: -1; }
/* Portrait screens (phones, upright tablets): the photo fills the top of the hero so the open pages sit above
   the text, and fades into the dark below */
@media (max-aspect-ratio: 4/5) {
  .hero__media { bottom: calc(var(--fade) + 26svh); }
  .hero__media::before {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 40%;
    z-index: 1;
    background: linear-gradient(transparent, var(--ink));
  }
}
.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 60%;
}
/* Shade: strongest at the bottom (phones) / left (desktop), where the text sits */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgb(28 19 9 / 0.92) 0%, rgb(28 19 9 / 0.55) 38%, rgb(28 19 9 / 0.1) 70%),
    radial-gradient(120% 80% at 50% 50%, transparent 55%, rgb(28 19 9 / 0.5));
}
/* Warm light over the pages */
.hero__glow {
  position: absolute;
  left: 60%;
  top: 55%;
  width: 90vmax;
  height: 60vmax;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgb(241 207 99 / 0.35), rgb(201 154 0 / 0.12) 45%, transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-top: 7rem;
  padding-bottom: calc(var(--fade) + 2.5rem);
}
.hero__eyebrow {
  margin-bottom: 0.75rem;
  color: var(--gold-light);
  font-family: var(--font-head);
  font-size: 0.875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.hero__title {
  /* background-clip: text paints only inside the box, so give the descenders
     (the "y"s) room below the line and take it back off the margin */
  padding-bottom: 0.14em;
  margin-bottom: calc(1.25rem - 0.14em);
  font-size: clamp(2.75rem, 11vw, 6.25rem);
  letter-spacing: -0.01em;
  line-height: 0.98;
  /* Gold light: a band of gold parked off to the left, swept across on load */
  background: linear-gradient(100deg, var(--beige) 0 40%, var(--gold-light) 47%, #fff7d6 50%, var(--gold-light) 53%, var(--beige) 60% 100%);
  background-size: 250% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--beige);
  -webkit-text-fill-color: transparent;
}
.hero__lead {
  max-width: 34rem;
  margin-bottom: 2rem;
  font-size: 1.0625rem;
  color: rgb(255 252 241 / 0.9);
}
.hero__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-family: var(--font-head);
  font-size: 1rem;
  text-decoration: none;
  color: var(--beige);
}
.hero__cue span { border-bottom: 1px solid rgb(201 154 0 / 0.8); padding-bottom: 2px; }
.hero__cue svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--gold-light);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero :focus-visible { outline-color: var(--gold-light); }

@media (min-width: 768px) and (min-aspect-ratio: 4/5) {
  .hero { align-items: center; }
  .hero__img { object-position: 60% 55%; }
  .hero__media::after {
    background:
      linear-gradient(to right, rgb(28 19 9 / 0.88) 0%, rgb(28 19 9 / 0.6) 35%, rgb(28 19 9 / 0) 68%),
      linear-gradient(to top, rgb(28 19 9 / 0.5), transparent 35%);
  }
  .hero__content { padding-top: 8rem; padding-bottom: var(--fade); }
  .hero__lead { font-size: 1.1875rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__img { animation: hero-settle 2.6s var(--ease-out) both; }
  .hero__glow { animation: hero-glow 3.2s 0.6s ease-out both; }
  .hero__eyebrow, .hero__lead, .hero__cue { animation: rise 1s var(--ease-out) both; }
  .hero__eyebrow { animation-delay: 0.5s; }
  .hero__title { animation: rise 1.1s 0.65s var(--ease-out) both, gold-sweep 2.4s 1.1s ease-in-out both; }
  .hero__lead { animation-delay: 0.95s; }
  .hero__cue { animation-delay: 1.2s; }
  .hero__cue svg { animation: nudge 2.4s 2.4s ease-in-out infinite; }
}
@keyframes hero-settle { from { transform: scale(1.12); filter: brightness(0.25); } }
@keyframes hero-glow { from { opacity: 0; transform: translate(-50%, -42%) scale(0.7); } }
@keyframes rise { from { opacity: 0; transform: translateY(1.25rem); } }
@keyframes gold-sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: translateY(4px); } }

/* ---------- 6. Six ways in ---------- */
.begin { padding-block: 2rem 5rem; }
/* The hero's link lands on the title, clear of the floating header */
.begin__title { scroll-margin-top: 6.5rem; }
.begin__title {
  margin-bottom: 2rem;
  text-align: center;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
}
/* Small gold mark under the title: a closed book seen from the spine */
.begin__title::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin: 1.1rem auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 20% 80%, transparent);
}

.portals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}
.portal {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  box-shadow: 0 2px 4px rgb(71 49 24 / 0.08), 0 14px 30px -12px rgb(71 49 24 / 0.35);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.portal__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out);
}
/* Darken the photo so white text always reads (AA on every tile) */
.portal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(closest-side, rgb(28 19 9 / 0.55), rgb(28 19 9 / 0.3) 130%),
    rgb(28 19 9 / 0.28);
  transition: background-color 0.5s;
}
/* Fine gold frame that settles in on hover */
.portal::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgb(241 207 99 / 0.75);
  border-radius: calc(var(--radius) - 10px);
  opacity: 0;
  transition: opacity 0.45s, inset 0.6s var(--ease-out);
  pointer-events: none;
}
/* People: keep the figures in the boat in frame at every tile shape */
.portal[data-view="people"] .portal__img { object-position: 62% 85%; }
/* The painting is already dark: a lighter shade keeps the figures visible */
.portal[data-view="people"]::before { background-color: rgb(28 19 9 / 0.06); }
.portal[data-view="people"]:hover::before { background-color: rgb(28 19 9 / 0); }
/* Light photos (map, white pages) need a deeper shade for white text */
.portal--light::before { background-color: rgb(28 19 9 / 0.45); }
.portal--light:hover::before { background-color: rgb(28 19 9 / 0.34); }
.portal__title {
  padding: 0 0.5rem;
  font-family: var(--font-head);
  font-size: clamp(1.375rem, 6vw, 2.25rem);
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 2px 18px rgb(28 19 9 / 0.6);
}
.portal__num {
  position: absolute;
  top: 0.9rem;
  left: 1rem;
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--gold-light);
}
.portal:hover .portal__img { transform: scale(1.06); }
.portal:hover::before { background-color: rgb(28 19 9 / 0.16); }
.portal:hover::after,
.portal:focus-visible::after { opacity: 1; inset: 10px; }
.portal:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgb(71 49 24 / 0.1), 0 22px 40px -14px rgb(71 49 24 / 0.45); }
.portal:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: var(--radius); }

@media (min-width: 768px) {
  .portals { grid-template-columns: repeat(3, 1fr); }
  .portal { aspect-ratio: 1 / 1; }
  .begin { padding-block: 3rem 7rem; }
  .begin__title { margin-bottom: 3rem; }
}
@media (min-width: 1100px) {
  .portal { aspect-ratio: 4 / 3; }
  .portal__title { font-size: 2.25rem; }
}

/* Entrance: tiles rise in, one after another, when the grid comes into view.
   Only with JS (home.js adds .portals--wait, then .is-in) so no-JS never hides them. */
@media (prefers-reduced-motion: no-preference) {
  .portals--wait li { opacity: 0; transform: translateY(1.5rem) scale(0.98); }
  .portals--wait.is-in li {
    opacity: 1;
    transform: none;
    transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
}

/* ---- Keyword search ----
   A white pill with a gold edge and a soft gold halo; the halo widens on
   focus. Results open below in a white card (grid-rows 0fr → 1fr) and rise
   in one after another. Matching words are marked in pale gold. */
.search {
  max-width: 46rem;
  margin: 3.5rem auto 0;
}
.search__label {
  display: block;
  margin-bottom: 0.75rem;
  font-family: var(--font-head);
  font-size: 1.25rem;
}
.search__field {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 0 0 6px rgb(201 154 0 / 0.14), 0 10px 26px -16px rgb(71 49 24 / 0.4);
  transition: box-shadow 0.35s var(--ease-out), border-color 0.35s;
}
.search__field:focus-within {
  border-color: #a98100;
  box-shadow: 0 0 0 9px rgb(201 154 0 / 0.22), 0 14px 30px -16px rgb(71 49 24 / 0.45);
}
.search__icon {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: var(--taupe);
  stroke-width: 2;
  stroke-linecap: round;
}
.search__input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 0.5rem;
  border: 0;
  background: transparent;
  color: var(--brown);
  font: 1.125rem/1.2 var(--font-body);
}
.search__input:focus { outline: none; }               /* the field's halo shows focus */
.search__input::placeholder { color: #8a7a66; opacity: 1; }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search__clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--taupe);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, transform 0.3s var(--ease-out);
}
.search__clear[hidden] { display: none; }
.search__clear:hover { color: var(--red); background: rgb(193 15 24 / 0.07); transform: rotate(90deg); }
.search__clear svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.search__go { flex: none; padding-inline: 1.4em; box-shadow: none; font-size: 1rem; }
.search__go:focus-visible { outline: 3px solid var(--brown); outline-offset: 2px; border-radius: 999px; }
.search__go:hover { transform: none; box-shadow: none; }
.search__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out);
}
.search.has-results .search__panel { grid-template-rows: 1fr; }
.search__results { min-height: 0; overflow: hidden; }
.search__card {
  margin-top: 1rem;
  padding: 1rem 0 0.5rem;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgb(71 49 24 / 0.05), 0 18px 40px -22px rgb(71 49 24 / 0.4);
}
.search__count { margin: 0 0 0.25rem; padding-inline: 1.5rem; font-size: 0.9375rem; color: #6b5a45; }
.search__list { max-height: 26rem; margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.result {
  position: relative;
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: baseline;
  padding: 0.7rem 1.5rem;
  text-decoration: none;
  transition: background-color 0.2s;
}
.result::before {                                   /* gold marker on hover / keyboard focus */
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
  transform: scaleY(0);
  transition: transform 0.3s var(--ease-out);
}
.result:hover, .result:focus-visible { background: var(--beige); outline: none; }
.result:hover::before, .result:focus-visible::before { transform: scaleY(1); }
.result__num { font-family: var(--font-head); font-size: 0.9375rem; color: #6b5a45; }
.result__title { font-size: 1.1875rem; line-height: 1.35; }
.result__meta { grid-column: 2; font-size: 0.9375rem; color: #6b5a45; }
.result mark { background: rgb(201 154 0 / 0.24); color: inherit; border-radius: 3px; padding: 0 0.08em; }
.search__empty { margin: 0; padding: 0.5rem 1.5rem 0.75rem; color: #6b5a45; }
@media (prefers-reduced-motion: no-preference) {
  .search.has-results .result { animation: rise 0.5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
}
@media (max-width: 479.98px) {
  .search__field { padding-left: 0.85rem; }
  .search__input { font-size: 1rem; padding-inline: 0.4rem; }
  .search__go { padding-inline: 1.1em; }
    .result { grid-template-columns: 2.4rem 1fr; padding-inline: 1.1rem; }
  .search__count, .search__empty { padding-inline: 1.1rem; }
}

/* Scroll reveal for calm blocks (search, footer). home.js adds .reveal-ready
   only with JS + motion, so nothing is ever hidden otherwise. */
.reveal-ready .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 0.9s var(--ease-out), transform 1s var(--ease-out); transition-delay: var(--d, 0s); }
.reveal-ready .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 7. Views + fly-out ----------
   .view = the page a tile opens. Blank for now (it will hold the stories
   organized that way). No JS: :target shows it. With JS: .is-open shows it,
   and home.js flies the tile out to full screen first (.fly). */
.view {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: var(--beige);
}
html:not(.js) .view:target,
.view.is-open { display: block; }
.view:focus { outline: none; }
.view__back {
  position: absolute;
  top: 1rem;
  left: var(--pad);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.1rem 0 0.9rem;
  border: 1px solid rgb(71 49 24 / 0.25);
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 0.9375rem;
  text-decoration: none;
  background: var(--beige);
  transition: border-color 0.25s, background-color 0.25s;
}
.view__back::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-bottom: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
  transform: rotate(45deg);
}
.view__back:hover { border-color: var(--gold); background: #fff; }
.view.is-entering .view__back { animation: rise 0.6s var(--ease-out) both; }

/* The flying copy of a tile (built by home.js) */
.fly {
  position: fixed;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  pointer-events: none;
  will-change: left, top, width, height, border-radius;
  contain: layout paint;
}
.fly__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fly__shade {
  position: absolute;
  inset: 0;
  background: rgb(28 19 9 / 0.5);
}
.fly--light .fly__shade { background: rgb(28 19 9 / 0.64); }
.fly__page {
  position: absolute;
  inset: 0;
  background: var(--beige);
  opacity: 0;
}
.fly__title {
  position: relative;
  font-family: var(--font-head);
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgb(28 19 9 / 0.6);
  will-change: transform, opacity;
}
html.is-flying { overflow: hidden; }

/* ---------- 8. Footer ----------
   Brown band. Story of the Day on the left (title, text, Subscribe), contact
   details on the right; a hairline, then the BibleTelling credit line.
   Stacked on phones. */
.site-footer {
  position: relative;
  overflow: hidden;
  padding-block: 4rem 2rem;
  background: var(--brown);
  color: var(--beige);
}
/* Faint warm light behind the invitation, echoing the hero */
.site-footer::before {
  content: "";
  position: absolute;
  left: -10rem;
  top: -14rem;
  width: 50rem;
  height: 32rem;
  background: radial-gradient(closest-side, rgb(201 154 0 / 0.16), transparent);
  pointer-events: none;
}
.site-footer__main {
  position: relative;
  display: grid;
  gap: 2.75rem;
  padding-bottom: 2.5rem;
}
.sotd__title {
  margin-bottom: 1.25rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  color: var(--beige);
}
.sotd__text {
  max-width: 38rem;
  margin-bottom: 1.75rem;
  font-size: 1.125rem;
  line-height: 1.7;
  color: rgb(255 252 241 / 0.88);
}

.contact { font-style: normal; }
.contact__label {
  margin-bottom: 1rem;
  font-family: var(--font-head);
  font-size: 1.25rem;
}
.contact__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
  min-height: 44px;
  margin: 0;
  color: rgb(255 252 241 / 0.88);
  text-decoration: none;
}
.contact__item svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
a.contact__item span {
  background: linear-gradient(var(--gold), var(--gold)) no-repeat 0 100% / 0% 1px;
  transition: background-size 0.4s var(--ease-out), color 0.2s;
}
a.contact__item:hover { color: var(--beige); }
a.contact__item:hover span { background-size: 100% 1px; }

.site-footer__base {
  position: relative;
  margin: 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(255 252 241 / 0.18);
  font-size: 0.9375rem;
  color: rgb(255 252 241 / 0.8);
}
.site-footer__base a { color: var(--gold); }       /* gold on brown passes AA (about 4.7:1) */
.site-footer__base a:hover { color: var(--gold-light); }
.site-footer :focus-visible { outline-color: var(--gold); }

@media (min-width: 900px) {
  .site-footer { padding-block: 5.5rem 2.25rem; }
  .site-footer__main { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 4rem; padding-bottom: 3rem; }
  .contact { justify-self: end; padding-top: 0.6rem; }
}

/* ---------- 9. Reduced motion ----------
   Everything still works; it just doesn't move. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- 10. "More" menu (every other page of the site) ----------
   Desktop: a pill that drops a frosted card (opens on hover with a short
   close delay and an invisible bridge, or on click). Phones/tablets: the
   pages are listed under the six sections inside the menu panel. */
.more { position: relative; }
.more__btn {
  gap: 0.4rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}
.more__chev {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  transition: transform 0.3s var(--ease-out);
}
.more__menu { margin: 0; padding: 0; list-style: none; }
.more__menu a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.9375rem;
  transition: background-color 0.2s, color 0.2s;
}
.more__menu a:hover { background: rgb(201 154 0 / 0.14); color: var(--red); }
.more__menu a[aria-current] { color: var(--red); }
.site-nav__link[aria-current="true"] { color: inherit; }

@media (min-width: 1100px) {
  .more__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1rem 0.25rem;
    width: 27rem;
    padding: 0.6rem;
    border-radius: 18px;
    background: rgb(255 252 241 / 0.97);
    color: var(--brown);
    box-shadow: inset 0 0 0 1px rgb(201 154 0 / 0.45), 0 22px 44px -18px rgb(71 49 24 / 0.55);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.25s, transform 0.35s var(--ease-out), visibility 0s 0.35s;
  }
  .more__menu::before { content: ""; position: absolute; left: 0; right: 0; top: -0.8rem; height: 0.8rem; }  /* hover bridge */
  .more.is-open .more__menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .more.is-open .more__chev { transform: rotate(225deg); margin-top: 0.15rem; }
}
@media (max-width: 1099.98px) {
  .more__btn { display: none !important; }
  .js .site-nav__list li.more { border-bottom: 0; }
  .more__menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.5rem;
    padding: 0.75rem 0 0.5rem;
  }
  .js .site-nav__list li.more .more__menu a { padding: 0 0.25rem; min-height: 44px; font-size: 1rem; }
  html:not(.js) .more__menu { display: flex; flex-wrap: nowrap; gap: 0.4rem; padding: 0; }
  html:not(.js) .more__menu a { white-space: nowrap; border: 1px solid rgb(255 252 241 / 0.3); border-radius: 999px; }
}
.fly__page--dark { background: var(--ink); }
@media (min-width: 1100px) and (max-width: 1279.98px) {
  .site-nav__link { padding: 0 0.6rem; font-size: 0.875rem; }
  .site-nav__link::after { left: 0.6rem; right: 0.6rem; }
  .site-header__logo { gap: 0.4rem; margin-right: 1rem; }
}

/* Bible references: each piece ("Luke 17:11-19,") stays on one line; lines break only after a comma */
.rs { white-space: nowrap; }
