/* ==========================================================================
   Bible Meat Feed — Brand Direction 4, "Meaty Truth"
   --------------------------------------------------------------------------
   Brand palette (the only literal colors in this file):
     Steak Red     #A92E36   hsl(356 57% 42%)
     Golden Yellow #F4B536   hsl( 40 90% 58%)
     Cream         #FFF3DC   hsl( 39100% 93%)
     Ink           #242323   hsl(  0  1% 14%)
     Fresh Sage    #7C9569   hsl( 94 17% 50%)
     Ice Blue      #3E86C4 — NOT in the kit; added for FREEZE IT, whose
                             snowflake is drawn blue in the app mockup.

   Trail colors carry --h / --s / --l set inline by app.js from data/trails.js;
   every tinted surface derives from them with color-mix(). Nothing is
   hard-coded per trail.
   ========================================================================== */

/* Brand typefaces (Lilita One, Inter) load from styles/fonts.css, which embeds
   them as data: URIs — see the note at the top of that file for why. */

/* --- Brand tokens --------------------------------------------------------- */

:root {
  /* Brand palette, verbatim. */
  --steak-red:  #a92e36;
  --golden:     #f4b536;
  --cream:      #fff3dc;
  --ink:        #242323;
  --sage:       #7c9569;
  --ice:        #3e86c4;   /* not in the kit — see the header note */

  /* Darkened variants, required for legibility on Cream. Golden Yellow is only
     1.66:1 on Cream and Fresh Sage only 3.00:1, so neither can carry text as
     drawn. These clear WCAG AA for normal text on Cream:
       golden-deep 4.88:1 (the FEED wordmark, at the size it actually is)
       sage-deep   4.78:1 (tagline, and the verse chip's pill)
       ice-deep    5.15:1 (any FREEZE label set in text) */
  --golden-deep: #8f6200;
  --sage-deep:   #5f7150;
  --ice-deep:    #316b9b;
  --steak-deep:  #8a2029;

  --paper:   var(--cream);
  --card:    #ffffff;
  --sunken:  #faf1e0;
  --border:  #e9dcc2;
  --border2: #d8c8a8;
  --ink2:    #5d5a55;
  /* 4.95:1 on Cream. The old #8b857c was 3.33:1 and failed inactive tabs. */
  --ink3:    #6f695f;

  --tint-wash: 0.06;
  --tint-edge: 0.32;
  --tint-glow: 0.16;
  --tint-text: 0.78;

  --radius:    10px;
  --radius-lg: 16px;
  --pill:      999px;

  /* The cut. A card is a piece of meat, so it is trimmed like one: the four
     corners get different elliptical radii (that is what the `/` separates),
     which is what stops the outline reading as a plain rounded rectangle. Four
     cuts are dealt round-robin down the feed so no two cards in view are
     trimmed alike — the mark is lopsided for the same reason.
     Radii stay in px rather than %, so a long card and a short one are cut the
     same instead of the shape stretching with the content. */
  --cut-1: 62px 24px 54px 30px / 40px 56px 32px 46px;
  --cut-2: 26px 58px 28px 56px / 52px 34px 50px 30px;
  --cut-3: 48px 34px 64px 22px / 32px 50px 40px 54px;
  --cut-4: 30px 52px 24px 60px / 46px 30px 56px 34px;

  /* The fat cap: the cream seam the mark sets just inside the edge of the cut.
     On the white card face, straight Cream (#fff3dc) is all but invisible, so
     the seam is deepened until it actually reads. */
  --fat-cap: #f0dfba;

  /* Marbling: the light-red seams the mark carries, laid into two opposite
     corners of the cut. Inlined as data: URIs rather than files so they survive
     being opened over file://, and applied as a *mask* rather than as colored
     background images — that way the seams take --steak-red from whichever
     scheme is active instead of needing a second hard-coded copy for dark. Each
     drawing carries its own width/height, so the seams keep their shape on a
     three-line card and a twelve-line one alike; stretching one drawing over
     the whole face turned them into smears.
     The color is Steak Red rather than --tint on purpose: marbling says "meat",
     and following each trail's hue would make it a second, competing signal. */
  --marbling-a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='140' viewBox='0 0 180 140'%3E%3Cg fill='none' stroke='%23fff' stroke-linecap='round'%3E%3Cpath d='M30 2c30 10 56 30 74 58' stroke-width='5'/%3E%3Cpath d='M78-6c24 16 44 38 56 64' stroke-width='3.5'/%3E%3Cpath d='M120 88c20 12 37 27 51 45' stroke-width='4'/%3E%3Cpath d='M4 30c26 4 50 14 70 30' stroke-width='3'/%3E%3Cpath d='M150 30c10 12 19 26 26 42' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
  --marbling-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='140' viewBox='0 0 180 140'%3E%3Cg fill='none' stroke='%23fff' stroke-linecap='round'%3E%3Cpath d='M2 22c4 32 18 61 42 84' stroke-width='5'/%3E%3Cpath d='M46 112c24 14 51 22 80 24' stroke-width='4'/%3E%3Cpath d='M22 4c-6 22-7 44-2 65' stroke-width='3'/%3E%3Cpath d='M74 136c-16-10-29-23-38-39' stroke-width='3.5'/%3E%3Cpath d='M4 88c14 18 31 33 51 44' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
  --marbling-alpha: 0.07;

  --shadow:    0 1px 2px rgb(36 35 35 / 0.05), 0 4px 14px rgb(36 35 35 / 0.05);
  --shadow-lg: 0 2px 10px rgb(36 35 35 / 0.09), 0 20px 48px rgb(36 35 35 / 0.12);

  --display: "Lilita One", "Arial Black", "Helvetica Neue", Impact, sans-serif;
  --body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-read: var(--body);
  --mono: Menlo, Consolas, ui-monospace, monospace;

  /* Text-size control. 1 is the size the feed was designed at; prefs.js writes the step. */
  --read-scale: 1;

  color-scheme: light dark;
}

/* Dark mode: Ink becomes the ground, Cream becomes the type. */
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) {
    --paper:   #1a1918;
    --card:    #252423;
    --sunken:  #201f1e;
    --border:  #383533;
    --border2: #4a4643;
    --ink:     var(--cream);
    --ink2:    #b8b0a2;
    --ink3:    #8b857c;
    --steak-red: #d9525b;
    --sage:      #9db98a;
    /* Cream at full strength on every card would shout; the seam is
       muted to a warm shadow that still separates rim from face. */
    --fat-cap: #554c40;
    /* Lifted, since the seams sit on Ink rather than on white. */
    --marbling-alpha: 0.14;
    --tint-wash: 0.14;
    --tint-edge: 0.46;
    --tint-glow: 0.30;
    --tint-text: 0.52;
    --shadow:    0 1px 2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 2px 10px rgb(0 0 0 / 0.5), 0 20px 46px rgb(0 0 0 / 0.55);
    color-scheme: dark;
  }
}
:root[data-color-scheme="dark"] {
  --paper:   #1a1918;
  --card:    #252423;
  --sunken:  #201f1e;
  --border:  #383533;
  --border2: #4a4643;
  --ink:     var(--cream);
  --ink2:    #b8b0a2;
  --ink3:    #8b857c;
  --steak-red: #d9525b;
  --sage:      #9db98a;
  --fat-cap: #554c40;
  /* Lifted, since the seams sit on Ink rather than on white. */
  --marbling-alpha: 0.14;
  --tint-wash: 0.14;
  --tint-edge: 0.46;
  --tint-glow: 0.30;
  --tint-text: 0.52;
  --shadow:    0 1px 2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 2px 10px rgb(0 0 0 / 0.5), 0 20px 46px rgb(0 0 0 / 0.55);
  color-scheme: dark;
}

[style*="--h"] { --tint: hsl(var(--h) calc(var(--s) * 1%) calc(var(--l) * 1%)); }

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

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --bleed is the wrap's own horizontal padding, so full-width strips (app bar,
   filter row) can reach the viewport edge with margin-inline: calc(-1 * it). */
:root { --bleed: 16px; --appbar-h: 104px; }
@media (min-width: 768px) { :root { --bleed: 24px; } }

/* The cuts scale up with the card: fixed radii on a 720px card read as a
   slightly-rounded rectangle rather than as a piece of meat. */
@media (min-width: 768px) {
  :root {
    --cut-1: 88px 34px 76px 42px / 56px 78px 45px 64px;
    --cut-2: 37px 82px 40px 78px / 73px 48px 70px 42px;
    --cut-3: 68px 48px 90px 31px / 45px 70px 56px 76px;
    --cut-4: 42px 73px 34px 84px / 64px 42px 78px 48px;
  }
}

/* Scroll lock while a drawer, filter sheet, submit sheet, or streak popover
   is open. The overlay keeps its own scroll; the page behind it does not. */
html:has(body.locked),
body.locked {
  overflow: hidden;
  overscroll-behavior: none;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 var(--bleed) 96px; }

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

.skip-link {
  position: absolute; left: 50%; top: 8px; z-index: 100;
  transform: translate(-50%, -200%);
  padding: 10px 18px; border-radius: var(--pill);
  background: var(--ink); color: var(--cream);
  font-weight: 700; text-decoration: none;
  transition: transform 160ms ease;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* --- App bar -------------------------------------------------------------- */
/* Slim and sticky, so the feed is the first thing on screen. The bar plus the
   tab row is ~104px; the first card is in view immediately at every width. */

.appbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 93%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 2px solid var(--border);
}
.appbar-inner { max-width: 720px; margin: 0 auto; padding: 0 var(--bleed); }

.topbar { display: flex; align-items: center; gap: 10px; height: 58px; }
.brand-mark { flex: 0 0 auto; width: 34px; height: 34px; }

/* BIBLE / MEAT / FEED — Ink, Steak Red, Golden Yellow. */
.wordmark {
  font-family: var(--display);
  font-size: clamp(16px, 4.4vw, 23px);
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  margin-right: auto;
  display: flex; flex-wrap: nowrap; gap: 0 0.22em;
  white-space: nowrap;
  min-width: 0;
}
@media (max-width: 420px) {
  .topbar { gap: 6px; }
  .brand-mark { width: 32px; height: 32px; }
}

.bar-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--border2); background: var(--card);
  color: var(--ink); font-size: 16px; cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.bar-btn:hover { background: var(--sunken); border-color: var(--steak-red); }
.bar-btn svg { width: 19px; height: 19px; }
.bar-btn[aria-expanded="true"] { background: var(--steak-red); border-color: var(--steak-red); color: #fff; }

.search-wrap { position: relative; padding-bottom: 12px; }
.search-wrap input {
  width: 100%; min-height: 44px;
  padding: 10px 52px 10px 16px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--card);
  border: 2px solid var(--border2); border-radius: var(--pill);
}
.search-wrap input::placeholder { color: var(--ink3); }
/* Chrome draws its own blue cancel on type=search. The custom button is the one clear. */
.search-wrap input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.search-wrap input:focus {
  outline: none; border-color: var(--steak-red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--steak-red) 16%, transparent);
}
.search-clear {
  position: absolute; right: 4px; top: 0;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: none; color: var(--ink3);
  font-size: 14px; cursor: pointer;
}
.search-clear:hover { background: var(--sunken); color: var(--ink); }
.wordmark .w-bible { color: var(--ink); }
.wordmark .w-meat  { color: var(--steak-red); }
.wordmark .w-feed  { color: var(--golden-deep); }
/* #d9525b on #1a1918 is 4.43:1. #e95a63 clears 4.5:1 on the dark ground and on a card. */
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .wordmark .w-meat,
  :root:not([data-color-scheme="light"]) .legal-brand .w-meat { color: #e95a63; }
  :root:not([data-color-scheme="light"]) .wordmark .w-feed { color: var(--golden); }
}
:root[data-color-scheme="dark"] .wordmark .w-meat,
:root[data-color-scheme="dark"] .legal-brand .w-meat { color: #e95a63; }
:root[data-color-scheme="dark"] .wordmark .w-feed { color: var(--golden); }

/* --- Nav: underline tabs, per the brand mockup ---------------------------- */

.tab-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.tab-scroll { position: relative; min-width: 0; flex: 1; }

.filter-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto;
  min-height: 44px; height: 44px; padding: 0 12px;
  border-radius: var(--pill);
  border: 2px solid var(--border2);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer;
}
.filter-toggle svg { width: 16px; height: 16px; }
.filter-toggle:hover { border-color: var(--steak-red); }
.filter-toggle[aria-expanded="true"] {
  background: var(--steak-red); border-color: var(--steak-red); color: #fff;
}
.filter-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--pill);
  background: var(--sunken); color: var(--ink);
  border: 1px solid var(--border2);
  font-size: 12px; font-weight: 800; letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.filter-count.is-on { background: var(--steak-red); color: #fff; }
.filter-toggle[aria-expanded="true"] .filter-count { background: #fff; color: var(--steak-red); }
.tab-scroll::before,
.tab-scroll::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 32px;
  pointer-events: none; z-index: 1; opacity: 0;
}
.tab-scroll::before {
  left: 0;
  background: linear-gradient(90deg, var(--paper), transparent);
}
.tab-scroll::after {
  right: 0;
  background: linear-gradient(270deg, var(--paper), transparent);
}
@media (max-width: 1023px) {
  .tab-scroll.can-scroll:not(.at-start)::before { opacity: 1; }
  .tab-scroll.can-scroll:not(.at-end)::after { opacity: 1; }
}

nav {
  display: flex; gap: 4px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: 0 0 auto; min-height: 44px; padding: 11px 14px;
  border: 0; background: none; cursor: pointer;
  font-family: var(--body);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink3); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color 140ms ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--steak-red); }
@media (max-width: 420px) {
  .tab { padding: 11px 10px; letter-spacing: 0.04em; font-size: 12px; }
}
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
  height: 3px; border-radius: 2px 2px 0 0;
  background: var(--steak-red);
}

.freezer-count {
  background: var(--ice); color: #fff;
  border-radius: var(--pill); font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}

section.page { display: none; }
section.page.active { display: block; animation: fade 240ms ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-intro { color: var(--ink2); font-size: calc(14px * var(--read-scale)); margin: 18px 0 16px; max-width: 60ch; }

/* --- Filter sheet and submit card ----------------------------------------- */
/* Collapsed until Filter is pressed. Bottom sheet on phones, popover on desktop. */

.filter-overlay, .submit-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgb(36 35 35 / 0.45);
  display: none;
}
.submit-overlay { z-index: 90; }
.filter-overlay.open, .submit-overlay.open { display: block; }

.filter-sheet, .submit-sheet {
  position: fixed; z-index: 80;
  left: 0; right: 0; bottom: 0;
  max-height: min(85dvh, 720px);
  background: var(--card);
  border-radius: 20px 20px 0 0;
  border-top: 5px solid var(--steak-red);
  box-shadow: 0 -8px 44px rgb(0 0 0 / 0.28);
  display: none; flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.submit-sheet { z-index: 100; max-height: min(92dvh, 820px); }
.filter-sheet.open, .submit-sheet.open {
  display: flex;
  animation: sheet-up 260ms cubic-bezier(.2,.8,.3,1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

@media (min-width: 1024px) {
  .filter-overlay { background: rgb(36 35 35 / 0.18); }
  .filter-sheet {
    left: 16px; right: auto; bottom: auto;
    top: calc(var(--appbar-h) + 8px);
    width: min(400px, calc(100vw - 24px));
    max-height: min(70dvh, 640px);
    border-radius: 18px;
    border: 2px solid var(--border2);
    border-top: 5px solid var(--steak-red);
    padding-bottom: 0;
  }
  .filter-sheet.open { animation: pop-in 160ms ease; }
  .submit-sheet {
    left: max(24px, calc(50% - 280px));
    right: auto; bottom: auto; top: 8vh;
    width: min(560px, calc(100vw - 48px));
    max-height: 84vh;
    border-radius: 18px;
    border: 2px solid var(--border2);
    border-top: 5px solid var(--steak-red);
    padding-bottom: 0;
  }
  .submit-sheet.open { animation: pop-in 160ms ease; }
  @keyframes pop-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

.filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 14px 12px 16px;
  border-bottom: 2px solid var(--border);
}
.filter-title {
  font-family: var(--display); font-size: 20px;
  letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--steak-red);
}
.filter-body {
  overflow-y: auto; padding: 16px;
  flex: 1 1 auto; min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.filter-hint { font-size: 13px; color: var(--ink2); margin-bottom: 14px; }
.filter-sep { height: 2px; background: var(--border); margin: 20px 0 16px; border-radius: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .consent label {
  font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink);
}
.field .opt, .field .req, .consent .opt {
  font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink3);
}
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--sunken);
  border: 2px solid var(--border2); border-radius: 12px;
  padding: 10px 12px; min-height: 44px;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus,
.field input:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--steak-red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--steak-red) 16%, transparent);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"],
.consent input[aria-invalid="true"] { border-color: var(--steak-red); }
.char-count { font-size: 12px; font-weight: 700; color: var(--ink3); text-align: right; }
.char-count.is-max { color: var(--steak-deep); }
.consent {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 4px 0 14px; font-size: 14px; line-height: 1.45;
}
.consent input {
  width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto;
  accent-color: var(--steak-red);
}
.consent label {
  font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--ink2);
}
.consent a { color: var(--steak-red); font-weight: 800; }
.hp {
  position: absolute; left: -10000px; top: auto;
  width: 200px; height: 40px; overflow: hidden;
}
.form-error {
  background: color-mix(in srgb, var(--steak-red) 10%, var(--card));
  border: 2px solid var(--steak-red);
  color: var(--steak-deep);
  border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
}
.form-fallback { margin: 0 0 12px; font-size: 14px; color: var(--ink2); }
.form-fallback a { color: var(--steak-red); font-weight: 800; }
.submit-send {
  width: 100%; min-height: 48px; margin-top: 4px;
  border: 0; border-radius: var(--pill);
  background: var(--steak-red); color: #fff;
  font: inherit; font-size: 15px; font-weight: 800;
  letter-spacing: 0.04em; cursor: pointer;
}
.submit-send:hover { background: var(--steak-deep); }
.submit-send:disabled { opacity: 0.65; cursor: progress; }
.submit-success h3 {
  font-family: var(--display); font-size: 28px;
  text-transform: uppercase; color: var(--steak-red); margin-bottom: 8px;
}
.submit-success p { color: var(--ink2); margin-bottom: 16px; }

/* Milk-first: the one filter that is a mode rather than a topic. */
.milk-toggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; margin-bottom: 16px;
  padding: 10px 14px;
  border: 2px solid color-mix(in srgb, var(--ice) 34%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ice) 7%, var(--card));
  cursor: pointer; text-align: left;
  transition: background 160ms ease, border-color 160ms ease;
}
.milk-toggle:hover { background: color-mix(in srgb, var(--ice) 14%, var(--card)); }
.milk-toggle-icon { font-size: 22px; }
.milk-toggle-label {
  display: block;
  font-family: var(--display); font-size: 15px;
  letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--ice-deep);
}
.milk-toggle-sub { display: block; font-size: 11.5px; color: var(--ink3); }
.milk-toggle-switch {
  margin-left: auto; flex: 0 0 auto;
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--border2); position: relative;
  transition: background 180ms ease;
}
.milk-toggle-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform 180ms cubic-bezier(.2,.8,.3,1);
}
.milk-toggle[aria-pressed="true"] { border-color: var(--ice); background: color-mix(in srgb, var(--ice) 16%, var(--card)); }
.milk-toggle[aria-pressed="true"] .milk-toggle-switch { background: var(--ice); }
.milk-toggle[aria-pressed="true"] .milk-toggle-switch::after { transform: translateX(18px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .milk-toggle-label { color: #8fc3ec; }
}
:root[data-color-scheme="dark"] .milk-toggle-label { color: #8fc3ec; }

/* Stacked, full-width, so long trail names aren't truncated. */
.chips { display: flex; flex-direction: column; gap: 8px; }
.chips .chip { width: 100%; justify-content: space-between; text-align: left; }
.chip-n {
  font-size: 12px; font-weight: 800;
  padding-left: 8px; font-variant-numeric: tabular-nums;
}

/* --- Active-filter note --------------------------------------------------- */

.filter-note {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 4px;
}
.filter-note-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink3);
}
.filter-clear {
  border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--steak-red);
  min-height: 44px; padding: 8px 10px; border-radius: var(--radius);
}
.filter-clear:hover { background: var(--sunken); }

.chip {
  min-height: 44px; padding: 8px 14px;
  border-radius: var(--pill);
  border: 2px solid color-mix(in srgb, var(--tint, var(--border2)) 38%, var(--border));
  background: color-mix(in srgb, var(--tint, transparent) 8%, var(--card));
  /* Darker than the card tint: these labels sit on a pale wash, and a light
     trail (Resurrection gold) missed 4.5:1 at the card mix. */
  color: color-mix(in srgb, var(--tint, var(--ink2)) 55%, var(--ink));
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease;
}
.chip:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--tint, transparent) 16%, var(--card)); }
.chip.on {
  background: var(--tint, var(--steak-red)); border-color: transparent;
  color: var(--on-tint, #fff);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--tint, var(--steak-red)) 40%, transparent);
}
/* Paper, not Cream: --ink flips to Cream in dark mode, so a hard-coded Cream
   label went invisible against it. --paper flips the opposite way. */
.chip.all.on {
  background: var(--ink); color: var(--paper);
  box-shadow: 0 3px 12px rgb(36 35 35 / 0.3);
}

/* --- Cards ---------------------------------------------------------------- */

/* Wider than before: the cuts are uneven, so they need air between them
   or two neighbouring curves read as one shape. */
.feed { display: flex; flex-direction: column; gap: 18px; }

/* Render virtualisation: off-screen cards skip layout and paint entirely, so a
   600-card feed costs about what a one-screen feed costs. Nodes stay in the DOM,
   so scrolling back up still works — unlike node recycling, which would need a
   spacer and would lose anything above it. contain-intrinsic-size keeps the
   scrollbar honest for cards that have not been rendered yet. */
.feed .card {
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}

#sentinel { height: 1px; }

.feed-end { text-align: center; padding: 32px 16px 8px; color: var(--ink2); }
.feed-end p { margin-bottom: 14px; font-size: 14px; }

/* A card is a cut of meat, built the way the mark is: an uneven outline, a
   marbled face, a rim in the trail's color, and a cream fat cap seamed just
   inside the rim.

   The rim and the cap are two stacked inset shadows rather than a nested
   element. An inset shadow follows border-radius exactly, so the seam tracks
   all four different corner curves for free — a ::after ring would need a
   second set of radii, hand-derived from the first and re-derived on every
   change. The card-colored ring is painted first and covers the outer 4px of
   the cap ring underneath it, leaving the 2px seam. */
.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  background:
    linear-gradient(152deg, color-mix(in srgb, var(--tint) calc(var(--tint-wash) * 190%), transparent), transparent 58%),
    var(--card);
  border: 2px solid color-mix(in srgb, var(--tint) calc(var(--tint-edge) * 128%), var(--border2));
  border-radius: var(--cut-1);
  /* Room for the seam (6px) on top of the usual gutter, and enough at the
     bottom that the deepest corner curve never crowds the action row. */
  padding: 22px 24px 20px 24px;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 4px var(--card),
    inset 0 0 0 6px var(--fat-cap),
    var(--shadow);
  transition: transform 160ms cubic-bezier(.2,.8,.3,1), box-shadow 200ms ease;
  /* Height follows the verse, summary, and actions. The feed is the only scroll. */
  scroll-margin-top: calc(var(--appbar-h) + 12px);
}

/* Marbling, seamed into two opposite corners of the face. Inset past the fat
   cap so the seams sit in the meat rather than crossing the rim, and clipped to
   the cut by the card's own overflow. */
.card::before {
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  background: var(--steak-red);
  opacity: var(--marbling-alpha);
  -webkit-mask-image: var(--marbling-a), var(--marbling-b);
  -webkit-mask-position: top right, bottom left;
  -webkit-mask-repeat: no-repeat;
  mask-image: var(--marbling-a), var(--marbling-b);
  mask-position: top right, bottom left;
  mask-repeat: no-repeat;
}

/* Deal the four cuts round-robin. nth-of-type counts <article> only, so the
   feed's sentinel and end-cap do not shift the sequence. */
.card:nth-of-type(4n+2) { border-radius: var(--cut-2); }
.card:nth-of-type(4n+3) { border-radius: var(--cut-3); }
.card:nth-of-type(4n+4) { border-radius: var(--cut-4); }

.card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 4px var(--card),
    inset 0 0 0 6px var(--fat-cap),
    var(--shadow-lg), 0 14px 36px color-mix(in srgb, var(--tint) calc(var(--tint-glow) * 100%), transparent);
}
.card:focus-visible { outline: 3px solid var(--tint); outline-offset: 3px; }

/* Glyph and reference on one row, score pushed right. */
.card-top { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }

/* The circular scripture glyph from the mockup's card avatar. */
.card-glyph {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint);
}
.card-glyph svg { width: 21px; height: 21px; }

.ref {
  font-family: var(--body);
  font-weight: 800; font-size: 15px;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 78%), var(--ink));
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-right: auto; min-width: 0;
}
.ref-btn {
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  background: none; border: 0; padding: 4px 0; margin: 0;
  cursor: pointer; text-align: left; min-height: 44px;
}

.milk {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--ice) 14%, transparent);
  color: var(--ice-deep);
  border: 1px solid color-mix(in srgb, var(--ice) 38%, transparent);
  white-space: nowrap; text-transform: uppercase;
}

.score {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 12%, var(--sunken));
  white-space: nowrap;
}
.score-bars { display: inline-flex; gap: 2px; }
.score-bars i { width: 4px; height: 13px; border-radius: 2px; background: color-mix(in srgb, var(--ink3) 30%, transparent); }
.score-bars i.on { background: var(--tint); }
.score-num {
  font-family: var(--display); font-size: 13px; letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
}

/* The scripture itself — the reason the card exists, so it gets the size. */
.verse {
  margin-top: 14px;
  font-family: var(--font-read);
  font-size: calc(clamp(19px, 3.4vw, 23px) * var(--read-scale));
  line-height: 1.48;
  color: var(--ink);
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.verse::before { content: "“"; }
.verse::after { content: "”"; }

.verse .v sup, .passage .v sup, .chapter .v sup, .orig-full .ov sup {
  font-size: 0.58em; font-weight: 800; vertical-align: super;
  color: color-mix(in srgb, var(--tint, var(--ink3)) 70%, var(--ink3));
  margin-right: 2px; line-height: 0;
}

.verse-src {
  margin-top: 8px;
  flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink3);
}

.card-trails { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.mini {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
  border: 1px solid color-mix(in srgb, var(--tint) 26%, transparent);
  white-space: nowrap;
}

/* --- Brand actions: FREEZE IT / CHEW ON THIS / PASS THE PLATE -------------- */

.actions {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  flex-shrink: 0;
}

.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 60px; padding: 8px 4px;
  border: 0; border-radius: var(--radius); background: none;
  cursor: pointer; text-align: center;
  transition: background 140ms ease, transform 120ms ease;
}
.act:hover { background: var(--sunken); transform: translateY(-1px); }
.act svg { width: 22px; height: 22px; }
.act-label {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink);
  text-wrap: balance;
}
.act-sub {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink3);
}

.act-freeze svg { color: var(--ice); }
.act-chew   svg { color: var(--golden-deep); }
.act-pass   svg { color: var(--sage-deep); }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .act-chew svg { color: var(--golden); }
  :root:not([data-color-scheme="light"]) .act-pass svg { color: var(--sage); }
}
:root[data-color-scheme="dark"] .act-chew svg { color: var(--golden); }
:root[data-color-scheme="dark"] .act-pass svg { color: var(--sage); }

/* Frozen state: the card is in the Freezer. */
.act-freeze[aria-pressed="true"] { background: color-mix(in srgb, var(--ice) 13%, transparent); }
.act-freeze[aria-pressed="true"] .act-label { color: var(--ice-deep); }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .act-freeze[aria-pressed="true"] .act-label { color: #8fc3ec; }
}
:root[data-color-scheme="dark"] .act-freeze[aria-pressed="true"] .act-label { color: #8fc3ec; }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .milk { color: #8fc3ec; }
}
:root[data-color-scheme="dark"] .milk { color: #8fc3ec; }

.empty {
  background: var(--card); border: 2px dashed var(--border2);
  border-radius: var(--cut-2); padding: 40px 22px;
  text-align: center; color: var(--ink2);
}
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; }

/* --- Drawer --------------------------------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(36 35 35 / 0.55);
  backdrop-filter: blur(3px);
  display: none;
}
.overlay.open { display: block; }

.drawer {
  position: fixed; z-index: 70;
  left: 0; right: 0; bottom: 0; top: 7%;
  background: var(--card);
  display: none; flex-direction: column;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 44px rgb(0 0 0 / 0.3);
  border-top: 5px solid var(--tint, var(--steak-red));
}
.drawer.open { display: flex; animation: chew-open 420ms cubic-bezier(.2,.9,.25,1); }

/* The sheet arrives with a chew: two quick bites before it settles. */
@keyframes chew-open {
  0%   { transform: translateY(10%) scaleY(0.96); opacity: 0; }
  45%  { transform: translateY(-1.2%) scaleY(1.015); opacity: 1; }
  70%  { transform: translateY(0.8%) scaleY(0.994); }
  100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

/* A bite mark out of the top edge, so opening reads as "chewing on the meat". */
.drawer::before {
  content: "";
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 116px; height: 15px;
  background: var(--paper);
  border-radius: 0 0 60px 60px / 0 0 22px 22px;
  box-shadow: inset 0 -3px 0 var(--tint, var(--steak-red));
  z-index: 2;
}
.drawer::after {
  content: "";
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--tint, var(--steak-red)) 40%, var(--border2));
  z-index: 2;
}

@media (min-width: 768px) {
  .drawer { left: 50%; right: auto; top: 6%; bottom: 6%; width: 660px; transform: translateX(-50%); border-radius: 20px; }
  /* The centred sheet keeps the chew, just smaller — it is not sliding up from
     the bottom edge, so a big bounce would look wrong. */
  .drawer.open { animation: chew-open-sm 320ms cubic-bezier(.2,.9,.25,1); }
  @keyframes chew-open-sm {
    0%   { transform: translateX(-50%) translateY(1.5%) scaleY(0.985); opacity: 0; }
    55%  { transform: translateX(-50%) translateY(-0.4%) scaleY(1.006); opacity: 1; }
    100% { transform: translateX(-50%) translateY(0) scaleY(1); opacity: 1; }
  }
}

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  /* Extra top padding clears the bite mark and grab handle. */
  padding: 34px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(152deg, color-mix(in srgb, var(--tint) calc(var(--tint-wash) * 230%), transparent), transparent 70%);
}
.drawer-head .ref { font-size: 17px; }
.drawer-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.close {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border2); background: var(--sunken);
  color: var(--ink); font-size: 17px; line-height: 1; cursor: pointer;
}
.close:hover { background: var(--card); border-color: var(--steak-red); }

.drawer-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px 32px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.dsec { margin-bottom: 24px; }
.dsec h3 {
  font-family: var(--display);
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 10px;
}

.passage {
  background: color-mix(in srgb, var(--tint) 7%, var(--sunken));
  border-left: 5px solid var(--tint);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 20px; font-size: calc(17px * var(--read-scale)); line-height: 1.62;
}
.passage .src { display: block; margin-top: 12px; font-size: 12px; color: var(--ink3); }

.langbox {
  background: color-mix(in srgb, var(--tint) 11%, var(--card));
  border: 2px solid color-mix(in srgb, var(--tint) 32%, transparent);
  border-radius: var(--radius); padding: 16px 18px;
}
.langbox .orig { font-size: 27px; line-height: 1.4; margin-bottom: 8px; color: color-mix(in srgb, var(--tint) 80%, var(--ink)); }
.langbox .say { font-size: 15px; margin-bottom: 6px; }
.langbox .say b { color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink)); }
.langbox .meaning { font-size: calc(14px * var(--read-scale)); color: var(--ink2); }

.comm {
  border: 1px solid var(--border);
  border-left: 4px solid color-mix(in srgb, var(--tint) 55%, transparent);
  border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 8px;
  font-size: calc(14px * var(--read-scale)); color: var(--ink2);
}
.comm b {
  display: block; margin-bottom: 3px; font-size: 13px;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 90%), var(--ink));
}

.comm-note {
  margin-top: 10px; font-size: 12px; font-style: italic;
  color: var(--ink3); line-height: 1.45;
}

.xrefs, .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.xref {
  min-height: 44px; padding: 8px 13px; border-radius: var(--pill);
  background: var(--sunken); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--ink3); cursor: default;
}
.xref.linked {
  background: color-mix(in srgb, var(--tint) 11%, var(--card));
  border-color: color-mix(in srgb, var(--tint) 42%, transparent);
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
  cursor: pointer;
}
.xref.linked:hover { background: color-mix(in srgb, var(--tint) 22%, var(--card)); }

.tagpill {
  padding: 7px 13px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 30%, transparent);
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.tagpill:hover { background: color-mix(in srgb, var(--tint) 25%, transparent); }

.drawer-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.drawer-actions .act { border: 2px solid var(--border); }

/* --- Expandable scripture / chapter --------------------------------------- */

.passage-verses .v, .chapter .v { display: inline; }

.expand {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin-top: 12px; min-height: 46px;
  padding: 11px 14px;
  border: 2px solid color-mix(in srgb, var(--tint) 34%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tint) 7%, var(--card));
  cursor: pointer; text-align: left;
  transition: background 160ms ease, border-color 160ms ease;
}
.expand:hover { background: color-mix(in srgb, var(--tint) 15%, var(--card)); }
.expand-label {
  font-family: var(--display); font-size: 14px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
}
.expand-sub { font-size: 12px; color: var(--ink3); margin-right: auto; }
.expand-caret {
  font-size: 13px; color: var(--ink3);
  transition: transform 200ms ease;
}
.expand[aria-expanded="true"] .expand-caret { transform: rotate(180deg); }

.chapter {
  margin-top: 12px;
  border: 2px solid color-mix(in srgb, var(--tint) 26%, var(--border));
  border-radius: var(--radius);
  background: var(--sunken);
  overflow: hidden;
  animation: unfurl 320ms cubic-bezier(.2,.8,.3,1);
}
@keyframes unfurl { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.chapter-head {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--tint) 22%, var(--border));
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
}
.chapter-body {
  max-height: 46vh; overflow-y: auto;
  padding: 16px 16px 18px;
  font-family: var(--font-read);
  font-size: calc(16px * var(--read-scale)); line-height: 1.7; color: var(--ink2);
}
/* The verses this card is actually about, highlighted inside the chapter. */
.chapter-body .v.is-card {
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--ink);
  border-radius: 4px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 16%, transparent);
}

/* --- Original language ---------------------------------------------------- */

.orig-full {
  font-size: calc(21px * var(--read-scale)); line-height: 1.85;
  color: color-mix(in srgb, var(--tint) 72%, var(--ink));
  margin-bottom: 10px;
}
.orig-full[dir="rtl"] { font-size: 23px; line-height: 2; }
.orig-src {
  font-size: 11px; color: var(--ink3);
  padding-bottom: 12px;
  border-bottom: 1px dashed color-mix(in srgb, var(--tint) 26%, var(--border));
  margin-bottom: 12px;
}
.keyword .orig { font-size: 22px; }

/* --- Expandable commentary ------------------------------------------------ */

.comm-body {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.comm.is-long { cursor: pointer; padding-bottom: 26px; }
.comm.is-long::after {
  content: "Read more ▾";
  position: absolute; right: 14px; bottom: 8px;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 100%), var(--ink));
}
.comm.is-long { position: relative; }
.comm.is-quote { border-left-color: var(--tint); }
.comm-tag {
  display: inline-block; margin-left: 8px;
  padding: 1px 7px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 34%, transparent);
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.07em; text-transform: uppercase;
  vertical-align: 1px;
}
.comm-src { margin-top: 8px; font-size: 11px; color: var(--ink3); }
.comm-src a { color: inherit; }
.comm-note .mono { font-family: var(--mono); font-size: 0.92em; }
.comm.is-open .comm-body { -webkit-line-clamp: unset; }
.comm.is-open::after { content: "Less ▴"; }

/* --- Trails --------------------------------------------------------------- */

.trail {
  position: relative; overflow: hidden;
  background:
    linear-gradient(152deg, color-mix(in srgb, var(--tint) calc(var(--tint-wash) * 190%), transparent), transparent 58%),
    var(--card);
  border: 1px solid color-mix(in srgb, var(--tint) calc(var(--tint-edge) * 100%), var(--border));
  border-radius: var(--radius-lg);
  padding: 18px 18px 18px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 200ms ease;
}
.trail::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 6px;
  background: linear-gradient(180deg, var(--tint), color-mix(in srgb, var(--tint) 40%, transparent));
}
.trail:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 14px 34px color-mix(in srgb, var(--tint) calc(var(--tint-glow) * 100%), transparent);
}
.trail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.trail-name {
  font-family: var(--display); font-size: 19px; letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 82%), var(--ink));
}
.trail-count {
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink3);
  padding: 4px 10px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 11%, var(--sunken));
}
.trail-desc { margin-top: 8px; font-size: calc(14.5px * var(--read-scale)); color: var(--ink2); }
.subs { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 6px; }
.sub {
  font-size: 12px; padding: 4px 11px; border-radius: var(--pill);
  background: color-mix(in srgb, var(--tint) 10%, var(--sunken));
  border: 1px solid color-mix(in srgb, var(--tint) 20%, transparent);
  color: var(--ink2);
}
.trail-btn {
  margin-top: 16px; min-height: 46px; padding: 10px 18px;
  border-radius: var(--radius); border: 0;
  background: var(--tint); color: var(--on-tint, #fff);
  font-family: var(--display); font-size: 14px; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: pointer;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--tint) 38%, transparent);
  transition: transform 120ms ease, box-shadow 160ms ease;
}
.trail-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--tint) 50%, transparent); }
.trail-soon { margin-top: 16px; font-size: 13px; font-style: italic; color: var(--ink3); }

/* --- Basics --------------------------------------------------------------- */

.basics-card {
  background:
    linear-gradient(152deg, color-mix(in srgb, var(--tint) calc(var(--tint-wash) * 170%), transparent), transparent 55%),
    var(--card);
  border: 1px solid color-mix(in srgb, var(--tint) calc(var(--tint-edge) * 80%), var(--border));
  border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.basics-card h3 {
  font-family: var(--display); font-size: 20px; margin-bottom: 6px;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 76%), var(--ink));
}
.basics-card .note { font-size: calc(14px * var(--read-scale)); color: var(--ink2); margin-bottom: 14px; }

.tblwrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800;
  color: color-mix(in srgb, var(--tint) calc(var(--tint-text) * 92%), var(--ink));
  border-bottom: 2px solid color-mix(in srgb, var(--tint) 38%, var(--border));
}
tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--tint) 5%, transparent); }
td.gl { font-size: 22px; color: color-mix(in srgb, var(--tint) 72%, var(--ink)); }
@media (max-width: 480px) {
  table { font-size: 12.5px; }
  th, td { padding: 8px 5px; }
  td.gl { font-size: 18px; }
}

/* --- Action motion -------------------------------------------------------- */
/* One gesture per brand verb. All of it is transform/opacity so it stays cheap,
   and all of it is switched off under prefers-reduced-motion (see the bottom). */

/* FREEZE IT — the button frosts over and the flake shivers. */
@keyframes frost {
  0%   { background: transparent; }
  35%  { background: color-mix(in srgb, var(--ice) 28%, transparent); }
  100% { background: color-mix(in srgb, var(--ice) 13%, transparent); }
}
@keyframes shiver {
  0%   { transform: scale(1) rotate(0deg); }
  25%  { transform: scale(1.35) rotate(-18deg); }
  50%  { transform: scale(1.25) rotate(14deg); }
  75%  { transform: scale(1.3) rotate(-8deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.act.is-freezing { animation: frost 700ms ease forwards; }
.act.is-freezing svg { animation: shiver 700ms cubic-bezier(.2,.8,.3,1); }

/* CHEW ON THIS — the icon works like a jaw. */
@keyframes chomp {
  0%   { transform: scaleY(1) translateY(0); }
  20%  { transform: scaleY(0.55) translateY(2px); }
  40%  { transform: scaleY(1.12) translateY(-2px); }
  60%  { transform: scaleY(0.7) translateY(1px); }
  80%  { transform: scaleY(1.06) translateY(-1px); }
  100% { transform: scaleY(1) translateY(0); }
}
.act.is-chewing svg { animation: chomp 460ms cubic-bezier(.3,.7,.3,1); transform-origin: 50% 70%; }
.act.is-chewing .act-label { animation: nudge 460ms ease; }
@keyframes nudge { 50% { letter-spacing: 0.12em; } }

/* PASS THE PLATE — the plate slides away and a fresh one arrives. */
@keyframes slide-off {
  0%   { transform: translateX(0); opacity: 1; }
  55%  { transform: translateX(22px); opacity: 0; }
  56%  { transform: translateX(-18px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.act.is-passing svg { animation: slide-off 620ms cubic-bezier(.3,.7,.3,1); }

/* The glyph that flies from the button to the Freezer tab (or off-screen). */
.fly {
  position: fixed; z-index: 95;
  font-size: 22px; line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: fly-to 850ms cubic-bezier(.35,.1,.25,1) forwards;
}
@keyframes fly-to {
  0%   { transform: translate(-50%, -50%) scale(0.6) rotate(0deg); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1.5) rotate(-15deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.5) rotate(220deg); opacity: 0; }
}

/* The Freezer tab count pops when something lands in it. */
@keyframes count-pop { 50% { transform: scale(1.45); } }
.freezer-count.is-bumped { animation: count-pop 420ms cubic-bezier(.2,.8,.3,1); }

/* --- Swipe ---------------------------------------------------------------- */
/* Right = Freeze it, left = Pass the plate. The card tracks the finger and a
   hint fades in behind it so the gesture is discoverable mid-swipe. */

.card { touch-action: pan-y; }
.card.is-swiping { transition: none; user-select: none; }
.card.is-snapping { transition: transform 260ms cubic-bezier(.2,.8,.3,1); }

.swipe-hint {
  position: absolute; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 108px; padding: 0 10px;
  opacity: 0; pointer-events: none;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  text-align: center;
}
.swipe-hint svg { width: 26px; height: 26px; }
.swipe-hint--freeze { left: 0; color: var(--ice-deep); background: linear-gradient(90deg, color-mix(in srgb, var(--ice) 26%, transparent), transparent); }
.swipe-hint--pass { right: 0; color: var(--sage-deep); background: linear-gradient(270deg, color-mix(in srgb, var(--sage) 30%, transparent), transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) .swipe-hint--freeze { color: #8fc3ec; }
  :root:not([data-color-scheme="light"]) .swipe-hint--pass { color: var(--sage); }
}
:root[data-color-scheme="dark"] .swipe-hint--freeze { color: #8fc3ec; }
:root[data-color-scheme="dark"] .swipe-hint--pass { color: var(--sage); }

/* --- Audio ---------------------------------------------------------------- */

.speak {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--tint) 30%, var(--border));
  background: var(--card); color: color-mix(in srgb, var(--tint) 72%, var(--ink));
  cursor: pointer;
  transition: background 140ms ease, transform 120ms ease;
}
.speak:hover { background: color-mix(in srgb, var(--tint) 14%, var(--card)); }
.speak svg { width: 17px; height: 17px; }
.speak.is-speaking { background: var(--tint); color: var(--on-tint, #fff); border-color: transparent; }
.speak.is-speaking svg { animation: pulse-speak 900ms ease-in-out infinite; }
@keyframes pulse-speak { 50% { transform: scale(1.18); } }

.dsec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dsec-head h3 { margin-bottom: 0; }
.dsec-head .speak { margin-left: auto; }

/* --- Toast ---------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; top: calc(var(--appbar-h) + 10px);
  transform: translate(-50%, -8px);
  background: var(--ink); color: var(--cream);
  padding: 12px 18px;
  border-radius: var(--pill);
  font-size: 14px; font-weight: 700;
  border: 2px solid var(--golden);
  box-shadow: 0 8px 28px rgb(36 35 35 / 0.4);
  z-index: 120; opacity: 0; pointer-events: none;
  max-width: min(92vw, 420px); text-align: center;
  transition: opacity 220ms ease, transform 220ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* While the phone sheet is open, sit the toast on the dimmed app bar so it
   does not cover the passage or the original-language line. */
@media (max-width: 1023px) {
  body.drawer-open .toast { top: 8px; bottom: auto; }
}

/* --- Motion --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card:hover, .trail:hover, .act:hover, .trail-btn:hover { transform: none; }
}

/* Wide layout already places .search-wrap on its own row. Keep the field open
   there and hide the icon that only matters on a phone. */
@media (min-width: 1024px) {
  #searchToggle { display: none; }
}

/* --- Menu: search, scheme, text size -------------------------------------- */
.menu-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink3); margin: 0 0 8px;
}
.menu-search {
  width: 100%; min-height: 48px; margin-bottom: 16px;
  padding: 10px 14px;
  border: 2px solid var(--border2); border-radius: var(--pill);
  background: var(--sunken); color: var(--ink);
  font: inherit; font-weight: 800; font-size: 15px;
  text-align: left; cursor: pointer;
}
.menu-search:hover { border-color: var(--steak-red); }
.menu-body .menu-hint a { color: var(--ink); font-weight: 800; text-underline-offset: 2px; }

.seg {
  display: flex; margin-bottom: 16px;
  border: 2px solid var(--border2); border-radius: var(--pill); overflow: hidden;
}
.seg button {
  flex: 1 1 0; min-height: 44px; padding: 8px 10px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.seg button + button { border-left: 2px solid var(--border2); }
.seg button[aria-pressed="true"] { background: var(--steak-deep); color: #fff; }
.seg button:disabled { cursor: default; }

.text-size {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.text-size button {
  min-width: 48px; min-height: 44px; padding: 0 12px;
  border: 2px solid var(--border2); border-radius: var(--pill);
  background: var(--card); color: var(--ink);
  font-family: var(--display); font-size: 18px; cursor: pointer;
}
.text-size button:hover { border-color: var(--steak-red); }
.text-size button:disabled { opacity: 0.4; cursor: default; }
#textSizeLabel {
  flex: 1 1 auto; text-align: center;
  font-size: 13px; font-weight: 800; color: var(--ink2);
}

.text-btn {
  border: 0; background: none; cursor: pointer;
  min-height: 44px; padding: 8px 4px;
  font: inherit; font-size: 13px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
}
.text-btn:hover { color: var(--steak-red); }

/* --- Ate today / streak ---------------------------------------------------- */
.streak-btn { width: auto; min-width: 40px; padding: 0 9px; gap: 3px; border-radius: var(--pill); display: inline-flex; }
.streak-btn .flame { width: 18px; height: 18px; color: var(--steak-red); }
#streakCount {
  font-family: var(--display); font-size: 15px; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums; color: var(--ink);
}

.ate-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 16px;
  border: 2px solid var(--border2); border-radius: var(--pill);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.ate-btn[aria-pressed="true"] {
  border-color: var(--steak-deep); background: var(--steak-deep); color: #fff;
}

#streakLayer[hidden] { display: none; }
#streakLayer {
  position: fixed; inset: 0; z-index: 85;
}
.streak-backdrop { position: absolute; inset: 0; background: rgb(36 35 35 / 0.45); }
.streak-pop {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  background: var(--card); color: var(--ink);
  border: 2px solid var(--border2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 8px 16px 18px;
}
.streak-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.streak-pop h2 {
  font-family: var(--display); font-size: 20px; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--ink);
}
.streak-lead {
  font-family: var(--display); font-size: calc(28px * var(--read-scale));
  line-height: 1.15; margin: 4px 0 2px; color: var(--ink);
}
.streak-best { font-size: calc(15px * var(--read-scale)); font-weight: 700; color: var(--ink2); margin-bottom: 12px; }
.streak-note { font-size: calc(14px * var(--read-scale)); color: var(--ink2); margin: 12px 0; }
.streak-week {
  list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin: 0 0 14px;
}
.streak-week li {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800; color: var(--ink3);
}
.streak-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border2); background: transparent;
}
.streak-week li.is-on .streak-dot { background: var(--steak-deep); border-color: var(--steak-deep); }
.streak-week li.is-today .streak-dow { color: var(--ink); }

.drawer-tools { margin-bottom: 14px; }
.drawer-tools .ate-btn { margin-top: 10px; }

/* --- Plans ----------------------------------------------------------------- */
.plan, .plan-detail {
  background: var(--card);
  border: 2px solid color-mix(in srgb, var(--tint, var(--steak-red)) 35%, var(--border2));
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.plan h2, .plan-detail h2 {
  font-family: var(--display); font-size: calc(22px * var(--read-scale));
  letter-spacing: 0.02em; color: var(--ink); margin-bottom: 6px;
}
.plan-blurb, .plan-pace, .plan-status {
  font-size: calc(14.5px * var(--read-scale)); color: var(--ink2); margin-bottom: 12px;
}
.plan-meta { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; }
.plan-bar {
  height: 8px; border-radius: var(--pill); background: var(--sunken);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 12px;
}
.plan-bar > span { display: block; height: 100%; background: var(--steak-red); }
.plan-kicker {
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink); margin: 8px 0;
}
.plan-steps { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.plan-step-open {
  width: 100%; min-height: 48px; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--ink); cursor: pointer; font: inherit;
}
.plan-step.is-done .plan-step-open { border-color: color-mix(in srgb, var(--sage-deep) 55%, var(--border)); }
.plan-step.is-current .plan-step-open { border-color: var(--steak-deep); }
.plan-step-n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sunken); font-size: 12px; font-weight: 800;
}
.plan-step.is-done .plan-step-n { background: var(--sage-deep); color: #fff; }
.plan-step.is-current .plan-step-n { background: var(--steak-deep); color: #fff; }
.plan-step-ref { display: block; font-weight: 800; font-size: 14px; }
.plan-step-note { display: block; font-size: calc(13px * var(--read-scale)); color: var(--ink2); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-reset { margin-top: 8px; }
.plan-reset p { font-size: calc(14px * var(--read-scale)); color: var(--ink2); margin-bottom: 8px; }


.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* A class that sets display (the filter note is flex) would otherwise
   paint an element the script has marked hidden. */
[hidden] { display: none !important; }

/* --- Footer, menu legal, wide layout -------------------------------------- */

.filter-links, .feed-end-legal {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-size: 14px; font-weight: 700;
}
.filter-links {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--border);
  background: var(--card);
}
.filter-links a, .feed-end-legal a, .site-foot a {
  color: var(--steak-red);
  min-width: 44px;
  min-height: 44px;
  padding: 10px 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.feed-end-legal { justify-content: center; margin-top: 16px; }
.site-foot {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  margin-top: 28px; padding-top: 16px;
  border-top: 2px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--ink2);
}
/* The feed is endless, so a footer under it would jump as cards load. */
body:has(#page-feed.active) .site-foot { display: none; }

/* Tablet: two columns. Filters stay in the sheet. */
@media (min-width: 768px) {
  .wrap, .appbar-inner { max-width: 960px; }
  .feed, #trailList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    align-items: start;
    gap: 18px;
  }
  .trail { margin-bottom: 0; }
  .feed .card { min-width: 0; }
}

/* Desktop: header beside the tabs, Chew on this as a side panel.
   Filters stay in the popover, not a rail. */
@media (min-width: 1024px) {
  :root { --appbar-h: 72px; --drawer-w: min(520px, 42vw); }

  .wrap {
    max-width: 1200px;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
  }
  .appbar-inner {
    max-width: none;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "top tabs" "search search";
    align-items: center;
    column-gap: 18px;
  }
  .topbar { grid-area: top; }
  .tab-row { grid-area: tabs; justify-content: flex-end; }
  .appbar nav { justify-content: flex-end; }
  .search-wrap { grid-area: search; }

  body.drawer-open .wrap {
    width: calc(100% - var(--drawer-w));
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .drawer {
    top: var(--appbar-h);
    right: 0;
    left: auto;
    bottom: 0;
    width: var(--drawer-w);
    transform: none;
    border-radius: 0;
    border-top: 0;
    border-left: 5px solid var(--tint, var(--steak-red));
  }
  .drawer.open { animation: drawer-slide 280ms cubic-bezier(.2,.8,.3,1); }
  .drawer::before, .drawer::after { display: none; }
  .drawer-head { padding-top: 16px; }
  @keyframes drawer-slide {
    from { transform: translateX(28px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
}

/* --- Privacy and Terms ---------------------------------------------------- */

.legal {
  max-width: 68ch;
  margin: 0 auto;
  padding: 28px var(--bleed) 72px;
}
.legal-top {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.legal-top img { width: 44px; height: 44px; }
.legal-brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}
.legal-brand .w-meat { color: var(--steak-red); }
.legal-brand .w-feed { color: var(--golden-deep); }
.legal h1 {
  font-family: var(--display);
  font-size: calc(clamp(28px, 5vw, 40px) * var(--read-scale));
  line-height: 1.05;
  text-transform: uppercase;
  margin: 12px 0 8px;
}
.legal .effective { color: var(--ink3); font-size: calc(14px * var(--read-scale)); font-weight: 700; margin-bottom: 18px; }
.legal h2 {
  font-family: var(--display);
  font-size: calc(18px * var(--read-scale));
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 22px 0 8px;
}
.legal p, .legal li { font-size: calc(16px * var(--read-scale)); line-height: 1.55; color: var(--ink2); margin-bottom: 10px; }
.legal ul { padding-left: 1.2em; margin: 0 0 12px; }
.legal a { color: var(--steak-red); }
.legal code {
  font-family: var(--mono); font-size: 0.9em;
  padding: 1px 5px; border-radius: 4px;
  background: var(--sunken); color: var(--ink);
  border: 1px solid var(--border);
}
.legal table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.legal th, .legal td {
  text-align: left; vertical-align: top;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-size: calc(15px * var(--read-scale)); color: var(--ink2);
}
.legal th {
  font-size: calc(12px * var(--read-scale)); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); font-weight: 800;
}
.legal-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; }
