*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1b1a;
  background-color: #f5f3ef;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

:root {
  --color-bg-home: #f5f3ef;
  --color-bg-faq: #13251d;
  --color-accent: #c9a46c;
  --color-text-on-dark: #f4f2ec;

  --ease-out-soft: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-in-out-soft: cubic-bezier(0.39, 0.575, 0.565, 1);
  --ease-overshoot: cubic-bezier(0.22, 1.35, 0.25, 1);

  --intro-fade-duration: 420ms;
  --intro-open-duration: 460ms;
  --intro-collage-duration: 600ms;
  --faq-out-duration: 260ms;
  --faq-in-duration: 600ms;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--color-bg-home);
  background-image:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.5) 0, transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.08) 0, transparent 55%);
  background-size: cover;
  transition: background-color var(--faq-in-duration) var(--ease-out-soft);
}

body.route-faq .page-bg {
  background-color: var(--color-bg-faq);
}

.transition-veil {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: rgba(11, 23, 18, 0.9);
  opacity: 0;
  transition: opacity var(--faq-out-duration) var(--ease-in-out-soft);
}

body.route-faq .transition-veil {
  opacity: 0.25;
}

.intro-scene {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(80px, 14vh, 140px) 16px;
}

.intro-layout {
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.intro-visual {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  padding: 28px 24px 30px;
  position: relative;
}

.envelope-heading {
  text-align: center;
  margin-bottom: 18px;
  font-family: "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: clamp(1.9rem, 3.2vw, 2.4rem);
  line-height: 1.2;
  color: #3f4034;
}

.envelope-heading-date {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.intro-envelope-shell {
  position: relative;
  z-index: 10;
  width: min(580px, 92vw);
  aspect-ratio: 16 / 10;
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  will-change: transform, opacity;
  overflow: hidden;
  cursor: pointer;
  animation: envelope-intro-in 650ms var(--ease-out-soft) 120ms forwards;
}

@keyframes envelope-intro-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.envelope-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 0.9rem;
  color: #6b6a62;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--intro-fade-duration) var(--ease-out-soft),
    transform var(--intro-fade-duration) var(--ease-out-soft);
}

body.intro-opened .envelope-hint {
  opacity: 0;
  transform: translateY(-4px);
}

.envelope-image {
  position: absolute;
  inset: 0;
  display: block;
  will-change: transform, opacity;
  pointer-events: none;
}

.envelope-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: auto;
}

.envelope-image--closed {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition:
    opacity var(--intro-fade-duration) var(--ease-in-out-soft),
    transform var(--intro-fade-duration) var(--ease-in-out-soft);
}

.envelope-image--open {
  opacity: 0;
  transform: scale(0.98) translateY(12px);
  transition:
    opacity var(--intro-fade-duration) var(--ease-in-out-soft),
    transform var(--intro-open-duration) var(--ease-overshoot);
}

.envelope-greeting {
  position: absolute;
  z-index: 15;
  left: 18%;
  right: 18%;
  top: 26%;
  bottom: 36%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Times New Roman", ui-serif, Georgia, serif;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.4;
  letter-spacing: 0.03em;
  color: #3f4034;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity var(--intro-fade-duration) var(--ease-out-soft),
    transform var(--intro-fade-duration) var(--ease-out-soft);
}

body.intro-opened .envelope-greeting {
  opacity: 1;
  transform: translateY(0);
}

.envelope-seal {
  position: absolute;
  z-index: 20;
  top: 60%;
  left: 50%;
  width: 18%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  will-change: transform, opacity;
  opacity: 0;
  transition:
    opacity var(--intro-fade-duration) var(--ease-in-out-soft),
    transform var(--intro-fade-duration) var(--ease-in-out-soft);
}

body.intro-images-ready .envelope-seal {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.envelope-seal picture,
.envelope-seal img {
  display: block;
  width: 100%;
  height: auto;
}

.envelope-seal:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .intro-envelope-shell:hover {
    transform: translateY(-10px) scale(1.01);
  }

  .envelope-seal:hover {
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes envelope-open-overshoot {
  0% {
    transform: scale(0.97) translateY(6px);
  }

  40% {
    transform: scale(1.015) translateY(-4px);
  }

  100% {
    transform: scale(1) translateY(0);
  }
}

/* KOLAŻ — PROFESJONALNY UKŁAD NA GRID-AREAS */

.invite-collage {
  position: relative;
  z-index: 30;
  width: min(720px, 100%);
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.4fr 1.1fr;
  grid-template-areas:
    "photo album"
    "rsvp schedule"
    "directions save-date";
  gap: 10px;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(3px);
  pointer-events: none;
  transition:
    opacity var(--intro-collage-duration) var(--ease-out-soft),
    transform var(--intro-collage-duration) var(--ease-out-soft),
    filter var(--intro-collage-duration) var(--ease-out-soft);
}

.invite-card {
  display: block;
  position: relative;
  border-radius: 0;
  background: #fbfaf8;
  border: 1px solid rgba(222, 214, 203, 0.95);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transform-origin: center center;
  transition:
    transform 220ms var(--ease-out-soft),
    box-shadow 220ms var(--ease-out-soft),
    background-color 180ms var(--ease-out-soft);
  margin: 0;
}

.invite-card:hover {
  background-color: #ffffff;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px) scale(1.01);
}

.invite-card--photo {
  grid-area: photo;
  padding: 0;
  min-height: 140px;
  transform: translate(-6px, -4px) rotate(-1.8deg);
}

.invite-card--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Album weselny — OBOK ZDJĘCIA */

.invite-card--album {
  grid-area: album;
  min-height: 195px;
  margin-top: 30px;
  transform: translate(8px, -2px) rotate(1.1deg);
}

/* Zapamiętaj datę — NA DOLE PO PRAWEJ */

.invite-card--save-date {
  grid-area: save-date;
  text-align: center;
  min-height: 115px;
  margin-top: 30px;
  transform: translate(12px, 16px) rotate(1.2deg);
}

.invite-card--rsvp {
  grid-area: rsvp;
  min-height: 105px;
  transform: translate(-8px, 2px) rotate(-0.9deg);
}

.invite-card--schedule {
  grid-area: schedule;
  min-height: 115px;
  margin-top: 20px;
  transform: translate(10px, 8px) rotate(0.7deg);
}

.invite-card--directions {
  grid-area: directions;
  min-height: 115px;
  margin-top: 16px;
  transform: translate(-4px, 12px) rotate(-0.5deg);
}

.invite-card-heading {
  font-family: "Times New Roman", ui-serif, Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: #8f6b3d;
}

.save-date-main {
  font-family: "Times New Roman", ui-serif, Georgia, serif;
  font-size: 20px;
  line-height: 1.3;
}

.save-date-time {
  margin-top: 4px;
  font-size: 14px;
}

.save-date-place {
  margin-top: 2px;
  font-size: 13px;
  color: #66645c;
}

.invite-card-body {
  font-size: 14px;
  color: #55534a;
}

.invite-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

.invite-card-icon--camera svg {
  width: 18px;
  height: 18px;
  stroke: #6a6a63;
  fill: none;
  stroke-width: 1.4;
}

.invite-ui {
  position: relative;
  z-index: 40;
  max-width: 600px;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(3px);
  pointer-events: none;
  will-change: transform, opacity, filter;
  transition:
    opacity var(--intro-collage-duration) var(--ease-out-soft),
    transform var(--intro-collage-duration) var(--ease-out-soft),
    filter var(--intro-collage-duration) var(--ease-out-soft);
}

.invite-title {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 3.4vw, 2.7rem);
  letter-spacing: 0.02em;
  margin: 8px 0 10px;
}

.invite-subtitle {
  margin: 0 0 20px;
  max-width: 36em;
  color: #4a4a45;
}

.btn-primary,
.btn-secondary {
  font: inherit;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color 180ms var(--ease-out-soft),
    color 180ms var(--ease-out-soft),
    box-shadow 180ms var(--ease-out-soft),
    transform 120ms var(--ease-out-soft);
}

.btn-primary {
  background-color: var(--color-accent);
  color: #1b1a15;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.btn-primary:hover {
  background-color: #d2ae76;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.17);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-on-dark);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-secondary:active {
  background-color: rgba(255, 255, 255, 0.16);
}

.faq-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 56px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  color: var(--color-text-on-dark);
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.08) 0, transparent 50%),
    linear-gradient(135deg, #102119 0%, #1e3a2e 60%, #274636 100%);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity var(--faq-in-duration) var(--ease-out-soft),
    transform var(--faq-in-duration) var(--ease-out-soft);
}

.faq-header {
  max-width: 720px;
}

.faq-title {
  font-size: clamp(2.4rem, 3.2vw, 3rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.faq-intro {
  margin: 0;
  color: rgba(244, 242, 236, 0.8);
}

.faq-list {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.faq-item {
  padding: 16px 0;
  border-bottom: 1px solid rgba(244, 242, 236, 0.24);
}

.faq-question {
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.faq-answer {
  margin: 0;
  color: rgba(244, 242, 236, 0.88);
  font-size: 0.97rem;
}

.faq-footer {
  margin-top: auto;
}

body.route-faq {
  overflow: hidden;
}

body.route-faq .faq-screen {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

body.route-home .faq-screen {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

body.route-home .intro-scene {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  transition:
    opacity var(--faq-in-duration) var(--ease-out-soft),
    transform var(--faq-in-duration) var(--ease-out-soft);
}

body.route-faq .intro-scene {
  opacity: 0;
  transform: scale(0.98) translateY(-8px);
  pointer-events: none;
  transition:
    opacity var(--faq-out-duration) var(--ease-in-out-soft),
    transform var(--faq-out-duration) var(--ease-in-out-soft);
}

body.intro-opened .envelope-image--closed {
  opacity: 0;
  transform: scale(1.02) translateY(6px);
}

body.intro-opened .envelope-image--open {
  opacity: 1;
  transform: scale(0.97) translateY(10px);
  animation: envelope-open-overshoot var(--intro-open-duration) var(--ease-overshoot) forwards;
}

body.intro-opened .envelope-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

body.intro-opened .invite-collage,
body.intro-opened .invite-ui {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  pointer-events: auto;
}

body:not(.intro-opened) .invite-collage,
body:not(.intro-opened) .invite-ui {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
}

@media (max-width: 720px) {
  .invite-collage {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "photo album"
      "rsvp schedule"
      "directions save-date";
    gap: 10px;
  }

  .invite-card--photo {
    transform: translate(-10px, -8px) rotate(-3deg);
  }

  .invite-card--album {
    transform: translate(12px, -6px) rotate(3deg);
  }

  .invite-card--rsvp {
    transform: translate(-10px, 8px) rotate(-2.2deg);
  }

  .invite-card--schedule {
    transform: translate(12px, 14px) rotate(2.4deg);
  }

  .invite-card--directions {
    transform: translate(-8px, 18px) rotate(-2.4deg);
  }

  .invite-card--save-date {
    transform: translate(14px, 22px) rotate(3.4deg);
  }
}

@media (max-width: 600px) {
  .intro-visual {
    padding: 22px 14px 24px;
    border-radius: 0;
  }

  .intro-envelope-shell {
    width: min(92vw, 380px);
    border-radius: 18px;
  }

  .envelope-heading {
    font-size: 1.8rem;
  }

  .envelope-hint {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .intro-layout {
    gap: 24px;
  }

  .invite-subtitle {
    font-size: 0.95rem;
  }

  .faq-screen {
    padding-top: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .envelope-image--closed {
    opacity: 0 !important;
  }

  .envelope-image--open {
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
  }

  .invite-collage,
  .invite-ui {
    opacity: 1 !important;
    transform: translateY(0) !important;
    filter: none !important;
    pointer-events: auto !important;
    max-height: none !important;
  }

  .transition-veil {
    opacity: 0 !important;
  }

  .intro-envelope-shell {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .envelope-hint {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
}