/* ==========================================================================
   BASE: tokens, type scale, reset, layout, shared components
   Ink and butter: near-monochrome, with one soft highlighter for emphasis.
   4-point system: every size, space, radius, line height and duration is a
   multiple of 4. Exceptions: 1px hairlines, tracking in em, opacity, easing
   curves and the fluid display sizes.
   ========================================================================== */

:root {
  /* Colour: light */
  --bg: #F5F5F2;
  --bg-2: #ECECE7;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --ink: #1C1C1F;
  --ink-2: #5A5A60;
  --ink-3: #8B8B91;
  --line: rgba(28, 28, 31, 0.1);
  --line-2: rgba(28, 28, 31, 0.06);
  --mark: #F2DC7A;          /* the highlighter */
  --mark-soft: #F8EDBF;
  /* Figma's component purple: components, instances and selections in the design-tool visuals */
  --component: #8A38F5;
  --on-mark: #1C1C1F;
  --inverse: #1C1C1F;
  --on-inverse: #F5F5F2;
  --positive: #3E8E63;

  /* Project rooms */
  --mint: #D6EBE2;   --mint-ink: #123C30;
  --butter: #F6EBB8; --butter-ink: #3B3208;
  --sky: #D4E1F2;    --sky-ink: #16294A;
  --lilac: #E2E0F6;  --lilac-ink: #27224F;
  --leaf: #D1E3B9;   --leaf-ink: #1F3A16;   /* Errand: a pastel of its green, picked in the Figma hero */

  --shadow-s: 0 1px 2px rgba(28, 28, 31, 0.05), 0 4px 12px -4px rgba(28, 28, 31, 0.08);
  --shadow-m: 0 2px 4px rgba(28, 28, 31, 0.04), 0 12px 32px -12px rgba(28, 28, 31, 0.16);
  --shadow-l: 0 4px 8px rgba(28, 28, 31, 0.04), 0 24px 56px -20px rgba(28, 28, 31, 0.2);

  /* Radius. Anything you press is a pill, panels are 24, things inside
     panels are 16, small parts are 8. */
  --r-xs: 8px;
  --r-s: 12px;
  --r-m: 16px;
  --r-l: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Type */
  --font-display: "Bricolage Grotesque", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-hero: clamp(48px, min(6.8vw, calc((100dvh - 360px) * 0.26)), 108px);
  --fs-h1: 72px;   --lh-h1: 76px;
  --fs-h2: 44px;   --lh-h2: 48px;
  --fs-h3: 24px;   --lh-h3: 32px;
  --fs-lead: 20px; --lh-lead: 32px;
  --fs-body: 16px; --lh-body: 28px;
  --fs-small: 14px; --lh-small: 20px;
  --fs-micro: 12px; --lh-micro: 16px;

  /* Motion: calm. Ease out, no bounce. */
  --t-fast: 160ms;
  --t-base: 240ms;
  --t-slow: 480ms;
  --t-slower: 800ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Layout */
  --gutter: 48px;
  --maxw: 1280px;
  --nav-h: 64px;
  --section: 120px;

  color-scheme: light;
}

@media (width < 1280px) {
  :root { --fs-h1: 64px; --lh-h1: 68px; }
}
@media (width < 1024px) {
  :root {
    --fs-h1: 52px; --lh-h1: 56px;
    --fs-h2: 36px; --lh-h2: 40px;
    --gutter: 32px;
    --section: 96px;
  }
}
@media (width < 640px) {
  :root {
    --fs-hero: clamp(40px, 12vw, 56px);
    --fs-h1: 40px; --lh-h1: 44px;
    --fs-h2: 30px; --lh-h2: 36px;
    --fs-h3: 22px; --lh-h3: 28px;
    --fs-lead: 18px; --lh-lead: 28px;
    --gutter: 20px;
    --section: 72px;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

[hidden] { display: none !important; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--mark); color: var(--on-mark); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 8px; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  padding: 12px 16px; border-radius: var(--r-pill);
  background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-small);
  transform: translateY(-160%);
  transition: transform var(--t-base) var(--ease-out);
}
.skip-link:focus { transform: none; }

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

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section); }

/* ---------- Type ---------- */
.t-h1, .t-h2, .t-h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-stretch: 94%;
}
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: -0.04em; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: -0.03em; }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: -0.015em; }
.t-lead { font-size: var(--fs-lead); line-height: var(--lh-lead); letter-spacing: -0.005em; color: var(--ink-2); }
.t-small { font-size: var(--fs-small); line-height: var(--lh-small); }
.t-label { font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; color: var(--ink-3); }
.t-mono { font-family: var(--font-mono); font-size: var(--fs-micro); line-height: var(--lh-micro); letter-spacing: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* Section head: headline, then one line under it */
.head { display: grid; gap: 20px; max-width: 880px; margin-bottom: 56px; }
.head .t-lead { max-width: 580px; }

/* ---------- The mark: a highlighter swipe ----------
   The one emphasis device on the site. It sweeps in when it's seen. */
.mark {
  padding: 0 0.06em;
  margin: 0 -0.02em;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-position: 0 92%;
  background-size: 100% 0.46em;
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 1100ms var(--ease-out);
}
.motion .mark:not(.is-in) { background-size: 0% 0.46em; }

/* ---------- Buttons ---------- */
.btn {
  --h: 48px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h);
  padding: 0 24px;
  border-radius: var(--r-pill);
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--inverse); color: var(--on-inverse); }
.btn--ghost { box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.btn--sm { --h: 40px; padding: 0 16px; font-size: var(--fs-small); }
@media (hover: hover) {
  .btn--primary:hover { background: var(--mark); color: var(--on-mark); }
  .btn--ghost:hover { background: var(--surface); }
}
.btn svg { width: 16px; height: 16px; flex: none; }

/* Text link with a highlighter underline that fills on hover */
.link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 2px 2px;
  font-weight: 500;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 2px;
  transition: background-size var(--t-slow) var(--ease-out);
}
.link svg { width: 16px; height: 16px; transition: transform var(--t-base) var(--ease-out); }
@media (hover: hover) {
  .link:hover { background-size: 100% 100%; }
  .link:hover svg { transform: translateX(3px); }
}

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.icon-btn svg { width: 20px; height: 20px; }
@media (hover: hover) { .icon-btn:hover { background: var(--bg-2); color: var(--ink); } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; line-height: 16px; font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 900;
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 12px 20px 12px 12px;
  border-radius: var(--r-pill);
  background: var(--inverse); color: var(--on-inverse);
  font-size: var(--fs-small); line-height: var(--lh-small);
  box-shadow: var(--shadow-l);
  translate: -50% 0;
  transform: translateY(calc(100% + 40px));
  transition: transform var(--t-slow) var(--ease-out);
  pointer-events: none;
}
.toast.is-on { transform: none; }
.toast__icon {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--mark); color: var(--on-mark);
}
.toast__icon svg { width: 16px; height: 16px; }

/* ---------- Reveal ---------- */
.motion [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 900ms var(--ease-out), transform 900ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.motion [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
