/* כיוון: "היכל" — כחול לילה וזהב, רקע קלף, תמונה במסגרת קשת כמו ארון קודש, קישוט זהב בין החלקים */
:root {
  /* שחור וזהב (עיצוב 3 שיקיר בחר). --navy נשאר שם הצבע הכהה הבסיסי */
  --navy: #0b0b0c;
  --navy-2: #141416;
  --gold: #d4ad5a;
  --gold-2: #e8c87e;
  --parchment: #101012;
  --paper: #161618;
  --ink: #efe6d2;
  --ink-soft: #a39a86;
  --line: #2c2923;
  /* הגופן הרגיל של המכשיר — בלי גופנים מיוחדים (יקיר, 8.11) */
  --serif: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --sans: var(--serif);
  --r: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--navy); color: var(--ink);
  font: 400 18px/1.6 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
body.has-player { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
body.no-scroll { overflow: hidden; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: clamp(2rem, 4.4vw, 2.9rem); color: #fff; }
p { margin: 0 0 1em; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: max(20px, env(safe-area-inset-right)); }
.ornament { display: block; width: 200px; height: auto; margin: 14px 0 18px; }
.ornament.start { margin-inline: 0; }

/* ---------- כפתורים ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions.center { justify-content: center; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 24px; border-radius: 999px;
  font: 700 1rem var(--sans); text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .2s var(--ease), background-color .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.gold:hover { background: var(--gold-2); }
.btn.line { border-color: rgba(255, 255, 255, .55); color: #fff; background: transparent; }
.btn.line:hover { border-color: var(--gold-2); color: var(--gold-2); }
.btn.navy, .btn.outline { background: transparent; color: var(--gold-2); border-color: var(--gold); }
.btn.navy:hover, .btn.outline:hover { background: var(--gold); color: var(--navy); }
.btn.big { min-height: 56px; font-size: 1.08rem; padding-inline: 30px; }
.more { display: flex; margin: 28px auto 0; }

/* ---------- מסך פתיחה: מכסה את דף הבית עד שהכול מוכן, ואז נמוג בבת אחת ----------
   app.js מסיר את body.booting; אם הקוד לא רץ בכלל — האנימציה מסירה את הכיסוי לבד אחרי 6 שניות */
.boot {
  position: fixed; inset: 0; z-index: 100; background: var(--navy);
  animation: boot-out .35s ease 6s forwards;
}
body:not(.booting) .boot { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s ease, visibility 0s .35s; animation: none; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* ---------- פתיח: תמונה גדולה שנמוגה לשחור, השם עליה ---------- */
body.on-home { display: flex; flex-direction: column; min-height: 100svh; }
body.on-home #home { flex: 1; display: flex; }
.hero { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; background: var(--navy); color: #fff; overflow: hidden; }
.hero-photo { position: absolute; inset: 0 0 auto 0; height: 70%; }
.hero-photo picture { display: contents; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 0; display: block; }
.hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(11, 11, 12, .15) 0%, transparent 30%, rgba(11, 11, 12, .6) 70%, var(--navy) 99%); }
.hero-text { position: relative; text-align: center; padding: 0 20px 18px; }
.hero h1 { font-size: clamp(2.8rem, 9vw, 5.4rem); font-weight: 700; text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
.hero h1 span { display: block; font-size: .42em; color: var(--gold-2); margin-top: 8px; }
.hero .ornament { margin: 14px auto 22px; }

.arch { margin: 0; position: relative; align-self: end; }
.arch img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 4.6; object-fit: cover; object-position: 62% 0%;
  border-radius: 999px 999px 0 0; border: 6px solid var(--gold); border-bottom: 0;
}
.arch::before {
  content: ""; position: absolute; inset: -14px -14px 0; border: 1px solid rgba(226, 194, 122, .45);
  border-bottom: 0; border-radius: 999px 999px 0 0; pointer-events: none;
}
.arch.small img { aspect-ratio: 1 / 1.15; border-width: 5px; border-bottom: 5px solid var(--gold); border-radius: 999px 999px 18px 18px; object-position: 50% 40%; }
.arch.small::before { inset: -10px; border: 1px solid var(--gold); border-radius: 999px 999px 26px 26px; }

/* ---------- הפינה של היום ---------- */
.today { background: var(--parchment); border-bottom: 1px solid var(--line); }
.today-in { display: grid; grid-template-columns: 300px 1fr; gap: 40px; padding-block: 48px; align-items: start; }
.today-date { font: 700 1.35rem var(--serif); color: var(--gold); margin: 6px 0 10px; }
.today .list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 18px; box-shadow: var(--shadow); }

/* ---------- רשימות ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
#archive-list .item:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.play {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--navy); border: 0; cursor: pointer; text-decoration: none; font-size: .95rem;
  transition: transform .2s var(--ease), background-color .2s;
}
.play:hover { transform: scale(1.06); }
.play.ext { background: transparent; color: var(--gold-2); border: 2px solid var(--gold); }
.item.playing .play, .card.playing .card-play { background: #fff; color: var(--navy); }
.item.playing .item-title { color: var(--gold-2); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 1.05rem; color: #fff; }
.item-meta { color: var(--ink-soft); font-size: .9rem; }

/* ---------- כרטיסים ---------- */
.block { padding-block: 72px; }
.parchment { background: var(--parchment); }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head .ornament { margin-inline: auto; }
.section-head p { color: var(--ink-soft); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(19, 32, 59, .16); }
.card-media { position: relative; height: 0; padding-top: 62%; background: var(--navy); }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; }
.card-play {
  position: absolute; z-index: 1; inset-inline-start: 14px; bottom: -22px; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold); color: var(--navy);
  border: 3px solid var(--paper); font-size: 1rem;
}
.card-body { padding: 30px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font: 700 1.15rem/1.4 var(--serif); color: #fff; }
.card-meta { margin-top: auto; color: var(--ink-soft); font-size: .88rem; border-top: 1px solid var(--line); padding-top: 10px; }
.badge { display: inline-block; margin-inline-start: 8px; padding: 0 10px; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: .78rem; font-weight: 700; }

/* ---------- ארכיון ---------- */
#archive-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
.archive { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }
.filters { display: grid; gap: 14px; margin-bottom: 8px; }
#q { width: 100%; min-height: 52px; padding: 10px 18px; border: 1.5px solid var(--line); border-radius: 999px; font: inherit; background: var(--paper); color: var(--ink); }
#q:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196, 154, 60, .25); }
.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; min-height: 42px; padding: 6px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font: 500 .95rem var(--sans);
}
.tabs button[aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.note { color: var(--ink-soft); font-size: .92rem; margin: 18px 0 0; text-align: center; }

/* ---------- על הרב ---------- */
.about { display: grid; grid-template-columns: 340px 1fr; gap: 64px; align-items: center; }
.about h2 { margin-bottom: 18px; }

/* ---------- הזמנה ---------- */
.booking { background: var(--navy); color: #fff; padding-block: 72px; }
.booking h2 { color: #fff; }
.booking-in { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center; }
.booking p { opacity: .9; font-size: 1.1rem; max-width: 34em; }
.booking-actions { display: grid; gap: 14px; }

/* ---------- סיום ---------- */
.footer { background: var(--navy); color: rgba(255, 255, 255, .7); text-align: center; padding-block: 14px; font-size: .92rem; }

.wa-float {
  position: fixed; z-index: 15; inset-inline-end: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: #25d366; color: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  transition: transform .2s var(--ease);
}
.wa-float:hover { transform: scale(1.07); }
body.has-player .wa-float { bottom: calc(150px + env(safe-area-inset-bottom)); }


@media (min-width: 961px) {
  .hero { justify-content: center; }
  .hero-photo { inset: 0 auto 0 0; width: 58%; height: 100%; }
  .hero-photo::after { background: linear-gradient(to right, transparent 40%, var(--navy) 98%), linear-gradient(to bottom, transparent 70%, var(--navy) 100%); }
  .hero-text { width: 46%; margin-inline-start: 4%; padding: 0; }
}
@media (max-width: 960px) {
  .today-in { grid-template-columns: 1fr; gap: 20px; padding-block: 40px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  #archive-list { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .about .arch.small { max-width: 260px; margin-inline: auto; }
  .about .ornament.start { margin-inline: auto; }
  .booking-in { grid-template-columns: 1fr; text-align: center; }
  .booking .ornament, .booking p { margin-inline: auto; }
  .block { padding-block: 56px; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .archive { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- אריחי קטגוריות ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 22px; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--r);
  box-shadow: var(--shadow); transition: transform .2s var(--ease);
}
.tile:hover { transform: translateY(-3px); }
.tile-src { font-size: .82rem; color: var(--gold); }
.tile-name { font: 700 1.35rem/1.25 var(--serif); color: #fff; }
.tile-count { color: var(--ink-soft); font-size: .92rem; margin-top: auto; }

/* ---------- שיעורים במהלך השבוע ---------- */
.weekly { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.w-card { display: grid; gap: 4px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); box-shadow: var(--shadow); }
.w-day { font: 700 1.3rem var(--serif); color: #fff; }
.w-time { color: var(--gold); font-weight: 700; }
.w-place { color: var(--ink-soft); font-size: .92rem; }

/* ---------- ספרייה ---------- */
.lib-head { background: var(--navy); color: #fff; padding-block: calc(84px + env(safe-area-inset-top)) 40px; }
.lib-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.lib-head p { opacity: .85; margin: 10px 0 0; max-width: 40em; }
.back { color: var(--gold-2); text-decoration: none; font-size: .95rem; }
.lib-body { padding-block: 28px 64px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select {
  min-height: 46px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--paper); font: inherit; color: var(--ink);
}
.filters input { flex: 1 1 240px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196, 154, 60, .25); }
.lib-count { color: var(--ink-soft); margin-inline-start: auto; }
.lib-list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 20px; box-shadow: var(--shadow); }
.lib-list:empty { display: none; }
.item.playing { background: rgba(196, 154, 60, .08); }

/* ---------- אייקונים בתחתית ---------- */
.social { list-style: none; display: flex; justify-content: center; gap: 18px; padding: 0; margin: 18px 0 16px; }
.soc {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid var(--gold); color: var(--gold-2); transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.soc[href]:hover { background: var(--gold); color: var(--navy); transform: translateY(-2px); }
.soc.soon { opacity: .35; cursor: default; }
/* שורת האייקונים רק במסך הבית (יקיר, 8.11); בשאר העמודים — מקום לנגן המוקטן בתחתית */
body:not(.on-home) .footer { display: none; }
@media (max-width: 600px) { body:not(.on-home) main { padding-bottom: 96px; } }

/* ---------- עמודים מתפריט הצד ---------- */
#pages > section:first-of-type, #pages > section:not([hidden]) { padding-top: calc(96px + env(safe-area-inset-top)); }
#pages .today { border-bottom: 0; }
#pages #latest { padding-top: 24px !important; }
#pages .booking { min-height: 70svh; display: flex; align-items: center; }
body.on-home .wa-float { display: none; }

