/* App pages in the Active Theory project language: a fixed WebGL room with the glass slab,
   HUD type in Kode Mono caps (white for titles, ice for everything said about them),
   frosted panels with the slab's cut corners. Code, file names and hashes keep their case. */
.app-page {
  --ice: #8ccbf2; --dim: #6d8aa6; --white: #eaf4ff;
  --edge: rgba(190, 220, 255, .16);
  --cut: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 10px 100%, 0 calc(100% - 10px));
  color: var(--white); background: var(--bg); overflow-x: hidden;
}
@media (prefers-reduced-motion: no-preference) { html:has(.app-page) { scroll-behavior: smooth; } }
.app-stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.app-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.app-page main, .app-footer { position: relative; z-index: 1; }
.app-page .hud { z-index: 40; }
.app-page :focus-visible { outline: 2px solid #c3e3ff; outline-offset: 4px; }
.app-page code, .app-page pre, .app-page .mono, .app-page .file, .app-page .hash, .app-page .chips li { text-transform: none; letter-spacing: 0; }
.app-page code { color: var(--white); font-family: var(--mono); font-size: .95em; }

.hud .wave svg { pointer-events: none; }

/* ---------- hero: the opened-project state ---------- */
.app-hero { position: relative; height: 100svh; min-height: 620px; }
.hero-slab { position: absolute; left: 50%; top: 50%; width: min(63vw, 60.5svh * 1.67); aspect-ratio: 1.67; transform: translate(-50%, -50%); }
.hero-slab img, .end-slab img, .mockup-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: var(--cut); }
/* Without WebGL the first shot stands in for the slab; the others stay readable but unseen. */
.hero-slab figure { position: absolute; inset: 0; margin: 0; }
.hero-slab > :not(:first-child), .hero-slab figcaption { opacity: 0; }
.has-stage .hero-slab img, .has-stage .end-slab img, .has-stage .mockup-screen img { opacity: 0; }
.app-display { margin: 0; font-weight: 400; font-size: clamp(38px, 5.6vw, 88px); line-height: .92; letter-spacing: -.01em; text-transform: uppercase; color: var(--white); text-shadow: 0 2px 30px #0009; }
.app-display .line { display: block; }
.app-display .serif, .app-h2 .serif { color: var(--ice); font-style: normal; font-family: inherit; }
.app-hero .app-display { position: absolute; left: clamp(20px, 4vw, 58px); top: clamp(96px, 13svh, 120px); max-width: 60vw; z-index: 2; }
.app-hint { position: absolute; left: 50%; bottom: max(22px, calc(50svh - min(63vw, 60.5svh * 1.67) / 3.34 - 58px)); transform: translateX(-50%); margin: 0; font-size: 13px; letter-spacing: .08em; color: #d2e2ef; opacity: .85; white-space: nowrap; }
.hero-count { position: absolute; right: calc(50% - min(63vw, 60.5svh * 1.67) / 2); top: calc(50% + min(63vw, 60.5svh * 1.67) / 3.34 + 16px); margin: 0; font-size: 10px; letter-spacing: .08em; color: var(--dim); white-space: nowrap; }
.hero-hud { position: absolute; left: clamp(20px, 4vw, 58px); bottom: clamp(70px, 11svh, 110px); width: min(400px, 32vw); display: grid; justify-items: start; gap: 12px; z-index: 2; text-shadow: 0 1px 14px #000d, 0 0 3px #0009; }
.hero-hud > * { margin: 0; }
.hud-eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; }
.hud-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ice); box-shadow: 0 0 10px var(--ice); animation: app-pulse 2.4s ease-in-out infinite; }
@keyframes app-pulse { 50% { opacity: .35; } }
.hud-lede, .hud-fine { color: var(--ice); line-height: 1.55; }
.hud-fine { color: var(--dim); font-size: 12px; }
.hud-links { display: grid; justify-items: start; gap: 10px; }
.hud-link, .app-link { color: var(--ice); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color .3s; }
.hud-link:hover, .app-link:hover { color: var(--white); }
.hero-cards { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.hero-cards > .glass-panel { pointer-events: auto; position: absolute; right: clamp(20px, 4vw, 58px); width: min(250px, 19vw); translate: calc(var(--px, 0) * var(--d, 10) * 1px) calc(var(--py, 0) * var(--d, 10) * .7px); transition: translate .9s cubic-bezier(.18,1,.22,1); }
.hero-cards .at-right { top: 25%; --d: 14; }
.hero-cards .at-left { top: 45%; --d: 22; }
.hero-cards .at-corner { top: 66%; --d: 9; }

/* ---------- glass panels ---------- */
.glass-panel { position: relative; padding: 16px 18px; clip-path: var(--cut); background: linear-gradient(160deg, rgba(48, 64, 82, .42), rgba(10, 14, 20, .7)); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 0 rgba(255,255,255,.12); font-size: 12px; line-height: 1.6; }
[data-tilt] { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .7s cubic-bezier(.18,1,.22,1); will-change: transform; }
[data-tilt].is-tilting { transition-duration: .25s; }
[data-tilt]::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--lx, 30%) var(--ly, 0%), rgba(214, 236, 255, .14), transparent 55%); opacity: 0; transition: opacity .5s; }
[data-tilt].is-tilting::after { opacity: 1; }
.ui-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--white); }
.ui-muted, .mono-dim { color: var(--dim); }
.ui-copy { margin: 0 0 10px; color: var(--ice); }
.ui-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--ice); }
.ui-list li { display: flex; align-items: center; gap: 8px; }
.ui-list li::before { content: "->"; color: var(--dim); }
.ui-list li.is-current { color: var(--white); }
.ui-list .mono { margin-left: auto; color: var(--white); }
.tag { padding: 1px 6px; border-radius: 3px; background: rgba(140, 203, 242, .16); color: var(--white); font-size: 10px; }
.code-card p { margin: 0; }
.mono-indent { padding-left: 1.5em; }
.mono-str { color: #f0d39a; text-transform: none; }
.mono-key { color: var(--ice); }
.mono-ok { color: #9be3c8; }
.layer-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; color: var(--ice); }
.mask-thumb { width: 22px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, #fff, #000); box-shadow: inset 0 0 0 1px var(--edge); }
.slider { position: relative; height: 3px; margin-top: 12px; border-radius: 3px; background: rgba(255,255,255,.14); }
.slider span { position: absolute; left: 0; top: 0; bottom: 0; width: 38%; border-radius: inherit; background: var(--ice); }
.slider span::after { content: ""; position: absolute; right: -5px; top: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--white); box-shadow: 0 0 10px var(--ice); }

/* ---------- compatibility strip ---------- */
.app-strip { display: grid; gap: 14px; padding: 46px clamp(20px, 4vw, 58px); border-block: 1px solid rgba(190, 220, 255, .1); background: linear-gradient(90deg, rgba(8, 12, 18, .75), rgba(8, 12, 18, .35)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.strip-row { display: grid; grid-template-columns: minmax(180px, 24%) 1fr; gap: 20px; align-items: baseline; }
.strip-label { margin: 0; color: var(--white); }
.wordmarks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--ice); }
.wordmarks li::before { content: "-> "; color: var(--dim); }

/* ---------- feature sections ---------- */
.app-feature { padding: clamp(90px, 16vh, 170px) clamp(20px, 4vw, 58px); }
.app-eyebrow { margin: 0 0 22px; color: var(--dim); font-size: 12px; letter-spacing: .1em; }
.app-h2 { margin: 0; font-weight: 400; font-size: clamp(32px, 4.4vw, 68px); line-height: .94; letter-spacing: -.01em; text-transform: uppercase; color: var(--white); text-shadow: 0 2px 30px #0008; }
.app-lede { margin: 26px 0 0; max-width: 46ch; color: var(--ice); line-height: 1.65; }
.app-lede p { margin: 0 0 14px; }
.app-note { color: var(--dim); font-size: 12px; }
.feature-head { margin-bottom: clamp(40px, 7vh, 70px); }

.app-editor { display: grid; grid-template-columns: minmax(0, 36fr) minmax(0, 58fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
.app-mockup { position: sticky; top: 16vh; margin: 0; }
.mockup-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; font-size: 12px; color: var(--dim); }
.mockup-caption { color: var(--white); }
.segmented { display: flex; gap: 6px; padding: 5px; border-radius: 5px; border: 1px solid #5d77904d; background: #0c1520a6; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.segmented button, .copy { min-height: 30px; padding: 0 12px; border-radius: 4px; border: 1px solid #6c86a066; background: #13202e; color: #9fc4e3; font: inherit; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background .3s, color .3s, border-color .3s; }
.segmented button:hover, .copy:hover { color: var(--white); border-color: #9cc6e888; }
.segmented button[aria-pressed="true"] { background: #d9ecff; border-color: #d9ecff; color: #08111b; }
.mockup-screen { position: relative; aspect-ratio: 1.67; }
.app-specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 34px; counter-reset: spec; }
.app-specs li { display: grid; gap: 10px; justify-items: start; }
.app-specs h3, .app-grid4 h3 { margin: 0; font: inherit; color: var(--white); }
.app-specs h3::before, .app-grid4 h3::before { content: "-> "; color: var(--ice); }
.app-specs p, .app-grid4 p { margin: 0; color: var(--ice); line-height: 1.65; max-width: 48ch; }
.text-button { padding: 0; border: 0; background: none; font: inherit; font-size: 12px; color: var(--dim); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; transition: color .3s; }
.text-button:hover { color: var(--white); }

.mockup-ai { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 18px; margin-bottom: clamp(50px, 8vh, 80px); align-items: stretch; }
.panel-label { margin: 0 0 14px; color: var(--dim); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 4px 9px; border-radius: 4px; border: 1px solid #6c86a055; background: rgba(19, 32, 46, .7); color: var(--ice); font-size: 12px; }
.panel-code pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.65 var(--mono); color: var(--white); }
.app-grid4 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); }
.app-grid4 li { display: grid; gap: 12px; align-content: start; }
.app-grid4 p { font-size: 13px; }

.card-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.app-card { padding: 28px 28px 24px; display: grid; gap: 12px; justify-items: start; align-content: start; font-size: 13px; }
.card-kicker { margin: 0; color: var(--dim); font-size: 12px; }
.app-card h3 { margin: 0; font-weight: 400; font-size: clamp(26px, 2.4vw, 38px); line-height: 1; text-transform: uppercase; }
.file { margin: 0 0 6px; color: var(--ice); font-size: 13px; }
.app-pill { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid #8fc1e6aa; background: rgba(140, 203, 242, .08); color: var(--white); text-decoration: none; font-size: 12px; letter-spacing: .06em; transition: background .3s, border-color .3s; }
.app-pill:hover { background: rgba(140, 203, 242, .2); border-color: var(--white); }
.app-pill span { color: var(--ice); }
.app-card details { width: 100%; margin-top: 10px; border-top: 1px solid rgba(190, 220, 255, .14); }
.app-card summary { display: flex; justify-content: space-between; gap: 12px; padding: 16px 0 4px; cursor: pointer; list-style: none; color: var(--white); font-size: 12px; }
.app-card summary::-webkit-details-marker { display: none; }
.app-card summary::after { content: "+"; color: var(--ice); transition: transform .4s; }
.app-card details[open] summary::after { transform: rotate(45deg); }
.detail-copy { padding-top: 10px; color: var(--ice); font-size: 12px; line-height: 1.65; }
.detail-copy ul { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.detail-copy li::before { content: "-> "; color: var(--dim); }
.detail-copy p { margin: 0 0 8px; }
.hash { overflow-wrap: anywhere; color: var(--white); font-size: 11px; }

.snippet { padding: 0; overflow: hidden; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-bottom: 1px solid rgba(190, 220, 255, .12); color: var(--white); font-size: 12px; }
.snippet pre { margin: 0; padding: 18px; overflow: auto; font: 12px/1.7 var(--mono); color: var(--ice); }
.copy-feedback { min-height: 1.6em; margin: 16px 0 0; color: var(--dim); font-size: 12px; }

/* ---------- finale: the slab comes back, bookending the hero ---------- */
.app-end { position: relative; min-height: 100svh; padding: clamp(110px, 16vh, 160px) clamp(20px, 4vw, 58px) clamp(70px, 10vh, 100px); display: grid; align-content: space-between; }
.end-slab { position: absolute; right: clamp(20px, 6vw, 100px); top: 50%; width: min(52vw, 56svh * 1.67); aspect-ratio: 1.67; transform: translateY(-50%); }
.app-end .app-h2 { position: relative; z-index: 2; font-size: clamp(38px, 5.6vw, 88px); max-width: 12ch; }
.end-copy { position: relative; z-index: 2; width: min(420px, 34vw); display: grid; justify-items: start; gap: 14px; color: var(--ice); line-height: 1.6; text-shadow: 0 1px 14px #000d; }
.end-copy p { margin: 0; }
.end-copy a:not(.app-pill) { color: var(--white); text-underline-offset: 4px; }

.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 30px; padding: 28px clamp(20px, 4vw, 58px) calc(28px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(190, 220, 255, .1); font-size: 12px; color: var(--dim); background: rgba(8, 10, 14, .7); }
.app-footer p { margin: 0; color: var(--white); }
.app-footer p span { color: var(--dim); margin-left: 8px; }
.app-footer nav { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.app-footer a { color: var(--ice); text-decoration: none; transition: color .3s; }
.app-footer a:hover { color: var(--white); }

/* ---------- entrances ---------- */
.app-reveal { opacity: 0; translate: 0 26px; transition: opacity 1s cubic-bezier(.18,1,.22,1), translate 1.2s cubic-bezier(.18,1,.22,1); }
.app-reveal.is-in { opacity: 1; translate: 0 0; }
.hero-cards > * { opacity: 0; transition: opacity 1s ease, translate .9s cubic-bezier(.18,1,.22,1); }
.is-ready .hero-cards > * { opacity: 1; }
.is-ready .hero-cards .at-left { transition-delay: .9s, 0s; }
.is-ready .hero-cards .at-right { transition-delay: 1.05s, 0s; }
.is-ready .hero-cards .at-corner { transition-delay: 1.2s, 0s; }

@media (max-width: 1100px) {
  .hero-cards > * { width: min(230px, 24vw); }
  .mockup-ai { grid-template-columns: 1fr 1fr; }
  .mockup-ai .panel-code { grid-column: 1 / -1; grid-row: 1; }
  .app-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-hero { height: auto; min-height: 0; padding: 92px 16px 40px; display: grid; gap: 22px; }
  .hero-slab { position: relative; left: auto; top: auto; transform: none; width: 100%; }
  .app-hero .app-display { position: static; max-width: none; font-size: clamp(34px, 10vw, 54px); }
  .app-hint { display: none; }
  .hero-count { position: static; justify-self: end; margin-top: -10px; }
  .hero-hud { position: static; width: auto; }
  .hero-cards { position: static; display: grid; gap: 12px; }
  .hero-cards > .glass-panel { position: relative; inset: auto; right: auto; width: auto; translate: none; }
  .hero-cards .at-left, .hero-cards .at-right, .hero-cards .at-corner { top: auto; }
  .app-strip { padding: 30px 16px; }
  .strip-row { grid-template-columns: 1fr; gap: 10px; }
  .app-feature { padding: 80px 16px; }
  .app-editor { grid-template-columns: 1fr; }
  .app-mockup { position: relative; top: auto; order: -1; }
  .mockup-bar { flex-direction: column; align-items: flex-start; }
  .mockup-ai, .card-pair, .app-grid4 { grid-template-columns: 1fr; }
  .mockup-ai .panel-code { grid-row: auto; }
  .app-end { min-height: 0; padding: 80px 16px 60px; gap: 26px; align-content: start; }
  .end-slab { position: relative; right: auto; top: auto; transform: none; width: 100%; order: -1; }
  .end-copy { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .app-reveal, .hero-cards > * { opacity: 1; translate: none; transition: none; }
  .hud-eyebrow .dot { animation: none; }
}
