/* ─── Type: self-hosted Geist (OFL, assets/fonts/GEIST-OFL.txt) ─── */

@font-face {
  font-family: "Geist";
  src: url("assets/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("assets/fonts/geist-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ─── Tokens ──────────────────────────────────────────────────── */

:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --col: 40rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Instrument (site default) */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --ink: #0c0c0e;
  --ink-2: #121215;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.055);
  --line: rgba(243, 240, 234, 0.09);
  --line-2: rgba(243, 240, 234, 0.17);
  --text: #f3f0ea;
  --text-2: #c9c4bb;
  --muted: #8f8a82;
  --faint: #5f5b55;
  --amber: #f0a94a;
  --amber-soft: rgba(240, 169, 74, 0.1);
  --amber-line: rgba(240, 169, 74, 0.32);
}

/* Paper (reading) */
[data-theme="paper"] {
  color-scheme: light;
  --ink: #f4f2ed;
  --ink-2: #eae7e0;
  --surface: rgba(26, 24, 21, 0.025);
  --surface-2: rgba(26, 24, 21, 0.05);
  --line: rgba(26, 24, 21, 0.1);
  --line-2: rgba(26, 24, 21, 0.2);
  --text: #1a1815;
  --text-2: #3d3934;
  --muted: #6c675f;
  --faint: #a19b91;
  --amber: #8f5c0d;
  --amber-soft: rgba(143, 92, 13, 0.08);
  --amber-line: rgba(143, 92, 13, 0.3);
}

/* ─── Base ────────────────────────────────────────────────────── */

@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--text);
  background:
    radial-gradient(60rem 28rem at 50% -12rem, var(--amber-soft), transparent 70%),
    var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
dl,
dd,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

::selection {
  background: var(--amber);
  color: var(--ink);
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--col) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
}

/* ─── Shared ──────────────────────────────────────────────────── */

.section-label,
.month-label,
.eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  font-weight: 450;
  color: var(--muted);
}

.section-label::after,
.month-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.text-link,
.inline {
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.text-link:hover,
.text-link:focus-visible,
.inline:hover,
.inline:focus-visible {
  color: var(--text);
  text-decoration-color: var(--amber);
}

.empty-note {
  padding: 2rem 0;
  color: var(--muted);
}

/* ─── Topbar ──────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  border-radius: 6px;
}

.brand-mark {
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: var(--amber);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 600ms var(--ease);
}

.brand:hover .brand-mark {
  transform: rotate(60deg);
}

.brand-mark circle {
  stroke-width: 2.4;
  opacity: 0.5;
}

.brand-name {
  font-size: 0.9375rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.875rem;
}

.nav a {
  color: var(--muted);
  transition: color 160ms ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-right: -0.4rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="paper"] .icon-moon {
  display: none;
}

:root:not([data-theme="paper"]) .icon-sun {
  display: none;
}

/* ─── Buttons ─────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem 0 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.button:hover,
.button:focus-visible {
  background: var(--surface-2);
  border-color: var(--amber-line);
}

.button svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Intro ───────────────────────────────────────────────────── */

.intro {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(4rem, 12vw, 7.5rem) clamp(3rem, 8vw, 5rem);
}

.intro-kicker {
  font-size: 0.875rem;
  color: var(--amber);
}

.intro h1 {
  font-size: clamp(2rem, 1.35rem + 2.6vw, 2.875rem);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -0.04em;
  max-width: 17ch;
  text-wrap: balance;
}

.intro h1 span {
  color: var(--faint);
}

.intro-lede {
  max-width: 31rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding-top: 0.5rem;
  font-size: 0.875rem;
}

/* The signature as atmosphere: Metatron's Cube, large and faint behind the
   intro, bleeding past the column and fading at its edges. */
.intro-mark {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: -27rem;
  width: 40rem;
  translate: 0 -50%;
  pointer-events: none;
  mask-image: radial-gradient(closest-side, #000 55%, transparent);
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
}

/* Every stroke has pathLength="1", so one keyframe draws any of them. */
.metatron {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: var(--amber);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.m-web {
  stroke-width: 0.5;
  opacity: 0.12;
}

.m-ring {
  stroke-width: 0.8;
  opacity: 0.22;
}

.m-cube {
  stroke-width: 1.4;
  opacity: 0.42;
}

/* ─── Stream ──────────────────────────────────────────────────── */

.month {
  padding-top: 2.5rem;
}

.month-label {
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.entries {
  list-style: none;
  display: grid;
  gap: 0.25rem;
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.3rem 1.5rem;
  margin-inline: -1rem;
  padding: 1rem;
  border-radius: var(--radius);
  transition: background 220ms ease, opacity 220ms ease;
}

.entry-title {
  font-size: 1.0625rem;
  font-weight: 550;
  line-height: 1.35;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.entry-title a {
  transition: color 160ms ease;
}

/* An essay's whole row is its link. */
.entry-essay .entry-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.entry-arrow {
  display: inline-block;
  margin-left: 0.3em;
  font-size: 0.85em;
  color: var(--faint);
  transition: transform 220ms var(--ease), color 160ms ease;
}

.entry-title a:hover .entry-arrow,
.entry-title a:focus-visible .entry-arrow {
  color: var(--amber);
  transform: translate(2px, -2px);
}

.entry-date {
  position: relative;
  font-size: 0.8125rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 160ms ease;
}

a.entry-date:hover,
a.entry-date:focus-visible {
  color: var(--text);
}

.entry-meta,
.entry-summary,
.entry-note {
  grid-column: 1 / -1;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.entry-meta [aria-hidden] {
  color: var(--faint);
}

/* Essays get a filled dot, links a ring: a legend you learn in one glance. */
.entry-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.entry-kind::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--amber);
}

.entry-link .entry-kind::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.25px var(--muted);
}

.entry-summary,
.entry-note {
  max-width: 36rem;
  padding-top: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
  text-wrap: pretty;
}

.entry-note {
  display: grid;
  gap: 0.6rem;
}

.entry-note em,
.entry-note strong {
  color: var(--text-2);
}

.entry-note a {
  position: relative;
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 0.2em;
}

.entry-note a:hover,
.entry-note a:focus-visible {
  color: var(--text);
  text-decoration-color: var(--amber);
}

.entry-note blockquote {
  padding-left: 1rem;
  border-left: 1px solid var(--amber);
}

@media (hover: hover) {
  .entry:hover {
    background: var(--surface);
  }

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

  /* Hovering one entry quiets the rest. */
  .entries:has(.entry:hover) .entry:not(:hover) {
    opacity: 0.5;
  }
}

.stream-more {
  padding-top: 1.5rem;
  font-size: 0.875rem;
}

/* Post-nav labels share the stream's caption style. */
.archive-date {
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ─── About ───────────────────────────────────────────────────── */

.about {
  display: grid;
  gap: 1.25rem;
  padding-top: clamp(3.5rem, 9vw, 5.5rem);
}

.about-body {
  display: grid;
  gap: 1rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--muted);
}

.about-body em {
  color: var(--text-2);
}

.elsewhere {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.875rem;
}

.elsewhere a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-2);
  transition: color 160ms ease;
}

.elsewhere a:hover,
.elsewhere a:focus-visible {
  color: var(--amber);
}

.elsewhere svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
  transition: transform 220ms var(--ease);
}

.elsewhere a:hover svg {
  transform: translate(1px, -1px);
}

/* ─── Footer ──────────────────────────────────────────────────── */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: clamp(4rem, 10vw, 6rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ─── Archive page ────────────────────────────────────────────── */

.section-head {
  display: grid;
  gap: 1rem;
  padding-block: clamp(3.5rem, 10vw, 6rem) 1rem;
}

.section-head .eyebrow {
  color: var(--amber);
}

.section-head h1 {
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.75rem);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.section-head p {
  color: var(--muted);
}

/* ─── Posts ───────────────────────────────────────────────────── */

.post-header {
  display: grid;
  gap: 1rem;
  padding-block: clamp(3.5rem, 10vw, 6rem) 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.post-header .eyebrow {
  color: var(--amber);
  text-transform: capitalize;
}

.post-header h1 {
  font-size: clamp(2rem, 1.35rem + 2.4vw, 2.75rem);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.post-header h1 a span {
  display: inline-block;
  margin-left: 0.15em;
  font-size: 0.6em;
  vertical-align: 0.35em;
  color: var(--faint);
  transition: transform 220ms var(--ease), color 160ms ease;
}

.post-header h1 a:hover span,
.post-header h1 a:focus-visible span {
  color: var(--amber);
  transform: translate(3px, -3px);
}

.post-standfirst {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--faint);
}

.prose-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-2);
}

.prose-body > * + * {
  margin-top: 1.25rem;
}

.prose-body h2 {
  font-size: 1.375rem;
  font-weight: 550;
  line-height: 1.3;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-top: 3rem;
  text-wrap: balance;
}

.prose-body h3 {
  font-size: 1.125rem;
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-top: 2.25rem;
}

.prose-body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 160ms ease;
}

.prose-body a:hover,
.prose-body a:focus-visible {
  text-decoration-color: var(--amber);
}

.prose-body strong {
  font-weight: 600;
  color: var(--text);
}

.prose-body ul,
.prose-body ol {
  padding-left: 1.35rem;
  list-style: disc;
}

.prose-body ol {
  list-style: decimal;
}

.prose-body li + li {
  margin-top: 0.4rem;
}

.prose-body li::marker {
  color: var(--faint);
}

.prose-body blockquote {
  padding-left: 1.25rem;
  border-left: 1px solid var(--amber);
  color: var(--muted);
}

.prose-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: var(--surface-2);
}

.prose-body hr {
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 2.5rem 0;
}

.code-block {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-2);
}

.code-block pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  height: 1.75rem;
  padding: 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 160ms ease, color 160ms ease;
}

.code-block:hover .copy-button,
.copy-button:focus-visible {
  opacity: 1;
}

.copy-button:hover {
  color: var(--text);
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 4rem;
}

.post-nav a {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease;
}

.post-nav a:hover,
.post-nav a:focus-visible {
  border-color: var(--line-2);
  background: var(--surface);
}

.post-nav .post-nav-next {
  text-align: right;
}

.post-nav strong {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.progress-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  height: 2px;
  width: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: var(--amber);
  pointer-events: none;
}

/* ─── Motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .metatron path,
  .metatron circle {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: trace 2.2s var(--ease) forwards;
  }

  .m-web {
    animation-duration: 3.4s;
  }

  .m-ring {
    animation-delay: calc(0.2s + var(--i) * 90ms);
  }

  .m-cube {
    animation-delay: 1.2s;
  }

  .m-cube-inner {
    animation-delay: 1.7s;
  }

  /* The page settles in: each block rises out of a slight blur, in order. */
  .intro > :not(.intro-mark),
  .month,
  .about,
  .section-head,
  .post-header,
  .prose-body {
    animation: settle 900ms var(--ease) both;
  }

  .intro > :nth-child(3) {
    animation-delay: 60ms;
  }

  .intro > :nth-child(4) {
    animation-delay: 120ms;
  }

  .intro > :nth-child(5) {
    animation-delay: 180ms;
  }

  .month {
    animation-delay: 260ms;
  }

  .month + .month {
    animation-delay: 340ms;
  }

  .about {
    animation-delay: 420ms;
  }

  .prose-body {
    animation-delay: 120ms;
  }
}

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

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(6px);
  }
}

/* ─── Responsive ──────────────────────────────────────────────── */

@media (max-width: 720px) {
  .intro-mark {
    top: 0;
    right: -10rem;
    width: 22rem;
    translate: none;
    opacity: 0.7;
  }
}

@media (max-width: 520px) {
  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav .post-nav-next {
    text-align: left;
  }

  .copy-button {
    opacity: 1;
  }
}

@media (max-width: 400px) {
  .nav {
    gap: 1rem;
  }

  /* The mark alone carries the brand; the link keeps its accessible name. */
  .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  @view-transition {
    navigation: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .topbar,
  .progress-rail,
  .copy-button,
  .post-nav,
  .intro-mark {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
