/* ==========================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================== */
:root {
  /* Adaptive palette — reacts to dark mode. Lives in CSS, not config.json,
     so the prefers-color-scheme override below can always win. */
  --ink:     #16302C;
  --paper:   #F2E9D1;
  --paper-2: #E8DCB8;
  --meadow:  #4F6D3D;
  --amber:   #C9861D;
  --ember:   #B14A26;
  --line:    rgba(22, 48, 44, 0.14);

  /* Fixed "printed poster" hero palette — does not flip with theme.
     Set at runtime from config.json by applyTheme(). */
  --hero-bg:     #0E2B27;
  --hero-bg-2:   #123A34;
  --hero-water:  #1C5850;
  --hero-water-2:#256B61;
  --hero-sand:   #D8BD86;
  --hero-cream:  #F4ECD6;

  --font-display: 'Roboto Slab', Rockwell, 'Noto Serif', serif;
  --font-body:    'Jost', Futura, 'Century Gothic', 'Segoe UI', sans-serif;
  --font-mono:    'Space Mono', 'Courier New', ui-monospace, monospace;

  --max-width:     920px;
  --section-v-pad: clamp(2.5rem, 6vw, 3.75rem);
  --section-h-pad: clamp(1.25rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:     #ECDFC0;
    --paper:   #0F2320;
    --paper-2: #16302C;
    --meadow:  #7C9A63;
    --amber:   #E8A33D;
    --ember:   #D4602F;
    --line:    rgba(236, 223, 192, 0.16);
  }
}
:root[data-theme="dark"] {
  --ink:     #ECDFC0;
  --paper:   #0F2320;
  --paper-2: #16302C;
  --meadow:  #7C9A63;
  --amber:   #E8A33D;
  --ember:   #D4602F;
  --line:    rgba(236, 223, 192, 0.16);
}
:root[data-theme="light"] {
  --ink:     #16302C;
  --paper:   #F2E9D1;
  --paper-2: #E8DCB8;
  --meadow:  #4F6D3D;
  --amber:   #C9861D;
  --ember:   #B14A26;
  --line:    rgba(22, 48, 44, 0.14);
}

/* ==========================================================
   2. BASE RESET
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.page {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ==========================================================
   3. SECTION / PANEL BASE
   ========================================================== */
.section {
  background: var(--paper);
  color: var(--ink);
  padding: var(--section-v-pad) var(--section-h-pad);
  position: relative;
}
.section:nth-child(even) { background: var(--paper-2); }
.section-inner { width: 100%; }

.section-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}
.section-heading::before {
  content: '✦';
  display: block;
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--amber);
  margin-bottom: 0.5rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
.section-intro {
  max-width: 42em;
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 1.75rem;
}

/* Wavy contour-line divider inserted between panels */
.contour { display: block; width: 100%; height: 22px; color: var(--line); overflow: hidden; }
.contour svg { width: 100%; height: 100%; display: block; }

/* ==========================================================
   4. NAV
   ========================================================== */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 2px solid var(--ember);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px var(--section-h-pad);
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--ember);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
#nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.nav-link {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  color: var(--ink);
  transition: color 0.15s;
}
.nav-link:hover { color: var(--ember); }
.nav-link::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--ember);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--ember); }
.nav-link.is-active::after { transform: scaleX(1); }

@media (max-width: 640px) {
  #nav-links { display: none; }
}

#lang-toggle {
  flex-shrink: 0;
  border: 1.5px solid var(--ember);
  background: transparent;
  color: var(--ember);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  cursor: pointer;
  text-transform: uppercase;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
}
#lang-toggle:hover {
  background: var(--ember);
  color: var(--hero-cream);
}

/* ==========================================================
   5. HERO
   ========================================================== */
.section--hero {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(120% 140% at 20% 0%, var(--hero-bg-2), var(--hero-bg) 60%) !important;
  color: var(--hero-cream) !important;
  overflow: hidden;
  isolation: isolate;
}
.hero-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.85;
}
@media (max-width: 560px) {
  .hero-map { opacity: 0.35; }
}
.hero-map .chan { fill: none; stroke: var(--hero-water); stroke-width: 3; opacity: 0.55; }
@media (prefers-reduced-motion: no-preference) {
  .hero-map .tree { animation: sway 7s ease-in-out infinite; transform-origin: center; }
  .hero-map .tree:nth-child(3n) { animation-duration: 9s; animation-delay: -2s; }
  .hero-map .tree:nth-child(3n+1) { animation-duration: 8s; animation-delay: -4s; }
}
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

.section--has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.section--has-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 0;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px var(--section-h-pad);
}
.hero-eyebrow {
  font-size: 1.8rem;
  color: var(--hero-sand);
  margin-bottom: 16px;
  display: inline-block;
  cursor: pointer;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 0.98;
  color: var(--hero-cream);
  margin-bottom: 16px;
}
.hero-subtitle {
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  font-weight: 400;
  color: var(--hero-cream);
  opacity: 0.92;
  margin-bottom: 8px;
  max-width: 34em;
  margin-left: auto;
  margin-right: auto;
}
.hero-date {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 2.2vw, 0.95rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hero-cream);
  opacity: 0.7;
  margin-bottom: 28px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(1.75rem, 5vw, 2.5rem);
}
.fact-badge {
  border: 1.5px solid var(--hero-cream);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--hero-cream);
}
.fact-badge.solid {
  background: var(--amber);
  border-color: var(--amber);
  color: #241705;
  font-weight: bold;
}

.countdown {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}
.cd-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 6.5vw, 3.2rem);
  line-height: 1;
  color: var(--hero-cream);
}
.cd-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hero-cream);
  opacity: 0.65;
  margin-top: 4px;
}
.cd-sep {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6.5vw, 3.2rem);
  font-weight: 700;
  color: var(--hero-cream);
  opacity: 0.4;
  align-self: flex-start;
  padding-top: 2px;
  line-height: 1;
}
.countdown-done {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4.5vw, 2.2rem);
  font-weight: 700;
  color: var(--hero-cream);
  text-transform: uppercase;
}

/* ==========================================================
   6. TIMELINE / DAY-CARD
   ========================================================== */
.timeline-day + .timeline-day,
.menu-day + .menu-day {
  margin-top: 64px;
}
.timeline-day-heading,
.menu-day-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  opacity: 0.7;
  padding-top: 0.75rem;
  margin-bottom: 24px;
  border-top: 3px solid var(--meadow);
}
.timeline-day.is-main-day .timeline-day-heading,
.menu-day.is-main-day .menu-day-heading {
  border-top-color: var(--ember);
  opacity: 1;
}
.timeline-day-heading .day-title,
.menu-day-heading .day-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--ink);
  opacity: 1;
}
.timeline-day.is-main-day .day-title,
.menu-day.is-main-day .day-title {
  color: var(--ember);
}
.main-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ember);
  color: var(--hero-cream);
  padding: 0.15rem 0.55rem;
  border-radius: 2px;
}

.timeline {
  position: relative;
  padding-left: 48px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--meadow);
}
.timeline-day.is-main-day .timeline::before { background: var(--ember); }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0 16px;
  margin-bottom: 32px;
  align-items: start;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -40px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--meadow);
  border: 2px solid var(--paper);
}
.timeline-day.is-main-day .timeline-dot { background: var(--ember); }
.timeline-time {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  padding-top: 1px;
  opacity: 0.75;
}
.timeline-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  display: block;
}
.timeline-desc {
  margin-top: 4px;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ==========================================================
   7. CARDS
   ========================================================== */
.cards-grid {
  display: grid;
  gap: 20px;
}
.cards-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.cards-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
  .cards-grid[data-cols="3"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .cards-grid[data-cols="2"],
  .cards-grid[data-cols="3"] { grid-template-columns: 1fr; }
}
.card {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 22px 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.section:nth-child(even) .card { background: var(--paper-2); }
.card:hover, .card:focus-within {
  transform: translate(-4px, -4px);
  box-shadow: 5px 5px 0 var(--meadow);
}
.card.is-highlight {
  border-color: var(--ember);
  border-width: 2px;
}
.card.is-highlight:hover, .card.is-highlight:focus-within {
  box-shadow: 5px 5px 0 var(--ember);
}
.card-tag {
  position: absolute;
  top: -10px;
  right: 16px;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ember);
  color: var(--hero-cream);
  padding: 0.15rem 0.55rem;
  border-radius: 2px;
}
.card-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  color: var(--meadow);
}
.card-icon svg { width: 100%; height: 100%; display: block; }
.card-icon.is-emoji {
  width: auto;
  height: auto;
  font-size: 1.8rem;
  line-height: 1;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.card-text {
  font-size: 0.9rem;
  line-height: 1.55;
  opacity: 0.85;
}

.menu-meal + .menu-meal {
  margin-top: 30px;
}
.menu-meal-heading {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin-bottom: 14px;
}

/* ==========================================================
   8. INFO-SPLIT / LOCATION
   ========================================================== */
.split-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
}
.split-grid[data-image-left="false"] .split-media { order: 2; }
.split-grid[data-image-left="false"] .split-text  { order: 1; }
.split-img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}
.split-iframe {
  width: 100%;
  height: 320px;
  border: 1.5px solid var(--line);
  display: block;
}
.mini-map { width: 100%; height: auto; display: block; }
.mini-map .chan { fill: none; stroke: var(--paper); stroke-width: 3; opacity: 0.6; }
.split-text p { margin-bottom: 12px; }
.split-text p:last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
  .split-grid[data-image-left="false"] .split-media,
  .split-grid[data-image-left="false"] .split-text {
    order: unset;
  }
}

/* ==========================================================
   9. ACCORDION
   ========================================================== */
.accordion-item {
  border-bottom: 1px solid var(--line);
}
.accordion-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 18px 0;
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: inherit;
  min-height: 44px;
}
.accordion-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  color: var(--ember);
  font-style: normal;
}
.accordion-body {
  padding: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.65;
  opacity: 0.9;
}
.accordion-body[hidden] { display: none; }

/* ==========================================================
   10. MAP (leaflet — currently unused, kept for future sections)
   ========================================================== */
.section--map .section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: 24px;
}
.map-container {
  height: 420px;
  width: 100%;
  border-top: 3px solid var(--ember);
  position: relative;
  isolation: isolate;
}
@media (max-width: 640px) {
  .map-container { height: 280px; }
}

/* ==========================================================
   11. GALLERY STUB
   ========================================================== */
.gallery-stub {
  text-align: center;
  padding: 44px 24px;
  border: 1.5px dashed var(--line);
  opacity: 0.8;
}
.gallery-stub-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  color: var(--meadow);
}
.gallery-stub-icon svg { width: 100%; height: 100%; }
.gallery-stub-text { font-size: 1.02rem; }

/* ==========================================================
   12. FOOTER
   ========================================================== */
.site-footer {
  background: var(--hero-bg);
  color: var(--hero-cream);
  text-align: center;
  padding: clamp(2rem, 5vw, 3rem) var(--section-h-pad) clamp(2.5rem, 6vw, 3.5rem);
}
.site-footer .sig {
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.site-footer .contact {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.7;
  margin-top: 0.6rem;
}
.site-footer a { text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================
   13. ERROR BANNER
   ========================================================== */
#error-banner {
  background: #8B0000;
  color: white;
  padding: 16px var(--section-h-pad);
  text-align: center;
  font-weight: 600;
}

/* ==========================================================
   13b. SCROLL PROGRESS BAR
   ========================================================== */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--ember);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ==========================================================
   13c. SCROLL-REVEAL
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.22,.68,.35,1), transform 0.7s cubic-bezier(.22,.68,.35,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================
   13d. FLOATING BACKGROUND GLYPHS
   ========================================================== */
.floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.floater {
  position: absolute;
  will-change: transform;
}
.floater-glyph {
  display: block;
  font-size: clamp(1rem, 2.5vw, 1.8rem);
  color: var(--ink);
  opacity: 0.1;
  animation-name: floaterDrift;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes floaterDrift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(18px, -22px) rotate(12deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ==========================================================
   13e. EASTER EGG CONFETTI + BANNER
   ========================================================== */
.confetti-piece {
  position: fixed;
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 300;
  animation: confettiPop 900ms ease-out forwards;
}
@keyframes confettiPop {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
.egg-banner {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: var(--ember);
  color: var(--hero-cream);
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 2px;
  box-shadow: 4px 4px 0 var(--hero-sand);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.egg-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================
   14. PRINT STYLESHEET
   ========================================================== */
@media print {
  #site-nav          { display: none !important; }
  #countdown-timer   { display: none !important; }
  .countdown-done    { display: none !important; }
  #lang-toggle       { display: none !important; }
  #map-leaflet       { display: none !important; }
  .gallery-stub      { display: none !important; }
  .floaters          { display: none !important; }
  #scroll-progress   { display: none !important; }
  .confetti-piece    { display: none !important; }
  .egg-banner        { display: none !important; }
  .contour           { display: none !important; }
  .hero-map          { display: none !important; }

  .reveal { opacity: 1 !important; transform: none !important; }
  .hero-title { text-shadow: none !important; }

  .accordion-body    { display: block !important; }
  .accordion-body[hidden] { display: block !important; }
  .accordion-icon    { display: none !important; }

  .section, .card {
    background: white !important;
    color: black !important;
  }
  .section-heading { color: black !important; }
  .section-heading::before { color: #888 !important; }
  .card { border-color: #ccc !important; }
  .card-tag { background: #888 !important; color: white !important; }
  .accordion-item { border-color: #ccc !important; }
  .timeline-day-heading, .menu-day-heading { color: black !important; border-top-color: #888 !important; }
  .day-title { color: black !important; }

  .split-grid { grid-template-columns: 1fr !important; }
  .cards-grid { grid-template-columns: repeat(2, 1fr) !important; }

  body { font-size: 10pt; }
  .section { break-inside: avoid; padding: 24pt 0; }
  .timeline-day, .menu-day { break-inside: avoid; }
  a::after { content: '' !important; }

  .hero-title { font-size: 36pt; color: black !important; }
  .hero-subtitle, .hero-date, .cd-num, .cd-label, .fact-badge { color: black !important; }
  .section--hero { background: white !important; color: black !important; min-height: auto !important; }
}

/* ==========================================================
   15. REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
