/* מקדש מלך — עיצוב 1: day / night.
   style.css is the night theme, untouched. This file adds the toggle and the day theme.

   Night is gold light on a sapphire sky. Day is sapphire ink on white, like blue-and-white porcelain:
   the page is pearl and sky, headings and ornaments are sapphire; gold stays where it is metal on a
   button, and inside the deep "jewel" blocks (donation cards, book covers, footer), which keep the
   night's own gold-on-sapphire.
   The moving effects by day are light, not ink (sparks.js): ribbons, rings and a dust of light in
   sky blue #73D5E9, pale gold #F5E3B7 and blue-white #EDF9FF. No letters are drawn by the effects.
   When the canvas is not running (reduced motion, no WebGL) the same light stands still, below. */

/* ------------------------------------------------------------ the toggle (both themes) */
.theme-btn {
  position: relative; width: 44px; height: 44px; flex: none; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--gold1);
  border: 1px solid rgba(246, 227, 161, .4); background: rgba(10, 16, 48, .5);
  transition: box-shadow .4s var(--ease), border-color .4s, background .4s;
}
.theme-btn:hover { border-color: var(--gold1); box-shadow: 0 0 30px -6px rgba(246, 227, 161, .7); }
.theme-btn .ico, .theme-row .ico { grid-area: 1 / 1; width: 1.3rem; height: 1.3rem; transition: transform .7s var(--ease), opacity .4s; }
/* the icon shows what a press brings: the sun by night, the moon by day */
.ico-moon { opacity: 0; transform: rotate(-90deg) scale(.4); }
[data-theme="day"] .ico-sun { opacity: 0; transform: rotate(90deg) scale(.4); }
[data-theme="day"] .ico-moon { opacity: 1; transform: none; }
.theme-row {
  display: inline-grid; grid-auto-flow: column; align-items: center; gap: .6rem; margin-top: .6rem; padding: .6rem 1.2rem;
  border-radius: 999px; cursor: pointer; font-size: 1rem; color: var(--gold1);
  border: 1px solid rgba(246, 227, 161, .4); background: transparent;
}
.theme-row span { grid-column: 2; }

/* the wipe: the new theme opens as a circle from the button (see initTheme) */
html.theme-wipe::view-transition-old(root), html.theme-wipe::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-wipe::view-transition-old(root) { z-index: 0; }
html.theme-wipe::view-transition-new(root) { z-index: 1; }

@media (max-width: 420px) {
  .theme-btn { width: 36px; height: 36px; }
  .theme-btn .ico { width: 1.1rem; height: 1.1rem; }
  .hdr-end { gap: .4rem; }
  .brand { gap: .5rem; }
  .brand-emblem { width: 40px; }
}
@media (max-width: 380px) {
  .brand-text b { white-space: nowrap; }
  .hdr .btn-sm { padding: .62em .7em; font-size: .75rem; }
}
@media (max-width: 349px) { .hdr .theme-btn { display: none; } }   /* still in the menu */
/* seven nav items: on a narrow desktop they sit a little closer, and the line under the name never wraps */
.brand-text small { white-space: nowrap; }
@media (min-width: 1101px) and (max-width: 1260px) { .nav { gap: .95rem; } .nav a { font-size: .93rem; } .hdr { gap: 1rem; } }

/* ============================================================ DAY */
html[data-theme="day"] {
  color-scheme: light;
  --bg0: #f5f8fe; --bg1: #e8effc;
  --ivory: #131a4c;            /* the text ink */
  --muted: #525c8a;
  --sap1: #0f1e72; --sap2: #1f3cc0; --sap3: #4f86ff;
  /* where night uses gold as light on dark, day uses sapphire as ink on white */
  --gold1: #1c3bbd; --gold2: #2b62d9; --gold3: #17309c;
  --foil-gold: linear-gradient(100deg, #b8862b 0%, #e9c46a 14%, #fff7d6 27%, #e9c46a 40%, #b8862b 54%, #f6e3a1 70%, #d9a94a 86%, #b8862b 100%);
  --foil: linear-gradient(100deg, #0f1e72 0%, #1f3cc0 14%, #5c8cff 27%, #1f3cc0 40%, #0f1e72 54%, #2a4ed6 70%, #17309c 86%, #0f1e72 100%);
  scrollbar-color: #9fb0e6 #f5f8fe;
}
/* the jewel blocks stay deep by day and keep real gold inside them */
html[data-theme="day"] :is(.tier-in, .book, .ftr, .season li.is-next) {
  --ivory: #f4eeda; --muted: #c3c8ea; --gold1: #f6e3a1; --gold2: #e9c46a; --gold3: #b8862b;
  --foil: var(--foil-gold);
  color: var(--ivory);
}
html[data-theme="day"] ::selection { background: rgba(31, 60, 192, .2); color: inherit; }

/* ---- fixed layers */
html[data-theme="day"] .sky {
  background:
    radial-gradient(60vw 50vh at 84% 2%, rgba(255, 255, 255, .95), transparent 70%),       /* clear light */
    radial-gradient(56vw 56vh at 6% 96%, rgba(96, 146, 255, .30), transparent 70%),
    radial-gradient(40vw 40vh at 94% 72%, rgba(132, 116, 255, .11), transparent 70%),
    linear-gradient(180deg, #dfe9ff 0%, #eef3fe 40%, #f8f9fd 72%, #e6eefe 100%);
}
/* no canvas (reduced motion, no WebGL, no JS): the same light, standing still. Three wide ribbons of
   sky blue and pale gold with their fine edges, soft haloes, and rings of light in place of the ink. */
html[data-theme="day"]:not(.sparks) .sky::after {
  opacity: 1;
  background-image:
    radial-gradient(22vmax 22vmax at 16% 30%, rgba(115, 213, 233, .30), transparent 70%),
    radial-gradient(18vmax 18vmax at 84% 64%, rgba(245, 227, 183, .55), transparent 70%),
    radial-gradient(14vmax 14vmax at 58% 18%, rgba(237, 249, 255, .9), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'><defs><linearGradient id='a' x1='0' y1='0' x2='1' y2='.35'><stop offset='0' stop-color='%2373D5E9' stop-opacity='0'/><stop offset='.3' stop-color='%2373D5E9' stop-opacity='.55'/><stop offset='.62' stop-color='%23EDF9FF' stop-opacity='.7'/><stop offset='1' stop-color='%2373D5E9' stop-opacity='.1'/></linearGradient><linearGradient id='b' x1='0' y1='.2' x2='1' y2='0'><stop offset='0' stop-color='%23F5E3B7' stop-opacity='.1'/><stop offset='.45' stop-color='%23F5E3B7' stop-opacity='.8'/><stop offset='.75' stop-color='%23EDF9FF' stop-opacity='.6'/><stop offset='1' stop-color='%23F5E3B7' stop-opacity='0'/></linearGradient><linearGradient id='c' x1='0' y1='1' x2='1' y2='0'><stop offset='0' stop-color='%2373D5E9' stop-opacity='.45'/><stop offset='.5' stop-color='%2373D5E9' stop-opacity='.12'/><stop offset='1' stop-color='%2373D5E9' stop-opacity='.5'/></linearGradient><filter id='s' x='-10%' y='-30%' width='120%' height='160%'><feGaussianBlur stdDeviation='7'/></filter></defs><g filter='url(%23s)'><path d='M-60 760C260 560 560 840 880 590S1380 300 1660 400L1660 520C1400 430 1180 660 900 690S300 660-60 880Z' fill='url(%23a)'/><path d='M-60 250C330 400 700 150 1040 300S1440 560 1660 450L1660 510C1450 640 1140 400 1040 370S340 470-60 330Z' fill='url(%23b)'/><path d='M-60 520C240 380 520 470 800 400S1300 130 1660 170L1660 290C1320 230 1080 480 800 500S260 520-60 640Z' fill='url(%23c)'/></g><g fill='none' stroke-linecap='round'><path d='M-60 760C260 560 560 840 880 590S1380 300 1660 400' stroke='%2373D5E9' stroke-width='1.6' stroke-opacity='.75'/><path d='M-60 250C330 400 700 150 1040 300S1440 560 1660 450' stroke='%23F5E3B7' stroke-width='1.8' stroke-opacity='.95'/><path d='M-60 520C240 380 520 470 800 400S1300 130 1660 170' stroke='%2373D5E9' stroke-width='1.2' stroke-opacity='.6'/><path d='M-60 880C300 660 620 700 900 690S1400 430 1660 520' stroke='%23EDF9FF' stroke-width='2' stroke-opacity='.9'/></g></svg>");
  background-size: auto, auto, auto, cover; background-position: 0 0, 0 0, 0 0, center; background-repeat: no-repeat;
}
html[data-theme="day"]:not(.sparks) .sky::before { background: repeating-radial-gradient(circle, transparent 0 5.6%, rgba(115, 213, 233, .7) 5.7% 5.82%, transparent 5.95% 7.1%); opacity: .7; }
html[data-theme="day"] .cursor-glow { background: radial-gradient(closest-side, rgba(255, 255, 255, .5), rgba(150, 185, 255, .1) 45%, transparent 72%); }
html[data-theme="day"] .grain { filter: invert(1); opacity: .035; }

html[data-theme="day"] #intro { background: radial-gradient(circle at 50% 50%, #ffffff 0%, #e4ecfd 62%); }
html[data-theme="day"] .intro-core i { background: #edf9ff; box-shadow: 0 0 14px 4px rgba(115, 213, 233, .95), 0 0 60px 18px rgba(245, 227, 183, .9); }
html[data-theme="day"] .intro-core b, html[data-theme="day"] .intro-core s { border-color: rgba(115, 213, 233, .9); }

/* ---- buttons: the gold button is the one piece of metal on the page */
html[data-theme="day"] .btn-gold { box-shadow: inset 0 0 0 1px rgba(255, 246, 207, .7), inset 0 -6px 14px -6px rgba(120, 72, 6, .55), 0 12px 26px -12px rgba(110, 76, 14, .65), 0 3px 8px -3px rgba(60, 40, 8, .3); }
html[data-theme="day"] .btn-gold:hover { box-shadow: inset 0 0 0 1px rgba(255, 246, 207, .9), inset 0 -6px 14px -6px rgba(120, 72, 6, .55), 0 18px 36px -12px rgba(110, 76, 14, .75), 0 0 0 5px rgba(233, 196, 106, .22); }
html[data-theme="day"] .btn-ghost { color: var(--sap1); background: rgba(255, 255, 255, .66); box-shadow: inset 0 0 0 1px rgba(31, 60, 192, .42), 0 10px 24px -16px rgba(24, 44, 130, .5); }
html[data-theme="day"] .btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--sap2), 0 14px 34px -14px rgba(31, 60, 192, .55); }

/* ---- header */
html[data-theme="day"] .hdr::before { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(245, 248, 254, .76)); border-bottom-color: rgba(31, 60, 192, .16); box-shadow: 0 10px 30px -22px rgba(24, 44, 130, .5); }
html[data-theme="day"] .brand-emblem::before { background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(150, 185, 255, .22) 55%, transparent 74%); }
html[data-theme="day"] .brand-emblem img { filter: drop-shadow(0 2px 6px rgba(24, 44, 130, .3)); }
html[data-theme="day"] .hdr .brand-text b { color: var(--sap1); }
html[data-theme="day"] .burger, html[data-theme="day"] .theme-btn { border-color: rgba(31, 60, 192, .32); background: rgba(255, 255, 255, .72); }
html[data-theme="day"] .theme-btn:hover { border-color: var(--sap2); box-shadow: 0 8px 24px -8px rgba(31, 60, 192, .5); }
html[data-theme="day"] .theme-row { border-color: rgba(31, 60, 192, .35); color: var(--sap1); }
html[data-theme="day"] .mnav { background: rgba(245, 248, 254, .96); }
html[data-theme="day"] .mnav a:not(.btn) { color: var(--sap1); }

/* ---- hero: by day the name is real type in sapphire; a dust of light gathers into it, and waves of light open behind it */
html[data-theme="day"].sparks .hero-title { opacity: 1; }
html[data-theme="day"] .hero-title { filter: drop-shadow(0 .012em 0 rgba(255, 255, 255, .95)) drop-shadow(0 .05em .11em rgba(16, 31, 115, .3)); }
html[data-theme="day"] .hero-emblem img { filter: drop-shadow(0 0 18px rgba(255, 255, 255, .9)) drop-shadow(0 10px 22px rgba(24, 44, 130, .28)); }
html[data-theme="day"] .halo { background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(150, 185, 255, .2) 46%, transparent 70%); }
/* fine rings of ink behind the name, as on the page of a sefer */
html[data-theme="day"].sparks .hero::before {
  content: ""; position: absolute; left: 50%; top: 47%; width: min(150vh, 150vw); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 5.6%, rgba(31, 60, 192, .15) 5.7% 5.78%, transparent 5.9% 7.1%);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 34%, transparent 66%); mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 34%, transparent 66%);
}

/* ---- glass panels: white glass, a fine line of sapphire, a blue shadow */
html[data-theme="day"] .panel {
  background: linear-gradient(158deg, rgba(255, 255, 255, .88) 0%, rgba(250, 252, 255, .78) 60%, rgba(241, 246, 255, .82) 100%);
  box-shadow: 0 44px 90px -44px rgba(24, 44, 130, .42), 0 10px 26px -14px rgba(24, 44, 130, .16), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 70px rgba(120, 150, 255, .07);
}
html[data-theme="day"] .panel::before { background: conic-gradient(from var(--a), rgba(31, 60, 192, .16), rgba(79, 134, 255, .95) 7%, rgba(16, 31, 115, .42) 20%, rgba(31, 60, 192, .16) 46%, rgba(79, 134, 255, .8) 56%, rgba(16, 31, 115, .32) 70%, rgba(31, 60, 192, .16)); }
html[data-theme="day"] .panel::after { opacity: .8; }

html[data-theme="day"] .eyebrow::before { box-shadow: 0 0 10px 1px rgba(79, 134, 255, .6); }
html[data-theme="day"] .orn { filter: none; stroke-width: 1.3; }
html[data-theme="day"] .facts { border-top-color: rgba(20, 40, 120, .14); }
html[data-theme="day"] .facts dd { color: var(--sap1); }
html[data-theme="day"] .tags li { border-color: rgba(31, 60, 192, .3); background: rgba(31, 60, 192, .06); }
html[data-theme="day"] .beat-dots li.on { background: var(--sap2); box-shadow: 0 0 12px 2px rgba(79, 134, 255, .6); }

/* ---- seven areas + lessons */
html[data-theme="day"] .area, html[data-theme="day"] .serie { border-bottom-color: rgba(20, 40, 120, .11); }
html[data-theme="day"] .area::before { background: linear-gradient(to left, rgba(31, 60, 192, .1), rgba(31, 60, 192, .02) 70%, transparent); }
html[data-theme="day"] .area-num { color: var(--sap1); border-color: rgba(31, 60, 192, .38); background: radial-gradient(circle at 50% 28%, #fff, rgba(79, 134, 255, .16) 78%); }
html[data-theme="day"] .area:hover .area-num, html[data-theme="day"] .area:focus-visible .area-num { background: linear-gradient(165deg, #2b46b8, #0f1a60); color: #fff; box-shadow: 0 8px 22px -6px rgba(31, 60, 192, .6); }
html[data-theme="day"] .area-ico { opacity: .85; }
html[data-theme="day"] .serie:hover .ico, html[data-theme="day"] .serie:focus-visible .ico { color: var(--sap2); filter: drop-shadow(0 0 8px rgba(79, 134, 255, .6)); }

/* ---- kinetic band */
html[data-theme="day"] .marquee-track span { -webkit-text-stroke-color: rgba(31, 60, 192, .36); }
html[data-theme="day"] .marquee-track span:nth-child(4n+1) { color: rgba(79, 134, 255, .1); }
html[data-theme="day"] .marquee-track i { box-shadow: 0 0 16px 2px rgba(79, 134, 255, .5); }

/* ---- donate: the three cards are sapphire jewels on the white panel */
html[data-theme="day"] .tier-in { background: linear-gradient(165deg, #2b46b8, #0f1a60); border-color: rgba(233, 196, 106, .5); box-shadow: 0 20px 40px -24px rgba(16, 26, 94, .8); }
html[data-theme="day"] .tier input:checked + .tier-in { border-color: #e9c46a; background: linear-gradient(165deg, #3c5ce0, #13207c); box-shadow: inset 0 0 0 1.5px #e9c46a, 0 24px 50px -22px rgba(31, 60, 192, .8), 0 0 0 5px rgba(79, 134, 255, .2); }
html[data-theme="day"] .dedic { border-top-color: rgba(20, 40, 120, .13); }
html[data-theme="day"] .chip-btn { color: var(--sap1); background: rgba(31, 60, 192, .05); border-color: rgba(31, 60, 192, .3); }
html[data-theme="day"] .chip-btn:hover { background: rgba(31, 60, 192, .11); }
html[data-theme="day"] .chip-btn[aria-pressed="true"] { background: linear-gradient(165deg, #2b46b8, #0f1a60); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(31, 60, 192, .7); }
html[data-theme="day"] .field input, html[data-theme="day"] .field textarea { background: rgba(255, 255, 255, .92); border-color: rgba(20, 40, 120, .24); }
html[data-theme="day"] .field input::placeholder { color: #656e99; }
html[data-theme="day"] .field input:focus, html[data-theme="day"] .field textarea:focus { border-color: var(--sap2); box-shadow: 0 0 0 3px rgba(79, 134, 255, .26), 0 8px 24px -10px rgba(31, 60, 192, .35); }

/* ---- books: the jewel covers stand on a line of sapphire */
html[data-theme="day"] .shelf-line { background: linear-gradient(90deg, transparent, rgba(31, 60, 192, .55) 20%, rgba(31, 60, 192, .55) 80%, transparent); box-shadow: 0 0 20px 1px rgba(79, 134, 255, .3); }
html[data-theme="day"] .book-item::after { background: radial-gradient(closest-side, rgba(16, 26, 94, .5), transparent); }

/* ---- pidyon + season */
html[data-theme="day"] .season li { border-color: rgba(31, 60, 192, .24); background: rgba(255, 255, 255, .66); }
html[data-theme="day"] .season li:hover { border-color: rgba(31, 60, 192, .7); background: rgba(31, 60, 192, .06); box-shadow: 0 12px 26px -14px rgba(31, 60, 192, .45); }
html[data-theme="day"] .season strong { color: var(--sap1); }
html[data-theme="day"] .season li.is-next { border-color: #e9c46a; background: linear-gradient(165deg, #2b46b8, #0f1a60); box-shadow: 0 16px 32px -16px rgba(31, 60, 192, .7); }
html[data-theme="day"] .season li.is-next strong { color: var(--gold1); }

/* ---- contact + footer: the page closes on the sapphire band of the emblem */
html[data-theme="day"] .addr { border-color: rgba(31, 60, 192, .24); background: rgba(255, 255, 255, .76); }
html[data-theme="day"] .ftr { background: linear-gradient(180deg, transparent 0, rgba(15, 26, 96, .9) 2.6rem, #0c1552 62%); }
html[data-theme="day"]:not(.sparks) .ftr { border-top-color: rgba(233, 196, 106, .55); }
html[data-theme="day"] .preview-pill { color: var(--sap1); background: rgba(255, 255, 255, .84); border-color: rgba(31, 60, 192, .3); }
html[data-theme="day"] .toast { background: rgba(255, 255, 255, .97); border-color: rgba(31, 60, 192, .35); box-shadow: 0 20px 50px -20px rgba(16, 26, 94, .55); }

@media (max-width: 900px) {
  html[data-theme="day"] .panel { background: linear-gradient(158deg, rgba(255, 255, 255, .95) 0%, rgba(249, 251, 255, .95) 55%, rgba(242, 246, 255, .96) 100%); }
}
