:root {
  --bg-deep: #0b0d1f;
  --bg-mid:  #141638;
  --bg-top:  #1d1347;
  --ink:     #e6e1ff;
  --muted:   #b9b2d9;
  --gold:    #d6b25f;
  --gold-2:  #8c6b2f;
  --accent:  #8c6de2;
  --accent-2:#4c2a88;
  --glow:    rgba(214,178,95,0.65);
  --primary-gold: #d4af37; /* warm sacred gold for breathing border */
}

html, body {
  height: 100%;
  background: radial-gradient(1200px 800px at 80% 20%, var(--bg-top), var(--bg-mid) 45%, var(--bg-deep) 86%);
  color: var(--ink);
  font-family: "Frank Ruhl Libre", serif;
  letter-spacing: 0.13px;
}

body {
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

a { color: var(--gold); }

/* Starfield canvas */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Soft vignette */
.vignette::before {
  content: "";
  position: fixed;
  inset: -10%;
  background: radial-gradient(80% 80% at 50% 50%, transparent 55%, rgba(0,0,0,0.45) 95%);
  z-index: 1;
  pointer-events: none;
}

/* Top brand */
.mystic-brand {
  position: fixed;
  top: 1.62rem; /* lowered to make room for בס"ד mark */
  right: 0.72rem;
  z-index: 3;
  font-family: "Assistant", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.52px;
  color: var(--gold);
  text-shadow: 0 0 8.6px rgba(214,178,95,0.25);
}
.mystic-brand small {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

/* Main layout */
.mystic-hero { position: relative; z-index: 2; padding-top: 5rem; padding-bottom: 4rem; }
.mystic-container { max-width: 1200px; }

/* בס"ד mark */
.bsd-mark {
  position: fixed;
  top: 0.36rem;
  right: 0.91rem;
  z-index: 4;
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 700;
  font-size: 0.91rem;
  color: var(--gold);
  text-shadow: 0 0 6.5px rgba(214,178,95,0.25);
  pointer-events: none;
}

.content-panel {
  background: linear-gradient(180deg, rgba(20,19,53,0.75), rgba(12,12,28,0.75));
  border: 1px solid rgba(214,178,95,0.18);
  border-right-color: rgba(214,178,95,0.28);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 0 60px rgba(140,109,226,0.09);
  backdrop-filter: blur(6px) saturate(120%);
  padding: 2rem;
  position: relative; /* needed for ::before border effect */
  z-index: 0;         /* create stacking context for ::before */
}

/* Breathing golden border */
.content-panel::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, var(--primary-gold), transparent, var(--primary-gold));
  border-radius: 22px; /* panel(16px) + 6px for a soft outer halo (22 letters) */
  z-index: -1; /* sit behind the panel content */
  opacity: var(--glowAlpha, 0.6);
  filter: drop-shadow(0 0 calc(8px + 13px * var(--glowAlpha, 0.6)) rgba(212,175,55,0.36));
  will-change: opacity, filter;
  animation: borderGlow 3.26s ease-in-out infinite; /* fallback if JS disabled */
}

@keyframes borderGlow {
  0%, 100% { opacity: 0.49; filter: drop-shadow(0 0 9.1px rgba(212,175,55,0.25)); }
  50% { opacity: 1; filter: drop-shadow(0 0 16.2px rgba(212,175,55,0.45)); }
}

/* When JS is controlling the border glow, disable the CSS animation */
.has-dyn-borderGlow::before {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .content-panel::before { animation: none; opacity: 0.63; }
}

h1.title { font-weight: 700; color: var(--gold); text-shadow: 0 0 13px rgba(214,178,95,0.35); margin-bottom: 0.52rem; }
.subtitle { color: var(--muted); margin-bottom: 1.26rem; }

.he-text { visibility: hidden; }
.he-text p { white-space: pre-line; line-height: 1.9; margin-bottom: 1rem; font-size: 1.1rem; }

/* Word-level animation styles */
.he-text .word { display: inline-block; position: relative; will-change: transform, opacity; text-shadow: 0 0 8px rgba(212,175,55,0.18); }
.he-text .ws { white-space: pre; }
.he-text .spark {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(212,175,55,0.9) 0%, rgba(212,175,55,0.25) 40%, rgba(212,175,55,0) 70%);
  filter: blur(0.6px); opacity: 0;
}

/* SVG */
#gate-wrap { position: relative; min-height: 486px; }
#mysticGate { width: 100%; height: auto; filter: drop-shadow(0 8px 26px rgba(140,109,226,0.26)); }
.particle { opacity: 0.8; }
#letterP { paint-order: stroke fill; stroke: rgba(214,178,95,0.9); stroke-width: 2.6; fill: url(#goldGrad); }

/* Audio player */
#player {
  position: fixed; bottom: 1rem; left: 1rem; z-index: 4;
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(165deg, rgba(19,17,51,0.9), rgba(10,10,24,0.9));
  border: 1px solid rgba(214,178,95,0.28);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 18px rgba(214,178,95,0.1);
  overflow: hidden; transition: width 286ms ease, height 286ms ease, box-shadow 286ms ease;
  backdrop-filter: blur(6.5px) saturate(117%);
}
#player:hover, #player.is-expanded { width: 318px; height: 84px; box-shadow: 0 14px 45px rgba(0,0,0,0.55), 0 0 22px rgba(214,178,95,0.2); }
#player .inner { display: flex; align-items: center; gap: 0.72rem; padding: 0.72rem; height: 100%; }
#togglePlay {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid rgba(214,178,95,0.35);
  color: var(--gold); display: grid; place-items: center; background: rgba(255,255,255,0.03);
  cursor: pointer; transition: transform 182ms ease;
}
#togglePlay:active { transform: scale(0.96); }
#trackTitle { font-family: "Assistant", system-ui, sans-serif; font-size: 0.91rem; color: var(--ink); }
#trackTitle small { color: var(--muted); }
#volume { appearance: none; width: 91px; height: 4px; background: rgba(214,178,95,0.26); border-radius: 999px; outline: none; }
#volume::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 13px var(--glow); border: none; cursor: pointer; }
#volume::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: none; }
#waveform { width: 108px; height: 39px; flex: 0 0 108px; opacity: 0.0; transition: opacity 216ms ease; }
#player.playing #waveform { opacity: 0.94; }

/* Tap overlay */
#tapOverlay { position: fixed; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; text-align: center; background:
  radial-gradient(792px 792px at 50% 50%, rgba(140,109,226,0.15), transparent 72%), rgba(5,6,15,0.63); backdrop-filter: blur(2px) saturate(118%); }
#tapOverlay.active { display: flex; }
#tapOverlay .panel { border: 1px solid rgba(214,178,95,0.36); background: linear-gradient(180deg, rgba(20,19,53,0.86), rgba(10,10,25,0.86)); border-radius: 16px; padding: 1.5rem 1.25rem; max-width: 522px; margin: 1rem; box-shadow: 0 14px 45px rgba(0,0,0,0.5); }
#tapOverlay button { margin-top: 0.72rem; border-radius: 13px; padding: 0.6rem 1rem; background: linear-gradient(165deg, var(--gold), #ffe9b3); color: #1a122f; font-weight: 700; border: none; box-shadow: 0 10px 26px rgba(214,178,95,0.35); cursor: pointer; }

/* Small screens */
@media (max-width: 768px) {
  #player:hover { width: 56px; height: 56px; }
  .columns.is-vcentered { align-items: stretch; }
  #gate-wrap { min-height: 306px; }
}
