/* Default theme — visual language carried over from blog-01.
 *
 * V0.2 §18 freezes the reference: soft gradient background, a scene-style hero,
 * floating liquid-glass navigation, restrained radii and shadows, a blue accent,
 * light and dark, reading-friendly content widths, and a table of contents.
 * §18 also freezes the runtime constraint: none of this depends on Next.js or
 * React SSR. It is plain CSS and a small amount of progressive-enhancement JS.
 *
 * Every colour is defined once as a custom property so the light and dark
 * palettes stay in step, and so a child theme can override a single token
 * without rewriting a rule.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  --accent-500: #2563eb;
  --accent-600: #1d4ed8;
  --accent-soft: rgb(37 99 235 / 0.1);
  --accent-contrast: #ffffff;

  --text-strong: #20243a;
  --text-muted: #747b91;
  --text-body: #3a4055;

  --surface: rgb(255 255 255 / 0.94);
  --surface-border: #ebe8f4;
  --surface-chip: #f7f7fa;
  --surface-muted: #f2f2f7;
  /* The page surface, sampled from the reference's rendered output rather than
   * from its stylesheet: see the note at `.site` below. */
  --page-background: #f8f7f6;

  --card-shadow: 0 14px 36px -30px rgb(82 75 155 / 0.34);
  --card-shadow-hover: 0 22px 44px -29px rgb(82 75 155 / 0.34);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 18px;
  --radius-pill: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --content-width: 1024px;
  --reading-width: 720px;
  --nav-height: 3.5rem;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* The editor's highlight palette (post-MVP body protocol). Published
   * <mark> elements reference these by name; values match the admin's
   * tiptap-vars.scss so what the author saw is what readers see. */
  --tt-color-highlight-yellow: #fef9c3;
  --tt-color-highlight-green: #dcfce7;
  --tt-color-highlight-blue: #e0f2fe;
  --tt-color-highlight-purple: #f3e8ff;
  --tt-color-highlight-red: #ffe4e6;
  --tt-color-highlight-gray: rgb(248, 248, 247);
  --tt-color-highlight-brown: rgb(244, 238, 238);
  --tt-color-highlight-orange: rgb(251, 236, 221);
  --tt-color-highlight-pink: rgb(252, 241, 246);
}

.dark {
  color-scheme: dark;

  --accent-500: #60a5fa;
  --accent-600: #93c5fd;
  --accent-soft: rgb(96 165 250 / 0.16);
  --accent-contrast: #0f172a;

  --text-strong: #ffffff;
  --text-muted: rgb(203 213 225 / 0.75);
  --text-body: rgb(226 232 240 / 0.86);

  --surface: rgb(255 255 255 / 0.055);
  --surface-border: rgb(255 255 255 / 0.1);
  --surface-chip: rgb(255 255 255 / 0.05);
  --surface-muted: rgb(255 255 255 / 0.04);
  --page-background: #0d0d0d;

  --card-shadow: 0 14px 36px -30px rgb(0 0 0 / 0.5);
  --card-shadow-hover: 0 22px 44px -29px rgb(0 0 0 / 0.58);

  --tt-color-highlight-yellow: #6b6524;
  --tt-color-highlight-green: #509568;
  --tt-color-highlight-blue: #6e92aa;
  --tt-color-highlight-purple: #583e74;
  --tt-color-highlight-red: #743e42;
  --tt-color-highlight-gray: rgb(47, 47, 47);
  --tt-color-highlight-brown: rgb(74, 50, 40);
  --tt-color-highlight-orange: rgb(92, 59, 35);
  --tt-color-highlight-pink: rgb(78, 44, 60);
}

/* ------------------------------------------------------------------ base */

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

html {
  font-family: var(--font-sans);
  /* V0.2 §18: anchored scrolling keeps a heading visible under the fixed nav. */
  scroll-padding-top: calc(var(--nav-height) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text-body);
  background: var(--page-background, #f4f5ff);
  /* V0.2 §18: "移动端正文不横向溢出." Clipping is the last-resort guard after
   * the layout rules below; it must not be the only defence. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-600);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* V0.2 §18: "导航与按钮支持键盘和可见焦点." */
:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent-500);
  color: var(--accent-contrast);
  border-radius: var(--radius-md);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ page surface */

/* V0.2 §18 names "柔和渐变背景" as part of the reference look, and `blog-01` does
 * carry those three gradients in `public-home.css` — but its *rendered* surface
 * is a flat near-white: the page body paints an opaque `--background`
 * (lab(97.68%) ≈ #f8f7f6) over the decorative layer, so the gradient never
 * reaches the screen. Sampling the reference at five points across the
 * viewport returns #f8f7f6 every time (dark mode: #0d0d0d).
 *
 * The first version of this theme painted the gradient directly, which turned a
 * calm near-white page into a saturated blue-to-orange wash — visibly nothing
 * like the reference. The surface is therefore flat, matching what the
 * reference actually renders; the gradient layer is gone rather than kept as
 * dead paint. */
.site {
  position: relative;
  isolation: isolate;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--page-background);
}

/* ---------------------------------------------------- floating glass nav */

/* The glass is the reference's "liquid glass" recipe, values copied from
 * blog-01's src/app/public-header.css: a very thin backdrop blur plus an SVG
 * filter (#public-nav-liquid-glass, defined in _header.html) that displaces the
 * backdrop by a generated gradient map, so the pill refracts what passes behind
 * it instead of frosting it. The plain blur() stays as the first declaration for
 * browsers that cannot resolve url() inside backdrop-filter. */
.site-header {
  --glass-surface: rgb(255 255 255 / 0.12);
  --glass-border: rgb(21 20 15 / 0.01);
  --glass-fallback-blur: 0.5px;
  --glass-lens-blur: 1px;
  --glass-saturation: 0.6;
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark .site-header {
  --glass-surface: rgb(15 23 42 / 0.12);
  --glass-border: rgb(226 232 240 / 0.14);
}

/* No `position: relative` / `overflow: hidden` here on purpose: the mobile menu
 * is an absolutely positioned disclosure anchored to .site-header, so making the
 * shell a clipping containing block would cut it off. The reference can use both
 * because its mobile menu is a portalled sheet. */
.nav-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, calc(100% - 1rem));
  max-width: var(--content-width);
  height: 100%;
  padding-inline: 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  transition:
    width 420ms var(--ease-out),
    height 420ms var(--ease-out),
    margin 420ms var(--ease-out),
    padding 420ms var(--ease-out),
    border-radius 420ms var(--ease-out),
    background 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

/* Condensed state: a floating pill over the content. The JS adds
 * data-scrolled once past a threshold with hysteresis so it does not flicker. */
.site-header[data-scrolled="true"] .nav-shell {
  width: min(100%, calc(100% - 1rem));
  height: 48px;
  margin-top: 4px;
  padding-inline: 14px;
  border-radius: var(--radius-pill);
  border-color: var(--glass-border);
  background: var(--glass-surface);
  -webkit-backdrop-filter: blur(var(--glass-fallback-blur)) saturate(var(--glass-saturation));
  backdrop-filter: blur(var(--glass-fallback-blur)) saturate(var(--glass-saturation));
  backdrop-filter: url("#public-nav-liquid-glass") blur(var(--glass-lens-blur)) saturate(var(--glass-saturation));
  box-shadow:
    inset 0 0 2px 1px rgb(255 255 255 / 0.55),
    inset 0 0 10px 4px rgb(255 255 255 / 0.22),
    0 6px 24px rgb(17 17 26 / 0.06),
    0 12px 40px rgb(17 17 26 / 0.05);
}

/* The surface is already dark in dark mode, so only the highlights change: the
 * reference keeps the same inset recipe at lower alpha. */
.dark .site-header[data-scrolled="true"] .nav-shell {
  box-shadow:
    inset 0 0 2px 1px rgb(255 255 255 / 0.16),
    inset 0 0 10px 4px rgb(255 255 255 / 0.07),
    0 6px 24px rgb(0 0 0 / 0.2),
    0 12px 40px rgb(0 0 0 / 0.16);
}

/* The filter and its map live outside the flow; the effect itself is applied to
 * .nav-shell above. */
.glass-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--text-strong);
  font-weight: 650;
}

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

.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 那块带强调色的底板只属于默认占位标。用户上传的 logo 保持原样：不垫底色、
 * 不描边、不裁圆角，带透明通道的图就是纯透明（模板只在无 logo 时加这个类）。 */
.brand-mark-fallback {
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent-500) 24%, transparent);
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--accent-500) 12%, white),
    color-mix(in srgb, var(--accent-500) 4%, transparent));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9);
}

/* The fallback mark: three rotated squares forming a spark, matching the
 * reference's placeholder logo. */
.brand-spark {
  position: relative;
  width: 18px;
  height: 18px;
}

.brand-spark span {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--accent-500);
  transform: rotate(45deg);
}

.brand-spark span:nth-child(2) {
  transform: rotate(45deg) scale(0.62);
  opacity: 0.55;
}

.brand-spark span:nth-child(3) {
  transform: rotate(45deg) scale(0.44);
  opacity: 0.3;
}

.brand-title {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;}

.nav-spacer {
  flex: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  position: relative;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 160ms ease, background 160ms ease;
}

.site-nav a:hover {
  color: var(--text-strong);
  background: rgb(148 163 184 / 0.1);
  text-decoration: none;
}

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

/* The reference's animated underline: a hairline that grows on hover or when
 * the entry is current. */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.18rem;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 180ms ease, transform 180ms ease;
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  opacity: 0.55;
  transform: scaleX(1);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
  color: var(--text-strong);
  background: rgb(148 163 184 / 0.14);
}

.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* The theme toggle shows exactly one icon, chosen by the current mode. */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

:root:not(.dark) .theme-toggle .icon-moon {
  display: block;
}

.dark .theme-toggle .icon-sun {
  display: block;
}

.nav-toggle {
  display: none;
}

/* The theme toggle is driven entirely by the script, so without the script it
 * would be a button that does nothing. It is hidden rather than shown dead; a
 * visitor with JavaScript disabled gets the light theme, which is the only one
 * the stylesheet defines without the class the script sets. */
.theme-toggle {
  display: none;
}

.has-js .theme-toggle {
  display: inline-grid;
}

/* --------------------------------------------------------------- layout */

.main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

.container-narrow {
  width: 100%;
  max-width: var(--reading-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

.page-head {
  padding-block: 2.5rem 1rem;
}

/* The reference closes the page header with a hairline across the content
 * column (measured #e5e5e5), which is what separates "title block" from
 * "list" instead of whitespace alone. */
.page-head-inner {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--surface-border);
}

.page-meta {
  margin: 0.6rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.page-title {
  margin: 0;
  /* The reference's list heading, measured: 30px / 700 / -0.75px. */
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-strong);
}

.page-description {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

.divider {
  height: 1px;
  border: 0;
  margin: 1.5rem 0;
  background: var(--surface-border);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.hero-actions .button svg {
  width: 1rem;
  height: 1rem;
}

.hero-actions .button-arrow {
  transition: transform 160ms var(--ease-out);
}

.hero-actions .button:hover .button-arrow {
  transform: translateX(2px);
}

/* 按钮跟随首页 hero 的设计语言：胶囊形、平涂色块、无投影无悬浮位移。 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.625rem;
  padding: 0 1.125rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

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

.button-primary {
  border-color: var(--accent-500);
  background: var(--accent-500);
  color: var(--accent-contrast);
}

.button-primary:hover {
  background: var(--accent-600);
  border-color: var(--accent-600);
}

.button-secondary {
  background: rgb(255 255 255 / 0.78);
  border-color: var(--surface-border);
  color: var(--text-strong);
}

.dark .button-secondary {
  background: rgb(255 255 255 / 0.05);
}

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

.section {
  padding-block: 1.5rem;
}

/* The reference's section panel: rounded, translucent, with a soft shadow. */
.section-shell {
  padding: 1.25rem;
  border: 1px solid var(--surface-border);
  border-radius: 1.6rem;
  background: rgb(255 255 255 / 0.68);
  box-shadow: 0 20px 55px -42px rgb(84 78 170 / 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dark .section-shell {
  background: rgb(255 255 255 / 0.045);
}

@media (min-width: 640px) {
  .section-shell {
    padding: 1.5rem;
  }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .section-head {
    margin-bottom: 1.5rem;
  }
}

.section-action {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-600);
}

.section-action svg {
  width: 1rem;
  height: 1rem;
  transition: transform 160ms var(--ease-out);
}

.section-action:hover svg {
  transform: translate(2px, -2px);
}

.section-title {
  margin: 0;
  /* The reference's section heading: text-xl, text-2xl from 640px. */
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

@media (min-width: 640px) {
  .section-title {
    font-size: 1.5rem;
  }
}

/* -------------------------------------------------------------- post card */

/* --------------------------------------------------------- card decoration */

/* Ported from the reference's post card: an inline line-art motif in the
 * bottom-right corner, masked so it fades toward the top-left, drawn in the
 * accent colour at low opacity, and nudged on hover. The motif itself is chosen
 * per article by `motifIndex` (see _motifs.html). */
.card-motif {
  pointer-events: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12rem;
  height: 9rem;
  overflow: hidden;
  border-bottom-right-radius: var(--radius-xl);
  color: color-mix(in srgb, var(--accent-500) 16%, transparent);
  -webkit-mask-image: linear-gradient(to top left, rgb(0 0 0 / 1) 0%, rgb(0 0 0 / 0.72) 36%, transparent 80%);
  mask-image: linear-gradient(to top left, rgb(0 0 0 / 1) 0%, rgb(0 0 0 / 0.72) 36%, transparent 80%);
}

.card-motif svg {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  transition: transform 500ms var(--ease-out);
}

.post-card:hover .card-motif svg,
.post-row:hover .card-motif svg {
  transform: translate(-2px, -2px) scale(1.04);
}

/* ------------------------------------------------------- home cards */

/* Ported from the reference's `HomePostCard`. The card is a 3-column grid item
 * whose top is a 16:9 media area: the cover when the post has one, otherwise a
 * designed placeholder — a gradient surface, a blurred halo, two outlined rings
 * and a rotated icon badge, in three colour variants cycled by card index. */
.home-card {
  min-width: 0;
}

.home-card-link {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  transition: transform 300ms var(--ease-out), border-color 300ms ease, box-shadow 300ms ease;
}

.home-card-link:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent-500) 25%, var(--surface-border));
  box-shadow: var(--card-shadow-hover);
  text-decoration: none;
}

.home-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-muted);
}

.home-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-out);
}

.home-card-link:hover .home-card-cover {
  transform: scale(1.035);
}

/* A dark-to-light wash over the cover, so the arrow button always has contrast. */
.home-card-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(2 6 23 / 0.1), transparent 55%, rgb(255 255 255 / 0.05));
}

.home-card-placeholder {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, var(--ph-from), var(--ph-via), var(--ph-to));
}

.home-card-placeholder[data-variant="0"] {
  --ph-from: color-mix(in srgb, var(--accent-500) 10%, transparent);
  --ph-via: color-mix(in srgb, var(--accent-500) 5%, transparent);
  --ph-to: #ffffff;
  --ph-halo: color-mix(in srgb, var(--accent-500) 20%, transparent);
  --ph-badge-a: var(--accent-500);
  --ph-badge-b: var(--accent-600);
}

.home-card-placeholder[data-variant="1"] {
  --ph-from: #fff2e4;
  --ph-via: #fff8f0;
  --ph-to: #ffffff;
  --ph-halo: rgb(255 173 103 / 0.2);
  --ph-badge-a: #ff9b49;
  --ph-badge-b: #f07835;
}

.home-card-placeholder[data-variant="2"] {
  --ph-from: #ebf8f1;
  --ph-via: #f7fcf9;
  --ph-to: #ffffff;
  --ph-halo: rgb(110 214 154 / 0.2);
  --ph-badge-a: #48c982;
  --ph-badge-b: #2bae68;
}

.home-card-halo {
  position: absolute;
  left: 16%;
  top: 12%;
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  background: var(--ph-halo);
  filter: blur(28px);
}

.home-card-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.6);
  background: rgb(255 255 255 / 0.3);
}

.home-card-ring--a {
  right: -2rem;
  top: -2.5rem;
  width: 8rem;
  height: 8rem;
}

.home-card-ring--b {
  left: -2rem;
  bottom: -3.5rem;
  width: 9rem;
  height: 9rem;
  border-color: rgb(255 255 255 / 0.75);
  background: rgb(255 255 255 / 0.48);
}

.dark .home-card-ring {
  border-color: rgb(255 255 255 / 0.1);
  background: rgb(255 255 255 / 0.05);
}

.home-card-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 1.05rem;
  background-image: linear-gradient(135deg, var(--ph-badge-a), var(--ph-badge-b));
  color: #fff;
  transform: translate(-50%, -50%) rotate(-6deg);
  box-shadow: 0 20px 25px -12px var(--ph-halo);
  transition: transform 300ms var(--ease-out);
}

.home-card-badge svg {
  width: 2rem;
  height: 2rem;
}

.home-card-link:hover .home-card-badge {
  transform: translate(-50%, -50%) rotate(0deg) scale(1.05);
}

.home-card-arrow {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.75);
  background: rgb(255 255 255 / 0.78);
  color: var(--accent-600);
  backdrop-filter: blur(8px);
  transition: transform 300ms var(--ease-out), background 300ms ease;
}

.home-card-arrow svg {
  width: 1rem;
  height: 1rem;
}

.home-card-link:hover .home-card-arrow {
  transform: rotate(6deg);
  background: #fff;
}

.dark .home-card-arrow {
  border-color: rgb(255 255 255 / 0.15);
  background: rgb(15 23 42 / 0.55);
}

.home-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1rem 1.1rem;
}

.home-card-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
  margin-bottom: 0.75rem;
}

.home-card-chip {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.home-card-chip--accent {
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 500;
}

/* 16px on small screens, 18px from the reference's `sm:text-lg`. */
.home-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.375;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  transition: color 200ms ease;
}

.home-card-link:hover .home-card-title {
  color: var(--accent-600);
}

.home-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (min-width: 640px) {
  .home-card-title {
    font-size: 1.125rem;
  }
}

/* 列表卡片上的封面（参照的 PostListCard 分支）：208px 高，hover 轻微放大。 */
.post-row-cover {
  overflow: hidden;
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-muted);
}

.post-row-cover img {
  display: block;
  width: 100%;
  height: 13rem;
  object-fit: cover;
  transition: transform 300ms var(--ease-out);
}

.post-row:hover .post-row-cover img {
  transform: scale(1.02);
}

/* ------------------------------------------------------------- list rows */

/* The reference's list page (measured on its rendered /blog): one column of
 * wide cards on the same surface as the page, a hairline border, a meta row
 * with calendar/clock icons, a 20px title and an excerpt clamped to two lines.
 * The card grid below is kept for the home page, where a cover earns its
 * space. */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.post-row {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.post-row:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent-500) 20%, var(--surface-border));
  box-shadow: var(--card-shadow-hover);
}

.post-row-link {
  display: block;
  padding: 1rem 1.05rem 1.1rem;
  color: inherit;
}

.post-row-link:hover {
  text-decoration: none;
}

.post-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.meta-item svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* The reference prints the category in the accent colour, so it reads as a
 * link even before you hover it. */
.post-row-meta .meta-item:last-child:not(:only-child) {
  color: var(--accent-600);
  font-weight: 500;
}

.post-row-title {
  margin: 0.5rem 0 0;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-strong);
  transition: color 160ms ease;
}

.post-row:hover .post-row-title {
  color: var(--accent-600);
}

.post-row .tag-row {
  margin-top: 0.65rem;
}

.post-row-excerpt {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.post-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}



.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: color-mix(in srgb, var(--accent-500) 20%, var(--surface-border));
}



.post-card-link:hover {
  text-decoration: none;
}







.post-card-meta .dot::before {
  content: "·";
}

.post-card-category {
  color: var(--accent-500);
  font-weight: 500;
  font-size: 0.75rem;}



.post-card:hover .post-card-title {
  color: var(--accent-500);
}



.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  background: var(--surface-chip);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tag-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* Tags without a colour keep the muted dot; a coloured tag paints it in the
   * tag's own colour below. */
  background: var(--text-muted);
  opacity: 0.35;
}

/* A tag with a colour: the reference's recipe
 * (blog-01 src/features/taxonomy/lib/tag-color.ts) — 10% of the colour as the
 * chip background, 24% as the border, and the dot in the solid colour. The text
 * keeps the default foreground, so contrast never depends on the picked colour.
 * The templates pass the colour as a custom property and the maths stays here,
 * which is also what makes it work in both themes without a second palette. */
.tag-badge[data-color] {
  background: color-mix(in srgb, var(--tag-color) 10%, transparent);
  border-color: color-mix(in srgb, var(--tag-color) 24%, transparent);
}

.tag-badge[data-color]::before {
  background: var(--tag-color);
  opacity: 1;
}

/* 分类带颜色时走同一套配方。分类出现在哪几个地方就补到哪几个地方：首页卡片的
 * 胶囊、文章页标题上方的分类链接、列表行的分类、以及侧栏分类行（那里分类靠图标
 * 区分，所以只把图标染成分类色，不改成胶囊）。 */
.home-card-chip[data-color] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: color-mix(in srgb, var(--tag-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 24%, transparent);
  color: var(--text-body);
}

.home-card-chip[data-color]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tag-color);
}

.post-card-category[data-color] {
  color: var(--tag-color);
}

.meta-item[data-color] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-item[data-color]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--tag-color);
}

.sidebar-cat[data-color] svg {
  color: var(--tag-color);
}

.tag-badge:hover {
  color: var(--text-strong);
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent-500) 30%, var(--surface-border));
}

/* --------------------------------------------------------- list + sidebar */

.split {
  display: grid;
  gap: 2rem;
  padding-block: 1rem 3rem;
}

@media (min-width: 1024px) {
  .split {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}



/* The reference's sidebar headings carry a count and say so when the list is
 * empty, so a reader can tell "none yet" from "failed to load". */
/* Measured from the reference: the count is an accent pill (accent on
 * accent-soft), not a neutral chip. */
/* The reference's heading: a small semibold label next to a 20px round accent
 * badge holding the count. */
.sidebar-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-strong);
}

.sidebar-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding-inline: 0.3rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-600);
}

/* One bordered row per category: icon, name, count on the right. */
.sidebar-cats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-cat {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-body);
  transition: background 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.sidebar-cat:hover {
  background: var(--surface-muted);
  transform: translateX(-4px);
  text-decoration: none;
}

.sidebar-cat svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
}

.sidebar-cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-strong);
}

.sidebar-cat-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-cat[aria-current="page"] {
  border-color: color-mix(in srgb, var(--accent-500) 35%, var(--surface-border));
  background: var(--accent-soft);
}

/* Tags wrap into a cloud instead of stacking into a wall of rows. */
.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sidebar-tags .tag-badge {
  transition: transform 200ms ease;
}

.sidebar-tags .tag-badge:hover {
  transform: scale(1.05);
}

.sidebar-tags .tag-badge[aria-current="page"] {
  border-color: color-mix(in srgb, var(--accent-500) 35%, var(--surface-border));
  background: var(--accent-soft);
  color: var(--accent-600);
}

/* The reference prints the empty state as body text, so "none yet" is as
 * readable as an entry would be. */
/* The current category or tag is marked, so the sidebar doubles as a
 * breadcrumb of where the reader is. */
.sidebar-list a[aria-current="page"] {
  color: var(--accent-600);
  font-weight: 600;
}

.sidebar-empty {
  margin: 0.5rem 0 0;
  /* The reference prints this as text-xs in the muted colour. */
  font-size: 0.75rem;
  color: var(--text-muted);
}





.sidebar-list a:hover {
  background: var(--accent-soft);
  color: var(--text-strong);
  text-decoration: none;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding-inline: 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-600);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ------------------------------------------------------------ pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
}

.pagination-summary {
  width: 100%;
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pagination a,
.pagination span {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding-inline: 0.6rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text-body);
}

.pagination a:hover {
  border-color: color-mix(in srgb, var(--accent-500) 40%, var(--surface-border));
  color: var(--text-strong);
  text-decoration: none;
}

.pagination [aria-current="page"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent-500) 35%, var(--surface-border));
  color: var(--accent-600);
  font-weight: 650;
}

.pagination .disabled {
  opacity: 0.45;
}

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

.post-layout {
  display: grid;
  gap: 2rem;
  padding-block: 1.5rem 3rem;
}

@media (min-width: 1024px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) 200px;
  }
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-cover {
  width: 100%;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--surface-border);
  background: var(--surface-muted);
  margin-bottom: 1.25rem;
}

.article-title {
  margin: 0.35rem 0 0;
  /* The reference's article title: text-3xl, text-4xl from 640px. */
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

@media (min-width: 640px) {
  .article-title {
    font-size: 2.25rem;
  }
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

.article-meta svg {
  width: 0.9rem;
  height: 0.9rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.back-link svg {
  width: 0.95rem;
  height: 0.95rem;
}

/* ------------------------------------------------------------ TOC aside */

.toc {
  font-size: 0.875rem;
}

@media (min-width: 1024px) {
  .toc {
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
    align-self: start;
    max-height: calc(100dvh - var(--nav-height) - 3rem);
    overflow-y: auto;
  }
}

.toc-title {
  margin: 0 0 0.6rem;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--text-strong);
}

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  /* V0.2 §18: the TOC collapses on narrow screens. */
  border-left: 2px solid var(--surface-border);
}

.toc-list a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.75rem;
  border-left: 2px solid transparent;
  margin-left: -2px;
  color: var(--text-muted);
  line-height: 1.5;
}

.toc-list a:hover {
  border-left-color: color-mix(in srgb, var(--text-muted) 50%, transparent);
  color: var(--text-body);
  text-decoration: none;
}

.toc-list a[aria-current="true"] {
  border-left-color: var(--text-strong);
  color: var(--text-strong);
  font-weight: 600;
}

.toc-level-3 a {
  padding-left: 1.5rem;
}

.toc-level-4 a {
  padding-left: 2.25rem;
}

/* The mobile disclosures are opt-in.
 *
 * V0.2 §18 requires the public site to work with JavaScript disabled. A rule
 * that hides content until a script reveals it fails that requirement the
 * moment the script does not run, so the collapsed state is keyed on a marker
 * the script itself sets: without the script every list is visible, and the
 * toggle button — which would do nothing — stays hidden.
 */
.toc-toggle {
  display: none;
}

.has-js .toc[data-collapsible="true"] .toc-list {
  display: none;
}

.has-js .toc[data-collapsible="true"][data-open="true"] .toc-list {
  display: block;
}

.has-js .toc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text-body);
  cursor: pointer;
}

@media (min-width: 1024px) {
  .has-js .toc[data-collapsible="true"] .toc-list {
    display: block;
  }

  .has-js .toc-toggle {
    display: none;
  }
}

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

.prose {
  color: var(--text-body);
  /* The reference's content scale: paragraph 1rem / 1.6, headings in em so they
   * follow the body size (h1 1.5em, h2 1.25em, h3 1.125em, h4 1em). */
  font-size: 1rem;
  line-height: 1.6;
  /* V0.2 §18: "内容区域保持阅读友好的宽度" and no horizontal overflow. */
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 清零浏览器默认的块间距：所有顶层块（含标题、引用、代码、分割线、图片）一律从
 * 零开始，间距由下面唯一的节奏规则给出。
 *
 * `:where()` 不增加优先级，这是关键：节奏规则的优先级要和它持平，靠"谁在后面"
 * 决定胜负。之前这里写的是 `.prose p { margin: 0 }`（优先级更高），把节奏规则整个盖掉了，
 * 于是段落之间、列表前面都没有间距——编辑器里有、读者那边没有，同一篇文章两种样子。 */
.prose :where(p, h1, h2, h3, h4, h5, h6, ul, ol, blockquote, pre, hr, figure, li > p) {
  margin: 0;
}

/* 节奏：相邻块之间统一 1rem（= 正文 1em = 16px），所有元素一个值。
 * 用 rem 不用 em：em 会随元素自身字号放大（h1 的 1em = 24px），间距又会各不相同。
 * 编辑器各节点样式（web/admin/src/tiptap/nodes/）与此同值。 */
.prose > * + * {
  margin-top: 1rem;
}

.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}

.prose h2 {
  font-size: 1.25em;
  font-weight: 700;
}

.prose h3 {
  font-size: 1.125em;
  font-weight: 600;
}

.prose h4 {
  font-size: 1em;
  font-weight: 600;
}

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

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

.prose blockquote {
  padding: 0.35em 0.75em 0.35em 1.1em;
  border-left: 3px solid color-mix(in srgb, var(--accent-500) 45%, transparent);
  /* 直角，不留圆角：引用块是引文，不是 card（编辑器里保持同一形状） */
  background: color-mix(in srgb, var(--accent-500) 6%, transparent);
  color: var(--text-muted);
}

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

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose code {
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  background: var(--surface-chip);
  border: 1px solid var(--surface-border);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.prose pre {
  /* V0.2 §18: "代码 / 表格各自滚动" — each scrolls on its own rather than
   * forcing the whole page sideways. */
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
  background: var(--surface-muted);
  font-size: 0.875rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.dark .prose pre {
  background: rgb(0 0 0 / 0.35);
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose hr {
  border: 0;
  height: 1px;
  background: var(--surface-border);
}

.prose img {
  border-radius: var(--radius-md);
}

.prose figure.media-image figcaption {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
}

.prose th,
.prose td {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--surface-border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-chip);
  color: var(--text-strong);
  font-weight: 650;
}

/* Post-MVP body elements: H1/H5/H6, underline, highlight, super/subscript
 * and task lists. Highlights get their background from the palette above
 * (inline style emitted by the Go renderer); dark mode just works. */
.prose h1 {
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}

.prose h5,
.prose h6 {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-strong);
}

.prose u {
  text-underline-offset: 2px;
}

.prose sup,
.prose sub {
  line-height: 0;
}

.prose mark {
  padding: 0.1em 0.2em;
  border-radius: 3px;
  color: inherit;
}

.prose ul[data-type="taskList"] {
  list-style: none;
  padding: 0;
}

.prose ul[data-type="taskList"] li {
  display: flex;
  gap: 0.6em;
  align-items: flex-start;
}

.prose ul[data-type="taskList"] li + li {
  margin-top: 0.5em;
}

.prose ul[data-type="taskList"] li > label {
  flex: 0 0 auto;
  margin-top: 0.28em;
  user-select: none;
}

.prose ul[data-type="taskList"] li > div {
  flex: 1 1 auto;
  min-width: 0;
}

.prose ul[data-type="taskList"] input[type="checkbox"] {
  /* 表单控件默认字号 13.33px；钉住 1rem 让两边（编辑器与公开页面）的方框一样大。
   * margin / line-height 同理：默认值会让两边的方框与文字错开几像素。 */
  font-size: 1rem;
  line-height: normal;
  margin: 0;
  width: 1em;
  height: 1em;
  accent-color: var(--accent-500);
}

.prose ul[data-type="taskList"] li[data-checked="true"] > div {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 55%, transparent);
}

/* ------------------------------------------------------------- prev/next */

.post-nav {
  display: grid;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--surface-border);
}

@media (min-width: 640px) {
  .post-nav {
    grid-template-columns: 1fr 1fr;
  }
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-body);
}

.post-nav a:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent-500) 30%, var(--surface-border));
}

.post-nav .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-nav .title {
  font-size: 1rem;
  font-weight: 550;
  color: var(--text-strong);
}

.post-nav .next {
  text-align: right;
}

/* ---------------------------------------------------------------- states */

.empty-state {
  padding: 3.5rem 1rem;
  text-align: center;
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text-muted);
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  color: var(--text-strong);
}

.notfound-code {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--accent-500);
}

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

.site-footer {
  margin-top: auto;
  padding-block: 2rem;
  border-top: 1px solid var(--surface-border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-inner a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
}

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

.footer-inner svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* --------------------------------------------------------------- search */

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.875rem;
}

.search-input:focus {
  outline: 2px solid var(--accent-500);
  outline-offset: 1px;
}

.search-result {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--surface-border);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result h2 {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  line-height: 1.4;
}

.search-result h2 a {
  color: var(--text-strong);
}

.search-result p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.search-result mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent-500) 22%, transparent);
  color: inherit;
}

.result-kind {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--surface-chip);
  border: 1px solid var(--surface-border);
  font-size: 0.75rem;
  color: var(--text-muted);
  vertical-align: middle;
}

/* --------------------------------------------------------------- narrow */

@media (max-width: 640px) {
  .nav-shell {
    width: calc(100% - 0.75rem);
    padding-inline: 10px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .brand-mark-fallback {
    border-radius: 10px;
  }

  .brand-title {
    font-size: 0.75rem;
  }

  /* Without the enhancement the navigation is a wrapping list under the bar, so
   * a phone with JavaScript disabled can still navigate; the script opts into
   * the disclosure by marking the root element. */
  .nav-shell {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 0.35rem;
  }

  .has-js .site-nav {
    display: none;
  }

  .nav-toggle {
    display: none;
  }

  .has-js .nav-toggle {
    display: inline-grid;
  }

  /* The mobile menu is a plain disclosure below the bar rather than an overlay,
   * so it works without JS-driven focus management. */
  .has-js .site-nav[data-open="true"] {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    top: calc(var(--nav-height) - 0.25rem);
    padding: 0.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--card-shadow-hover);
  }

  .has-js .site-nav[data-open="true"] a {
    border-radius: var(--radius-md);
  }

    .prose {
    font-size: 1rem;
    line-height: 1.8;
  }
}

/* V0.2 §18: honour a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toc,
  .post-nav {
    display: none;
  }

  .site::before {
    display: none;
  }
}


/* DIY WebPages keep the blog's top navigation but otherwise hand the whole
   viewport to the administrator HTML. There is no reading-width container, card
   chrome, page title or footer in this mode: the sandboxed iframe should feel
   like the page itself, not content embedded inside one.

   The nav floats *over* that frame instead of sitting above it in a reserved
   band. Filling the viewport from the very top is what lets the page's own
   content scroll behind the glass pill, the same way a blog page's content
   scrolls behind the transparent header. Reserving a band would keep the frame's
   content out of the nav area entirely: the pill would float over nothing and
   read as a bar across the top of the page.

   Pages that want their first band clear of the nav pad themselves with
   --dblog-nav-height; the token exists for this. */
body.web-page-shell .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
.web-page-main {
  flex: 1;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
}
.web-page-frame {
  display: block;
  flex: 1;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  border: 0;
  background: transparent;
}
