/* ==========================================================================
   Colors. Change the palette here; everything else reads from these.
   ========================================================================== */
:root {
  --paper: #09090B;
  --surface: #18181B;
  --ink: #FAFAFA;
  --ink-2: #D4D4D8;
  --ink-3: #A1A1AA;
  --line: #27272A;
  --line-strong: #FAFAFA;
  --grid: rgba(255, 255, 255, 0.045);
  --blue: #6D28D9;
  --blue-hover: #5B21B6;
  --link: #C4B5FD;
  --link-hover: #DDD6FE;
  --blue-soft: #2E1065;
  --on-blue: #FFFFFF;
  --pencil: #FB7185;
  --hatch: rgba(196, 181, 253, 0.08);
  --redact: #3F3F46;

  --idea: #D4D4D8;       --idea-bg: #27272A;
  --validating: #FBBF24; --validating-bg: #422006; --validating-dot: #FBBF24;
  --building: #C4B5FD;   --building-bg: #2E1065;
  --live: #34D399;       --live-bg: #052E22;      --live-dot: #34D399;
  --retired: #A1A1AA;    --retired-bg: #27272A;

  --font-ui: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-read: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --wrap: 1120px;
  --narrow: 700px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #09090B;
  --ink-2: #3F3F46;
  --ink-3: #71717A;
  --line: #E4E4E7;
  --line-strong: #09090B;
  --grid: rgba(9, 9, 11, 0.05);
  --blue: #6D28D9;
  --blue-hover: #5B21B6;
  --link: #6D28D9;
  --link-hover: #5B21B6;
  --blue-soft: #EDE9FE;
  --on-blue: #FFFFFF;
  --pencil: #E11D48;
  --hatch: rgba(109, 40, 217, 0.06);
  --redact: #09090B;

  --idea: #52525B;       --idea-bg: #F4F4F5;
  --validating: #B45309; --validating-bg: #FEF3C7; --validating-dot: #D97706;
  --building: #6D28D9;   --building-bg: #EDE9FE;
  --live: #047857;       --live-bg: #ECFDF5;      --live-dot: #059669;
  --retired: #71717A;    --retired-bg: #F4F4F5;

  --font-ui: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-read: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --wrap: 1120px;
  --narrow: 700px;
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 80px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--pencil); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 40px, var(--narrow)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }
.link { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.link:hover { color: var(--link-hover); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius);
  background: var(--blue); color: var(--on-blue);
  font: 600 16px/1 var(--font-ui); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--blue-hover); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue); color: var(--on-blue); font-weight: 800; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--blue-soft); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { background: var(--blue-soft); }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
@media (max-width: 520px) {
  .header-inner { gap: 8px; }
  .nav a[href="/#about"] { display: none; }
  .nav a { padding: 0 9px; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 128px) 0 clamp(48px, 7vw, 88px);
  border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}
.hero-title {
  max-width: 15ch;
  font-size: clamp(42px, 7.2vw, 96px);
  font-weight: 750;
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96;
}
.arr-meter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 22px;
}
.arr-squares { display: inline-flex; gap: 4px; }
.arr-square {
  width: 18px; height: 18px; border-radius: 3px;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong);
  opacity: 0.35;
}
.arr-square.is-filled { background: var(--live-dot); box-shadow: none; opacity: 1; }
.arr-goal { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.hero-body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px);
  align-items: end; margin-top: clamp(28px, 4vw, 48px);
}
.hero-lede { max-width: 38ch; font-family: var(--font-read); font-size: clamp(19px, 2vw, 22px); line-height: 1.55; color: var(--ink-2); }
.hero-status {
  display: inline-flex; align-items: center; gap: 10px; margin-top: clamp(32px, 4vw, 48px);
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 15px; color: var(--ink-2);
}
.pulse { width: 8px; height: 8px; border-radius: 999px; background: var(--live-dot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--live-dot) 25%, transparent); }
@media (max-width: 760px) { .hero-body { grid-template-columns: 1fr; } }

/* Signup form */
.signup { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 480px; }
.signup-row { display: flex; gap: 8px; }
.signup input[type="email"] {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: 400 16px var(--font-ui);
}
.signup input[type="email"]::placeholder { color: var(--ink-3); }
.signup-note, .signup-error { font-size: 14px; }
.signup-note { color: var(--ink-3); }
.signup-error { color: var(--pencil); }
.signup button[disabled] { opacity: 0.65; cursor: progress; }
.hp { display: none; }
@media (max-width: 420px) { .signup-row { flex-direction: column; } }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.section-head h2, .about-text h2 { font-size: clamp(32px, 4.4vw, 48px); letter-spacing: -0.03em; }
.section-sub { max-width: 56ch; color: var(--ink-2); font-size: 17px; }
.page-title { font-size: clamp(38px, 6vw, 64px); letter-spacing: -0.035em; margin-bottom: 14px; }
.empty-note { padding: 24px 0; color: var(--ink-3); }

/* ==========================================================================
   Products
   ========================================================================== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.js .filters[hidden] { display: flex; }
.filter {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 500 15px var(--font-ui); cursor: pointer;
}
.filter .count { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter[aria-pressed="true"] .count { color: inherit; opacity: 0.7; }
.filter[data-empty] { color: var(--ink-3); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.dot.stage-idea { background: var(--idea); }
.dot.stage-validating { background: var(--validating-dot); }
.dot.stage-building { background: var(--building); }
.dot.stage-live { background: var(--live-dot); }
.dot.stage-retired { background: transparent; box-shadow: inset 0 0 0 2px var(--retired); }

.project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 88px 88px;
  gap: 16px; align-items: center;
  padding: 12px 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.project[hidden] { display: none; }
.project.has-link { cursor: pointer; }
.project.has-link:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--ink) 28%, var(--line));
  box-shadow: 0 12px 28px color-mix(in srgb, #000 40%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .project { transition: none; }
  .project.has-link:hover { transform: none; }
}
.project-name { font-size: 18px; letter-spacing: -0.02em; }
.project-name a { text-decoration: none; }
.project-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.project-name a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 4px; }
.project-summary {
  margin-top: 2px; max-width: 62ch; color: var(--ink-2); font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.project-date { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.project-links { display: flex; gap: 12px; justify-content: flex-end; }
.project-links .link { position: relative; z-index: 2; display: inline-flex; align-items: center; min-height: 32px; font-size: 14px; }

.is-stealth { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 11px); }
.redacted { display: inline-block; width: min(260px, 70%); height: 22px; border-radius: 4px; background: var(--redact); vertical-align: middle; }

.stage-label { align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.stage-label.stage-idea { background: var(--idea-bg); color: var(--idea); }
.stage-label.stage-validating { background: var(--validating-bg); color: var(--validating); }
.stage-label.stage-building { background: var(--building-bg); color: var(--building); }
.stage-label.stage-live { background: var(--live-bg); color: var(--live); }
.stage-label.stage-retired { background: var(--retired-bg); color: var(--retired); }

/* The stage track: Idea > Validating > Building > Live */
.project-stage { display: flex; flex-direction: column; gap: 6px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.track span { height: 4px; border-radius: 999px; background: var(--line); }
.track span.done { background: color-mix(in srgb, var(--blue) 45%, var(--line)); }
.project[data-stage="validating"] .track span.now { background: var(--validating-dot); }
.project[data-stage="building"] .track span.now { background: var(--building); }
.project[data-stage="live"] .track span { background: var(--live-dot); }
.project[data-stage="idea"] .track span.now { background: var(--idea); }
.track.is-retired span { background: var(--line); }
.track.is-retired { position: relative; }
.track.is-retired::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--retired); transform: translateY(-50%) rotate(-1deg); }

.stage-key { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin: 24px 0 0; }
.stage-key div { display: flex; flex-direction: column; gap: 4px; }
.stage-key dt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.stage-key dd { margin: 0; color: var(--ink-3); font-size: 14px; line-height: 1.45; }

@media (max-width: 900px) {
  .project { grid-template-columns: minmax(0, 1fr) 150px; grid-template-areas: "main stage" "date links"; row-gap: 8px; padding: 12px 16px; }
  .project-main { grid-area: main; } .project-stage { grid-area: stage; }
  .project-date { grid-area: date; } .project-links { grid-area: links; }
  .stage-key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .project { grid-template-columns: 1fr; grid-template-areas: "main" "stage" "date" "links"; padding: 14px 16px; gap: 8px; }
  .project-stage { max-width: 240px; }
  .project-links { justify-content: flex-start; }
  .stage-key { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Writing lists
   ========================================================================== */
.writing-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: clamp(28px, 6vw, 80px); align-items: start; }
@media (max-width: 860px) { .writing-grid { grid-template-columns: 1fr; } }
.post-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--line-strong); }
.post-item a {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); column-gap: 20px; row-gap: 4px;
  padding: 20px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.post-item time { grid-row: span 2; padding-top: 4px; color: var(--ink-3); font-size: 15px; font-variant-numeric: tabular-nums; }
.post-item-title { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; }
.post-item-desc { color: var(--ink-2); font-family: var(--font-read); font-size: 17px; }
.post-item a:hover .post-item-title { color: var(--link); text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 560px) { .post-item a { grid-template-columns: 1fr; } .post-item time { grid-row: auto; } }
.year { margin: 40px 0 0; padding-bottom: 10px; font-size: 18px; color: var(--ink-3); letter-spacing: 0; }
.writing-index .post-list { border-top-width: 1px; }

/* ==========================================================================
   About
   ========================================================================== */
.about-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: start; }
.about-photo {
  display: grid; place-items: center; aspect-ratio: 1; width: 100%; max-width: 220px;
  border-radius: 20px; background: var(--blue-soft); color: var(--blue); font-size: 88px; font-weight: 800; overflow: hidden;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.about-text { display: flex; flex-direction: column; gap: 16px; max-width: 62ch; }
.about-text p { font-family: var(--font-read); font-size: 19px; line-height: 1.6; color: var(--ink-2); }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rules li { position: relative; padding-left: 26px; font-size: 17px; color: var(--ink-2); }
.rules li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 12px; height: 7px; border-left: 2px solid var(--blue); border-bottom: 2px solid var(--blue); transform: rotate(-45deg); }
.rules strong { color: var(--ink); font-weight: 650; }
@media (max-width: 640px) { .about-grid { grid-template-columns: 1fr; } .about-photo { max-width: 140px; font-size: 56px; } }

/* ==========================================================================
   Post
   ========================================================================== */
.post { padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 96px); }
.post-back { margin-bottom: 28px; font-size: 15px; }
.post-title { font-size: clamp(36px, 5.6vw, 58px); letter-spacing: -0.035em; line-height: 1.04; }
.post-dek { margin-top: 16px; font-family: var(--font-read); font-size: clamp(20px, 2.2vw, 23px); line-height: 1.5; color: var(--ink-2); }
.post-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; padding-bottom: 28px; border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 15px; }

.prose { margin-top: 36px; font-family: var(--font-read); font-size: 20px; line-height: 1.7; color: var(--ink); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 1.9em; font-family: var(--font-ui); font-size: 27px; letter-spacing: -0.02em; line-height: 1.2; }
.prose h3 { margin-top: 1.6em; font-family: var(--font-ui); font-size: 21px; }
.prose a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--ink-3); }
.prose blockquote { margin: 1.4em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--blue); color: var(--ink-2); font-style: italic; }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; padding: 2px 6px; border-radius: 5px; background: var(--blue-soft); }
.prose pre { overflow-x: auto; padding: 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.prose pre code { padding: 0; background: none; }
.prose img { border-radius: 10px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose strong { font-weight: 600; }

.post-footer { margin-top: 56px; display: flex; flex-direction: column; gap: 28px; }
.post-project { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: center; padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.post-project-label { grid-column: 1 / -1; color: var(--ink-3); font-size: 14px; }
.post-project-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.post-project-name a { color: var(--link); }
.post-project-stage { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-2); }
.post-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.post-nav a { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; border-top: 2px solid var(--line-strong); text-decoration: none; font-weight: 600; font-size: 18px; line-height: 1.3; }
.post-nav a span { color: var(--ink-3); font-size: 14px; font-weight: 500; }
.post-nav a:hover { color: var(--link); }
.post-nav a:only-child:last-child:not(:first-child) { grid-column: 2; }
@media (max-width: 560px) { .post-nav { grid-template-columns: 1fr; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: clamp(48px, 7vw, 80px) 0 40px; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.footer-title { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 18px; max-width: 20ch; }
.footer-meta { display: flex; flex-direction: column; gap: 16px; color: var(--ink-2); font-size: 15px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-underline-offset: 4px; }
.copyright { color: var(--ink-3); }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; } }
