:root {
  --paper: #f2ede4;
  --paper-deep: #e6ddd0;
  --ink: #20241d;
  --muted: #6f7167;
  --moss: #202a1d;
  --moss-soft: #3c4734;
  --wine: #6b1f2b;
  --rose: #af7774;
  --gold: #a68451;
  --line: rgba(32, 36, 29, .2);
  --ivory: #fffaf1;
  --serif: "Italiana", Georgia, serif;
  --script: "Parisienne", "Snell Roundhand", cursive;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --max: 1240px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ivory); background: #172016; font-family: var(--sans); line-height: 1.55; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #d6a39e; outline-offset: 4px; }
.language-switch { position: fixed; z-index: 50; right: 18px; top: 18px; display: flex; gap: 7px; align-items: center; padding: 7px 10px; color: var(--ink); background: rgba(255,250,241,.9); border: 1px solid rgba(92,77,57,.22); font-size: 10px; font-weight: 600; letter-spacing: .1em; }
.language-switch a { color: inherit; text-decoration: none; opacity: .55; }
.language-switch a[aria-current="page"] { color: var(--wine); opacity: 1; }
/* Invitation opening */
.invitation-gate { position: fixed; inset: 0; z-index: 20; overflow: hidden; color: var(--ivory); background-color: #172016; background-image: repeating-linear-gradient(2deg, rgba(255,250,241,.025) 0 1px, transparent 1px 4px), repeating-linear-gradient(92deg, rgba(0,0,0,.07) 0 1px, transparent 1px 5px), radial-gradient(ellipse at 35% 20%, rgba(82,102,72,.17), transparent 52%); background-size: 100% 100%, 100% 100%, 100% 100%; transition: opacity .35s ease, visibility .35s; }
.invitation-gate::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .42; background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255,255,255,.018) 3px 4px), repeating-linear-gradient(-45deg, transparent 0 4px, rgba(0,0,0,.035) 4px 5px); background-size: 9px 9px, 11px 11px; mix-blend-mode: soft-light; }
.invitation-gate::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 25%, rgba(6,12,6,.25) 100%); }
.invitation-gate.is-opening { opacity: 0; visibility: hidden; }
.photographic-gate { position: relative; z-index: 1; width: 100%; height: 100%; display: grid; place-items: center; }
.gate-heading { position: absolute; z-index: 4; top: clamp(25px, 5vh, 60px); left: 50%; width: min(92vw, 900px); text-align: center; transform: translateX(-50%); transition: opacity .45s, transform .6s cubic-bezier(.22,1,.36,1); }
.gate-heading h1 { margin: 0; font-family: var(--script); font-size: clamp(48px, 7vw, 86px); font-weight: 400; line-height: 1; }
.gate-heading h1 span { color: #d6a39e; }
.envelope-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(1120px, 100vw); margin-top: clamp(55px, 8vh, 95px); }
.envelope-scene { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; box-shadow: 0 35px 100px rgba(0,0,0,.35); cursor: pointer; }
.envelope-scene > picture { position: absolute; inset: 0; }
.envelope-state { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.open-envelope { position: relative; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 13px 18px; color: var(--ivory); background: rgba(23,32,22,.72); border: 1px solid rgba(255,250,241,.56); box-shadow: 0 8px 30px rgba(0,0,0,.24); backdrop-filter: blur(7px); cursor: pointer; font-family: var(--serif); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; transition: background .25s, color .25s, transform .25s, opacity .3s; }
.open-envelope i { font-style: normal; font-size: 17px; }
.open-envelope:hover { color: var(--moss); background: var(--ivory); transform: translateY(-3px); }
.open-envelope:active { transform: scale(.98); }

@media (min-width: 641px) and (max-height: 850px) {
  .gate-heading { top: 22px; }
  .gate-heading h1 { font-size: clamp(46px, 6vw, 68px); }
  .envelope-stage { width: min(900px, 88vw); margin-top: 76px; gap: 12px; }
  .open-envelope { padding: 11px 16px; }
}


.envelope-scene { padding: 0; border: 0; background: transparent; }
.invitation-gate { overflow-y: auto; }
.photographic-gate { min-height: 540px; }
.gate-heading { pointer-events: none; }
.password-dialog { width: min(430px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 48px 36px 36px; color: var(--ink); background: var(--ivory); border: 1px solid #d6c7b5; box-shadow: 0 24px 100px #0006; }
.password-dialog::backdrop { background: rgba(8,16,8,.68); backdrop-filter: blur(5px); }
.password-dialog h2 { margin: 0 0 12px; color: var(--wine); font-family: var(--serif); font-size: 44px; font-weight: 400; line-height: 1.1; }
.password-dialog > p { margin: 0 0 28px; color: #626359; font-size: 14px; }
.close-prompt { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; padding: 0; color: var(--ink); background: transparent; border: 0; font-size: 26px; }
.password-dialog label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.password-dialog input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; color: var(--ink); background: #fffdf8; border: 1px solid #a69c8f; border-radius: 0; font-size: 16px; }
.password-dialog input[aria-invalid="true"] { border-color: var(--wine); }
.password-error { min-height: 22px; margin: 10px 0 16px; color: var(--wine); font-size: 13px; }
.unlock-button { display: block; width: 100%; min-height: 48px; padding: 12px 18px; color: var(--ivory); background: var(--wine); border: 1px solid var(--wine); font-size: 14px; }
.unlock-button:hover { background: #501620; }
.no-script { margin: 0 16px; font-size: 13px; text-align: center; }
@media (max-width: 640px) {
  .gate-heading { top: 90px; }
  .gate-heading h1 { font-size: 48px; }
  .envelope-stage { width: 100vw; margin-top: 100px; gap: 16px; }
  .envelope-scene { width: 100%; height: min(58vh, 620px); aspect-ratio: auto; box-shadow: none; }
  .envelope-state { object-fit: cover; object-position: center; }
  .open-envelope { padding: 12px 15px; font-size: 11px; white-space: nowrap; }
  .password-dialog { padding: 48px 24px 28px; }
  .password-dialog h2 { font-size: 40px; }
}
@media (max-height: 540px) {
  .photographic-gate { min-height: 460px; }
  .gate-heading { top: 56px; }
  .gate-heading h1 { font-size: 42px; }
  .envelope-stage { width: min(520px, 90vw); margin-top: 88px; }
  .envelope-scene { height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
