/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; -webkit-user-drag: none; user-select: none; }
button { font: inherit; color: inherit; }

/* ── Custom cursor: native hidden, the DOM shape takes over ── */
@media (pointer: fine) and (min-width: 769px) {
  *, *::before, *::after { cursor: none !important; }
}

.cs-root {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10001;
}

.cursor-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: var(--color-tooltip);
  opacity: 0.94;
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--color-tooltip-text);
  font-family: var(--font-family-primary);
  font-size: var(--tooltip-size);
  line-height: var(--leading-snug);
  white-space: pre-line;
  animation: tooltip-in 0.12s ease forwards;
}
@keyframes tooltip-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 0.85; transform: translateY(0); }
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  min-height: 100vh;
  background: var(--color-bg-body);
  font-family: var(--font-family-primary);
  color: var(--color-text-primary);
  transition: background 0.5s ease, color 0.5s ease;
}

strong, b {
  font-weight: var(--weight-semibold);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 500;
  width: 40px;
  height: 40px;
  border-radius: 100px;
  border: none;
  background: var(--color-surface-action-icon);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 40px var(--color-shadow-action-icon);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.5s ease;
}
.back-to-top--visible { opacity: 1; transform: scale(1); pointer-events: auto; }
.back-to-top:hover    { transform: scale(1.08); }
.back-to-top:active   { transform: scale(0.95); }

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 48px;
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav--hidden { transform: translateY(-110%); }

.nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  max-width: var(--nav-max-width);
  margin: 0 auto;
}

/* Over an open case study the logo and toggles stay, the section pills go */
body.cs-open .nav { z-index: 350; pointer-events: none; }
body.cs-open .nav-inner > * { pointer-events: auto; }
body.cs-open .nav-pills {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nav-pills { transition: background 0.5s ease, opacity 0.25s ease, transform 0.25s ease; }
.nav-logo--close { cursor: pointer; }

.nav-toggles { transition: margin-right 0.6s cubic-bezier(0.65, 0, 0.35, 1); }
body.cs-open .nav-toggles { margin-right: 44px; transition: margin-right 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

/* The minimise: its own fixed layer so the scroll-hide never takes it */
.nav-close {
  position: fixed;
  top: 20px; left: 0; right: 0;
  z-index: 360;
  padding: 0 48px;
  pointer-events: none;
}
.nav-close__inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 46px;
  max-width: var(--nav-max-width);
  margin: 0 auto;
}
.nav-close__btn {
  pointer-events: auto;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 100px;
  background: var(--color-surface-nav-blur);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.3s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
.nav-close__btn--goo-in { animation: nav-close-fade 0.2s ease 0.45s both; }
.nav-close__btn--out    { opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
@keyframes nav-close-fade { from { opacity: 0; } to { opacity: 1; } }
.nav-close__btn:hover  { background: var(--color-surface-nav); box-shadow: 0 0 20px var(--color-shadow-nav); }
.nav-close__btn:active { transform: scale(0.92); }
.nav-close__btn img { width: 16px; height: 16px; display: block; filter: var(--filter-action-icon); }

/* The liquid behind the minimise: two blobs under a goo filter */
.nav-goo {
  position: fixed;
  top: 20px; left: 0; right: 0;
  z-index: 95;
  padding: 0 48px;
  pointer-events: none;
}
body.cs-open .nav-goo { z-index: 345; }
.nav-goo__filter { position: absolute; width: 0; height: 0; }
.nav-goo__inner {
  position: relative;
  min-height: 46px;
  max-width: var(--nav-max-width);
  margin: 0 auto;
}
.nav-goo__blobs {
  position: absolute;
  top: 5px; right: 0;
  width: 160px; height: 36px;
  filter: url(#nav-goo);
}
.nav-goo__blob {
  position: absolute;
  top: 0; right: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-surface-nav);
}
.nav-goo--in  { animation: nav-goo-fade-out 0.2s ease 0.55s both; }
.nav-goo--out { animation: nav-goo-fade-out 0.2s ease 0.58s both; }
.nav-goo--in .nav-goo__blob--theme { animation: nav-goo-theme-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.nav-goo--in .nav-goo__blob--close { animation: nav-goo-close-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes nav-goo-theme-in { from { transform: translateX(0); } to { transform: translateX(-44px); } }
@keyframes nav-goo-close-in {
  0%   { transform: scale(0.55); }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.nav-goo--out .nav-goo__blob--theme { animation: nav-goo-theme-out 0.6s cubic-bezier(0.65, 0, 0.35, 1) both; }
.nav-goo--out .nav-goo__blob--close { animation: nav-goo-close-out 0.6s cubic-bezier(0.5, 0, 0.75, 0.3) both; }
@keyframes nav-goo-theme-out { from { transform: translateX(-44px); } to { transform: translateX(0); } }
@keyframes nav-goo-close-out {
  0%   { transform: translateX(0) scale(1, 1); }
  35%  { transform: translateX(-6px) scale(1.18, 0.88); }
  70%  { transform: translateX(-12px) scale(0.9, 0.8); }
  100% { transform: translateX(-10px) scale(0.2, 0.2); }
}
@keyframes nav-goo-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Logo: a wordmark, the dot carries the brand gradient */
.nav-logo {
  height: 46px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: var(--weight-extrabold);
  font-size: 30px;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.5s ease;
}
.nav-logo i {
  font-style: normal;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-pills {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--color-surface-nav-blur);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: 100px;
}

.nav-pill-hover-ghost {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 100px;
  background: var(--color-surface-nav);
  opacity: 0;
  pointer-events: none;
  transition: left 0.25s cubic-bezier(0.25, 1, 0.5, 1),
              width 0.25s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.18s ease;
  box-shadow: 0 0 12px var(--color-shadow-nav);
  filter: opacity(0.35);
}

.nav-pill-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 100px;
  background: var(--color-surface-nav);
  box-shadow: 0 0 40px var(--color-shadow-nav);
  pointer-events: none;
  will-change: left, width, transform;
  transform-origin: center center;
}
.nav-pill-indicator--ready {
  transition: left 0.62s cubic-bezier(0.34, 1.56, 0.64, 1),
              width 0.62s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-pill-indicator--liquid {
  transition: left 0.72s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.72s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-pill {
  position: relative;
  z-index: 1;
  padding: 8px 16px;
  border-radius: 100px;
  font-weight: var(--weight-medium);
  font-size: 1rem;
  color: var(--color-text-primary);
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  transition: color 0.2s;
}
.nav-pill.active { color: var(--color-text-primary); }
.nav-pill:not(.active):hover { color: var(--color-primary); }

.nav-toggles {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Round header toggles (scroll mode, theme) ── */
.lazy-toggle {
  display: flex;
  align-items: center;
  height: 36px;
  border: none;
  border-radius: 100px;
  background: var(--color-surface-nav-blur);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--color-text-primary);
  user-select: none;
  overflow: hidden;
  transition: background 0.3s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lazy-toggle:hover  { background: var(--color-surface-nav); box-shadow: 0 0 20px var(--color-shadow-nav); }
.lazy-toggle:active { transform: scale(0.92); }
.lazy-toggle--icon { width: 36px; padding: 0; justify-content: center; }
.lazy-toggle__icon { display: block; overflow: visible; flex-shrink: 0; }

.lz-arrow { fill: currentColor; stroke: currentColor; stroke-width: 1; }
.lz-ghost {
  fill: currentColor;
  stroke: none;
  transform-box: view-box;
  transition: opacity 0.3s ease, translate 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.lz-ghost--far  { opacity: 0.18; }
.lz-ghost--near { opacity: 0.38; }
.lazy-toggle--off .lz-ghost--far  { opacity: 0; translate: 5px 5px; }
.lazy-toggle--off .lz-ghost--near { opacity: 0; translate: 2.5px 2.5px; }
.lz-ticks {
  transform-origin: 8px 6.5px;
  transform-box: view-box;
  opacity: 0;
  transform: scale(1.5);
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.5, 0.64, 1);
}
.lazy-toggle--off .lz-ticks { opacity: 1; transform: scale(1); }

/* The cursor's own drawing over the scroll toggle */
.cs-fx {
  position: absolute;
  left: -30px; top: -30px;
  overflow: visible;
  pointer-events: none;
}
.cs-fx-ghost { fill: #333333; }
.cs-fx-ticks {
  fill: none;
  stroke: #333333;
  stroke-width: 1.8;
  stroke-linecap: round;
  paint-order: stroke;
  opacity: 0;
  transform-origin: 1px 2px;
}

/* ── Theme toggle: the lens and the wipe ── */
.theme-toggle { position: relative; }
.theme-toggle__icon {
  position: absolute;
  left: 50%; top: 50%;
  margin: -9px 0 0 -9px;
  transform: rotate(0) scale(1);
  opacity: 1;
  transition: transform 0.4s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
}
.theme-toggle__sun.theme-toggle__icon--out  { transform: rotate(90deg) scale(0);  opacity: 0; }
.theme-toggle__moon.theme-toggle__icon--out { transform: rotate(-90deg) scale(0); opacity: 0; }

.theme-lens {
  --lens: 126px;
  position: fixed;
  z-index: 110;
  width: var(--lens);
  height: var(--lens);
  margin: calc(var(--lens) / -2) 0 0 calc(var(--lens) / -2);
  border-radius: 50%;
  pointer-events: none;
  -webkit-backdrop-filter: invert(1) hue-rotate(180deg);
  backdrop-filter: invert(1) hue-rotate(180deg);
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}
body.cs-open .theme-lens { z-index: 365; }
.theme-lens--lit {
  transform: scale(1);
  transition: transform 0.6s cubic-bezier(0.05, 0.7, 0.1, 1);
  animation: theme-lens-breathe 1.6s cubic-bezier(0.2, 0, 0, 1) 0.6s infinite;
}
@keyframes theme-lens-breathe {
  0%, 100% { scale: 1; }
  50%      { scale: 1.08; }
}

:root[data-theme-wipe]::view-transition-old(root),
:root[data-theme-wipe]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
[data-theme-switching] *,
[data-theme-switching] *::before,
[data-theme-switching] *::after { transition: none !important; }

/* ── Layout ── */
.mobile-page-logo { display: none; }

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 110px 24px 80px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 252px);
  grid-auto-rows: 252px;
  gap: 18px;
}

.site-foot {
  text-align: center;
  padding: 0 24px 56px;
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-ultra);
  text-transform: uppercase;
  color: var(--color-text-primary);
  opacity: 0.3;
}

/* ══════════════════════════════════════
   BENTO CARD
══════════════════════════════════════ */
.bento-card {
  background: var(--color-surface-card);
  border-radius: 32px;
  border: 1px solid var(--color-border-card);
  box-shadow:
    0 1px 3px var(--color-shadow-card-rest),
    0 1px 2px var(--color-shadow-card-rest),
    inset 0 1px 0 var(--color-card-inset-top),
    inset 0 -1px 0 var(--color-card-inset-bottom);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: background 0.5s ease, border-color 0.3s ease, transform 0.15s ease;
  isolation: isolate;
  animation: card-enter 0.8s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: var(--card-enter-delay, 0s);
}

.bento-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--card-grain-image);
  background-size: 180px 180px;
  opacity: var(--card-grain-opacity);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}

.bento-card:active,
.bento-card--pressed {
  transform: scale(0.97);
  transition: background 0.5s ease, box-shadow 0.08s ease, border-color 0.3s ease, transform 0.08s ease;
}

.bento-card.dark {
  --color-card-inset-top:    rgba(255, 255, 255, 0.05);
  --color-card-inset-bottom: rgba(0, 0, 0, 0.30);
  --card-grain-opacity:      0.05;
  --card-grain-image:        var(--grain-specks-light);
  --color-card-ripple:       rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.06);
  background: var(--color-surface-card-dark);
}

.action-icon,
.bento-card > .action-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: var(--color-surface-action-icon);
  border-radius: 100px;
  box-shadow: 0 2px 40px var(--color-shadow-action-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.5s ease;
  z-index: 10;
}
.bento-card .action-icon img {
  width: 16px;
  height: 16px;
  filter: var(--filter-action-icon);
}
.bento-card:hover .action-icon { opacity: 1; transform: scale(1); }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

/* ── Grid slot: the lift and the pre-drawn hover shadow live here ── */
.grid-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  transition: opacity 0.4s ease, transform 0.15s ease;
}
.grid-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 32px;
  box-shadow:
    0 12px 40px var(--color-shadow-card-hover),
    0 4px 12px var(--color-shadow-card-hover-2);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.15s ease;
  pointer-events: none;
}
.grid-slot:has(.bento-card:hover:not(.cs-card--ghost, .xp-card--ghost))::before { opacity: 1; }
.grid-slot:has(.bento-card:hover):not(:has(.cs-card--ghost, .xp-card--ghost, .cs-video-fly, .cs-expanded, .xp-fly, .xp-expanded)) {
  transform: translateY(-3px);
}
.grid-slot:has(.cs-card--ghost, .cs-video-fly, .cs-expanded, .xp-card--ghost, .xp-expanded) {
  transition: opacity 0.4s ease;
}
.grid-slot > * { width: 100%; height: 100%; }
.grid-slot--dim { opacity: 0.3; pointer-events: none; }

/* ── Click ripple ── */
.card-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: card-ripple 0.52s linear forwards;
  background: var(--color-card-ripple);
  pointer-events: none;
  z-index: 10;
}
@keyframes card-ripple { to { transform: scale(20); opacity: 0; } }

/* ══════════════════════════════════════
   REDUCED MOTION
══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
  }
  .bento-card, .grid-slot, .nav-pill-indicator, .back-to-top { transition-duration: 0.1s !important; }
  .cs-root, .cursor-tooltip { display: none !important; }
  *, *::before, *::after { cursor: auto !important; }
}

/* QA hook (?still): freeze every animation so a headless screenshot sees the settled page */
html.still *, html.still *::before, html.still *::after {
  animation: none !important;
  transition: none !important;
}

/* ── Liquid Glass, per Apple's HIG: only on the functional layer that floats over content
   (the tab bar, the round header buttons, the card corner action), never on cards.
   Regular variant: blur plus a luminosity lift so labels stay legible over any card. ── */
.nav-pills, .lazy-toggle, .nav-close__btn, .bento-card .action-icon {
  background: color-mix(in srgb, var(--color-surface-nav) 58%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 4px 16px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .nav-pills, html[data-theme="dark"] .lazy-toggle,
html[data-theme="dark"] .nav-close__btn, html[data-theme="dark"] .bento-card .action-icon {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 16px rgba(0, 0, 0, 0.3);
}
/* Clear variant over film: highly translucent, with Apple's 35% dimming layer for legibility */
.case-chip { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.22); }
@media (prefers-reduced-transparency: reduce) {
  .nav-pills, .lazy-toggle, .nav-close__btn, .bento-card .action-icon { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--color-surface-nav); }
}
