/* Capa do voucher A6 (105 x 148 mm): azul Nuit, lótus, "Um momento só teu." Medidas do PDF da gráfica (01-Essence-Voucher-A6-Artes-Para-Impressao.pdf).
   1 mm = 1/105 da largura da capa; a capa centra o conteúdo, por isso serve qualquer altura. */
.letter { container-type: inline-size; --mm: calc(100cqw / 105); background: #161a26; color: #ece6d6; gap: 0; }
.letter::before { inset: calc(var(--mm) * 2.4); border: max(1px, calc(var(--mm) * .2)) solid rgba(236, 230, 214, .16); }
.letter img.lt-lotus { width: calc(var(--mm) * 23); height: auto; margin: 0 0 calc(var(--mm) * 5.8); object-fit: contain; }
.letter .lt-title { margin: 0; width: auto; font: 400 calc(var(--mm) * 10.5) / calc(var(--mm) * 12.1) var(--display); text-align: center; color: #ece6d6; white-space: nowrap; }
.letter .lt-para { margin: calc(var(--mm) * .7) 0 0; font: 500 calc(var(--mm) * 4.85) / calc(var(--mm) * 5.4) var(--sans); color: #ece6d6; }
.letter .lt-brand { margin: calc(var(--mm) * 4.8) 0 0; font: 400 calc(var(--mm) * 2.22) / calc(var(--mm) * 3) var(--sans); letter-spacing: .22em; color: #ece6d6; padding-left: .22em; }

/* A capa tem a proporção exata do A6 (105:148) dentro do envelope de 160:120 (deitada, o livro ocupa 148 x 105 mm) */
.envelope > .letter { width: 65.625%; left: 17.1875%; top: -11.67%; height: auto; aspect-ratio: 105 / 148; }
.cover-front > .letter { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }

/* Selo de vinil redondo de 30 mm (selos-finais-pdfx1a/01-selo-geral-30mm): 30/160 da largura do envelope */
.envelope-seal { width: 18.75%; height: auto; aspect-ratio: 1; padding: 0; background: none; box-shadow: none; border-radius: 50%; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); }
.envelope-seal img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.envelope-scene:has(.envelope-trigger:hover) .envelope-seal { box-shadow: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)) brightness(1.05); }

/* Aba do envelope, numa só peça (versão definitiva, 2026-11-05).
   - Sobe para nós: perspetiva mais forte e olho ligeiramente abaixo do centro, por isso a ponta cresce ao levantar.
   - Face de fora com um brilho que passa enquanto sobe; face de dentro mais clara, com fio champagne, para a aba aberta se ver sobre o fundo escuro.
   - Sombra no envelope que acompanha a aba (forte a meio, suave no fim). Interior do envelope mais fundo. */
@property --shade { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --sheen { syntax: '<number>'; inherits: true; initial-value: -0.4; }
.envelope-scene { perspective: 560px; perspective-origin: 50% 80%; }
.envelope-back::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, #0b0f19 0, #121726 32%, rgba(18, 23, 38, 0) 66%); pointer-events: none; }
.envelope-flap { transform-origin: 50% 0; }
.envelope-flap > span { display: none; }
.envelope-flap .fx, .envelope-flap .fi { position: absolute; inset: 0; display: block; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.envelope-flap .fx { clip-path: polygon(0 0, 100% 0, 50% 100%); background: linear-gradient(162deg, #3d465b 0%, #313a4e 46%, #2a3143 100%); }
.envelope-flap .fx::before { content: ""; position: absolute; inset: 0; background: #05070d; opacity: calc(var(--shade) * .6); }
.envelope-flap .fx::after { content: ""; position: absolute; inset: -20% -40%;
  background: linear-gradient(100deg, transparent calc(var(--sheen) * 100%), rgba(236, 230, 214, .16) calc((var(--sheen) + .12) * 100%), transparent calc((var(--sheen) + .26) * 100%)); }
.envelope-flap .fi { transform: rotateX(180deg); clip-path: polygon(0 100%, 100% 100%, 50% 0); background: linear-gradient(0deg, #2c3447 0%, #3a4359 55%, #46506a 100%); }
.envelope-flap .fi::before { content: ""; position: absolute; inset: 0; background: #05070d; opacity: calc(var(--shade) * .5); }
.envelope-flap .fi::after { content: ""; position: absolute; inset: 0; background: #d4b886; opacity: .32; clip-path: polygon(0 100%, 3.2% 100%, 50% 4.5%, 96.8% 100%, 100% 100%, 50% 0); }
.flap-shadow { position: absolute; z-index: 5; left: 0; right: 0; top: 0; height: 74%; pointer-events: none; opacity: 0;
  background: radial-gradient(120% 70% at 50% 0%, rgba(4, 6, 12, .75), rgba(4, 6, 12, 0) 70%); }

/* Realismo: papel com grão, sombra da boca do envelope sobre o voucher, brilho que passa na capa ao virar. */
@property --ls { syntax: '<number>'; inherits: true; initial-value: -0.5; }
.envelope-scene { --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.paper-grain { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: var(--noise); background-size: 180px; opacity: .17; mix-blend-mode: soft-light; clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%); }
.pocket-shadow { position: absolute; z-index: 3; left: 0; right: 0; top: 0; height: 50%; pointer-events: none; background: linear-gradient(to bottom, rgba(2, 4, 9, 0) 4%, rgba(2, 4, 9, .62) 100%); clip-path: polygon(0 0, 50% 96%, 100% 0); }
.letter::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--noise); background-size: 150px; opacity: .13; mix-blend-mode: soft-light; }
.letter .lt-sheen { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent calc(var(--ls) * 100%), rgba(255, 255, 255, .17) calc((var(--ls) + .13) * 100%), transparent calc((var(--ls) + .3) * 100%)); }
.cover-front > .letter { --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.envelope-back { background-image: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(0, 0, 0, .06)); }
.envelope-folds { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }

/* Página 02: o que inclui e como decorre o ritual (textos das páginas de ritual do site) */
.ritual-more { border-top: 1px solid #22263320; padding-top: 20px; margin-bottom: 22px; }
.ritual-more .eyebrow { display: block; color: #5a564c; font-size: 11px; margin: 0 0 9px; }
.ritual-more .eyebrow:not(:first-child) { margin-top: 20px; }
.ritual-includes, .ritual-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.ritual-includes li, .ritual-steps li { position: relative; padding-left: 20px; font-size: 13px; line-height: 1.7; color: #5e5b52; }
.ritual-includes li::before { content: ""; position: absolute; left: 0; top: .85em; width: 11px; height: 1px; background: #8a6f3a; }
.ritual-steps { counter-reset: passo; }
.ritual-steps li { counter-increment: passo; }
.ritual-steps li::before { content: counter(passo); position: absolute; left: 0; top: 0; font: 400 15px/1.55 var(--display); color: #8a6f3a; }
.ritual-includes strong, .ritual-steps strong { font-weight: 600; color: #222633; }

/* Página 01: o texto fica centrado na altura da página e, sem mensagem pessoal, ganha escala e o lótus por baixo */
.gift-center { flex: 1; display: flex; flex-direction: column; justify-content: safe center; min-height: 0; overflow-y: auto; }
.gift-center .gift-lotus { display: none; }
.gift-center:has([data-message-section][hidden]) { align-items: center; text-align: center; }
.gift-center:has([data-message-section][hidden]) h1 { font-size: clamp(44px, 4.6vw, 64px); margin-bottom: 30px; }
.gift-center:has([data-message-section][hidden]) .gift-dedication { font-size: 17px; line-height: 1.8; max-width: 24em; margin-bottom: 22px; }
.gift-center:has([data-message-section][hidden]) .page-invitation { font-size: 14px; color: #726d63; margin-bottom: 38px; }
.gift-center:has([data-message-section][hidden]) .gift-lotus { display: block; width: 72px; height: auto; opacity: .85; }
@media (max-width: 700px) { .gift-center:has([data-message-section][hidden]) h1 { font-size: 46px; } }

/* Telemóvel: o livro inteiro cabe no ecrã (cada página fica mais compacta, a foto encolhe com a altura do ecrã) */
@media (max-width: 700px) {
  .photo-art { height: calc(var(--book-page-height, 560px) * .35); flex: 0 0 auto; }
  .photo-art .art-title { font-size: 32px; padding: 0 24px 22px; }
  .photo-art .art-eyebrow { top: 18px; left: 22px; }
  .chapter-content { min-height: 0; padding: 20px 24px 16px; }
  .chapter-content .paper-top { margin-bottom: 14px; }
  .chapter-content h1, .chapter-content h2 { font-size: 31px; margin-bottom: 14px; }
  .chapter-content .ritual-description { font-size: 12.5px; line-height: 1.7; margin-bottom: 16px; }
  .ritual-more { padding-top: 14px; margin-bottom: 14px; }
  .ritual-includes li { font-size: 12.5px; line-height: 1.55; }
  .chapter-content .paper-foot { padding-top: 12px; }
  .chapter-content h3 { font-size: 15px; }
  .chapter-content ol li p, .chapter-content ol li div p { font-size: 12.5px; line-height: 1.55; }
  .booking-steps { gap: 10px; margin-bottom: 12px; }
  .booking-steps li { gap: 12px; padding: 0; }
  .booking-steps h3 { margin: 0 0 2px; font-size: 14.5px; }
  .booking-steps p { font-size: 12px; line-height: 1.5; margin: 0; }
  .chapter-content .booking-meta { margin: 12px 0 12px; }
  .chapter-content .chapter-help { margin: 12px 0 16px; }
  .chapter-booking-button { padding-block: 13px; }
}

/* Ecrã de início no telemóvel: conteúdo centrado na altura (sem vazio em baixo) e seta desenhada (no iPhone o carácter ↗ vira emoji) */
.open-arrow { display: inline-block; vertical-align: -1px; margin-left: 10px; }
@media (max-width: 700px) {
  .invitation { justify-content: safe center; }
  .invitation-copy { margin-top: clamp(18px, 3.5vh, 34px); }
  .envelope-scene { margin-top: clamp(22px, 4vh, 38px); }
}

/* Cabe no ecrã: a página de marcação mais compacta, o livro encolhe o conteúdo (zoom) se a janela for baixa, e o envelope do ecrã inicial acompanha a altura */
.booking-steps { margin-bottom: 14px; }
.booking-steps li { gap: 14px; margin-bottom: 12px; }
.booking-steps h3 { font-size: 18px; margin-bottom: 3px; }
.booking-steps p { font-size: 12.5px; line-height: 1.6; }
.booking-meta { margin: 2px 0 16px; padding-top: 12px; }
.chapter-content .chapter-help { margin: 12px 0 18px; }
.chapter-content { zoom: var(--fit, 1); }
/* Escala uniforme no portátil: o painel da capa/foto também encolhe, como o livro. */
@media (min-width: 701px) { .chapter-art { zoom: var(--fit, 1); } }
@media (min-width: 701px) {
  .envelope-scene { width: clamp(300px, calc((100svh - 490px) * 1.3333), 530px); margin-top: clamp(24px, 4vh, 60px); }
}
/* Portátil com janela baixa (cerca de 600 a 900 px de altura útil): o resto do ecrã encolhe para o envelope ficar grande, sem barra de rolagem e sem deformar (a proporção 160:120 mantém-se). */
@media (min-width: 701px) and (max-height: 900px) {
  .invitation { padding-top: 26px; padding-bottom: 16px; }
  .invitation-copy { margin-top: 10px; }
  .invitation-copy #invitation-title { font-size: 38px; line-height: 1.1; }
  .invitation-copy p:last-child { font-size: 12.5px; line-height: 1.45; }
  .envelope-scene { width: clamp(320px, calc((100svh - 350px) * 1.3333), 530px); margin-top: 14px; margin-bottom: 10px; }
  .invitation-actions { margin-top: 4px; }
}

/* Auditoria de movimento (2026-11-06) */
.gift-paper.is-unwrapping { perspective: 3600px; }
@keyframes env-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .invitation .envelope { animation: none !important; } }
.invitation-actions p { font-size: 12px; color: #aeb1bc; }
.book-gesture-cue, .mobile-leaf-hint { min-height: 1.5em; display: flex; align-items: center; justify-content: center; text-align: center; }
.leaf-face, .curl-slice { -webkit-backface-visibility: hidden; backface-visibility: hidden; outline: 1px solid transparent; }
@media (max-width: 700px) {
  .photo-art .art-eyebrow { display: none; }
  .gift-book.is-cover-turn { overflow: clip; }
}

@media (max-width: 700px) {
  .recipient-view { padding-top: 28px; }
  .book-gesture-cue { margin-bottom: 10px; font-size: 11px; }
  .book-pagination { padding-top: 8px; padding-bottom: 10px; }
}

/* Desktop: sem altura mínima fixa (o livro mede-se pelo conteúdo) e janelas baixas ganham espaço em cima e em baixo */
@media (min-width: 701px) {
  .book-spread { min-height: var(--book-page-height, 0px); }
}
@media (min-width: 701px) and (max-height: 900px) {
  .recipient-view { padding-top: 30px; }
  .book-gesture-cue { margin-bottom: 10px; }
  .book-pagination { padding-top: 10px; padding-bottom: 12px; }
}

/* Sombra da capa a abrir por overlay (um filter numa camada 3D gera bandas) e título legível sobre as fotos */
.cover-front { position: relative; }
.cover-shade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; display: block; }
.opening-cover { will-change: transform; }
.photo-art .art-title { text-shadow: 0 1px 14px rgba(0, 0, 0, .55); }

/* Último ecrã: as ações finais cabem sem a paginação (a viragem para trás continua por arrasto/teclado) e as tiras da folha não deixam ver o fundo creme */
@media (min-width: 701px) and (max-height: 900px) {
  .recipient-view:has(.book-ending-actions:not([hidden])) .book-pagination { display: none; }
  .book-ending-actions { padding: 8px 0 14px; }
}
.curl-slice .leaf-face { background: transparent; }

/* Capa final mais compacta (era a página mais alta e empurrava as ações para fora do ecrã) */
.closing-cover-content { padding: 36px 26px; }
.closing-cover h2 { margin: 26px 0 12px; font-size: clamp(32px, 3.1vw, 44px); }
.closing-cover .closing-lotus { width: 92px; }
.closing-cover .closing-location { margin-top: 28px; }

/* Telemóvel, último ecrã: sem paginação e com as ações compactas, para tudo caber no ecrã */
@media (max-width: 700px) {
  .recipient-view:has(.book-ending-actions:not([hidden])) .book-pagination { display: none; }
  .book-ending-actions { padding: 6px 0 8px; }
  .ending-booking { padding: 8px; }
  .ending-utilities { margin-top: 2px; gap: 18px; }
}

.gift-book.is-cover-turn { perspective: 3200px; }
.envelope-seal { transition: none; }

/* Telemóvel: a capa final assenta (inclina e ganha sombras) com transição em vez de saltar */
@media (max-width: 700px) {
  .gift-book > .closing-cover { transition: transform .4s ease, box-shadow .4s ease; }
}

/* iPhone (WebKit): a frente do envelope fica explicitamente à frente do voucher no espaço 3D (o z-index sozinho não chega com preserve-3d) */
.pocket-shadow, .envelope-folds, .paper-grain, .envelope-address { transform: translateZ(2px); }
.envelope-seal { transform: translate(-50%, -50%) translateZ(6px); }
.envelope-flap { transform: translateZ(4px); }
.flap-shadow { transform: translateZ(3px); }

/* Capa atualizada (prova Norcópia aprovada, 2026-11-10): fundo Overlay #1F2433, moldura, fio e assinatura em champagne. */
.letter { background: #1f2433; }
.letter::before { border-color: #d4b886; }
.letter .lt-brand { color: #d4b886; }
.letter .lt-para::before { content: ""; display: block; width: calc(var(--mm) * 12); height: max(1px, calc(var(--mm) * .4)); background: #d4b886; margin: 0 auto calc(var(--mm) * 4.7); }

/* Contracapa branca com faixa champagne, como no PDF da Norcópia (2026-11-16).
   Tudo em unidades da largura do próprio cartão (cqw), com as proporções medidas no PDF: o cartão pode ter qualquer tamanho e fica sempre igual. */
.book-spread.closing-cover { container-type: inline-size; background: #fff; color: #2d313c; box-shadow: inset 0 0 0 1px #e8e4d8, inset 8px 0 12px -12px #0003; }
.book-spread.closing-cover::before { inset: 6cqw 6cqw 6cqw 8cqw; border: 1px solid #2d313c1a; }
.book-spread.closing-cover::after { inset: 0 auto 0 3cqw; width: 2.3cqw; background: #d4b886; border: 0; box-shadow: none; }
.book-spread.closing-cover .closing-cover-content { padding: 12cqw 9cqw 12cqw 11cqw; }
.book-spread.closing-cover .closing-lotus { width: 21cqw; margin-bottom: 4cqw; }
.book-spread.closing-cover .closing-wordmark { font-size: 8.6cqw; letter-spacing: .02em; }
.book-spread.closing-cover .closing-wordmark span { font-size: max(8px, 2.1cqw); margin-top: 2.2cqw; letter-spacing: .26em; }
.book-spread.closing-cover h2 { font-size: 9cqw; line-height: 1.12; margin: 10cqw 0 3.4cqw; }
.book-spread.closing-cover p { font-size: max(10px, 3cqw); color: #4b4f5a; }
.book-spread.closing-cover .closing-location { font-size: max(8px, 2.1cqw); margin-top: 10cqw; letter-spacing: .24em; color: #5f6370; }
