/* =====================================================================
   TRITEJO — EFFECTS EDITION (temporary layer)
   Loaded only by `python build.py --fx` (output: ../site-fx/). The base
   site never sees this file. Everything is scoped to html.fx and to
   prefers-reduced-motion: no-preference, so reduced-motion visitors get
   the plain base site.
   Ideas adapted from the Awwwards pack in /testes:
     intro TRI·TEJO   → Hero Animations 1 (word with a growing image)
     river wipe       → SVG Animations 1 (shape overlays)
     tagline window   → Scroll Animation 10 (image grows from the text)
     footer links     → Hover Effects 2 (text dispersion)
   ===================================================================== */

@media (prefers-reduced-motion: no-preference){

  /* ---- hand the base CSS reveals over to GSAP (avoid double animation) ---- */
  html.fx-js .title,html.fx-js .hero .lead,html.fx-js .hero .acts,html.fx-js .hints{animation:none}
  html.fx-js :is(.shead,.rev-head,.cards li,.tile,.exp .fig){animation:none}
  html.fx-js .tag-text .w{animation:none}

  /* hold the hero copy until GSAP takes it (avoids a flash of the final state) */
  html.fx-js:not(.fx-ready) :is(.hero .title,.hero .lead,.hero .acts,.hints){visibility:hidden}

  /* ---- first paint covers: the intro and the river wipe start already covered ---- */
  html.fx-intro{overflow:hidden}           /* html only: overflow on body would make body its own scroller */
  html:is(.fx-intro,.fx-wave-in) body::after{content:"";position:fixed;inset:0;z-index:190;background:var(--pearl)}
  html.fx-wave-in body::after{background:var(--navy)}
  html.fx-covered body::after{display:none}

  /* ---- intro: TRI [window] TEJO ---- */
  .fx-open{position:fixed;inset:0;z-index:200;display:grid;place-items:center;background:var(--pearl);overflow:clip;pointer-events:none}
  .fx-open .word{display:flex;align-items:center;font:800 clamp(84px,19vw,300px)/.78 "Saira Condensed",sans-serif;text-transform:uppercase;color:var(--navy);letter-spacing:-.01em;white-space:nowrap}
  .fx-open .half{display:flex;overflow:clip;padding-block:.06em}
  .fx-open .l{display:block}
  .fx-open .win{position:relative;width:0;height:.74em;overflow:clip;margin-inline:.04em;background:var(--night)}
  .fx-open .win img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
  .fx-open .full{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 58%;clip-path:inset(50% 50% 50% 50%)}
  .fx-open .shade{position:absolute;inset:0;opacity:0;background:      /* same veil as .hero::before, so the hand-off is seamless */
    linear-gradient(90deg,rgb(10 15 42 / .86),rgb(10 15 42 / .22) 62%,rgb(10 15 42 / .08)),
    linear-gradient(180deg,rgb(10 15 42 / .55),transparent 26%,transparent 50%,rgb(10 15 42 / .9) 92%)}
  html.fx-intro .voyage{visibility:hidden}
  .fx-open .cap{position:absolute;left:50%;bottom:clamp(28px,6vh,64px);translate:-50% 0;font:400 clamp(28px,3.2vw,44px)/1 "Allura",cursive;color:var(--blue);white-space:nowrap}
  .fx-skip{position:fixed;right:20px;bottom:20px;z-index:201;padding:10px 16px;border:1.5px solid var(--navy);background:transparent;color:var(--navy);cursor:pointer;
    font:700 13px/16px "Saira Condensed",sans-serif;text-transform:uppercase;letter-spacing:.08em;transition:background-color .3s var(--ease),color .3s var(--ease)}
  .fx-skip:hover{background:var(--navy);color:#fff}
  .fx-skip:focus-visible{outline:2px solid var(--blue);outline-offset:3px}

  /* ---- river wipe between pages ---- */
  .fx-wipe{position:fixed;inset:0;z-index:180;width:100%;height:100%;pointer-events:none;visibility:hidden}
  .fx-wipe.on{visibility:visible;pointer-events:auto}
  .fx-wipe-mark{position:fixed;left:50%;top:50%;z-index:181;width:54px;height:67px;translate:-50% -50%;color:#fff;opacity:0;pointer-events:none}

  /* ---- living wave edge on dark bands (amplitude follows scroll speed: a boat wake) ---- */
  .fx-edge{position:absolute;left:0;right:0;top:-1px;width:100%;height:clamp(36px,5vw,72px);z-index:3;pointer-events:none;display:block}

  /* ---- tagline v3 "waterline" (current): WebGL water on the Almourol dusk photo, see fx.js 7b ---- */
  .tagline.fx-wl{padding:0;position:relative}
  .fx-wl .fx-pin{position:relative;height:100svh;overflow:clip;background:var(--night)}
  .fx-wl .fx-still,.fx-wl canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
  .fx-wl .fx-still{object-fit:cover;object-position:50% 45%;filter:brightness(.86)}
  .fx-wl canvas{opacity:0;transition:opacity .6s var(--ease);touch-action:pan-y;cursor:crosshair}
  .fx-wl.gl-on canvas{opacity:1}
  .fx-wl :is(.fx-txt,.fx-hint,.fx-line){position:absolute;left:0;right:0;z-index:3;text-align:center;padding-inline:var(--pad);pointer-events:none;color:#fff}
  .fx-wl .fx-txt{display:none;top:50%;translate:0 -100%;color:var(--pearl);
    font:800 clamp(48px,7vw,130px)/.9 "Saira Condensed",sans-serif;text-transform:uppercase;text-wrap:balance;text-shadow:0 2px 30px rgb(10 15 42 / .55)}
  .fx-wl.gl-fail .fx-txt{display:block}
  .fx-wl .fx-hint{bottom:5svh;opacity:.75;font:600 13px/16px "Saira Condensed",sans-serif;text-transform:uppercase;letter-spacing:.16em}
  .fx-wl.gl-fail .fx-hint{display:none}
  .fx-wl .fx-line{bottom:12svh;opacity:0;font:400 clamp(40px,5.4vw,84px)/1 "Allura",cursive;text-shadow:0 2px 24px rgb(0 0 0 / .6)}
  @media (max-width:700px){ .fx-wl .fx-still{object-position:45% 50%} }

  /* ---- (v2, unused) tagline: the river inside the letters, then through the "O" ---- */
  .tagline.fx-river{padding:0;position:relative}
  .fx-river .fx-pin{position:relative;height:100svh;overflow:clip;isolation:isolate;background:var(--night)}
  .fx-river .fx-rv{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:62% 60%}
  .fx-river .fx-tint{position:absolute;inset:0;background:rgb(10 15 42 / .5)}
  .fx-river .fx-shade{position:absolute;inset:0;opacity:0;background:linear-gradient(180deg,transparent 45%,rgb(10 15 42 / .7))}
  .fx-river .fx-knock{position:absolute;inset:0;display:grid;place-items:center;padding-inline:var(--pad);background:var(--pearl);mix-blend-mode:screen;will-change:transform}
  .fx-river .fx-big{font:800 clamp(58px,10.5vw,200px)/.86 "Saira Condensed",sans-serif;text-transform:uppercase;color:#000;text-align:center;letter-spacing:-.01em;text-wrap:balance}
  .fx-river .fx-line{position:absolute;left:0;right:0;bottom:14svh;z-index:3;text-align:center;color:#fff;opacity:0;padding-inline:var(--pad);
    font:400 clamp(44px,6vw,92px)/1 "Allura",cursive;text-shadow:0 2px 30px rgb(0 0 0 / .55)}
  @media (max-width:700px){
    .fx-river .fx-big br{display:none}
    .fx-river .fx-big{font-size:17vw;line-height:.88}
    .fx-river .fx-rv{object-position:86% 60%}      /* portrait screens: keep the castle (right of the frame) in view */
  }

  /* ---- (v1, unused) tagline: words light up, a window opens in the sentence, the photo takes the screen ---- */
  .tagline.fx-tag{padding:0;position:relative}
  .fx-tag .fx-pin{position:relative;height:100svh;display:grid;place-items:center;overflow:clip}
  .fx-tag .tag-text{position:relative;z-index:2}
  .fx-tag .tag-text .w{opacity:.22}
  .fx-tag .fx-win{display:inline-block;position:relative;width:0;height:.78em;vertical-align:-.06em;overflow:clip}   /* empty: the photo layer below shows through it */
  .fx-tag .fx-win img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
  .fx-tag .fx-full{position:absolute;inset:0;z-index:1;clip-path:inset(50% 50% 50% 50%);background:var(--night)}
  .fx-tag .fx-full img{width:100%;height:100%;object-fit:cover;scale:1.12}
  .fx-tag .fx-full::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgb(10 15 42 / .15),rgb(10 15 42 / .55))}
  .fx-tag .fx-line{position:absolute;left:0;right:0;bottom:12svh;z-index:3;text-align:center;color:#fff;opacity:0;
    font:400 clamp(44px,6vw,88px)/1 "Allura",cursive;text-shadow:0 2px 30px rgb(0 0 0 / .45)}

  /* ---- marquee band (speeds up and turns with the scroll) ---- */
  .fx-marquee{overflow:clip;contain:inline-size;min-width:0;max-width:100%;   /* contain: its max-content row must not widen <main> */
    padding:42px 0;background:var(--pearl);border-block:1px solid var(--line);user-select:none}
  .fx-marquee .row{display:flex;width:max-content;will-change:transform}
  .fx-marquee .set{display:flex;align-items:center;gap:.45em;padding-right:.45em;
    font:800 clamp(54px,8vw,120px)/1 "Saira Condensed",sans-serif;text-transform:uppercase;color:var(--navy);white-space:nowrap}
  .fx-marquee .row.ghost .set{color:transparent;-webkit-text-stroke:1.5px var(--navy)}
  .fx-marquee .row.ghost{margin-top:.08em}
  .fx-marquee .set .mark{width:.42em;height:.52em;color:var(--navy);flex:none}
  .fx-marquee .set em{font-style:normal;color:var(--blue)}
  .fx-marquee .row.ghost .set em{-webkit-text-stroke-color:var(--blue)}

  /* ---- headings: split into lines/words, each word rises out of its line ---- */
  /* clip only the bottom edge (words rise from below): sideways and upwards stay free, so long words and Ê/À are never cut */
  .fxline-mask,.fxchar-mask{overflow:visible !important;clip-path:inset(-.5em -100vw -.06em -100vw)}

  /* ---- buttons and menu links: the label rolls up on hover ---- */
  .fx-roll{display:inline-grid;overflow:clip;vertical-align:top;line-height:1.15}
  .fx-roll>span{grid-area:1/1;transition:translate .5s var(--ease)}
  .fx-roll>span+span{translate:0 110%}
  @media (hover:hover){
    :is(a,button):hover>.fx-roll>span:first-child{translate:0 -110%}
    :is(a,button):hover>.fx-roll>span+span{translate:0 0}
  }

}

/* without JS or with reduced motion nothing above applies, and nothing is left hidden */
@media (prefers-reduced-motion: reduce){
  .fx-open,.fx-skip,.fx-wipe,.fx-wipe-mark,.fx-edge,.fx-marquee{display:none !important}
}

/* =====================================================================
   PAPER RIVER (effects edition, homepage #viagem, markup in _fx/river.html, logic in river.js).
   Layout lives OUTSIDE the motion query: reduced-motion visitors get the same river, drawn whole.
   ===================================================================== */
.river{position:relative;padding:clamp(72px,10vw,140px) 0 clamp(64px,8vw,120px);background:var(--pearl);overflow:clip;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .3  0 0 0 0 .22  0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
.river .shead{margin-bottom:0}
.river .shead h2{max-width:15ch;margin-inline:auto;text-wrap:balance}
.river-map{--rw:118px;position:relative;max-width:1240px;margin:0 auto;padding:clamp(72px,8vw,120px) var(--pad)}
.river-svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:0}
.river-svg path{fill:none;stroke-linecap:round;stroke-linejoin:round}
.rv-reveal{stroke:#fff;stroke-width:calc(var(--rw) + 60px)}
.rv-shade{stroke:rgb(22 34 92 / .16);stroke-width:calc(var(--rw) + 14px);transform:translate(0,9px)}
.rv-edge{stroke:#FBF8F0;stroke-width:calc(var(--rw) + 14px)}                 /* the white cut edge of the paper */
.rv-water{stroke:#93ABE9;stroke-width:var(--rw)}
.rv-mid{stroke:#6E8CDD;stroke-width:calc(var(--rw) * .56);transform:translate(0,3px)}
.rv-light{stroke:#CBD7F6;stroke-width:calc(var(--rw) * .09);stroke-dasharray:26 58}
.rv-boat{position:absolute;left:0;top:0;z-index:1;width:clamp(54px,5vw,72px);height:auto;translate:-50% -70%;pointer-events:none;
  filter:drop-shadow(0 6px 4px rgb(22 34 92 / .25));will-change:transform;display:none}
.rv-live .rv-boat{display:block}
.stops{position:relative;z-index:2;list-style:none;margin:0;padding:0;display:grid;gap:clamp(64px,10vw,150px)}
.stop{display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:clamp(24px,5vw,80px)}
.stop:nth-child(even) .pop{order:2}
.pop{position:relative;isolation:isolate;margin:0;justify-self:center;width:min(100%,470px);--sh:1}
.rv-live .pop{--sh:0}
.pop::after{content:"";position:absolute;z-index:-1;left:8%;right:8%;bottom:1%;height:12%;opacity:var(--sh);
  background:radial-gradient(closest-side,rgb(22 34 92 / .32),transparent)}
.pop img{display:block;width:100%;height:auto;filter:drop-shadow(0 10px 10px rgb(22 34 92 / .18));backface-visibility:hidden}
.stop:nth-child(4) .pop{width:min(82%,380px)}                                 /* the buffet is portrait: keep it the same visual weight */
.rv-card{justify-self:start;max-width:420px;background:#FBF8F0;border:1px solid #E4DCCB;padding:clamp(20px,2.4vw,32px);
  box-shadow:0 2px 0 #E4DCCB,0 22px 44px -26px rgb(22 34 92 / .4)}
.stop:nth-child(even) .rv-card{justify-self:end}
.rv-no{display:block;font:700 15px/1 "Saira Condensed",sans-serif;letter-spacing:.1em;color:var(--blue)}
.rv-card .script{margin:8px 0 2px}
.rv-card h3{font:700 clamp(28px,3vw,40px)/1 "Saira Condensed",sans-serif;text-transform:uppercase;color:var(--navy)}
.rv-card p{color:var(--mut);margin:12px 0 0}
.rv-go{display:inline-block;margin-top:16px;padding-block:6px;font:700 15px/20px "Saira Condensed",sans-serif;text-transform:uppercase;letter-spacing:.05em;
  color:var(--blue);border-bottom:2px solid var(--gold);transition:color .3s var(--ease),border-color .3s var(--ease)}
.rv-go:hover{color:var(--navy);border-color:var(--blue)}
.river-end{position:relative;z-index:1;display:grid;justify-items:center;gap:20px;text-align:center;padding-inline:var(--pad)}
@media (max-width:760px){
  .river-map{--rw:70px}
  .stop{grid-template-columns:1fr;gap:16px}
  .stop .pop,.stop:nth-child(even) .pop{order:0;width:74%;justify-self:start}
  .stop:nth-child(even) .pop{justify-self:end}
  .stop:nth-child(4) .pop{width:58%}
  .rv-card{justify-self:end;width:68%;max-width:none;padding:18px 18px 16px}           /* narrow and on the far side from its piece: the river shows beside it */
  .stop:nth-child(even) .rv-card{justify-self:start}
  .rv-card .script{font-size:30px}
  .rv-card h3{font-size:26px}
  .rv-card p{font-size:15px;line-height:1.45}
}

/* ---- paper river VERSION 2 (index-river-v2.html): compact, about half the scroll ---- */
.rv2.river{padding:clamp(56px,7vw,96px) 0 clamp(48px,6vw,80px)}
.rv2 .shead h2{font-size:clamp(34px,4.6vw,60px);max-width:18ch}
.rv2 .river-map{--rw:84px;max-width:1040px;padding:clamp(56px,6vw,84px) var(--pad)}
.rv2 .stops{gap:clamp(18px,3vw,44px)}
.rv2 .stop{gap:clamp(20px,3vw,44px)}
.rv2 .pop{width:min(100%,320px)}
.rv2 .stop:nth-child(4) .pop{width:min(64%,230px)}
.rv2 .rv-card{max-width:360px;padding:clamp(16px,1.8vw,24px)}
.rv2 .rv-card .script{font-size:clamp(28px,2.6vw,36px)}
.rv2 .rv-card h3{font-size:clamp(24px,2.2vw,30px)}
.rv2 .rv-card p{font-size:15px;line-height:1.45;margin-top:8px}
.rv2 .rv-go{margin-top:10px;font-size:14px}
.rv2 .rv-boat{width:clamp(44px,4vw,56px)}
@media (max-width:760px){
  .rv2 .river-map{--rw:52px;padding-block:56px}
  .rv2 .stops{gap:26px}
  .rv2 .stop{grid-template-columns:44% 1fr;gap:12px;align-items:center}      /* picture beside its card, not above it */
  .rv2 .stop:nth-child(even){grid-template-columns:1fr 44%}
  .rv2 .stop .pop,.rv2 .stop:nth-child(even) .pop{width:100%;justify-self:center}
  .rv2 .stop:nth-child(even) .pop{order:2}
  .rv2 .stop:nth-child(4) .pop{width:78%}
  .rv2 .rv-card,.rv2 .stop:nth-child(even) .rv-card{width:auto;justify-self:stretch;padding:12px 12px 10px}
  .rv2 .rv-no{font-size:13px}
  .rv2 .rv-card .script{font-size:24px;margin:4px 0 0}
  .rv2 .rv-card h3{font-size:19px}
  .rv2 .rv-card p{font-size:13px;line-height:1.4;margin-top:6px}
  .rv2 .rv-go{font-size:12px;line-height:16px;margin-top:8px;padding-block:4px}
}
.river-end .script{text-wrap:balance}
@media (max-width:760px){ .river-end .script{font-size:clamp(32px,9.4vw,40px);line-height:1.1} }   /* two even lines, "Tejo" no longer alone */
.river .shead .script{margin-bottom:.34em}                                  /* the "g" of "viagem" no longer touches the title */
.rv-tri{display:inline-block;width:.62em;height:.78em;margin-left:.22em;vertical-align:-.04em;color:var(--blue)}
