:root {
  color-scheme: dark;
  --bg: #071a13;
  --bg-2: #0c2a1e;
  --ink: #eef6ef;
  --muted: #a8c1b2;
  --accent: #c5e5bd;
  --line: rgba(197, 229, 189, .18);
  --ease: cubic-bezier(.22, .7, .18, 1);
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- header ---------- */
.top { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 22px clamp(16px, 4vw, 56px); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand span { font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
#motion { border: 1px solid var(--line); background: rgba(7, 26, 19, .62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 999px; padding: 9px 15px; font-size: 12px; font-weight: 500; }

.eyebrow { margin: 0 0 16px; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.eyebrow b { display: inline-block; min-width: 28px; font-weight: 600; color: var(--ink); }
.lead { margin: 18px 0 0; font-size: clamp(15px, 1.25vw, 18px); line-height: 1.55; color: #d5e4da; max-width: 440px; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.035em; line-height: 1.04; text-wrap: balance; }

/* ---------- story ---------- */
/* About 60vh of scrolling per step. */
.story { position: relative; height: 520vh; }
#celek, #vse { height: 400vh; }
.story-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #050f0b; }
.films, .film, .shade { position: absolute; inset: 0; }
.film { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.1s var(--ease); }
.film.is-on { opacity: 1; }
.shade { background:
  linear-gradient(90deg, rgba(4, 16, 11, .86) 0%, rgba(4, 16, 11, .55) 34%, rgba(4, 16, 11, .08) 62%, rgba(4, 16, 11, .30) 100%),
  linear-gradient(0deg, rgba(4, 16, 11, .72) 0%, rgba(4, 16, 11, 0) 34%, rgba(4, 16, 11, 0) 78%, rgba(4, 16, 11, .45) 100%); }

.copy { position: absolute; left: clamp(16px, 6vw, 96px); bottom: 22vh; width: min(660px, 48vw); min-height: 260px; }
.beat { position: absolute; left: 0; bottom: 0; width: 100%; opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .9s var(--ease); pointer-events: none; text-shadow: 0 2px 30px rgba(0, 0, 0, .35); }
.beat.is-on { opacity: 1; transform: none; transition-delay: .18s; }
.beat.was { transform: translateY(-14px); }
.beat h1 { font-size: clamp(44px, 5.2vw, 82px); }
.beat h2 { font-size: clamp(38px, 4.8vw, 74px); }
.story:not(.office) .lead { font-size: clamp(17px, 1.45vw, 21px); max-width: 520px; }

.phone { position: absolute; margin: 0; right: clamp(16px, 9vw, 150px); top: 50%; height: min(78svh, 740px); aspect-ratio: 390 / 888; padding: 11px; border-radius: 52px; background: linear-gradient(145deg, #2a302d, #0b0d0c 40%, #1b1f1d); box-shadow: 0 0 0 1.5px #3b423e inset, 0 50px 90px -20px rgba(0, 0, 0, .75), 0 18px 40px rgba(0, 0, 0, .45); transform: translate(0, calc(-50% + 70px)) scale(.94); opacity: 0; transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.phone.is-on { opacity: 1; transform: translate(0, -50%); }
.phone::before { content: ""; position: absolute; z-index: 3; top: 17px; left: 50%; width: 28%; height: 20px; transform: translateX(-50%); border-radius: 20px; background: #050606; }
.phone-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 42px; background: #f1ece3; transition: background-color .6s var(--ease); }
.phone-screen img { position: absolute; left: 0; top: 4.95%; width: 100%; height: 95.05%; object-fit: cover; opacity: 0; transform: translateX(9%); transition: opacity .6s var(--ease), transform .8s var(--ease); }
.phone-screen img.is-on { opacity: 1; transform: none; }
.phone-screen img.was { transform: translateX(-6%); }
.tap { position: absolute; z-index: 2; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, .5); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 6px 20px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; }
.tap.go { animation: tap 1.9s .9s var(--ease) 2 both; }
@keyframes tap { 0% { opacity: 0; transform: scale(1.6); } 22% { opacity: 1; transform: scale(1); } 34% { transform: scale(.82); } 60% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

/* ---------- notebook (office chapter) ---------- */
#kancelar { height: 580vh; }
.office .copy { width: min(470px, 32vw); }
.office .beat h2 { font-size: clamp(30px, 3.3vw, 52px); }
.laptop { position: absolute; margin: 0; right: clamp(16px, 4vw, 72px); top: 50%; width: min(57vw, 980px); opacity: 0; transform: translateY(calc(-50% + 70px)) scale(.95); transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.laptop.is-on { opacity: 1; transform: translateY(-50%); }
.laptop-lid { position: relative; padding: 1.5% 1.5% 2.1%; border-radius: 18px 18px 6px 6px; background: linear-gradient(160deg, #2c322f, #0e1110 45%, #1b201e); box-shadow: 0 0 0 1.5px #3b423e inset, 0 50px 90px -30px rgba(0, 0, 0, .75); }
.laptop-lid::before { content: ""; position: absolute; top: .55%; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #2f3633; box-shadow: 0 0 0 1px #0a0c0b; }
.laptop-screen { position: relative; aspect-ratio: 1440 / 900; overflow: hidden; border-radius: 4px; background: #f1ece3; }
.laptop-screen img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: translateX(4%); transition: opacity .6s var(--ease), transform .8s var(--ease); }
.laptop-screen img.is-on { opacity: 1; transform: none; }
.laptop-screen img.was { transform: translateX(-3%); }
.laptop-base { position: relative; height: clamp(10px, 1.3vw, 20px); margin: 0 -6.5%; border-radius: 2px 2px 16px 16px / 2px 2px 12px 12px; background: linear-gradient(180deg, #e2e6e3 0%, #a9afab 45%, #6b716d 100%); box-shadow: 0 34px 60px -14px rgba(0, 0, 0, .7); }
.laptop-base::before { content: ""; position: absolute; left: 50%; top: 0; width: 15%; height: 42%; transform: translateX(-50%); border-radius: 0 0 8px 8px; background: rgba(40, 46, 43, .35); }

.steps { position: absolute; left: clamp(16px, 6vw, 96px); bottom: 7vh; display: flex; gap: 6px; }
.steps button { position: relative; border: 0; background: none; padding: 14px 0 4px; width: 104px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); }
.steps button::before { content: ""; position: absolute; left: 0; right: 10px; top: 0; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .2); }
.steps button::after { content: ""; position: absolute; left: 0; top: 0; height: 2px; border-radius: 2px; background: var(--accent); width: calc((100% - 10px) * var(--fill, 0)); }
.steps button[aria-current] { color: var(--ink); }
.hint { position: absolute; right: clamp(16px, 4vw, 56px); bottom: 7vh; margin: 0; font-size: 12px; color: var(--muted); transition: opacity .5s; }
.story.past-start .hint { opacity: 0; }

/* ---------- 3D assembly ---------- */
.assembly { position: relative; height: 560vh; background: radial-gradient(120% 80% at 70% 60%, #123a2a 0%, var(--bg) 62%); }
.assembly-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.assembly-copy { position: absolute; z-index: 2; left: clamp(16px, 6vw, 96px); top: 15vh; width: min(460px, 32vw); }
.assembly-copy h2 { font-size: clamp(30px, 3.1vw, 50px); }
#assembly-lead { transition: opacity .4s; min-height: 3.2em; }
.view3d { position: absolute; inset: 0; perspective: 2600px; perspective-origin: 50% 38%; }
.scene { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; transform-style: preserve-3d; transform-origin: 0 0; will-change: transform; }
.plate { position: absolute; inset: 0; border-radius: 22px; background: #f1ece3 url(./app/layers/layer-base.png) 0 0 / 100% 100%; transform-style: preserve-3d; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5) inset; }
.plate-edge { position: absolute; inset: 0; border-radius: 22px; background: #c9c1b2; }
.plate-glow { position: absolute; inset: 2%; border-radius: 40px; box-shadow: 0 70px 140px 40px rgba(0, 0, 0, .5); }
.piece { position: absolute; transform-style: preserve-3d; will-change: transform; }
.piece-face { position: absolute; inset: 0; background-size: 100% 100%; border-radius: inherit; }
.piece-edge { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, #d8d1c3, #b8b09f); }
.piece-shadow { position: absolute; inset: 6%; border-radius: inherit; background: rgba(23, 33, 26, .32); box-shadow: 0 0 28px 16px rgba(23, 33, 26, .32); opacity: 0; will-change: transform, opacity; }
.tags2d { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; margin-top: -8px; padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; color: #0b2419; background: var(--accent); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); opacity: 0; will-change: transform, opacity; }
.tag-anchor { position: absolute; left: 50%; top: 0; width: 1px; height: 1px; }
/* Final line-up: monitor behind the scene, tablet and phone in front of it. Positions come from p360.js. */
.lineup-back, .lineup-front { position: absolute; inset: 0; pointer-events: none; }
.monitor, .tablet, .mini-phone { position: absolute; visibility: hidden; opacity: 0; will-change: transform, opacity; }
.monitor { border-radius: calc(var(--u, 800px) * .014); background: linear-gradient(170deg, #2a302d, #0c0f0e 40%, #171b19); box-shadow: 0 0 0 1px #3b423e inset, 0 60px 110px -30px rgba(0, 0, 0, .8); }
.monitor-stand { position: absolute; left: 50%; top: 100%; width: calc(var(--u, 800px) * .11); height: calc(var(--u, 800px) * .13); transform: translateX(-50%); background: linear-gradient(90deg, #7d837f, #cfd4d1 45%, #8a908c); }
.monitor-stand::after { content: ""; position: absolute; left: 50%; bottom: 0; width: calc(var(--u, 800px) * .34); height: calc(var(--u, 800px) * .022); transform: translate(-50%, 60%); border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #d8dcd9, #8f9591); box-shadow: 0 18px 30px -8px rgba(0, 0, 0, .6); }
.tablet, .mini-phone { box-sizing: border-box; background: linear-gradient(150deg, #2c322f, #0b0d0c 45%, #1b1f1d); box-shadow: 0 0 0 1px #3b423e inset, 0 40px 70px -20px rgba(0, 0, 0, .75); }
.tablet { border-radius: 4.5% / 6.5%; }
.mini-phone { border-radius: 16% / 7.5%; }
.tablet img, .mini-phone img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tablet img { border-radius: 2.2% / 3.2%; }
.mini-phone img { border-radius: 12% / 5.5%; }
.flat-fallback { display: none; }

/* ---------- outro ---------- */
.outro { position: relative; padding: 18vh clamp(16px, 6vw, 96px) 12vh; text-align: center; background: var(--bg); }
.outro h2 { font-size: clamp(34px, 4.4vw, 66px); }
.outro > p { margin: 18px auto 0; color: #d5e4da; font-size: 17px; line-height: 1.55; }
.button { display: inline-block; margin-top: 34px; padding: 15px 24px; border-radius: 999px; background: var(--accent); color: #0b2419; font-weight: 600; font-size: 15px; }
.outro .credits { max-width: 560px; margin-top: 80px; font-size: 12px; color: #7f9a8a; }
.outro .mail { margin-top: 14px; font-size: 15px; color: var(--muted); }
.outro .legal { margin-top: 14px; font-size: 12px; color: #7f9a8a; }
.outro .legal a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- phone layout ---------- */
@media (max-width: 760px) {
  .brand span { display: none; }
  .story { height: 490vh; }
  #celek, #vse { height: 380vh; }
  .shade { background: linear-gradient(180deg, rgba(4, 16, 11, .88) 0%, rgba(4, 16, 11, .55) 34%, rgba(4, 16, 11, .10) 58%, rgba(4, 16, 11, .55) 100%); }
  .copy { left: 20px; right: 20px; top: 84px; bottom: auto; width: auto; min-height: 0; }
  .beat { top: 0; bottom: auto; }
  .beat h1 { font-size: 38px; }
  .beat h2 { font-size: 32px; }
  .lead { font-size: 15px; margin-top: 12px; }
  .story:not(.office) .lead { font-size: 16px; }
  .eyebrow { margin-bottom: 10px; }
  .phone { right: auto; left: 50%; top: auto; bottom: 64px; height: min(50svh, 420px); padding: 7px; border-radius: 34px; transform: translate(-50%, 60px) scale(.94); }
  .phone.is-on { transform: translate(-50%, 0); }
  .phone::before { top: 11px; height: 12px; }
  .phone-screen { border-radius: 28px; }
  .tap { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
  .steps { left: 20px; right: 20px; bottom: 22px; justify-content: space-between; }
  .steps button { width: auto; flex: 1; font-size: 11px; padding-top: 10px; }
  .hint { display: none; }
  #kancelar { height: 540vh; }
  .office .copy { width: auto; }
  .office .beat h2 { font-size: 27px; }
  .laptop { right: auto; left: 50%; top: auto; bottom: 78px; width: calc(100vw - 32px); transform: translate(-50%, 60px) scale(.95); }
  .laptop.is-on { transform: translate(-50%, 0); }
  .laptop-lid { border-radius: 10px 10px 4px 4px; }
  .laptop-base { margin: 0 -3%; }
  .assembly { height: 480vh; }
  .assembly-copy { top: 80px; left: 20px; right: 20px; width: auto; }
  .assembly-copy h2 { font-size: 30px; }
  .tag { padding: 5px 8px; font-size: 11px; }
  .lead { max-width: none; }

}
@media (max-height: 560px) and (min-width: 761px) { .copy { bottom: 16vh; } .steps { bottom: 4vh; } }

/* ---------- reduced motion / no JS ---------- */
/* "Reduce motion" until the visitor taps "Spustit pohyb" (class set by p360.js):
   the same story with still footage and cross-fades only, no sliding. */
html.motion-calm .film, html.motion-calm .phone-screen img, html.motion-calm .laptop-screen img,
html.motion-calm .beat, html.motion-calm .beat.is-on, html.motion-calm .beat.was,
html.motion-calm .phone-screen img.was, html.motion-calm .laptop-screen img.was { transform: none; transition: opacity .5s ease; transition-delay: 0s; }
html.motion-calm .phone, html.motion-calm .phone.is-on { transform: translate(0, -50%); transition: opacity .5s ease; }
html.motion-calm .laptop, html.motion-calm .laptop.is-on { transform: translateY(-50%); transition: opacity .5s ease; }
html.motion-calm .tap { display: none; }
html.motion-calm #motion { border-color: transparent; background: var(--accent); color: #0b2419; font-weight: 600; }
html.motion-calm #motion::before { content: ""; display: inline-block; margin-right: 7px; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
@media (max-width: 760px) {
  html.motion-calm .phone, html.motion-calm .phone.is-on, html.motion-calm .laptop, html.motion-calm .laptop.is-on { transform: translate(-50%, 0); }
}
/* Calm 3D swaps between still states with a short fade. */
.view3d, .lineup-back, .lineup-front, .tags2d { transition: opacity .26s ease; }
.assembly.swap .view3d, .assembly.swap .lineup-back, .assembly.swap .lineup-front, .assembly.swap .tags2d { opacity: 0; }
html.no-3d .view3d { display: none; }
html.no-3d .flat-fallback { display: block; position: absolute; left: 50%; top: 58%; width: min(88vw, 1100px); height: auto; transform: translate(-50%, -50%); border-radius: 14px; box-shadow: 0 40px 80px rgba(0, 0, 0, .5); }
html.no-3d .assembly { height: auto; min-height: 100svh; }
