:root {
  --cream: #fbf4eb;
  --blue-light: #9ec6e6;
  --blue-medium: #6fa6cf;
  --blue-dark: #5282ad;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: block;
  background: #e6e6e6;
  font-family: 'Quicksand', sans-serif;
  overflow: hidden;
}

.card {
  width: min(92vw, 520px);
  max-height: 95%;
  aspect-ratio: 42 / 65;
  background: var(--cream);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  margin: 30px auto;
}

.small-card {
  width: min(92vw, 520px);
  max-height: 95%;
  aspect-ratio: 42 / 65;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  z-index: 9999;
}

.gate-panel {
  background: var(--cream);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  width: min(92vw, 320px);
}

.panels {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.panels-inner {
  transition: transform 620ms cubic-bezier(.2,.9,.3,1);
  will-change: transform;
}

.panel {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

/* reset margin inside panels so card centers nicely */
.panel .card { margin: 0; }

/* indicator dots */
.panel-dots {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 11000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.panels-enabled .panel-dots {
  opacity: 1;
  pointer-events: auto;
}

.panel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.75);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  padding: 0;
  cursor: pointer;
}

.panel-dot.active {
  background: var(--blue-medium);
  box-shadow: 0 6px 14px rgba(82,130,173,0.18);
}

.panel-dot:focus {
  outline: 2px solid rgba(111,160,200,0.25);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .panel-dot { transition: none; }
}

/* RSVP modal styles */
.rsvp-button {
  position: fixed;
  right: 18px;
  bottom: 80px;
  z-index: 12000;
  display: none; /* shown only when panels-enabled */
  padding: 10px 14px;
  background: var(--blue-medium);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.panels-enabled .rsvp-button { display: block; }

.rsvp-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 12010;
}
.rsvp-modal[aria-hidden="false"] { display: flex; }

.rsvp-panel {
  background: var(--cream);
  width: min(96vw, 520px);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  position: relative;
}
.rsvp-close {
  position: absolute;
  right: 10px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}
.rsvp-panel h2 { margin: 0 0 10px 0; }
.rsvp-panel label { display: block; margin-top: 10px; font-weight: 600; }
.rsvp-panel input, .rsvp-panel textarea { width: 100%; padding: 8px 10px; margin-top: 6px; border-radius: 8px; border: 1px solid #ccc; }
.rsvp-actions { display: flex; gap: 10px; margin-top: 12px; }
.rsvp-actions button { padding: 10px 14px; border-radius: 8px; border: none; cursor: pointer; }
.rsvp-actions button[type="submit"] { background: var(--blue-medium); color: white; }
.rsvp-actions button#rsvpCancel { background: #ddd; }
.rsvp-msg { margin-top: 10px; min-height: 1.2em; }

/* fade animation for overlay */
.gate-overlay.fade-out {
  animation: fadeOut 360ms ease-out forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

.card-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

/* ablauf overlay grid */
.ablauf-wrapper {
  position: relative;
  width: 100%;
  display: block;
}

.ablauf-img {
  display: block;
  width: 100%;
  height: auto;
}

.ablauf-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  grid-template-columns: 1fr 25% 1fr;
  gap: 0;
  z-index: 2;
}

.grid-cell {
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(12px, 2.5vw, 16px);
  color: #111;
  min-height: 0;
  overflow: hidden;
}

.small-card .card-face {
  position: relative;
  display: flex;
  flex-direction: column;
}

.small-card .card-header {
  padding: 18px;
  text-align: center;
  color: var(--blue-dark);
}

.card-header {
  padding: clamp(24px, 6vw, 40px) 20px 20px;
  text-align: center;
  color: var(--blue-medium);
  container-type: inline-size;
}

.card-header .intro {
  font-family: 'La Belle Aurore', cursive;
  font-size: clamp(22px, 6vw, 28px);
  margin-bottom: 0px;
}

.card-header .names {
  font-family: 'Quicksand', sans-serif;
  font-weight: 300;
  letter-spacing: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(12px, 6cqw, 28px);
}

.illustration {
  position: relative;
  width: 100%;
  height: 50%;
}

.illustration img {
  position: relative;
  bottom: -5px;
  left: 50%;
  transform: translateX(-40%);
  width: 130%;
  max-width: none;
}

.card-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 28%;
  background: var(--blue-dark);
  color: #ffffff;
  text-align: center;
  padding-top: 35px;
}

.small-card .card-footer {
  position: static;
  bottom: auto;
  width: 100%;
  height: auto;
  background: transparent;
  color: #222;
  text-align: left;
  padding: 16px 18px;
}

.small-card .card-footer h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: var(--blue-medium);
}

.small-card .card-footer p {
  margin: 6px 0;
  color: #333;
}

.card-footer .pw-form {
  padding: 10px 16px;
}

.card-footer .title {
  font-family: 'Limelight', sans-serif;
  font-size: clamp(24px, 7vw, 36px);
  letter-spacing: 4px;
  margin-bottom: 20px;
}

.card-footer .date {
  font-family: 'Limelight', sans-serif;
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: 6px;
  opacity: 0.9;
}

.pw-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pw-form label {
  color: var(--blue-dark);
  font-weight: 600;
}

.pw-form input[type="password"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
}

.pw-actions button {
  margin-top: 6px;
  padding: 10px 14px;
  background: var(--blue-medium);
  border: none;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}

.pw-error {
  color: #8b1c1c;
  min-height: 1.2em;
  margin-top: 6px;
}

.pw-form input:focus, .pw-actions button:focus {
  outline: 3px solid rgba(111,160,200,0.35);
  outline-offset: 2px;
}

.main-content {
  max-width: 900px;
  margin: 20px auto 60px;
  padding: 0 20px;
  display: none; 
}

.main-content[aria-hidden="false"] {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.card.small-card {
  transform-origin: center top;
}

.panels-enabled .card.small-card {
  animation: cardPop 420ms cubic-bezier(.2,.9,.3,1) both;
}

@keyframes cardPop {
  0% { opacity: 0; transform: translateY(8px) scale(0.985); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .panels-enabled .card.small-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

body.unlocked {
  overflow: auto;
}

/* Prevent pull-to-refresh / overscroll navigation while panels navigation is active.
   Apply to both html and body to ensure mobile browsers do not trigger a reload
   when the user pulls down at the top. */
html.panels-enabled, body.panels-enabled {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  touch-action: pan-y;
}

@media (max-width: 360px) {
  .card, .small-card {
    border-radius: 18px;
  }

  .card-header, .small-card .card-header {
    padding: 12px;
  }

  .gate-panel {
    padding: 12px;
  }
}
