/* ================= Case study: Cube Audience Manager =================
   A product walk-through, not a lookbook. The page follows the product's own flow, step by step,
   in Cube's dark system: near-black, Space Grotesk, the blue-to-lilac headline gradient and one
   electric blue for actions. Latch keeps its grey intros. Screens sit in angled frames that turn
   as you scroll. Spacing runs on one scale: 8, 16, 24, 40, 64. */
.cb { --c0: #050609; --c1: #0b0d16; --c2: #141726; --c-line: rgba(150, 160, 255, .16); --c-blue: #2E4BFF; --c-lilac: #9B7BFF; --c-mist: #C9CBE0;
  --c-txt: rgba(226, 228, 245, .7); --c-font: 'Space Grotesk', var(--font);
  --c-h2: clamp(28px, 3.3vw, 48px); --c-gap: clamp(32px, 4.5vw, 64px);
  font-family: var(--c-font); background: var(--c0); color: #fff; overflow-x: clip; }
.cb h1, .cb h2, .cb h3 { font-family: var(--c-font); font-stretch: 100%; letter-spacing: -0.02em; font-weight: 400; }
.cb .label { font-family: var(--font); color: rgba(226, 228, 245, .55); }
.cb .lede { font-size: clamp(16px, 1.2vw, 18px); line-height: 1.6; color: var(--c-txt); }
.cb :focus-visible { outline-color: #fff; }
.cb-grad { background: linear-gradient(90deg, #4458FF 0%, #9B7BFF 52%, #D8D9E8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cb-sec { padding: clamp(72px, 10vw, 140px) 0; position: relative; }
.cb-sec.alt { background: var(--c1); }
.cb-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 16px clamp(32px, 6vw, 96px); margin-bottom: var(--c-gap); }
.cb-head h2 { font-size: var(--c-h2); line-height: 1.1; max-width: 18ch; }
.cb-head > p { max-width: 46ch; }
.cb-step { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #8E98FF; display: flex; gap: 12px; align-items: center; margin-bottom: 16px; font-weight: 500; }
.cb-step i { width: 14px; height: 14px; flex: none; border: 1.5px solid currentColor; border-radius: 3px; transform: rotate(45deg) scale(.8); }

/* The mark: four tiles */
.cb-mark { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5%; width: 100%; aspect-ratio: 1; }
.cb-mark span { background: #F4F5FB; color: #05060A; display: grid; place-items: center; font: 700 1em/1 var(--c-font); aspect-ratio: 1; }

/* Angled frames */
.cb-3d { perspective: 1800px; perspective-origin: 50% 40%; }
.cb-fr { position: relative; border-radius: clamp(8px, 1vw, 14px); overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(150, 160, 255, .28), 0 40px 120px -40px rgba(68, 88, 255, .55), 0 30px 60px -30px rgba(0, 0, 0, .9);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rz, 0deg)) translateZ(var(--tz, 0px)); transform-style: preserve-3d;
  transition: transform .9s var(--ease), opacity .6s var(--ease), filter .6s var(--ease); }
.cb-fr img { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 1039; }
.cb-fr::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgba(255,255,255,.07), transparent 38%); }

/* Hero */
.cb-hero { position: relative; padding: clamp(28px, 4vw, 48px) 0 clamp(64px, 8vw, 120px); isolation: isolate; }
.cb-hero::before { content: ""; position: absolute; inset: -10% -10% 0; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 50% at 22% 30%, rgba(46, 60, 220, .32), transparent 70%), radial-gradient(36% 46% at 80% 60%, rgba(120, 70, 220, .26), transparent 70%); }
.cb-hero .crumbs a, .cb-hero .crumbs span { color: rgba(226, 228, 245, .6); }
.cb-hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 5vw, 80px); align-items: center; margin-top: clamp(24px, 4vw, 56px); }
.cb-hero .cb-mark { width: clamp(56px, 6vw, 80px); font-size: clamp(22px, 2.4vw, 32px); margin-bottom: clamp(24px, 3vw, 40px); }
.cb-hero h1 { font-size: clamp(40px, 5.6vw, 84px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 500; }
.cb-hero h1 span { display: block; }
.cb-hero .row { margin-top: clamp(24px, 3vw, 40px); }
.cb-btn { background: var(--c-blue); color: #fff; border-color: var(--c-blue); }
.cb-btn:hover { background: #4458FF; border-color: #4458FF; }
.cb-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.cb-ghost:hover { border-color: #fff; }
.cb-stack { position: relative; aspect-ratio: 16 / 12; transform-style: preserve-3d; }
.cb-stack .cb-fr { position: absolute; width: 78%; }
.cb-stack .cb-fr:nth-child(1) { left: 0; top: 0; --ry: 24deg; --rx: 8deg; --tz: -120px; filter: brightness(.55); }
.cb-stack .cb-fr:nth-child(2) { left: 22%; top: 24%; --ry: 24deg; --rx: 8deg; --tz: -20px; filter: brightness(.8); }
.cb-stack .cb-fr:nth-child(3) { left: 12%; top: 50%; --ry: 24deg; --rx: 8deg; --tz: 80px; }
.cb-stack-wrap { transform: rotateX(var(--px, 0deg)) rotateY(var(--py, 0deg)); transform-style: preserve-3d; transition: transform .6s var(--ease); }
.cb-about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 5vw, 80px); margin-top: clamp(56px, 7vw, 96px); align-items: start; }
.cb-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; }
.cb-meta span { display: block; font-size: 13px; color: rgba(226, 228, 245, .5); margin-bottom: 6px; }
.cb-meta b { font-weight: 500; font-size: 17px; }

/* Film */
.cb-filmwrap { position: relative; }
.cb-filmwrap::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: -12%; height: 24%; z-index: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(90, 100, 255, .38), rgba(120, 80, 220, .14) 60%, transparent); pointer-events: none; }
.cb .ol-scr.wide { box-shadow: 0 0 0 1px rgba(150, 160, 255, .22), 0 50px 140px -50px rgba(68, 88, 255, .7); }
.cb .ol-big i { background: rgba(10, 12, 40, .45); }
.cb .ol-big:hover i { background: rgba(46, 75, 255, .7); }
.cb .ol-hint { background: rgba(8, 10, 30, .55); }

/* Principles */
.cb-pr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cb-pr li { list-style: none; padding: 24px; border-radius: 16px; background: var(--c2); border: 1px solid var(--c-line); min-width: 0; }
.cb-pr .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(68, 88, 255, .14); color: #A9B2FF; margin-bottom: 24px; }
.cb-pr .ic svg { width: 22px; height: 22px; }
.cb-pr h3 { font-size: 20px; line-height: 1.2; margin-bottom: 8px; }
.cb-pr p { color: var(--c-txt); font-size: 15px; line-height: 1.55; }

/* Personality picker */
.cb-pick { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.cb-tabs { display: grid; gap: 8px; }
.cb-tab { display: grid; grid-template-columns: 40px 1fr; gap: 16px; align-items: center; text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--c-line); background: transparent; color: #fff; cursor: pointer; font: inherit; transition: background .3s, border-color .3s; }
.cb-tab .n { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--c2); color: rgba(226, 228, 245, .6); font-size: 13px; }
.cb-tab b { display: block; font-weight: 500; font-size: 18px; }
.cb-tab small { display: block; color: rgba(226, 228, 245, .5); font-size: 13.5px; margin-top: 2px; }
.cb-tab[aria-pressed="true"] { background: var(--c2); border-color: rgba(120, 135, 255, .55); }
.cb-tab[aria-pressed="true"] .n { background: var(--c-blue); color: #fff; }
.cb-tab:hover { border-color: rgba(120, 135, 255, .4); }
.cb-pick .cb-fr { --ry: -14deg; --rx: 4deg; }
.cb-pick .cb-fr.swap { animation: cbSwap .7s var(--ease); }
@keyframes cbSwap { from { opacity: .2; transform: rotateX(4deg) rotateY(-30deg) translateZ(-80px); } to { opacity: 1; transform: rotateX(4deg) rotateY(-14deg); } }

/* Archetype scene: pinned while you scroll through all twelve */
.cb-arch { height: 360vh; position: relative; }
.cb-arch .pin { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; overflow: hidden; }
.cb-arch .pin > .wrap { width: 100%; }
.cb-arch-grid > :first-child { position: relative; z-index: 2; }
.cb-arch-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.cb-arch h2 { font-size: var(--c-h2); line-height: 1.1; margin-bottom: 24px; }
.cb-arch-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; margin-bottom: 24px; }
.cb-arch-list li { list-style: none; font-size: 17px; color: rgba(226, 228, 245, .32); transition: color .3s, transform .3s var(--ease); display: flex; align-items: center; gap: 8px; }
.cb-arch-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity .3s; }
.cb-arch-list li.on { color: var(--ac, #fff); transform: translateX(4px); }
.cb-arch-list li.on::before { opacity: 1; }
.cb-arch-d { min-height: 6.4em; color: var(--c-txt); line-height: 1.6; max-width: 44ch; }
.cb-ring { position: relative; aspect-ratio: 16 / 11; transform-style: preserve-3d; }
.cb-ring .cb-fr { position: absolute; left: 6%; top: 8%; width: 88%; transition: none; }
.cb-meter { height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; margin-top: 24px; overflow: hidden; }
.cb-meter i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, #4458FF, #9B7BFF); }


/* Cube AI */
.cb-ai { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.cb-ai-shots { position: relative; aspect-ratio: 16 / 12.5; transform-style: preserve-3d; }
.cb-ai-shots .cb-fr { position: absolute; width: 80%; }
.cb-ai-shots .cb-fr:nth-child(1) { left: 0; top: 0; --ry: 18deg; --rx: 4deg; }
.cb-ai-shots .cb-fr:nth-child(2) { right: 0; bottom: 0; --ry: 18deg; --rx: 4deg; --tz: 60px; }
.cb-flow { display: grid; gap: 8px; counter-reset: f; }
.cb-flow li { list-style: none; display: grid; grid-template-columns: 32px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--c-line); }
.cb-flow li::before { counter-increment: f; content: counter(f, decimal-leading-zero); color: #8E98FF; font-size: 13px; padding-top: 3px; }
.cb-flow b { display: block; font-weight: 500; font-size: 17px; }
.cb-flow p { color: var(--c-txt); font-size: 15px; line-height: 1.5; margin-top: 4px; }

/* Scroll reveal */
.cb-in { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--k, 0) * 80ms); }
.cb-in.on { opacity: 1; transform: none; }

/* Work tile cover */
.tile .cover.cb-cover { background: #050609; isolation: isolate; }
.cb-cover .cb-fr { position: absolute; width: 74%; left: 13%; top: 16%; --ry: -18deg; --rx: 10deg; transition: transform .8s var(--ease); }
.cb-cover .cb-3d { position: absolute; inset: 0; }
.cb-cover::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 60% at 30% 30%, rgba(46, 60, 220, .4), transparent 70%), radial-gradient(50% 50% at 80% 80%, rgba(120, 70, 220, .3), transparent 70%); }
.tile:hover .cb-cover .cb-fr { --ry: -8deg; --rx: 4deg; }
.cb-cover .cap { position: absolute; left: 18px; bottom: 16px; right: 18px; display: flex; justify-content: space-between; color: rgba(255,255,255,.8); font-family: 'Space Grotesk', var(--font); font-size: 13.5px; z-index: 1; }
.cb-cover .cb-mark { position: absolute; top: 16px; left: 18px; width: 34px; font-size: 13px; z-index: 1; }

@media (max-width: 900px) {
  .cb-head, .cb-hero-grid, .cb-about, .cb-pick, .cb-arch-grid, .cb-ai { grid-template-columns: minmax(0, 1fr); }
  .cb-pr { grid-template-columns: minmax(0, 1fr); }
  .cb-stack { margin: 8px 4% 0; }
  .cb-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cb-pick .cb-fr { --ry: 0deg; --rx: 0deg; }
  .cb-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .cb-tab { grid-template-columns: 1fr; padding: 8px 4px; text-align: center; gap: 6px; justify-items: center; }
  .cb-tab .n { width: 32px; height: 32px; }
  .cb-tab b { font-size: 11.5px; }
  .cb-tab small { display: none; }
  .cb-arch { height: auto; }
  .cb-arch .pin { position: relative; height: auto; display: block; overflow: visible; padding: clamp(72px, 10vw, 140px) 0; }
  .cb-ring { aspect-ratio: auto; display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(var(--gutter, 16px) * -1); padding: 8px var(--gutter, 16px) 24px; scrollbar-width: none; }
  .cb-ring::-webkit-scrollbar { display: none; }
  .cb-ring .cb-fr { position: relative; left: auto; top: auto; width: 84%; flex: none; scroll-snap-align: center; transform: none !important; opacity: 1 !important; filter: none !important; }
  .cb-meter { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-in { opacity: 1; transform: none; transition: none; }
  .cb-fr, .cb-stack-wrap { transition: none; }
  .cb-pick .cb-fr.swap { animation: none; }
  .cb-arch { height: auto; }
  .cb-arch .pin { position: relative; height: auto; padding: clamp(72px, 10vw, 140px) 0; }
}
