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

/* --- Light Theme (default) --- */
:root, [data-theme="light"] {
  --bg: #FAF6F0;
  --bg-alt: #F0E8DC;
  --surface: #FFFFFF;
  --text-primary: #3E2D22;
  --text-secondary: #8A7060;
  --heading: #5C3D2E;
  --accent: #C17832;
  --accent-dark: #9A5E24;
  --accent-light: #D4A06A;
  --rust: #A04B2D;
  --sage: #7B8B6F;
  --fox: #D4763A;
  --border: rgba(92, 61, 46, 0.12);
  --accent-glow: rgba(193, 120, 50, 0.35);
  --nav-bg: rgba(250, 246, 240, 0.97);
  --card-shadow: rgba(92, 61, 46, 0.06);
  --canvas-dot: rgba(92, 61, 46, 0.45);
  --canvas-line: rgba(193, 120, 50, 0.12);
  --overlay-bg: rgba(250, 246, 240, 0.98);

  --font-display: 'EB Garamond', 'Georgia', serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
  --bg: #1C1410;
  --bg-alt: #2A1F1A;
  --surface: #3A2E26;
  --text-primary: #F2ECE4;
  --text-secondary: #A89888;
  --heading: #F2ECE4;
  --accent: #D4956A;
  --accent-dark: #C67B5C;
  --accent-light: #D9A48A;
  --rust: #C67B5C;
  --sage: #8B9B7F;
  --fox: #D9884A;
  --border: rgba(198, 123, 92, 0.18);
  --accent-glow: rgba(212, 149, 106, 0.35);
  --nav-bg: rgba(28, 20, 16, 0.92);
  --card-shadow: rgba(0, 0, 0, 0.25);
  --canvas-dot: rgba(242, 236, 228, 0.5);
  --canvas-line: rgba(212, 149, 106, 0.15);
  --overlay-bg: rgba(28, 20, 16, 0.98);
}

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

section, footer { position: relative; z-index: 2; }
.hero { z-index: 1; }

/* ===================================================================
   REUSABLE — Section Header
   =================================================================== */
.section-header {
  text-align: center;
  margin-bottom: clamp(48px, 6vw, 80px);
  position: relative;
  z-index: 2;
}

.section-header__label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.section-header__label .fox-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.section-header__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 400;
  color: var(--heading);
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.3s ease;
}

.section-header__subtitle {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 16px;
  line-height: 1.65;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  transition: color 0.3s ease;
}

/* ===================================================================
   REUSABLE — Card
   =================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(28px, 4vw, 48px);
  box-shadow: 0 2px 16px var(--card-shadow);
  transition: box-shadow 0.4s ease, transform 0.4s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 36px var(--card-shadow);
  transform: translateY(-2px);
}

/* ===================================================================
   Botanical Overlay
   =================================================================== */
.botanical-overlay {
  position: absolute;
  max-width: none;
  opacity: 0.15;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
  mask-image: radial-gradient(ellipse 80% 70% at center, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at center, black 40%, transparent 100%);
}

/* Dark theme: hide branches, constellation takes over */
[data-theme="dark"] .botanical-overlay,
[data-theme="dark"] .hero__branch-left,
[data-theme="dark"] .hero__branch-right {
  display: none;
}

/* Light theme: hide constellation canvases */
[data-theme="light"] .constellation-hero {
  display: none;
}

[data-theme="light"] .constellation-island {
  display: none;
}

/* ===================================================================
   Buttons
   =================================================================== */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 18px 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
  border: 1px solid transparent;
}

.btn--primary {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===================================================================
   Leaf Divider (inside section-header)
   =================================================================== */
.section-header__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.section-header__divider svg {
  width: clamp(160px, 30vw, 320px);
  height: 24px;
  overflow: visible;
}

.section-header__divider .div-line {
  stroke: var(--accent);
  stroke-width: 1;
  fill: none;
  opacity: 0.3;
}

.section-header__divider .div-leaf {
  fill: var(--accent);
  opacity: 0.5;
}

.section-header__divider.visible .div-line,
.section-header.visible .section-header__divider .div-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawLine 1.2s ease forwards;
}

/* ===================================================================
   Scroll Reveal
   =================================================================== */
.reveal {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal--left {
  transform: translateX(-60px) rotate(-2deg);
}

.reveal--right {
  transform: translateX(60px) rotate(2deg);
}

.reveal--up {
  transform: translateY(40px);
}

.reveal--scale {
  transform: scale(0.9);
}

.reveal.visible {
  opacity: 1;
  transform: translateX(0) rotate(0deg) scale(1) 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; }
.reveal--delay-5 { transition-delay: 0.5s; }

/* ===================================================================
   Constellation Canvas
   =================================================================== */
.constellation-hero {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.constellation-island {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.constellation-island.hidden,
.constellation-hero.hidden {
  opacity: 0 !important;
}

.constellation-island {
  mask-image: radial-gradient(ellipse 80% 70% at center, black 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at center, black 30%, transparent 90%);
}

/* ===================================================================
   Keyframes
   =================================================================== */
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes flipPulse {
  0% { transform: scaleY(1); }
  30% { transform: scaleY(0.88); }
  60% { transform: scaleY(1.04); }
  100% { transform: scaleY(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

/* ===================================================================
   Blazor validation styling
   =================================================================== */
.validation-message {
  color: var(--rust, #A04B2D);
  font-size: 12px;
  margin-top: 4px;
  font-family: var(--font-body);
}

.valid.modified:not([type=checkbox]) {
  outline: none;
}

.invalid {
  border-bottom-color: var(--rust, #A04B2D) !important;
}

/* ===================================================================
   MOBILE — Botanical overlays & Constellation islands
   Na výškovém displeji: větve natočené diagonálně, constellation na stejné pozici
   =================================================================== */
@media (max-width: 768px) {
  /* Větve: větší pro portrait displej, rotation per-section */
  .botanical-overlay {
    opacity: 0.10;
    max-width: none !important;
  }

  /* Constellation: kopíruje velikost větví */
  .constellation-island {
    height: 60% !important;
  }

  /* --- Per-section mobile positioning (light=větve, dark=constellation) --- */

  /* STORY: z levého dolního rohu diagonálně nahoru */
  .story > .botanical-overlay {
    bottom: -5% !important; left: -50% !important; width: 200% !important;
    transform: rotate(30deg) !important;
  }
  .story > .constellation-island {
    bottom: -5% !important; left: -50% !important; width: 200% !important;
  }

  /* SCHEDULE: jedna větev vpravo diagonálně */
  .schedule > .botanical-overlay {
    top: 5% !important; right: -50% !important; left: auto !important; width: 200% !important;
    transform: rotate(-30deg) scaleX(-1) !important;
  }
  .schedule > .constellation-island {
    top: 5% !important; right: -50% !important; left: auto !important; width: 200% !important;
  }

  /* VENUES: z pravého horního rohu diagonálně dolů */
  .venues > .botanical-overlay {
    top: -5% !important; right: -50% !important; left: auto !important;
    width: 200% !important; transform: rotate(-30deg) !important;
  }
  .venues > .constellation-island {
    top: -5% !important; right: -50% !important; left: auto !important; width: 200% !important;
  }

  /* DRESSCODE: z pravého horního rohu, překlop */
  .dresscode > .botanical-overlay {
    top: -5% !important; right: -50% !important; left: auto !important;
    width: 200% !important; transform: rotate(-30deg) scaleX(-1) !important;
  }
  .dresscode > .constellation-island {
    top: -5% !important; right: -50% !important; left: auto !important; width: 200% !important;
  }

  /* TRAVEL: z levého horního rohu diagonálně */
  .travel > .botanical-overlay {
    top: -5% !important; left: -50% !important;
    width: 200% !important; transform: rotate(30deg) scaleX(-1) !important;
  }
  .travel > .constellation-island {
    top: -5% !important; left: -50% !important; width: 200% !important;
  }

  /* FAQ: deco wrapper — z pravého spodního rohu */
  .faq__deco > .botanical-overlay {
    bottom: 0 !important; right: -40% !important; left: auto !important;
    width: 180% !important; transform: rotate(-25deg) scaleX(-1) !important;
  }
  .faq__deco > .constellation-island {
    bottom: 0 !important; right: -40% !important; left: auto !important; width: 180% !important;
  }

  /* GUEST RESPONSE: z levého spodního rohu */
  .rsvp > .botanical-overlay {
    bottom: -5% !important; left: -50% !important;
    width: 200% !important; transform: rotate(30deg) !important;
  }
  .rsvp > .constellation-island {
    bottom: -5% !important; left: -50% !important; width: 200% !important;
  }

  /* Reveal animace — menší posuny na mobilu */
  .reveal--left {
    transform: translateX(-30px) rotate(-1deg);
  }

  .reveal--right {
    transform: translateX(30px) rotate(1deg);
  }
}

/* ===================================================================
   Blazor Reconnect Modal — styled to match wedding theme
   =================================================================== */
.wedding-reconnect {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.wedding-reconnect[style*="display"] {
  display: flex !important;
}

/* Blazor adds these classes to control visibility */
.wedding-reconnect.show {
  display: flex;
}

.wedding-reconnect__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wedding-reconnect__dialog {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: clamp(40px, 6vw, 64px);
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 40px var(--card-shadow);
}

.wedding-reconnect__fox {
  width: 48px;
  height: 48px;
  fill: var(--fox);
  opacity: 0.5;
  margin: 0 auto 20px;
  display: block;
}

.wedding-reconnect__text {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  display: none;
}

/* Blazor sets these states on the modal */
.wedding-reconnect.show .wedding-reconnect__text--connecting { display: block; }
.wedding-reconnect.failed .wedding-reconnect__text--failed { display: block; }
.wedding-reconnect.rejected .wedding-reconnect__text--rejected { display: block; }

.wedding-reconnect.show .wedding-reconnect__btn { display: none; }
.wedding-reconnect.failed .wedding-reconnect__btn,
.wedding-reconnect.rejected .wedding-reconnect__btn { display: inline-block; }

.wedding-reconnect__btn {
  display: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 16px 40px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--accent);
  color: var(--bg);
  background: var(--accent);
  transition: background 0.3s ease, transform 0.2s ease;
}

.wedding-reconnect__btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* ===================================================================
   Blazor Error UI
   =================================================================== */
.wedding-error {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px var(--card-shadow);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.wedding-error__reload {
  color: var(--accent);
  text-decoration: underline;
  margin-left: 8px;
}

.wedding-error__dismiss {
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  opacity: 0.5;
}
