/* "Apus la mare" (Components/Heroes/SeaHero.razor, SeaScene.razor), over site.css, the theme and layouts/envelope.css
   (whose script seals and opens it): the invitation's words on the sand under a sunset over the sea. In a browser, first
   the cover: the same scene painted over a whole envelope that fills the screen, its flap held by a wax seal with the
   hosts' monogram, the guest's name on the sand. The seal lifts the flap, the envelope slides away.
   Only the colours every theme names (--paper, --cream, --ink, --muted, --line, --gold, --green) and the invitation's
   fonts. What moves is moved by transform and opacity alone, and nothing that moves sits under a filter. */
.sea-hero{
  --sea-warm:var(--warm,var(--gold));
  --sea-sky-top:color-mix(in srgb,var(--sea-warm) 46%,color-mix(in srgb,var(--gold) 70%,var(--paper)));
  --sea-cloud:color-mix(in srgb,var(--sea-warm) 46%,transparent);
  --sea-sky-low:color-mix(in srgb,var(--gold) 30%,var(--paper));
  --sea-far:color-mix(in srgb,var(--green) 50%,color-mix(in srgb,var(--gold) 62%,var(--paper)));
  --sea-near:color-mix(in srgb,var(--green) 13%,color-mix(in srgb,var(--gold) 30%,var(--paper)));
  --sea-sand:color-mix(in srgb,var(--gold) 36%,var(--paper));
  --sea-sand-deep:color-mix(in srgb,var(--sea-warm) 16%,color-mix(in srgb,var(--gold) 56%,var(--paper)));
  --sea-hill:color-mix(in srgb,var(--ink) 34%,color-mix(in srgb,var(--gold) 60%,var(--paper)));
  --sea-hi:color-mix(in srgb,var(--paper) 80%,#fff);
  --sea-lo:color-mix(in srgb,var(--sea-warm) 36%,color-mix(in srgb,var(--gold) 52%,var(--paper)));
  --sea-line:color-mix(in srgb,var(--sea-warm) 62%,var(--gold));
  --sea-edge:color-mix(in srgb,var(--gold) 82%,var(--ink));
  --sea-wax:color-mix(in srgb,var(--gold) 72%,var(--sea-warm));
  --sea-wax-hi:color-mix(in srgb,var(--gold) 42%,#fff);
  --sea-wax-lo:color-mix(in srgb,var(--sea-warm) 72%,var(--ink));
  --sea-liner:color-mix(in srgb,var(--gold) 62%,var(--paper));
  /* where the sky ends and where the water ends, down the scene; how far down the cover the flap reaches */
  --sea-horizon:32%;--sea-shore:51%;--sea-flap:.57;
  padding:0;position:relative}
.sea-defs{position:absolute;width:0;height:0;overflow:hidden}
.sea-hi{stop-color:var(--sea-hi)}.sea-lo{stop-color:var(--sea-lo)}.sea-mid{stop-color:color-mix(in srgb,var(--sea-hi) 55%,var(--sea-lo))}

/* — the scene: sky, sun, a headland, the water with the sun's path on it, the wave on the sand — */
.sea-scene{position:absolute;inset:0 0 auto;height:100%;overflow:hidden;background:linear-gradient(var(--sea-sand) 50%,var(--sea-sand-deep))}
.sea-scene:after{content:'';position:absolute;inset:0;background:url(sea-grain.svg);mix-blend-mode:multiply;opacity:.55;pointer-events:none}
.sea-sky{position:absolute;inset:0 0 auto;height:var(--sea-horizon);background:
  radial-gradient(ellipse 30% 4.5% at 14% 38%,rgb(255 255 255 / .6),transparent),
  radial-gradient(ellipse 36% 4% at 84% 24%,rgb(255 255 255 / .5),transparent),
  radial-gradient(ellipse 20% 3% at 70% 55%,rgb(255 255 255 / .55),transparent),
  radial-gradient(ellipse 26% 3% at 30% 66%,rgb(255 255 255 / .45),transparent),
  radial-gradient(ellipse 44% 5% at 60% 12%,var(--sea-cloud),transparent),
  radial-gradient(ellipse 30% 4% at 8% 20%,var(--sea-cloud),transparent),
  radial-gradient(ellipse 24% 3% at 90% 46%,var(--sea-cloud),transparent),
  radial-gradient(ellipse 62% 70% at 50% 88%,rgb(255 255 255 / .8),rgb(255 255 255 / .45) 40%,transparent 74%),
  linear-gradient(var(--sea-sky-top),var(--sea-sky-low) 88%)}
.sea-sun{position:absolute;left:50%;top:calc(var(--sea-horizon)*.83);width:clamp(72px,22vmin,150px);aspect-ratio:1;translate:-50% -50%;border-radius:50%;
  background:radial-gradient(circle,#fff 0 43%,color-mix(in srgb,var(--sea-sky-low) 55%,#fff) 46%,rgb(255 255 255 / .35) 56%,rgb(255 255 255 / 0) 72%);animation:sea-sun 7s ease-in-out infinite alternate}
.sea-headland{position:absolute;right:0;bottom:calc(100% - var(--sea-horizon) - 1px);width:min(46%,340px);aspect-ratio:5}
.sea-headland path{fill:var(--sea-hill)}.sea-headland .far{opacity:.45}
.sea-water{position:absolute;left:0;right:0;top:var(--sea-horizon);height:calc(var(--sea-shore) - var(--sea-horizon) + 3%);overflow:hidden;
  background:linear-gradient(var(--sea-far),var(--sea-near) 82%)}
.sea-water:before{content:'';position:absolute;inset:0;background:radial-gradient(ellipse 34% 120% at 50% 0,rgb(255 255 255 / .78),rgb(255 255 255 / .3) 55%,transparent),linear-gradient(rgb(255 255 255 / .22),transparent 18%)}
.sea-ripples{position:absolute;inset:0 auto 0 0;width:200%;height:100%;animation:sea-drift 38s linear infinite}
.sea-ripples path{fill:none;stroke:#fff}
.sea-breakers{position:absolute;inset:0 0 0 auto;width:200%;height:100%;animation:sea-drift 30s linear infinite reverse}
.sea-breakers path{fill:none}.sea-breakers .shade{stroke:var(--sea-far);stroke-opacity:.5}.sea-breakers .crest{stroke:#fff;stroke-opacity:.82}
.sea-glitter{position:absolute;inset:0;width:100%;height:100%}
.sea-glitter rect{fill:#fff}
.sea-glitter .a{animation:sea-glint 2.6s ease-in-out infinite alternate}
.sea-glitter .b{animation:sea-glint 3.4s -1.2s ease-in-out infinite alternate-reverse}
.sea-shoreline,.sea-wash{position:absolute;left:-2%;width:104%;top:calc(var(--sea-shore) - 3.2%);height:9%}
.sea-shoreline .wet{fill:color-mix(in srgb,var(--sea-sand-deep) 82%,var(--sea-far))}
.sea-shoreline .beach{fill:var(--sea-sand)}
.sea-wash{animation:sea-laps 6.5s ease-in-out infinite}
.sea-wash .sheet{fill:var(--sea-near);opacity:.62}
.sea-wash .foam{fill:#fff;opacity:.92}
@keyframes sea-sun{to{scale:1.06;opacity:.92}}
@keyframes sea-drift{to{transform:translateX(-50%)}}
@keyframes sea-glint{from{opacity:.28}to{opacity:.95}}
@keyframes sea-laps{0%,100%{transform:translateY(-24%);opacity:.75}55%{transform:translateY(14%);opacity:1}}

/* — the relief at the corners: pampas plumes that sway, a shell, flowers, pearls — */
.sea-flora{position:absolute;bottom:0;pointer-events:none}
.sea-flora svg{display:block;width:100%;height:auto;overflow:visible;filter:drop-shadow(3px 7px 6px rgb(0 0 0 / .3))}
.sea-flora .plumes{transform-origin:24% 100%;animation:sea-sways 7s ease-in-out infinite alternate}
.sea-flora .shells{position:absolute;inset:0;animation:none}
.sea-flora.right{right:0;transform:scaleX(-1)}
.sea-flora.left{left:0}
.sea-flora.right .plumes{animation-delay:-3s;animation-duration:8.5s}
.sea-lobe,.sea-rib,.sea-petal{fill:url(#sea-relief);stroke:var(--sea-line);stroke-width:.6;stroke-opacity:.7}
.sea-rib{fill:url(#sea-relief-rib);stroke-width:1.1;stroke-opacity:.9}
.sea-petal{fill:url(#sea-relief-petal)}
.sea-stem{fill:none;stroke:var(--sea-line);stroke-width:3.4;stroke-linecap:round}.sea-stem.thin{stroke-width:1.8}
.sea-petal.under{fill:var(--sea-lo);stroke:none;opacity:.75}
.sea-heart{fill:var(--sea-wax)}.sea-bead{fill:var(--sea-wax-hi)}
.sea-pearl{fill:url(#sea-relief-petal);stroke:var(--sea-line);stroke-width:.6;stroke-opacity:.7}
@keyframes sea-sways{from{transform:rotate(-1.4deg)}to{transform:rotate(1.6deg)}}

/* — the invitation, open: the scene across the top, the words on the sand — */
.sea-cover{display:none}
/* the sand goes on under the scene and pales into the page a little further down, so the scene has no lower edge */
.sea-open{--sea-view:clamp(300px,56svh,560px);position:relative;background:linear-gradient(var(--sea-sand) var(--sea-view),var(--cream) calc(var(--sea-view) + 380px))}
.sea-view{position:relative;height:var(--sea-view);--sea-horizon:50%;--sea-shore:80%;overflow:hidden;-webkit-mask-image:linear-gradient(#000 84%,transparent);mask-image:linear-gradient(#000 84%,transparent)}
.sea-view .sea-scene{background:var(--sea-sand)}
.sea-view .sea-flora{width:clamp(110px,27vw,250px);bottom:-2%}
.sea-open .hero-content{max-width:890px;margin:0 auto;padding:34px 40px 84px}
.sea-open .hero-content h1{font-family:var(--script);font-style:normal;letter-spacing:0;font-weight:400;line-height:1.25;word-spacing:.12em;padding:0 .1em}
.sea-open .personal-greeting{margin-top:22px;color:var(--ink)}
.sea-open .eyebrow,.sea-open .ornament{color:var(--sea-edge)}
.sea-open .ornament:before,.sea-open .ornament:after{background:var(--sea-edge)}
:is(:lang(zh),:lang(ja),:lang(el)) .sea-open .hero-content h1{font-family:var(--serif);font-style:italic}
.sea-hero.just-opened .sea-view .sea-scene{animation:sea-settles 1.6s cubic-bezier(.2,.7,.2,1) both}
.sea-hero.just-opened .hero-content{animation:sea-words 1s .45s cubic-bezier(.2,.7,.2,1) both}
@keyframes sea-settles{from{transform:scale(1.12)}}
@keyframes sea-words{from{opacity:0;transform:translateY(26px)}}

/* — sealed (layouts/envelope.js): the cover alone, as tall as the screen under whatever bar stands above it — */
html[data-sealed] main.invitation-page{display:flex;flex-direction:column;min-height:100svh}
html[data-sealed] .sea-hero{display:block;flex:1;min-height:0;padding:0}
html[data-sealed] .sea-open{display:none}
html[data-sealed] .sea-cover,.sea-hero.just-opened .sea-cover{display:block;position:absolute;inset:0;overflow:hidden;perspective:1500px;perspective-origin:50% 12%;background:var(--sea-liner)}
/* what the lifted flap shows: the lining, and the letter's top in the pocket */
.sea-inside{position:absolute;inset:0;background:
  radial-gradient(circle at 50% 100%,transparent 0 9px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 9px 10px,transparent 10px 15px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 15px 16px,transparent 16px 21px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 21px 22px,transparent 22px) 0 0/44px 22px,
  radial-gradient(circle at 50% 100%,transparent 0 9px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 9px 10px,transparent 10px 15px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 15px 16px,transparent 16px 21px,color-mix(in srgb,var(--sea-liner) 76%,var(--ink)) 21px 22px,transparent 22px) 22px 11px/44px 22px,
  linear-gradient(color-mix(in srgb,var(--sea-liner) 84%,var(--ink)),var(--sea-liner) 46%)}
.sea-peek{position:absolute;left:8%;right:8%;top:9%;bottom:0;border-radius:10px 10px 0 0;background:var(--paper);box-shadow:0 -6px 22px rgb(0 0 0 / .22);display:grid;justify-items:center;align-content:start;padding-top:clamp(18px,5svh,44px)}
.sea-peek:before{content:'';position:absolute;inset:9px 9px 0;border:1px solid var(--sea-lo);border-bottom:0;border-radius:5px 5px 0 0}
.sea-peek span{font-family:var(--script);font-size:clamp(28px,8vw,46px);color:var(--ink);word-spacing:.12em}
.sea-body{position:absolute;inset:0;clip-path:polygon(0 14%,50% 45%,100% 14%,100% 100%,0 100%)}
.sea-pocket{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.sea-pocket .shade{fill:none;stroke:rgb(0 0 0 / .22);stroke-width:9;vector-effect:non-scaling-stroke}
.sea-pocket .rim{fill:none;stroke:var(--sea-hi);stroke-width:1.5;vector-effect:non-scaling-stroke}
/* the plumes stay under the guest's name: on an upright screen as tall as the sand left below it, on a wide one as the width allows */
.sea-cover .sea-flora{width:max(120px,min(50vw,33svh - 80px))}.sea-cover .sea-flora.right{width:max(108px,min(45vw,30svh - 72px))}
@media (min-aspect-ratio:1/1){.sea-cover .sea-flora{width:min(430px,34vw,58svh)}.sea-cover .sea-flora.right{width:min(390px,31vw,52svh)}}
/* the guest's name on the sand and the hint under it */
.sea-address{position:absolute;z-index:3;left:6%;right:6%;top:calc(var(--sea-flap)*100% + clamp(44px,12.5vmin,72px));text-align:center}
.sea-to{margin:0;font-family:var(--script);
  font-size:clamp(27px,7.4vw,42px);line-height:1.15;word-spacing:.16em;color:var(--ink);overflow-wrap:anywhere;text-shadow:0 1px 0 rgb(255 255 255 / .6)}
.sea-hint{margin:12px 0 0;font-size:11px;letter-spacing:2.6px;text-transform:uppercase;color:var(--ink);animation:sea-hint 2.6s ease-in-out infinite alternate}
:is(:lang(zh),:lang(ja)) .sea-hint{letter-spacing:1px;font-size:12px}
@keyframes sea-hint{from{opacity:.55}}
/* the flap: the scene goes on across it; a shadow under its edge, a light line along it */
.sea-flap-shadow{position:absolute;z-index:1;inset:0 0 auto;height:calc(var(--sea-flap)*100%);filter:blur(10px);opacity:.5;transform:translateY(12px);transition:opacity .5s}
.sea-flap-shadow i{position:absolute;inset:0;background:color-mix(in srgb,var(--ink) 60%,#000);clip-path:url(#sea-flap-shape)}
.sea-hero .sea-flap{position:absolute;z-index:2;inset:0 0 auto;height:calc(var(--sea-flap)*100%);background:none;clip-path:none;filter:none;border-radius:0;transform-origin:50% 0;will-change:transform}
.sea-flap-cut{position:absolute;inset:0;clip-path:url(#sea-flap-shape)}
.sea-flap-cut .sea-scene{height:calc(100%/var(--sea-flap))}
.sea-flap-cut:before{content:'';position:absolute;z-index:1;inset:0;background:linear-gradient(rgb(255 255 255 / 0) 45%,rgb(255 255 255 / .2))}
.sea-flap-cut:after{content:'';position:absolute;z-index:1;inset:0;background:linear-gradient(transparent 30%,rgb(0 0 0 / .5));opacity:0}
.sea-flap-edge{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
.sea-flap-edge path{fill:none;vector-effect:non-scaling-stroke}
.sea-flap-edge .dark{stroke:color-mix(in srgb,var(--sea-edge) 70%,transparent);stroke-width:3.5}
.sea-flap-edge .light{stroke:rgb(255 255 255 / .85);stroke-width:1.4}
/* the wax seal, pressed with the monogram: the button that opens the invitation */
.sea-seal{position:absolute;z-index:4;left:50%;top:100%;width:clamp(92px,27vmin,138px);aspect-ratio:1;translate:-50% -64%;border:0;padding:0;cursor:pointer;color:var(--sea-wax-hi);
  border-radius:47% 53% 52% 48%/52% 47% 53% 48%;
  background:radial-gradient(circle at 30% 24%,var(--sea-wax-hi) 0,var(--sea-wax) 46%,var(--sea-wax-lo) 100%);
  box-shadow:0 12px 20px rgb(0 0 0 / .3),0 3px 4px rgb(0 0 0 / .28),inset 0 3px 3px rgb(255 255 255 / .55),inset 0 -5px 8px rgb(0 0 0 / .28);
  display:grid;place-items:center;transition:scale .25s}
.sea-seal[hidden]{display:none}
.sea-seal:before{content:'';position:absolute;inset:13%;border-radius:50%;
  background:radial-gradient(circle at 66% 72%,var(--sea-wax-hi) 0,var(--sea-wax) 58%,var(--sea-wax-lo) 100%);
  box-shadow:inset 0 4px 6px rgb(0 0 0 / .38),inset 0 -2px 3px rgb(255 255 255 / .4),0 1px 1px rgb(255 255 255 / .45),0 -1px 1px rgb(0 0 0 / .2)}
.sea-seal:after{content:'';position:absolute;inset:-4%;border-radius:50%;border:2px solid #fff;opacity:0;animation:sea-calls 2.8s ease-out infinite}
.sea-seal:hover{scale:1.04}
.sea-seal:focus-visible{outline:3px solid var(--ink);outline-offset:6px}
.sea-seal-mark{position:relative;font-family:var(--serif);font-style:italic;font-size:clamp(19px,6vmin,31px);letter-spacing:-.5px;white-space:nowrap;
  text-shadow:0 -1px 0 rgb(255 255 255 / .55),0 2px 2px rgb(0 0 0 / .4)}
.sea-seal-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@keyframes sea-calls{0%{opacity:.75;scale:1}70%,100%{opacity:0;scale:1.5}}

/* — opening: the seal is pressed, the flap lifts with it, then (just-opened) the envelope slides down off the letter.
   The script takes the flap's animationend for the end of the opening, and a child's would bubble up to it: nothing inside
   the flap starts an animation that ends (the seal is pressed by a transition). — */
html[data-sealed=opening] .sea-seal{scale:.93;transition:scale .2s ease-out}
html[data-sealed=opening] .sea-seal:after{animation:none}
html[data-sealed=opening] .sea-hero .sea-flap{animation:sea-flap-lifts .85s .22s cubic-bezier(.55,0,.6,1) forwards}
html[data-sealed=opening] .sea-flap-cut:after{transition:opacity .7s .25s;opacity:1}
html[data-sealed=opening] .sea-flap-shadow{opacity:0}
html[data-sealed=opening] .sea-address{transition:opacity .4s;opacity:0}
@keyframes sea-flap-lifts{to{transform:rotateX(96deg)}}
.sea-hero.just-opened .sea-cover{position:fixed;z-index:60;pointer-events:none;background:none;animation:sea-cover-leaves 1.05s .12s cubic-bezier(.6,0,.35,1) forwards}
.sea-hero.just-opened :is(.sea-flap,.sea-flap-shadow,.sea-address){display:none}
/* gone at the end in every engine: WebKit keeps a filled animation's last frame visible, so it ends clear as well */
@keyframes sea-cover-leaves{99%{opacity:1}to{transform:translateY(102%);opacity:0;visibility:hidden}}

@media (max-width:700px){
  .sea-open .hero-content{padding:22px 18px 64px}
  .sea-open .hero-content h1{font-size:clamp(46px,14vw,60px);margin-top:18px}
}
@media (prefers-reduced-motion:reduce){.sea-hero *,.sea-hero *:before,.sea-hero *:after{animation:none!important}}

/* — paper and the PDF: the scene, still, over the words — */
@media print{
  .sea-cover{display:none!important}
  .sea-hero{padding:0;justify-content:flex-start}
  .sea-open{background:none;width:100%}
  .sea-view{height:92mm;-webkit-mask-image:none;mask-image:none;print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .sea-hero *{animation:none!important}
  /* a PDF draws the paper's grain and the relief's shadows as pictures (2.6 MB more in an emailed invitation): left out */
  .sea-scene:after{display:none}
  .sea-flora svg{filter:none}
  .sea-open .hero-content{padding:8mm 10mm 0}
}
