/* ================================================================
   styles.css — Welcome Tos Tos
================================================================ */

:root {
  --bg:         #FFF381;
  --gold:       #c8a800;
  --gold-mid:   #a88a00;
  --gold-dark:  #8a6e00;
  --gold-deep:  #6b5200;
  --text:       #28180a;
  --text-mid:   #5c3f10;
  --text-soft:  #8a6525;
  --card-bg:    rgba(255, 252, 218, 0.86);
  --shadow-xs:  0 2px  8px  rgba(90, 55, 0, 0.08);
  --shadow-sm:  0 4px  16px rgba(90, 55, 0, 0.11);
  --shadow-md:  0 8px  32px rgba(90, 55, 0, 0.15);
  --shadow-lg:  0 16px 48px rgba(90, 55, 0, 0.20);
  --radius-sm: 12px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Lato', system-ui, sans-serif;
  --font-arabic:  'Amiri', serif;
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* Wood frame palette */
  --wood-light:  #d4a06a;
  --wood-mid:    #a0622a;
  --wood-dark:   #6a3510;
  --wood-shadow: #3a180a;
  --frame-size:  14px;
  --frame-size-lg: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Safety: ensure [hidden] always means display:none even when CSS sets display elsewhere */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background-color: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,220,30,0.25) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(200,168,0,0.18) 0%, transparent 55%);
}

img { display: block; max-width: 100%; }
button { font-family: var(--font-body); }

/* ================================================================
   DECORATIVE TULIPS
================================================================ */
#tulip-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.tulip {
  position: absolute;
  pointer-events: none;
  transform-origin: 50% 100%;
  animation: tulip-sway var(--dur, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.32;
}

.poem-tulip-ring .tulip { opacity: 0.40; }

@keyframes tulip-sway {
  0%   { transform: rotate(var(--r, 0deg))                translateY(0px); }
  25%  { transform: rotate(calc(var(--r, 0deg) +  4deg))  translateY(-5px); }
  55%  { transform: rotate(calc(var(--r, 0deg) -  3deg))  translateY(-8px); }
  80%  { transform: rotate(calc(var(--r, 0deg) +  2deg))  translateY(-4px); }
  100% { transform: rotate(var(--r, 0deg))                translateY(0px); }
}

/* ================================================================
   SECTION STYLES
================================================================ */
.section {
  position: relative;
  z-index: 1;
  padding: clamp(28px, 4vw, 56px) clamp(16px, 5vw, 72px);
}

.fade-section {
  opacity: 0;
  transform: translateY(50px) scale(0.96);
  filter: blur(2px);
  transition:
    opacity   0.85s var(--ease-out),
    transform 0.85s var(--ease-out),
    filter    0.85s var(--ease-out);
}

.fade-section.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: 0.025em;
  color: var(--text);
  text-align: center;
  margin-bottom: clamp(20px, 4vw, 48px);
}

/* ================================================================
   HERO
================================================================ */
#hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 72px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 10vw, 7.5rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow: 0 2px 16px rgba(90, 55, 0, 0.12);
}

.hero-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.4vw, 1.55rem);
  font-weight: 300;
  color: var(--text-mid);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.hero-tulip { margin-top: 28px; }

.hero-tulip svg {
  width: clamp(52px, 8vw, 84px);
  height: auto;
  opacity: 0.82;
  filter: drop-shadow(0 6px 12px rgba(90, 55, 0, 0.18));
  transform-origin: 50% 100%;
  animation: tulip-sway 5s ease-in-out infinite;
}

.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.72;
  transition: opacity 0.3s, color 0.3s;
  animation: bounce-chevron 2.2s ease-in-out infinite;
}

.scroll-indicator:hover { opacity: 1; color: var(--gold-dark); }

@keyframes bounce-chevron {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}

/* ================================================================
   POEM — Vintage Manuscript Book design
================================================================ */
#poem {
  min-height: 80svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(40px, 8vw, 100px) clamp(16px, 5vw, 60px);
}

.poem-tulip-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Override the section fade — manuscript handles its own animation */
.poem-slide-section {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* ── New Animated Poem Container ── */
.animated-poem-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  background: rgba(255, 252, 218, 0.4);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  border: 1px solid rgba(200, 160, 50, 0.3);
  box-shadow: 0 10px 40px rgba(90, 55, 0, 0.1);
  transform: translateY(30px);
  opacity: 0;
  animation: float-up-fade 1.2s ease-out forwards;
}

.poem-ornament {
  font-size: 24px;
  color: var(--gold);
  opacity: 0.7;
  animation: spin-slow 8s linear infinite;
}

.poem-ornament-top { margin-bottom: 20px; }
.poem-ornament-bottom { margin-top: 20px; }

.animated-arabic-poem {
  font-family: var(--font-arabic);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  line-height: 2.2;
  color: var(--text-mid);
  text-align: center;
  text-shadow: 0 2px 4px rgba(100, 55, 10, 0.1);
  margin: 0;
}

.poem-line {
  opacity: 0;
  transform: translateY(20px);
  animation: slide-up-fade 1s ease-out forwards, float-breathe 6s ease-in-out infinite alternate;
}

/* Stagger the lines */
.line-1 { animation-delay: 0.4s, 1.4s; }
.line-2 { animation-delay: 1.2s, 2.2s; }
.line-3 { animation-delay: 2.0s, 3.0s; }
.line-4 { animation-delay: 2.8s, 3.8s; }

@keyframes float-up-fade {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slide-up-fade {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes float-breathe {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

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

/* ── Scattered background petals ── */
.poem-petal {
  position: absolute;
  pointer-events: none;
  border-radius: 60% 40% 60% 40% / 55% 45% 55% 45%;
  background: radial-gradient(ellipse at 50% 35%,
    rgba(220, 185, 30, 0.70) 0%,
    rgba(185, 145, 10, 0.45) 55%,
    rgba(145, 105, 0,  0.20) 100%);
  z-index: 1;
}

.poem-petal-1 { width:48px; height:30px; top:12%;  left: 6%;  transform:rotate(25deg);   animation: petal-float 8s  ease-in-out infinite; }
.poem-petal-2 { width:38px; height:24px; top:68%;  left: 8%;  transform:rotate(-40deg);  animation: petal-float 10s ease-in-out infinite 1.5s; }
.poem-petal-3 { width:55px; height:34px; top:20%;  right:5%;  transform:rotate(55deg);   animation: petal-float 9s  ease-in-out infinite 3s; }
.poem-petal-4 { width:42px; height:26px; top:75%;  right:9%;  transform:rotate(-20deg);  animation: petal-float 7s  ease-in-out infinite 0.8s; }
.poem-petal-5 { width:32px; height:20px; top:45%;  left: 3%;  transform:rotate(70deg);   animation: petal-float 11s ease-in-out infinite 2s; }

@keyframes petal-float {
  0%, 100% { transform: rotate(var(--pr, 25deg)) translateY(0);  }
  33%       { transform: rotate(calc(var(--pr, 25deg) + 8deg)) translateY(-8px); }
  66%       { transform: rotate(calc(var(--pr, 25deg) - 5deg)) translateY(-4px); }
}

/* ================================================================
   MEMORIES — "Memories We Won't Forget" scattered layout
================================================================ */
#memories {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: clamp(24px, 4vw, 48px);
}

.memories-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-style: italic;
  color: var(--gold-deep);
  text-align: center;
  margin-bottom: clamp(48px, 8vw, 96px);
  position: relative;
}

.memories-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 12px auto 0;
}

/* Scattered canvas */
.memories-scatter {
  position: relative;
  min-height: clamp(560px, 80vw, 780px);
}

/* Each card: label + frame, positioned absolutely with individual tilts */
.memory-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Per-card hover — keeps each card's centering method intact */
.memory-card-1:hover { transform: rotate(0deg) scale(1.05) !important; z-index: 10; }
.memory-card-2:hover { transform: rotate(0deg) scale(1.05) !important; z-index: 10; }
.memory-card-3:hover { transform: rotate(0deg) scale(1.05) !important; z-index: 10; }

/* Handwritten-style label above each frame */
.memory-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.25rem);
  color: var(--gold-deep);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(255, 230, 140, 0.9);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Individual positions & tilts.
   card-2 uses left:0 right:0 margin:auto to center WITHOUT translateX
   so the hover transform won't cause a jump. */
.memory-card-1 {
  left: 2%;
  top: 0%;
  transform: rotate(-5deg);
}
.memory-card-2 {
  left: 0;
  right: 0;
  margin: 0 auto;
  top: 5%;
  transform: rotate(2.5deg);
  width: fit-content;
}
.memory-card-3 {
  right: 2%;
  top: 0%;
  transform: rotate(4.5deg);
}

/* Memory frame sizes */
.memory-frame {
  width: clamp(220px, 27vw, 320px);
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

/* Ghibli-style thick cartoon wood frame overrides */
.memory-frame.wood-frame {
  --frame-size: 18px;
  padding: var(--frame-size) !important;
  background-image:
    /* wood knot circles */
    radial-gradient(ellipse 6px 4px at 18% 32%, rgba(50,18,0,0.22) 0%, transparent 100%),
    radial-gradient(ellipse 5px 3px at 72% 65%, rgba(50,18,0,0.18) 0%, transparent 100%),
    /* grain lines A — coarser */
    repeating-linear-gradient(
      85deg,
      transparent 0px, transparent 4px,
      rgba(255, 200, 110, 0.22) 4px, rgba(255, 200, 110, 0.22) 5px
    ),
    /* grain lines B */
    repeating-linear-gradient(
      175deg,
      transparent 0px, transparent 9px,
      rgba(50, 18, 0, 0.18) 9px, rgba(50, 18, 0, 0.18) 10px
    ),
    /* warm wood base */
    linear-gradient(
      148deg,
      #dba96e 0%,
      #b06a2e 30%,
      #8a4a18 62%,
      #5a2508 100%
    );
  box-shadow:
    /* top highlight */
    inset 0    4px 0   rgba(240, 185, 100, 0.90),
    /* left highlight */
    inset 4px  0   0   rgba(228, 168,  82, 0.68),
    /* bottom shadow */
    inset 0   -4px 0   rgba(30,   8,   0,  0.60),
    /* right shadow */
    inset -4px 0   0   rgba(30,   8,   0,  0.50),
    /* cartoon drop shadow */
    6px 10px 0px rgba(40, 16, 0, 0.55),
    10px 14px 24px rgba(40, 16, 0, 0.35);
  border-radius: 8px !important;
  border: 2.5px solid rgba(60, 24, 4, 0.55);
}

.memory-frame .frame-canvas {
  inset: 18px;
  border-radius: 3px;
}

/* Responsive — stack on small screens */
@media (max-width: 760px) {
  .memories-scatter {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    min-height: unset;
  }
  .memory-card {
    position: static !important;
    transform: rotate(0deg) !important;
  }
  .memory-card-1 { transform: rotate(-3deg) !important; }
  .memory-card-2 { transform: rotate(2deg)  !important; }
  .memory-card-3 { transform: rotate(-2deg) !important; }
  .memory-frame  { width: min(280px, 85vw); }
}

/* ================================================================
   WOOD FRAME — Ghibli cartoon style
   Uses padding + background on gallery-item itself.
   frame-canvas sits inside the padded area.
   All elements have pointer-events correctly set.
================================================================ */

/* The frame is the padding + background of the gallery-item */
.wood-frame {
  padding: var(--frame-size) !important;
  background-image:
    /* grain lines A */
    repeating-linear-gradient(
      82deg,
      transparent 0px, transparent 5px,
      rgba(255, 195, 110, 0.18) 5px, rgba(255, 195, 110, 0.18) 6px
    ),
    /* grain lines B */
    repeating-linear-gradient(
      172deg,
      transparent 0px, transparent 11px,
      rgba(50, 18, 0, 0.14) 11px, rgba(50, 18, 0, 0.14) 12px
    ),
    /* wood base gradient */
    linear-gradient(
      148deg,
      var(--wood-light) 0%,
      var(--wood-mid)   38%,
      var(--wood-dark)  68%,
      var(--wood-shadow) 100%
    );
  /* inner edge highlights/shadows to give 3-D depth */
  box-shadow:
    inset 0    3px 0 rgba(230, 175, 100, 0.85),
    inset 3px  0   0 rgba(220, 160,  80, 0.65),
    inset 0   -3px 0 rgba(35,  10,   0,  0.55),
    inset -3px 0   0 rgba(35,  10,   0,  0.45),
    6px 10px 30px rgba(50, 20, 0, 0.50),
    0   2px   8px rgba(50, 20, 0, 0.30);
  border-radius: 5px !important;
  overflow: hidden !important;
  cursor: pointer;
}

/* Larger frame for featured images */
.wood-frame-special {
  padding: var(--frame-size-lg) !important;
  box-shadow:
    inset 0    4px 0 rgba(235, 180, 105, 0.90),
    inset 4px  0   0 rgba(225, 165,  85, 0.70),
    inset 0   -4px 0 rgba(35,  10,   0,  0.60),
    inset -4px 0   0 rgba(35,  10,   0,  0.50),
    8px 14px 40px rgba(50, 20, 0, 0.60),
    0   3px  10px rgba(50, 20, 0, 0.35);
}

/* Inner canvas — holds the actual image */
.frame-canvas {
  position: absolute;
  inset: var(--frame-size);
  border-radius: 2px;
  overflow: hidden;
  background: #f5ecd8;
  /* No pointer-events override needed — inherits from parent */
}

.wood-frame-special .frame-canvas {
  inset: var(--frame-size-lg);
}

.frame-canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;       /* full image visible, no cropping */
  object-position: center;
  background: #f5ecd8;
  display: block;
  transition: transform 0.30s var(--ease-out), opacity 0.3s;
}

.frame-canvas .img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--gold-dark);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.4s;
  user-select: none;
}

.gallery-item.img-loaded .img-placeholder { opacity: 0; }
.gallery-item.img-loaded img { opacity: 1; }

/* Corner nails */
.nail {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c87840 0%, #6a3010 55%, #3a1408 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,200,120,0.45);
  pointer-events: none;
  z-index: 5;
}

.nail-tl { top:  5px; left:  5px; }
.nail-tr { top:  5px; right: 5px; }
.nail-bl { bottom: 5px; left:  5px; }
.nail-br { bottom: 5px; right: 5px; }

/* ================================================================
   GALLERY — MOSAIC LAYOUT
================================================================ */
#gallery {
  max-width: 1280px;
  margin: 0 auto;
}

.gallery-mosaic {
  display: grid;
  grid-template-areas:
    "left center right"
    "bottom bottom bottom";
  grid-template-columns: 1fr 1.45fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px 16px;
  align-items: start;
}

.mosaic-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mosaic-left   { grid-area: left; }
.mosaic-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.mosaic-right  { grid-area: right; }
.mosaic-bottom {
  grid-area: bottom;
  display: flex;
  justify-content: center;
}

/* ----------------------------------------------------------------
   Gallery item base
---------------------------------------------------------------- */
.gallery-item {
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, #ffee80 0%, #f5d800 55%, #c8a800 100%);
  transition:
    transform  0.28s var(--ease-out),
    box-shadow 0.28s var(--ease-out);
}

/* Side column items — fixed aspect ratio */
.mosaic-col .gallery-item {
  aspect-ratio: 4 / 3;
  width: 100%;
}

/* Center featured image — portrait ratio */
.gallery-special {
  width: 100%;
  aspect-ratio: 3 / 4;
}

/* Bottom single image */
.mosaic-bottom .gallery-item {
  width: min(380px, 90%);
  aspect-ratio: 4 / 3;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover {
    transform: translateY(-4px) scale(1.02);
    z-index: 4;
  }
  .gallery-item:hover .frame-canvas img {
    transform: scale(1.03);
  }
}

.gallery-item:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

/* Special badge label below the center image */
.special-badge {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--wood-dark);
  letter-spacing: 0.12em;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(255, 230, 140, 0.9);
  margin-top: 2px;
}

/* ================================================================
   MOHAMAD'S ART
================================================================ */
#mohamad-art {
  max-width: 780px;
  margin: 0 auto;
}

.single-art {
  display: flex;
  justify-content: center;
}

.gallery-solo {
  width: min(500px, 90vw);
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
}

/* ================================================================
   CHESS
================================================================ */
#chess {
  max-width: 640px;
  margin: 0 auto;
}

.chess-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  text-align: center;
  margin-top: -16px;
  margin-bottom: clamp(16px, 3vw, 36px);
  letter-spacing: 0.05em;
  font-style: italic;
}

.chess-wrapper {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: clamp(16px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.chess-board-el {
  width: 100%;
  max-width: 480px;
}

/* chessboard.js board override */
.board-b72b1 {
  border: 3px solid var(--gold) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
  box-shadow: var(--shadow-sm) !important;
}

.chess-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.chess-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chess-btn {
  background: rgba(255, 250, 200, 0.95);
  border: 1.5px solid var(--gold);
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.20s, color 0.20s, transform 0.15s, box-shadow 0.20s;
  box-shadow: var(--shadow-xs);
  line-height: 1;
}

.chess-btn:hover {
  background: var(--gold);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

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

.chess-btn-primary {
  background: var(--gold);
  color: #fff;
  padding: 12px 30px;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.chess-btn-primary:hover { background: var(--gold-mid); }

.chess-speed-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-label {
  font-size: 0.82rem;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.speed-select {
  background: rgba(255, 250, 200, 0.95);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}

.speed-select:focus { outline: none; border-color: var(--gold-mid); }

.move-counter {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  min-height: 1.4em;
  text-align: center;
}

.game-over-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold-deep);
  letter-spacing: 0.06em;
  text-align: center;
  animation: label-appear 0.5s var(--ease-out) both;
}

@keyframes label-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   LIGHTBOX
================================================================ */
.lightbox {
  /* IMPORTANT: display:none by default so it never blocks clicks when hidden */
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 0, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.28s var(--ease-out);
}

/* Step 1: make it flex (visible in DOM, but still transparent) */
.lightbox.lb-open {
  display: flex;
}

/* Step 2: fade in */
.lightbox.lb-active { opacity: 1; }

.lightbox-img-wrap {
  max-width: min(90vw, 920px);
  max-height: 86vh;
  cursor: default;
  transform: scale(0.88);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.lb-active .lightbox-img-wrap { transform: scale(1); }

.lightbox-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  display: block;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 243, 129, 0.14);
  border: 1.5px solid rgba(255, 243, 129, 0.32);
  color: rgba(255, 255, 255, 0.90);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 243, 129, 0.32);
  transform: scale(1.12) rotate(90deg);
}

/* ================================================================
   RESPONSIVE — TABLET
================================================================ */
@media (max-width: 900px) {
  .gallery-mosaic {
    grid-template-areas:
      "center center"
      "left   right"
      "bottom bottom";
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
  }

  .gallery-special {
    width: min(340px, 88%);
    aspect-ratio: 3 / 4;
    margin: 0 auto;
  }

  .mosaic-col .gallery-item {
    aspect-ratio: 4 / 3;
  }
}

/* ================================================================
   RESPONSIVE — MOBILE (≤ 600px)
================================================================ */
@media (max-width: 600px) {
  .section {
    padding: clamp(18px, 4vw, 32px) clamp(12px, 4vw, 20px);
  }

  .hero-title {
    font-size: clamp(2.6rem, 13vw, 4.2rem);
  }

  .section-title {
    margin-bottom: clamp(14px, 3vw, 24px);
  }

  .poem-slide-inner {
    margin: 0 8px;
    padding: 24px 18px;
  }

  .arabic-poem {
    font-size: clamp(1.1rem, 5.5vw, 1.4rem);
  }

  .chess-wrapper { padding: 14px 10px; }
  .chess-buttons { gap: 8px; }
  .chess-btn { padding: 9px 16px; font-size: 0.88rem; }
  .chess-subtitle { margin-top: -8px; margin-bottom: 12px; }

  .gallery-mosaic {
    grid-template-areas:
      "center"
      "left"
      "right"
      "bottom";
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mosaic-left, .mosaic-right {
    flex-direction: row;
    gap: 10px;
  }

  .mosaic-col .gallery-item {
    flex: 1;
    aspect-ratio: 4 / 3;
  }

  .gallery-special {
    width: min(260px, 82vw);
  }

  .gallery-solo {
    width: 90vw;
  }
}

/* ---- Tablet (601px – 900px) ---- */
@media (min-width: 601px) and (max-width: 900px) {
  .poem-slide-inner { margin: 0 32px; }
}

/* ================================================================
   ACCESSIBILITY
================================================================ */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .fade-section {
    opacity: 1; transform: none; filter: none; transition: none;
  }
  .poem-slide-inner {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
  .tulip, .hero-tulip svg, .scroll-indicator { animation: none; }
}

/* ================================================================
   FOOTER
================================================================ */
.site-footer {
  text-align: center;
  padding: 14px 16px 20px;
  border-top: 1px solid rgba(160, 120, 32, 0.18);
}

.footer-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.14em;
  opacity: 0.85;
}
