@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  color-scheme: dark light;

  --bg: #0b0d10;
  --bg-elev: #111418;
  --bg-tint: #0f1216;
  --text: #e6e8eb;
  --text-strong: #f6f7f9;
  --muted: #8a8f98;
  --faint: #565a63;
  --line: #1f2329;
  --line-strong: #2a2f37;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --selection: rgba(245, 158, 11, 0.28);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --content: 720px;
  --content-wide: 1040px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf7;
    --bg-elev: #ffffff;
    --bg-tint: #f4f2ed;
    --text: #1a1d22;
    --text-strong: #0a0c0f;
    --muted: #5b626c;
    --faint: #8a8f98;
    --line: #e6e2d8;
    --line-strong: #d4cebd;
    --accent: #b45309;
    --accent-soft: rgba(180, 83, 9, 0.1);
    --selection: rgba(180, 83, 9, 0.18);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% -10%, rgba(245, 158, 11, 0.06), transparent 40%),
    radial-gradient(circle at 90% 0%, rgba(125, 211, 252, 0.04), transparent 35%);
  background-attachment: fixed;
  min-height: 100vh;
  font-feature-settings: "ss01", "cv11", "cv02";
}

/* subtle dot grid texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(currentColor 0.5px, transparent 0.5px);
  background-size: 24px 24px;
  color: var(--line);
  opacity: 0.5;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}

body > * { position: relative; z-index: 1; }

::selection { background: var(--selection); color: var(--text-strong); }

a {
  color: var(--text-strong);
  text-decoration: none;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

img { max-width: 100%; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* ---------- shell ---------- */

.shell {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 24px;
}

.shell-wide {
  max-width: var(--content-wide);
}

/* ---------- topbar ---------- */

.topbar {
  padding: 28px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-strong);
}

.brand:hover { text-decoration: none; }

.brand-prompt { color: var(--accent); }
.brand-path { color: var(--text-strong); font-weight: 500; }
.brand-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

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

.nav {
  display: flex;
  gap: 22px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

/* ---------- hero ---------- */

.hero {
  padding: 80px 0 56px;
}

.hero .eyebrow {
  margin-bottom: 22px;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--text-strong);
  font-variation-settings: "opsz" 144;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}

.hero-lede {
  margin: 28px 0 0;
  max-width: 36rem;
  font-size: 1.075rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-meta {
  margin-top: 36px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-meta .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

/* ---------- eyebrow ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0;
  color: var(--accent);
}

.eyebrow::before {
  content: "//";
  color: var(--faint);
}

/* ---------- section ---------- */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  margin-bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.975rem;
  max-width: 36rem;
}

/* ---------- post index ---------- */

.post-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.post-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  position: relative;
  transition: background 160ms ease;
}

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

.post-row::before {
  content: "";
  position: absolute;
  left: -16px;
  right: -16px;
  top: 0;
  bottom: 0;
  background: var(--bg-tint);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: -1;
}

.post-row:hover::before { opacity: 1; }

.post-row:hover .post-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

.post-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0;
  white-space: nowrap;
}

.post-main { min-width: 0; }

.post-title {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--text-strong);
  letter-spacing: -0.015em;
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.post-tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-tint);
}

.post-arrow {
  font-family: var(--font-mono);
  color: var(--faint);
  transition: transform 160ms ease, color 160ms ease;
  align-self: center;
}

/* ---------- about ---------- */

.about-prose {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.025rem;
  line-height: 1.7;
}

.about-prose p { margin: 0 0 16px; }
.about-prose p:last-child { margin-bottom: 0; }
.about-prose strong { color: var(--text-strong); font-weight: 600; }

.about-prose ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about-prose li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 4px;
}

.about-prose li::before {
  content: "→";
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ---------- footer ---------- */

.footer {
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover { color: var(--text-strong); }

/* ---------- article ---------- */

.article-shell {
  padding: 56px 0 32px;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 40px;
  text-decoration: none;
}

.article-back:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-back::before {
  content: "←";
  transition: transform 160ms ease;
}

.article-back:hover::before { transform: translateX(-3px); }

.article-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.article-header h1 {
  margin: 18px 0 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  font-variation-settings: "opsz" 144;
}

.article-summary {
  margin: 20px 0 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.article-meta {
  margin-top: 28px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.article-meta .sep { color: var(--line-strong); }

/* prose */

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

.prose > * + * { margin-top: 1.4em; }

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin-top: 2.4em;
  margin-bottom: 0.6em;
  line-height: 1.2;
}

.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.3rem; }
.prose h4 { font-size: 1.1rem; }

.prose h2 + p,
.prose h3 + p { margin-top: 0.5em; }

.prose p { margin: 0; }

.prose a {
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-thickness: 2px;
}

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

.prose ul,
.prose ol {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.prose ul li,
.prose ol li {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: baseline;
}

.prose ul li::before {
  content: "─";
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.prose ol {
  counter-reset: list;
}

.prose ol li {
  counter-increment: list;
}

.prose ol li::before {
  content: counter(list, decimal-leading-zero);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78em;
  letter-spacing: 0;
}

.prose blockquote {
  margin: 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1em;
}

.prose blockquote p { margin: 0; }
.prose blockquote p + p { margin-top: 0.6em; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--text-strong);
}

.prose pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.65;
  position: relative;
}

.prose pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.prose hr {
  margin: 2.5em auto;
  width: 80px;
  border-top: 1px solid var(--line-strong);
}

.prose img {
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* article footer */

.article-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.article-tags {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.article-more {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-more h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  text-transform: lowercase;
}

.article-more h3::before { content: "// "; }

.article-more-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.article-more-list li {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.article-more-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--text-strong);
  text-decoration: none;
}

.article-more-list a:hover { color: var(--accent); text-decoration: none; }

.article-more-list time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}

/* ---------- 404 ---------- */

.not-found {
  padding: 120px 0;
  text-align: center;
}

.not-found .code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 24px;
}

.not-found h1 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.not-found p {
  margin: 0 0 32px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-strong);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .shell { padding: 0 18px; }

  .topbar { padding-top: 18px; }

  .hero { padding: 56px 0 32px; }

  .section { padding: 48px 0; }

  .post-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 20px 0;
  }

  .post-arrow { display: none; }

  .post-date { order: 2; }
  .post-main { order: 1; }

  .nav { gap: 16px; }
  .nav a:not(:first-child):not(:last-child) { display: none; }

  .article-header h1 { font-size: 2rem; }
}
