/* ---------- Theme ---------- */
:root {
  --forest: #1b4332;
  --forest-dark: #0f2b1f;
  --sky: #3a7ca5;
  --gold: #e0a72e;
  --gold-light: #f4c95d;
  --cream: #faf6ee;
  --cream-dark: #f0e9d8;
  --ink: #1c2321;
  --ink-soft: #4a5550;
  --white: #ffffff;
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-retro: 'Press Start 2P', monospace;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 43, 31, 0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}

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

.btn {
  display: inline-block;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-3px); }
.btn-primary {
  background: var(--gold);
  color: var(--forest-dark);
  box-shadow: 0 8px 20px rgba(224, 167, 46, 0.4);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(224, 167, 46, 0.55); }
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.22); }

/* ---------- Confetti canvas ---------- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ---------- Nav ---------- */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
  padding: 1.2rem 0;
}
#navbar.scrolled {
  background: rgba(250, 246, 238, 0.92);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 0.7rem 0;
  backdrop-filter: blur(8px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--white);
  text-decoration: none;
  transition: color 0.3s ease;
}
#navbar.scrolled .nav-logo { color: var(--forest-dark); }

#nav-links {
  list-style: none;
  display: flex;
  gap: 1.8rem;
}
#nav-links a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease, opacity 0.2s ease;
  opacity: 0.85;
}
#nav-links a:hover, #nav-links a.active { opacity: 1; }
#navbar.scrolled #nav-links a { color: var(--ink); }
#navbar.scrolled #nav-links a.active { color: var(--sky); font-weight: 700; }

#nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
#nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--white);
  transition: background 0.3s ease;
}
#navbar.scrolled #nav-toggle span { background: var(--ink); }

/* ---------- Hero ---------- */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 7rem 1.5rem 5rem;
  background: linear-gradient(160deg, var(--forest-dark) 0%, var(--forest) 55%, var(--forest-dark) 100%);
}
.hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(224,167,46,0.18), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(58,124,165,0.22), transparent 50%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--white);
  max-width: 800px;
}
.hero-eyebrow {
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--gold-light);
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.1s forwards;
}
#hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.3s forwards;
}
.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--cream);
  margin-bottom: 2.2rem;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.5s forwards;
}
.hero-photo-frame {
  display: inline-block;
  max-width: 360px;
  width: 100%;
  margin: 0 auto 2.2rem;
  padding: 10px;
  background: var(--cream);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.35);
  transition: transform 0.35s ease;
  opacity: 0;
  animation: photoFadeUp 0.8s ease 0.65s forwards;
}
.hero-photo-frame:hover { transform: rotate(0deg) scale(1.02); }
@keyframes photoFadeUp {
  from { opacity: 0; transform: translateY(24px) rotate(-3deg); }
  to { opacity: 1; transform: translateY(0) rotate(-3deg); }
}
.hero-photo-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}
.hero-photo-frame.img-missing {
  aspect-ratio: 4/5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--forest), var(--sky));
  border-radius: 12px;
}
.hero-photo-frame.img-missing img { display: none; }
.hero-photo-frame.img-missing::before {
  content: attr(data-missing-label);
  color: var(--white);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  opacity: 0.9;
}
.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.85s forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 20px;
}
.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-light);
  animation: scrollDown 1.6s ease infinite;
}
@keyframes scrollDown {
  0% { top: 8px; opacity: 1; }
  70% { opacity: 1; }
  100% { top: 24px; opacity: 0; }
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Scroll story (pinned, Apple-style scrubbing) ---------- */
.story-section {
  position: relative;
  height: 500vh; /* 5 stages x 100vh of scroll each */
  background: linear-gradient(180deg, var(--forest-dark), var(--forest) 50%, var(--forest-dark));
}
.story-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.story-stage {
  position: relative;
  width: 100%;
  height: 46vh;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}
.story-icon {
  position: absolute;
  font-size: clamp(6rem, 22vw, 15rem);
  opacity: 0;
  line-height: 1;
  filter: drop-shadow(0 25px 45px rgba(0,0,0,0.35));
  will-change: transform, opacity;
}
.story-caption-wrap {
  position: relative;
  width: 100%;
  height: 14vh;
  text-align: center;
}
.story-caption {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  will-change: transform, opacity;
}
.story-eyebrow {
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.story-caption h3 {
  font-family: var(--font-display);
  color: var(--cream);
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 600;
}
.story-dots {
  display: flex;
  gap: 0.7rem;
  margin-top: 2.5rem;
}
.story-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(250, 246, 238, 0.25);
  transition: background 0.3s ease, transform 0.3s ease;
}
.story-dot.active {
  background: var(--gold);
  transform: scale(1.35);
}

/* ---------- Sections ---------- */
.section {
  padding: 6rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.alt-bg { background: var(--cream-dark); max-width: 100%; }
.alt-bg > * { max-width: 1200px; margin-left: auto; margin-right: auto; }

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}
.section-eyebrow {
  color: var(--sky);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--forest-dark);
  margin-bottom: 0.8rem;
}
.section-sub {
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------- Tennis: bounce accent + serve animation ---------- */
.bounce-ball-inline {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6f56b, #b7d926 70%);
  margin-left: 8px;
  vertical-align: middle;
  animation: mini-bounce 1s ease-in-out infinite;
}
@keyframes mini-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.serve-anim {
  position: relative;
  height: 150px;
  max-width: 460px;
  margin: 0 auto 3rem;
}
.serve-court-line {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(58, 124, 165, 0.3);
  border-radius: 2px;
}
.serve-ball {
  position: absolute;
  left: 6%;
  bottom: 92px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6f56b, #b7d926 70%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.racket {
  position: absolute;
  left: 36%;
  bottom: 28px;
  transform-origin: bottom center;
  transform: rotate(-30deg);
}
.racket-head {
  display: block;
  width: 44px;
  height: 58px;
  border: 6px solid var(--sky);
  border-radius: 50% / 60%;
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(58,124,165,0.3) 4px 5px),
    repeating-linear-gradient(90deg, transparent 0 4px, rgba(58,124,165,0.3) 4px 5px);
}
.racket-handle {
  display: block;
  width: 8px;
  height: 32px;
  background: var(--forest-dark);
  margin: 0 auto;
  border-radius: 3px;
}

.serve-anim.play .racket {
  animation: racket-swing 1.1s cubic-bezier(.4,0,.2,1) both;
}
.serve-anim.play .serve-ball {
  animation: ball-serve 1.1s cubic-bezier(.3,0,.4,1) both;
}
@keyframes racket-swing {
  0%   { transform: rotate(-30deg); }
  38%  { transform: rotate(-30deg); }
  50%  { transform: rotate(35deg); }
  70%  { transform: rotate(10deg); }
  100% { transform: rotate(-15deg); }
}
@keyframes ball-serve {
  0%   { left: 6%;  bottom: 92px;  opacity: 1; transform: scale(1); }
  38%  { left: 33%; bottom: 60px;  opacity: 1; transform: scale(1); }
  50%  { left: 40%; bottom: 55px;  opacity: 1; transform: scale(1.08); }
  100% { left: 98%; bottom: 135px; opacity: 0; transform: scale(0.7); }
}

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4/5;
}
.gallery-item.wide { grid-column: span 2; aspect-ratio: 16/9; }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item figcaption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1rem 1.1rem;
  background: linear-gradient(0deg, rgba(15,43,31,0.85), transparent);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Full-body/action shots: show the whole photo instead of a fixed crop
   that can cut people's heads or feet off */
.gallery--natural .gallery-item,
.gallery--natural .gallery-item.wide {
  aspect-ratio: auto;
}
.gallery--natural .gallery-item img {
  height: auto;
}

/* image placeholder (JS adds this class if a photo fails to load) */
.gallery-item.img-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--forest), var(--sky));
  min-height: 220px;
}
.gallery-item.img-missing img { display: none; }
.gallery-item.img-missing::before {
  content: attr(data-missing-label);
  color: var(--white);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ---------- Game Room (retro) ---------- */
.retro {
  background: var(--forest-dark);
  max-width: 100%;
  padding: 5rem 1.5rem;
}
.crt {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  color: var(--cream);
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 3rem 2rem;
  background: radial-gradient(circle at 50% 0%, rgba(224,167,46,0.08), transparent 60%);
  box-shadow: 0 0 0 6px rgba(224,167,46,0.08), inset 0 0 40px rgba(0,0,0,0.4);
}
.retro-eyebrow { color: var(--gold-light); }
.retro-title {
  font-family: var(--font-retro);
  font-size: clamp(1.3rem, 4vw, 2rem);
  color: var(--gold-light);
  margin-bottom: 1.2rem;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.35);
  letter-spacing: 2px;
}
.retro-sub {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 620px;
  margin: 0 auto 2.5rem;
  color: var(--cream-dark);
}
.retro-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}
.retro-card {
  border: 2px dashed rgba(224,167,46,0.4);
  border-radius: 10px;
  padding: 1.6rem 1rem;
}
.retro-icon { font-size: 2rem; display: block; margin-bottom: 0.8rem; }
.retro-card h3 {
  font-family: var(--font-retro);
  font-size: 0.85rem;
  color: var(--gold-light);
  margin-bottom: 0.8rem;
  letter-spacing: 1px;
}
.retro-card p { font-size: 0.9rem; color: var(--cream-dark); line-height: 1.5; }
.retro-footer {
  font-family: var(--font-retro);
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 1px;
  animation: blink 1.4s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- AI Toast ---------- */
.ai-box {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.ai-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.ai-output-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#ai-output {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
}
#ai-output.loading { color: var(--ink-soft); font-style: italic; }
#ai-output.error { color: #b3261e; }

/* ---------- Ask Sajjad chat ---------- */
.chat-box {
  max-width: 640px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.3rem;
}
.chat-msg {
  max-width: 82%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.95rem;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--cream-dark);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--sky);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.chat-msg--loading p { font-style: italic; opacity: 0.75; }
.chat-msg--error { color: #b3261e; }
.chat-form {
  display: flex;
  gap: 0.6rem;
}
#chat-input {
  flex: 1;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(28, 35, 33, 0.15);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
}
#chat-input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.chat-form .btn { padding: 0.8rem 1.5rem; }

/* ---------- Footer ---------- */
#footer {
  background: var(--forest-dark);
  color: var(--cream);
  text-align: center;
  padding: 3rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
}
.footer-sub {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--cream-dark);
  margin-top: 0.6rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .gallery-item.wide { grid-column: span 2; }
  .retro-cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--cream);
    padding: 1rem 1.5rem;
    gap: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transform: translateY(-140%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  #nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  #nav-links a { color: var(--ink) !important; }
  #nav-toggle { display: flex; }
  #nav-toggle span { background: var(--white); }
  #navbar.scrolled #nav-toggle span { background: var(--ink); }

  .gallery { grid-template-columns: 1fr; }

  /* Show full photos on mobile instead of a tight crop */
  .gallery-item, .gallery-item.wide {
    aspect-ratio: auto;
    grid-column: span 1;
  }
  .gallery-item img {
    height: auto;
  }
}
