@font-face { font-family: Rajdhani; src: url(../assets/fonts/rajdhani-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Rajdhani; src: url(../assets/fonts/rajdhani-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Rajdhani; src: url(../assets/fonts/rajdhani-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Rubik; src: url(../assets/fonts/rubik-var.woff2) format('woff2'); font-weight: 300 800; font-display: swap; }

:root {
  /* Pipo palette + Quality Windows brand */
  --cream: #FAF9EF;
  --peach: #E6B093;
  --sky: #A3CEFF;
  --sand: #E3CCA1;
  --navy: #434E6E;
  --ink: #283150;
  --muted: #5d6886;
  --night-ink: #eef0f6;
  --night-muted: #b3bad0;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: Rajdhani, 'Arial Narrow', sans-serif;
  --body: Rubik, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--peach); outline-offset: 3px; border-radius: 6px; }

/* ---------- backdrop layers ---------- */
/* Fixed layers are sized to the large viewport (100lvh), so they don't resize while the mobile URL bar slides. */
.sky, .night, #scene, .grain, .veil { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; }
.sky {
  z-index: 0;
  background:
    radial-gradient(44vmax 40vmax at var(--ax, 74%) var(--ay, 36%), rgba(230, 176, 147, .92), rgba(230, 176, 147, 0) 70%),
    radial-gradient(48vmax 42vmax at var(--bx, 14%) var(--by, 88%), rgba(163, 206, 255, .95), rgba(163, 206, 255, 0) 70%),
    var(--cream);
}
.night {
  z-index: 0; opacity: var(--night, 0); pointer-events: none;
  background:
    radial-gradient(60vmax 40vmax at 70% 30%, rgba(230, 176, 147, .16), transparent 70%),
    radial-gradient(70vmax 50vmax at 15% 90%, rgba(163, 206, 255, .14), transparent 70%),
    linear-gradient(180deg, #1a2140, #232c4c 60%, #2d3657);
}
#scene { z-index: 1; display: block; transition: opacity 1.2s var(--ease); }
.grain {
  z-index: 2; pointer-events: none; opacity: .09; mix-blend-mode: multiply;
  background-image: 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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .2 0 0 0 0 .3 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* dims and blurs the house behind the sections that follow the tour */
.veil {
  z-index: 4; pointer-events: none; display: none;
  background: rgba(20, 26, 48, calc(var(--veil, 0) * .5));
  -webkit-backdrop-filter: blur(calc(var(--veil, 0) * 10px)); backdrop-filter: blur(calc(var(--veil, 0) * 10px));
}
.bar { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 25; background: rgba(67, 78, 110, .1); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--navy) 60%, var(--peach)); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* ---------- glass ---------- */
/* Two inner edges read like a sash sitting inside its frame. */
.glass {
  background: linear-gradient(140deg, rgba(255, 255, 255, .64), rgba(255, 255, 255, .26));
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .12), inset 0 0 0 6px rgba(255, 255, 255, .55), 0 26px 60px -30px rgba(39, 48, 73, .55);
}
.is-night .glass, .after .glass {
  background: linear-gradient(140deg, rgba(52, 62, 96, .58), rgba(26, 33, 58, .36));
  border-color: rgba(255, 255, 255, .2);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .02), inset 0 0 0 6px rgba(255, 255, 255, .12), 0 26px 60px -30px rgba(0, 0, 0, .7);
  color: var(--night-ink);
}

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: .5em;
  padding: .85em 1.4em; border-radius: 999px; border: 1px solid transparent;
  background: var(--navy); color: #fff; text-decoration: none; font: 500 15px/1 var(--body);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .35s;
  box-shadow: 0 10px 24px -12px rgba(39, 48, 73, .7);
}
.btn::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%) skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  transition: transform .7s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-sm { padding: .7em 1.15em; font-size: 14px; }
.is-night .btn, .after .btn { background: var(--sand); color: #2a2f45; }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .35); color: inherit; box-shadow: none; }
.after .btn-ghost { background: rgba(255, 255, 255, .06); color: var(--night-ink); }

/* ---------- nav ---------- */
.nav {
  position: fixed; z-index: 20; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(1180px, calc(100% - 28px)); display: flex; align-items: center; gap: 24px;
  padding: 8px 10px 8px 18px; border-radius: 999px;
}
.brand img { width: 74px; height: auto; transition: filter .6s; }
.is-night .brand img { filter: brightness(0) invert(1); opacity: .92; }
.links { display: flex; gap: 26px; margin-left: auto; font-size: 14.5px; }
.links a { position: relative; text-decoration: none; padding: 6px 0; color: inherit; opacity: .85; transition: opacity .3s; }
.links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease); }
.nav .links.glass { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.menu-btn { display: none; }

/* ---------- hero (hero-scrub split title over the 3D house) ---------- */
.hero {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  display: grid; place-items: center; text-align: center;
  --k: 0;
}
.hero h1 {
  margin: 0; font: 600 clamp(76px, 15.5vw, 250px)/.8 var(--display); letter-spacing: -.035em; color: var(--navy);
  display: flex; flex-direction: column; justify-content: space-between; height: min(66vh, 640px); transform: translateY(-5vh);
}
.hero h1 span { display: block; will-change: transform; opacity: calc(1 - var(--k) * 1.4); }
.hero .w1 { transform: translateX(calc(var(--k) * -62vw)); letter-spacing: calc(-.035em + var(--k) * .08em); }
.hero .w2 { transform: translateX(calc(var(--k) * 62vw)); letter-spacing: calc(-.035em + var(--k) * .08em); }
.hero-line {
  position: absolute; left: 50%; bottom: 11vh; width: min(520px, 86vw); transform: translate(-50%, calc(var(--k) * -24px));
  margin: 0; font-size: 17px; color: var(--ink); opacity: calc(1 - var(--k) * 2.2); filter: blur(calc(var(--k) * 12px));
}
.hint {
  position: absolute; left: 50%; bottom: 3vh; transform: translateX(-50%); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  opacity: calc(1 - var(--k) * 8); transition: opacity .4s;
}
.hint svg { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); opacity: .5; } }
.is-loading .hero h1 span, .is-loading .hero-line, .is-loading .hint { opacity: 0; }
.is-loading .hero .w1 { transform: translateY(40px); }
.is-loading .hero .w2 { transform: translateY(-40px); }
.is-loading #scene { opacity: 0; }
.hero h1 span, .hero-line, .hint { transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.is-ready .hero h1 span, .is-ready .hero-line { transition: none; }

/* ---------- tour panel ---------- */
.panel {
  position: fixed; z-index: 10; left: max(24px, 3vw); top: 50%; transform: translate(calc((1 - var(--pv, 0)) * -24px), -50%);
  width: min(400px, 34vw); max-height: calc(100vh - 150px); overflow: auto; padding: 26px 26px 22px; border-radius: 24px;
  opacity: var(--pv, 0); pointer-events: none; scrollbar-width: none;
}
.panel.on { pointer-events: auto; }
.panel-head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.panel-stop { margin: 0; flex: 1; font-size: 13px; color: var(--muted); }
.panel-btn {
  display: none; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(67, 78, 110, .22);
  background: rgba(255, 255, 255, .55); color: var(--navy); font: 500 13px/1 var(--body); cursor: pointer;
}
.panel-btn.next { background: var(--navy); color: #fff; border-color: var(--navy); }
.panel-btn:active { transform: scale(.96); }
.panel h2 { margin: 0; font: 600 40px/1 var(--display); letter-spacing: -.01em; color: var(--ink); }
.panel-room { margin: 6px 0 14px; font-size: 14px; color: var(--navy); }
.panel-text { margin: 0 0 16px; font-size: 15px; line-height: 1.6; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; margin: 0 0 18px; font-size: 13.5px; }
.specs dt, .specs dd { margin: 0; padding: 7px 0; border-top: 1px solid rgba(67, 78, 110, .14); }
.specs dt { color: var(--muted); }
.stages { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: s; }
.stages li {
  counter-increment: s; flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px;
  font-size: 12px; line-height: 1.2; color: var(--muted); background: rgba(255, 255, 255, .35); transition: background .4s, color .4s;
}
.stages li::before {
  content: counter(s); flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font: 600 11px/1 var(--body); border: 1px solid currentColor;
}
.stages li.done { color: var(--navy); }
.stages li.on { background: var(--navy); color: #fff; }
.stages li[hidden] { display: none; }
.readout { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .5); min-height: 62px; }
.readout strong { flex: none; min-width: 3.2ch; font: 600 30px/1 var(--display); color: var(--navy); font-variant-numeric: tabular-nums; }
.readout span { font-size: 13.5px; line-height: 1.35; color: var(--ink); }

/* ---------- stop rail ---------- */
.rail { position: fixed; z-index: 10; right: 18px; top: 50%; transform: translateY(-50%); opacity: var(--rv, 0); pointer-events: none; transition: opacity .4s; }
.rail.on { pointer-events: auto; }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rail button {
  all: unset; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 4px; color: var(--ink);
  font: 500 13px/1 var(--body);
}
.rail button span {
  opacity: 0; transform: translateX(8px); transition: opacity .35s var(--ease), transform .35s var(--ease);
  padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap;
}
.rail button i {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 600 11px/1 var(--body); font-style: normal;
  background: rgba(255, 255, 255, .55); border: 1px solid rgba(255, 255, 255, .9); transition: background .35s, color .35s, transform .35s var(--ease);
}
.rail button:focus-visible span, .rail:not(.quiet) li.on span { opacity: 1; transform: none; }
.rail button:focus-visible i { outline: 2px solid var(--peach); outline-offset: 2px; }
.rail li.on i { background: var(--navy); color: #fff; border-color: var(--navy); }
.rail li.done i { background: rgba(67, 78, 110, .3); }

/* ---------- part labels ---------- */
.leads, .tags { position: fixed; inset: 0; z-index: 8; pointer-events: none; width: 100%; height: 100%; }
.leads line { stroke: var(--navy); stroke-width: 1; opacity: .75; }
.leads circle { fill: #fff; stroke: var(--navy); stroke-width: 1.5; }
.tag {
  position: absolute; left: 0; top: 0; padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  font: 500 12.5px/1 var(--body); color: var(--ink); background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 8px 20px -12px rgba(39, 48, 73, .6); transition: background .25s, color .25s;
}
.tag.hot { background: var(--navy); color: #fff; border-color: var(--navy); }

.tip {
  position: fixed; z-index: 30; left: 0; top: 0; max-width: 290px; padding: 12px 14px; border-radius: 14px; pointer-events: none;
  opacity: 0; transform: translate(-9999px, 0); transition: opacity .2s;
}
.tip.on { opacity: 1; }
.tip strong { display: block; font: 600 19px/1.1 var(--display); color: var(--ink); margin-bottom: 4px; }
.tip span { display: block; font-size: 13.5px; line-height: 1.45; }
.is-night .tip strong { color: var(--night-ink); }

/* ---------- finale ---------- */
.finale {
  position: fixed; z-index: 6; left: max(28px, 6vw); top: 50%; transform: translateY(calc(-50% + (1 - var(--fv, 0)) * 30px));
  width: min(520px, 88vw); color: var(--night-ink); opacity: var(--fv, 0); pointer-events: none;
}
.finale.on { pointer-events: auto; }
.finale h2 { margin: 0 0 14px; font: 600 clamp(48px, 6.4vw, 92px)/.9 var(--display); letter-spacing: -.02em; }
.finale p { margin: 0 0 26px; font-size: 18px; color: var(--night-muted); max-width: 40ch; }

/* ---------- after the tour ---------- */
#tour { position: relative; z-index: 3; pointer-events: none; }
.after { position: relative; z-index: 12; color: var(--night-ink); padding: 0 max(20px, 5vw) 40px; }
.block { max-width: 1180px; margin: 0 auto 18vh; scroll-margin-top: 100px; }
.block-title { margin: 0 0 14px; font: 600 clamp(42px, 6vw, 80px)/.92 var(--display); letter-spacing: -.02em; max-width: 14ch; }
.block-lead { margin: 0 0 44px; font-size: 18px; color: var(--night-muted); max-width: 52ch; }

.folders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.folder { position: relative; height: 350px; perspective: 1000px; outline-offset: 6px; cursor: default; }
.folder-back {
  position: absolute; inset: 44px 0 0; border-radius: 6px 20px 20px 20px;
  background: linear-gradient(160deg, rgba(163, 206, 255, .3), rgba(67, 78, 110, .35));
  border: 1px solid rgba(255, 255, 255, .18);
}
.folder-back::before {
  content: ''; position: absolute; left: -1px; top: -24px; width: 44%; height: 25px; border-radius: 12px 12px 0 0;
  background: rgba(163, 206, 255, .3); border: 1px solid rgba(255, 255, 255, .18); border-bottom: 0;
}
.folder img {
  position: absolute; left: 13%; top: 58px; width: 74%; height: 170px; object-fit: cover; border-radius: 12px;
  box-shadow: 0 18px 30px -16px rgba(0, 0, 0, .7); transition: transform .6s var(--ease);
}
.folder img:nth-of-type(1) { transform: rotate(-5deg) translateY(14px); }
.folder img:nth-of-type(2) { transform: rotate(3deg) translateY(6px); }
.folder img:nth-of-type(3) { transform: rotate(-1deg); }
.folder.open img:nth-of-type(1), .folder:focus-visible img:nth-of-type(1) { transform: translate(-30%, -40px) rotate(-13deg); }
.folder.open img:nth-of-type(2), .folder:focus-visible img:nth-of-type(2) { transform: translateY(-74px) rotate(0); }
.folder.open img:nth-of-type(3), .folder:focus-visible img:nth-of-type(3) { transform: translate(30%, -40px) rotate(13deg); }
.folder-front {
  position: absolute; left: 0; right: 0; bottom: 0; height: 47%; padding: 20px 22px 18px; border-radius: 20px;
  transform-origin: 50% 100%; transition: transform .6s var(--ease);
}
.folder.open .folder-front, .folder:focus-visible .folder-front { transform: rotateX(-16deg); }
.folder h3 { margin: 0 0 8px; font: 600 28px/1 var(--display); }
.folder p { margin: 0; font-size: 14.5px; color: var(--night-muted); }

.steps { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; counter-reset: st; max-width: 760px; --fill: 0; }
.steps::before {
  content: ''; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px;
  background: linear-gradient(var(--sand) calc(var(--fill) * 100%), rgba(255, 255, 255, .14) 0);
}
.steps li { counter-increment: st; position: relative; padding: 0 0 38px 70px; }
.steps li::before {
  content: counter(st); position: absolute; left: 0; top: -4px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font: 600 18px/1 var(--display); color: var(--night-ink); background: rgba(31, 39, 66, .92); border: 1px solid rgba(255, 255, 255, .22);
  transition: background .5s, color .5s, border-color .5s;
}
.steps li.on::before { background: var(--sand); color: #2a2f45; border-color: var(--sand); }
.steps h3 { margin: 0 0 4px; font: 600 26px/1.1 var(--display); }
.steps p { margin: 0; color: var(--night-muted); max-width: 54ch; }

.contact { padding: clamp(28px, 5vw, 60px); border-radius: 28px; }
.contact .block-lead { margin-bottom: 30px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.facts { display: grid; grid-template-columns: 1fr 2fr; gap: 28px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, .14); }
.facts p { margin: 0; color: var(--night-muted); }
.facts strong { display: block; font: 600 34px/1 var(--display); color: var(--night-ink); margin-bottom: 6px; }
.facts p:last-child strong { font-size: 22px; }
.facts a { text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: 4px; }
.foot { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; color: var(--night-muted); font-size: 14px; }
.foot p { margin: 0; }
.foot p:last-child { margin-left: auto; }

/* ---------- hover effects, only for a real mouse (no sticky hover after a tap) ---------- */
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(39, 48, 73, .8); }
  .btn:hover::after { transform: translateX(120%) skewX(-20deg); }
  .links a:hover { opacity: 1; }
  .links a:hover::after { transform: scaleX(1); transform-origin: left; }
  .rail button:hover span { opacity: 1; transform: none; }
  .rail button:hover i { transform: scale(1.12); }
  .folder:hover img:nth-of-type(1) { transform: translate(-30%, -40px) rotate(-13deg); }
  .folder:hover img:nth-of-type(2) { transform: translateY(-74px) rotate(0); }
  .folder:hover img:nth-of-type(3) { transform: translate(30%, -40px) rotate(13deg); }
  .folder:hover .folder-front { transform: rotateX(-16deg); }
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .grain { display: none; }
  .nav { gap: 10px; padding: 6px 6px 6px 14px; }
  .brand img { width: 62px; }
  .menu-btn {
    display: grid; place-content: center; gap: 5px; width: 42px; height: 42px; margin-left: auto; border-radius: 50%;
    border: 1px solid rgba(67, 78, 110, .2); background: rgba(255, 255, 255, .4); cursor: pointer; color: inherit;
  }
  .menu-btn i { display: block; width: 16px; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform .35s var(--ease); }
  .nav.open .menu-btn i:first-child { transform: translateY(3.25px) rotate(45deg); }
  .nav.open .menu-btn i:last-child { transform: translateY(-3.25px) rotate(-45deg); }
  .is-night .menu-btn { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); }
  .nav .links.glass {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; flex-direction: column; gap: 0;
    padding: 8px; border-radius: 20px; margin: 0;
    background: linear-gradient(140deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .72)); border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: 0 26px 60px -30px rgba(39, 48, 73, .55);
  }
  .is-night .nav .links.glass { background: linear-gradient(140deg, rgba(44, 53, 86, .96), rgba(30, 37, 64, .94)); border-color: rgba(255, 255, 255, .16); }
  .nav.open .links.glass { display: flex; }
  .links a { padding: 13px 14px; font-size: 16px; opacity: 1; }
  .links a::after { display: none; }
  .rail { right: 8px; top: calc(max(14px, env(safe-area-inset-top)) + 72px); transform: none; }
  .rail button { padding: 3px; }
  .rail button span { display: none; }
  .rail button i { width: 22px; height: 22px; font-size: 10px; }
  .rail ol { gap: 2px; }
  .tag { font-size: 11px; padding: 5px 8px; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 255, 255, .92); }
  .veil { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(20, 26, 48, calc(var(--veil, 0) * .72)); }
  .folders { grid-template-columns: repeat(2, 1fr); }
  .folder img { left: 17%; width: 66%; }
  .folder.open img:nth-of-type(1), .folder:focus-visible img:nth-of-type(1) { transform: translate(-17%, -30px) rotate(-8deg); }
  .folder.open img:nth-of-type(2), .folder:focus-visible img:nth-of-type(2) { transform: translateY(-56px); }
  .folder.open img:nth-of-type(3), .folder:focus-visible img:nth-of-type(3) { transform: translate(17%, -30px) rotate(8deg); }
  .facts { grid-template-columns: 1fr; }
  .cta-row .btn { flex: 1 1 auto; justify-content: center; min-height: 48px; }
  .block { margin-bottom: 14vh; }
}

/* Phones and tablets held upright: the tour panel becomes a compact bottom sheet; text and specs open on demand. */
@media (max-width: 900px) and (orientation: portrait) {
  .panel {
    left: 10px; right: 10px; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto;
    max-height: calc(100svh - 120px); padding: 14px 16px 12px; border-radius: 22px;
    transform: translateY(calc((1 - var(--pv, 0)) * 24px));
  }
  .panel-btn { display: inline-flex; }
  .rail.quiet { opacity: 0; pointer-events: none; }
  .panel h2 { font-size: 28px; }
  .panel-room { margin: 4px 0 10px; font-size: 13px; }
  .panel-body { display: none; }
  .panel.open .panel-body { display: block; }
  .panel-text { font-size: 14px; margin-bottom: 12px; }
  .specs { margin-bottom: 12px; font-size: 13px; }
  .stages { margin-bottom: 10px; }
  .stages li { font-size: 11px; padding: 5px 6px; gap: 5px; }
  .readout { min-height: 50px; padding: 9px 12px; }
  .readout strong { font-size: 24px; }
  .readout span { font-size: 13px; }
  .finale { top: auto; bottom: calc(9svh + env(safe-area-inset-bottom)); transform: translateY(calc((1 - var(--fv, 0)) * 30px)); }
  .hint { bottom: calc(3svh + env(safe-area-inset-bottom)); }
}

/* Phones turned sideways: side panel like desktop, just smaller. */
@media (orientation: landscape) and (max-height: 520px) {
  .nav { top: max(8px, env(safe-area-inset-top)); padding: 4px 4px 4px 12px; }
  .brand img { width: 52px; }
  .menu-btn { width: 36px; height: 36px; }
  .btn-sm { padding: .6em 1em; font-size: 13px; }
  .panel {
    left: max(10px, env(safe-area-inset-left)); top: 62px; width: min(330px, 42vw); max-height: calc(100svh - 72px);
    padding: 14px 16px 12px; border-radius: 20px; transform: translateX(calc((1 - var(--pv, 0)) * -24px));
  }
  .panel-btn { display: inline-flex; min-height: 30px; }
  .panel h2 { font-size: 26px; }
  .panel-room { margin: 4px 0 8px; font-size: 13px; }
  .panel-body { display: none; }
  .panel.open .panel-body { display: block; }
  .panel-text { font-size: 13.5px; margin-bottom: 10px; }
  .specs { font-size: 12.5px; margin-bottom: 10px; }
  .stages { margin-bottom: 8px; }
  .stages li { font-size: 11px; padding: 4px 6px; }
  .readout { min-height: 44px; padding: 8px 10px; }
  .readout strong { font-size: 22px; }
  .rail { top: 56px; }
  .rail.quiet { opacity: 0; pointer-events: none; }
  .hero h1 { font-size: clamp(56px, 25vh, 250px); height: 78vh; transform: translateY(2vh); }
  .hero-line, .hint { display: none; }
  .finale h2 { font-size: 44px; }
  .finale p { font-size: 15px; margin-bottom: 16px; }
}

@media (max-width: 560px) {
  .folders { grid-template-columns: 1fr; }
  .hero h1 { height: 56vh; }
  .rail.quiet { opacity: 0; pointer-events: none; }
  .hero-line { font-size: 15px; bottom: calc(15svh + env(safe-area-inset-bottom)); }
  .foot { flex-wrap: wrap; }
  .foot p:last-child { margin-left: 0; }
}

/* Weak phones (the page switches this on itself when frames start dropping): no live blur, solid glass instead. */
.lite .glass, .lite .tag, .lite .rail button span, .lite .veil { -webkit-backdrop-filter: none; backdrop-filter: none; }
.lite .glass { background: linear-gradient(140deg, rgba(255, 255, 255, .93), rgba(255, 255, 255, .8)); }
.lite.is-night .glass, .lite .after .glass { background: linear-gradient(140deg, rgba(48, 58, 92, .95), rgba(30, 37, 64, .92)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
