/*
 * Shared by the landing page and Meet Pip: design tokens, the reset,
 * typography, the parts both pages draw, and the motion switches.
 * Spacing follows an 8px grid and is written out where it is used;
 * the tokens hold what changes together across the site.
 */

:root {
  /* Colour */
  --ink: #203047;
  --muted: #566579;
  --subtle: #69758a;
  --iris: #6355d9;
  --iris-deep: #4939b5;
  --canvas: #f8faff;
  --surface: #fff;
  --lilac: #eeeaff;
  --line: #e4e7f0;
  --teal: #0a756a;
  --yellow: #ffd56a;

  /* Type */
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: ui-rounded, "Avenir Next", "Arial Rounded MT Bold", system-ui, sans-serif;

  /* Radius */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  /* Motion */
  --motion-quick: .2s;

  /* Layout: the page's content width and the space kept beside it, and the
     wider band the header and footer use. Pages narrow the gutters where
     their own layout changes. */
  --header: 88px;
  --page-width: 1280px;
  --gutter: 56px;
  --frame-width: calc(var(--page-width) + 64px);
  --frame-gutter: 40px;
}

/* Reset and typography */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 24px);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--iris);
  outline-offset: 5px;
}

h1, h2, h3, h4, p, figure { margin: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -.045em;
}

h2 { font-size: clamp(2.5rem, 4.35vw, 4.25rem); }

h3 {
  font-size: 1.4rem;
  letter-spacing: -.025em;
}

p { color: var(--muted); }

.eyebrow {
  color: var(--iris);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .08em;
  line-height: 1.6;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: 24px;
  top: -80px;
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
}

.skip-link:focus { top: 16px; }

/* Page frame */

.section-wrap {
  width: min(var(--page-width), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/*
 * A band spans the window, keeps its content at the page width with --bleed,
 * and clips sideways at the window's edge, so decoration (glows, orbits) can
 * reach into the gutters without widening the page.
 */
.band {
  --bleed: max(var(--gutter), (100% - var(--page-width)) / 2);
  padding-inline: var(--bleed);
  overflow-x: clip;
}

body > header {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: max(var(--frame-gutter), (100% - var(--frame-width)) / 2);
}

header .wordmark { flex-shrink: 0; }

/* Pip's stage: the poster shows until the 3D view has drawn a frame. */

.pip-render-host {
  position: relative;
  isolation: isolate;
  touch-action: pan-y;
}

.pip-render-host[data-pip-mode=explore], .pip-render-host[data-pip-mode=pose] {
  touch-action: none;
  cursor: grab;
}

.pip-render-host.is-dragging { cursor: grabbing; }

.pip-render-host:focus-visible {
  outline: 3px solid var(--iris);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

.pip-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity .3s ease;
  outline: none;
}

.pip-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  opacity: 1;
  transition: opacity .3s ease;
}

.pip-render-host[data-pip-state=ready] > .pip-canvas { opacity: 1; }

.pip-render-host[data-pip-state=ready] > .pip-poster {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 700px) {
  :root {
    --gutter: 24px;
    --frame-gutter: 24px;
  }
  .eyebrow { font-size: 12px; }
  .desktop-break { display: none; }
  header .wordmark { font-size: 20px; }
}

@media (max-width: 380px) {
  :root {
    --gutter: 16px;
    --frame-gutter: 16px;
  }
  header .wordmark { font-size: 17px; }
}

/* The narrowest phones: keep the header inside the screen. */
@media (max-width: 340px) {
  header .wordmark { font-size: 15px; }
}

/*
 * Motion: js/motion.mjs sets <html data-motion> to the visitor's choice, or
 * to the system preference when there is none. Before it runs (and without
 * scripts) the system preference applies; an explicit "on" wins over it.
 */

html[data-motion=off] { scroll-behavior: auto; }

html[data-motion=off] *, html[data-motion=off] *::before, html[data-motion=off] *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion=on]) { scroll-behavior: auto; }

  html:not([data-motion=on]) *, html:not([data-motion=on]) *::before, html:not([data-motion=on]) *::after {
    animation: none !important;
    transition: none !important;
  }
}
