/* ================= ClearBound Labs =================
   Palette: paper white / ink / deep petrol teal, with dark mode
   Type: Zodiak (display) · Switzer (body) · Spline Sans Mono (labels)
   ==================================================== */

:root {
  --paper: #F5F6F7;
  --ink: #0E1116;
  --accent: #0B5C52;
  --gray: #5C6672;
  --line: #DDE0E2;
  --surface: #FDFDFC;
  --grid-line: rgba(14, 17, 22, 0.035);
  --dot: rgba(14, 17, 22, 0.11);
  --rule-line: rgba(11, 92, 82, 0.10);
  --field-mark: #BBC0C5;
  --ring-gold: #A87B2A;
  --ring-rose: #9C3D54;
  --lg-s1: #4C1D95;
  --lg-s2: #0369A1;
  --lg-glow: rgba(13, 148, 136, 0.55);
  --serif: "Zodiak", Georgia, serif;
  --sans: "Satoshi", -apple-system, "Segoe UI", sans-serif;
  --reading: "Merriweather", Georgia, serif;
  --mono: "Space Mono", "SF Mono", Consolas, monospace;
  --measure: 34rem;
  --pad: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --paper: #000000;
  --ink: #F2F4F6;
  --accent: #45C4B3;
  --gray: #9BA4AD;
  --line: #20252B;
  --surface: #0C0F12;
  --grid-line: rgba(242, 244, 246, 0.05);
  --rule-line: rgba(69, 196, 179, 0.14);
  --field-mark: #454F59;
  --ring-gold: #D9A441;
  --ring-rose: #C75B7A;
  --lg-s1: #C4B5FD;
  --lg-s2: #67E8F9;
  --lg-glow: rgba(94, 234, 212, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  /* reading text is Merriweather; UI elements opt back into the sans below */
  font-family: var(--reading);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: page-in 500ms ease both;
  transition: background 350ms ease, color 350ms ease;
}

@keyframes page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1.15rem var(--pad);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background 350ms ease, border-color 350ms ease;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark-glyph { display: inline-flex; transition: transform 400ms var(--ease); }
.wordmark:hover .wordmark-glyph { transform: translateY(-2px); }

/* logo: 3d cube pops in face by face, rings tumble around it forever */
.lg-face {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: lg-pop 500ms var(--ease) forwards;
}

.lg-f1 { animation-delay: 150ms; }
.lg-f2 { animation-delay: 280ms; }
.lg-f3 { animation-delay: 400ms; }

@keyframes lg-pop {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.lg-cube-g {
  transform-box: fill-box;
  transform-origin: center;
  animation: lg-breathe 3.6s ease-in-out 1.2s infinite;
}

/* the cube is alive: gentle float with a breathing glow */
@keyframes lg-breathe {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 0 transparent); }
  50% { transform: translateY(-0.8px) scale(1.04); filter: drop-shadow(0 0 3.5px var(--lg-glow)); }
}

/* orbits: thin neutral rings, back arc dimmer than front for depth,
   one accent dot circling each ring */
.lg-arc {
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0;
  animation: lg-arc-in 700ms ease 600ms forwards;
}

.lg-back { animation-name: lg-arc-in-back; }

@keyframes lg-arc-in { to { opacity: 0.32; } }
@keyframes lg-arc-in-back { to { opacity: 0.14; } }

.lg-dot {
  opacity: 0;
  animation: lg-dot-in 400ms ease 1100ms forwards;
  filter: drop-shadow(0 0 1.5px var(--lg-glow));
}

@keyframes lg-dot-in { to { opacity: 1; } }

.wordmark-labs { font-weight: 400; color: var(--gray); }

/* live project link on research studies */
.study-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  border: 1.5px solid var(--line);
  padding: 0.55rem 1.05rem;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  transition: border-color 300ms ease, transform 300ms var(--ease);
}

.study-link:hover { border-color: var(--accent); transform: translateY(-2px); }

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 2.2s ease-in-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.study-link-arrow {
  width: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 300ms var(--ease);
}

.study-link:hover .study-link-arrow { transform: translateX(3px); }

/* linkedin icons beside founder names */
.founder-li {
  display: inline-flex;
  margin-left: 0.6rem;
  vertical-align: baseline;
  color: var(--gray);
  transition: color 300ms ease, transform 300ms var(--ease);
}

.founder-li:hover { color: var(--accent); transform: translateY(-2px); }

.founder-li svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.2vw, 1.8rem);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
}

.site-nav a:not(.nav-contact) {
  position: relative;
  text-decoration: none;
  color: var(--gray);
  padding: 0.2rem 0;
  transition: color 180ms ease;
}

.site-nav a:not(.nav-contact)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 4px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 320ms var(--ease);
}

.site-nav a:not(.nav-contact):hover,
.site-nav a[aria-current="page"] { color: var(--ink); }

.site-nav a:not(.nav-contact):hover::after,
.site-nav a[aria-current="page"]:not(.nav-contact)::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-contact {
  color: var(--accent);
  text-decoration: none;
  border: 1.5px solid currentColor;
  padding: 0.38rem 0.95rem;
  /* hand-drawn wobble */
  border-radius: 155px 12px 145px 12px / 12px 145px 12px 155px;
  transition: background 180ms ease, color 180ms ease;
}

.nav-contact:hover,
.nav-contact[aria-current="page"] {
  background: var(--accent);
  color: var(--paper);
}

/* ---------- theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--gray);
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, transform 450ms var(--ease);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(45deg);
}

.tt-core { fill: currentColor; r: 4.5px; transition: r 450ms var(--ease); }

.tt-cut { transform: translate(11px, -11px); transition: transform 500ms var(--ease); }

.tt-rays line {
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.tt-rays {
  transform-origin: 12px 12px;
  transition: opacity 300ms ease, transform 450ms var(--ease);
}

[data-theme="dark"] .tt-core { r: 7px; }
[data-theme="dark"] .tt-cut { transform: translate(-1px, 1px); }
[data-theme="dark"] .tt-rays { opacity: 0; transform: scale(0.4); }

/* full spin + squash punch on every toggle */
.theme-toggle.spin svg { animation: tog-spin 550ms var(--ease); }

@keyframes tog-spin {
  0%   { transform: rotate(0) scale(1); }
  45%  { transform: rotate(180deg) scale(0.62); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ---------- shared layout ---------- */

main > section {
  position: relative;
  padding: clamp(4.5rem, 10vw, 8rem) var(--pad);
  max-width: 80rem;
  margin: 0 auto;
}

/* hand-wavy dividers between sections instead of ruled lines */
main > section + section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--pad);
  right: var(--pad);
  height: 4px;
  background: var(--gray);
  opacity: 0.35;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 8' preserveAspectRatio='none'><path d='M2 5 C24 2 42 7 66 4 C88 2 108 6 128 3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>") repeat-x 0 0 / 130px 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 8' preserveAspectRatio='none'><path d='M2 5 C24 2 42 7 66 4 C88 2 108 6 128 3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>") repeat-x 0 0 / 130px 100%;
}


.section-head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }

.section-marker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* hand-drawn wavy underline instead of a ruled border */
.section-marker::after {
  content: "";
  display: block;
  height: 5px;
  margin-top: 5px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
}

.section-intro {
  margin-top: 1.4rem;
  max-width: var(--measure);
  color: var(--gray);
}

.section-foot { margin-top: clamp(1.75rem, 4vw, 2.5rem); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 1.6rem;
}

.line-mask { display: block; overflow: hidden; }
.line { display: block; }

/* ---------- buttons & links ---------- */

.btn-primary {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  color: var(--paper);
  background: var(--accent);
  padding: 0.85rem 1.7rem;
  border-radius: 2.5rem;
  transition: background 200ms ease, transform 200ms var(--ease), box-shadow 200ms ease;
}

.btn-primary:hover {
  background: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.5);
}

.btn-ghost {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  color: var(--ink);
  padding: 0.85rem 1.7rem;
  border: 2px solid var(--line);
  /* hand-drawn wobble */
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  transition: border-color 200ms ease, color 200ms ease, transform 200ms var(--ease);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.text-link {
  position: relative;
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--accent);
  padding-bottom: 0.15rem;
}

.text-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 320ms var(--ease);
}

.text-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---------- landing hero ---------- */

.hero {
  position: relative;
  min-height: calc(100vh - 4.2rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: clamp(2rem, 5vh, 3.5rem);
  overflow: hidden;
}

#field-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }

/* ---------- hero whiteboard scene ---------- */

/* network edges are lighter than nodes */
.sk.thin { stroke-width: 2.5; opacity: 0.5; }

/* signal pulses flowing through the net forever */
.runner {
  fill: var(--accent);
  opacity: 0;
  animation: label-in 400ms ease 6500ms forwards;
}

/* ---------- doodle icons: little sketches beside section labels ---------- */

.doodle {
  display: inline-block;
  width: 32px;
  height: 32px;
  margin-left: 0.7rem;
  vertical-align: -11px;
  overflow: visible;
}

.doodle path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1100ms var(--ease) 350ms;
}

.doodle.reveal.in path { stroke-dashoffset: 0; }

.doodle-load path { animation: draw 1100ms var(--ease) 1400ms forwards; }

/* little sparkle at the end of page titles: draws in, then twinkles */
.sparkle {
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-left: 0.15em;
  vertical-align: super;
  overflow: visible;
  transform-origin: center;
  animation: twinkle 2.8s ease-in-out 2600ms infinite;
}

.sparkle path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 700ms var(--ease) 1500ms forwards;
}

@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%      { transform: scale(1.25) rotate(14deg); opacity: 0.7; }
}

/* tiny inline doodles inside sentences (the contact smiley) */
.mini-doodle {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 0.35em;
  vertical-align: -5px;
  overflow: visible;
}

.mini-doodle path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1100ms var(--ease) 1800ms forwards;
}

/* ---------- contact: paper plane on a dotted loop ---------- */

.trail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 10;
  opacity: 0.4;
}

.plane-fly .sk { stroke-width: 3.5; }

.hero-grid,
.page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 4.6vw, 4.4rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.hero-title em { font-style: italic; color: var(--accent); }

.u-wrap { position: relative; display: inline-block; }

.title-underline {
  position: absolute;
  left: 0;
  bottom: -0.02em;
  width: 100%;
  height: 0.14em;
  overflow: visible;
}

.title-underline path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 700ms var(--ease) 1500ms forwards;
}

.hero-sub {
  margin-top: 2.1rem;
  max-width: var(--measure);
  font-size: 1.125rem;
  color: var(--gray);
}

.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  right: var(--pad);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gray);
  transition: color 200ms ease;
}

.hero-scroll:hover { color: var(--accent); }

.hero-scroll svg {
  width: 14px;
  height: auto;
  overflow: visible;
  animation: bob 2.2s ease-in-out infinite;
}

.hero-scroll svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ---------- marker sketches (house style) ---------- */

.hero-sketch {
  cursor: pointer;
  max-width: 32rem;
  justify-self: end;
  width: 100%;
}

.hero-sketch svg { display: block; width: 100%; height: auto; }

.sk {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 900ms var(--ease) forwards;
}

.sk.ink { stroke: var(--ink); stroke-width: 4.5; }

.sk-o1 { animation-delay: 700ms; }
.sk-o2 { animation-delay: 1000ms; animation-duration: 1400ms; }
.sk-o3 { animation-delay: 2500ms; animation-duration: 700ms; }
.sk-o4 { animation-delay: 3250ms; animation-duration: 500ms; }
.sk-o5 { animation-delay: 3800ms; animation-duration: 400ms; }
.sk-o6 { animation-delay: 4200ms; animation-duration: 300ms; }

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* theme switch: circular ink wipe from the toggle button (View Transitions) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* during the wipe both snapshots must show final colors instantly */
:root.vt * { transition: none !important; }

.sk-label {
  font-family: "Caveat", cursive;
  font-size: 27px;
  font-weight: 600;
  fill: var(--accent);
  opacity: 0;
  animation: label-in 500ms ease forwards;
}

.sk-l1 { animation-delay: 4500ms; }
.sk-l2 { animation-delay: 4750ms; }
.sk-l3 { animation-delay: 5000ms; }
.sk-l4 { animation-delay: 5250ms; }

@keyframes label-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* draw order for multi-step scenes.
   Must come AFTER the .sk / .sk-label shorthands, or their implicit
   animation-delay: 0s wins the cascade and kills the sequencing. */
.q1 { animation-delay: 700ms; }
.q2 { animation-delay: 1500ms; }
.q3 { animation-delay: 2000ms; }
.q4 { animation-delay: 2500ms; }
.q5 {
  animation:
    draw 700ms var(--ease) 3300ms forwards,
    pop 450ms var(--ease) 4100ms;
  transform-box: fill-box;
  transform-origin: center;
}
.q6 { animation-delay: 3700ms; }
.q7 { animation-delay: 4200ms; }
.q8 { animation-delay: 4900ms; }

@keyframes pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.25) rotate(-5deg); }
  100% { transform: scale(1); }
}

.q9 {
  animation:
    draw 700ms var(--ease) 5600ms forwards,
    pop 450ms var(--ease) 6400ms;
  transform-box: fill-box;
  transform-origin: center;
}
.q10 { animation-delay: 6400ms; }

.ql1 { animation-delay: 2600ms; }
.ql2 { animation-delay: 5300ms; }
.ql3 { animation-delay: 6800ms; }

/* ---------- sub-page hero ---------- */

.page-hero { padding-top: clamp(4rem, 9vw, 7rem); }

.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.4vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  max-width: 20ch;
}

.page-lede {
  margin-top: 1.9rem;
  max-width: 44rem;
  font-size: 1.125rem;
  color: var(--gray);
}

/* ---------- per-page ambient backgrounds ---------- */

/* research: graph paper */
.page-research {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-attachment: fixed;
}

/* about: live dot field on a fixed canvas (see script.js) */
.page-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* contact: ruled letter paper */
.page-contact {
  background-image: linear-gradient(transparent calc(100% - 1px), var(--rule-line) calc(100% - 1px));
  background-size: 100% 44px;
  background-attachment: fixed;
}

/* ---------- philosophy ---------- */

.triad { display: grid; gap: 0.4rem; }

.triad-line {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.2vw, 3.1rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--gray);
}

.triad-word { color: var(--ink); }

.triad-thesis { color: var(--ink); }
.triad-thesis .triad-word { color: var(--accent); font-style: italic; }

/* scribbled ring around "Infrastructure", drawn when scrolled into view */
.circled { position: relative; display: inline-block; }

.circle-sketch {
  position: absolute;
  inset: -14% -5%;
  width: 110%;
  height: 128%;
  overflow: visible;
  pointer-events: none;
}

.circle-sketch path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.85;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 900ms var(--ease);
}

.reveal.in .circle-sketch path {
  stroke-dashoffset: 0;
  transition-delay: 500ms;
}

/* study numbers need a roomier ring than inline words */
.study-index.circled .circle-sketch {
  inset: -80% -120%;
  width: auto;
  height: auto;
}

/* founder names: ring sketches in on hover instead of on scroll */
.founder-ring path { stroke-width: 4; }
.founder-card .founder-ring path { stroke-dashoffset: 1; transition-delay: 0ms; }
.founder-card:hover .founder-ring path { stroke-dashoffset: 0; }

.philosophy-note {
  margin-top: clamp(2rem, 5vw, 3rem);
  max-width: 44rem;
  color: var(--gray);
}

/* ---------- research preview (landing) ---------- */

.program-list { list-style: none; }

.program {
  display: grid;
  grid-template-columns: 4.5rem 1fr 3rem;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  padding: clamp(1.6rem, 3.5vw, 2.2rem) 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.program-list li:last-of-type .program { border-bottom: 1px solid var(--line); }

.program-index {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--gray);
  transition: color 220ms ease;
}

.program-title {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  letter-spacing: -0.015em;
  line-height: 1.2;
  transition: color 220ms ease, transform 320ms var(--ease);
}

.program-tags {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 0.5rem;
}

.program-arrow {
  justify-self: end;
  width: 2.6rem;
  transition: transform 320ms var(--ease);
}

.program-arrow svg { display: block; width: 100%; height: auto; overflow: visible; }

.program-arrow path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 420ms var(--ease);
}

.program:hover .program-title,
.program:hover .program-index { color: var(--accent); }
.program:hover .program-title { transform: translateX(6px); }
.program:hover .program-arrow { transform: translateX(4px); }
.program:hover .program-arrow path { stroke-dashoffset: 0; }

/* ---------- research page studies ---------- */

.study-grid {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}

.study-meta { padding-top: 0.6rem; }

.study-index {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}


.study-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 24ch;
}

/* marker underline sweeps in under each study title on scroll */
.study-title::after {
  content: "";
  display: block;
  width: min(16rem, 70%);
  height: 5px;
  margin-top: 0.6rem;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 700ms var(--ease) 350ms;
}

.study-title.reveal.in::after { transform: scaleX(1); }

.study-lede {
  margin-top: 1.2rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--accent);
}

.study-body p:not(.study-lede) {
  margin-top: 1.3rem;
  max-width: 44rem;
  color: var(--gray);
}

/* ---------- principles ---------- */

.principle-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.principle-grid li {
  position: relative;
  background: var(--paper);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  transition: background 220ms ease;
}

/* small check sketches itself in when you hover a value */
.li-check {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 1.05rem;
  height: 1.05rem;
  overflow: visible;
}

.li-check path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 380ms var(--ease);
}

.principle-grid li:hover .li-check path { stroke-dashoffset: 0; }

.principle-grid li:hover { background: var(--surface); }

.principle-grid h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}

.principle-grid p {
  font-size: 0.9rem;
  color: var(--gray);
  line-height: 1.55;
}

/* ---------- prose / about ---------- */

.prose p {
  max-width: 44rem;
  color: var(--gray);
}

.prose p + p { margin-top: 1.4rem; }

.founder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22rem));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  width: fit-content;
}

.founder-card {
  background: var(--paper);
  padding: clamp(1.5rem, 3vw, 2.2rem) clamp(1.75rem, 3vw, 2.6rem);
  transition: background 220ms ease;
}

.founder-card:hover { background: var(--surface); }

.founder-card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.founder-role {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
}

.founder-mail {
  display: inline-block;
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.1rem;
  transition: color 180ms ease, border-color 180ms ease;
}

.founder-mail:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- page CTA ---------- */

.page-cta-text {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.015em;
  max-width: 26ch;
  margin-bottom: 2rem;
}

/* ---------- contact ---------- */

.contact-hero { min-height: 60vh; }

.contact-mails {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 2.5rem;
}

.contact-mail {
  position: relative;
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--accent);
  padding-bottom: 0.3rem;
}

.contact-mail-underline {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 420ms var(--ease);
}

.contact-mail:hover .contact-mail-underline {
  transform: scaleX(1);
  transform-origin: left;
}

.contact-note {
  margin-top: 1.6rem;
  font-size: 0.95rem;
  color: var(--gray);
}

/* ---------- footer ---------- */

.site-footer {
  padding: 0 var(--pad) clamp(2.5rem, 6vw, 4rem);
}

/* pencil-drawn divider; all timing lives in the SVG (SMIL), perfectly synced */
.footer-bounds { max-width: 80rem; margin: 0 auto; }

.footer-bounds svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fb-draw {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.fb-pencil path {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 4rem;
  align-items: flex-start;
}

.footer-mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
}

.footer-line {
  margin-top: 0.3rem;
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
  font-size: 0.95rem;
  width: max-content;
}

.footer-line::after {
  content: "";
  display: block;
  height: 4px;
  margin-top: 3px;
  background: var(--accent);
  opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding-top: 0.25rem;
}

.footer-nav a {
  position: relative;
  text-decoration: none;
  color: var(--gray);
  padding-bottom: 0.2rem;
  transition: color 180ms ease;
}

.footer-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 4px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M2 5 C20 2 40 7 60 4 C75 2 90 6 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") no-repeat 0 0 / 100% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 320ms var(--ease);
}

.footer-nav a:hover { color: var(--accent); }

.footer-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.back-top {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gray);
  transition: color 200ms ease;
}

.back-top svg {
  width: 30px;
  height: 30px;
  overflow: visible;
  transition: transform 300ms var(--ease);
}

.back-top svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-top:hover { color: var(--accent); }
.back-top:hover svg { transform: translateY(-4px); }

/* ---------- motion ---------- */

.reveal-load {
  opacity: 0;
  transform: translateY(1.3rem);
  animation: rise 850ms var(--ease) forwards;
}

.d0 { animation-delay: 120ms; }
.d1 { animation-delay: 230ms; }
.d2 { animation-delay: 340ms; }
.d3 { animation-delay: 450ms; }
.d4 { animation-delay: 560ms; }
.d5 { animation-delay: 670ms; }
.d6 { animation-delay: 900ms; }

.hero-title .reveal-load,
.page-title .reveal-load { transform: translateY(108%); }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 750ms var(--ease), transform 750ms var(--ease);
  transition-delay: var(--stagger, 0ms);
}

.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { animation: none; transition: none; }
  .reveal-load, .reveal,
  .hero-title .reveal-load,
  .page-title .reveal-load {
    animation: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-scroll svg { animation: none; }
  .sk, .q5, .q9 { animation: none; stroke-dashoffset: 0; }
  .sk-label { animation: none; opacity: 1; }
  .plane-fly, .runner, .fb-pencil { display: none; }
  .fb-draw { stroke-dasharray: none; }
  .back-top svg { transition: none; }
  .doodle path, .doodle-load path,
  .sparkle path, .mini-doodle path {
    animation: none;
    stroke-dashoffset: 0;
    transition: none;
  }
  .sparkle { animation: none; }
  .theme-toggle, .tt-core, .tt-cut, .tt-rays { transition: none; }
  .theme-toggle.spin svg { animation: none; }
  .title-underline path,
  .circle-sketch path,
  .program-arrow path,
  .li-check path {
    animation: none;
    stroke-dashoffset: 0;
    transition: none;
  }
  .lg-face { animation: none; opacity: 1; }
  .lg-cube-g { animation: none; }
  .lg-arc { animation: none; opacity: 0.32; }
  .lg-arc.lg-back { animation: none; opacity: 0.14; }
  .lg-dot { display: none; }
  .live-dot { animation: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-grid, .page-hero-grid { grid-template-columns: 1fr; }
  .hero-sketch { justify-self: start; max-width: 26rem; margin-top: 1rem; }
  .principle-grid { grid-template-columns: repeat(2, 1fr); }
  .study-grid { grid-template-columns: 1fr; }
  .study-meta { display: flex; align-items: baseline; gap: 1.5rem; }
}

@media (max-width: 640px) {
  .wordmark-labs { display: none; }
  .site-nav { gap: 0.7rem; font-size: 0.82rem; }
  .nav-contact { padding: 0.3rem 0.7rem; }
  .theme-toggle { width: 1.9rem; height: 1.9rem; }
  .hero-sub, .page-lede { font-size: 1.05rem; }
  .program { grid-template-columns: 2.6rem 1fr; }
  .program-arrow { display: none; }
  .principle-grid { grid-template-columns: 1fr; }
  .founder-grid { grid-template-columns: 1fr; width: 100%; }
  .back-top { margin-left: 0; }
  .contact-mail { overflow-wrap: anywhere; }
  .hero-scroll { display: none; }
}

/* small phones */
@media (max-width: 420px) {
  .hero-title, .page-title { font-size: 2.05rem; }
  .triad-line { font-size: 1.5rem; }
  .contact-mail { font-size: 1.15rem; }
  .hero-sketch { max-width: 100%; }
  .doodle { width: 26px; height: 26px; vertical-align: -8px; }
  .hero-actions .btn-primary,
  .hero-actions .btn-ghost { width: 100%; text-align: center; }
}
