/* =========================
   0. Reset / base
   ========================= */

   *,
   *::before,
   *::after {
     box-sizing: border-box;
   }
   
   html,
   body {
     margin: 0;
     padding: 0;
   }
   
   body {
     font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
       sans-serif;
     font-size: 16px;
     line-height: 1.5;
     color: #1a1b1a;
     background-color: #f5f3ef; /* HOME bg */
     -webkit-font-smoothing: antialiased;
     text-rendering: optimizeLegibility;
   }
   
   /* prevent scroll jank */
   html,
   body {
     height: 100%;
   }
   
   .page {
     position: relative;
     min-height: 100vh;
     overflow-x: hidden;
   }
   
   /* =========================
      1. Variables
      ========================= */
   
   :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;
   }
   
   /* =========================
      2. Background layer
      ========================= */
   
   .page-bg {
     position: fixed;
     inset: 0;
     z-index: 0; /* BG */
     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 bg syncs with FAQ route */
   body.route-faq .page-bg {
     background-color: var(--color-bg-faq);
   }
   
   /* =========================
      3. Transition veil
      ========================= */
   
   .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);
   }
   
   /* lekki welon nad FAQ */
   body.route-faq .transition-veil {
     opacity: 0.25;
   }
   
   /* =========================
      4. Intro scene layout
      ========================= */
   
   .intro-scene {
     position: relative;
     z-index: 1;
     min-height: 100vh;
     display: flex;
     align-items: center;
     justify-content: center;
     /* większy top padding, żeby nie ucinało koperty */
     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;
   }
   
   /* JEDNA karta z fakturą papieru – koperta + kolaż */
   
   .intro-visual {
     width: 100%;
     max-width: 720px;
     display: flex;
     flex-direction: column;
     align-items: center;
     gap: 18px;
     background-color: #f3eee6; /* „papier” */
     border-radius: 26px;
     box-shadow: 0 20px 46px rgba(0, 0, 0, 0.22);
     padding: 28px 24px 30px;
     position: relative;
   }
   
   /* blok z kopertą */
   
   .intro-envelope-shell {
     position: relative;
     z-index: 10; /* envelope */
     width: min(460px, 90vw);
     aspect-ratio: 16 / 10;
     opacity: 0;
     transform: translateY(24px) scale(0.96);
     will-change: transform, opacity;
     overflow: hidden;
     cursor: pointer; /* cała koperta klikalna */
   
     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);
     }
   }
   
   /* mobile tuning */
   @media (max-width: 600px) {
     .intro-visual {
       padding: 22px 14px 24px;
       border-radius: 22px;
     }
   
     .intro-envelope-shell {
       width: min(92vw, 380px);
       border-radius: 18px;
     }
   }
   
   /* Envelope images */
   
   .envelope-image {
     position: absolute;
     inset: 0;
     display: block;
     will-change: transform, opacity;
     pointer-events: none;
   }
   
   .envelope-image img {
     width: 100%;
     height: 100%;
     display: block;
     /* żeby nie ucinało górnej części koperty */
     object-fit: contain;
     image-rendering: auto;
   }
   
   /* Closed / open default states */
   
   .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);
   }
   
   /* Tekst na kartce */
   
   .envelope-greeting {
     position: absolute;
     z-index: 15;
     /* obszar białej kartki w otwartej kopercie – lekko wyżej */
     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);
   }
   
   /* pokazujemy tekst dopiero po otwarciu koperty */
   body.intro-opened .envelope-greeting {
     opacity: 1;
     transform: translateY(0);
   }
   
   /* Seal button */
   
   .envelope-seal {
     position: absolute;
     z-index: 20; /* above envelope */
     top: 52%;
     left: 50%;
     width: 22%;  /* ~rozmiar z nagraniem */
     transform: translate(-50%, -50%) scale(0.9);
     padding: 0;
     border: none;
     background: transparent;
     cursor: pointer;
     will-change: transform, opacity;
     pointer-events: auto;
   
     /* domyślnie ukryty, pokażemy dopiero po załadowaniu obrazów */
     opacity: 0;
     transition:
       opacity var(--intro-fade-duration) var(--ease-in-out-soft),
       transform var(--intro-fade-duration) var(--ease-in-out-soft);
   }
   
   /* po pełnym załadowaniu strony – pokazujemy lak */
   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;
   }
   
   /* Hover / focus efekt */
   
   .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);
     }
   }
   
   /* OpenSceneIn - overshoot dla otwartej koperty */
   
   @keyframes envelope-open-overshoot {
     0% {
       transform: scale(0.97) translateY(6px);
     }
     40% {
       transform: scale(1.015) translateY(-4px);
     }
     100% {
       transform: scale(1) translateY(0);
     }
   }
   
   /* =========================
      4b. Collage under envelope
      ========================= */
   
   .invite-collage {
     position: relative;
     z-index: 30; /* collage/invite UI layer */
     width: min(720px, 100%);
     margin-top: 14px;
     display: grid;
     grid-template-columns: 1.4fr 1.1fr;
     grid-template-rows: auto auto auto;
     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);
   }
   
   /* Podstawowy wygląd kart */
   
   .invite-card {
     display: block;
     position: relative;
     border-radius: 0; /* ostre krawędzie */
     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);
     /* zerujemy marginesy figure, żeby kafelek ze zdjęciem nie był węższy */
     margin: 0;
   }
   
   /* karty: hover */
   
   .invite-card:hover {
     background-color: #ffffff;
     box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
     transform: translateY(-2px) scale(1.01);
   }
   
   /* zdjęcie pary */
   
   .invite-card--photo {
     padding: 0;
     grid-row: 1 / 2;
     grid-column: 1 / 2;
     min-height: 140px;
     transform: translate(-6px, -4px) rotate(-1.8deg);
   }
   
   /* zdjęcie zawsze wypełnia kafelek – także na mobile */
   .invite-card--photo img {
     width: 100%;
     height: 100%;
     object-fit: cover;
     display: block;
   }
   
   /* Save the Date – prawa kolumna niżej */
   
   .invite-card--save-date {
     grid-row: 1 / 2;
     grid-column: 2 / 3;
     text-align: center;
     min-height: 195px;
     margin-top: 30px; /* prawa kolumna wyraźnie niżej */
     transform: translate(8px, -2px) rotate(1.1deg);
   }
   
   .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;
   }
   
   /* RSVP */
   
   .invite-card--rsvp {
     grid-row: 2 / 3;
     grid-column: 1 / 2;
     min-height: 105px;
     transform: translate(-8px, 2px) rotate(-0.9deg);
   }
   
   .invite-card--rsvp .invite-card-heading {
     text-align: left;
   }
   
   .invite-card-body {
     font-size: 14px;
     color: #55534a;
   }
   
   /* Plan ślubu */
   
   .invite-card--schedule {
     grid-row: 2 / 3;
     grid-column: 2 / 3;
     min-height: 115px;
     margin-top: 20px;
     transform: translate(10px, 8px) rotate(0.7deg);
   }
   
   /* Jak dojechać */
   
   .invite-card--directions {
     grid-row: 3 / 4;
     grid-column: 1 / 2;
     min-height: 115px;
     margin-top: 16px;
     transform: translate(-4px, 12px) rotate(-0.5deg);
   }
   
   /* Album weselny */
   
   .invite-card--album {
     grid-row: 3 / 4;
     grid-column: 2 / 3;
     min-height: 115px;
     margin-top: 30px;
     transform: translate(12px, 16px) rotate(1.2deg);
   }
   
   /* Ikony w nagłówkach */
   
   .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;
   }
   
   /* mobile: mocniejszy efekt „rozrzucenia” + równa szerokość kolumn */
   
   @media (max-width: 720px) {
     .invite-collage {
       gap: 10px;
       /* obie kolumny równej szerokości */
       grid-template-columns: 1fr 1fr;
     }
   
     /* mocniejsze, „kolorowe” rozrzucenie jak na inspiracji */
     .invite-card--photo {
       transform: translate(-10px, -8px) rotate(-3deg);
     }
   
     .invite-card--save-date {
       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--album {
       transform: translate(14px, 22px) rotate(3.4deg);
     }
   }
   
   /* =========================
      4c. Invite text / CTA
      ========================= */
   
   .invite-ui {
     position: relative;
     z-index: 40; /* ponad collage */
     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 typografia */
   
   .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;
   }
   
   /* Buttony */
   
   .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);
   }
   
   /* =========================
      5. FAQ screen
      ========================= */
   
   .faq-screen {
     position: fixed;
     inset: 0;
     z-index: 200; /* FAQ */
     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;
   }
   
   /* FAQ visible states */
   
   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;
   }
   
   /* HOME visibility w zależności od trasy */
   
   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);
   }
   
   /* =========================
      6. Proste otwieranie koperty (body.intro-opened)
      ========================= */
   
   /* Zamknięta koperta znika, lekko się "wysuwa" */
   body.intro-opened .envelope-image--closed {
     opacity: 0;
     transform: scale(1.02) translateY(6px);
   }
   
   /* Otwarta koperta wskakuje z lekkim overshootem */
   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;
   }
   
   /* Lak znika */
   body.intro-opened .envelope-seal {
     opacity: 0;
     transform: translate(-50%, -50%) scale(0.9);
   }
   
   /* Po otwarciu koperty pokazujemy kolaż + tekst jak w wideo */
   body.intro-opened .invite-collage,
   body.intro-opened .invite-ui {
     opacity: 1;
     transform: translateY(0);
     filter: blur(0);
     pointer-events: auto;
   }
   
   /* PRZED otwarciem: kolaż i tekst nie biorą udziału w layoutcie */
   
   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;
   }
   
   /* =========================
      7. prefers-reduced-motion
      ========================= */
   
   @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;
     }
   }
   
   /* =========================
      8. Small screens (ogólny layout)
      ========================= */
   
   @media (max-width: 768px) {
     .intro-layout {
       gap: 24px;
     }
   
     .invite-subtitle {
       font-size: 0.95rem;
     }
   
     .faq-screen {
       padding-top: 40px;
     }
   }
   