/* The weather show (#hava, between the steps and the outfit demo): the section holds on screen while the visitor
   scrolls; the words and the four stages at the left, the show large at the right. js/site.js part 4 sets the numbers:
   --s1  0..1  the phone shows the app's own permission card (never the system's); a touch mark taps "İzin ver"
   --s2  0..1  the view rises: the phone sinks and shrinks away over a map of the city seen from above, a pin on Kadıköy
   --s3  0..1  the view rises on through the clouds: three layers grow past the camera, the city dims, rain starts
   --s4  0..1  the weather card comes in: Kadıköy, 18°, rain
   --s5  0..1  the rainy outfit lands
   Not live (narrower than 1024px, a screen under 640px tall, reduced motion, no script): one screen, the show is
   hidden and the weather and outfit cards stand in the frame. */

/* ---- the section */
main > section#hava.is-live { height: 600svh; padding: 0; }
#hava.is-live .hv-sec__stage { position: sticky; top: 0; height: 100svh; box-sizing: border-box; display: grid; align-items: center;
  padding: calc(var(--nav, 72px) + var(--s-5)) 0 var(--s-6); }
.hv-sec__grid { align-items: center; }
.hv-sec__text { display: grid; gap: var(--s-5); align-content: center; }
.hv-sec__text p { max-width: 42ch; }
.hv-sec__list { display: grid; gap: var(--s-3); margin: var(--s-3) 0 0; padding: 0; list-style: none; }
.hv-sec__list li { display: flex; gap: 14px; align-items: baseline; padding-left: var(--s-4); border-left: 2px solid var(--line);
  font: 500 var(--t-lead)/1.3 var(--font-text); color: var(--muted); transition: color .5s ease, border-color .5s ease; }
.hv-sec__list b { font: 700 12px/1 var(--font-text); font-stretch: 125%; letter-spacing: .1em; }
#hava:not(.is-live) .hv-sec__list li, .hv-sec__list li.is-on { color: var(--ink); border-left-color: var(--accent, var(--lime)); }
.hv-sec__list li.is-done { color: var(--ink); }
.hv-sec__frame { position: relative; margin: 0; border-radius: var(--r-lg); overflow: hidden; display: grid; place-items: center;
  height: min(560px, 70svh); }
#hava.is-live .hv-sec__frame { height: min(820px, calc(100svh - var(--nav, 72px) - var(--s-5) - var(--s-6))); }

/* ---- the show (live only) */
.hv { display: none; }
#hava.is-live .hv { display: block; position: absolute; inset: 0; overflow: hidden; }

/* the city from above: zoomed far in at first (only night shows), it opens as the view rises; Kadıköy is the centre */
/* the map is 1.7x the frame (inset -35%) and never drawn smaller than the frame, so its edge never shows while the
   view rises, at any window size or browser zoom */
.hv__world { position: absolute; inset: -35%; transform-origin: 50% 50%;
  transform: scale(calc((7 - 6 * var(--s2, 1)) * .68 - .08 * var(--s3, 0))); opacity: min(calc(var(--s2, 1) * 1.6), calc(1 - .55 * var(--s3, 0))); }
.hv__map { position: absolute; inset: 0; width: 100%; height: 100%; }
.hv__pin { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: grid; justify-items: center;
  opacity: calc((var(--s2, 1) - .72) * 3.6); }
.hv__pin i { position: relative; width: 16px; height: 16px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgb(var(--lime-rgb) / .25), 0 0 28px 8px rgb(var(--lime-rgb) / .6); }
.hv__pin b { position: absolute; top: 26px; white-space: nowrap; padding: 5px 11px; border-radius: 99px; background: var(--cream); color: var(--night); font: 700 14px/1.2 var(--font-text); }
@media (prefers-reduced-motion: no-preference) {
  .hv__pin i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--lime); animation: hv-ping 1.8s ease-out infinite; }
}
@keyframes hv-ping { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }

/* the phone alone (no drawn hand): as the view rises it shrinks toward the bottom edge and fades */
.hv__hold { position: absolute; left: 50%; top: 2%; height: 115%; aspect-ratio: 220 / 440; container-type: size;
  translate: -50% 0; transform-origin: 50% 100%;
  transform: scale(calc(1 - .72 * var(--s2, 0)));
  opacity: calc(1 - (var(--s2, 0) - .25) * 2.4); }
.hv__phone { position: absolute; left: 13.6%; top: 4.5%; width: 72.8%; height: 75%; border-radius: 9cqh; padding: 2cqh;
  background: #0b0b0a; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16), 0 30px 60px -20px rgb(0 0 0 / .8); }
.hv__screen > *, .hv__perm > * { min-width: 0; }
.hv__screen { height: 100%; border-radius: 7.2cqh; background: var(--cream); color: var(--night); overflow: hidden;
  display: grid; grid-template-rows: auto 1fr; padding: 2.2cqh 2.6cqh 2.6cqh; }
/* the status bar has a row of its own: the time, the island, wifi and a full battery; nothing runs under it */
.hv__bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1cqh; height: 5cqh; padding: 0 .8cqh; font: 700 2.4cqh/1 var(--font-text); }
.hv__island { width: 7.5cqh; height: 2.9cqh; border-radius: 99px; background: #0b0b0a; }
.hv__icons { justify-self: end; display: flex; gap: .8cqh; align-items: center; }
.hv__icons svg { height: 2cqh; width: 2.7cqh; flex: none; }
.hv__icons svg + svg { width: 4.1cqh; }
.hv__perm { align-self: end; display: grid; gap: 1.2cqh; padding: 2.8cqh 2.6cqh; overflow-wrap: anywhere; border-radius: 5cqh; background: #fff; box-shadow: 0 2cqh 5cqh -2cqh rgb(0 0 0 / .25); }
.hv__perm-ico { display: grid; place-items: center; width: 8cqh; height: 8cqh; border-radius: 50%; background: var(--lime); }
.hv__perm-ico svg { width: 4.8cqh; height: 4.8cqh; }
.hv__perm b { font: 800 3.2cqh/1.05 var(--font-display); font-stretch: 75%; letter-spacing: -.01em; }
.hv__perm > span:not([class]) { font: 500 2.2cqh/1.35 var(--font-text); color: #4d4a42; }
.hv__btn { position: relative; display: grid; height: 7cqh; margin-top: .6cqh; border-radius: 99px; background: var(--night); color: var(--cream);
  font: 700 2.6cqh/1 var(--font-text); transition: background .25s ease, color .25s ease; }
.hv__btn i { grid-area: 1 / 1; place-self: center; font-style: normal; transition: opacity .2s ease; }
.hv__btn i + i { opacity: 0; }
.hv__later { justify-self: center; font: 600 2.2cqh/1 var(--font-text); color: #8a8578; }
/* the tap: a soft touch mark lands on the button (it grows in, presses, lifts), the button turns lime */
.hv__btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8cqh; height: 8cqh; margin: -4cqh 0 0 -4cqh;
  border-radius: 50%; background: rgb(255 255 255 / .35); box-shadow: 0 0 0 .5cqh rgb(255 255 255 / .85), 0 1cqh 3cqh rgb(0 0 0 / .35);
  opacity: var(--tap, 0); transform: scale(calc(1.6 - .6 * var(--tap, 0))); pointer-events: none; }
[data-hv].is-tapped .hv__btn { background: var(--lime); color: var(--night); }
[data-hv].is-tapped .hv__btn i:first-child { opacity: 0; }
[data-hv].is-tapped .hv__btn i + i { opacity: 1; }

/* the clouds: three soft layers, each starts small and far, grows past the camera and is gone; they come one after
   another (each its own slice of --s3). A haze stays at the end, the rain falls through it */
.hv__sky { position: absolute; inset: 0; pointer-events: none; }
.hv__cloud { --k: clamp(0, calc((var(--s3, 0) - var(--d)) / .55), 1); position: absolute; inset: 0;
  transform: scale(calc(.4 + 2.8 * var(--k))) rotate(var(--r)); opacity: calc(min(var(--k) * 4, (1 - var(--k)) * 3)); }
/* each cloud is soft shapes torn and shaded by fractal noise (the filters in index.html): puffy edges, lit from the top
   left, darker underneath. Drawn once, then only scaled (will-change), so the scroll stays smooth */
.hv__cloud { will-change: transform, opacity; }
/* the SVG is only the recipe: js/site.js part 7 draws it once into a canvas (with its shadow) and the canvas is what
   moves. A live SVG filter scaled on every scroll frame was heavy enough to crash a tab on a large screen */
.hv__cloud svg { display: none; }
.hv__cloud canvas { position: absolute; left: -25%; top: -25%; width: 150%; height: 150%; max-width: none; max-height: none; }
.hv__cloud:nth-of-type(1) { --d: 0;   --r: 0deg; }
.hv__cloud:nth-of-type(2) { --d: .2;  --r: -8deg; }
.hv__cloud:nth-of-type(3) { --d: .42; --r: 6deg; }
.hv__sky::before { content: ""; position: absolute; inset: 0; opacity: calc(var(--s3, 0) * .9);
  background: radial-gradient(90% 70% at 50% 30%, rgb(180 186 184 / .28), transparent 75%), linear-gradient(rgb(18 18 16 / .25), rgb(18 18 16 / .55)); }
.hv__rain { position: absolute; inset: 0; opacity: calc((var(--s3, 0) - .3) * 1.5);
  background: repeating-linear-gradient(102deg, transparent 0 29px, rgb(225 232 236 / .34) 29px 30.5px, transparent 30.5px 61px);
  mask-image: repeating-linear-gradient(180deg, #000 0 34px, transparent 34px 97px), repeating-linear-gradient(90deg, #000 0 113px, transparent 113px 151px);
  mask-composite: intersect; }
.hv__rain--far { opacity: calc((var(--s3, 0) - .3) * .9);
  background: repeating-linear-gradient(101deg, transparent 0 17px, rgb(225 232 236 / .2) 17px 18px, transparent 18px 43px);
  mask-image: repeating-linear-gradient(180deg, #000 0 18px, transparent 18px 97px), repeating-linear-gradient(90deg, transparent 0 37px, #000 37px 139px); }
@media (prefers-reduced-motion: no-preference) {
  .hv__rain { animation: hv-rain .55s linear infinite; }
  .hv__rain--far { animation-duration: .9s; }
}
@keyframes hv-rain { from { mask-position: 0 0, 0 0; } to { mask-position: 0 97px, 0 0; } }

/* ---- the weather card, then the outfit: over the map when live, standing in the frame at rest */
.hv__end { position: relative; z-index: 1; display: grid; gap: 12px; width: min(380px, 80%); color: var(--night); }
.hv__end .scr__wx { margin: 0; box-shadow: 0 20px 40px -14px rgb(0 0 0 / .6); }
.hv__end .scr__card { box-shadow: 0 20px 40px -14px rgb(0 0 0 / .6); }
.hv__end .scr__fit { height: 200px; }
#hava.is-live .hv__wx { opacity: var(--s4, 0); transform: translateY(calc(24px * (1 - var(--s4, 0)))); }
#hava.is-live .hv__fits { opacity: var(--s5, 0); transform: translateY(calc(30px * (1 - var(--s5, 0)))); }
#hava.is-live [data-hv]:not(.is-end) .hv__fits { pointer-events: none; }
/* three outfits: the first is open; the others show only their name and open (or close) on a click */
.hv__fits { display: grid; gap: 8px; }
.hv__fit { padding: 0; }
.hv__fit-head { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 16px; }
.hv__fit-head .scr__k { margin: 0; }
.hv__fit-head svg { width: 14px; height: 14px; flex: none; color: #5b6b2f; transition: transform .3s ease; }
.hv__fit.is-open .hv__fit-head svg { transform: rotate(180deg); }
.hv__fit-head:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.hv__fit-body { max-height: 0; overflow: hidden; transition: max-height .4s cubic-bezier(.2, .7, .2, 1); }
.hv__fit-body > .scr__fit { padding: 0 12px; }
.hv__fit.is-open .hv__fit-body { max-height: 240px; }
.hv__fit.is-open .hv__fit-body > .scr__fit { padding-bottom: 12px; }
@media (prefers-reduced-motion: no-preference) {
  [data-hv].is-end .hv__fit.is-open .scr__fit img { animation: fly-in 1.3s cubic-bezier(.2, .9, .2, 1.15) both .2s; }
  [data-hv].is-end .hv__fit.is-open .scr__fit img:nth-child(2) { animation-delay: .5s; }
  [data-hv].is-end .hv__fit.is-open .scr__fit img:nth-child(3) { animation-delay: .8s; }
}

@media (max-width: 1023px) {
  .hv-sec__frame { grid-column: 1 / -1; height: auto; padding: var(--s-6) 0; }
  .hv-sec__text { grid-column: 1 / -1; }
}
