/* KG Studios motion layer: 3D hero deck, scroll scene, game, cursor, curtain, calculator, consent. Loads after main.css. */

[hidden] { display: none !important; }

/* Entry curtain: slides up once per session. Pure CSS so it can never get stuck. */
.curtain { position: fixed; inset: 0; z-index: 300; background: var(--ink); display: grid; place-items: center; animation: curtainUp .9s var(--ease) .55s forwards; }
.curtain img { width: 150px; height: auto; animation: logoIn .8s var(--ease) both; }
.seen .curtain, .reduce-motion .curtain { display: none; }
@keyframes curtainUp { to { transform: translateY(-100%); visibility: hidden; } }
@keyframes logoIn { from { opacity: 0; transform: translateY(14px); } }

/* Cursor with context labels (fine pointers only) */
.cursor { position: fixed; left: 0; top: 0; z-index: 250; pointer-events: none; display: none; opacity: 0; transition: opacity .3s; }
.cursor.is-on { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .cursor { display: block; } }
.cursor span { display: grid; place-items: center; width: 5.5rem; height: 5.5rem; margin: -2.75rem 0 0 -2.75rem; background: var(--paper); mix-blend-mode: difference; color: var(--ink); font: 600 var(--s-small)/1 var(--body); transform: scale(.16); transition: transform .3s var(--ease), background .3s; }
.cursor.is-link span { transform: scale(1); mix-blend-mode: normal; background: var(--gold); }
.cursor.is-small span { transform: scale(.36); }
.cursor span::after { content: attr(data-label); }
.reduce-motion .cursor { display: none; }

/* Page transitions (Chromium; others simply navigate) */
@media (prefers-reduced-motion: no-preference) {
	@view-transition { navigation: auto; }
	::view-transition-old(root) { animation: vtOut .3s var(--ease) both; }
	::view-transition-new(root) { animation: vtIn .5s var(--ease) both; }
}
@keyframes vtOut { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(16px); } }

/* Scroll scene: chaos to clarity. motion.js sets --p on .scene. */
.scene { position: relative; height: 190svh; --p: 0; }
.scene__stick { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: 2.5rem; padding: 4rem var(--m) 1rem; overflow: hidden; }
.scene__copy { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 3rem; }
.scene__copy .soft { max-width: 26rem; margin: 0; }
.scene__h { margin: 0; }
/* One heading whose words change at the half-way point (motion.js sets data-state), so nothing ever overlaps it. */
.scene__a { display: none; }
.scene[data-state="a"] .scene__a { display: inline; }
.scene[data-state="a"] .scene__b { display: none; }
.scene__stage { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; perspective: 1400px; transform-style: preserve-3d; }
.tile { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper); will-change: transform; transform: translate3d(calc(var(--x) * (1 - var(--p)) * 1px), calc(var(--y) * (1 - var(--p)) * 1px), calc(var(--z) * (1 - var(--p)) * 1px)) rotateX(calc(var(--rx) * (1 - var(--p)) * 1deg)) rotateY(calc(var(--ry) * (1 - var(--p)) * 1deg)) rotate(calc(var(--r) * (1 - var(--p)) * 1deg)); }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile__after { position: absolute; inset: 0; opacity: clamp(0, calc((var(--p) - .2) * 2.2), 1); }
@media (max-width: 900px) {
	.scene { height: auto; --p: 1 !important; }
	.scene__stick { position: static; height: auto; grid-template-columns: minmax(0, 1fr); padding: var(--gap) var(--m); overflow: visible; }
	.scene__a { display: none !important; }
	.scene__b { display: inline !important; }
	.scene__stage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.scene__copy { display: block; }
}
.reduce-motion .scene { height: auto; --p: 1 !important; }
.reduce-motion .scene__stick { position: static; height: auto; padding-block: var(--gap); overflow: visible; }
.reduce-motion .scene__a { display: none !important; }
.reduce-motion .scene__b { display: inline !important; }

/* Fix this slide: the stage is a real interface fragment (data-ui), so it keeps its own light slide look */
.game { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.game__status { font: 700 var(--s-head)/1 var(--display); letter-spacing: -.04em; margin: 1.4rem 0; font-variant-numeric: tabular-nums; }
.game__win { font-weight: 600; margin-bottom: 1.2rem; }
.game__win .btn { margin-top: .8rem; }
.game__stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--slide-ground); touch-action: none; container-type: inline-size; }
/* Each block sits at its slot (left/top) and is moved away from it with transform only: --dx and --dy are percentages of the stage. */
.blk { position: absolute; display: grid; place-items: center; background: var(--slide-card); border: 2px solid var(--slide-line); color: var(--slide-text); font: 600 var(--s-small)/1 var(--body); font-size: clamp(.6875rem, 2.2cqw, .875rem); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; z-index: 1; transform: translate(calc(var(--dx, 0) * 1cqw), calc(var(--dy, 0) * .5625cqw)) rotate(var(--r, 0deg)); transition: transform .55s var(--ease), border-color .3s, box-shadow .3s; }
.blk.is-drag { transition: none; cursor: grabbing; z-index: 5; box-shadow: var(--shadow); /* taste-skill-ignore: a block being dragged floats */ }
.blk.is-set { cursor: default; border-color: var(--gold); z-index: 0; }
.blk--headline { background: var(--slide-ink); color: var(--slide-card); }
.blk--logo { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.blk--image { background: var(--slide-teal); }
.blk--points { background: var(--slide-soft); }
.blk--number { background: var(--slide-ink); color: var(--gold); }
.blk--chart { background: var(--slide-card); place-items: start center; padding-top: 6%; }
.blk__bars { position: absolute; left: 17%; right: 17%; bottom: 10%; height: 52%; display: flex; align-items: flex-end; gap: 7%; }
.blk__bars i { flex: 1; background: var(--gold); }
.blk__bars i:nth-child(1) { height: 38%; } .blk__bars i:nth-child(2) { height: 62%; } .blk__bars i:nth-child(3) { height: 50%; } .blk__bars i:nth-child(4) { height: 92%; background: var(--teal); }

/* Calculator */
.calc { background: var(--tile); padding: clamp(1.4rem, 3vw, 2.5rem); max-width: 52rem; }
.calc__row { display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem; align-items: center; font-weight: 600; }
.calc__row input { grid-column: 1 / -1; width: 100%; accent-color: var(--ink); }
.calc__row b { font: 700 var(--s-lead)/1 var(--display); }
.calc__out { font: 700 var(--s-head)/.95 var(--display); letter-spacing: -.04em; margin: 1.4rem 0 1rem; }

/* Consent, WhatsApp */
.consent { position: fixed; left: 50%; bottom: 1rem; z-index: 260; width: min(640px, 100% - 2rem); transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; box-shadow: var(--shadow); /* taste-skill-ignore: dialog */ }
.consent p { margin: 0; flex: 1 1 260px; font-size: var(--s-small); }
.consent__btns { display: flex; gap: .5rem; }
.consent .btn { min-height: 2.6rem; padding: .6rem 1.1rem; font-size: var(--s-small); }
.wa { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 140; padding: 1rem 1.3rem; background: var(--ink); color: var(--paper); font: 600 var(--s-small)/1 var(--body); transition: transform .3s var(--ease); }
.wa:hover { transform: translateY(-3px); }

@media (max-width: 980px) {
	.game { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) { .consent { bottom: .6rem; } }

/* Manual "reduce motion" switch (footer). Mirrors prefers-reduced-motion. */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
.reduce-motion [data-reveal] { opacity: 1 !important; transform: none !important; }
