/* ============================================================================
   Memorial Yosef — style.css
   Refactored 2026-04-16 (conservative cleanup — no visual changes intended).

   ORGANIZATION
   1.  Reset & base
   2.  Design tokens (:root)
   3.  Base elements & typography
   4.  Utilities (container, section helpers, reveal)
   5.  Section wrappers
   6.  Layout components
        - Nav
        - Hero
        - Film strips (hero / menatzikhim / sticker) + @keyframes filmScroll
        - Slideshow controls (arrows + dots)
        - Biography
        - Song
        - Jokes
        - Gallery + Lightbox
        - Letters
        - Video
        - Media / news
        - Form
        - Footer
   7.  Fixed-position widgets (music player, music prompt, share widget)
   8.  Keyframes (non-filmstrip)
   9.  Responsive (@media 768, 520, 480)

   NOTES
   - Unused selectors extracted to _unused.css (not linked).
   - Two undefined CSS variables (`--shadow-md`, `--text-main`) are intentionally
     left as-is on #song rules to preserve current rendering (they silently
     resolve to `initial`/inherited — see refactor report).
   ============================================================================ */


/* ============================================================================
   1. RESET & BASE
   ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ============================================================================
   2. DESIGN TOKENS
   ============================================================================ */
:root {
  --navy: #2d4a2d;
  --navy-light: #3d5f3d;
  --forest: #1e3320;
  --forest-light: #2a4a2c;
  --gold: #c8612a;
  --gold-light: #e07b43;
  --gold-dark: #a64c1d;
  --off-white: #fdf6ec;
  --soft-gray: #e8ede0;
  --text-dark: #1e3320;
  --text-mid: #4a5a42;
  --text-light: #7a8a6a;
  --white: #ffffff;
  --shadow: 0 4px 24px rgba(30, 51, 32, 0.12);
  --shadow-lg: 0 8px 40px rgba(30, 51, 32, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s ease;
  --font: 'Heebo', sans-serif;
}


/* ============================================================================
   3. BASE ELEMENTS & TYPOGRAPHY
   ============================================================================ */
html {
  scroll-behavior: smooth;
  direction: rtl;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background-color: var(--off-white);
  color: var(--text-dark);
  line-height: 1.7;
  font-size: 16px;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  width: 100%;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font);
}

h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: clamp(2.2rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.8rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }


/* ============================================================================
   4. UTILITIES
   ============================================================================ */
.container {
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-mid);
  font-size: 1.05rem;
  margin-bottom: 3rem;
}

.section-divider {
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 0.8rem auto 1.5rem;
  border-radius: 2px;
}

/* Scroll reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }


/* ============================================================================
   5. SECTION WRAPPERS
   ============================================================================ */
.section-light {
  background: var(--off-white);
  padding: 5rem 0;
}

.section-alt {
  background: var(--soft-gray);
  padding: 5rem 0;
}

.section-dark {
  background: var(--forest);
  padding: 5rem 0;
}


/* ============================================================================
   6. COMPONENTS
   ============================================================================ */

/* ---------- 6.1  NAV ---------- */
#navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  padding: 1rem 0;
  transition: background var(--transition), box-shadow var(--transition), padding var(--transition);
  background: transparent;
}

#navbar.scrolled {
  background: rgba(45, 74, 45, 0.97);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  padding: 0.6rem 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-links {
  display: flex;
  gap: 0.3rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-weight: 400;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
  color: var(--gold-light);
  background: rgba(255,255,255,0.08);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  padding: 0.2rem;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}


/* ---------- 6.2  HERO ---------- */
#hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #1e3320;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(200, 97, 42, 0.15) 0%, transparent 60%),
    linear-gradient(160deg, #162a17 0%, #2d4a2d 50%, #3d5f3d 100%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 248, 235, 0.15);
  z-index: 2;
}

.hero-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  text-align: center;
  width: 100%;
  padding: 2rem 1rem;
}

.hero-badge {
  display: block;
  color: #c8612a;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.hero-service {
  font-size: 0.95rem;
  color: #ffffff;
  text-align: center;
  line-height: 1.8;
  margin-top: 0.8rem;
  opacity: 0.9;
}

.hero-name {
  color: #ffffff;
  font-size: 4rem;
  font-weight: 800;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.5rem;
}

.hero-dates {
  color: #c8612a;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.hero-tagline {
  color: #ffffff;
  font-size: 2.5rem;
  font-weight: 500;
  max-width: 700px;
  margin: 0 auto 2rem;
  line-height: 1.4;
}

.hero-scroll {
  display: inline-flex;
  align-items: center;
  color: #ffffff;
  animation: bounce 2s infinite;
}

.hero-scroll svg {
  width: 24px;
  height: 24px;
}


/* ---------- 6.3  FILM STRIPS ---------- */
/* Hero film strip */
.hero-slideshow {
  position: absolute;
  top: 0;
  left: 0;
  direction: ltr;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: 100vh;
  width: max-content;
  animation: filmScroll 45s linear infinite;
  will-change: transform;
  z-index: 1;
}

.hero-slide {
  flex: 0 0 auto;
  height: 100vh;
  line-height: 0;
  flex-shrink: 0;
}

.hero-slide .slide-img {
  height: 100vh;
  width: auto;
  max-width: none;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* Menatzikhim film strip */
#menatzikhim {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

#menatzikhim-slideshow {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 6rem 2rem 2rem;
  align-content: center;
  justify-items: center;
  z-index: 1;
}

.menatz-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: #000;
}

.menatz-box .menatz-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.menatz-box .menatz-img.is-active {
  opacity: 1;
}

.menatzikhim-overlay {
  display: none;
}

#menatzikhim .section-title {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  color: white;
  text-align: center;
  width: 100%;
  margin: 0;
}

#menatzikhim .section-title h2 {
  color: #ffffff;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 40px rgba(0,0,0,0.7);
  letter-spacing: 0.04em;
}

/* Sticker section — "blown by wind" flying grid (4x2 desktop, 3x3 mobile).
   Images fly in/out of their slot; the outer wrapper's overflow:hidden
   clips them at the section edge. */
#sticker-slideshow {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
  z-index: 1;
}

.sticker-slot {
  position: relative;
}

.sticker-flyer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  will-change: transform, opacity;
  backface-visibility: hidden;
  /* Each flyer reads its in/out vectors from CSS custom properties set inline. */
  --in-tx: 0px;
  --in-ty: 0px;
  --in-rot: 0deg;
  --out-tx: 0px;
  --out-ty: 0px;
  --out-rot: 0deg;
  opacity: 0;
}

.sticker-flyer.fly-in {
  animation: stickerFlyIn 900ms cubic-bezier(0.2, 0.8, 0.25, 1) forwards;
}

.sticker-flyer.fly-out {
  animation: stickerFlyOut 900ms cubic-bezier(0.55, 0, 0.85, 0.2) forwards;
}

@keyframes stickerFlyIn {
  0%   { transform: translate(var(--in-tx), var(--in-ty)) rotate(var(--in-rot)) scale(0.85); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
}

@keyframes stickerFlyOut {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--out-tx), var(--out-ty)) rotate(var(--out-rot)) scale(0.7); opacity: 0; }
}

@keyframes filmScroll {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

@keyframes letterScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}


/* ---------- 6.4  SLIDESHOW CONTROLS (prev/next arrows + dots) ---------- */
.slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.slideshow-arrow:hover {
  background: rgba(200, 97, 42, 0.35);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
}

.slideshow-arrow svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.slideshow-prev { left: 1.5rem; }
.slideshow-next { right: 1.5rem; }

.slideshow-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.slideshow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.slideshow-dot.active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.35);
}

.slideshow-dot:hover:not(.active) {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.3);
}

/* Hide arrows / dots when only one slide */
.slideshow-arrow.hidden,
.slideshow-dots.hidden {
  display: none;
}


/* ---------- 6.5  BIOGRAPHY ---------- */
.bio-chapter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 5rem;
}

.bio-chapter:last-child {
  margin-bottom: 0;
}

.bio-chapter.reverse {
  direction: ltr;
}

.bio-chapter.reverse .bio-text {
  direction: rtl;
  text-align: right;
}

.bio-text h3 {
  color: var(--navy);
  margin-bottom: 1rem;
  position: relative;
  padding-bottom: 0.8rem;
}

.bio-text h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
}

.bio-text p {
  color: var(--text-mid);
  font-size: 1.05rem;
}

.bio-image-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #fdf6ec;
  position: relative;
  height: auto;
}

.bio-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Used by JS onerror fallback when an image fails to load */
.bio-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ddd8cc 0%, #ccc8be 100%);
  color: #aaa;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.bio-image-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.bio-image-caption {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  background: linear-gradient(transparent, rgba(30,51,32,0.7));
  color: white;
  font-size: 0.85rem;
  padding: 1.5rem 1rem 0.8rem;
  text-align: right;
}


/* ---------- 6.6  SONG ---------- */
#song .song-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-top: 2rem;
  align-items: start;
}

#song .song-video .video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#song .song-video .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

#song .song-lyrics {
  height: 400px;
  overflow: hidden;
  position: relative;
  direction: rtl;
  background: #fdf6ec;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md); /* NOTE: --shadow-md is intentionally undefined — preserves original rendering (no shadow) */
  padding: 0 1.75rem;
}

#song .song-lyrics-track {
  display: flex;
  flex-direction: column;
  animation: song-lyrics-scroll 28s linear infinite;
  will-change: transform;
}

#song .song-lyrics-block {
  text-align: right;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 2.2;
  color: var(--text-main); /* NOTE: --text-main is intentionally undefined — preserves original rendering (inherits) */
  white-space: pre-line;
  padding: 1.5rem 0;
  flex-shrink: 0;
}

#song .song-credits {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(200, 97, 42, 0.35);
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--text-light);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}


/* ---------- 6.7  JOKES ---------- */
#jokes {
  background: #fffbf0;
  padding: 5rem 1rem;
  direction: rtl;
}

.jokes-inner {
  max-width: 800px;
  margin: 0 auto;
}

.jokes-header {
  text-align: center;
  margin-bottom: 1rem;
}

.jokes-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #2d4a2d;
  margin-bottom: 0.75rem;
}

.jokes-stage {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.jokes-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 220px;
}

.jokes-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  padding: 2.5rem 2rem;
  text-align: right;
  direction: rtl;
  animation-duration: 0.5s;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.jokes-card.slide-in-right  { animation-name: jokeSlideInRight; }
.jokes-card.slide-out-left  { animation-name: jokeSlideOutLeft; }
.jokes-card.slide-in-left   { animation-name: jokeSlideInLeft; }
.jokes-card.slide-out-right { animation-name: jokeSlideOutRight; }

.jokes-counter {
  font-size: 0.85rem;
  color: #c8612a;
  font-weight: 600;
  margin-bottom: 1rem;
  direction: rtl;
}

.jokes-text {
  font-size: 1.3rem;
  line-height: 2;
  color: #222;
  margin: 0;
}

.jokes-arrow {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #2d4a2d;
  color: #ffffff;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.jokes-arrow:hover {
  background: #c8612a;
  transform: scale(1.1);
}

.jokes-reactions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: #fff;
  border: 2px solid #e8ede0;
  border-radius: 16px;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  min-width: 80px;
}

.reaction-btn:hover {
  border-color: #2d4a2d;
  box-shadow: 0 4px 16px rgba(45,74,45,0.15);
}

.reaction-btn.pop {
  animation: reactionPop 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.reaction-emoji {
  font-size: 2rem;
  line-height: 1;
}

.reaction-label {
  font-size: 0.8rem;
  color: #555;
  font-weight: 500;
}

.reaction-count {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2d4a2d;
}


/* ---------- 6.8  GALLERY ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.gallery-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--soft-gray);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  aspect-ratio: 1 / 1;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--transition);
}

.gallery-item:hover img {
  opacity: 0.9;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 51, 32, 0.0);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item:hover .gallery-item-overlay {
  background: rgba(30, 51, 32, 0.35);
}

.gallery-item-overlay svg {
  color: white;
  opacity: 0;
  transition: opacity var(--transition);
  width: 40px;
  height: 40px;
}

.gallery-item:hover .gallery-item-overlay svg {
  opacity: 1;
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  background: linear-gradient(transparent, rgba(30,51,32,0.75));
  color: white;
  font-size: 0.8rem;
  padding: 1rem 0.75rem 0.5rem;
  text-align: right;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
}

/* Gallery pagination footer */
.gallery-footer {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.gallery-counter {
  color: var(--text-mid);
  font-size: 0.95rem;
  font-weight: 500;
}

.gallery-load-more {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: #556b2f; /* olive green */
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 2rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 0 4px 16px rgba(85, 107, 47, 0.25);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.gallery-load-more:hover:not(:disabled) {
  background: #6b8233;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(85, 107, 47, 0.35);
}

.gallery-load-more:disabled {
  opacity: 0.75;
  cursor: wait;
}

.gallery-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: gallery-spin 0.8s linear infinite;
}

.gallery-load-more.loading .gallery-spinner {
  display: inline-block;
}

.gallery-load-more.loading .gallery-load-more-label {
  opacity: 0.8;
}


/* ---------- 6.9  LIGHTBOX ---------- */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  cursor: pointer;
}

#lightbox.open {
  display: flex;
}

#lightbox img {
  max-width: min(90vw, 900px);
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
  cursor: default;
}

#lightbox-caption {
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  text-align: center;
}

#lightbox-close {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  cursor: pointer;
  z-index: 10;
}

#lightbox-close:hover {
  background: rgba(255,255,255,0.2);
}

#lightbox-prev,
#lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(45,74,45,0.6);
  border: 2px solid rgba(200,97,42,0.5);
  color: white;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  z-index: 10;
}

#lightbox-prev { left: 1.5rem; }
#lightbox-next { right: 1.5rem; }

#lightbox-prev:hover,
#lightbox-next:hover {
  background: rgba(200,97,42,0.7);
  border-color: var(--gold);
}

#lightbox-counter {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45,74,45,0.7);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(200,97,42,0.4);
  border-radius: 20px;
  padding: 0.25rem 0.9rem;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  pointer-events: none;
}


/* ---------- 6.10  LETTERS (ENVELOPE STRIP) ---------- */

.letters-strip-outer {
  overflow: hidden;
  direction: ltr;
  width: 100%;
  padding: 2.5rem 0;
}

.letters-strip {
  display: flex;
  flex-direction: row;
  gap: 1.8rem;
  width: max-content;
  padding: 0.5rem 3rem;
  align-items: center;
  animation: letterScroll 70s linear infinite;
  will-change: transform;
}

.letters-strip-outer:hover .letters-strip {
  animation-play-state: paused;
}

/* Wrapper: envelope + caption below */
.env-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* Individual envelope */
.env-card {
  width: 200px;
  height: 140px;
  position: relative;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 0.25s ease, filter 0.25s ease;
  outline: none;
}

.env-card:hover,
.env-card:focus {
  transform: translateY(-7px) scale(1.04);
  filter: drop-shadow(0 10px 22px rgba(30, 51, 32, 0.28));
}

/* Envelope body */
.env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, #fdf6ec 0%, #f4e8d4 100%);
  border: 1.5px solid var(--navy);
  border-radius: 3px;
  overflow: hidden;
}

/* Bottom-left fold */
.env-body::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  border-style: solid;
  border-width: 0 0 72px 100px;
  border-color: transparent transparent rgba(45,74,45,0.13) transparent;
}

/* Bottom-right fold */
.env-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  border-style: solid;
  border-width: 0 100px 72px 0;
  border-color: transparent rgba(45,74,45,0.13) transparent transparent;
}

/* Top flap */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 68px;
  background: var(--navy-light);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 2;
  border-radius: 3px 3px 0 0;
  transition: background 0.25s;
}

.env-card:hover .env-flap,
.env-card:focus .env-flap {
  background: var(--navy);
}

/* Postage-stamp seal — top-right corner */
.env-seal {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--gold);
  border: 1.5px solid var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.82rem;
  z-index: 4;
  box-shadow: 0 1px 5px rgba(0,0,0,0.22);
  transition: transform 0.25s, background 0.25s;
}

.env-card:hover .env-seal,
.env-card:focus .env-seal {
  transform: scale(1.1);
  background: var(--gold-dark);
}

/* Author name — bottom of envelope body */
.env-label {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 4;
  direction: rtl;
  padding: 0 10px;
}

.env-author {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.82rem;
  line-height: 1.3;
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Relationship caption — below the envelope */
.env-caption {
  color: var(--gold-dark);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  max-width: 200px;
  direction: rtl;
  line-height: 1.3;
  padding: 0 4px;
  font-family: var(--font);
}

/* ----------  LETTER MODAL ---------- */
.env-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.env-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.env-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 51, 32, 0.72);
  backdrop-filter: blur(4px);
}

.env-modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  max-width: 620px;
  width: calc(100% - 3rem);
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 20px 60px rgba(30, 51, 32, 0.32);
  direction: rtl;
  transform: scale(0.93) translateY(14px);
  transition: transform 0.3s ease;
  border-top: 5px solid var(--gold);
}

.env-modal.is-open .env-modal-card {
  transform: scale(1) translateY(0);
}

.env-modal-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-light);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  font-family: var(--font);
  line-height: 1;
  padding: 0;
}

.env-modal-close:hover {
  background: var(--soft-gray);
  color: var(--navy);
}

.env-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--soft-gray);
}

.env-modal-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.env-modal-author {
  font-weight: 700;
  color: var(--navy);
  font-size: 1.05rem;
}

.env-modal-rel {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 2px;
}

.env-modal-date {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 2px;
}

.env-modal-body {
  color: var(--text-mid);
  font-size: 1rem;
  line-height: 1.9;
  white-space: pre-line;
}


/* ---------- 6.11  VIDEO ---------- */
.video-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: #000;
}

.video-embed iframe,
.video-embed video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius);
}


/* ---------- 6.12  MEDIA / NEWS ---------- */
.media-card {
  flex: 0 0 300px;
  background: var(--white);
  margin-left: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.09);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
}

/* ── image area ─────────────────────────────── */
.media-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f0ebe2;
  flex-shrink: 0;
}

.media-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* fallback = site logo: contain + padding, no crop */
.media-card-image--fallback img {
  object-fit: contain;
  padding: 1.25rem;
  background: #faf7f2;
}

/* ── text body ──────────────────────────────── */
.media-card-body {
  padding: 0.75rem 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.media-card-outlet {
  font-weight: 700;
  color: var(--forest);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-card-headline {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.media-card-date {
  color: #999;
  font-size: 0.72rem;
  margin-top: auto;
  padding-top: 0.3rem;
}


/* ---------- 6.13  FORM ---------- */
.form-section-inner {
  max-width: 680px;
  margin: 0 auto;
}

.contact-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.form-group label {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.92rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  font-family: var(--font);
  font-size: 1rem;
  direction: rtl;
  text-align: right;
  border: 2px solid var(--soft-gray);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background: var(--off-white);
  color: var(--text-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,97,42,0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 140px;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-light);
}

.btn-submit {
  width: 100%;
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-submit:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit svg {
  width: 20px;
  height: 20px;
}

#form-success {
  display: none;
  text-align: center;
  padding: 2rem;
  color: var(--navy);
}

#form-success svg {
  width: 56px;
  height: 56px;
  color: #27ae60;
  margin: 0 auto 1rem;
}

#form-success h3 {
  color: var(--navy);
  margin-bottom: 0.5rem;
}

#form-success p {
  color: var(--text-mid);
}


/* ---------- 6.14  FOOTER ---------- */
footer {
  background: #1e3320;
  color: rgba(255,255,255,0.7);
  padding: 3rem 0 1.5rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-inner > div {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-inner > div p {
  font-size: 0.9rem;
  line-height: 1.8;
  margin-bottom: 0.3rem;
}

.footer-name {
  color: var(--white);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.footer-dates {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-contact a {
  color: var(--gold-light);
  transition: color var(--transition);
}

.footer-contact a:hover {
  color: var(--white);
}

.footer-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.idf-badge {
  width: 70px;
  height: 70px;
  background: rgba(200,97,42,0.12);
  border: 2px solid rgba(200,97,42,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}


/* ============================================================================
   7. FIXED-POSITION WIDGETS
   ============================================================================ */

/* ---------- 7.1  BACKGROUND MUSIC PLAYER ---------- */
.music-player {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem 0.55rem 0.75rem;
  background: var(--navy);
  color: var(--white);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(30, 51, 32, 0.35);
  font-family: var(--font);
  direction: rtl;
  border: 1px solid rgba(200, 97, 42, 0.4);
  max-width: calc(100vw - 2.5rem);
}

.music-toggle {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  position: relative;
}

.music-toggle:hover {
  background: var(--gold-dark);
  transform: scale(1.05);
}

.music-toggle svg {
  width: 20px;
  height: 20px;
}

.music-toggle .music-icon-play { display: block; }
.music-toggle .music-icon-pause { display: none; }

.music-player.playing .music-toggle .music-icon-play { display: none; }
.music-player.playing .music-toggle .music-icon-pause { display: block; }

.music-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.music-title::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--gold);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M12 3v10.55A4 4 0 1 0 14 17V7h4V3h-6z'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M12 3v10.55A4 4 0 1 0 14 17V7h4V3h-6z'/></svg>") center/contain no-repeat;
}

.music-volume {
  flex-shrink: 0;
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
  cursor: pointer;
  transition: background var(--transition);
}

.music-volume::-webkit-slider-thumb:hover {
  background: var(--gold-dark);
}

.music-volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
  cursor: pointer;
}


/* ---------- 7.2  MUSIC FIRST-VISIT PROMPT ---------- */
.music-prompt {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(30, 51, 32, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.music-prompt.visible {
  display: flex;
  opacity: 1;
}

.music-prompt-inner {
  background: var(--off-white);
  color: var(--text-dark);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  max-width: 360px;
  width: calc(100% - 2rem);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  border-top: 4px solid var(--gold);
}

.music-prompt-inner svg {
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.music-prompt-inner p {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-dark);
}

.music-prompt-buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.music-prompt-btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.music-prompt-primary {
  background: var(--gold);
  color: var(--white);
}

.music-prompt-primary:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

.music-prompt-secondary {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid rgba(30, 51, 32, 0.2);
}

.music-prompt-secondary:hover {
  background: rgba(30, 51, 32, 0.06);
}


/* ---------- 7.3  FLOATING SHARE WIDGET ---------- */
.share-widget {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  font-family: var(--font);
  direction: rtl;
}

.share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: #556b2f; /* olive green */
  color: var(--white);
  border: 2px solid #c8612a; /* terracotta accent */
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(30, 51, 32, 0.4);
  min-height: 48px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.share-toggle:hover {
  background: #6b8233;
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(30, 51, 32, 0.5);
}

.share-toggle svg {
  width: 20px;
  height: 20px;
}

.share-toggle-label {
  letter-spacing: 0.03em;
}

.share-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #fdf6ec;
  border: 2px solid #556b2f;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(30, 51, 32, 0.4);
  padding: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  direction: rtl;
}

.share-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.share-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: #556b2f;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--white);
  border: 1px solid rgba(85, 107, 47, 0.25);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  min-height: 44px;
  text-align: right;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.share-option:hover {
  background: #f5efdf;
  border-color: #c8612a;
  transform: translateY(-1px);
}

.share-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(200, 97, 42, 0.12);
  color: #c8612a;
  flex-shrink: 0;
}

.share-option-icon svg {
  width: 18px;
  height: 18px;
}

.share-option span:last-child {
  flex: 1;
}


/* ============================================================================
   8. KEYFRAMES (non-filmstrip)
   ============================================================================ */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes jokeSlideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes jokeSlideOutLeft {
  from { transform: translateX(0);     opacity: 1; }
  to   { transform: translateX(-100%); opacity: 0; }
}

@keyframes jokeSlideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

@keyframes jokeSlideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

@keyframes reactionPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35) rotate(-5deg); }
  60%  { transform: scale(0.92) rotate(3deg); }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes gallery-spin {
  to { transform: rotate(360deg); }
}

@keyframes song-lyrics-scroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}


/* ============================================================================
   9. RESPONSIVE
   ============================================================================ */

/* ---------- 9.1  max-width: 768px (tablet) ---------- */
@media (max-width: 768px) {
  .container {
    width: 92%;
  }

  /* Nav: show hamburger, collapse links into dropdown */
  .nav-inner {
    justify-content: flex-end;
    padding: 0 0.25rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: rgba(45, 74, 45, 0.98);
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    min-height: 44px;
    width: 100%;
  }

  /* Hero */
  .hero-name {
    font-size: clamp(2.2rem, 9vw, 3.6rem);
    white-space: normal;
    line-height: 1.15;
  }

  .hero-dates {
    font-size: 0.95rem;
  }

  .hero-tagline {
    font-size: clamp(1.1rem, 4.2vw, 1.6rem);
    margin-bottom: 1.75rem;
  }

  .hero-content {
    padding: 2rem 1rem;
  }

  .hero-badge {
    font-size: 0.8rem;
  }

  .hero-scroll {
    padding: 0.5rem;
    min-height: 44px;
  }

  .slideshow-arrow {
    width: 44px;
    height: 44px;
  }

  /* Bio stacks */
  .bio-chapter {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    margin-bottom: 3rem;
  }

  .bio-chapter.reverse {
    direction: rtl;
  }

  .bio-chapter.reverse .bio-image-wrap {
    order: -1;
  }

  /* Song stacks */
  #song .song-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  #song .song-lyrics {
    height: 340px;
  }

  /* Gallery: 2 columns on tablet */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Menatzikhim: tighter gap on tablet */
  #menatzikhim-slideshow {
    gap: 0.75rem;
    padding: 1.5rem;
  }

  /* Sticker: 3x3 grid on tablet (still 9 visible slots) */
  #sticker-slideshow {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }

  /* Letters strip: smaller envelopes on mobile */
  .env-card {
    width: 170px;
    height: 120px;
  }

  .env-flap {
    height: 58px;
  }

  /* Footer stacks */
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .footer-inner > div,
  .footer-contact {
    text-align: center !important;
  }

  /* Section padding */
  .section-light,
  .section-alt,
  .section-dark {
    padding: 4rem 0;
  }

  /* Modal full-width on mobile */
  .env-modal-card {
    width: calc(100% - 2rem);
    padding: 2rem 1.25rem 1.5rem;
    max-height: 90vh;
  }

  .btn-submit {
    min-height: 52px;
    font-size: 1rem;
  }
}

/* ---------- 9.2  max-width: 520px (music player) ---------- */
@media (max-width: 520px) {
  .music-player {
    padding: 0.45rem 0.8rem 0.45rem 0.55rem;
    gap: 0.55rem;
  }

  .music-title {
    display: none;
  }

  .music-volume {
    width: 70px;
  }
}

/* ---------- 9.3  max-width: 480px (phone) ---------- */
@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .container {
    width: 94%;
  }

  /* Hero: smallest screens */
  .hero-name {
    font-size: clamp(1.8rem, 8.5vw, 2.6rem);
  }

  .hero-tagline {
    font-size: 1.05rem;
    line-height: 1.45;
    margin-bottom: 1.5rem;
  }

  .hero-dates {
    font-size: 0.85rem;
    letter-spacing: 0.02em;
  }

  .hero-badge {
    font-size: 0.7rem;
    padding: 0.35rem 0.85rem;
  }

  /* Nav links a bit tighter */
  .nav-links a {
    padding: 0.85rem 1rem;
  }

  /* Bio chapter tighter */
  .bio-chapter {
    gap: 1.5rem;
    margin-bottom: 2.5rem;
  }

  .bio-text h3 {
    font-size: 1.25rem;
  }

  /* Jokes */
  .jokes-stage { gap: 0.5rem; }
  .jokes-arrow { width: 38px; height: 38px; font-size: 1.4rem; }
  .jokes-card { padding: 1.5rem 1rem; }
  .jokes-text { font-size: 1.1rem; }
  .reaction-btn { min-width: 64px; padding: 0.6rem 0.75rem; }

  /* Gallery: 1 column on phones */
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  /* Menatzikhim: tighter on phone (still 3 boxes in a row) */
  #menatzikhim-slideshow {
    gap: 0.5rem;
    padding: 1rem;
  }

  /* Letter envelopes: even smaller on phone */
  .env-card {
    width: 155px;
    height: 110px;
  }

  .env-flap {
    height: 52px;
  }

  .env-seal {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  /* Contact form stacks */
  .form-row {
    grid-template-columns: 1fr;
  }

  .contact-form {
    padding: 1.25rem;
  }

  .form-group input,
  .form-group textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
    min-height: 44px;
  }

  .section-subtitle {
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  .section-light,
  .section-alt,
  .section-dark {
    padding: 3rem 0;
  }

  /* Footer text */
  .footer-name {
    font-size: 1.1rem;
  }

  /* Share widget */
  .share-widget {
    bottom: 14px;
  }

  .share-toggle {
    padding: 0.65rem 1.2rem;
    font-size: 0.9rem;
  }

  .share-menu {
    padding: 0.7rem;
    gap: 0.45rem;
    max-width: calc(100vw - 16px);
  }

  .share-option {
    font-size: 0.85rem;
    padding: 0.6rem;
  }
}


/* ============================================================================
   SONG — כתב יד (shir images in song tab)
   ============================================================================ */

.song-pinkas {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* Natural size: no resize, no object-fit distortion.
   Images scroll horizontally if wider than screen on mobile. */
.song-pinkas-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: #f5f0e8;
}

@media (min-width: 769px) {
  .song-pinkas {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
  }

  .song-pinkas-img {
    width: auto;
    max-width: calc(50% - 1rem);
  }
}


/* ============================================================================
   PINKAS — פנקס דיגיטלי עם אפקט דפדוף
   ============================================================================ */

#pinkas {
  background: var(--soft-gray);
}

.pinkas-container {
  max-width: 850px;
  margin: 0 auto;
}

/* Book wrapper */
.pinkas-book-wrap {
  margin: 0 auto 1.5rem;
}

/* Book — open-book spread layout */
.pinkas-book {
  position: relative;
  width: 100%;
  max-width: 850px;
  max-height: 65vh;
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  perspective: 2500px;
  transform-style: preserve-3d;
}

/* Each spread = left (image) + right (caption) side by side */
.pinkas-spread {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row-reverse; /* RTL: first child appears on left */
  background: #f5e9d0;
  box-shadow: 0 15px 50px rgba(0,0,0,0.4);
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.pinkas-spread.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* Spread currently animating out — stays visible above the incoming spread */
.pinkas-spread.flipping-out {
  opacity: 1;
  pointer-events: none;
  z-index: 2;
}

/* Centre spine crease */
.pinkas-spread::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: linear-gradient(to bottom,
    rgba(0,0,0,0.06),
    rgba(0,0,0,0.32),
    rgba(0,0,0,0.06));
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}

/* Half-pages */
.pinkas-page {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* Left page — image with 3D flip capability */
.pinkas-page-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #f5e9d0;
  transform-origin: right center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  /* Transition ONLY applied via .flipping-out to avoid stray animations */
}

/* Activate the 3D flip when parent is flipping-out */
.pinkas-spread.flipping-out .pinkas-page-image {
  transform: rotateY(-180deg);
  box-shadow: -15px 5px 25px rgba(0,0,0,0.3);
  transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1),
              box-shadow 0.9s ease;
}

.pinkas-page-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

/* Right page — caption / explanation, centred vertically & horizontally */
.pinkas-page-caption {
  background: #faf3e3;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left page when content is long text (page 3) */
.pinkas-page-text-main {
  background: #faf3e3;
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      rgba(150, 180, 150, 0.25) 31px,
      rgba(150, 180, 150, 0.25) 32px
    );
  background-size: 100% 32px;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Auto-scroll variant (page 3) */
.pinkas-page-text-main.has-auto-scroll {
  padding: 0;
  overflow: hidden;
}

.pinkas-auto-scroller {
  height: 100%;
  overflow: hidden;
  padding: 1rem 1.75rem 0;
  -webkit-mask-image: linear-gradient(transparent, black 2.5rem, black calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(transparent, black 2.5rem, black calc(100% - 2.5rem), transparent);
}

.pinkas-auto-scroller-inner {
  animation: pinkasTextScroll 65s linear infinite;
  will-change: transform;
}

.pinkas-auto-scroller:hover .pinkas-auto-scroller-inner {
  animation-play-state: paused;
}

@keyframes pinkasTextScroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

/* Text content shared */
.pinkas-text-content {
  font-family: 'Heebo', sans-serif;
  font-size: 0.92rem;
  line-height: 1.9;
  color: #3a2d1f;
  direction: rtl;
  text-align: right;
  white-space: pre-wrap;
  width: 100%;
  max-width: 92%;
}

.pinkas-page-caption .pinkas-text-content {
  font-size: 1rem;
  line-height: 1.8;
  white-space: normal;
  text-align: center;
}

/* Page number badge — bottom centre of spread */
.pinkas-page-num {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(58,45,31,0.5);
  background: rgba(245,233,208,0.85);
  padding: 0.1rem 0.55rem;
  border-radius: 20px;
  z-index: 4;
  pointer-events: none;
}

/* Navigation */
.pinkas-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.25rem 0;
  direction: ltr; /* arrows stay LTR so left=left, right=right */
}

.pinkas-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}

.pinkas-arrow:hover {
  background: var(--gold);
  transform: scale(1.08);
}

.pinkas-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

.pinkas-counter {
  font-size: 0.9rem;
  color: var(--text-mid);
  min-width: 60px;
  text-align: center;
}

/* Caption area — hidden: captions are now inside the spread */
.pinkas-caption-area {
  display: none;
}

/* Dots navigator */
.pinkas-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.3rem;
  flex-wrap: wrap;
}

.pinkas-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(58, 45, 31, 0.5);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.pinkas-dot:hover {
  background: rgba(58, 45, 31, 0.4);
  transform: scale(1.2);
}

.pinkas-dot.active {
  background: #3a2d1f;
  border-color: #3a2d1f;
  transform: scale(1.3);
}

/* Responsive — stack spread vertically on mobile */
@media (max-width: 768px) {
  .pinkas-book {
    aspect-ratio: unset;
    height: auto;
  }

  .pinkas-spread {
    position: static;
    flex-direction: column; /* image on top, caption below */
    opacity: 0;
    pointer-events: none;
    display: none;
  }

  .pinkas-spread.active {
    opacity: 1;
    pointer-events: auto;
    display: flex;
  }

  .pinkas-page-image {
    min-height: 55vw;
  }

  .pinkas-page-caption,
  .pinkas-page-text-main {
    padding: 1.25rem 1rem;
  }

  .pinkas-text-content {
    font-size: 0.88rem;
  }

  .pinkas-spread::before {
    display: none; /* no spine on mobile */
  }
}


/* ============================================================================
   HESPEDIM — לשונית הספדים
   ============================================================================ */

#hespedim {
  background: var(--off-white);
}

/* Hespedim filmstrip — mirrors the letters-strip pattern */
.hesped-strip-outer {
  overflow: hidden;
  direction: ltr;
  width: 100%;
  padding: 2rem 0;
  margin-top: 1rem;
}

.hesped-strip {
  display: flex;
  flex-direction: row;
  gap: 1.8rem;
  width: max-content;
  padding: 0.5rem 2rem;
  align-items: flex-start;
  animation: letterScroll 50s linear infinite;
  will-change: transform;
}

.hesped-strip-outer:hover .hesped-strip {
  animation-play-state: paused;
}

.hesped-item {
  width: 200px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
  transition: transform var(--transition), box-shadow var(--transition);
}

.hesped-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.hesped-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  flex-shrink: 0;
}

.hesped-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.hesped-image img[alt*="יפעת"] {
  object-position: 25% center;
}

.hesped-image img[alt*="אלישמע"] {
  object-position: 75% center;
}

.hesped-caption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--navy);
  background: #fff;
  direction: rtl;
}

.hesped-name {
  font-weight: 600;
}

.hesped-relation {
  font-size: 0.9em;
  color: #666;
  font-weight: 400;
}


/* ============================================================================
   PINKAS TEXT MODAL — קריאת טקסט מהפנקס
   ============================================================================ */

.pinkas-text-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.pinkas-text-modal[hidden] { display: none; }

.pinkas-text-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.pinkas-text-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.pinkas-text-modal-content {
  position: relative;
  background: #faf3e3;
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      rgba(150, 180, 150, 0.2) 31px,
      rgba(150, 180, 150, 0.2) 32px
    );
  background-size: 100% 32px;
  border-radius: 8px;
  padding: 3rem 2.5rem 2.5rem;
  max-width: 700px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
  border-top: 4px solid var(--gold);
}

.pinkas-text-modal-close {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #3a2d1f;
  line-height: 1;
  padding: 0.5rem;
  transition: opacity 0.2s;
}

.pinkas-text-modal-close:hover { opacity: 0.6; }

.pinkas-text-modal-body {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1.05rem;
  line-height: 1.9;
  color: #3a2d1f;
  direction: rtl;
  text-align: right;
  white-space: pre-wrap;
}

/* Visual cue: text page with auto-scroll is clickable */
.pinkas-page-text-main.has-auto-scroll {
  cursor: pointer;
  transition: background 0.25s ease;
}

.pinkas-page-text-main.has-auto-scroll:hover {
  background: #f0e8d2;
}


/* ============================================================================
   PINKAS IMAGE MODAL — זום על תמונות הפנקס
   ============================================================================ */

.pinkas-image-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pinkas-image-modal[hidden] { display: none; }

.pinkas-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.pinkas-image-modal-content {
  position: relative;
  z-index: 1;
  width: min(90vw, 960px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* Nav arrows — positioned absolute within .pinkas-image-modal-content */
.pinkas-image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s ease;
  padding: 0;
  font-family: var(--font);
}

.pinkas-image-nav:hover { background: rgba(0, 0, 0, 0.88); }

/* RTL: prev (earlier image) is on the right, next (later image) on the left */
.pinkas-image-nav-prev { right: -3.5rem; }
.pinkas-image-nav-next { left:  -3.5rem; }

.pinkas-image-modal-frame {
  overflow: hidden;
  max-width: 100%;
  max-height: calc(90vh - 4rem);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.pinkas-image-modal-frame:active { cursor: grabbing; }

.pinkas-image-modal-frame img {
  max-width: min(90vw, 960px);
  max-height: calc(90vh - 4rem);
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

.pinkas-image-modal-close {
  position: absolute;
  top: -2.75rem;
  left: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  font-family: var(--font);
  line-height: 1;
}

.pinkas-image-modal-close:hover { background: rgba(255, 255, 255, 0.3); }

.pinkas-image-modal-controls {
  display: flex;
  gap: 0.5rem;
}

.pinkas-modal-zoom-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
  font-family: var(--font);
}

.pinkas-modal-zoom-btn:hover { background: rgba(255, 255, 255, 0.3); }
