/* Kan Sipur Teachers' Resource (v3.1). The Kan Sipur brand: navy ink and hoopoe teal on a cool, lightly
   teal-tinted mist with white cards. Warmth comes from the bird itself (its peach crest) and small copper
   and sand accents. Rubik headings, Nunito Sans text, Narkisim for Hebrew. */
:root {
  --navy: #0e3445;
  --navy-2: #12465b;
  --teal: #0b7584;          /* AA on mist and white */
  --teal-bright: #0e8798;   /* logo teal, for fills */
  --teal-light: #4cc6d6;    /* on navy */
  --brown: #a14f28;         /* copper, for small labels and rules (AA on mist) */
  --peach: #f5c9a6;         /* from the hoopoe's crest, decoration only */
  --sand: #fbf1e6;

  --bg: #f3f7f8;
  --bg-band: #e6f0f2;
  --surface: #ffffff;
  --surface-2: #edf3f5;
  --ink: #0e3445;           /* headings */
  --text: #1e2b31;          /* body */
  --text-soft: #3d4d55;
  --muted: #56666e;
  --link: #0b7584;
  --accent-soft: #dcefef;
  --hal-bg: #fbf1e6;
  --line: rgba(14, 52, 69, .12);
  --line-strong: rgba(14, 52, 69, .26);
  --focus: #1f6fd1;
  --mark: #fde3a0;
  --on-dark: #f7fbfc;
  --on-dark-soft: #c9dbe0;
  --hero-a: #0e3445;
  --hero-b: #0b5361;
  --shadow: 0 1px 2px rgba(14, 52, 69, .06), 0 10px 30px rgba(14, 52, 69, .09);
  --radius: 16px;
  --head: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Narkisim where the reader has it (Windows Hebrew fonts), else Noto Serif Hebrew, a classic sefer-style face. */
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e3445' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --hebrew: "Narkisim", "Narkis Tam", "Noto Serif Hebrew", "Frank Ruhl Libre", "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cfe3e8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --teal: #4cc6d6; --brown: #f0a77a; --peach: #f0b98f; --sand: #2a211a;
    --bg: #09171e; --bg-band: #0d212a; --surface: #10252f; --surface-2: #16303b;
    --ink: #eef5f6; --text: #e3ebee; --text-soft: #c4d2d7; --muted: #9fb2b9; --link: #6fd3e0; --accent-soft: #123e49;
    --hal-bg: #2a211a; --line: rgba(227, 235, 238, .12); --line-strong: rgba(227, 235, 238, .26);
    --focus: #8cb8ff; --mark: #5c4a1a; --hero-a: #061219; --hero-b: #0a3a46;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cfe3e8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --teal: #4cc6d6; --brown: #f0a77a; --peach: #f0b98f; --sand: #2a211a;
  --bg: #09171e; --bg-band: #0d212a; --surface: #10252f; --surface-2: #16303b;
  --ink: #eef5f6; --text: #e3ebee; --text-soft: #c4d2d7; --muted: #9fb2b9; --link: #6fd3e0; --accent-soft: #123e49;
  --hal-bg: #2a211a; --line: rgba(227, 235, 238, .12); --line-strong: rgba(227, 235, 238, .26);
  --focus: #8cb8ff; --mark: #5c4a1a; --hero-a: #061219; --hero-b: #0a3a46;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--sans); overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; padding-bottom: 72px; }
main:focus, main:focus-visible { outline: none; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; text-wrap: balance; color: var(--ink); letter-spacing: -.012em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.8rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.75rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
.eyebrow, .kicker, .intro, .hero-lead, .sec-intro, .section-head p, .story-syn, .story-src, .page-head p, .help, .card-msg, .entry p, .row-desc { text-wrap: balance; }
a { color: var(--link); text-underline-offset: 3px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg use { stroke: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
[lang="he"] { font-family: var(--hebrew); }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 800px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.rule { display: block; width: 40px; height: 3px; background: var(--brown); border-radius: 3px; margin: 12px auto; opacity: .75; }

/* The hoopoe artwork (transparent WebP from the designer's originals). */
.divider { display: flex; align-items: center; gap: 18px; margin: 56px auto 0; max-width: 560px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.divider img { width: 66px; height: auto; }
.band-bird { position: absolute; width: 92px; height: auto; right: 6%; top: 16px; pointer-events: none; transform: rotate(-4deg); }
@media (max-width: 719px) { .band-bird { width: 58px; right: 12px; top: 10px; } }
.pose-bird { display: block; width: 190px; height: auto; margin: 32px auto 0; }
.pose-bird.wide { width: 280px; }
@media (max-width: 599px) { .pose-bird { width: 140px; } .pose-bird.wide { width: 220px; } .promise-bird { width: 160px; } }
.walker { display: block; width: 92px; margin: 0 auto 10px; }
.walker img { width: 100%; height: auto; display: block; }
.loading { display: flex; flex-direction: column; align-items: center; padding: 96px 16px; text-align: center; color: var(--muted); }
.loading p { margin: 0; }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1600px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 24px; min-height: 68px; }
@media (min-width: 720px) { .topbar-in { padding: 8px 32px; } }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand img { width: 48px; height: auto; }
.brand-text { display: flex; align-items: center; gap: 10px; line-height: 1.1; }
.brand-name { font: 700 1.2rem var(--head); color: var(--ink); white-space: nowrap; }
.brand-bar { width: 2px; height: 22px; background: var(--teal); border-radius: 2px; opacity: .7; }
.brand-sub { font: 600 1.02rem var(--head); color: var(--teal); white-space: nowrap; }
@media (max-width: 479px) {
  .brand-text { flex-direction: column; align-items: flex-start; gap: 2px; }
  .brand-bar { display: none; }
  .brand-sub { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
}
.mainnav { display: flex; gap: 4px; margin-inline-start: auto; }
.mainnav a { color: var(--text-soft); text-decoration: none; font: 600 .97rem var(--head); padding: 10px 14px; border-radius: 10px; white-space: nowrap; transition: background .15s, color .15s; }
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--teal); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--teal); }
.nav-more { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: 8px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.soon { display: inline-block; font: 700 .66rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #5b2a10; background: var(--peach); border-radius: 999px; padding: 4px 8px; white-space: nowrap; vertical-align: middle; }
.listen-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--teal); background: transparent; color: var(--teal); font: 600 .93rem var(--head); text-decoration: none; cursor: pointer; white-space: nowrap; }
.listen-btn:hover { background: var(--accent-soft); }
.listen-btn svg { width: 17px; height: 17px; }
@media (max-width: 1599px) { .listen-btn .listen-label { display: none; } .listen-btn::after { content: "For families"; order: 2; } .listen-btn .soon { order: 3; } }
@media (max-width: 719px) { .listen-btn { display: none; } }
.popover { position: fixed; z-index: 60; max-width: min(300px, calc(100vw - 24px)); background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-size: .92rem; line-height: 1.45; }
.popover p { margin: 0; }
.foot-listen { background: none; border: 0; padding: 0; color: #fff; font: 600 .95rem var(--head); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.foot-listen:hover .listen-label { text-decoration: underline; color: var(--teal-light); }
@media (max-width: 1439px) {
  .top-actions { margin-inline-start: auto; }
  .menu-btn { display: grid; }
  .mainnav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 20px 16px; }
  body.menu-open .mainnav { display: flex; }
  .mainnav a, .nav-more { display: block; padding: 14px 12px; font-size: 1.02rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .mainnav a[aria-current="page"] { background: none; box-shadow: inset 3px 0 0 var(--teal); padding-inline-start: 18px; }
  .nav-listen { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: start; background: none; border: 0; border-bottom: 0; color: var(--teal); font: 600 1.02rem var(--head); cursor: pointer; }
}


/* ---------- buttons, pills, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 .98rem var(--head); text-decoration: none; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
:root[data-theme="dark"] .btn.primary { background: var(--teal); border-color: var(--teal); color: #04222a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--teal); border-color: var(--teal); color: #04222a; } }
.btn.accent { background: var(--teal-light); border-color: var(--teal-light); color: #052a33; }
.btn.accent:hover { background: #7ad7e3; border-color: #7ad7e3; }
.btn.light { background: transparent; border-color: rgba(251, 247, 240, .55); color: var(--on-dark); }
.btn.light:hover { background: rgba(251, 247, 240, .1); }
.btn.small { min-height: 38px; padding: 6px 13px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.textlink { display: inline-flex; align-items: center; gap: 6px; font: 600 .98rem var(--head); color: var(--link); text-decoration: none; }
.textlink:hover { text-decoration: underline; }
.textlink svg { width: 16px; height: 16px; }
.linkbtn { background: none; border: 0; color: var(--link); font: 700 .88rem var(--sans); cursor: pointer; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-soft); text-decoration: none; font: 600 .86rem var(--head); cursor: pointer; line-height: 1.35; }
.pill:hover { border-color: var(--teal); color: var(--teal); }
.pill.removable { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.pill.removable svg { width: 14px; height: 14px; }
select, input[type="search"] { font: inherit; font-size: .95rem; color: var(--text); background-color: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; min-height: 46px; padding: 10px 14px; width: 100%; max-width: 100%; }
select { -webkit-appearance: none; appearance: none; background-image: var(--chev); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px 16px; padding-right: 44px; cursor: pointer; text-overflow: ellipsis; }
select:hover { border-color: var(--teal); }
select:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font: 600 .93rem var(--head); color: var(--ink); padding: 0; }
.help { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 7px 0; font-weight: 600; font-size: .95rem; }
.check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--teal); flex: none; }
.check small { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); line-height: 1.4; }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* ---------- search bar */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 6px 6px 6px 18px; max-width: 640px; margin: 0 auto; box-shadow: 0 4px 16px rgba(14, 52, 69, .06); }
.searchbar:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent); }
.searchbar > svg { color: var(--muted); }
.searchbar input { border: 0; background: transparent; min-height: 46px; padding: 6px 6px; outline: none; flex: 1; min-width: 0; font-size: 1rem; }
.searchbar input:focus-visible { outline: none; }
@media (max-width: 479px) { .searchbar .btn { padding: 9px 14px; } }

/* ---------- hero (home) */
.hero { position: relative; overflow: hidden; color: var(--on-dark); background:
  radial-gradient(700px 420px at 85% 30%, rgba(14, 135, 152, .45), transparent 70%),
  radial-gradient(600px 400px at 0% 100%, rgba(141, 90, 43, .22), transparent 70%),
  linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 100%); padding: 44px 0 0; }
.hero::after { content: ""; position: absolute; left: -5%; right: -5%; bottom: -1px; height: 56px; background: var(--bg); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.hero-grid { position: relative; z-index: 1; display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; padding-top: 28px; } }
.hero-copy { text-align: center; }
@media (min-width: 900px) { .hero-copy { text-align: start; } .hero .searchbar { margin: 0; } }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 600 .8rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--teal-light); margin-bottom: 14px; }
.hero-eyebrow [lang="he"] { font-size: 1.15rem; letter-spacing: 0; text-transform: none; color: #fff; }
.hero-eyebrow .sep { width: 18px; height: 2px; background: var(--teal-light); border-radius: 2px; }
.hero-title { color: #fff; font-size: clamp(2.3rem, 6.2vw, 4rem); font-weight: 700; line-height: 1.05; letter-spacing: -.025em; margin-bottom: 18px; }
.hero-title .line { display: block; }
.hero-title .accent { color: var(--teal-light); }
.hero-title .w { display: inline-block; }
.hero-lead { color: var(--on-dark-soft); font-size: 1.1rem; max-width: 560px; margin: 0 auto 26px; }
@media (min-width: 900px) { .hero-lead { margin-inline: 0; } }
.hero-search .searchbar { border-color: transparent; box-shadow: 0 12px 34px rgba(0, 0, 0, .25); }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 22px; margin: 20px 0 0; }
@media (min-width: 900px) { .hero-links { justify-content: flex-start; } }
.hero-links .textlink { color: var(--on-dark); }
.hero-art { position: relative; display: flex; flex-direction: column; align-items: center; }
.hero-bird { width: min(400px, 88%); height: auto; filter: drop-shadow(0 22px 32px rgba(0, 0, 0, .28)); }
.hero-art .swoosh { width: min(300px, 60vw); height: 38px; color: var(--teal-light); margin-top: -4px; }
@media (max-width: 899px) { .hero-bird { width: min(200px, 54vw); } .hero-art { order: -1; } .hero-art .swoosh { width: 150px; height: 24px; } .hero { padding-top: 28px; } }
.hero-stats { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; padding: 30px 0 76px; color: var(--on-dark-soft); font-size: .95rem; }
.hero-stats strong { font: 700 1.3rem var(--head); color: #fff; margin-inline-end: 5px; }
.glide { position: absolute; z-index: 2; top: 6%; left: 0; width: 150px; height: auto; opacity: 0; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .25)); }

/* Welcome: words rise in one after another; the bird glides across once. */
@keyframes kst-rise { from { opacity: 0; transform: translateY(.55em); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes kst-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes kst-pop { from { opacity: 0; transform: scale(.86) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes kst-glide {
  0% { opacity: 0; transform: translate(-140px, 60px) rotate(-6deg); }
  12% { opacity: 1; }
  50% { transform: translate(50vw, -6px) rotate(2deg); }
  88% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(100vw + 40px), 40px) rotate(-4deg); }
}
@keyframes kst-flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.82); } }
.hero.play .w { opacity: 0; animation: kst-rise .7s cubic-bezier(.2, .7, .2, 1) forwards; animation-delay: calc(var(--i) * 85ms + 120ms); }
.hero.play .hero-eyebrow { opacity: 0; animation: kst-fade .6s ease-out forwards; }
.hero.play .hero-lead { opacity: 0; animation: kst-fade .7s ease-out .85s forwards; }
.hero.play .hero-search, .hero.play .hero-links { opacity: 0; animation: kst-fade .7s ease-out 1.05s forwards; }
.hero.play .hero-stats { opacity: 0; animation: kst-fade .7s ease-out 1.3s forwards; }
.hero.play .hero-bird { opacity: 0; animation: kst-pop .9s cubic-bezier(.2, .8, .2, 1.1) .3s forwards; }
.hero.play .glide { animation: kst-glide 5.6s cubic-bezier(.45, .05, .4, 1) .6s forwards; }
@media (prefers-reduced-motion: reduce) {
  .hero.play *, .hero.play .glide { animation: none !important; opacity: 1 !important; }
  .hero.play .glide { display: none; }
}

/* ---------- inner page bands */
.page-band { position: relative; background: var(--bg-band); border-bottom: 1px solid var(--line); padding-bottom: 36px; overflow: hidden; }
.page-band::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--navy), var(--teal-bright)); }
.page-head { text-align: center; max-width: 720px; margin: 12px auto 0; }
.page-head h1 { margin-bottom: .35em; }
.page-head .intro { color: var(--text-soft); font-size: 1.06rem; margin: 0 auto; max-width: 60ch; }
.eyebrow, .kicker { font: 600 .78rem var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--brown); margin-bottom: .7em; }
.crumbs { padding: 20px 0 6px; font-size: .88rem; position: relative; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); min-width: 0; }
.crumbs li + li::before { content: "›"; padding: 0 4px; }
.crumbs a { font-weight: 700; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.section { margin: 64px 0 0; }
.section.tight { margin-top: 40px; }
.section-head { margin-bottom: 28px; }
.section-head.center { text-align: center; }
.section-head h2 { margin-bottom: .25em; }
.section-head p:last-child { color: var(--muted); margin: 0 auto; max-width: 60ch; }
.jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 28px 0 8px; }
.group-h { font-size: 1.35rem; padding-bottom: 10px; border-bottom: 2px solid var(--line); margin-bottom: 18px; scroll-margin-top: 90px; outline: none; }
.group-intro { margin: -8px 0 18px; }

/* ---------- home blocks */
.entry-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 640px) { .entry-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .entry-grid { grid-template-columns: repeat(4, 1fr); } }
.entry { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; padding: 28px 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: box-shadow .2s, transform .2s, border-color .2s; }
.entry:hover { border-color: var(--teal); box-shadow: var(--shadow); transform: translateY(-3px); }
.entry-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft); color: var(--teal); display: grid; place-items: center; margin-bottom: 14px; }
.entry-ico svg { width: 24px; height: 24px; }
.entry h3 { margin-bottom: .35em; }
.entry p { color: var(--text-soft); font-size: .93rem; margin: 0 0 14px; }
.go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--link); font: 600 .9rem var(--head); }
.go svg { width: 16px; height: 16px; }
.promise { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; margin: 64px 0 0; padding: 32px 24px; background: var(--bg-band); border-radius: 22px; border: 1px solid var(--line); }
.promise { background: linear-gradient(135deg, var(--surface) 0%, var(--sand) 100%); }
.promise-bird { width: 200px; height: auto; flex: none; }
.promise h2 { margin-bottom: .3em; }
.promise p { color: var(--text-soft); max-width: 620px; }
@media (min-width: 760px) { .promise { flex-direction: row; text-align: start; padding: 36px 44px; gap: 32px; }  }

/* ---------- story cards (centered) */
.cards { list-style: none; margin: 0 0 32px; padding: 0; display: grid; gap: 18px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .browse-grid .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .browse-grid .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { display: flex; }
.card > a { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; padding: 28px 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s; }
.card > a::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--navy), var(--teal-bright)); opacity: 0; transition: opacity .2s; }
.card > a:hover { border-color: var(--teal); box-shadow: var(--shadow); transform: translateY(-3px); }
.card > a:hover::before { opacity: 1; }
.card-he { font-size: 1.2rem; color: var(--teal); line-height: 1.3; margin-bottom: 6px; }
.card h3 { font-size: 1.2rem; margin: 0 0 4px; }
.card-src { font: 600 .8rem var(--head); color: var(--muted); letter-spacing: .03em; }
.card .rule { width: 30px; margin: 12px auto; }
.card-msg { margin: 0 0 14px; color: var(--text-soft); font-size: .93rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-snip { margin: -4px 0 14px; font-size: .84rem; color: var(--muted); font-style: italic; }
.card-meta { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 0; font: 600 .8rem var(--head); color: var(--teal); }
.card-meta .mi { white-space: nowrap; }
.card-meta .mi + .mi::before { content: "·"; margin: 0 7px; color: var(--muted); }

/* ---------- browse */
.browse-search { margin: 28px 0 28px; }
.browse-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .browse-grid { grid-template-columns: 272px minmax(0, 1fr); gap: 32px; align-items: start; } }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 24px; }
.filters-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.filters-head h2 { font-size: 1.15rem; margin: 0; }
#filterForm { display: grid; gap: 20px; }
#doneFilters { display: none; }
.filter-toggle { justify-self: start; }
@media (min-width: 1000px) { .filters { position: sticky; top: 84px; } .filter-toggle { display: none; } }
@media (max-width: 999px) { .filters { display: none; } .filters.open { display: block; } #doneFilters { display: inline-flex; } }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.res-count { margin: 0; font: 600 1rem var(--head); color: var(--ink); margin-inline-end: auto; }
.fcount { color: var(--teal); }
.sort { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 700; color: var(--text-soft); }
.sort select { width: auto; min-height: 42px; padding: 8px 44px 8px 14px; }
.active-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.active-chips:empty { display: none; }
.empty { list-style: none; grid-column: 1 / -1; padding: 40px 20px; text-align: center; background: var(--surface); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); margin: 24px 0; }
.empty p { color: var(--text-soft); }

/* ---------- list pages */
.list-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 760px) { .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; } }
.row-card { display: flex; align-items: center; gap: 16px; height: 100%; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.row-card:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-title { font: 600 1.05rem var(--head); color: var(--ink); }
.row-desc { font-size: .88rem; color: var(--muted); line-height: 1.45; }
.row-count { flex: none; font: 600 .8rem var(--head); color: var(--teal); background: var(--accent-soft); border-radius: 999px; padding: 4px 11px; white-space: nowrap; }

/* ---------- masechtos */
.mas-grid { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 18px; justify-content: center; grid-template-columns: minmax(0, 420px); }
@media (min-width: 900px) { .mas-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 360px)); } }
.mas-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 32px 24px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.mas-card:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.mas-he { font-size: 2.4rem; color: var(--teal); line-height: 1.2; }
.mas-name { font: 600 1.2rem var(--head); color: var(--ink); }
.mas-facts { font-size: .9rem; color: var(--text-soft); }
.mas-card .go { margin-top: 14px; }

/* ---------- how to use, about, contact */
.steps { list-style: none; counter-reset: step; margin: 36px 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 22px 22px 20px 74px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; left: 20px; top: 20px; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; font: 700 1.05rem/38px var(--head); text-align: center; }
.steps h2 { font-size: 1.2rem; margin-bottom: .3em; }
.steps p { margin: 0; color: var(--text-soft); }
@media (max-width: 479px) { .steps li { padding: 66px 18px 18px; } .steps li::before { left: 18px; top: 18px; } }
.prose { padding-top: 12px; }
.prose section { margin-top: 36px; }
.prose h2 { font-size: 1.4rem; }
.prose p { color: var(--text-soft); font-size: 1.04rem; }
.prose .divider { margin-top: 40px; }
.prose.center .pose-bird { margin: 32px auto 20px; width: 150px; }

/* ---------- story page */
.story-hero { position: relative; overflow: hidden; color: var(--on-dark); background: radial-gradient(600px 300px at 90% 0%, rgba(14, 135, 152, .4), transparent 70%), linear-gradient(160deg, var(--hero-a), var(--hero-b)); padding-bottom: 36px; }
.story-hero .band-bird { top: 54px; }
@media (max-width: 719px) { .story-hero .band-bird { display: none; } }
.story-hero .crumbs li, .story-hero .crumbs li::before { color: var(--on-dark-soft); }
.story-hero .crumbs a { color: #fff; }
.story-he { font-size: 1.55rem; color: var(--teal-light); margin: 10px 0 6px; }
.story-hero h1 { color: #fff; margin-bottom: .35em; }
.story-src { color: var(--on-dark-soft); font: 600 .92rem var(--head); margin: 0; }
.story-hero .rule { background: var(--teal-light); }
.story-syn { font-size: 1.08rem; color: #e6eef0; max-width: 640px; margin: 0 auto 24px; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.toc { position: sticky; top: 68px; z-index: 20; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); box-shadow: 0 6px 16px rgba(14, 52, 69, .05); }
.toc-in { max-width: 800px; margin: 0 auto; padding: 0 8px; display: flex; justify-content: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.toc-in::-webkit-scrollbar { display: none; }
.toc button { background: none; border: 0; border-bottom: 3px solid transparent; color: var(--text-soft); font: 600 .92rem var(--head); padding: 13px 12px 10px; cursor: pointer; white-space: nowrap; }
.toc button:hover { color: var(--ink); }
.toc button.on { color: var(--teal); border-bottom-color: var(--teal); }
@media (max-width: 479px) { .toc button { padding: 12px 8px 9px; font-size: .84rem; } }
.story-body { padding-top: 8px; }
.sec { padding: 44px 0 10px; border-bottom: 1px solid var(--line); outline: none; scroll-margin-top: 124px; }
.sec:last-child { border-bottom: 0; }
.sec > h2 { text-align: center; }
.sec-intro { text-align: center; color: var(--muted); max-width: 60ch; margin: 0 auto 22px; font-size: .95rem; }
.sec h3 { margin-top: 1.6em; }
.sec-lead { font-size: 1.07rem; }
.agebar { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; }
.agebar-label { font: 600 .78rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--brown); }
.tabs { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.tabs [role="tab"] { font: 600 .93rem var(--head); color: var(--text-soft); background: none; border: 0; border-radius: 10px; padding: 9px 15px; cursor: pointer; min-height: 42px; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .tabs [role="tab"][aria-selected="true"] { background: var(--teal); color: #04222a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs [role="tab"][aria-selected="true"] { background: var(--teal); color: #04222a; } }
@media (max-width: 479px) { .tab-pre { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .tabs [role="tab"] { padding: 9px 14px; } }
.reading { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; outline: none; box-shadow: 0 2px 10px rgba(14, 52, 69, .04); }
@media (min-width: 720px) { .reading { padding: 32px 42px; } }
.reading-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.reading-head h3 { margin: 0 0 2px; font-size: 1.3rem; }
.reading-head p { margin: 0; }
.reading-text p { font-size: 1.07rem; line-height: 1.8; }
.reading-text p:last-child { margin-bottom: 0; }
.audio { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 16px; }
.audio audio { width: 100%; max-width: 420px; height: 40px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-top: 16px; }
.note h3 { margin: 0 0 4px; font: 600 .78rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.note p:last-child { margin-bottom: 0; }
.note.hal { background: var(--hal-bg); border-color: transparent; border-inline-start: 4px solid var(--brown); }
.note.hal h3 { color: var(--brown); }
.questions { padding-inline-start: 1.4em; margin: 0 0 1em; display: grid; gap: 10px; }
.questions li::marker { color: var(--teal); font-weight: 700; }
.terms { margin: 0 0 1em; display: grid; gap: 10px; }
.terms div { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.terms dt { font-weight: 800; color: var(--ink); }
.terms dd { margin: 2px 0 0; color: var(--text-soft); font-size: .95rem; }
.src-big { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font: 600 1rem var(--head); color: var(--text-soft); }
.src-big [lang="he"] { font-size: 1.6rem; color: var(--teal); font-weight: 500; }
#s-source > p:has(.btn) { text-align: center; }
.gemara { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; margin: 16px 0; }
.gemara summary { cursor: pointer; font: 600 1rem var(--head); padding: 10px 0; color: var(--link); }
.gemara-text { font-size: 1.38rem; line-height: 1.95; margin: 6px 0 12px; color: var(--text); }
.gemara-text p { margin: 0 0 .5em; }
.seg-ref { font: 700 .7rem var(--sans); color: var(--muted); background: var(--surface-2); border-radius: 5px; padding: 1px 6px; vertical-align: middle; }
.explore { margin-top: 20px; }
.explore p { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.explore-label { font: 600 .76rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--brown); margin-inline-end: 6px; }
.related { margin-top: 56px; }

/* ---------- footer, toast, dialog */
.sitefoot { background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); color: var(--on-dark-soft); }
.foot-in { max-width: 1140px; margin: 0 auto; padding: 40px 16px 36px; display: grid; gap: 18px; font-size: .92rem; }
@media (min-width: 720px) { .foot-in { padding: 44px 32px 40px; } }
.foot-brand { display: flex; align-items: flex-end; gap: 14px; }
.foot-bird { width: 52px; height: auto; flex: none; }
.foot-brand p { margin: 0; }
.foot-name { font: 700 1.2rem var(--head); color: #fff; }
.foot-name [lang="he"] { color: var(--teal-light); margin-inline-end: 6px; font-weight: 600; }
.foot-tag { color: var(--on-dark-soft); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-nav a { color: #fff; font: 600 .95rem var(--head); text-decoration: none; }
.foot-nav a:hover { color: var(--teal-light); text-decoration: underline; }
.foot-note { margin: 0; max-width: 760px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(6, 18, 25, .55); }
.dlg { padding: 28px; display: grid; gap: 18px; }
@media (max-width: 479px) { .dlg { padding: 22px 20px; } }
.dlg h2 { margin: 0; }
.dlg > p { margin: -8px 0 0; font-size: .93rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font: 600 .88rem var(--head); color: var(--ink); margin-bottom: 6px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt span { display: inline-block; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-strong); font: 600 .9rem var(--head); cursor: pointer; }
.seg-opt input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.dlg .check { padding: 3px 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- print story card */
#printCard { display: none; }
@media print {
  @page { margin: 15mm 16mm; }
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --ink: #0e3445; --text: #1f1b16; --text-soft: #3d362e; --muted: #5a5046; --teal: #0b7584; --brown: #8d5a2b; --line: #d9cfc0; color-scheme: light;
  }
  body { background: #fff !important; display: block; font: 11.5pt/1.5 var(--sans); }
  body.has-print > *:not(#printCard) { display: none !important; }
  body.has-print #printCard { display: block; color: #1f1b16; }
  .topbar, .sitefoot, .toast, .skip, .toc, .actions, .crumbs, .filters, dialog { display: none !important; }
  #printCard h1 { font: 700 20pt/1.2 var(--head); margin: 8pt 0 2pt; color: #0e3445; }
  #printCard h2 { font: 600 10.5pt var(--head); margin: 0 0 4pt; color: #0b7584; text-transform: uppercase; letter-spacing: .08em; }
  .pc-top { display: flex; justify-content: space-between; gap: 12pt; font-size: 8.5pt; color: #5a5046; border-bottom: 1.5pt solid #0b7584; padding-bottom: 4pt; }
  .pc-top [lang="he"] { font-size: 10.5pt; }
  .pc-meta { font-size: 9.5pt; color: #5a5046; margin: 0 0 10pt; }
  .pc-text p { margin: 0 0 7pt; orphans: 3; widows: 3; }
  .pc-box { border: 1pt solid #d9cfc0; border-inline-start: 3pt solid #0b7584; border-radius: 4pt; padding: 7pt 10pt; margin: 10pt 0; break-inside: avoid; }
  .pc-box p { margin: 0; }
  .pc-sec { margin: 12pt 0 0; }
  .pc-sec ol { margin: 0; padding-inline-start: 16pt; }
  .pc-sec li { margin-bottom: 4pt; break-inside: avoid; }
  .pc-sec dt { font-weight: 700; }
  .pc-sec dd { margin: 0 0 4pt 12pt; }
  .pc-he { font: 13.5pt/1.75 var(--hebrew); }
  .pc-he p { margin: 0 0 4pt; }
  .pc-foot { margin-top: 14pt; padding-top: 4pt; border-top: .75pt solid #d9cfc0; font-size: 8.5pt; color: #5a5046; }
}

/* Dark: selected choices use teal so they stand out from the navy surface. */
:root[data-theme="dark"] .seg-opt input:checked + span { background: var(--teal); border-color: var(--teal); color: #04222a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-opt input:checked + span { background: var(--teal); border-color: var(--teal); color: #04222a; } }
