/* Casper Modern for HTMLy
   Fonts: Bricolage Grotesque (UI, headings) + Literata (reading text), both self-hosted. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f3f5f7;
  --ink: #12171d;
  --ink-2: #444f5c;
  --ink-3: #66717e;
  --line: #e1e5ea;
  --link: var(--accent);
  --btn: var(--accent);
  --btn-fg: var(--accent-fg);
  --shadow: 0 14px 34px -14px rgba(18, 23, 29, 0.28);

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 72rem;
  --measure: 44rem;
  --radius: 10px;
  color-scheme: light;
}

:root[data-mode="dark"],
:root[data-theme="dark"] {
  --bg: #0e1217;
  --bg-soft: #171c23;
  --ink: #e8ecf0;
  --ink-2: #b4bdc8;
  --ink-3: #8f9aa7;
  --line: #262d36;
  --link: var(--accent-dk);
  --btn: var(--accent-dk);
  --btn-fg: var(--accent-dkfg);
  --shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"]:not([data-theme="light"]) {
    --bg: #0e1217;
    --bg-soft: #171c23;
    --ink: #e8ecf0;
    --ink-2: #b4bdc8;
    --ink-3: #8f9aa7;
    --line: #262d36;
    --link: var(--accent-dk);
    --btn: var(--accent-dk);
    --btn-fg: var(--accent-dkfg);
    --shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.wrap-narrow { max-width: calc(var(--measure) + 4rem); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--btn); color: var(--btn-fg); padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.is-admin .site-header { position: relative; }
.header-bar { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.brand-wrap { display: flex; align-items: center; margin: 0; font-size: inherit; font-weight: inherit; letter-spacing: 0; line-height: inherit; flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-logo { width: 2.25rem; height: 2.25rem; border-radius: 9px; object-fit: cover; background: var(--bg-soft); }
.brand-name { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }

.primary-nav { flex: 1 1 auto; min-width: 0; }
.primary-nav ul, .footer-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.15rem; }
@media (min-width: 52.01rem) {
  .primary-nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .primary-nav ul::-webkit-scrollbar { display: none; }
  .primary-nav li { flex-shrink: 0; }
}
.primary-nav li { position: relative; }
.primary-nav a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 0.9375rem;
}
.primary-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.primary-nav li.active > a { color: var(--ink); font-weight: 650; box-shadow: inset 0 -2px 0 var(--link); border-radius: 8px 8px 0 0; }
.primary-nav li ul {
  display: none; position: absolute; left: 0; top: 100%; min-width: 12rem; z-index: 60;
  flex-direction: column; flex-wrap: nowrap; gap: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0.4rem; box-shadow: var(--shadow);
}
.primary-nav li:hover > ul, .primary-nav li:focus-within > ul { display: flex; }

.header-tools { display: flex; align-items: center; gap: 0.15rem; margin-left: auto; }
.header-tools button, .search-pop summary {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
  background: none; border: 0; border-radius: 999px; color: var(--ink-2); cursor: pointer; list-style: none;
}
.search-pop summary::-webkit-details-marker { display: none; }
.header-tools button:hover, .search-pop summary:hover, .search-pop[open] summary { background: var(--bg-soft); color: var(--ink); }
.nav-toggle { display: none !important; }
.header-tools svg { display: block; }
.header-tools button > span { display: flex; line-height: 0; }
.theme-toggle .icon-sun { display: none !important; }
:root[data-mode="dark"] .theme-toggle .icon-moon, :root[data-theme="dark"] .theme-toggle .icon-moon { display: none !important; }
:root[data-mode="dark"] .theme-toggle .icon-sun, :root[data-theme="dark"] .theme-toggle .icon-sun { display: flex !important; }
@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"]:not([data-theme="light"]) .theme-toggle .icon-moon { display: none !important; }
  :root[data-mode="auto"]:not([data-theme="light"]) .theme-toggle .icon-sun { display: flex !important; }
}

.search-pop { position: relative; }
.search-pop .search-form {
  position: absolute; right: 0; top: calc(100% + 0.5rem); width: min(92vw, 24rem);
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 0.6rem; box-shadow: var(--shadow);
}
.search-form { display: flex; gap: 0.5rem; }
.search-form input[type="search"] {
  flex: 1 1 auto; min-width: 0; height: 2.75rem; padding: 0 0.9rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-appearance: none; appearance: none;
}
.search-form input[type="search"]::placeholder { color: var(--ink-3); }
.search-form input[type="search"]:focus { outline: 2px solid var(--link); outline-offset: 0; border-color: transparent; }
.search-form button, .btn {
  display: inline-flex; align-items: center; justify-content: center; height: 2.75rem; padding: 0 1.1rem;
  background: var(--btn); color: var(--btn-fg); border: 0; border-radius: var(--radius);
  font-weight: 600; text-decoration: none; cursor: pointer; width: auto;
}
.search-form button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.search-form-lg { max-width: 30rem; margin: 1.75rem 0; }

@media (max-width: 52rem) {
  /* Search panel spans the screen under the header instead of hanging off the icon */
  .search-pop { position: static; }
  .search-pop .search-form { left: clamp(1rem, 4vw, 2rem); right: clamp(1rem, 4vw, 2rem); width: auto; top: calc(100% + 0.5rem); }
  .js .nav-toggle { display: inline-grid !important; }
  .js .primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 0.5rem clamp(1rem, 4vw, 2rem) 1rem;
  }
  .js .nav-open .primary-nav { display: block; }
  .primary-nav ul { flex-direction: column; }
  .primary-nav a { padding: 0.7rem 0.5rem; }
  .primary-nav li.active > a { box-shadow: none; color: var(--link); }
  .primary-nav li ul { display: flex; position: static; border: 0; box-shadow: none; padding: 0 0 0 1rem; }
  .nav-toggle .icon-close { display: none; }
  .nav-open .nav-toggle .icon-open { display: none; }
  .nav-open .nav-toggle .icon-close { display: flex; }
  .brand-name { font-size: 1rem; }
  .header-bar { flex-wrap: wrap; }
  html:not(.js) .primary-nav { flex-basis: 100%; order: 3; padding-bottom: 0.5rem; }
}

/* ---------- Page heads ---------- */
.page-head { padding: clamp(1.5rem, 4vw, 3rem) 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.page-title { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); font-weight: 750; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.page-lede { margin-top: 0.9rem; max-width: 40rem; color: var(--ink-2); font-family: var(--serif); font-size: 1.125rem; line-height: 1.6; }
.page-lede p + p { margin-top: 0.75rem; }
.author-head { display: flex; gap: 1.5rem; align-items: center; }
.avatar { border-radius: 999px; object-fit: cover; background: var(--bg-soft); width: 2.75rem; height: 2.75rem; }
.avatar-lg { width: 6rem; height: 6rem; flex-shrink: 0; }
.crumb-row { padding-top: 1.25rem; }
@media (max-width: 69.99rem) { .crumb-row { max-width: calc(var(--measure) + 4rem); } }
.page-head .breadcrumb { margin-bottom: 1.25rem; }

.breadcrumb { font-size: 0.875rem; color: var(--ink-3); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0; }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "/"; margin: 0 0.5rem; color: var(--line); }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--ink-2); }
.breadcrumb [aria-current] span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }

/* ---------- Listings ---------- */
.site-main { padding: 1.5rem 0 4rem; }
.is-home .site-main { padding-top: clamp(1.5rem, 4vw, 3rem); }
.section-title { font-size: 1.25rem; font-weight: 700; margin: 3rem 0 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

.feed { display: grid; gap: 3rem 2rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 62rem) { .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { .feed { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; } }

.card { display: flex; flex-direction: column; min-width: 0; }
.card-media {
  display: block; position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--bg-soft); border-radius: 8px; margin-bottom: 1rem;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-play {
  position: absolute; right: 0.75rem; bottom: 0.75rem; width: 2.5rem; height: 2.5rem;
  border-radius: 999px; background: rgba(10, 14, 20, 0.72);
}
.card-play::after {
  content: ""; position: absolute; left: 52%; top: 50%; transform: translate(-50%, -50%);
  border-style: solid; border-width: 0.4rem 0 0.4rem 0.7rem; border-color: transparent transparent transparent #fff;
}
.card-quote { display: block; margin-bottom: 1rem; text-decoration: none; }
.card-quote blockquote {
  margin: 0; padding: 1.25rem 1.25rem 1.25rem 1.5rem; border-left: 3px solid var(--link);
  background: var(--bg-soft); border-radius: 0 8px 8px 0;
  font-family: var(--serif); font-style: italic; font-size: 1.0625rem; line-height: 1.55; color: var(--ink);
}
.card-text { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.card-body { display: flex; flex-direction: column; flex: 1; }
.card-catline { font-size: 0.875rem; font-weight: 650; margin-bottom: 0.4rem; }
.card-cat { color: var(--link); text-decoration: none; }
.card-cat:hover { text-decoration: underline; }
.card-title { font-size: 1.1875rem; font-weight: 650; letter-spacing: -0.012em; line-height: 1.25; text-wrap: balance; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-thickness: 0.09em; text-underline-offset: 0.2em; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card-catline, .card-edit { position: relative; z-index: 1; }
.card-excerpt {
  margin-top: 0.55rem; color: var(--ink-2); font-family: var(--serif); font-size: 0.96875rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: auto; padding-top: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; color: var(--ink-3); font-size: 0.8125rem; }
.card-read { display: inline-flex; align-items: center; gap: 0.3rem; }

.lead-wrap { margin-bottom: 1rem; }
.card-lead { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.card-lead .card-media { margin-bottom: 0; border-radius: 12px; aspect-ratio: 3 / 2; }
.card-lead .card-title { font-size: clamp(1.65rem, 1.1rem + 1.9vw, 2.6rem); font-weight: 720; letter-spacing: -0.025em; line-height: 1.08; }
.card-lead .card-excerpt { font-size: 1.0625rem; -webkit-line-clamp: 4; margin-top: 0.9rem; }
.card-lead .card-catline { font-size: 0.9375rem; }
.card-lead .card-meta { margin-top: 1.1rem; padding-top: 0; font-size: 0.875rem; }
.card-lead.card-text { grid-template-columns: minmax(0, 1fr); border-top: 0; padding-top: 0; }
@media (max-width: 52rem) { .card-lead { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; } }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager-link {
  display: inline-flex; align-items: center; height: 2.75rem; padding: 0 1.2rem; border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 600;
}
a.pager-link:hover { border-color: var(--link); color: var(--link); }
.pager-link.is-off { color: var(--ink-3); opacity: 0.5; }
.pager-num { color: var(--ink-3); font-size: 0.9375rem; }

.empty-state { padding: clamp(2rem, 8vw, 5rem) 0; max-width: 38rem; }


/* ---------- Homepage hero (popular / latest mosaic) ---------- */
.hero-grid { display: grid; gap: 0.75rem; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; height: clamp(24rem, 40vw, 30rem); }
.tile { position: relative; min-width: 0; min-height: 0; border-radius: 12px; overflow: hidden; background: #1b2430; }
.tile-1 { grid-column: 1; grid-row: 1 / 3; }
.tile-2 { grid-column: 2 / 4; grid-row: 1; }
.tile-3 { grid-column: 2; grid-row: 2; }
.tile-4 { grid-column: 3; grid-row: 2; }
.tile-link { position: absolute; inset: 0; display: block; color: #fff; text-decoration: none; }
.tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: no-preference) { .tile-img { transition: transform 0.4s ease; } .tile-link:hover .tile-img { transform: scale(1.03); } }
.tile-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 12, 18, 0.88) 0%, rgba(8, 12, 18, 0.35) 50%, rgba(8, 12, 18, 0) 100%); }
.tile-noimg { background: linear-gradient(135deg, var(--accent), #12171d); }
.tile-badge { position: absolute; top: 0.75rem; left: 0.75rem; padding: 0.2rem 0.65rem; border-radius: 999px; background: rgba(8, 12, 18, 0.62); color: #fff; font-size: 0.75rem; font-weight: 650; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.tile-body { position: absolute; left: 0; right: 0; bottom: 0; display: block; padding: clamp(0.85rem, 2vw, 1.5rem); }
.tile-cat { display: block; margin-bottom: 0.35rem; font-size: 0.8125rem; font-weight: 700; color: var(--accent-dk); }
.tile-title {
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance;
}
.tile-1 .tile-title { font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem); letter-spacing: -0.02em; line-height: 1.12; -webkit-line-clamp: 4; }
.tile-link:hover .tile-title { text-decoration: underline; text-decoration-thickness: 0.07em; text-underline-offset: 0.18em; }
.hero + .section-title { margin-top: 2.5rem; }
@media (max-width: 62rem) {
  .hero-grid { height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .tile { aspect-ratio: 4 / 3; }
  .tile-1 { grid-column: 1 / 3; grid-row: auto; aspect-ratio: 16 / 9; }
  .tile-2 { grid-column: 1 / 3; grid-row: auto; aspect-ratio: 21 / 9; }
  .tile-3, .tile-4 { grid-column: auto; grid-row: auto; }
}
@media (max-width: 40rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .tile, .tile-1, .tile-2, .tile-3, .tile-4 { grid-column: 1; aspect-ratio: 2 / 1; }
  .tile-1 { aspect-ratio: 16 / 10; }
}

/* ---------- Article ---------- */
.entry { padding-top: 1.25rem; }
.entry-head, .prose, .entry-foot { max-width: var(--measure); margin-inline: auto; }
.entry-cat { font-weight: 650; font-size: 0.9375rem; margin-bottom: 0.75rem; }
.entry-cat a { color: var(--link); text-decoration: none; }
.entry-cat a:hover { text-decoration: underline; }
.entry-title { font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.5rem); font-weight: 750; letter-spacing: -0.03em; line-height: 1.06; text-wrap: balance; }
.entry-title a { color: inherit; text-decoration: none; }
.entry-dek { margin-top: 1.1rem; color: var(--ink-2); font-family: var(--serif); font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); line-height: 1.55; }
.entry-edit { margin-top: 0.75rem; font-size: 0.9375rem; }

.byline { display: flex; align-items: center; gap: 0.85rem; margin-top: 1.75rem; }
.byline-avatar { display: block; flex-shrink: 0; }
.byline-name { font-weight: 650; color: var(--ink); text-decoration: none; }
.byline-name:hover { text-decoration: underline; }
.byline-meta { display: flex; flex-wrap: wrap; gap: 0.1rem 1rem; color: var(--ink-3); font-size: 0.875rem; }
.byline-read { display: inline-flex; align-items: center; gap: 0.3rem; }

.entry-hero { max-width: 62rem; margin: 2rem auto 0; }
.entry-hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: var(--bg-soft); }
.entry-page .entry-head { padding-bottom: 0.5rem; }

/* Reading text */
.prose { margin-top: 2.25rem; font-family: var(--serif); font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); line-height: 1.75; color: var(--ink); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.4em; }
.prose h2 { font-family: var(--display); font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); font-weight: 720; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2.2em; scroll-margin-top: 5rem; }
.prose h3 { font-family: var(--display); font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); font-weight: 700; margin-top: 1.9em; scroll-margin-top: 5rem; }
.prose h4, .prose h5, .prose h6 { font-family: var(--display); font-size: 1.0625rem; font-weight: 700; margin-top: 1.6em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.7em; }
.prose a { text-decoration-line: underline; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose strong { font-weight: 700; }
.prose blockquote {
  margin-inline: 0; padding: 0.15em 0; padding-inline-start: 1.25rem; border-inline-start: 3px solid var(--link);
  font-style: italic; color: var(--ink-2);
}
.prose blockquote > * + * { margin-top: 0.8em; }
.prose img { border-radius: 8px; margin-inline: auto; }
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: 0.6rem; font-family: var(--display); font-size: 0.875rem; color: var(--ink-3); text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-soft); padding: 0.15em 0.4em; border-radius: 5px; }
.prose pre { overflow-x: auto; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; font-size: 0.9rem; line-height: 1.6; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse; font-family: var(--display); font-size: 0.9375rem; line-height: 1.5; }
.prose th, .prose td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 700; background: var(--bg-soft); white-space: nowrap; }
.prose .toc, .prose #toc { font-family: var(--display); font-size: 0.9375rem; line-height: 1.5; background: var(--bg-soft); border-radius: var(--radius); padding: 1rem 1.25rem; }
.prose .toc ul, .prose #toc ul { margin-top: 0.4rem; padding-left: 1.1em; }
.prose iframe { border: 0; }
.prose iframe[src*="youtube"], .prose iframe[src*="youtu.be"], .embed iframe[src*="youtube"] { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; }
.embed iframe { width: 100%; border: 0; border-radius: 10px; }
.prose-sm p + p { margin-top: 0.6rem; }


/* ---------- Table of contents ---------- */
/* HTMLy's own TOC box is replaced by the theme's (built from the same headings) */
.prose .toc-wrapper { display: none !important; }
.prose .anchor { display: none; }
.entry-toc[hidden] { display: none; }

.toc-box { font-size: 0.9375rem; }
.toc-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; cursor: pointer; list-style: none;
  padding: 0.75rem 1rem; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 650; color: var(--ink);
}
.toc-summary::-webkit-details-marker { display: none; }
.toc-chevron { transition: transform 0.15s ease; flex-shrink: 0; }
.toc-box[open] .toc-chevron { transform: rotate(180deg); }
.toc-nav { margin-top: 0.5rem; padding: 0.25rem 1rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius); }
.toc-list { list-style: none; border-left: 1px solid var(--line); margin: 0.5rem 0; }
.toc-list a {
  display: block; margin-left: -1px; padding: 0.4rem 0 0.4rem 1rem; border-left: 2px solid transparent;
  color: var(--ink-3); text-decoration: none; line-height: 1.35;
}
.toc-list .toc-sub a { padding-left: 2rem; font-size: 0.9rem; }
.toc-list a:hover { color: var(--ink); }
.toc-list a.is-active { color: var(--ink); font-weight: 650; border-left-color: var(--link); }
.entry-post > .entry-toc { max-width: var(--measure); margin: 1.75rem auto 0; }

@media (min-width: 70rem) {
  /* With a TOC the article fills the header width: text on the left, floating TOC on the right.
     Without a TOC the article stays in a centered reading column. */
  .entry-post.has-toc {
    display: grid; align-items: start;
    grid-template-columns: minmax(0, 1fr) 16rem;
    column-gap: 3rem;
  }
  .has-toc > .entry-head, .has-toc > .prose, .has-toc > .entry-foot {
    grid-column: 1; max-width: none; width: 100%; margin-inline: 0;
  }
  .has-toc > .entry-head { grid-row: 1; }
  .has-toc > .entry-hero { grid-column: 1; grid-row: 2; max-width: none; width: 100%; margin: 2rem 0 0; }
  .has-toc > .prose { grid-row: 3; }
  .has-toc > .entry-foot { grid-row: 4; }
  .has-toc > .entry-toc { grid-column: 2; grid-row: 1 / 5; align-self: stretch; max-width: none; margin: 0.35rem 0 0; }
  .has-toc .toc-box { position: sticky; top: 6rem; }
  .has-toc .toc-summary { background: none; border: 0; padding: 0 0 0.5rem; cursor: default; pointer-events: none; }
  .has-toc .toc-chevron { display: none; }
  .has-toc .toc-nav { margin: 0; padding: 0; border: 0; max-height: calc(100vh - 9rem); overflow-y: auto; }
  .is-admin .has-toc .toc-box { top: 9rem; }
}

/* HTML sitemap */
.sitemap h2 { margin-top: 2.2em; }
.sitemap > h2:first-child { margin-top: 0; }
.sitemap h3 { font-size: 1.125rem; margin-top: 1.8em; }
.sitemap h3 a { color: inherit; text-decoration: none; }
.sitemap h3 a:hover { color: var(--link); text-decoration: underline; }
.sitemap-count { font-size: 0.8125rem; font-weight: 500; color: var(--ink-3); background: var(--bg-soft); border-radius: 999px; padding: 0.1rem 0.55rem; vertical-align: middle; }
.sitemap-list { list-style: none; padding-left: 0 !important; }
.sitemap-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.sitemap-list li + li { margin-top: 0; }
.sitemap-list a { text-decoration: none; color: var(--ink); }
.sitemap-list a:hover { color: var(--link); text-decoration: underline; }
.sitemap-list time { flex-shrink: 0; font-family: var(--display); font-size: 0.8125rem; color: var(--ink-3); padding-top: 0.15rem; }
@media (max-width: 40rem) { .sitemap-list li { flex-direction: column; gap: 0.1rem; } }

/* Article footer */
.entry-foot { margin-top: 3rem; padding-top: 1.75rem; border-top: 1px solid var(--line); display: grid; gap: 2rem; }
.foot-title { font-size: 0.9375rem; font-weight: 700; color: var(--ink-2); margin-bottom: 0.7rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags a {
  display: inline-block; padding: 0.3rem 0.85rem; background: var(--bg-soft); color: var(--ink-2);
  border-radius: 999px; font-size: 0.875rem; font-weight: 500; text-decoration: none;
}
.tags a::before { content: "#"; color: var(--ink-3); margin-right: 0.1rem; }
.tags a:hover { background: var(--btn); color: var(--btn-fg); }
.tags a:hover::before { color: inherit; }
.share ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.share a {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.5rem; padding: 0 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 0.9375rem; font-weight: 550;
}
.share a:hover { border-color: var(--link); color: var(--link); }
.author-box { display: flex; gap: 1.1rem; align-items: center; padding: 1.25rem; background: var(--bg-soft); border-radius: 14px; }
.author-box .avatar-lg { width: 4.5rem; height: 4.5rem; }
.author-box-by { font-size: 0.8125rem; color: var(--ink-3); }
.author-box-name { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.01em; }
.author-box-name a { color: var(--ink); text-decoration: none; }
.author-box-name a:hover { text-decoration: underline; }
.author-box-bio { margin-top: 0.3rem; color: var(--ink-2); font-size: 0.9375rem; font-family: var(--serif); }
.comments { min-height: 1px; }

/* After the article */
.after-post { background: var(--bg-soft); padding: clamp(2.5rem, 6vw, 4rem) 0; border-top: 1px solid var(--line); }
.after-title { font-size: 1.5rem; font-weight: 720; margin-bottom: 1.75rem; }
.prevnext { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 3rem; }
.prevnext-link { display: block; padding: 1.1rem 1.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.prevnext-link:hover { border-color: var(--link); }
.prevnext-next { grid-column: 2; text-align: right; }
.prevnext-prev:only-child { grid-column: 1; }
.prevnext-label { display: block; font-size: 0.8125rem; color: var(--ink-3); margin-bottom: 0.2rem; }
.prevnext-title { display: block; font-weight: 650; line-height: 1.3; }
@media (max-width: 40rem) { .prevnext { grid-template-columns: minmax(0, 1fr); } .prevnext-next { grid-column: 1; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2rem; background: var(--bg); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.footer-note { margin-top: 0.9rem; max-width: 30rem; color: var(--ink-2); font-family: var(--serif); font-size: 0.96875rem; line-height: 1.6; }
.footer-nav ul { flex-direction: column; gap: 0.25rem; }
.footer-nav a { color: var(--ink-2); text-decoration: none; padding: 0.15rem 0; display: inline-block; font-weight: 500; }
.footer-nav a:hover { color: var(--link); text-decoration: underline; }
.social { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.social a {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-2);
}
.social a:hover { color: var(--link); border-color: var(--link); }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 0.875rem; }
.footer-bottom a { color: var(--ink-3); }
.footer-bottom p { display: inline; margin-right: 0.4rem; }
@media (max-width: 40rem) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Utilities and print ---------- */
.is-admin .skip-link { top: -4rem; }
@media print {
  .site-header, .site-footer, .after-post, .share, .pager, .header-tools { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { font-size: 11.5pt; }
  a { color: inherit; }
}
