/* A card opened into its world, almost full screen (journey.js). One stop per gesture; each dish an engraved plate;
   each arcanum its own night. Garamond only: no handwriting where things must be read at a glance. */
.journey {
  --night: #0b0c12; --night-2: #141522; --gold: #c9a463; --gold-dim: rgba(201,164,99,.45);
  --text: #efe6d4; --text-dim: rgba(239,230,212,.68); --glow: 255,196,110;
  --jf: "EB Garamond", Georgia, serif;
  position: fixed; inset: 0; z-index: 18; color: var(--text); font: 18px/1.5 var(--jf);
}
/* the room dims behind the card as it comes close; the night is opaque from its first frame */
.journey::before { content: ""; position: absolute; inset: 0; background: rgba(3,2,1,.6); opacity: 0; transition: opacity .9s ease; }
.journey.dim::before { opacity: 1; }
.journey.out::before { opacity: 0; transition-duration: .8s; }
.journey.empress { --night: #150a0d; --night-2: #2a1318; --glow: 255,200,120; }
.journey.star { --night: #060a17; --night-2: #101a33; --gold: #d8c08a; --gold-dim: rgba(216,192,138,.45); --glow: 200,215,255; }

/* the card itself: a gold double frame around its night */
.journey .jcard { transform-origin: 50% 50%; position: absolute; inset: max(10px, 1.6vh) max(10px, 1.6vw); border-radius: 6px; overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, var(--night-2), var(--night) 72%);
  box-shadow: 0 0 0 1px rgba(201,164,99,.25), 0 30px 90px rgba(0,0,0,.8); }
/* the card's painted face (a decoded <img>), in its own proportions, in front of the night while the card comes
   close; journey.js places and moves it. A sheen of light crosses it once on the way */
.journey .face { position: absolute; z-index: 30; transform-origin: 0 0; border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(201,164,99,.3), 0 0 70px rgba(var(--glow), .28), 0 40px 110px rgba(0,0,0,.8); pointer-events: none; opacity: 0; will-change: transform, opacity; }
.journey .face img { display: block; width: 100%; height: 100%; }
.journey .face i { position: absolute; inset: -10% -40%; transform: translateX(-120%); will-change: transform;
  background: linear-gradient(105deg, transparent 40%, rgba(255,244,220,.32) 50%, transparent 60%); }
/* the light that swells out of the card as it opens, and gathers into it as it closes */
.journey .glow { position: absolute; z-index: 31; border-radius: 50%; pointer-events: none; opacity: 0; will-change: transform, opacity;
  background: radial-gradient(circle closest-side, rgba(var(--glow), .85), rgba(var(--glow), .3) 40%, rgba(var(--glow), 0)); }
/* the night opens through a soft round mask that only scales (journey.js); after a resize it simply fills the window */
.journey .bloom { position: absolute; inset: 0; will-change: transform, opacity;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 55%, transparent 100%); mask-image: radial-gradient(circle closest-side, #000 55%, transparent 100%); }
.journey .bloom.plain { inset: 0; -webkit-mask-image: none; mask-image: none; }
.journey .jcard { will-change: transform; }
/* the dust of the passage, over everything */
.journey canvas.dust { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 32; pointer-events: none; }
/* folding back: what is inside goes first; the light stays, and the night goes back into the card around it */
.journey .jstuff { position: absolute; inset: 0; transition: opacity .45s ease; will-change: opacity; }
.journey.out .jstuff { opacity: 0; }
.journey .jcard::before, .journey .jcard::after { content: ""; position: absolute; pointer-events: none; z-index: 6; }
.journey .jcard::before { inset: 10px; border: 3px solid var(--gold); border-radius: 3px; }
.journey .jcard::after { inset: 20px; border: 1px solid var(--gold-dim); }
.journey .jcard .corner { position: absolute; z-index: 6; width: 18px; height: 18px; color: var(--gold); }
.journey .corner.tl { top: 12px; left: 12px; } .corner.tr { top: 12px; right: 12px; } .corner.bl { bottom: 12px; left: 12px; } .corner.br { bottom: 12px; right: 12px; }

/* the night's furniture, fixed behind the journey; only the big numeral shifts a little at each stop, the sign in the sky stays */
.journey .jcard canvas.air { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.journey .jcard .hatch { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(115deg, rgba(201,164,99,.025) 0 1px, transparent 1px 7px);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 40%, #000 100%); mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 40%, #000 100%); }
.journey .jcard .numeral { position: absolute; z-index: 0; right: 4%; top: 50%; font: 500 clamp(220px, 42vw, 620px)/1 var(--jf); color: transparent;
  -webkit-text-stroke: 1px rgba(201,164,99,.09); pointer-events: none; user-select: none;
  transform: translateY(calc(-50% - var(--at, 0) * 2.2vh)); transition: transform 1.6s cubic-bezier(.4,0,.2,1); }
.journey .jcard .sky { position: absolute; z-index: 1; top: 46px; left: 52px; width: clamp(34px, 3.4vw, 54px); color: var(--gold); opacity: .85;
  filter: drop-shadow(0 0 14px rgba(201,164,99,.35)); }
.journey .jcard .sky.crown { width: clamp(44px, 4.2vw, 66px); }
.journey .jcard .sky.bigstar { width: clamp(90px, 10vw, 150px); top: 34px; left: 40px; opacity: .45; animation: turn 120s linear infinite; }
@keyframes turn { to { rotate: 360deg; } }
.journey .jcard .ground { position: absolute; left: 0; bottom: 0; width: 100%; height: 18%; z-index: 1; pointer-events: none; }
.journey .jcard .ground.water .wave { animation: drift 7s ease-in-out infinite alternate; }
.journey .jcard .ground.water .w1 { animation-duration: 9s; } .jcard .ground.water .w2 { animation-duration: 11s; } .jcard .ground.water .w3 { animation-duration: 13s; }
@keyframes drift { to { transform: translateX(-26px); } }


/* the journey: moved one stop at a time by the script (the browsers' own snapping skipped stops under a trackpad's inertia) */
.journey .jpage { position: absolute; inset: 24px; z-index: 2; overflow: hidden; touch-action: none; }
.journey .jtrack { position: absolute; inset: 0; will-change: transform; }
.journey .jpath { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 0; overflow: visible; will-change: transform; }
/* the head of the path: a lit point moved by a transform (a filtered svg circle repainted the path at every step) */
.journey .jhead { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; pointer-events: none; z-index: 0; will-change: transform;
  background: radial-gradient(circle closest-side, #ffd27a 0 42%, rgba(255,176,74,.55) 50%, rgba(255,176,74,0)); }
.journey.star .jhead { background: radial-gradient(circle closest-side, #eef2ff 0 42%, rgba(184,200,255,.55) 50%, rgba(184,200,255,0)); }
.journey .jstop { position: relative; height: 100%; display: flex; align-items: center; padding: 0 clamp(22px, 8vw, 150px); }

/* the opening: the place's room behind its name */
.journey .jstop.open { flex-direction: column; justify-content: center; text-align: center; }
.journey .room { position: absolute; left: 50%; top: 47%; width: min(92%, 1000px); aspect-ratio: 3 / 2; transform: translate(-50%, -50%) scale(1.08); z-index: -1; opacity: 0;
  background: center / cover no-repeat; will-change: transform, opacity;
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
/* the photos' look (sepia, saturation, brightness) is baked in while loading: see LOOK in journey.js */
.journey.in .room { animation: roomin 1.4s ease forwards, roomdrift 26s linear 1.4s forwards; }
@keyframes roomin { to { opacity: .55; transform: translate(-50%, -50%) scale(1.02); } }
@keyframes roomdrift { from { transform: translate(-50%, -50%) scale(1.02); } to { transform: translate(-50%, -50%) scale(1.12); } }
.journey .jstop .arc { color: var(--gold); letter-spacing: .3em; font-size: 15px; }
.journey .jstop .arc span { display: block; letter-spacing: .12em; font-style: italic; color: var(--gold-dim); margin-top: 2px; }
.journey .jname { margin: 18px 0 0; font-weight: 500; font-size: clamp(44px, 8vw, 110px); line-height: 1; }
.journey .jstop .where { color: var(--gold); font-size: clamp(18px, 1.8vw, 24px); letter-spacing: .08em; margin-top: 12px; }
.journey .jstop .what { font-style: italic; font-size: clamp(22px, 2.6vw, 34px); line-height: 1.3; max-width: 24ch; margin: 34px 0 0; text-wrap: balance; }
.journey .jstop .flourish { width: 160px; margin-top: 28px; color: var(--gold); opacity: .8; }
/* the place's words wait for the window to open, then rise */
.journey:not(.in) .open > :not(.room) { opacity: 0; }
.journey.in .open > :not(.room) { opacity: 0; transform: translateY(14px); animation: rise 1.1s cubic-bezier(.2,.7,.2,1) forwards; }
.journey .open > :nth-child(3) { animation-delay: .35s !important; } .open > :nth-child(4) { animation-delay: .63s !important; } .open > :nth-child(5) { animation-delay: 1s !important; } .open > :nth-child(6) { animation-delay: 1.33s !important; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* a dish: an engraved plate, its frame drawn first, then the light opens the photo, then the name is engraved */
.journey .jstop.right { flex-direction: row-reverse; }
/* each plate is its own layer: its reveal, drawn frame by frame, then repaints the plate alone, not the whole track */
.journey .plate { position: relative; width: min(56%, 700px); padding: 14px; margin: 0; will-change: transform; }
/* two engraved frames drawn stroke by stroke (journey.js): the outer from the top left, the inner from the bottom right */
.journey .plate .frame { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.journey .plate .frame.inner { inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
.journey .plate .frame path { fill: none; stroke: var(--gold); stroke-width: 1; }
/* not yet drawn: hidden until the script measures and draws it */
.journey .jstop:not(.on) .plate .frame { visibility: hidden; }
.journey .plate .frame.inner path { stroke: var(--gold-dim); }
.journey .plate .orn { position: absolute; width: 14px; height: 14px; color: var(--gold); opacity: 0; transition: opacity .6s ease .8s; }
.journey .plate .orn.a { top: -7px; left: -7px; } .plate .orn.b { top: -7px; right: -7px; } .plate .orn.c { bottom: -7px; left: -7px; } .plate .orn.d { bottom: -7px; right: -7px; }
.journey .on .plate .orn { opacity: 1; }
.journey .plate .ph { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
/* the mask and the rim are written by the script frame by frame */
.journey .plate .ph img { display: block; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: linear-gradient(transparent, transparent); mask-image: linear-gradient(transparent, transparent); }
.journey .plate .rim { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen; }
.journey .label { flex: 1; display: grid; justify-items: start; gap: 10px; padding: 0 clamp(18px, 3.5vw, 56px); }
.journey .right .label { justify-items: end; text-align: right; }
.journey .label .no { color: var(--gold); letter-spacing: .3em; font-size: 14px; }
/* room under the line: with the text clipped to its gold glint, descenders (the gg of «Pioggia») would be cut */
.journey .label .nm { padding-bottom: .16em; margin-bottom: -.16em; font-size: clamp(24px, 2.8vw, 42px); line-height: 1.15; max-width: 14ch; text-wrap: balance;
  background: linear-gradient(100deg, var(--text) 0 42%, #ffe2a0 50%, var(--text) 58% 100%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.journey .label .desc { font-style: italic; color: var(--text-dim); font-size: clamp(16px, 1.4vw, 20px); max-width: 26ch; }
.journey .label .rule { width: 0; height: 1px; background: var(--gold-dim); transition: width 1s ease 2.07s; }
.journey .on .label .rule { width: 90px; }
.journey .label > * { opacity: 0; transform: translateY(10px); transition: opacity 1s ease, transform 1s cubic-bezier(.2,.7,.2,1); }
.journey .label .no { transition-delay: 1.62s; } .label .nm { transition-delay: 1.8s; } .label .desc { transition-delay: 2s; }
.journey .on .label > * { opacity: 1; transform: none; }
.journey .on .label .nm { animation: glint 1.6s ease 2.16s forwards; }
@keyframes glint { to { background-position: 0 0; } }

/* the end: the arcanum's sign, then a reminder of the place */
.journey .jstop.end { justify-content: center; flex-direction: column; text-align: center; }
.journey .jstop.end .sign { width: clamp(70px, 8vw, 110px); filter: drop-shadow(0 0 26px rgba(var(--glow), .7)); opacity: 0; transition: opacity 1.4s ease .3s; }
.journey.empress .jstop.end .sign { width: clamp(90px, 10vw, 140px); }
.journey .end.on .sign { opacity: 1; }
.journey .memo { display: grid; justify-items: center; gap: 30px; margin-top: 30px; }
.journey .memo-k { display: flex; align-items: center; gap: 12px; color: var(--gold); font-size: 14px; letter-spacing: .32em; text-transform: uppercase; opacity: 0; transition: opacity 1s ease .9s; }
.journey .memo-k svg { width: 10px; height: 10px; }
.journey .jstop.end .last { font-style: italic; font-size: clamp(24px, 3vw, 40px); line-height: 1.5; margin: 0; max-width: 40ch; text-wrap: balance;
  opacity: 0; transform: translateY(10px); transition: opacity 1.2s ease 1.5s, transform 1.2s cubic-bezier(.2,.7,.2,1) 1.5s; }
.journey .pill { display: inline-flex; align-items: center; gap: .32em; font-size: .86em; font-style: normal; font-weight: 500; letter-spacing: .04em; color: #ffe7b0;
  padding: 0 .58em .04em .48em; margin-right: .2em; border-radius: 999px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, rgba(201,164,99,.22), rgba(201,164,99,.08)); vertical-align: .06em; }
.journey .pill svg { width: .55em; height: .55em; color: var(--gold); }
.journey .end.on .memo-k, .journey .end.on .last { opacity: 1; transform: none; }
.journey .end.on .pill { animation: pilllight 2.4s ease 2.5s both; }
@keyframes pilllight { 0% { box-shadow: 0 0 0 0 rgba(var(--glow),0); } 40% { box-shadow: 0 0 28px 4px rgba(var(--glow),.45); } 100% { box-shadow: 0 0 14px 1px rgba(var(--glow),.22); } }
.journey.closable { cursor: pointer; }

/* the scroll hint: a wheel, until the first move */
.journey .jcard .hint { position: absolute; z-index: 15; left: 50%; bottom: 46px; margin-left: -13px; width: 26px; height: 40px; border: 1.5px solid var(--gold); border-radius: 13px;
  opacity: 0; animation: jshow 1s ease 3s forwards; transition: opacity .6s; pointer-events: none; }
.journey .jcard .hint::after { content: ""; position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--gold); animation: wheel 1.8s ease-in-out infinite; }
.journey .jcard .hint.gone { animation: none; opacity: 0; }
@keyframes jshow { to { opacity: .85; } }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* the cue sits at the very bottom while a card is open */
body:has(.journey) #sub { bottom: 5vh; z-index: 30; }

@media (max-width: 700px) {
  .journey .jstop, .journey .jstop.right { flex-direction: column; justify-content: center; align-items: flex-start; padding: 0 12px; gap: 18px; }
  .journey .jstop.right { align-items: flex-end; }
  .journey .jstop.open, .journey .jstop.end { align-items: center; }
  .journey .plate { width: 90%; padding: 10px; }
  .journey .label { flex: none; padding: 0 6px; } /* in a column, a growing label pushed the plate to the top */
  .journey .jcard .sky { top: 40px; left: 40px; }
  .journey .room { width: 112%; aspect-ratio: 3 / 4; }
}
@media (prefers-reduced-motion: reduce) {
  .journey.in .jcard, .journey.in .open > :not(.room), .journey .jcard .hint, .journey.in .room { animation: none; opacity: 1; transform: none; }
  .journey.in .room { opacity: .55; transform: translate(-50%, -50%); }
  .journey .plate .orn, .journey .label > *, .journey .label .rule, .journey .jstop.end .sign { transition: none; }
}
