:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #18202b;
  --muted: #5d6878;
  --line: #d9dfe8;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #ffedd5;
  --button: #b83a16;
  --code: #101722;
  --code-text: #dce7f5;
  --shadow: 0 18px 50px rgba(24, 32, 43, .08);
  --radius: 18px;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1118;
    --surface: #141a23;
    --surface-2: #1b2330;
    --text: #ecf1f8;
    --muted: #9da9ba;
    --line: #293344;
    --accent: #fb923c;
    --accent-strong: #fdba74;
    --accent-soft: #3a1d0d;
    --button: #cf542e;
    --code: #080c12;
    --code-text: #dce7f5;
    --shadow: 0 18px 60px rgba(0, 0, 0, .24);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #18202b;
  --muted: #5d6878;
  --line: #d9dfe8;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #ffedd5;
  --button: #b83a16;
  --code: #101722;
  --code-text: #dce7f5;
  --shadow: 0 18px 50px rgba(24, 32, 43, .08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1118;
  --surface: #141a23;
  --surface-2: #1b2330;
  --text: #ecf1f8;
  --muted: #9da9ba;
  --line: #293344;
  --accent: #fb923c;
  --accent-strong: #fdba74;
  --accent-soft: #3a1d0d;
  --button: #cf542e;
  --code: #080c12;
  --code-text: #dce7f5;
  --shadow: 0 18px 60px rgba(0, 0, 0, .24);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  transition: background-color .2s ease, color .2s ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: .6;
  background-image:
    radial-gradient(circle at 12% 5%, var(--accent-soft), transparent 27rem),
    linear-gradient(90deg, transparent 0, transparent calc(50% - .5px), color-mix(in srgb, var(--line) 45%, transparent) 50%, transparent calc(50% + .5px));
  background-size: auto, 72px 100%;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
  pointer-events: none;
}

a { color: var(--accent-strong); text-underline-offset: .2em; }
a:hover { color: var(--accent); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 10;
  padding: .65rem 1rem;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.container { width: min(1120px, calc(100% - 2.5rem)); margin-inline: auto; }
.narrow { width: min(760px, calc(100% - 2.5rem)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-weight: 760;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}

.brand-mark path { stroke: var(--accent); }

.main-nav { margin-left: auto; }
.main-nav ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.main-nav a {
  color: var(--muted);
  font-size: .93rem;
  font-weight: 620;
  text-decoration: none;
}
.main-nav a[aria-current="page"], .main-nav a:hover { color: var(--text); }

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 19px; height: 19px; }

.hero { padding: clamp(5rem, 12vw, 9rem) 0 4.5rem; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: clamp(2.5rem, 8vw, 7rem);
  align-items: end;
}

.eyebrow, .tag {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
  transform: rotate(45deg);
}

h1, h2, h3 { margin: 0; line-height: 1.14; letter-spacing: -.035em; }
.hero h1 { max-width: 850px; margin-top: 1rem; font-size: clamp(3rem, 8vw, 6.8rem); }
.hero h1 span { color: var(--accent); }
.hero-copy { max-width: 660px; margin: 1.5rem 0 0; color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.28rem); }

.terminal-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code);
  color: var(--code-text);
  box-shadow: var(--shadow);
  transform: rotate(1.2deg);
}
.terminal-head { display: flex; gap: .42rem; padding: .85rem 1rem; border-bottom: 1px solid #263040; }
.terminal-head i { width: 9px; height: 9px; border-radius: 50%; background: #455267; }
.terminal-head i:first-child { background: #fb7185; }
.terminal-head i:nth-child(2) { background: #fbbf24; }
.terminal-head i:nth-child(3) { background: #34d399; }
.terminal-body { margin: 0; padding: 1.4rem; font: .84rem/1.9 var(--mono); white-space: pre-wrap; }
.prompt { color: #75a7ff; }
.ok { color: #6ee7b7; }

.journal-hero { padding: clamp(4.8rem, 11vw, 8rem) 0 4rem; }
.journal-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .6fr);
  gap: clamp(3rem, 8vw, 7rem);
  align-items: center;
}
.journal-intro h1 {
  max-width: 820px;
  margin-top: 1.1rem;
  font-family: var(--serif);
  font-size: clamp(3.1rem, 7vw, 6rem);
  font-weight: 500;
  letter-spacing: -.055em;
}
.journal-intro h1 span { color: var(--accent-strong); font-style: italic; }
.journal-intro > p { max-width: 720px; margin: 1.6rem 0 0; color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.24rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 2rem; }
.quiet-link { color: var(--text); font-weight: 700; text-decoration-thickness: 1px; }

.profile-card {
  position: relative;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 8px 24px 24px 24px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}
.profile-card::before {
  position: absolute;
  top: -9px;
  right: 28px;
  width: 72px;
  height: 18px;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  content: "";
  transform: rotate(2deg);
}
.profile-head, .author-line { display: flex; align-items: center; gap: .9rem; }
.profile-head > div, .author-line > div { display: grid; gap: .08rem; }
.profile-head span:not(.profile-mark), .author-line span { color: var(--muted); font-size: .86rem; }
.profile-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font: 700 .85rem var(--mono);
  letter-spacing: .04em;
}
.profile-card > p { margin: 1.4rem 0; color: var(--muted); }
.profile-facts { margin: 0; border-top: 1px solid var(--line); }
.profile-facts div { display: grid; grid-template-columns: 5rem 1fr; gap: .8rem; padding: .72rem 0; border-bottom: 1px solid var(--line); }
.profile-facts dt { color: var(--muted); font: .74rem var(--mono); text-transform: uppercase; }
.profile-facts dd { margin: 0; font-size: .88rem; font-weight: 650; }

.editorial-head { border-bottom: 1px solid var(--line); padding-bottom: 1.35rem; }
.post-feed { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 1rem; }
.featured-post, .post-row {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
}
.featured-post { min-height: 480px; display: flex; flex-direction: column; padding: clamp(1.7rem, 4vw, 2.6rem); border-radius: 6px 22px 22px; }
.featured-post::before { position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: 6px 0 0 6px; background: var(--accent); content: ""; }
.post-meta { display: flex; flex-wrap: wrap; gap: .45rem 1rem; color: var(--muted); font: .76rem var(--mono); }
.post-meta span:first-child { color: var(--accent-strong); font-weight: 700; text-transform: uppercase; }
.featured-post h3 { max-width: 700px; margin-top: 2.8rem; font: 500 clamp(2.25rem, 5vw, 4.25rem)/1.02 var(--serif); letter-spacing: -.045em; }
.featured-post h3 a, .post-row h3 a { color: var(--text); text-decoration: none; }
.featured-post h3 a::after, .post-row h3 a::after { position: absolute; inset: 0; content: ""; }
.featured-post > p { max-width: 640px; margin: 1.25rem 0; color: var(--muted); font-size: 1.05rem; }
.post-points { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: auto 0 1.5rem; padding: 1rem 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; list-style-position: inside; }
.read-link { position: relative; z-index: 1; width: fit-content; font-weight: 750; text-decoration: none; }
.post-stack { display: grid; gap: 1rem; }
.post-row { min-height: 232px; padding: 1.55rem; border-radius: 18px; }
.post-row h3 { max-width: 540px; margin-top: 1.6rem; font-size: clamp(1.45rem, 3vw, 2rem); }
.post-row > p { margin: .8rem 0 1.2rem; color: var(--muted); }

.notebook-section { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border-block: 1px solid var(--line); }
.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.note-card { min-height: 260px; padding: 1.5rem; border-top: 3px solid var(--accent); background: var(--surface); box-shadow: 0 10px 30px color-mix(in srgb, var(--text) 5%, transparent); }
.note-card:nth-child(2) { transform: rotate(-.4deg); }
.note-card:nth-child(3) { transform: rotate(.5deg); }
.note-number { color: var(--accent-strong); font: 700 .78rem var(--mono); }
.note-card h3 { margin-top: 2.7rem; font-size: 1.3rem; }
.note-card p { margin: .8rem 0 0; color: var(--muted); }

.process-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(3rem, 8vw, 7rem); align-items: start; }
.process-grid h2 { max-width: 540px; margin-top: .7rem; font-size: clamp(2rem, 4vw, 3.5rem); }
.process-copy { max-width: 540px; color: var(--muted); }
.topic-chips { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.5rem; }
.topic-chips span { padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: .82rem var(--mono); }
.process-list { margin: 0; padding: 0; list-style: none; counter-reset: process; }
.process-list li { position: relative; padding: 0 0 1.8rem 4.2rem; border-left: 1px solid var(--line); counter-increment: process; }
.process-list li:last-child { padding-bottom: 0; }
.process-list li::before { position: absolute; top: 0; left: -1.3rem; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--accent-strong); content: "0" counter(process); font: 700 .76rem var(--mono); }
.process-list span { font-weight: 760; font-size: 1.12rem; }
.process-list p { margin: .3rem 0 0; color: var(--muted); }

.section { padding: 4.5rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-head h2 { margin-top: .55rem; font-size: clamp(2rem, 4vw, 3.25rem); }
.section-head p { max-width: 420px; margin: 0; color: var(--muted); }

.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.article-card, .topic-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.article-card:hover, .topic-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.article-card { display: flex; min-height: 290px; flex-direction: column; padding: 1.55rem; }
.article-card time { color: var(--muted); font: .78rem var(--mono); }
.article-card h3 { margin-top: 2.2rem; font-size: 1.45rem; }
.article-card p { margin: .85rem 0 1.8rem; color: var(--muted); }
.card-link { margin-top: auto; font-weight: 700; text-decoration: none; }
.card-link::after { position: absolute; inset: 0; content: ""; }

.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.topic-card { min-height: 185px; padding: 1.35rem; }
.topic-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: 700 .86rem var(--mono);
}
.topic-card h3 { margin-top: 2rem; font-size: 1.18rem; }
.topic-card p { margin: .6rem 0 0; color: var(--muted); font-size: .92rem; }

.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}
.principle { padding: 2rem; background: var(--surface); }
.principle strong { display: block; margin-bottom: .5rem; font-size: 1.05rem; }
.principle p { margin: 0; color: var(--muted); }

.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); }
.footer-inner { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .88rem; }
.footer-inner p { margin: 0; }
.footer-inner a { color: inherit; }

.page-head { padding: clamp(4.5rem, 10vw, 7rem) 0 2.5rem; }
.page-head h1 { max-width: 780px; margin-top: .9rem; font-size: clamp(2.7rem, 7vw, 5.2rem); }
.page-head > p, .page-head .narrow > p { max-width: 700px; margin: 1.25rem 0 0; color: var(--muted); font-size: 1.18rem; }

.article-meta { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; margin-top: 1.5rem; color: var(--muted); font: .82rem var(--mono); }

.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 210px; gap: 4rem; align-items: start; }
.prose { min-width: 0; }
.prose h2 { margin: 3.2rem 0 1rem; font-size: clamp(1.65rem, 4vw, 2.2rem); }
.prose h3 { margin: 2.2rem 0 .8rem; font-size: 1.3rem; }
.prose p { margin: 1rem 0; }
.prose ul, .prose ol { padding-left: 1.35rem; }
.prose li + li { margin-top: .5rem; }
.prose code { padding: .14rem .38rem; border-radius: 5px; background: var(--surface-2); font: .88em var(--mono); }
.prose pre { overflow-x: auto; margin: 1.5rem 0; padding: 1.25rem 1.4rem; border: 1px solid #293344; border-radius: 14px; background: var(--code); color: var(--code-text); }
.prose pre code { padding: 0; background: none; color: inherit; font: .86rem/1.7 var(--mono); }
.prose blockquote { margin: 1.5rem 0; padding: .8rem 1.2rem; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.prose blockquote p { margin: 0; }
.prose table { width: 100%; margin: 1.5rem 0; border-collapse: collapse; font-size: .92rem; }
.prose th, .prose td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 700; }
.article-aside { position: sticky; top: 100px; }
.article-aside strong { display: block; margin-bottom: .8rem; font-size: .82rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.article-aside a { display: block; margin: .55rem 0; color: var(--muted); font-size: .88rem; text-decoration: none; }
.article-aside a:hover { color: var(--accent); }
.related { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.related h2 { margin-top: 0; }

.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 4rem; padding: 2rem 0 5rem; }
.about-grid h2 { margin-bottom: 1rem; font-size: 2rem; }
.about-grid p { color: var(--muted); }
.about-head h1 { font-family: var(--serif); font-weight: 500; }
.personal-about { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .65fr); }
.about-story { min-width: 0; }
.author-line { margin-bottom: 3rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.about-story h2 { margin-top: 2.8rem; }
.personal-quote { margin: 2rem 0; padding: 1.4rem 1.6rem; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.personal-quote p { margin: 0; color: var(--text); font: italic 1.15rem/1.65 var(--serif); }
.writing-steps { margin: 0; padding: 0; list-style: none; }
.writing-steps li { display: grid; grid-template-columns: minmax(150px, .45fr) 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.writing-steps span { color: var(--muted); }
.about-aside { position: sticky; top: 100px; padding: 1.5rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.not-here { margin-top: 2rem; padding: 1rem; border-radius: 12px; background: var(--surface-2); }
.not-here p { margin: .5rem 0 0; font-size: .9rem; }
.about-list { margin: 0; padding: 0; list-style: none; }
.about-list li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.about-list strong { display: block; }
.about-list span { color: var(--muted); font-size: .92rem; }

.error-page { min-height: calc(100vh - 185px); display: grid; place-items: center; text-align: center; }
.error-code { color: var(--accent); font: 700 clamp(5rem, 20vw, 10rem)/1 var(--mono); }
.error-page h1 { margin: 1rem 0; font-size: 2rem; }
.error-page p { max-width: 520px; margin: 0 auto 2rem; color: var(--muted); }
.button { display: inline-flex; padding: .7rem 1rem; border-radius: 10px; background: var(--button); color: #fff; font-weight: 700; text-decoration: none; }
.button:hover { filter: brightness(1.08); color: #fff; }

.author-note { display: flex; align-items: center; gap: 1rem; margin: 0 0 2rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.author-note .profile-mark { width: 40px; height: 40px; font-size: .72rem; }
.author-note p { margin: 0; color: var(--muted); font-size: .92rem; }
.author-note strong { color: var(--text); }

@media (max-width: 900px) {
  .hero-grid, .journal-hero-grid, .post-feed, .process-grid, .about-grid { grid-template-columns: 1fr; }
  .profile-card { max-width: 560px; }
  .notes-grid { grid-template-columns: 1fr 1fr; }
  .note-card:nth-child(2), .note-card:nth-child(3) { transform: none; }
  .about-aside { position: static; }
  .terminal-card { max-width: 520px; transform: none; }
  .article-grid { grid-template-columns: 1fr 1fr; }
  .article-card:first-child { grid-column: 1 / -1; min-height: 240px; }
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .article-aside { display: none; }
}

@media (max-width: 640px) {
  .container, .narrow { width: min(100% - 1.5rem, 1120px); }
  .header-inner { min-height: 64px; gap: .7rem; }
  .brand-mark { width: 32px; height: 32px; }
  .main-nav ul { gap: .8rem; }
  .main-nav a { font-size: .83rem; }
  .nav-articles { display: none; }
  .theme-toggle { width: 36px; height: 36px; }
  .hero, .journal-hero { padding-top: 4rem; }
  .hero h1 { font-size: clamp(3rem, 17vw, 4.8rem); }
  .journal-intro h1 { font-size: clamp(2.8rem, 14vw, 4.2rem); }
  .profile-card { padding: 1.25rem; }
  .section { padding: 3.2rem 0; }
  .section-head { display: block; }
  .section-head p { margin-top: 1rem; }
  .article-grid, .topic-grid, .principles, .notes-grid { grid-template-columns: 1fr; }
  .featured-post { min-height: 430px; padding: 1.5rem; }
  .featured-post h3 { margin-top: 2rem; font-size: 2.45rem; }
  .post-points { display: block; }
  .post-points li + li { margin-top: .35rem; }
  .note-card { min-height: 220px; }
  .writing-steps li { grid-template-columns: 1fr; gap: .2rem; }
  .article-card:first-child { grid-column: auto; }
  .article-card { min-height: 240px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; }
  .prose table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
