:root {
  --bg: #FFFFFF;
  --ink: #1A1A1A;
  /* The accent is the throughline: blob, link, active rule, caret. Saturated,
     not pastel. Secondary tones below derive from it so the page never falls
     back to a washed-out warm grey. */
  --accent: #8e1da5;
  --ink-soft: #4a2c52;
  --rule:        color-mix(in srgb, var(--accent) 22%, transparent);
  --placeholder: color-mix(in srgb, var(--accent) 38%, transparent);
  --display: "Fraunces", "Times New Roman", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0814;          /* deep purple dusk — matches the blob's bgDark */
    --ink: #ECE1F0;         /* warm off-white, slight violet tint */
    --accent: #d77af0;      /* the lit-side blob hue, readable on dark */
    --ink-soft: #9b8aa6;
    --rule:        color-mix(in srgb, var(--accent) 26%, transparent);
    --placeholder: color-mix(in srgb, var(--accent) 30%, transparent);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

body { overflow-x: hidden; }

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

/* Blob canvas — fixed, full viewport. The renderer positions the blob
   in the right third on desktop and centers it on mobile. */
#blob-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

main {
  position: relative;
  z-index: 3;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

/* On desktop, text occupies the left ~58% so it doesn't collide with
   the blob which is rendered into the right third of the viewport. */
section {
  max-width: 38rem;
  padding-block: clamp(44px, 7vh, 88px);
}

section:first-of-type {
  padding-top: clamp(40px, 7vh, 80px);
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

section.contact {
  max-width: 44rem;
  padding-bottom: clamp(56px, 9vh, 110px);
}

/* Section signposts — small, lowercase, letterspaced. Not banners. */
.signpost {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--ink-soft);
  margin: 0 0 28px 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.signpost::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--ink-soft);
  display: inline-block;
}

/* The opening sentence — the one piece of display type that earns the room. */
.lede {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 400;
  font-size: clamp(34px, 5.8vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 1.2em 0;
  max-width: 22ch;
}
.lede em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

p {
  margin: 0 0 1.1em 0;
  max-width: 36rem;
}
p:last-child { margin-bottom: 0; }

/* "That's the work." — display-set pivot, smaller than the lede. */
.pivot {
  font-family: var(--display);
  font-variation-settings: "opsz" 72;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.6em 0 0 0;
}

/* Founder name in bios — only other display use. */
.who { margin-top: 0.4em; }
.who + .who { margin-top: 2.2em; }
.who h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 60;
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 26px);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.35em 0;
}
.who .role {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-soft);
  margin: 0 0 0.8em 0;
}

a.email {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: opacity 160ms ease;
}
a.email:hover { opacity: 0.7; }

/* The interaction. A single field, no chrome. */
.field {
  position: relative;
  margin-top: 2.4em;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  transition: border-color 200ms ease;
}
.field.is-active { border-top-color: var(--accent); }
.field.is-sent   { border-top-color: var(--accent); }

.field .prompt {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--ink-soft);
  margin: 0 0 14px 0;
  transition: color 200ms ease;
}
.field.is-active .prompt { color: var(--accent); }

textarea.input {
  display: block;
  width: 100%;
  min-height: 1.6em;
  resize: none;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-family: var(--display);
  font-variation-settings: "opsz" 36;
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.32;
  letter-spacing: -0.01em;
  caret-color: var(--accent);
  overflow: hidden;
}
textarea.input::placeholder {
  color: var(--placeholder);
  font-style: italic;
}

.field .meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-soft);
  min-height: 1.4em;
}
.field .hint {
  opacity: 0.7;
  transition: opacity 200ms ease;
}
.field.is-active .hint { opacity: 1; }
.field .status { color: var(--accent); }

@media (max-width: 720px) {
  /* Canvas stays full-viewport so the bg field fills the page. The blob
     itself is restricted to a top-right rectangle via shader discard
     (uBlobRegion) — see layout() in blob.js. */
  section { max-width: none; }
  main { padding: 0 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .field, .field .prompt, a.email { transition: none; }
}

/* Tiny initial-paint guard: hide canvas until WebGL is set up so we never
   flash an empty rectangle. JS removes this class on first frame. */
#blob-canvas.pending { opacity: 0; }

/* The fine-tune toggle. Fixed in the bottom-right; small and quiet so the
   page reads as still. Lights up on hover and when the panel is open. */
#tune-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 50%;
  color: color-mix(in srgb, var(--accent) 70%, transparent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
#tune-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
#tune-toggle:focus-visible {
  outline: none;
  color: var(--accent);
  border-color: var(--accent);
}
#tune-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}

/* The lil-gui fine-tune panel, themed to the page: Inter, accent + ink,
   a glass surface (translucent --bg + backdrop blur) over the live canvas.
   Compact rows; the slider gets an accent fill + a small ink knob.
   NOTE: every folder is its own nested `.lil-gui` element and lil-gui's
   (later-injected) sheet re-declares all vars via `.lil-gui{}`, so the
   token overrides must target the root AND every nested folder, or folder
   contents fall back to lil-gui's blue numbers / near-white text. */
.lil-gui.root,
.lil-gui.root .lil-gui {
  --background-color:       color-mix(in srgb, var(--bg) 70%, transparent);
  --text-color:             var(--ink);
  --title-background-color: color-mix(in srgb, var(--bg) 78%, transparent);
  --title-text-color:       var(--ink-soft);
  --widget-color:           color-mix(in srgb, var(--accent) 12%, transparent);
  --hover-color:            color-mix(in srgb, var(--accent) 22%, transparent);
  --focus-color:            color-mix(in srgb, var(--accent) 34%, transparent);
  --number-color:           var(--accent);
  --string-color:           var(--accent);

  --font-family:        var(--sans);
  --font-family-mono:   var(--sans);
  --font-size:          11px;
  --input-font-size:    11px;
  --padding:            5px;
  --spacing:            3px;
  --widget-height:      18px;
  --title-height:       26px;
  --name-width:         42%;
  --scrollbar-color:    var(--rule);
  --slider-knob-width:  0px;
  --widget-border-radius: 4px;
}

/* Outer shell only — not the nested folders. */
.lil-gui.root {
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: 0 10px 34px color-mix(in srgb, var(--accent) 14%, transparent),
              0 2px 8px rgba(0, 0, 0, 0.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  overflow: hidden;
}
.lil-gui .children { background: transparent; }

/* Folder titles → the page's lowercase, letterspaced signpost voice.
   lil-gui's own stylesheet is injected after ours and its selectors are
   specific, so these overrides are scoped + !important to win the cascade. */
.lil-gui.root .title {
  font-weight: 500 !important;
  letter-spacing: 0.11em;
  text-transform: lowercase;
  border-bottom: 1px solid var(--rule);
}
.lil-gui.root > .title {
  font-family: var(--sans);
  font-weight: 600 !important;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--ink-soft) !important;
}
.lil-gui.root .controller > .name {
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
}
.lil-gui.root .controller input { font-variant-numeric: tabular-nums; }

/* Inputs: quiet until focused, accent caret + focus ring. */
.lil-gui.root input {
  transition: background-color 140ms ease, box-shadow 140ms ease;
  caret-color: var(--accent);
}
.lil-gui.root input:focus {
  box-shadow: 0 0 0 1px var(--accent) inset;
}

/* Slider: thin pill track, accent fill, small ink knob at the fill edge. */
.lil-gui.root .controller.number .slider {
  height: 5px !important;
  align-self: center;
  border-radius: 999px !important;
  overflow: visible !important;
  background: var(--widget-color) !important;
}
.lil-gui.root .controller.number .fill {
  background: var(--accent) !important;
  border-right: 0 !important;
  border-radius: 999px;
  position: relative;
}
.lil-gui.root .controller.number .fill::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bg) 75%, transparent);
  transition: transform 120ms ease;
}
.lil-gui.root .controller.number .slider:hover .fill::after,
.lil-gui.root .controller.number .slider.active .fill::after {
  transform: translateY(-50%) scale(1.2);
}

/* Color swatch + checkbox accents. */
.lil-gui.root .controller.color .display { border-radius: 4px; }
.lil-gui.root .controller.boolean input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

/* Paper grain — tiny SVG turbulence, multiplied at low opacity. Sits above
   the blob, ties the WebGL surface into the page's material. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  opacity: 0.07;
  mix-blend-mode: multiply;
}

/* Soft vignette — pulls the corners of the viewport toward the accent rather
   than toward grey, so the edge falloff reads as theme-coherent dimension
   rather than a pastel haze. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 42%,
              transparent 55%,
              color-mix(in srgb, var(--accent) 14%, transparent) 100%);
}

@media (prefers-color-scheme: dark) {
  /* Multiply darkens an already-dark page into nothing. Soft-light lifts the
     grain so it reads as surface noise rather than vanishing. */
  body::before {
    mix-blend-mode: soft-light;
    opacity: 0.22;
  }
  /* Deeper vignette to match the lower base luminance. */
  body::after {
    background: radial-gradient(ellipse at 50% 42%,
                transparent 50%,
                rgba(0, 0, 0, 0.40) 100%);
  }
}
