/* ————————————————————————————————————————————————
   Design tokens (see design handoff README)
   ———————————————————————————————————————————————— */
:root {
  --bg: #10161f;
  --panel: #131b28;
  --card: #161e2b;
  --card-border: rgba(120, 150, 190, 0.16);
  --hairline: rgba(120, 150, 190, 0.14);
  --rule: rgba(120, 150, 190, 0.18);
  --chip-border: rgba(120, 150, 190, 0.35);

  --heading: #f2f5fa;
  --heading-2: #e8edf5;
  --body: #a8b2c3;
  --secondary: #c6cedb;
  --muted: #7d8aa0;
  --faint: #5d6b80;
  --check: #9fb3c8;

  --blue: #58c4dd;
  --blue-hover: #8ed8ea;
  --yellow: #f0c674;
  --pink: #c47ac9;

  --blue-tint: rgba(88, 196, 221, 0.3);
  --yellow-tint: rgba(240, 198, 116, 0.3);
  --yellow-rule: rgba(240, 198, 116, 0.35);
  --nav-underline: rgba(88, 196, 221, 0.5);
  --bar-empty: rgba(120, 150, 190, 0.2);

  --serif: "Spectral", Georgia, serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --hand: "Caveat", cursive;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(120, 150, 190, 0.1) 1px, transparent 1px);
  background-size: 26px 26px;
  color: #dde4ee;
  font-family: var(--serif);
}

.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 32px;
}

/* accent utilities */
.c-blue { color: var(--blue); }
.c-yellow { color: var(--yellow); }
.c-pink { color: var(--pink); }
.c-faint { color: var(--faint); }

/* ————————————————————————————————————————————————
   Header + nav
   ———————————————————————————————————————————————— */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  gap: 12px 22px;
}

.slug {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}

.slug:hover {
  color: var(--blue-hover);
}

.site-nav {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--blue-hover);
}

.site-nav a.active {
  color: var(--blue);
  border-bottom-color: var(--nav-underline);
}

/* ————————————————————————————————————————————————
   Footer
   ———————————————————————————————————————————————— */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px 0 32px;
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  flex-wrap: wrap;
  gap: 10px;
}

.chips {
  display: flex;
  gap: 14px;
}

.chip {
  border: 1px dashed var(--chip-border);
  border-radius: 4px;
  padding: 2px 8px;
}

a.chip {
  border-style: solid;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a.chip:hover {
  color: var(--blue-hover);
  border-color: var(--nav-underline);
}

/* ————————————————————————————————————————————————
   Home: hero
   ———————————————————————————————————————————————— */
.hero {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 44px;
  padding: 56px 0 36px;
  align-items: start;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: 42px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--heading);
}

.hero h1 sup {
  font-size: 16px;
  color: var(--yellow);
}

.hero p {
  margin: 0 0 12px;
  font-size: 17.5px;
  line-height: 1.7;
  color: var(--body);
}

.hero p:last-child {
  margin-bottom: 0;
}

.hero p sup {
  font-size: 13px;
  color: var(--yellow);
}

.hero-photo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.hero-photo img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.photo-caption {
  font-family: var(--hand);
  font-size: 19px;
  color: var(--yellow);
  transform: rotate(-2deg);
  text-align: center;
  line-height: 1.25;
  margin-top: 2px;
}

/* ————————————————————————————————————————————————
   Series cards (home featured + learning)
   ———————————————————————————————————————————————— */
.series-card {
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--blue-tint);
  border-radius: 10px;
}

.series-card.accent-yellow {
  border-color: var(--yellow-tint);
}

.series-card.featured {
  position: relative;
}

.float-label {
  position: absolute;
  top: -12px;
  left: 20px;
  font-family: var(--hand);
  font-size: 20px;
  color: var(--yellow);
  background: var(--panel);
  padding: 0 8px;
  transform: rotate(-1deg);
}

.series-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.featured .series-head {
  margin-bottom: 10px;
}

.series-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--heading-2);
}

a.series-title {
  text-decoration: none;
  transition: color 0.15s ease;
}

a.series-title:hover {
  color: var(--blue-hover);
}

.series-status {
  font-family: var(--mono);
  font-size: 11px;
}

.series-desc {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--body);
}

.progress {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
}

.progress .seg {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--bar-empty);
}

.progress .seg.filled {
  background: var(--blue);
}

.checklist {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.featured .checklist {
  gap: 22px;
}

.checklist .done {
  color: var(--check);
}

/* ————————————————————————————————————————————————
   Home: latest + margin notes
   ———————————————————————————————————————————————— */
.home-latest {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 32px;
  padding: 34px 0 18px;
}

.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 16px;
}

.home-latest .kicker {
  margin-bottom: 14px;
}

.latest-list {
  display: flex;
  flex-direction: column;
}

.latest-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 14px 8px;
  border-top: 1px solid var(--hairline);
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.latest-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.latest-row .tag {
  font-family: var(--mono);
  font-size: 10.5px;
  width: 44px;
  flex: none;
}

.latest-row .title {
  flex: 1;
  font-size: 17.5px;
  font-weight: 500;
  color: var(--heading-2);
}

.latest-row .date {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.latest-row.hover-blue:hover { background: rgba(88, 196, 221, 0.05); }
.latest-row.hover-yellow:hover { background: rgba(240, 198, 116, 0.05); }
.latest-row.hover-pink:hover { background: rgba(196, 122, 201, 0.05); }

.margins {
  border-left: 2px solid var(--yellow-rule);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.margins-head {
  font-family: var(--hand);
  font-size: 18px;
  color: var(--yellow);
  line-height: 1.4;
}

.footnote {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.footnote .fn-marker {
  color: var(--yellow);
}

/* ————————————————————————————————————————————————
   Section pages (shared)
   ———————————————————————————————————————————————— */
.section {
  padding: 56px 0 24px;
}

.page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 500;
  color: var(--heading);
}

.page-head .aside {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--yellow);
  transform: rotate(-1deg);
  display: inline-block;
}

.section-intro {
  margin: 0 0 36px;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--body);
  max-width: 640px;
}

.meta {
  font-family: var(--mono);
  font-size: 10.5px;
  margin-bottom: 8px;
}

.text-link {
  color: var(--blue);
  text-decoration: none;
}

.text-link:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

/* ————————————————————————————————————————————————
   Learning
   ———————————————————————————————————————————————— */
.series-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 44px;
}

.absorb-list {
  display: flex;
  flex-direction: column;
  max-width: 720px;
}

.absorb-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 13px 0;
  border-top: 1px solid var(--hairline);
}

.absorb-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.absorb-row .tag {
  font-family: var(--mono);
  font-size: 10.5px;
  width: 52px;
  flex: none;
}

.absorb-text {
  flex: 1;
}

.absorb-title {
  font-size: 16.5px;
  font-weight: 500;
  color: var(--heading-2);
}

.absorb-note {
  font-size: 14px;
  color: var(--muted);
}

/* ————————————————————————————————————————————————
   Essays
   ———————————————————————————————————————————————— */
.essay-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 720px;
}

.essay {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
}

.essay .meta {
  color: var(--blue);
}

.essay-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--heading-2);
  margin-bottom: 8px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.essay-title:hover {
  color: var(--blue-hover);
}

.dek {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--body);
}

/* ————————————————————————————————————————————————
   Notes
   ———————————————————————————————————————————————— */
.notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-width: 820px;
}

.note-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
}

.note-card:nth-child(4n + 1) { transform: rotate(-0.4deg); }
.note-card:nth-child(4n + 2) { transform: rotate(0.4deg); }
.note-card:nth-child(4n + 3) { transform: rotate(0.3deg); }
.note-card:nth-child(4n + 4) { transform: rotate(-0.3deg); }

.note-card .meta {
  color: var(--yellow);
  margin-bottom: 10px;
}

.note-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--heading-2);
  margin-bottom: 8px;
}

.note-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--body);
}

/* ————————————————————————————————————————————————
   Videos
   ———————————————————————————————————————————————— */
.videos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  max-width: 860px;
}

.video-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
}

.thumb {
  aspect-ratio: 16 / 9;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--card-border);
}

.play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--pink);
  color: var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding-left: 4px;
}

.play.draft {
  border-style: dashed;
  border-color: var(--faint);
  color: var(--faint);
}

.thumb-caption {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.video-body {
  padding: 18px 20px;
}

.video-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--heading-2);
  margin-bottom: 6px;
}

.video-body p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--body);
}

/* ————————————————————————————————————————————————
   Projects
   ———————————————————————————————————————————————— */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-status {
  font-family: var(--mono);
  font-size: 10.5px;
}

.project-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--heading-2);
}

.project-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--body);
}

/* ————————————————————————————————————————————————
   Now
   ———————————————————————————————————————————————— */
.now-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 680px;
}

.now-row {
  display: flex;
  gap: 18px;
  align-items: baseline;
}

.now-label {
  font-family: var(--mono);
  font-size: 11px;
  width: 76px;
  flex: none;
}

.now-row p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--secondary);
}

/* ————————————————————————————————————————————————
   Responsive (mock is desktop-only; collapse below ~760px)
   ———————————————————————————————————————————————— */
@media (max-width: 760px) {
  .container {
    padding: 0 22px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 40px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .home-latest,
  .notes-grid,
  .videos-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .page-head h1 {
    font-size: 30px;
  }
}

/* ————————————————————————————————————————————————
   Linked listing cards (pieces with published pages)
   ———————————————————————————————————————————————— */
a.essay-title {
  display: block;
  color: var(--heading-2);
  text-decoration: none;
}

a.essay-title:hover {
  color: var(--blue-hover);
}

a.note-card,
a.video-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

a.note-card:hover,
a.video-card:hover {
  border-color: var(--nav-underline);
}

/* ————————————————————————————————————————————————
   Post pages
   ———————————————————————————————————————————————— */
.post {
  max-width: 700px;
}

.post-title {
  margin: 6px 0 14px;
  font-size: 36px;
  line-height: 1.25;
  font-weight: 500;
  color: var(--heading);
}

.post-dek {
  margin: 0;
  font-size: 18px;
  line-height: 1.65;
  font-style: italic;
  color: var(--body);
}

.post-rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 26px 0 30px;
}

.post-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--secondary);
}

.post-body p {
  margin: 0 0 20px;
}

.post-body h2 {
  margin: 40px 0 14px;
  font-size: 25px;
  font-weight: 600;
  color: var(--heading-2);
}

.post-body h3 {
  margin: 30px 0 10px;
  font-size: 19px;
  font-weight: 600;
  color: var(--heading-2);
}

.post-body a {
  color: var(--blue);
  text-decoration: none;
}

.post-body a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.post-body ul,
.post-body ol {
  margin: 0 0 20px;
  padding-left: 26px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body code {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 1px 6px;
}

.post-body pre {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.post-body blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--yellow-rule);
  font-style: italic;
  color: var(--body);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 34px auto;
  width: 120px;
}

.post-body figure {
  margin: 28px 0;
}

.post-body figcaption {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}

.post-foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 12.5px;
}

/* empty listing state, hand-written so bare sections read as intentional */
.empty-state {
  margin: 6px 0 0;
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.4;
  color: var(--yellow);
  transform: rotate(-1deg);
}

/* handwritten margin note, the whimsy channel */
.hand-note {
  display: block;
  max-width: 420px;
  margin: 26px 12px 26px auto;
  font-family: var(--hand);
  font-size: 21px;
  line-height: 1.35;
  color: var(--yellow);
  text-align: right;
  transform: rotate(-1deg);
}

/* collapsible caveats, the rigor channel */
details.fine-print {
  margin: 0 0 20px;
  border: 1px dashed var(--chip-border);
  border-radius: 8px;
  padding: 10px 16px;
}

details.fine-print summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

details.fine-print[open] summary {
  color: var(--blue);
  margin-bottom: 8px;
}

details.fine-print p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--body);
}

/* ————————————————————————————————————————————————
   Explorables (interactive figures)
   ———————————————————————————————————————————————— */
.explorable {
  margin: 30px 0;
  background: var(--panel);
  border: 1px solid var(--blue-tint);
  border-radius: 10px;
  padding: 20px;
}

.explorable-title {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--yellow);
  margin-bottom: 2px;
}

.explorable-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

.explorable-panels {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: stretch;
}

.explorable-panels svg {
  display: block;
  width: 100%;
  height: auto;
}

.panel-dag {
  flex: 0 1 230px;
  min-width: 210px;
}

.panel-plot {
  flex: 1 1 300px;
  min-width: 260px;
}

.explorable-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.control-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.explorable-controls input[type="range"] {
  flex: 1;
  min-width: 160px;
  min-height: 44px;
  accent-color: var(--blue);
}

.toggle-btn {
  min-height: 44px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toggle-btn[aria-pressed="true"] {
  color: var(--yellow);
  border-color: var(--yellow-rule);
}

.readouts {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-family: var(--mono);
}

.readout .r-label {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.readout .r-value {
  font-size: 18px;
  font-weight: 600;
}

.explorable-caption {
  margin-top: 14px;
  font-family: var(--hand);
  font-size: 20px;
  line-height: 1.35;
  color: var(--yellow);
  transform: rotate(-0.5deg);
}

/* svg text roles */
.svg-hand {
  font-family: var(--hand);
}

.svg-mono {
  font-family: var(--mono);
}

/* backdoor path flow animation (explorable DAGs) */
@keyframes dash-flow {
  to {
    stroke-dashoffset: -14;
  }
}

.edge-flow {
  stroke-dasharray: 7 7;
  animation: dash-flow 0.9s linear infinite;
}

.dimmed {
  opacity: 0.22;
}

@media (prefers-reduced-motion: reduce) {
  .edge-flow {
    animation: none;
  }

  * {
    transition: none !important;
  }
}
