:root {
  --bg: #f3f4f6;
  --bg-soft: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #111827;
  --muted: #4b5563;
  --line: #d1d5db;
  --accent: #374151;
  --highlight: #b45309;
  --dark: #1f2937;
  --dark-soft: #273244;
  --dark-line: #4b5563;
  --dark-text: #f9fafb;
  --dark-muted: #d1d5db;
  --dark-label: #9ca3af;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f2937;
    --bg-soft: #212b3a;
    --panel: #273244;
    --panel-soft: #242e3f;
    --text: #f9fafb;
    --muted: #d1d5db;
    --line: #4b5563;
    --accent: #d1d5db;
    --highlight: #fbbf24;
  }
}
:root[data-theme="dark"] {
  --bg: #1f2937;
  --bg-soft: #212b3a;
  --panel: #273244;
  --panel-soft: #242e3f;
  --text: #f9fafb;
  --muted: #d1d5db;
  --line: #4b5563;
  --accent: #d1d5db;
  --highlight: #fbbf24;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  text-wrap: pretty;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button, input { font: inherit; }

.container {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--highlight);
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.brand-tagline {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.site-nav {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

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

.site-nav a[aria-current="page"] {
  color: var(--highlight);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.theme-toggle-icon {
  width: 16px;
  height: 16px;
}

.theme-toggle-icon-moon { display: none; }

:root[data-theme="light"] .theme-toggle-icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle-icon-moon { display: block; }

main {
  flex: 1;
}

.hero { padding: 64px 0 72px; }

.page-hero { padding: 56px 0 16px; }

.hero,
.page-hero {
  position: relative;
  overflow: hidden;
}

.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  top: -110px;
  right: -70px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 1.5px solid var(--highlight);
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
}

.hero::after,
.page-hero::after {
  content: "";
  position: absolute;
  top: 26px;
  right: 240px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--highlight);
  opacity: 0.16;
  pointer-events: none;
  z-index: -1;
}

.post-banner + .page-hero::before,
.post-banner + .page-hero::after {
  content: none;
}

.post-banner {
  position: relative;
  height: 108px;
  margin-top: 40px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.post-banner svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.post-banner-line {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.2;
  opacity: 0.7;
}

.post-banner-line-flag {
  fill: none;
  stroke: var(--highlight);
  stroke-width: 1.8;
  opacity: 0.85;
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--highlight);
}

.pub-subnav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 44px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

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

.pub-subnav a:hover { color: var(--text); }

.pub-subnav a[aria-current="page"] { color: var(--highlight); }

.pub-subnav .divider { color: var(--line); }

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.page-hero h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
}

.post-draft-banner {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--highlight);
  border: 1px solid var(--highlight);
  border-radius: 999px;
}

.post-draft-banner[hidden] {
  display: none;
}

.lead {
  margin-top: 24px;
  font-size: 1.06rem;
  line-height: 1.85;
  color: var(--muted);
}

.latest-writing {
  margin-top: 48px;
  padding: 36px 40px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 32px -16px rgba(15, 23, 42, 0.18);
}

.latest-writing .eyebrow {
  margin-bottom: 20px;
}

.latest-writing .article-list {
  margin-top: 0;
  margin-bottom: 20px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.latest-writing .article-row:first-child {
  padding-top: 0;
}

.latest-writing .back-link {
  margin-top: 0;
}

.notify {
  margin-top: 40px;
  padding: 36px 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 32px -16px rgba(15, 23, 42, 0.18);
}

.notify .eyebrow {
  display: block;
  margin-bottom: 14px;
}

.highlight {
  color: var(--highlight);
  font-weight: 600;
  white-space: nowrap;
}

.notify p {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 40ch;
}

.notify p.notify-intro {
  margin: 0 0 24px;
  max-width: none;
}

.notify-success {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  max-width: 40ch;
}

.notify-success[hidden] { display: none; }

.notify-form {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 4px;
  max-width: 27rem;
  transition: border-color 120ms ease;
}

.notify-form:focus-within {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.18);
}

.subscribe-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: min(300px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 18px 34px -14px rgba(15, 23, 42, 0.3);
}

.subscribe-widget-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
}

.subscribe-widget-close:hover { color: var(--text); }

.subscribe-bar-label {
  margin: 0 18px 12px 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.subscribe-bar-label,
.subscribe-bar-message {
  display: block;
}

.subscribe-bar-label[hidden],
.subscribe-bar-message[hidden] {
  display: none;
}

.subscribe-widget .notify-form {
  max-width: none;
  margin: 0;
  flex-wrap: wrap;
  border-radius: 16px;
}

.subscribe-widget .notify-form input {
  flex-basis: 100%;
  padding: 10px 14px;
}

.subscribe-widget .notify-form .button {
  width: 100%;
  margin-top: 6px;
}

.subscribe-bar-message {
  font-size: 0.86rem;
  color: var(--muted);
}

.subscribe-bar-message a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .subscribe-widget {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

.notify-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.notify-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--dark);
  cursor: pointer;
}

.form-field {
  margin-bottom: 22px;
  max-width: 32rem;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-field input[type="email"],
.form-field input[type="text"],
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 16px;
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 120ms ease;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.18);
}

.form-field textarea {
  min-height: 96px;
  resize: vertical;
}

.visually-hidden-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.notify-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  outline: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--dark);
  color: #fff;
  white-space: nowrap;
  transition: 160ms ease;
}

.button:hover { background: #111827; }

.footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-inner a {
  color: var(--muted);
  font-weight: 600;
}

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

.visually-hidden-field { display: none; }

.section { padding: 8px 0 72px; }

.article-list {
  margin-top: 32px;
  padding: 8px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 32px -16px rgba(15, 23, 42, 0.18);
}

.article-row {
  display: block;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 120ms ease;
}

.article-row:last-child { border-bottom: 0; }

.article-row:hover { opacity: 0.7; }

.article-row .meta {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--highlight);
}

.article-row h3 {
  margin: 8px 0 6px;
  font-size: 1.15rem;
}

.article-row p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
}

.empty-state {
  margin-top: 32px;
  padding: 32px 0;
  color: var(--muted);
  font-size: 0.98rem;
  border-top: 1px solid var(--line);
}

.about-intro {
  margin-top: 36px;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--muted);
}

.about-intro a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-intro a:hover { color: var(--text); }

.book-list {
  margin-top: 32px;
  padding: 8px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 32px -16px rgba(15, 23, 42, 0.18);
}

.book-row {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.book-row:last-child { border-bottom: 0; }

.book-cover {
  flex-shrink: 0;
  width: 92px;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.book-row-body {
  min-width: 0;
}

.book-row .meta {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--highlight);
  margin-bottom: 8px;
}

.book-row h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.book-row p {
  margin: 0 0 16px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 60ch;
}

.book-row .buy-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.book-row .buy-link:hover { color: var(--text); }

.pub-list {
  margin-top: 20px;
  padding: 8px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 32px -16px rgba(15, 23, 42, 0.18);
}

.pub-row {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.pub-row:last-child { border-bottom: 0; }

.pub-row .meta {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--highlight);
  margin-bottom: 8px;
}

.pub-row .meta a {
  color: inherit;
  text-decoration: underline;
}

.pub-row h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.pub-row p {
  margin: 0 0 16px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 60ch;
}

.pub-row .buy-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.pub-row .buy-link:hover { color: var(--text); }

@media (max-width: 480px) {
  .book-row { flex-direction: column; }
  .book-cover { width: 96px; }
}

.post-meta {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-body {
  margin-top: 28px;
  max-width: 66ch;
}

.post-body p {
  margin: 0 0 20px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body h2 {
  margin: 40px 0 16px;
  font-size: 1.35rem;
  color: var(--highlight);
}

.post-body h3 {
  margin: 32px 0 14px;
  font-size: 1.1rem;
}

.post-body ul,
.post-body ol {
  margin: 0 0 20px;
  padding-left: 1.3em;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

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

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.post-body code {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  font-size: 0.9em;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

.post-body pre {
  margin: 0 0 24px;
  padding: 18px 20px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
}

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

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

.post-body img {
  max-width: 100%;
  border-radius: 14px;
  margin: 8px 0 24px;
}

.back-link {
  display: inline-block;
  margin-top: 40px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.back-link:hover { color: var(--text); }

@media (max-width: 480px) {
  .notify-form {
    flex-wrap: wrap;
    border-radius: 22px;
    align-items: stretch;
  }
  .notify-form input { flex-basis: 100%; padding: 10px 14px; }
  .notify-form .button { width: 100%; margin-top: 4px; }
}

.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
