/* =============================================================
   יומיומי · HUB THEME — dark, alive, subtle RGB · multi-page
   Loaded LAST. Dark animated background, sticky nav, 6 home tiles,
   topic-page chrome. Reuses .card styling from redesign.css.
   ============================================================= */

:root {
  --bg-0: #07070a;
  --bg-1: #0c0c12;
  --ink: #f4f3f7;
  --ink-2: #c7c5cf;
  --ink-3: #8e8b98;
  --gold: #d4a843;
  --gold-light: #f0c668;
  --gold-deep: #a67c20;
  --gold-glow: rgba(212,168,67,0.30);
  /* subtle RGB accent set */
  --rgb-violet: #7c6cff;
  --rgb-cyan:   #45c8ff;
  --rgb-pink:   #ff5ea8;
  --rgb-green:  #46d39a;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(212,168,67,0.30);

  /* category colors (tiles + nav + page accents) */
  --c-limud:    #45c8ff;
  --c-chizuk:   #f0c668;
  --c-video:    #ff5ea8;
  --c-erachim:  #7c6cff;
  --c-mishpacha:#46d39a;
  --c-olam:     #ff9d4d;
}

/* ---------- ALIVE DARK BACKGROUND (CSS only, gentle drift) ---------- */
html, body { background: var(--bg-0) !important; }
body {
  color: var(--ink);
  font-family: var(--f-sans, "Heebo", system-ui, sans-serif);
  cursor: auto !important;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  background:
    radial-gradient(38vmax 38vmax at 18% 12%, rgba(212,168,67,0.16), transparent 60%),
    radial-gradient(34vmax 34vmax at 85% 22%, rgba(124,108,255,0.16), transparent 60%),
    radial-gradient(36vmax 36vmax at 75% 88%, rgba(69,200,255,0.12), transparent 60%),
    radial-gradient(30vmax 30vmax at 12% 85%, rgba(255,94,168,0.10), transparent 60%);
  filter: blur(8px);
  animation: hub-drift 26s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(120vmax 90vmax at 50% -10%, transparent 55%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
@keyframes hub-drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2.5vmax,-2vmax,0) scale(1.06); }
  100% { transform: translate3d(-2vmax,2.5vmax,0) scale(1.02); }
}
/* faint star/grain veil */
body { background-image:
  radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.10), transparent),
  radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.08), transparent),
  radial-gradient(1px 1px at 45% 85%, rgba(255,255,255,0.06), transparent);
  background-attachment: fixed; }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

.page { max-width: 1080px; margin: 0 auto; padding: 0 clamp(0.85rem,2.5vw,1.75rem) 3rem; position: relative; z-index: 1; }

/* hide any leftover old chrome */
.site-header, .mega-brand, .hero, .holiday-banner, .mood-layer, .mood-stars,
.mood-scan, .mood-grain, .mood-label, .cursor-halo, .cursor-dot, .section-nav,
.parsha-ticker { display: none !important; }

/* =============================================================
   STICKY NAV (injected by nav.js)
   ============================================================= */
.hub-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10,10,14,0.72);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(-1 * clamp(0.85rem,2.5vw,1.75rem)) 0;
  padding: 0 clamp(0.85rem,2.5vw,1.75rem);
}
.hub-nav-in {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  height: 60px;
}
.hub-brand { display: flex; flex-direction: column; text-decoration: none; flex-shrink: 0; }
.hub-brand b {
  font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--gold-light), var(--gold) 40%, var(--rgb-violet) 120%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hub-brand small { font-size: 0.58rem; letter-spacing: 0.14em; color: var(--ink-3); margin-top: -3px; }
.hub-links { display: flex; gap: 0.15rem; overflow-x: auto; scrollbar-width: none; margin-inline-start: auto; }
.hub-links::-webkit-scrollbar { height: 0; }
.hub-link {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 700; font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  position: relative;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}
.hub-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.hub-link.active { color: #fff; }
.hub-link.active::after {
  content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 4px; height: 2px;
  border-radius: 2px; background: var(--lc, var(--gold));
  box-shadow: 0 0 10px var(--lc, var(--gold));
}
.hub-link[data-k="limud"]    { --lc: var(--c-limud); }
.hub-link[data-k="chizuk"]   { --lc: var(--c-chizuk); }
.hub-link[data-k="video"]    { --lc: var(--c-video); }
.hub-link[data-k="erachim"]  { --lc: var(--c-erachim); }
.hub-link[data-k="mishpacha"]{ --lc: var(--c-mishpacha); }
.hub-link[data-k="olam"]     { --lc: var(--c-olam); }
.hub-link[data-k="zmanim"]   { --lc: var(--gold); }
.hub-link[data-k="luach"]    { --lc: #e0b0ff; }
.hub-ctrls { display: flex; gap: 0.4rem; flex-shrink: 0; }
.hub-ctrl {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-2); font-size: 0.82rem; font-weight: 600;
  padding: 0.4rem 0.8rem; min-height: 36px; cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.hub-ctrl:hover { border-color: var(--line-strong); color: var(--gold-light); background: rgba(212,168,67,0.08); }
@media (max-width: 760px) {
  .hub-brand small { display: none; }
  .hub-links { order: 3; width: 100%; padding-bottom: 0.4rem; }
  .hub-nav-in { flex-wrap: wrap; height: auto; padding: 0.5rem 0; gap: 0.5rem; }
}

/* =============================================================
   HOME — hero strip + 6 animated tiles
   ============================================================= */
.home-hero {
  text-align: center;
  padding: clamp(2rem,6vw,3.75rem) 1rem clamp(1rem,3vw,2rem);
}
.home-name {
  font-size: clamp(3.2rem, 10vw, 7rem);
  font-weight: 900; letter-spacing: -0.04em; line-height: 0.95; margin: 0;
  display: inline-block;
  background: linear-gradient(110deg, var(--gold-deep) 0%, var(--gold) 25%, var(--gold-light) 45%, #fff7e0 50%, var(--gold-light) 55%, var(--gold) 75%, var(--gold-deep) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px var(--gold-glow));
  animation: name-shine 5s linear infinite, name-bob 6s ease-in-out infinite;
}
.home-name::after {
  content: "✦";
  -webkit-text-fill-color: var(--gold-light);
  font-size: 0.28em;
  vertical-align: super;
  margin-inline-start: 0.1em;
  display: inline-block;
  filter: drop-shadow(0 0 10px var(--gold));
  animation: name-spark 2.6s ease-in-out infinite;
}
@keyframes name-shine { to { background-position: -250% 0; } }
@keyframes name-bob { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-6px); } }
@keyframes name-spark { 0%,100%{ opacity:0.35; transform: scale(0.8) rotate(0deg); } 50%{ opacity:1; transform: scale(1.25) rotate(180deg); } }
@media (prefers-reduced-motion: reduce){ .home-name{ animation: name-shine 5s linear infinite; } .home-name::after{ animation:none; } }

/* =============================================================
   HOME SECTION BLOCKS — one big animated tile per topic,
   each previews its live content; clicking the head enters page.
   ============================================================= */
.sec {
  position: relative;
  margin: 1.4rem 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
  overflow: hidden;
  isolation: isolate;
  opacity: 0; transform: translateY(22px);
}
.sec.in-view { opacity: 1; transform: none; transition: opacity 600ms ease, transform 600ms cubic-bezier(0.16,1,0.3,1); }
.sec::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(130% 80% at 85% 0%, color-mix(in srgb, var(--sc) 26%, transparent), transparent 60%);
  opacity: 0.7;
}
.sec::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--sc) 60%, transparent), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.45;
}
.sec[data-k="limud"]    { --sc: var(--c-limud); }
.sec[data-k="chizuk"]   { --sc: var(--c-chizuk); }
.sec[data-k="video"]    { --sc: var(--c-video); }
.sec[data-k="erachim"]  { --sc: var(--c-erachim); }
.sec[data-k="mishpacha"]{ --sc: var(--c-mishpacha); }
.sec[data-k="olam"]     { --sc: var(--c-olam); }
.sec[data-k="zmanim"]   { --sc: var(--gold); }
.sec[data-k="luach"]    { --sc: #e0b0ff; }

.sec-head {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1.15rem 1.4rem; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.sec-head .sec-ico {
  width: 52px; height: 52px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 1.7rem; border-radius: 14px;
  background: color-mix(in srgb, var(--sc) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc) 40%, transparent);
  box-shadow: 0 0 24px -8px var(--sc);
  transition: transform 280ms cubic-bezier(0.16,1,0.3,1);
}
.sec:hover .sec-head .sec-ico { transform: scale(1.1) rotate(-4deg); }
.sec-titles { flex: 1; min-width: 0; }
.sec-titles h2 { margin: 0; font-size: clamp(1.3rem,2.6vw,1.7rem); font-weight: 900; color: #fff; letter-spacing: -0.01em; }
.sec-titles p { margin: 0.1rem 0 0; color: var(--ink-2); font-size: 0.9rem; }
.sec-go {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.1rem; border-radius: 999px; font-weight: 800; font-size: 0.9rem;
  color: #fff; background: color-mix(in srgb, var(--sc) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc) 50%, transparent);
  transition: background 200ms ease, transform 200ms ease;
}
.sec-go::after { content: "←"; transition: transform 220ms ease; }
.sec-head:hover .sec-go { background: color-mix(in srgb, var(--sc) 38%, transparent); }
.sec-head:hover .sec-go::after { transform: translateX(-5px); }
.sec-body { padding: 1.2rem 1.4rem 1.4rem; }

/* auto-scrolling preview rows (right→left, alternating) */
.auto-row {
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.auto-row + .auto-row { margin-top: 0.8rem; }
.auto-row .yt-track { display: flex; gap: 0.85rem; width: max-content; animation: row-rtl 55s linear infinite; }
.auto-row.rev .yt-track { animation-direction: reverse; }
.auto-row:hover .yt-track { animation-play-state: paused; }
@keyframes row-rtl { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce){ .auto-row .yt-track{ animation: none; } .auto-row{ overflow-x:auto; } }

/* compact preview helpers */
.sec-body .learning-grid { margin: 0; }
.sec-peek { max-height: 230px; overflow: hidden; position: relative; }
.sec-peek::after { content:""; position:absolute; left:0; right:0; bottom:0; height:60px; background: linear-gradient(transparent, var(--bg-0)); pointer-events:none; }

/* mini chizuk inside section */
.sec .chizuk-runner { transition: opacity 480ms ease; }
.sec .chizuk-runner.swapping { opacity: 0; }

/* download (desktop clock) block */
.dl-clock { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.dl-clock-img {
  width: 220px; flex-shrink: 0; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: 0 16px 40px -12px #000;
  background: #0c3a2c;
}
.dl-clock-img img { width: 100%; display: block; }
.dl-clock-info { flex: 1; min-width: 240px; }
.dl-clock-info h3 { margin: 0 0 0.3rem; font-size: 1.35rem; font-weight: 900; color: #fff; }

/* ============================================================
   RABBI SHOWCASE — crossfading image stage, never empty
   ============================================================ */
.rabbi-shows { display: flex; flex-direction: column; gap: 1rem; }
.rabbi-show {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rc, var(--c-video)) 30%, var(--line));
  background: #0b0b11;
}
.rs-stage {
  position: relative;
  aspect-ratio: 24 / 8;
  min-height: 150px;
  background:
    radial-gradient(120% 140% at 80% 0%, color-mix(in srgb, var(--rc) 45%, transparent), transparent 60%),
    linear-gradient(135deg, #14141d, #07070a);
  overflow: hidden;
}
.rs-stage .rs-poster {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(4rem, 14vw, 8rem); font-weight: 900; line-height: 1;
  color: color-mix(in srgb, var(--rc) 70%, #fff);
  opacity: 0.22; user-select: none;
}
.rs-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1.3s ease, transform 6s ease;
  transform: scale(1.04);
}
.rs-stage img.show { opacity: 0.92; transform: scale(1); }
.rs-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(7,7,10,0.85) 0%, rgba(7,7,10,0.25) 45%, transparent 70%);
}
.rs-name {
  position: absolute; inset-inline-start: 1.3rem; bottom: 1rem; z-index: 2;
  margin: 0; font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 900; color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,0.7);
}
.rs-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1.2rem;
}
.rs-meta .rs-sub { color: var(--ink-2); font-size: 0.88rem; }
.rs-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.2rem; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 0.9rem;
  background: color-mix(in srgb, var(--rc) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 50%, transparent);
  color: #fff; white-space: nowrap; transition: background 180ms ease, transform 180ms ease;
}
.rs-link::after { content: "←"; transition: transform 200ms ease; }
.rs-link:hover { background: color-mix(in srgb, var(--rc) 38%, transparent); transform: translateY(-1px); }
.rs-link:hover::after { transform: translateX(-4px); }
.yt-src { display: none !important; }

/* full video page — taller stages */
.rabbi-shows-lg .rs-stage { aspect-ratio: 16 / 7; min-height: 220px; }
.rabbi-shows-lg .rs-name { font-size: clamp(1.8rem, 5vw, 3rem); }

/* poster card (learning / daf yomi etc.) */
.poster-card {
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
  padding: 1rem 1.1rem; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c-limud) 16%, transparent), transparent);
  border: 1px solid color-mix(in srgb, var(--c-limud) 28%, var(--line));
}
.poster-ava {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 900; color: #fff;
  background: var(--c-limud); border: 3px solid #fff2; box-shadow: 0 0 22px -6px var(--c-limud);
}
.poster-info { flex: 1; min-width: 180px; }
.poster-info h4 { margin: 0 0 0.2rem; font-size: 1.05rem; font-weight: 800; color: #fff; }
.poster-info p { margin: 0; color: var(--ink-3); font-size: 0.82rem; }
.poster-link {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.1rem; border-radius: 999px;
  text-decoration: none; font-weight: 800; font-size: 0.85rem; color: #0a0a0a;
  background: linear-gradient(135deg, var(--c-limud), #2a86b5);
}

/* ============================================================
   centering: keep content in a comfortable centered column
   ============================================================ */
.panel-grid { justify-content: center; }
.panel-grid > .card { max-width: 520px; width: 100%; margin-inline: auto; }
.panel-grid > .card.wide { max-width: 100%; }
.rabbi-shows, .rabbi-shows-lg { max-width: 860px; margin-inline: auto; }

/* ============================================================
   YT PLAY overlays + grid (glat.tube-style, plays in-site)
   ============================================================ */
.yt-card { cursor: pointer; background: none; border: 0; text-align: start; padding: 0; font: inherit; }
.yt-thumb { position: relative; }
.yt-play {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(190,18,60,0.92); color: #fff; font-size: 1.3rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5); opacity: 0.9;
  transition: transform 200ms ease, opacity 200ms ease; pointer-events: none;
}
.yt-card:hover .yt-play { transform: scale(1.12); opacity: 1; }

.yt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 1rem; margin: 0 auto 0.5rem; max-width: 1000px;
  min-width: 0;
  max-height: 580px; overflow-y: auto; padding: 4px 6px 4px 4px;
  scrollbar-width: thin; scrollbar-color: var(--rc, var(--gold)) transparent;
}
.yt-grid::-webkit-scrollbar { width: 8px; }
.yt-grid::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--rc, var(--gold)) 55%, transparent); border-radius: 4px; }
.yt-grid::-webkit-scrollbar-track { background: transparent; }
.yt-grid .yt-card { width: 100%; min-width: 0; }

/* rabbi block on the full video page */
.rav-block { width: 100%; max-width: 1000px; margin: 0 auto 2.2rem; min-width: 0; }
.rav-block-head {
  display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1rem;
  padding-bottom: 0.7rem; border-bottom: 1px solid color-mix(in srgb, var(--rc) 30%, var(--line));
}
.rav-block-head .rav-ava {
  width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.4rem; font-weight: 900; color: #fff; background: var(--rc);
  box-shadow: 0 0 20px -5px var(--rc); border: 2px solid #fff2;
}
.rav-block-head h2 { margin: 0; font-size: 1.3rem; font-weight: 900; color: #fff; }
.rav-block-head p { margin: 0; color: var(--ink-3); font-size: 0.82rem; }
.rav-block-head > span:last-child, .rav-block-head > a:last-child { margin-inline-start: auto; }
.rs-playable { cursor: pointer; }
.rs-playable::after {
  content: "▶"; position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; z-index: 3;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 1.5rem;
  opacity: 0; transition: opacity 220ms ease; pointer-events: none;
}
.rs-playable:hover::after { opacity: 1; }

/* ============================================================
   YT LIGHTBOX — in-site player
   ============================================================ */
.yt-lightbox { position: fixed; inset: 0; z-index: 4000; display: none; }
.yt-lightbox.open { display: block; }
.ytl-backdrop { position: absolute; inset: 0; background: rgba(3,3,6,0.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ytl-panel {
  position: absolute; inset: 0; margin: auto; width: min(960px, 94vw); height: max-content;
  top: 50%; transform: translateY(-50%);
  background: #0b0b11; border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 80px -20px #000;
}
.ytl-close {
  position: absolute; top: 8px; inset-inline-start: 10px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 1.5rem; line-height: 1;
}
.ytl-close:hover { background: var(--gold); color: #0a0a0a; }
.ytl-frame-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.ytl-frame, .ytl-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ytl-title { padding: 0.85rem 1.2rem; color: #fff; font-weight: 700; font-size: 0.95rem; }

/* ============================================================
   CITY PICKER — GPS button + worldwide search results
   ============================================================ */
.city-gps-btn {
  display: block; width: 100%; margin: 0 0 0.75rem;
  padding: 0.75rem 1rem; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #0a0a0a;
  border: 0; font-family: inherit; font-size: 0.95rem; font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.city-gps-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -8px var(--gold-glow); }
.city-gps-btn:disabled { opacity: 0.65; cursor: wait; }

/* ============================================================
   ZMANIM — denser, smaller cells, more breathing room around card
   ============================================================ */
.card-zmanim { padding: clamp(1.1rem, 2vw, 1.6rem) !important; }
/* the zmanim container must STACK its children (flat grid, then legend) */
#zmanimGrid, .card-zmanim .zmanim-grid { display: block !important; }
.zg-legend { justify-content: center; gap: 0.35rem 0.75rem; margin: 1rem 0 0; padding-top: 0.85rem; border-top: 1px solid var(--line); border-bottom: 0; }
.zg-flat { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 0.45rem; max-width: 940px; margin: 0 auto; }
.zg-cell { padding: 0.5rem 0.4rem 0.55rem; }
.zg-time { font-size: 1rem; }
.zg-name { font-size: 0.66rem; min-height: 2.2em; }
@media (max-width: 520px) { .zg-flat { grid-template-columns: repeat(3, 1fr); } }
.dl-clock-info p { margin: 0 0 0.9rem; color: var(--ink-2); font-size: 0.92rem; line-height: 1.5; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #0a0a0a;
  border-radius: 999px; font-weight: 800; text-decoration: none; font-size: 0.95rem;
  box-shadow: 0 8px 24px -8px var(--gold-glow); transition: transform 200ms ease, box-shadow 200ms ease;
}
.dl-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -8px var(--gold-glow); }
.dl-btn.disabled { opacity: 0.6; pointer-events: none; }
.dl-note { font-size: 0.74rem; color: var(--ink-3); margin-top: 0.5rem; }
.home-tag { color: var(--ink-2); font-size: clamp(1rem,2.4vw,1.35rem); font-weight: 500; margin: 0.6rem 0 0; }
.home-strip {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.4rem;
  margin-top: 1.2rem; font-size: 0.95rem;
}
.home-strip .hs { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-2); font-weight: 600; }
.home-strip .hs b { color: var(--gold-light); }
.home-strip .hs .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* mini chizuk teaser on home */
.home-chizuk {
  max-width: 760px; margin: 0.5rem auto 0; padding: 1.25rem 1.5rem;
  background: rgba(20,18,28,0.5); border: 1px solid var(--line); border-radius: 16px;
  text-align: center; position: relative; overflow: hidden;
}
.home-chizuk .chizuk-runner { transition: opacity 500ms ease; }
.home-chizuk .chizuk-runner.swapping { opacity: 0; }
.home-chizuk .chizuk-title { color: var(--gold-light); font-size: 1rem; font-weight: 800; margin: 0 0 0.4rem; }
.home-chizuk .chizuk-text { font-size: clamp(1.1rem,2.2vw,1.45rem); font-weight: 500; line-height: 1.55; color: var(--ink); margin: 0 0 0.4rem; }
.home-chizuk .chizuk-src { color: var(--ink-3); font-size: 0.82rem; font-weight: 700; }
.home-chizuk .chizuk-foot-wrap { margin-top: 0.9rem; }
.home-chizuk .chizuk-refresh {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 1.1rem; border-radius: 999px; cursor: pointer;
  background: rgba(212,168,67,0.12); border: 1px solid var(--line-strong); color: var(--gold-light);
  font-family: inherit; font-size: 0.85rem; font-weight: 700;
}
.home-chizuk .chizuk-refresh::before { content: "⟳"; transition: transform 600ms ease; }
.home-chizuk .chizuk-refresh.spin::before { transform: rotate(360deg); }
.home-chizuk .chizuk-nav { display: none; }

/* ----- the 6 tiles ----- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.85rem, 1.6vw, 1.4rem);
  margin-top: 2rem;
}
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .tiles { grid-template-columns: 1fr; } }

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 200px;
  padding: 1.4rem;
  border-radius: 20px;
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  isolation: isolate;
  opacity: 0; transform: translateY(20px);
  animation: tile-in 600ms cubic-bezier(0.16,1,0.3,1) forwards;
  transition: transform 280ms cubic-bezier(0.16,1,0.3,1), box-shadow 280ms ease, border-color 280ms ease;
}
.tile:nth-child(1){animation-delay:.05s} .tile:nth-child(2){animation-delay:.12s}
.tile:nth-child(3){animation-delay:.19s} .tile:nth-child(4){animation-delay:.26s}
.tile:nth-child(5){animation-delay:.33s} .tile:nth-child(6){animation-delay:.40s}
@keyframes tile-in { to { opacity: 1; transform: none; } }

/* each tile has its own glow color via --tc */
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 90% at 80% 0%, color-mix(in srgb, var(--tc) 38%, transparent), transparent 60%);
  opacity: 0.8; transition: opacity 320ms ease, transform 600ms ease;
}
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tc) 70%, transparent), transparent 50%, color-mix(in srgb, var(--tc) 30%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.5; transition: opacity 320ms ease;
}
.tile:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--tc) 55%, transparent);
  box-shadow: 0 24px 50px -18px rgba(0,0,0,0.7), 0 0 50px -16px var(--tc);
}
.tile:hover::before { opacity: 1; transform: scale(1.1); }
.tile:hover::after { opacity: 0.9; }

.tile-ico {
  font-size: 2.4rem; line-height: 1; margin-bottom: auto;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,0.4));
  transition: transform 320ms cubic-bezier(0.16,1,0.3,1);
}
.tile:hover .tile-ico { transform: scale(1.15) translateY(-4px); }
.tile-title { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.01em; margin: 0.8rem 0 0.25rem; }
.tile-sub { font-size: 0.88rem; color: var(--ink-2); font-weight: 500; line-height: 1.4; }
.tile-go {
  margin-top: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--tc) 60%, #fff);
}
.tile-go::after { content: "←"; transition: transform 240ms ease; }
.tile:hover .tile-go::after { transform: translateX(-5px); }

/* tile colors */
.tile[data-k="limud"]     { --tc: var(--c-limud); }
.tile[data-k="chizuk"]    { --tc: var(--c-chizuk); }
.tile[data-k="video"]     { --tc: var(--c-video); }
.tile[data-k="erachim"]   { --tc: var(--c-erachim); }
.tile[data-k="mishpacha"] { --tc: var(--c-mishpacha); }
.tile[data-k="olam"]      { --tc: var(--c-olam); }

/* make a couple of tiles span wider for a varied "magazine" rhythm */
.tile[data-k="chizuk"] { grid-column: span 2; min-height: 220px; }
@media (max-width: 860px){ .tile[data-k="chizuk"]{ grid-column: span 2; } }
@media (max-width: 540px){ .tile[data-k="chizuk"]{ grid-column: span 1; } }

/* =============================================================
   TOPIC PAGE chrome
   ============================================================= */
.page-hero {
  padding: clamp(1.75rem,5vw,3rem) 0 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}
.page-hero .ph-back { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-3); text-decoration: none; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.85rem; }
.page-hero .ph-back:hover { color: var(--gold-light); }
.page-hero h1 {
  font-size: clamp(2.2rem,6vw,3.4rem); font-weight: 900; margin: 0; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 0.6rem;
}
.page-hero h1 .ph-ico { filter: drop-shadow(0 0 18px var(--pc, var(--gold-glow))); }
.page-hero h1 .ph-txt {
  background: linear-gradient(120deg, #fff, color-mix(in srgb, var(--pc, var(--gold)) 80%, #fff));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.page-hero p { color: var(--ink-2); font-size: 1.05rem; margin: 0.5rem 0 0; }

/* topic content grid (uniform cards) */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(0.9rem, 1.6vw, 1.4rem);
  align-items: start;
}
.panel-grid > .card.wide { grid-column: 1 / -1; }

/* =============================================================
   CARD reveal + chizuk dark crossfade (override marquee)
   ============================================================= */
.chizuk-viewport { position: relative; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.chizuk-runner { animation: none !important; transition: opacity 480ms ease; max-width: 720px; }
.chizuk-runner.swapping { opacity: 0; }

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in-view { opacity: 1; transform: none; transition: opacity 480ms ease, transform 480ms cubic-bezier(0.16,1,0.3,1); }
@media (prefers-reduced-motion: reduce){ .reveal{opacity:1;transform:none} .tile{opacity:1;transform:none;animation:none} }

/* footer */
.site-footer { border-top-color: var(--line); color: var(--ink-3); margin-top: 3rem; }
.site-footer::before { display: none; }
.ft-credit { color: var(--ink-2); }
.ft-lab { color: var(--gold); }
