/* Gordon's Blog — Substack-like, minimal */
:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #9b9b9b;
  --border: #e8e6e1;
  --bg: #ffffff;
  --soft: #faf9f7;
  --accent: #1a56b0;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
}

/* Dark mode: the `dark` class is set on <html> by blog-theme.js
   (manual toggle > system preference > time of day). */
html.dark {
  --text: #e9e4dc;
  --muted: #a8a198;
  --faint: #837d74;
  --border: #37322c;
  --bg: #1c1917;
  --soft: #242019;
  --accent: #8ab0e8;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; color-scheme: light; }
html.dark { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 22px 72px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }

/* ---------- Site header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: var(--muted); font-size: 14px; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav .theme-toggle {
  font-size: 16px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
}
.site-nav .theme-toggle:hover { color: var(--text); border-color: var(--text); text-decoration: none; }

/* ---------- Index ---------- */
.blog-hero { padding: 52px 0 34px; }
.blog-hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 52px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.blog-hero p {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
  margin: 0 0 22px;
  max-width: 34em;
}
.hero-actions { display: flex; gap: 12px; font-family: var(--sans); align-items: center; flex-wrap: wrap; }
.hero-socials { display: inline-flex; gap: 8px; margin-left: 4px; }
.hero-actions .hero-socials a {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.hero-actions .hero-socials a:hover { color: var(--text); border-color: var(--text); text-decoration: none; }
.hero-socials svg { width: 15px; height: 15px; display: block; }
.hero-socials a[title^="RedNote"] svg { width: 21px; height: 21px; }
.hero-actions a {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
}
.hero-actions a.primary { background: var(--text); border-color: var(--text); color: #fff; }
.hero-actions a:hover { text-decoration: none; border-color: var(--text); }
.hero-actions a.primary:hover { background: #000; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 30px 0; border-bottom: 1px solid var(--border); display: flex; gap: 22px; align-items: center; }
.post-thumb { flex: 1 1 0; min-width: 0; }
.post-thumb img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}
.post-body { flex: 2 1 0; min-width: 0; }
.post-item:last-child { border-bottom: 0; }
.post-meta {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 8px;
}
.post-meta .tag { color: var(--accent); }
.post-item h2 { margin: 0 0 8px; font-weight: 500; font-size: 22px; line-height: 1.24; letter-spacing: -0.015em; }
.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--accent); text-decoration: none; }
.post-dek { margin: 0 0 10px; color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.post-read { font-family: var(--sans); font-size: 13px; color: var(--faint); }
/* ---------- Send-to-my-email subscribe forms (Claude palette) ---------- */
:root {
  --sub-accent: #b76531;
  --sub-accent-hover: #cf7e4d;
  --sub-input-bg: #fffdf8;
  --sub-input-border: rgba(95, 69, 39, 0.28);
  --sub-box-bg: #f6efe4;
  --sub-box-border: rgba(95, 69, 39, 0.14);
}
html.dark {
  --sub-accent: #d97757;
  --sub-accent-hover: #e08a56;
  --sub-input-bg: rgba(255, 255, 255, 0.05);
  --sub-input-border: rgba(245, 233, 215, 0.24);
  --sub-box-bg: #2e2823;
  --sub-box-border: rgba(245, 233, 215, 0.12);
}
.subscribe-form {
  display: flex;
  max-width: 420px;
  font-family: var(--sans);
}
.subscribe-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text);
  background: var(--sub-input-bg);
  border: 1px solid var(--sub-input-border);
  border-right: 0;
  border-radius: 999px 0 0 999px;
  outline: none;
}
.subscribe-form input:focus { border-color: var(--sub-accent); }
.subscribe-form input::placeholder { color: var(--faint); }
.subscribe-form button {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--sans);
  color: #fffaf5;
  background: var(--sub-accent);
  border: 1px solid var(--sub-accent);
  border-radius: 0 999px 999px 0;
  cursor: pointer;
  white-space: nowrap;
}
.subscribe-form button:hover { background: var(--sub-accent-hover); border-color: var(--sub-accent-hover); }
.subscribe-form button.is-sent,
.subscribe-form button.is-sent:hover {
  background: var(--sub-accent);
  border-color: var(--sub-accent);
  opacity: 0.72;
  cursor: default;
}
.subscribe-compact { max-width: 360px; margin-top: 10px; }
.subscribe-compact input { padding: 7px 13px; font-size: 13px; }
.subscribe-compact button { padding: 7px 14px; font-size: 13px; }
.byline-subscribe { margin: 0 0 0 auto; width: 300px; flex-shrink: 0; }
.subscribe-box {
  margin: 38px 0 0;
  padding: 22px 24px;
  background: var(--sub-box-bg);
  border: 1px solid var(--sub-box-border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.subscribe-box p {
  margin: 0;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}
.subscribe-box .subscribe-form { width: 100%; }

/* ---------- Article ---------- */
article { padding-top: 46px; }
.article-tag {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
article h1 {
  font-weight: 500;
  font-size: clamp(34px, 6vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.subtitle {
  color: var(--muted);
  font-size: 21px;
  line-height: 1.5;
  margin: 0 0 26px;
}
.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 34px;
  font-family: var(--sans);
}
.byline img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.byline-name { font-size: 14px; font-weight: 600; }
.byline-name a { color: var(--text); }
.byline-name a:hover { color: var(--accent); text-decoration: none; }
.byline-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

article p { margin: 19px 0; }
article strong { font-weight: 650; }
article h2 {
  font-weight: 500;
  font-size: 29px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 46px 0 14px;
}
article h3 { font-weight: 550; font-size: 22px; line-height: 1.3; margin: 32px 0 10px; }
article ul, article ol { padding-left: 1.35em; margin: 16px 0 22px; }
article li { margin: 9px 0; }
article hr {
  border: 0;
  border-top: 1px solid var(--border);
  width: 88px;
  margin: 46px auto;
}
article blockquote {
  margin: 26px 0;
  padding: 2px 0 2px 22px;
  border-left: 3px solid #d5d2ca;
  color: #3f3f3f;
  font-size: 20px;
  line-height: 1.6;
}
article blockquote p { margin: 8px 0; }
article figure { margin: 30px 0; }
article figure img, article p img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
article figcaption {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin-top: 10px;
}
article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
article pre {
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--soft);
  overflow: auto;
  font-size: 14.5px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
article pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.table-wrap {
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
article table { width: 100%; border-collapse: collapse; min-width: 640px; font-family: var(--sans); }
article th, article td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
article th { background: var(--soft); font-weight: 600; }
article td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
article tr:last-child td { border-bottom: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; font-family: var(--sans); }
.chips span {
  border: 1px solid var(--border);
  background: var(--soft);
  border-radius: 999px;
  padding: 5px 12px;
  color: #444;
  font-size: 14px;
}

.disclaimer, .note-fine {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 42px;
}

/* ---------- Previous / next post navigation ---------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 38px 0 0;
  font-family: var(--sans);
}
.post-nav-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--soft);
  color: var(--text);
}
.post-nav-card:hover {
  text-decoration: none;
  border-color: var(--sub-accent);
}
.post-nav-card:hover .post-nav-title { color: var(--sub-accent); }
.post-nav-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.post-nav-card:nth-child(2) .post-nav-label { text-align: right; }
.post-nav-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 7px;
}
.post-nav-card img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  margin-top: auto;
  padding-top: 12px;
  border-radius: 8px;
}
@media (max-width: 560px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-empty { display: none; }
}

/* ---------- Author card ---------- */
.author-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 54px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  font-family: var(--sans);
}
.author-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-name { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.author-card p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; color: #3f3f3f; }
.author-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13.5px; }

/* ---------- Comments ---------- */
.comments { margin-top: 46px; border-top: 1px solid var(--border); padding-top: 10px; }
.comments-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 6px;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--faint);
}
.site-footer a { color: var(--muted); }

/* ---------- Floating action bar (posts) ---------- */
.action-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: rgba(250, 246, 238, 0.92);
  border: 1px solid rgba(95, 69, 39, 0.16);
  border-radius: 999px;
  box-shadow: 0 10px 34px rgba(92, 68, 41, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--sans);
}
html.dark .action-bar {
  background: rgba(40, 34, 29, 0.92);
  border-color: rgba(245, 233, 215, 0.14);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
}
.ab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.ab-btn:hover { color: var(--sub-accent); background: rgba(183, 101, 49, 0.08); }
.ab-btn.is-liked { color: var(--sub-accent); }
.ab-btn.is-liked svg { color: var(--sub-accent); }
.ab-count { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 12.5px; }
.ab-btn.is-liked .ab-count { color: var(--sub-accent); }
.ab-btn .ab-hint { margin-left: -2px; opacity: 0.55; }
.ab-btn.ab-icon { padding: 7px 8px; }
.ab-btn:disabled { opacity: 0.35; cursor: default; }
.ab-btn:disabled:hover { color: var(--muted); background: none; }
.ab-sep { width: 1px; height: 18px; background: rgba(95, 69, 39, 0.15); }
html.dark .ab-sep { background: rgba(245, 233, 215, 0.14); }
.ab-pulse svg { animation: ab-pop 0.4s ease; }
@keyframes ab-pop { 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
.ab-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px;
  background: var(--sub-box-bg);
  border: 1px solid var(--sub-box-border);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(92, 68, 41, 0.2);
  width: min(340px, calc(100vw - 40px));
}
html.dark .ab-popover { box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45); }
.ab-popover.is-open { display: block; }
.ab-popover .subscribe-form { max-width: none; }
.ab-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px;
  background: var(--sub-box-bg);
  border: 1px solid var(--sub-box-border);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(92, 68, 41, 0.2);
  min-width: 230px;
}
html.dark .ab-menu { box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45); }
.ab-menu.is-open { display: block; }
.ab-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ab-menu-item:hover { color: var(--sub-accent); background: rgba(183, 101, 49, 0.08); }

/* Icon-only action bar on small screens: full-width and larger touch targets */
@media (max-width: 560px) {
  .action-bar {
    gap: 0;
    padding: 8px 12px;
    bottom: 14px;
    width: min(92vw, 440px);
    justify-content: space-between;
  }
  .ab-btn { padding: 10px; gap: 4px; }
  .ab-btn svg { width: 20px; height: 20px; }
  .ab-btn span:not(.ab-count) { display: none; }
  .ab-btn .ab-hint { display: none; }
  .ab-count { font-size: 13.5px; }
  .ab-sep { height: 18px; }
  .ab-popover, .ab-menu { max-width: calc(100vw - 24px); }
}

/* ---------- Dark-mode overrides for hardcoded colors ---------- */
html.dark .hero-actions a.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
html.dark .hero-actions a.primary:hover { background: #fff; border-color: #fff; }
html.dark article blockquote { border-left-color: #4a443c; color: #c9c2b8; }
html.dark .author-card p { color: #c9c2b8; }
html.dark .chips span { color: #c9c2b8; }
html.dark .brand:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 17.5px; }
  .post-item { gap: 14px; }
  .post-thumb img { height: 96px; }
  .blog-hero { padding-top: 38px; }
  .blog-hero h1 { font-size: 40px; }
  .post-item h2 { font-size: 19px; }
  .post-dek { font-size: 14.5px; }
  article { padding-top: 34px; }
  .byline { flex-wrap: wrap; }
  .byline-subscribe { width: 100%; margin: 10px 0 0; }
}
