@font-face {
  font-family: Geist;
  src: url('/assets/geist-regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Geist;
  src: url('/assets/geist-semibold.ttf') format('truetype');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/geist-mono-regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #0a0c10;
  --white: #fff;
  --violet: #7c5cff;
  --slate: #8a92a6;
  font-family: Geist, system-ui, sans-serif;
  color: var(--white);
  background: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 47%, #38257124 0, transparent 52%),
    var(--ink);
}
::selection { color: var(--white); background: #5835c5; }
.page {
  width: min(100%, 1600px);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  padding: clamp(14px, 3svh, 32px) clamp(20px, 4vw, 64px) clamp(12px, 2svh, 24px);
  padding-left: max(clamp(20px, 4vw, 64px), env(safe-area-inset-left));
  padding-right: max(clamp(20px, 4vw, 64px), env(safe-area-inset-right));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.masthead, footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.brand { display: block; width: 134px; height: auto; }
.status, .domain, .eyebrow, .motion-toggle {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: .875rem;
  line-height: 1.6;
}
.status { color: var(--slate); }
main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.2fr);
  gap: clamp(8px, 2vw, 28px);
  padding: clamp(6px, 2svh, 24px) 0;
}
.intro { position: relative; z-index: 1; min-width: 0; align-self: center; }
.eyebrow { color: #b7a5ff; margin: 0 0 32px; }
h1 {
  font-size: clamp(2rem, min(8.4vw, 16svh), 9rem);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.065em;
  margin: 0;
}
h1 span { color: var(--violet); }
.containment {
  position: relative;
  isolation: isolate;
  container-type: size;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scene {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(112cqw, 100cqh);
  height: min(112cqw, 100cqh);
  transform: translate(-50%, -50%);
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse, #000 33%, #000e 53%, transparent 73%);
  mask-image: radial-gradient(ellipse, #000 33%, #000e 53%, transparent 73%);
}
.cube-scene {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.96);
}
.cube-hover, .cube-impulse, .cube-piece { position: absolute; inset: 0; width: 100%; height: 100%; }
.cube-hover {
  --lid-rise: 0%;
  --side-gap: 0%;
  --lid-angle: 0deg;
  --heart-opacity: .3;
  transform-origin: 50% 43%;
  transform: perspective(900px) translate3d(var(--hover-x, 0px), var(--hover-y, 0px), 0) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform .28s ease-out;
  filter: drop-shadow(0 0 8px #a683ff55);
}
.cube-impulse { transform-origin: 50% 43%; }
.cube-piece { display: block; object-fit: cover; pointer-events: none; user-select: none; transition: transform .72s cubic-bezier(.2,.8,.2,1); }
.cube-lid {
  clip-path: polygon(50% 14.3%, 71.4% 24.3%, 71.4% 28%, 50.1% 39.8%, 28.4% 28%, 28.6% 24.3%);
  transform-origin: 50% 27%;
  transform: translateY(var(--lid-rise)) rotate(var(--lid-angle));
}
.cube-left {
  /* Tuck the upper edge beneath the lid so no corner wedge opens at rest. */
  clip-path: polygon(26.8% 26.8%, 50.2% 39.1%, 50.2% 68.4%, 46.8% 68.4%, 27.1% 56%);
  transform: translateX(calc(-1 * var(--side-gap)));
}
.cube-right {
  clip-path: polygon(49.8% 39.1%, 73.2% 26.8%, 73% 56%, 53% 68.4%, 49.8% 68.4%);
  transform: translateX(var(--side-gap));
}
.cube-heart {
  position: absolute;
  left: 27%; right: 27%; top: 23%; bottom: 32%;
  background: radial-gradient(ellipse, #fff 0, #e6d5ff 15%, #a371ff99 40%, transparent 68%);
  filter: blur(9px);
  opacity: var(--heart-opacity);
  transition: opacity .65s ease;
}
.cube-target {
  position: absolute; left: 26.8%; top: 14.3%; width: 46.4%; height: 54.1%; z-index: 5;
  background: none; border: 0; padding: 0; color: inherit;
  clip-path: polygon(50% 0, 100% 25%, 100% 77%, 50% 100%, 0 77%, 0 25%);
  pointer-events: auto; cursor: grab; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.cube-target:active { cursor: grabbing; }
.cube-target:focus-visible { outline: none; background: #c8b5ff0b; }
.scene:has(.cube-target:focus-visible) .cube-hover { filter: drop-shadow(0 0 12px #e5d7ff); }
.cube-target[aria-disabled='true'] { cursor: default; }
.cube-burst {
  position: fixed; z-index: 20; left: 0; top: 0; width: 300vmax; height: 300vmax;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 80px 40px #fff, 0 0 160px 100px #d9c2ff;
  opacity: 0; transform: translate(-50%, -50%) scale(.001); pointer-events: none;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html[data-motion='paused'] .cube-hover, html[data-motion='paused'] .cube-piece, html[data-motion='paused'] .cube-heart { transition: none; }
#energy-canvas, #smoke-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.core-light {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #b899ff48, #7948ff20 30%, transparent 66%);
  mix-blend-mode: screen;
  opacity: .3;
}
.pulse-wave {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 12%;
  bottom: 22%;
  background: radial-gradient(ellipse, transparent 28%, #9a74ff08 45%, #9570ff1c 50%, transparent 57%);
  opacity: 0;
}
html[data-motion='running'] .core-light { animation: core-pulse 6.8s ease-in-out infinite; }
html[data-motion='running'] .pulse-wave { animation: wave 6.8s ease-out infinite; }
@keyframes core-pulse {
  0%, 100% { opacity: .15; transform: scale(.95); }
  40% { opacity: .72; transform: scale(1.08); }
  56% { opacity: .3; transform: scale(1); }
  69% { opacity: .68; transform: scale(1.1); }
}
@keyframes wave {
  0%, 30% { opacity: 0; transform: scale(.45); }
  45% { opacity: .8; }
  79%, 100% { opacity: 0; transform: scale(1.45); }
}
footer { padding-top: 20px; border-top: 1px solid #3b415070; }
.domain { color: #c9cfd9; }
.copyright { font-size: .875rem; line-height: 1.5; color: var(--slate); }
.motion-toggle {
  color: var(--slate);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
.motion-toggle:hover { color: #ddd4ff; border-color: #7c5cff55; }
.motion-toggle:focus-visible { outline: 2px solid #b7a5ff; outline-offset: 4px; color: #fff; }
@media (max-width: 900px) and (orientation: portrait) {
  body { background: radial-gradient(ellipse at 50% 27%, #38257124 0, transparent 60%), var(--ink); }
  .page { padding: max(14px, env(safe-area-inset-top)) 24px max(10px, env(safe-area-inset-bottom)); }
  .brand { width: 112px; }
  .masthead { gap: 12px; }
  .status { font-size: .75rem; }
  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: clamp(4px, 1.4svh, 14px);
    padding: 4px 0 clamp(12px, 2.5svh, 24px);
  }
  .containment { grid-column: 1; grid-row: 1; }
  .intro { grid-column: 1; grid-row: 2; }
  .eyebrow { margin-bottom: clamp(8px, 1.8svh, 18px); font-size: .75rem; }
  h1 { font-size: clamp(2rem, min(15.5vw, 10svh), 6rem); }
  footer { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding-top: 10px; }
  .copyright { grid-column: 2; grid-row: 1; text-align: right; }
  .motion-toggle { grid-column: 1 / -1; justify-self: center; }
}
@media (max-height: 480px) {
  .page { padding: 10px 20px 8px; }
  .brand { width: 92px; }
  .status, .domain, .copyright, .motion-toggle { font-size: .6875rem; }
  .masthead, footer { gap: 10px; }
  main { padding: 4px 0; gap: 12px; }
  .eyebrow { margin-bottom: 8px; font-size: .6875rem; }
  h1 { font-size: clamp(1.5rem, min(8vw, 15svh), 3.8rem); }
  footer { padding-top: 4px; }
  .motion-toggle { min-height: 32px; padding: 4px 8px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .page { padding-inline: 18px; }
  .brand { width: 96px; }
  .status { font-size: .6875rem; }
}
@media (forced-colors: active) {
  h1 span { color: CanvasText; }
  footer { border-color: CanvasText; }
  .motion-toggle { border-color: ButtonText; }
  .core-light, .pulse-wave { display: none; }
  .cube-burst { display: none; }
  .cube-target:focus-visible { outline: 3px solid Highlight; outline-offset: -4px; }
}
@media (prefers-reduced-motion: reduce) {
  .cube-hover, .cube-piece, .cube-heart { transition: none; }
}
