:root {
  --cream: #FBF5EC;
  --cream-alt: #F4EADA;
  --rose: #D9A5A0;
  --rose-dark: #B97B76;
  --green: #7C8A5E;
  --gold: #C39A4B;
  --ink: #4A3728;
  --ink-soft: #7A6A5A;
  --white: #FFFFFF;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(74, 55, 40, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  width: 100%;
  max-width: 100vw;
}

body {
  position: relative;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  color: var(--ink);
  margin: 0 0 0.4em;
}

h2 { font-size: 2rem; text-align: center; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--rose-dark); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

img, svg { max-width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 245, 236, 0.9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(74, 55, 40, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}
.logo .amp, .logo span { color: var(--rose-dark); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
}
.main-nav a:hover { color: var(--rose-dark); }
.nav-puffik {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--rose);
  color: var(--white) !important;
  padding: 7px 14px;
  border-radius: 999px;
}
.icon-sm { width: 24px; height: 24px; }
.icon-xs { width: 34px; height: 34px; flex-shrink: 0; }
.icon-md { width: 56px; height: 56px; flex-shrink: 0; }
.icon-lg { width: 130px; height: 130px; flex-shrink: 0; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 90px 24px 70px;
  position: relative;
}
.hero-deco {
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--rose-dark);
  font-size: 0.85rem;
  font-weight: 600;
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  margin: 6px 0;
}
.hero h1 .amp {
  color: var(--rose-dark);
  font-style: italic;
}
.hero-date {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin-bottom: 34px;
}
.hero-lead {
  max-width: 620px;
  margin: 30px auto 26px;
}

.hero-photo {
  --side-x: 140px;
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 300px;
  margin: 36px auto 0;
  overflow: hidden;
}
.hero-photo-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 210px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: var(--cream-alt);
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-photo-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 210px;
  height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 4px solid var(--white);
  outline: 2px solid var(--gold);
  outline-offset: -10px;
  transition: transform 1.1s cubic-bezier(.4,0,.2,1), opacity 1.1s ease;
}
.hero-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.role-center { transform: translate(-50%, -50%) translateX(0) scale(1); opacity: 1; z-index: 3; }
.role-left   { transform: translate(-50%, -50%) translateX(calc(-1 * var(--side-x))) scale(0.72); opacity: 0.55; z-index: 2; }
.role-right  { transform: translate(-50%, -50%) translateX(var(--side-x)) scale(0.72); opacity: 0.55; z-index: 2; }

/* Karta co "opouští" levou stranu se neviditelně ponoří (fotka se v tu chvíli
   vymění) a zase se vynoří na pravé straně - žádné prokluzování přes střed. */
@keyframes heroRecycle {
  0%   { transform: translate(-50%, -50%) translateX(calc(-1 * var(--side-x))) scale(0.72); opacity: 0.55; }
  45%  { transform: translate(-50%, -50%) translateX(0) scale(0.25); opacity: 0; }
  55%  { transform: translate(-50%, -50%) translateX(0) scale(0.25); opacity: 0; }
  100% { transform: translate(-50%, -50%) translateX(var(--side-x)) scale(0.72); opacity: 0.55; }
}
.hero-photo-card.recycling {
  animation: heroRecycle 1.3s ease;
  transition: none;
  z-index: 1;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.countdown-item {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-width: 84px;
}
.countdown-item span {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--rose-dark);
}
.countdown-item small {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--ink-soft);
}

.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--rose-dark); color: var(--white); }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(185,123,118,.35); }
.btn-outline { border-color: var(--rose-dark); color: var(--rose-dark); background: transparent; }

/* ---------- Sections ---------- */
.section { padding: 70px 24px; max-width: 1100px; margin: 0 auto; }
.section.alt { background: var(--cream-alt); max-width: none; border-radius: 40px; margin: 0 24px; }
.section.alt > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.section-lead { text-align: center; max-width: 560px; margin: 0 auto 40px; }

/* Timeline */
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 75px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--rose) 0 6px, transparent 6px 12px);
}
.timeline li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
  position: relative;
}
.timeline .time {
  width: 54px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--rose-dark);
  text-align: right;
  padding-top: 3px;
}
.timeline .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--cream);
  flex-shrink: 0;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.timeline-content { flex: 1; }
.timeline strong { display: block; }
.timeline p { margin: 2px 0 0; font-size: 0.92rem; }

/* Venue */
.venues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}
.venue-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.venue-card h3 { font-size: 1.25rem; }
.venue-card iframe {
  width: 100%;
  height: 220px;
  border: 0;
  border-radius: 14px;
  margin-top: 16px;
}

/* Info cards */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.info-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.info-card h3 { font-size: 1.1rem; color: var(--rose-dark); }
.info-card p { font-size: 0.92rem; margin: 0; }

/* RSVP */
.rsvp-form {
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-row { margin-bottom: 18px; }
.form-row label, .form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.rsvp-form input[type="text"],
.rsvp-form input[type="number"],
.rsvp-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e2d5c4;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px; /* min. 16px, jinak iOS Safari při focusu pole automaticky přiblíží stránku */
  background: var(--cream);
}
.rsvp-form input:focus, .rsvp-form textarea:focus {
  outline: 2px solid var(--rose);
}
.radio-group { display: flex; flex-direction: column; gap: 6px; font-weight: 400; font-size: 0.92rem; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form-hint { font-size: 0.8rem; margin-top: 10px; }

.rsvp-success {
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  padding: 40px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.rsvp-success .icon-lg { width: 90px; height: 90px; margin: 0 auto 12px; }
.rsvp-success h3 { font-size: 1.4rem; margin-bottom: 6px; }
.rsvp-success p { margin: 0; }

/* ---------- Puffík chat ---------- */
.puffik-section { scroll-margin-top: 90px; }
.puffik-intro {
  display: flex;
  align-items: center;
  gap: 26px;
  max-width: 760px;
  margin: 0 auto 40px;
  text-align: left;
}
.puffik-intro h2 { text-align: left; }

.chat-window {
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 460px;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--cream-alt);
  border-bottom: 1px solid rgba(74,55,40,.08);
}
.chat-header strong { display: block; font-family: 'Playfair Display', serif; }
.chat-header .status { font-size: 0.72rem; color: var(--green); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  animation: pop .18s ease;
}
.msg-bot {
  background: var(--cream-alt);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-user {
  background: var(--rose);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: var(--cream-alt);
  align-self: flex-start;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.msg-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-soft);
  animation: typingDot 1s infinite ease-in-out;
}
.msg-typing span:nth-child(2) { animation-delay: .15s; }
.msg-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(74,55,40,.08);
}
.chat-input-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid #e2d5c4;
  font-family: inherit;
  font-size: 16px;
  background: var(--cream);
}
.chat-input-row input:focus { outline: 2px solid var(--rose); }
.chat-input-row button {
  background: var(--rose-dark);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.chat-input-row button:hover { background: var(--rose); }

/* ---------- Footer ---------- */
.site-footer { background: var(--cream-alt); padding: 40px 24px; margin-top: 40px; }
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.footer-admin {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  padding: 10px 20px 10px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.footer-admin strong { display: block; font-family: 'Playfair Display', serif; }
.footer-admin span { font-size: 0.78rem; color: var(--green); font-weight: 600; }
.site-footer p { font-size: 0.85rem; margin: 0; }

/* ---------- Floating chat button ---------- */
.chat-fab {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  right: calc(22px + env(safe-area-inset-right, 0px));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 12px 26px rgba(74,55,40,.25);
  border: 3px solid var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  padding: 0;
  /* drží fixní pozici spolehlivě i na iOS Safari (jinak umí za scrollu "ujíždět") */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}
.chat-fab:hover { transform: scale(1.06); }

/* ---------- Puffík animations (apply to every <use> instance) ---------- */
.p-eyelid {
  animation: blink 6.5s infinite;
  transform-origin: center;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(0); }
  95% { transform: scaleY(1); }
}
.p-ear-left { transform-origin: 60px 60px; animation: earTwitchL 4.5s ease-in-out infinite; }
.p-ear-right { transform-origin: 160px 60px; animation: earTwitchR 4.5s ease-in-out infinite 0.4s; }
@keyframes earTwitchL {
  0%, 85%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(-8deg); }
}
@keyframes earTwitchR {
  0%, 85%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(8deg); }
}
.p-tail { animation: tailSway 2.6s ease-in-out infinite; transform-origin: 180px 165px; }
@keyframes tailSway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(10deg); }
}
.p-paw { animation: pawWiggle 3s ease-in-out infinite; transform-origin: bottom center; }
@keyframes pawWiggle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.p-patch { animation: patchTilt 5s ease-in-out infinite; transform-origin: 140px 106px; }
@keyframes patchTilt {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-2deg); }
}

.icon-sm, .icon-xs, .icon-lg { animation: bob 3.4s ease-in-out infinite; }
.icon-md.puffik-float, .chat-fab .icon-md { animation: bob 3.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ---------- Language toggle ---------- */
.lang-toggle {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 200;
  background: var(--white);
  border: 2px solid var(--rose);
  color: var(--ink);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}
.lang-toggle:hover { background: var(--rose); color: var(--white); }

/* ---------- Lock screen ---------- */
body.is-locked { overflow: hidden; }

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity .5s ease;
}
.lock-overlay.fade-out { opacity: 0; pointer-events: none; }

.lock-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: var(--white);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 36px 30px 30px;
  position: relative;
}
.lock-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.lock-card p { font-size: 0.9rem; }

#guard-cat { width: 170px; height: auto; margin: 0 auto 6px; display: block; }

.lock-bubble {
  position: relative;
  max-width: 200px;
  margin: 0 auto 6px;
  padding: 0;
  border-radius: 14px;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.3rem;
  opacity: 0;
  transform: scale(0.6) translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  height: 0;
  overflow: visible;
}
.lock-bubble.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  padding: 8px 0 18px;
}
.lock-bubble.happy { color: var(--green); }
.lock-bubble.hiss { color: #A63C3C; }

.lock-form {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.lock-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid #e2d5c4;
  background: var(--cream);
  font-family: inherit;
  font-size: 16px;
}
.lock-form input:focus { outline: 2px solid var(--rose); }
.lock-form button {
  background: var(--rose-dark);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.lock-form button:hover { background: var(--rose); }

.lock-form.shake { animation: shake .5s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* --- Guard cat states --- */
.guard-eye-happy,
.guard-pupil-slit,
.guard-mouth-hiss,
.guard-spike { opacity: 0; }

.guard-pupil { opacity: 1; }

.guard-paw {
  transform: translateY(70px);
  transition: transform .35s ease;
  transform-origin: center;
}

#guard-cat.is-hiding .guard-paw {
  animation: peek 1.6s ease-in-out infinite;
}
@keyframes peek {
  0%, 60% { transform: translateY(0); }
  75% { transform: translateY(7px); }
  100% { transform: translateY(0); }
}

#guard-cat.is-watching .guard-pupil {
  animation: lookAround 4s ease-in-out infinite;
}
@keyframes lookAround {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2.5px); }
  75% { transform: translateX(2.5px); }
}

#guard-cat.is-happy .guard-eye-good { opacity: 0; }
#guard-cat.is-happy .guard-eye-happy { opacity: 1; }
#guard-cat.is-happy .guard-paw { transform: translateY(70px); }
#guard-cat.is-happy { animation: happyBounce 1.3s ease-in-out infinite; }
@keyframes happyBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

#guard-cat.is-hissing .guard-pupil { opacity: 0; }
#guard-cat.is-hissing .guard-pupil-slit {
  opacity: 1;
  transform: scaleX(0.25);
}
#guard-cat.is-hissing .guard-mouth-normal { opacity: 0; }
#guard-cat.is-hissing .guard-mouth-hiss { opacity: 1; }
#guard-cat.is-hissing .guard-spike { opacity: 1; }
#guard-cat.is-hissing .guard-paw { transform: translateY(70px); }
#guard-cat.is-hissing .guard-ear-l { transform: rotate(-14deg); transform-origin: 78px 55px; }
#guard-cat.is-hissing .guard-ear-r { transform: rotate(14deg); transform-origin: 172px 55px; }
#guard-cat.is-hissing { animation: hissShake .4s ease; }
@keyframes hissShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-5px) rotate(-2deg); }
  50% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-3px) rotate(-1deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .main-nav { display: none; }
  .puffik-intro { flex-direction: column; text-align: center; }
  .puffik-intro h2 { text-align: center; }
  .chat-window { height: 420px; }
  .section.alt { margin: 0 12px; border-radius: 26px; }
  .lock-card { padding: 28px 20px 24px; }
  #guard-cat { width: 130px; }
  .lang-toggle {
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  .chat-fab {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
    width: 58px;
    height: 58px;
  }
  .venues { grid-template-columns: 1fr; }
  .hero-photo { --side-x: 95px; height: 230px; }
  .hero-photo-card, .hero-photo-placeholder { width: 160px; height: 205px; }
}
