/* ═══════════════════════════════════════════════════════════════════════════
   Depth and motion for the website, Studio and admin. Loaded last.
   Adds shadow, light, translucency and movement only: no sizes, spacing or
   positions of in-flow content are set here.
   1 tokens  2 elevation  3 frosted glass  4 3D  5 ambient
   6 entrances and states  7 micro-interactions  8 reduced motion  9 contrast
   The extension carries the same tokens in extension/depth.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1 · tokens ──────────────────────────────────────────────────────── */
:root {
  --m-1: 150ms;   /* touch: hover, press, highlight */
  --m-2: 250ms;   /* switch: tabs, accordion, states */
  --m-3: 400ms;   /* arrive: pages, cards, dialogs */
  --m-4: 600ms;   /* turn: light sweep */
  --m-step: 50ms; /* stagger */
  --m-ease: cubic-bezier(.16, 1, .3, 1);      /* confident ease-out */
  --m-spring: cubic-bezier(.34, 1.3, .5, 1);  /* soft spring, small things only */
  /* the older names now point at the shared set */
  --dur-1: var(--m-1); --dur-2: var(--m-2); --dur-3: var(--m-3);

  /* ── 2 · elevation: 0 background · 1 surface · 2 raised · 3 floating ─
     inner top light, a tight contact shadow and a soft ambient shadow.
     The fine translucent edge is each element's own 1px border. */
  --shadow-sm: inset 0 1px 0 rgb(255 255 255 / .045), 0 1px 2px -1px rgb(0 0 0 / .55), 0 10px 22px -16px rgb(0 0 0 / .75);
  --shadow: inset 0 1px 0 rgb(255 255 255 / .055), 0 2px 5px -2px rgb(0 0 0 / .55), 0 28px 54px -30px rgb(0 0 0 / .9);
  --shadow-lg: inset 0 1px 0 rgb(255 255 255 / .065), 0 4px 10px -4px rgb(0 0 0 / .55), 0 60px 120px -48px rgb(0 0 0 / .95), 0 0 0 1px rgb(0 0 0 / .4);
  --shadow-float: inset 0 1px 0 rgb(255 255 255 / .09), 0 6px 14px -6px rgb(0 0 0 / .6), 0 40px 80px -30px rgb(0 0 0 / .92), 0 0 0 1px rgb(0 0 0 / .4);
  --elevation: var(--shadow-lg);
}

/* 1 · surfaces */
.table-scroll, .trust-table-wrap, .privacy-table-region, .terms-table-region, .compute-desk, .metrics, .quota, .locked { box-shadow: var(--shadow-sm); }
/* 2 · raised */
.site-card, .site-form, .price-row, .read-page .read-section .entry, .studio-page .glass, .panel:not([role=tabpanel]), .st-banner { box-shadow: var(--shadow); }
.studio-page .pane:focus-within { box-shadow: var(--shadow), 0 0 0 4px rgb(143 125 255 / .12); }
.compute-desk .site-form, .access-spread .site-form.site-form { box-shadow: none; }
.access-spread .site-form.site-form { box-shadow: var(--shadow-lg); }
/* 3 · floating */
.site-menu, .page-search, .st-toast, .st-dialog, .st-drawer, dialog[open], [data-tip]::after { box-shadow: var(--shadow-float); }

/* ── 3 · frosted glass ───────────────────────────────────────────────── */
/* Solid first: this is what browsers without backdrop-filter keep. */
.site-menu, .page-search, .st-toast { background: var(--ink-2); }
.st-dialog, .st-drawer, dialog { background-color: var(--ink-2); }
[data-tip]::after { background: var(--ink-3); }
/* Bars frost on a layer of their own: menus inside them can then frost the page too. */
.site-header, [data-site-header], .st-strip, body > header { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; isolation: isolate; }
.site-header::before, .st-strip::before, body > header:not(.site-header)::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--void); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header::before, body > header:not(.site-header)::before { background: rgb(4 4 6 / .72); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
  .st-strip::before { background: rgb(6 6 9 / .72); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
  .site-menu, .page-search { background: rgb(13 13 19 / .8); -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%); }
  .st-toast { background: rgb(20 20 28 / .8); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
  .st-dialog, .st-drawer, dialog { background-color: rgb(13 13 19 / .86); -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%); }
  [data-tip]::after { background: rgb(20 20 28 / .84); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}

/* A permanent view-transition-name stops everything inside the header (its menus)
   from blurring the page, so the header takes the name only while pages change. */
body > header { view-transition-name: none; }
html.vs-turning body > header { view-transition-name: site-header; }

/* ── 4 · 3D: cursor tilt with a following light (mouse only) ─────────── */
.vs-lit { position: relative; }
.vs-sheen { position: absolute; inset: 0; margin: 0 !important; overflow: hidden; border-radius: inherit; pointer-events: none; opacity: 0; }
.vs-sheen > i {
  position: absolute; left: -240px; top: -240px; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 255 255 / .075), rgb(182 171 255 / .04) 48%, transparent);
  transform: translate3d(var(--vs-x, 0), var(--vs-y, 0), 0);
}
.vs-tilting > .vs-sheen { opacity: 1; }
body .vs-tilting.vs-tilting { transform: perspective(1200px) rotateX(var(--vs-rx, 0deg)) rotateY(var(--vs-ry, 0deg)) translateZ(0) !important; }

/* ── 5 · ambient light behind the page ───────────────────────────────── */
body.vs-has-ambient { isolation: isolate; }
/* this wash has always been hidden behind the page colour; keep it that way */
.home-pricing::before { content: none; }
.vs-ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.vs-ambient > i { position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%; }
.vs-ambient > i:nth-child(1) { left: -34vmax; top: -50vmax; background: radial-gradient(closest-side, rgb(123 105 201 / .12), transparent); }
.vs-ambient > i:nth-child(2) { right: -40vmax; top: -8vmax; background: radial-gradient(closest-side, rgb(79 111 184 / .08), transparent); }
.vs-ambient > i:nth-child(3) { left: 16vmax; bottom: -64vmax; background: radial-gradient(closest-side, rgb(143 125 255 / .075), transparent); }
@media (prefers-reduced-motion: no-preference) {
  .vs-ambient > i { animation: vs-drift-a 48s ease-in-out infinite alternate; }
  .vs-ambient > i:nth-child(2) { animation: vs-drift-b 62s ease-in-out infinite alternate; }
  .vs-ambient > i:nth-child(3) { animation: vs-drift-c 55s ease-in-out infinite alternate; }
}
@keyframes vs-drift-a { to { transform: translate3d(14vmax, 9vmax, 0) scale(1.14); } }
@keyframes vs-drift-b { to { transform: translate3d(-12vmax, 12vmax, 0) scale(.9); } }
@keyframes vs-drift-c { to { transform: translate3d(10vmax, -10vmax, 0) scale(1.1); } }

/* ── 6 · entrances and states ────────────────────────────────────────── */
@keyframes vs-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes vs-fade { from { opacity: 0; } }
@keyframes vs-confirm-in { from { opacity: 0; transform: scale(.86); } }
@keyframes vs-confirm-out { to { opacity: 0; transform: scale(.96); } }
@keyframes vs-pop { 50% { transform: scale(1.16); } }
@media (prefers-reduced-motion: no-preference) {
  /* the first screen arrives in order; scrolling reveals are in motion.js */
  main > :first-child:not(#view-title, .primary-nav) > *:not([style*="view-transition-name"], .vs-sheen) { animation: vs-in var(--m-3) var(--m-ease) backwards; }
  main > :first-child > :nth-child(2) { animation-delay: var(--m-step); }
  main > :first-child > :nth-child(3) { animation-delay: calc(var(--m-step) * 2); }
  main > :first-child > :nth-child(4) { animation-delay: calc(var(--m-step) * 3); }
  main > :first-child > :nth-child(n + 5) { animation-delay: calc(var(--m-step) * 4); }
  /* a page that arrived through a transition is already moving: don't move it twice */
  html.vs-arrived main > :first-child > * { animation: none; }

  /* results · warnings · prompts · confirmations */
  :is(.site-form, .access-fields) [role=status]:not(:empty), #offerResult:not(:empty), [data-account-content]:not([hidden]), [data-account-error]:not([hidden]),
  [data-action-status]:not(:empty), .st-notice:not(:empty), .st-allowances:not(:empty), .st-error:not([hidden]), .st-gate:not([hidden]),
  #stWorkspace:not([hidden]), .st-hint.is-warn, .compute-desk output:not(:empty), [data-example-panel]:not([hidden]), p.error:not([hidden]), #compute-health:not([hidden]) {
    animation: vs-in var(--m-2) var(--m-ease);
  }
  :is(#plans, #cycles, #homeOffers, .run-list, .fix-list, #view) > * { animation: vs-in var(--m-3) var(--m-ease) backwards; }
  :is(#plans, #homeOffers, .run-list, .fix-list, #view) > :nth-child(2) { animation-delay: var(--m-step); }
  :is(#plans, #homeOffers, .run-list, .fix-list, #view) > :nth-child(3) { animation-delay: calc(var(--m-step) * 2); }
  :is(#plans, #homeOffers, .run-list, .fix-list, #view) > :nth-child(n + 4) { animation-delay: calc(var(--m-step) * 3); }

  /* "Copied": scales in. Toasts scale in, hold, and fade out before they are removed. */
  .btn.is-done, .icon-btn.is-done { animation: vs-pop var(--m-2) var(--m-spring); }
  .st-toasts .st-toast { animation: vs-confirm-in var(--m-2) var(--m-spring), vs-confirm-out var(--m-2) var(--m-ease) 3350ms forwards; }
  .st-toasts .st-toast.error { animation: vs-confirm-in var(--m-2) var(--m-spring), vs-confirm-out var(--m-2) var(--m-ease) 6250ms forwards; }

  /* accordions: height plus fade */
  @supports (interpolate-size: allow-keywords) {
    :is(.faq details, .pipeline details, .trust-answer, .compute-desk, .sample-detail)::details-content { interpolate-size: allow-keywords; height: 0; opacity: 0; overflow: clip; transition: height var(--m-2) var(--m-ease), opacity var(--m-2) var(--m-ease), content-visibility var(--m-2) allow-discrete; }
    :is(.faq details, .pipeline details, .trust-answer, .compute-desk, .sample-detail)[open]::details-content { height: auto; opacity: 1; }
    .faq details[open] p, .pipeline details[open] p, .trust-answer[open] p { animation: none; }
  }
}

/* ── 7 · micro-interactions ──────────────────────────────────────────── */
@media (hover: hover) {
  .icon-btn:hover:not(:disabled):not(:active), .workbench button:hover:not(:disabled):not(:active), .price-row a:hover:not(:active),
  .primary-nav ~ * button:hover:not(:disabled):not(:active), #sign-out:hover:not(:active) { translate: 0 -1px; }
}
.icon-btn:active:not(:disabled), .workbench button:active:not(:disabled), .price-row a:active { translate: 0 1px; scale: .97; }
/* menu rows: the highlight is its own layer, so it can glide */
.site-menu a, .page-search nav a { position: relative; isolation: isolate; }
.site-menu a::after, .page-search nav a::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: rgb(255 255 255 / .06); opacity: 0; pointer-events: none; }
.site-menu a:is(:hover, :focus-visible)::after, .page-search nav a:is(:hover, :focus-visible)::after { opacity: 1; }
.site-menu a:hover, .page-search nav a:hover, .page-search nav a:focus-visible { background: transparent; }
@media (prefers-reduced-motion: no-preference) {
  .site-menu a::after, .page-search nav a::after { transition: opacity var(--m-1) var(--m-ease); }
  /* native checkboxes and radios keep their look; the change gets a soft pop */
  input:is([type=checkbox], [type=radio]):checked { animation: vs-pop var(--m-2) var(--m-spring); }
  .icon-btn, .workbench button, .price-row a, .primary-nav ~ * button, #sign-out { transition: transform var(--m-1) var(--m-ease), translate var(--m-1) var(--m-ease), scale var(--m-1) var(--m-ease); }
  .vs-tilt.vs-tilt.vs-tilt { transition: transform var(--m-3) var(--m-ease), translate var(--m-1) var(--m-ease), scale var(--m-1) var(--m-ease); }
  .vs-tilt.vs-tilting.vs-tilting { transition: transform var(--m-1) var(--m-ease), translate var(--m-1) var(--m-ease), scale var(--m-1) var(--m-ease); }
  .vs-sheen { transition: opacity var(--m-3) var(--m-ease); }
}

/* ── 8 · reduced motion: no tilt, drift or slides; short fades remain ── */
@media (prefers-reduced-motion: reduce) {
  .vs-ambient, .vs-sheen { display: none !important; }
  :is(.site-form, .access-fields) [role=status]:not(:empty), [data-account-content]:not([hidden]), .st-notice:not(:empty), .st-error:not([hidden]),
  .st-banner, .st-toast, .panel.is-active, .st-dialog[open], .st-drawer[open], dialog[open], .site-menu { animation: vs-fade var(--m-1) linear !important; }
}

/* ── 9 · high contrast: solid, outlined, no translucency or light play ─ */
@media (prefers-contrast: more), (forced-colors: active) {
  :root {
    --line: #8d899c; --line-2: #b4b0c2; --line-3: #e6e3ee; --field-line: #e6e3ee; --violet-line: #cfc8ff;
    --fog: #e7e4f0; --mist: #cfccda; --surface: linear-gradient(var(--ink-2), var(--ink-2));
    --violet-wash: #1b1830; --shadow-sm: 0 0 #0000; --shadow: 0 0 #0000; --shadow-lg: 0 0 #0000; --shadow-float: 0 0 0 1px #e6e3ee;
  }
  *, *::before, *::after, ::backdrop { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .site-header::before, .st-strip::before, body > header:not(.site-header)::before { background: var(--void) !important; }
  .site-menu, .page-search, .st-toast, .st-dialog, .st-drawer, dialog, [data-tip]::after { background: var(--ink-2) !important; }
  .site-proof, .workbench, .read-intro .read-sample, .access-spread .site-form, .st-gate, .site-card, .specimen, .studio-page .glass { background: var(--ink-2) !important; border-color: var(--line-2) !important; }
  .processing, .locked-card { background: var(--ink) !important; }
  dialog::backdrop, .st-dialog::backdrop, .st-drawer::backdrop { background: #000 !important; }
  .vs-ambient, .vs-sheen, .workbench::after, .home-hero-art { display: none !important; }
}
