/*
 * Hoshiki base — the shared layer of the built-in themes.
 *
 * Paper, ink and a vermilion seal, with the same vocabulary as the author's
 * homepage. Themes only choose a palette (the --b*, --d* and --a-* triplets)
 * and switch optional ornaments on or off; every component lives here.
 * Shared resources are referenced from /assets so copied themes keep working.
 */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-italic-latin.woff2") format("woff2");
}

/* Noto Serif TC subset holding only the seal characters 星 and 記. */
@font-face {
  font-family: "Hoshi Seal";
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url("/assets/fonts/noto-serif-tc-seal.woff2") format("woff2");
  unicode-range: U+661F, U+8A18;
}

/* ----- Tokens ----------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Palette triplets: light glows, dark glows and the two accents. */
  --b1: 216 203 246;
  --b2: 244 205 229;
  --d1: 118 86 214;
  --d2: 176 72 162;
  --a-l: 106 78 180;
  --a-d: 193 174 246;

  --paper: #f7f5f1;
  --surface: rgb(255 255 255 / 0.56);
  --surface-hover: rgb(255 255 255 / 0.86);
  --surface-solid: #fdfcf9;
  --field: rgb(255 255 255 / 0.72);
  --code-bg: rgb(28 30 35 / 0.045);
  --ink: #1c1e23;
  --ink-2: #565a63;
  --ink-3: #6a6e77;
  --line: rgb(28 30 35 / 0.09);
  --line-strong: rgb(28 30 35 / 0.15);
  --rim: rgb(255 255 255 / 0.65);
  --seal: #b03f34;
  --seal-ink: #fbf6f1;
  --warn-rgb: 166 112 28;
  --shadow: 0 1px 2px rgb(28 30 35 / 0.04), 0 14px 30px -20px rgb(28 30 35 / 0.22);
  --shadow-lift: 0 2px 4px rgb(28 30 35 / 0.04), 0 22px 40px -22px rgb(28 30 35 / 0.3);
  --shadow-float: 0 2px 6px rgb(28 30 35 / 0.05), 0 28px 64px -24px rgb(28 30 35 / 0.32);
  --bloom-alpha: 0.6;
  --grain-alpha: 0.04;
  --star-alpha: 0;

  --g1: var(--b1);
  --g2: var(--b2);
  --accent-rgb: var(--a-l);
  --accent: rgb(var(--accent-rgb));
  /* Transparent brand marks adapt contrast across paper and night surfaces. */
  --hoshivel-orbit-a: #3b889e;
  --hoshivel-orbit-b: #ba873c;
  --hoshivel-star: #1e2a4a;
  --hoshivel-core: #5b74c9;
  --sr-stop-1: #7b96f0;
  --sr-stop-2: #5d7ae8;
  --sr-stop-3: #8c6be6;
  --sr-outer-opacity: 0.85;
  --friend-mark-shadow: drop-shadow(0 4px 10px rgb(var(--accent-rgb) / 0.18));
  /* Shared reading, account and admin components retain these public tokens. */
  --muted: var(--ink-3);
  --tint: rgb(var(--accent-rgb) / 0.08);

  --gutter: clamp(20px, 5vw, 48px);
  --wide: 1080px;
  --mid: 880px;
  --text: 680px;
  /* Vertical rhythm: the first block under the header, and gaps between sections. */
  --space-page-top: clamp(28px, 6vh, 60px);
  --space-section: clamp(56px, 9vh, 88px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
  --serif-latin: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --serif-han: "Hoshi Seal", "Noto Serif TC", "Noto Serif CJK TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Noto Sans Mono CJK TC", monospace;
}

html[data-color-scheme="dark"] {
  color-scheme: dark;
  --paper: #0e1016;
  --surface: rgb(255 255 255 / 0.035);
  --surface-hover: rgb(255 255 255 / 0.065);
  --surface-solid: #171a22;
  --field: rgb(255 255 255 / 0.04);
  --code-bg: rgb(255 255 255 / 0.05);
  --ink: #eceef3;
  --ink-2: #a9aebb;
  --ink-3: #868c9c;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.14);
  --rim: rgb(255 255 255 / 0.085);
  --seal: #b8473b;
  --seal-ink: #fbf1ea;
  --warn-rgb: 226 178 96;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 36px -22px rgb(0 0 0 / 0.7);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.3), 0 24px 44px -22px rgb(0 0 0 / 0.8);
  --shadow-float: 0 2px 6px rgb(0 0 0 / 0.35), 0 30px 70px -24px rgb(0 0 0 / 0.85);
  --bloom-alpha: 0.2;
  --grain-alpha: 0.05;
  --g1: var(--d1);
  --g2: var(--d2);
  --accent-rgb: var(--a-d);
  --hoshivel-orbit-a: #59a0b4;
  --hoshivel-orbit-b: #c99a54;
  --hoshivel-star: #e8f6fd;
  --hoshivel-core: #ffffff;
  --sr-stop-1: #cdd7ff;
  --sr-stop-2: #8fa9ff;
  --sr-stop-3: #b89bff;
  --sr-outer-opacity: 0.78;
  --friend-mark-shadow: drop-shadow(0 4px 12px rgb(0 0 0 / 0.48));
}

/* Readers without JavaScript follow the system appearance. */
@media (prefers-color-scheme: dark) {
  html:not([data-color-scheme]) {
    color-scheme: dark;
    --paper: #0e1016;
    --surface: rgb(255 255 255 / 0.035);
    --surface-hover: rgb(255 255 255 / 0.065);
    --surface-solid: #171a22;
    --field: rgb(255 255 255 / 0.04);
    --code-bg: rgb(255 255 255 / 0.05);
    --ink: #eceef3;
    --ink-2: #a9aebb;
    --ink-3: #868c9c;
    --line: rgb(255 255 255 / 0.08);
    --line-strong: rgb(255 255 255 / 0.14);
    --rim: rgb(255 255 255 / 0.085);
    --seal: #b8473b;
    --seal-ink: #fbf1ea;
    --warn-rgb: 226 178 96;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 36px -22px rgb(0 0 0 / 0.7);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.3), 0 24px 44px -22px rgb(0 0 0 / 0.8);
    --shadow-float: 0 2px 6px rgb(0 0 0 / 0.35), 0 30px 70px -24px rgb(0 0 0 / 0.85);
    --bloom-alpha: 0.2;
    --grain-alpha: 0.05;
    --g1: var(--d1);
    --g2: var(--d2);
    --accent-rgb: var(--a-d);
    --hoshivel-orbit-a: #59a0b4;
    --hoshivel-orbit-b: #c99a54;
    --hoshivel-star: #e8f6fd;
    --hoshivel-core: #ffffff;
    --sr-stop-1: #cdd7ff;
    --sr-stop-2: #8fa9ff;
    --sr-stop-3: #b89bff;
    --sr-outer-opacity: 0.78;
    --friend-mark-shadow: drop-shadow(0 4px 12px rgb(0 0 0 / 0.48));
  }
}

/* Six shared palette blooms synchronized with the homepage. */
html[data-bloom="astral"] {
  --paper: #f6f4ee;
  --surface-solid: #fcfbf8;
  --b1: 194 206 248;
  --b2: 244 222 186;
  --d1: 72 96 212;
  --d2: 186 132 64;
  --a-l: 76 92 178;
  --a-d: 176 196 255;
  --gold-rgb: 168 122 52;
}

html[data-bloom="lilac"] {
  --paper: #f7f5f1;
  --surface-solid: #fdfcf9;
  --b1: 216 203 246;
  --b2: 244 205 229;
  --d1: 118 86 214;
  --d2: 176 72 162;
  --a-l: 106 78 180;
  --a-d: 193 174 246;
  --gold-rgb: 158 84 148;
}

html[data-bloom="rose"] {
  --paper: #f7f5f1;
  --surface-solid: #fdfcf9;
  --b1: 246 190 207;
  --b2: 250 218 200;
  --d1: 196 72 126;
  --d2: 150 70 160;
  --a-l: 173 67 105;
  --a-d: 242 166 192;
  --gold-rgb: 184 114 96;
}

html[data-bloom="sky"] {
  --paper: #f5f7fa;
  --surface-solid: #fbfcfd;
  --b1: 186 212 245;
  --b2: 205 232 246;
  --d1: 58 112 205;
  --d2: 38 132 170;
  --a-l: 45 106 174;
  --a-d: 156 195 244;
  --gold-rgb: 56 132 162;
}

html[data-bloom="peach"] {
  --paper: #f8f5f0;
  --surface-solid: #fefcf8;
  --b1: 251 208 180;
  --b2: 248 228 178;
  --d1: 204 108 58;
  --d2: 186 140 52;
  --a-l: 165 83 42;
  --a-d: 242 184 143;
  --gold-rgb: 168 124 44;
}

html[data-bloom="mint"] {
  --paper: #f4f7f5;
  --surface-solid: #fafcfb;
  --b1: 192 232 214;
  --b2: 212 237 244;
  --d1: 36 150 116;
  --d2: 40 118 168;
  --a-l: 31 122 100;
  --a-d: 139 214 189;
  --gold-rgb: 46 118 148;
}

html[data-color-scheme="dark"][data-bloom="astral"] {
  --paper: #080b12;
  --surface-solid: #111622;
  --gold-rgb: 232 192 124;
}

html[data-color-scheme="dark"][data-bloom="lilac"],
html[data-color-scheme="dark"][data-bloom="rose"],
html[data-color-scheme="dark"][data-bloom="sky"],
html[data-color-scheme="dark"][data-bloom="peach"],
html[data-color-scheme="dark"][data-bloom="mint"] {
  --paper: #0e1016;
  --surface-solid: #171a22;
}

html[data-color-scheme="dark"][data-bloom="lilac"] { --gold-rgb: 226 164 216; }
html[data-color-scheme="dark"][data-bloom="rose"] { --gold-rgb: 240 184 164; }
html[data-color-scheme="dark"][data-bloom="sky"] { --gold-rgb: 142 212 232; }
html[data-color-scheme="dark"][data-bloom="peach"] { --gold-rgb: 235 196 120; }
html[data-color-scheme="dark"][data-bloom="mint"] { --gold-rgb: 146 206 232; }

@media (prefers-color-scheme: dark) {
  html:not([data-color-scheme])[data-bloom="astral"] {
    --paper: #080b12;
    --surface-solid: #111622;
    --gold-rgb: 232 192 124;
  }

  html:not([data-color-scheme])[data-bloom="lilac"],
  html:not([data-color-scheme])[data-bloom="rose"],
  html:not([data-color-scheme])[data-bloom="sky"],
  html:not([data-color-scheme])[data-bloom="peach"],
  html:not([data-color-scheme])[data-bloom="mint"] {
    --paper: #0e1016;
    --surface-solid: #171a22;
  }

  html:not([data-color-scheme])[data-bloom="lilac"] { --gold-rgb: 226 164 216; }
  html:not([data-color-scheme])[data-bloom="rose"] { --gold-rgb: 240 184 164; }
  html:not([data-color-scheme])[data-bloom="sky"] { --gold-rgb: 142 212 232; }
  html:not([data-color-scheme])[data-bloom="peach"] { --gold-rgb: 235 196 120; }
  html:not([data-color-scheme])[data-bloom="mint"] { --gold-rgb: 146 206 232; }
}

/* ----- Base ------------------------------------------------------------- */

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

/* Only the root paints the paper, so the backdrop can sit between it and the page. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
  /* Anchors, outline links and focused fields land below the sticky header. */
  scroll-padding-top: calc(var(--site-header-height, 0px) + 16px);
}

/*
 * The sticky header's height. site.js measures the bar and keeps this value
 * current; these figures cover the first paint and readers without scripts.
 */
:root:has(> body > .site-header) {
  --site-header-height: 69px;
}

@media (max-width: 860px) {
  :root:has(> body > .site-header) {
    --site-header-height: 59px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  :root:has(> body > .site-header) {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
}

/* Zero specificity: link styling always comes from the component. */
:where(a) {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgb(var(--accent-rgb) / 0.22);
}

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

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

summary {
  cursor: pointer;
}

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

.skip-link {
  position: absolute;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* Inline icons are drawn with strokes in the current text colour. */
.site-tools svg,
.chip svg,
.search svg,
.read-more svg,
.icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----- Backdrop: two soft blooms, paper grain and (at night) stars ------ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bloom {
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
}

.bloom-a {
  top: -34vmax;
  left: -26vmax;
  background: radial-gradient(closest-side, rgb(var(--g1) / var(--bloom-alpha)), rgb(var(--g1) / 0));
}

.bloom-b {
  right: -30vmax;
  bottom: -40vmax;
  background: radial-gradient(closest-side, rgb(var(--g2) / var(--bloom-alpha)), rgb(var(--g2) / 0));
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 100vh;
  opacity: var(--star-alpha);
  background: url("/assets/stars.svg") top center / max(1600px, 100%) auto no-repeat;
  -webkit-mask-image: linear-gradient(#000 0 25%, transparent 80%);
  mask-image: linear-gradient(#000 0 25%, transparent 80%);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--grain-alpha);
  background: url("/assets/grain.svg");
}

html[data-color-scheme="dark"] .backdrop::after {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  html:not([data-color-scheme]) .backdrop::after {
    filter: invert(1);
  }
}

/* ----- Seal and wordmark ------------------------------------------------ */

/* A vermilion seal read top to bottom, as on the homepage. */
.seal {
  display: inline-grid;
  place-items: center;
  flex: none;
  padding: 0.34em 0.3em;
  border-radius: 0.36em 0.3em 0.36em 0.26em;
  background: var(--seal);
  color: var(--seal-ink);
  line-height: 1;
  transform: rotate(-4deg);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.22) inset,
    0 6px 14px -8px rgb(120 30 24 / 0.55);
}

.seal > span {
  writing-mode: vertical-rl;
  font-family: var(--serif-han);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: 0.02em;
}

.seal-sm {
  font-size: 11.5px;
}

.seal-md {
  font-size: 16px;
}

.seal-lg {
  font-size: 21px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.wordmark-name {
  font: italic 500 31px/1 var(--serif-latin);
  letter-spacing: -0.01em;
  padding-right: 0.05em;
}

/* ----- Header ----------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  width: min(100% - 2 * var(--gutter), var(--wide));
  margin-inline: auto;
  padding-block: 28px 20px;
}

/*
 * The built-in layout keeps the header at the top while reading. The bar spans
 * the viewport so its frosted surface reaches both edges; the inline padding
 * keeps its content on the main column. site.js adds .is-scrolled once the
 * page moves under the bar. Until then (and always without scripts, which
 * leave html[data-color-scheme] unset) the surface below decides the look.
 */
body > .site-header {
  position: sticky;
  top: 0;
  width: 100%;
  margin: 0;
  padding: 14px max(var(--gutter), (100% - var(--wide)) / 2);
  border-bottom: 1px solid var(--line);
  background-color: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  transition:
    background-color 0.25s,
    border-color 0.25s,
    box-shadow 0.25s;
}

html[data-color-scheme] body > .site-header:not(.is-scrolled) {
  border-bottom-color: transparent;
  background-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body > .site-header.is-scrolled {
  box-shadow: 0 14px 32px -28px rgb(0 0 0 / 0.45);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-left: auto;
}

.site-nav > a,
.nav-group-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-block: 6px;
  color: var(--ink-2);
  font-size: 15px;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.site-nav > a:hover,
.site-nav > a[aria-current],
.nav-group-trigger:hover,
.nav-group-trigger.is-current,
.nav-group[open] > .nav-group-trigger {
  color: var(--ink);
}

.site-nav > a[aria-current]::after,
.nav-group-trigger.is-current::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--seal);
}

.nav-group {
  position: relative;
}

.nav-group-trigger {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.nav-group-trigger::-webkit-details-marker {
  display: none;
}

.nav-group-trigger::before {
  content: "";
  order: 2;
  width: 6px;
  height: 6px;
  margin-top: -2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.6;
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
}

.nav-group[open] > .nav-group-trigger::before {
  transform: translateY(2px) rotate(-135deg);
}

.nav-group-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 11.5rem;
  max-width: min(18rem, calc(100vw - 2 * var(--gutter)));
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-float);
}

.nav-group:not([open]) > .nav-group-menu {
  display: none;
}

.nav-group-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 14px;
  transition: background-color 0.18s, color 0.18s;
}

.nav-group-menu a:hover,
.nav-group-menu a:focus-visible,
.nav-group-menu a[aria-current] {
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--ink);
}

.nav-group-menu a[aria-current] {
  color: var(--accent);
  font-weight: 500;
}

.nav-external-indicator {
  font-size: 0.8em;
  opacity: 0.65;
}

.page-top-anchor {
  position: relative;
  width: 0;
  height: 0;
  outline: none;
}

.site-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-nav ~ .site-tools {
  margin-left: 0;
}

.icon-button,
.site-header .appearance-selector .appearance-trigger {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink-2);
  transition:
    color 0.2s,
    border-color 0.2s,
    background-color 0.2s,
    transform 0.25s var(--ease-spring);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button:hover,
.icon-button[aria-current],
.site-header .appearance-selector .appearance-trigger:hover,
.site-header .appearance-selector .appearance-trigger[aria-expanded="true"] {
  border-color: rgb(var(--accent-rgb) / 0.45);
  background: var(--surface-hover);
  color: var(--accent);
}

.site-header .appearance-selector .appearance-label,
.site-header .appearance-selector .appearance-chevron {
  display: none;
}

/* ----- Layout ----------------------------------------------------------- */

.site-main {
  flex: 1;
  width: min(100% - 2 * var(--gutter), var(--wide));
  margin-inline: auto;
  padding-bottom: clamp(56px, 10vh, 96px);
}

/* Listings that open a page sit as far below the header as page titles do. */
.site-main > :is(.journal, .notices):first-child {
  margin-top: var(--space-page-top);
}

/* Section links keep a little room under the sticky header. */
:is(.journal, .comments, .friends, .archive-year) {
  scroll-margin-top: 16px;
}

.site-main > .login-notice {
  max-width: var(--text);
  margin: 16px auto 0;
}

/* ----- Shared pieces: labels, chips, buttons, fields -------------------- */

.label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.6;
}

.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.label-en {
  font: italic 500 17px/1 var(--serif-latin);
  letter-spacing: 0.01em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition:
    border-color 0.25s,
    background-color 0.25s,
    color 0.25s,
    transform 0.3s var(--ease-spring),
    box-shadow 0.3s var(--ease);
}

.chip svg {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
  transition: color 0.25s, transform 0.3s var(--ease-spring);
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--accent-rgb) / 0.45);
  background: var(--surface-hover);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
}

.chip:hover svg {
  color: var(--accent);
  transform: scale(1.06);
}

.chip[aria-current="true"],
.chip[aria-current="page"] {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.chip[aria-current="true"]:hover,
.chip[aria-current="page"]:hover {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
}

/* Zero specificity keeps the reset below every component rule. */
:where(input, select, textarea, button) {
  font: inherit;
  color: inherit;
}

:where(button, .button) {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 500 14px/1.2 var(--sans);
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s,
    opacity 0.2s;
}

:where(button, .button):hover {
  background: color-mix(in srgb, var(--ink) 84%, rgb(var(--accent-rgb)));
}

:where(button.secondary, .button.secondary) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

:where(button.secondary, .button.secondary):hover {
  border-color: rgb(var(--accent-rgb) / 0.45);
  background: var(--surface-hover);
  color: var(--ink);
}

:where(button.secondary[aria-pressed="true"], button.secondary.is-active) {
  border-color: rgb(var(--accent-rgb) / 0.5);
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent);
}

:where(.text-button) {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.02em;
}

:where(.text-button):hover {
  background: none;
  color: var(--accent);
}

:where(button):disabled {
  cursor: default;
  opacity: 0.5;
}

:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="range"], [type="color"]), select, textarea) {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background-color 0.2s;
}

/* Full --ink-3 keeps hints readable (about 4.8:1 on fields) yet lighter than input. */
:where(input, select, textarea)::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

:where(input, select, textarea):focus {
  outline: none;
  border-color: rgb(var(--accent-rgb) / 0.65);
  box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / 0.14);
}

:where(textarea) {
  line-height: 1.8;
  resize: vertical;
}

/* The chevron's mid grey reads on both paper and night surfaces. */
:where(select) {
  appearance: none;
  padding-right: 40px;
  background-image: url("/assets/chevron.svg");
  background-position: right 15px center;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  cursor: pointer;
}

:where(select):disabled {
  cursor: default;
  opacity: 0.6;
}

input[type="checkbox"],
input[type="radio"] {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

input[type="file"] {
  max-width: 100%;
  font-size: 14px;
  color: var(--ink-2);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
}

label {
  display: block;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

label > :where(input:not([type="checkbox"], [type="radio"]), select, textarea) {
  margin-top: 8px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 15px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

.muted,
.empty {
  color: var(--ink-3);
  font-size: 14.5px;
  line-height: 1.85;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 18px;
}

.form-status,
#save-status,
#notification-status {
  min-height: 1.7em;
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* Empty live regions stay in place for announcements without adding a gap. */
.form-status:empty {
  min-height: 0;
  margin: 0;
}

/* Text actions beside full buttons share their height, so they are as easy to hit. */
.form-actions .text-button {
  min-height: 40px;
  padding-inline: 8px;
}

.error {
  color: var(--seal);
}

.login-notice {
  padding: 12px 18px;
  border: 1px solid rgb(var(--accent-rgb) / 0.22);
  border-radius: 14px;
  background: rgb(var(--accent-rgb) / 0.08);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.75;
}

/* ----- Home: masthead and the latest entry ------------------------------ */

.masthead {
  display: grid;
  row-gap: 44px;
  padding-block: clamp(28px, 6vh, 64px) clamp(48px, 8vh, 80px);
}

.masthead-kicker {
  margin: 0 0 20px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.masthead-title {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0;
  font-weight: 400;
}

.masthead-name {
  font: italic 500 clamp(66px, 7.4vw, 92px)/0.86 var(--serif-latin);
  letter-spacing: -0.015em;
  padding-right: 0.06em;
}

.masthead-description {
  max-width: 24em;
  margin: 28px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.9;
  text-wrap: pretty;
}

.masthead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

/*
 * On the first page the masthead carries the name, so the header steps back.
 * site.js brings the name into the sticky bar once the masthead scrolls away.
 */
.has-masthead:not(.has-custom-brand) .site-header .wordmark {
  transition:
    opacity 0.3s var(--ease),
    visibility 0.3s;
}

.has-masthead:not(.has-custom-brand) .site-header:not(.shows-brand) .wordmark {
  visibility: hidden;
  opacity: 0;
}

.lead {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  transition:
    transform 0.4s var(--ease-spring),
    border-color 0.25s,
    background-color 0.25s,
    box-shadow 0.4s var(--ease);
}

.lead-cover {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: rgb(var(--accent-rgb) / 0.08);
}

.lead-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.lead-body {
  padding: 24px 28px 26px;
}

.lead-title {
  margin: 12px 0 0;
  font-size: clamp(23px, 2.3vw, 28px);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.lead-title a::after,
.post-title a::after,
.friend-heading h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}

.lead-excerpt {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.85;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.read-more svg {
  width: 15px;
  height: 15px;
  transition: transform 0.35s var(--ease);
}

.lead-flag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-right: 10px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* ----- Entry metadata --------------------------------------------------- */

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.03em;
  line-height: 1.7;
}

.entry-meta time {
  font-variant-numeric: tabular-nums;
}

/* Date, author and category are separated by dots; tags follow as #words. */
.entry-meta > time ~ :not(.tag)::before {
  content: "·";
  display: inline-block;
  margin-inline: 0.6em;
  color: var(--ink-3);
}

/* The padding widens the hit area; the negative margins keep the row as it was. */
.entry-meta a {
  position: relative;
  z-index: 1;
  margin-block: -4px;
  padding-block: 4px;
  color: var(--accent);
}

.entry-meta a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.entry-meta > .tag {
  margin-left: 0.9em;
  color: var(--ink-3);
}

.entry-meta > .tag::before {
  content: "#";
  opacity: 0.7;
}

.entry-meta > .tag:first-child {
  margin-left: 0;
}

/* ----- Journal ---------------------------------------------------------- */

.notices {
  display: grid;
  gap: 10px;
  margin: 0 0 40px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 0.25s, background-color 0.25s;
}

.notice > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  list-style: none;
  font-size: 14.5px;
  font-weight: 500;
}

.notice > summary::-webkit-details-marker {
  display: none;
}

.notice > summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--seal);
  box-shadow: 0 0 0 4px rgb(176 63 52 / 0.14);
}

.notice > summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.25s var(--ease);
}

.notice[open] > summary::after {
  transform: translateY(1px) rotate(-135deg);
}

.notice > .prose {
  padding: 0 20px 16px 37px;
  color: var(--ink-2);
  font-size: 15px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.section-head .label {
  flex: 1;
  margin: 0;
}

.search {
  position: relative;
  flex: 0 1 236px;
}

.search input {
  height: 38px;
  min-height: 38px;
  padding: 0 42px 0 16px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
}

.search button:hover {
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--accent);
}

.search svg {
  width: 16px;
  height: 16px;
}

.journal-note {
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 14px;
}

.post-list {
  display: flex;
  flex-direction: column;
}

.post {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 24px;
  margin-inline: -16px;
  padding: 22px 16px;
  border-radius: 18px;
  transition: background-color 0.28s var(--ease);
}

.post::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 4px;
  width: 2.5px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.45);
  transition:
    opacity 0.25s var(--ease),
    transform 0.35s var(--ease-spring);
}

.post + .post::before {
  content: "";
  position: absolute;
  top: 0;
  right: 16px;
  left: 16px;
  height: 1px;
  background: var(--line);
  transition: opacity 0.25s;
}

.post-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding-top: 3px;
  color: var(--ink-3);
}

.post-day {
  color: var(--ink);
  font: italic 500 36px/0.8 var(--serif-latin);
  font-variant-numeric: lining-nums;
  letter-spacing: -0.01em;
  transition: color 0.25s var(--ease);
}

.post-month {
  font-size: 12px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.post-body {
  min-width: 0;
}

.post-title {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.post-excerpt {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.post .entry-meta {
  margin-top: 8px;
}

/* The date column already shows the date on wide screens. */
.post-date + .post-body .entry-meta > time {
  display: none;
}

.post-date + .post-body .entry-meta > time + :not(.tag)::before {
  content: none;
}

.post-date + .post-body .entry-meta > time + .tag {
  margin-left: 0;
}

.post-thumb {
  display: block;
  width: 176px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 12px;
  background: rgb(var(--accent-rgb) / 0.08);
}

.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

/* ----- Pagination ------------------------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 48px;
  font-size: 14px;
}

.page-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.page-number,
.page-gap {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}

a.page-number:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.page-number.current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.page-gap {
  color: var(--ink-3);
}

.page-direction {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 0.2s,
    background-color 0.2s;
}

.page-direction:hover {
  border-color: rgb(var(--accent-rgb) / 0.45);
  background: var(--surface-hover);
}

/* ----- Page headings and the archive ------------------------------------ */

.page-head {
  max-width: var(--text);
  margin: 0 auto;
  padding: var(--space-page-top) 0 24px;
}

.page-head .label {
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.page-note {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 14px;
}

.archive {
  max-width: var(--text);
  margin: 0 auto;
}

.taxonomy-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: var(--text);
  margin: 0 auto 20px;
}

.taxonomy-strip .chip {
  height: auto;
  min-height: 34px;
  padding: 5px 14px;
  font-size: 13.5px;
}

.taxonomy-strip .chip[aria-current="page"] {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.taxonomy-strip .chip[aria-current="page"]:hover {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
}

.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  max-width: var(--text);
  margin: 0 auto 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.archive-toolbar .archive-sort {
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

.archive-toolbar .search {
  flex: 1 1 200px;
  max-width: 260px;
  margin-left: auto;
}

.archive-year {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 44px 0 8px;
  color: var(--ink);
  font: italic 500 32px/1 var(--serif-latin);
  letter-spacing: 0.01em;
}

.archive-year:first-child {
  margin-top: 16px;
}

.archive-year::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.archive article {
  position: relative;
  display: grid;
  grid-template-columns: minmax(56px, max-content) minmax(0, 1fr) auto 18px;
  align-items: baseline;
  column-gap: 16px;
  margin-inline: -14px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: background-color 0.25s;
}

.archive article::after {
  content: "→";
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.25s,
    transform 0.35s var(--ease);
}

.archive time {
  color: var(--ink-3);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.archive h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.65;
  text-wrap: pretty;
}

.archive h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* ----- Reading ---------------------------------------------------------- */

.reading {
  max-width: var(--mid);
  margin: 0 auto;
  padding-top: var(--space-page-top);
}

.reading > * {
  max-width: var(--text);
  margin-inline: auto;
}

.reading-head {
  margin-bottom: 40px;
}

.reading-head .label {
  margin-bottom: 20px;
}

.reading-title {
  margin: 14px 0 0;
  font-size: clamp(30px, 4.2vw, 42px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.reading-head > .reading-title:first-child {
  margin-top: 0;
}

.reading-lede {
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.9;
}

.reading > .reading-cover {
  max-width: none;
  margin: 0 0 48px;
}

.reading-cover img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.reading-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 52px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.seal-end {
  font-size: 12.5px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list .tag {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.09);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: background-color 0.2s;
}

.tag-list .tag::before {
  content: "#";
  margin-right: 2px;
  opacity: 0.6;
}

.tag-list .tag:hover {
  background: rgb(var(--accent-rgb) / 0.16);
}

.reading-followup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.reading-followup .chip {
  height: auto;
  min-height: 36px;
  padding: 5px 14px;
  font-size: 13.5px;
}

.reader-toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 9px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-float);
}

/* ----- Prose ------------------------------------------------------------ */

.prose {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.95;
  letter-spacing: 0.015em;
  overflow-wrap: anywhere;
  text-autospace: normal;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose :is(p, ul, ol, dl, table, figure, details) {
  margin: 0 0 1.35em;
}

.prose p {
  text-wrap: pretty;
}

.prose :is(h1, h2, h3, h4, h5, h6) {
  position: relative;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  scroll-margin-top: 16px;
}

.prose h1 {
  margin: 2em 0 0.7em;
  font-size: 1.65em;
}

.prose h2 {
  margin: 2.2em 0 0.75em;
  font-size: 1.42em;
}

.prose h3 {
  margin: 1.9em 0 0.6em;
  font-size: 1.18em;
}

.prose :is(h4, h5, h6) {
  margin: 1.7em 0 0.5em;
  font-size: 1.03em;
}

.prose :is(h1, h2, h3, h4, h5, h6):target {
  color: var(--accent);
}

.heading-permalink {
  margin-left: 0.4em;
  color: var(--ink-3);
  font-weight: 400;
  text-decoration: none !important;
  opacity: 0;
  transition: opacity 0.2s;
}

:is(h1, h2, h3, h4, h5, h6):hover .heading-permalink,
.heading-text-link:focus .heading-permalink,
.heading-permalink:focus-visible {
  opacity: 0.6;
}

@media (hover: none), (max-width: 700px) {
  .heading-permalink {
    opacity: 0.48;
  }
}

.prose a:not(.heading-permalink):not(.heading-text-link) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgb(var(--accent-rgb) / 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.2s;
}

.prose a:not(.heading-permalink):not(.heading-text-link):hover {
  text-decoration-color: currentColor;
}

.prose a.heading-text-link {
  color: inherit;
  text-decoration: none;
}

.prose a.heading-text-link:hover,
.prose a.heading-text-link:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.prose strong {
  font-weight: 600;
}

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

.prose li {
  margin: 0.35em 0;
  padding-left: 0.2em;
}

.prose li > :is(ul, ol) {
  margin: 0.35em 0 0;
}

.prose li::marker {
  color: var(--accent);
}

.prose ol > li {
  margin: 0.5em 0;
}

.prose ol > li::marker {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.prose li:has(> input[type="checkbox"]) {
  list-style: none;
  margin-left: -1.4em;
}

.prose li > input[type="checkbox"] {
  margin-right: 0.55em;
  vertical-align: -2px;
}

.prose blockquote {
  margin: 1.8em 0;
  padding: 0.15em 0 0.15em 1.3em;
  border-left: 2px solid rgb(var(--accent-rgb) / 0.5);
  color: var(--ink-2);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose :not(pre) > code {
  padding: 0.14em 0.42em;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.85em;
  letter-spacing: 0;
}

.prose pre {
  margin: 1.8em 0;
  padding: 20px 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.75;
  letter-spacing: 0;
  tab-size: 4;
}

.prose pre code {
  font: inherit;
}

.prose kbd {
  padding: 0.1em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.82em;
}

.prose mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: rgb(var(--accent-rgb) / 0.2);
  color: inherit;
}

.prose del {
  color: var(--ink-3);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: 14px;
  cursor: zoom-in;
}

.prose figure img {
  margin-bottom: 0.7em;
}

.prose figcaption {
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.6;
  text-align: center;
}

.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.prose :is(th, td) {
  padding: 10px 18px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  border-bottom-color: var(--line-strong);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose hr {
  height: auto;
  margin: 2.8em 0;
  border: 0;
  color: var(--ink-3);
  text-align: center;
}

.prose hr::before {
  content: "· · ·";
  font: italic 500 22px/1 var(--serif-latin);
  letter-spacing: 0.7em;
}

.prose iframe,
.prose video {
  max-width: 100%;
}

/* Typecho shortcodes keep their content but follow the theme. */
.legacy-notice {
  margin: 1.6em 0;
  padding: 16px 20px;
  border: 1px solid rgb(var(--accent-rgb) / 0.18);
  border-inline-start: 3px solid rgb(var(--accent-rgb) / 0.65);
  border-radius: 14px;
  background: rgb(var(--accent-rgb) / 0.07);
  font-size: 0.94em;
}

.legacy-notice > :last-child {
  margin-bottom: 0;
}

.legacy-notice.legacy-warning {
  border-color: rgb(var(--warn-rgb) / 0.3);
  border-inline-start-color: rgb(var(--warn-rgb) / 0.85);
  background: rgb(var(--warn-rgb) / 0.1);
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 12px;
  margin: 1.8em 0;
}

.image-gallery figure {
  min-width: 0;
  margin: 0;
}

.image-gallery img {
  width: 100%;
  height: auto;
  margin: 0 0 0.5em;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
}

.legacy-collapse {
  margin: 1.6em 0;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}

.legacy-collapse > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.legacy-collapse[open] {
  padding-bottom: 16px;
}

img.inline-emote,
.prose img.inline-emote {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  margin: 0 0.1em;
  border-radius: 0;
  object-fit: contain;
  vertical-align: -0.35em;
  cursor: default;
}

/* ----- Comments --------------------------------------------------------- */

.comments {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  max-width: var(--text);
  margin: var(--space-section) auto 0;
}

.comments > * {
  grid-column: 1 / -1;
}

.comments > .comments-title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
}

/* Without controls beside it, the heading rule runs the full width. */
.comments:not(:has(> .comment-order:not([hidden]))):not(:has(> .comment-jump-compose:not([hidden]))) > .comments-title {
  grid-column: 1 / -1;
}

.comments > .comment-jump-compose {
  grid-column: 2;
  grid-row: 1;
  min-height: 32px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
}

.comments:not(:has(> .comment-order:not([hidden]))) > .comment-jump-compose {
  grid-column: -2 / -1;
}

.comments > .comment-order {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

.comment-order select {
  width: auto;
  min-height: 32px;
  height: 32px;
  margin: 0;
  padding: 0 34px 0 14px;
  border-radius: 999px;
  background-color: var(--surface);
  font-size: 13px;
  background-position: right 12px center;
}

#comment-list {
  margin-top: 10px;
}

.comment {
  position: relative;
  padding: 18px 0 16px 52px;
  scroll-margin-top: 28px;
}

.comment + .comment {
  border-top: 1px solid var(--line);
}

.comment > header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.comment-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.13);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  object-fit: cover;
}

.comment strong {
  font-size: 15px;
  font-weight: 600;
}

.comment time {
  color: var(--ink-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.comment-parent {
  display: inline-block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13px;
}

.comment-parent::before {
  content: "↳ ";
}

.comment-parent:hover {
  color: var(--accent);
}

.comment > p {
  margin: 6px 0 0;
  font-size: 15.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment > small {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgb(var(--warn-rgb) / 0.12);
  color: var(--ink-2);
  font-size: 12.5px;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.comment:target {
  border-radius: 14px;
  background: rgb(var(--accent-rgb) / 0.07);
  box-shadow: 0 0 0 12px rgb(var(--accent-rgb) / 0.07);
}

.comments > .form-status {
  margin-top: 8px;
}

.comments > button {
  justify-self: center;
  margin-top: 18px;
}

.comment-account-status {
  margin: 28px 0 0;
  font-size: 14px;
}

.comments-closed,
.comments-empty {
  margin: 20px 0 0;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  margin-top: 12px;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* The current reply dock owns the card; its existing form moves inside it. */
.comments .comment-composer .comment-form {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.comment-form > * {
  grid-column: 1 / -1;
}

.comment-form > label {
  grid-column: 1;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.comment-form > .comment-tools,
.comment-form > .markdown-toolbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 6px;
  margin: 0;
}

.comment-form textarea {
  min-height: 132px;
  margin-top: 12px;
  border-radius: 14px;
}

.comment-form > .reply-status {
  grid-column: 1;
  justify-self: start;
  margin: 12px 0 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--accent);
  font-size: 13px;
}

.comment-form > .reply-status:empty {
  display: none;
}

.comment-form > .reply-status + .text-button {
  grid-column: 2;
  min-height: 36px;
  margin: 12px -8px 0 0;
  padding-inline: 8px;
}

.comment-form .form-actions {
  margin-top: 14px;
}

.comment-tools button,
.markdown-toolbar button {
  min-height: 32px;
  padding: 0 13px;
  font-size: 13px;
}

/* ----- Friends ---------------------------------------------------------- */

.friends {
  max-width: var(--mid);
  margin: var(--space-section) auto 0;
}

.friends-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.friends-head .label {
  flex: 1;
  margin: 0;
}

.friends-settings {
  color: var(--ink-3);
  font-size: 13px;
  transition: color 0.2s;
}

.friends-settings:hover {
  color: var(--accent);
}

.friends-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 18px 0 24px;
}

.friends-filters label {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.friends-filters select {
  width: auto;
  min-width: 7.5rem;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 34px 0 14px;
  border-radius: 999px;
  background-color: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 13.5px;
  background-position: right 13px center;
}

.friends-filters button {
  min-height: 36px;
  height: 36px;
}

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.friend-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  transition:
    transform 0.4s var(--ease-spring),
    border-color 0.25s,
    background-color 0.25s,
    box-shadow 0.4s var(--ease);
}

.friend-card::after {
  content: "↗";
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1;
  opacity: 0.65;
  pointer-events: none;
  transition:
    transform 0.35s var(--ease-spring),
    color 0.25s,
    opacity 0.25s;
}

.friend-card:has(.friend-preview-link:not([hidden]))::after {
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.36);
  color: #fff;
  opacity: 0.85;
}

.friend-preview-link {
  display: block;
  height: 112px;
  margin: -22px -22px 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgb(var(--accent-rgb) / 0.08);
}

/* Without a site screenshot, the band turns into an ambient celestial corner glow + astrolabe watermark. */
.friend-band {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  overflow: hidden;
  pointer-events: none;
  --band-alpha: calc(var(--bloom-alpha) * 0.44);
  background:
    radial-gradient(85% 95% at 100% 0%, rgb(var(--g1) / var(--band-alpha)), transparent 68%),
    radial-gradient(75% 90% at 0% 100%, rgb(var(--g2) / calc(var(--band-alpha) * 0.72)), transparent 70%);
}

.friend-band::after {
  content: "";
  position: absolute;
  top: -54px;
  right: -54px;
  width: 172px;
  height: 172px;
  opacity: 0.16;
  background: linear-gradient(135deg, rgb(var(--accent-rgb)), rgb(var(--gold-rgb, var(--accent-rgb))));
  -webkit-mask: url("/assets/astrolabe.svg") center / contain no-repeat;
  mask: url("/assets/astrolabe.svg") center / contain no-repeat;
  transition: transform 0.7s var(--ease-spring), opacity 0.35s var(--ease);
}

.friend-card:nth-child(3n + 2) .friend-band {
  background:
    radial-gradient(85% 95% at 100% 0%, rgb(var(--g2) / var(--band-alpha)), transparent 68%),
    radial-gradient(75% 90% at 0% 100%, rgb(var(--g1) / calc(var(--band-alpha) * 0.72)), transparent 70%);
}

.friend-card:nth-child(3n) .friend-band {
  background:
    radial-gradient(95% 110% at 90% 0%, rgb(var(--g1) / var(--band-alpha)), transparent 66%),
    radial-gradient(70% 95% at 10% 100%, rgb(var(--g2) / calc(var(--band-alpha) * 0.72)), transparent 72%);
}

.friend-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.6s var(--ease);
}

.friend-heading {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  row-gap: 2px;
}

.friend-avatar,
.friend-placeholder {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  object-fit: cover;
  box-shadow: 0 8px 18px -10px rgb(0 0 0 / 0.28);
  transition: transform 0.35s var(--ease-spring), border-color 0.25s;
}

.friend-mark {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  transition: transform 0.45s var(--ease-spring);
}

.friend-mark svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: var(--friend-mark-shadow);
  transition: transform 0.45s var(--ease-spring), filter 0.45s var(--ease);
}

.friend-mark .orbit-a,
.friend-mark .orbit-b,
.friend-mark .star-core,
.friend-mark .sr-outer,
.friend-mark .sr-inner {
  transition: transform 0.65s var(--ease-spring), opacity 0.4s var(--ease);
}

.friend-mark .orbit-a,
.friend-mark .orbit-b,
.friend-mark .star-core {
  transform-origin: 32px 32px;
}

.friend-mark .sr-outer,
.friend-mark .sr-inner {
  transform-origin: 16px 16px;
}

.friend-mark .orbit-a ellipse { stroke: var(--hoshivel-orbit-a); }
.friend-mark .orbit-a circle { fill: var(--hoshivel-orbit-a); }
.friend-mark .orbit-b ellipse { stroke: var(--hoshivel-orbit-b); }
.friend-mark .orbit-b circle { fill: var(--hoshivel-orbit-b); }
.friend-mark .star-core path { fill: var(--hoshivel-star); }
.friend-mark .star-core circle { fill: var(--hoshivel-core); }
.friend-mark .sr-stop-1 { stop-color: var(--sr-stop-1); }
.friend-mark .sr-stop-2 { stop-color: var(--sr-stop-2); }
.friend-mark .sr-stop-3 { stop-color: var(--sr-stop-3); }
.friend-mark .sr-outer { opacity: var(--sr-outer-opacity); }

.friend-avatar-wrap {
  position: relative;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
}

.friend-avatar-wrap .friend-avatar,
.friend-avatar-wrap .friend-placeholder {
  grid-row: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.friend-orbit-ring {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  color: rgb(var(--gold-rgb, var(--accent-rgb)));
  opacity: 0.72;
  pointer-events: none;
  transition: transform 0.6s var(--ease-spring), opacity 0.35s var(--ease), color 0.3s;
}

/* ----- Special Animated Friend Card Templates --------------------------- */

.friend-card--special::before {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    115deg,
    transparent 38%,
    rgb(var(--accent-rgb) / 0.1) 48%,
    rgb(var(--gold-rgb, var(--accent-rgb)) / 0.12) 52%,
    transparent 62%
  );
  transform: translate3d(-45%, -10%, 0);
  transition: transform 0.85s var(--ease), opacity 0.35s var(--ease);
}

.friend-card--hoshivel {
  border-color: rgb(89 160 180 / 0.24);
}

.friend-card--hoshivel .friend-band {
  background:
    radial-gradient(88% 100% at 100% 0%, rgb(89 160 180 / calc(var(--bloom-alpha) * 0.42)), transparent 68%),
    radial-gradient(75% 90% at 0% 100%, rgb(201 154 84 / calc(var(--bloom-alpha) * 0.38)), transparent 70%);
}

.friend-card--shattered-realms {
  border-color: rgb(143 169 255 / 0.26);
}

.friend-card--shattered-realms .friend-band {
  background:
    radial-gradient(88% 100% at 100% 0%, rgb(143 169 255 / calc(var(--bloom-alpha) * 0.44)), transparent 68%),
    radial-gradient(75% 90% at 0% 100%, rgb(184 155 255 / calc(var(--bloom-alpha) * 0.38)), transparent 70%);
}

.friend-card--celestial-star {
  border-color: rgb(var(--gold-rgb, var(--accent-rgb)) / 0.26);
}

.friend-card--aurora-prism {
  border-color: rgb(var(--accent-rgb) / 0.26);
}

.friend-card--aurora-prism .friend-band {
  background:
    radial-gradient(92% 100% at 96% 0%, rgb(116 196 226 / calc(var(--bloom-alpha) * 0.44)), transparent 66%),
    radial-gradient(80% 95% at 4% 100%, rgb(198 156 244 / calc(var(--bloom-alpha) * 0.4)), transparent 70%);
}

.friend-card--aurora-prism .friend-avatar {
  border-radius: 50%;
  border-color: rgb(var(--accent-rgb) / 0.42);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.1), 0 10px 22px -12px rgb(var(--accent-rgb) / 0.45);
}

.friend-heading h3 {
  grid-column: 2;
  margin: 0;
  padding-right: 22px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.friend-host {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-host::before {
  content: "";
  flex: none;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.55);
}

.friend-card > p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin: 14px 0 16px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.friend-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.friend-meta > span:first-child {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid rgb(var(--accent-rgb) / 0.16);
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.08);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.friend-meta a {
  position: relative;
  z-index: 1;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.friend-meta a:hover {
  border-color: rgb(var(--accent-rgb) / 0.45);
  color: var(--accent);
}

/* ----- Settings, privacy, notices and empty states ---------------------- */

.settings-page {
  max-width: var(--text);
  margin: 0 auto;
  padding-top: var(--space-page-top);
}

.settings-page > header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 500;
  line-height: 1.35;
}

.settings-page > header p {
  margin: 12px 0 0;
  color: var(--ink-2);
  line-height: 1.85;
}

.settings-section,
.settings-page fieldset {
  position: relative;
  margin: 20px 0 0;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.settings-section:has(.appearance-selector),
.settings-page fieldset:has(.appearance-selector) {
  z-index: 10;
}

.settings-section:has(.appearance-trigger[aria-expanded="true"]),
.settings-page fieldset:has(.appearance-trigger[aria-expanded="true"]),
.settings-section.is-appearance-open,
.settings-page fieldset.is-appearance-open {
  z-index: 25;
}

.settings-section h2,
.settings-page legend {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
}

.settings-page legend {
  float: left;
  width: 100%;
}

.settings-page legend + * {
  clear: both;
}

.settings-section > p {
  margin: 4px 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.8;
}

.settings-page label.check {
  margin-top: 16px;
}

.settings-page label.check + .muted {
  margin: 2px 0 0 28px;
  font-size: 13.5px;
  line-height: 1.7;
}

.settings-page .muted:empty {
  display: none;
}

.settings-page form > button,
.settings-page fieldset ~ button {
  margin-top: 20px;
}

.settings-section .settings-section {
  margin-top: 22px;
  padding: 22px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.avatar-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.notification-settings {
  margin-top: 20px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}

.notification-settings > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 500;
  list-style: none;
}

.notification-settings > summary::-webkit-details-marker {
  display: none;
}

.notification-settings > summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.25s var(--ease);
}

.notification-settings[open] > summary::after {
  transform: translateY(1px) rotate(-135deg);
}

.notification-settings > summary:hover {
  color: var(--accent);
}

.notification-settings label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-settings input[type="email"] {
  max-width: 380px;
}

.privacy-page .prose h2 {
  font-size: 1.2em;
}

/* ----- Header account entry & /account page ----------------------------- */

.header-account-link.is-signed-in {
  padding: 0;
  overflow: hidden;
}

.header-account-link.is-signed-in .comment-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  font-size: 13px;
}

.account-grid {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.account-card {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.account-card h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.account-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.account-card-head h2 {
  margin: 0;
}

.account-hero {
  display: grid;
  gap: 18px;
}

.account-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.account-hero-avatar .comment-avatar {
  flex: none;
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.account-hero-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.account-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.account-role-chip,
.account-badge,
.account-inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--tint);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.account-inline-badge {
  margin-inline-start: 8px;
}

.account-badge[data-tone="ok"],
.account-inline-badge[data-tone="ok"] {
  border-color: rgb(var(--accent-rgb, 106 78 180) / 0.3);
  background: rgb(var(--accent-rgb, 106 78 180) / 0.12);
  color: var(--accent);
}

.account-badge[data-tone="warn"],
.account-inline-badge[data-tone="warn"] {
  border-color: rgb(var(--warn-rgb, 166 112 28) / 0.35);
  background: rgb(var(--warn-rgb, 166 112 28) / 0.14);
  color: var(--ink-2);
}

.account-badge[data-tone="blocked"] {
  border-color: color-mix(in srgb, var(--seal) 36%, transparent);
  background: color-mix(in srgb, var(--seal) 12%, transparent);
  color: var(--seal);
}

.account-email-line,
.account-standing-detail,
.account-notify-summary {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.account-hero-actions {
  margin: 0;
}

.account-facts {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tint);
}

.account-fact {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
}

.account-fact dt {
  color: var(--muted);
  font-size: 13.5px;
}

.account-fact dd {
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.account-card .settings-section,
.account-card .notification-settings--inline {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.account-card .notification-settings--inline {
  margin-top: 14px;
}

.account-card .avatar-preview {
  margin: 14px 0 16px;
}

.account-foot-links {
  margin: 4px 0 0;
  font-size: 13.5px;
  text-align: center;
}

.visitor-account-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tint);
}

.visitor-account-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.visitor-account-info strong {
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.visitor-account-info span {
  font-size: 13px;
}

.forbidden-state .label {
  justify-content: center;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .account-card {
    padding: 18px;
  }

  .account-hero-main {
    align-items: flex-start;
  }

  .account-fact {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.notification-card,
.empty-state {
  max-width: 520px;
  margin: clamp(40px, 18vh, 168px) auto clamp(40px, 12vh, 120px);
  text-align: center;
}

.notification-card {
  padding: 40px 32px 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.notification-card .seal,
.empty-state .seal {
  margin-bottom: 22px;
}

.notification-card .page-title,
.empty-state .page-title {
  font-size: clamp(24px, 3vw, 30px);
}

.notification-card #notification-status {
  margin: 12px 0 24px;
  color: var(--ink-2);
  font-size: 15px;
}

.empty-state p {
  margin: 12px 0 0;
  color: var(--ink-2);
}

.empty-state .button {
  margin-top: 26px;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.empty-state-actions .button {
  margin-top: 0;
}

/* ----- Cookie card and dialogs ------------------------------------------ */

.cookie-card {
  position: fixed;
  z-index: 80;
  bottom: 20px;
  left: 20px;
  width: min(400px, calc(100% - 40px));
  padding: 22px 22px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.cookie-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.cookie-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
}

.cookie-card .form-actions {
  margin-top: 16px;
}

.cookie-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 13px;
}

.cookie-card-links a {
  color: var(--ink-3);
  transition: color 0.2s;
}

.cookie-card-links a:hover {
  color: var(--accent);
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(12 13 18 / 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.emoji-picker {
  width: min(560px, calc(100% - 32px));
  max-height: min(82dvh, 760px);
  overflow: auto;
  padding: 22px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-float);
}


.emoji-picker > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.emoji-picker h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.emoji-picker h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.emoji-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
}

.emoji-groups button {
  min-height: 32px;
  padding: 0 13px;
  font-size: 13px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
  margin: 16px 0;
}

.emoji-grid button {
  min-height: 52px;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.emoji-grid button:hover {
  border-color: rgb(var(--accent-rgb) / 0.45);
  background: rgb(var(--accent-rgb) / 0.08);
}

.emoji-grid img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.emoji-upload {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.emoji-upload button {
  justify-self: start;
}

.hoshiki-lightbox {
  width: min(1200px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.hoshiki-lightbox::backdrop {
  background: rgb(9 10 14 / 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hoshiki-lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.hoshiki-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  border-radius: 12px;
  box-shadow: 0 30px 80px -30px #000;
}

.hoshiki-lightbox figcaption {
  margin-top: 14px;
  color: rgb(255 255 255 / 0.75);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.lightbox-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.hoshiki-lightbox :is(.lightbox-close, .lightbox-previous, .lightbox-next, .lightbox-original) {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font-size: 13.5px;
  transition: background-color 0.2s;
}

.hoshiki-lightbox :is(.lightbox-close, .lightbox-previous, .lightbox-next, .lightbox-original):hover {
  background: rgb(255 255 255 / 0.2);
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* ----- Footer ----------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  width: min(100% - 2 * var(--gutter), var(--wide));
  margin: 0 auto;
  padding: 28px 0 calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.wordmark-sm .wordmark-name {
  color: var(--ink-2);
  font-size: 22px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-left: auto;
}

.site-footer nav.has-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 32px;
}

.footer-nav-group {
  display: grid;
  gap: 6px;
  min-width: 6.5rem;
}

.footer-nav-group-title {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.footer-nav-group ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.site-footer nav a[aria-current],
.site-footer nav a:hover,
.wordmark-sm:hover .wordmark-name {
  color: var(--accent);
}

.colophon {
  margin: 0;
  white-space: pre-line;
}

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

@media (hover: hover) {
  .lead:hover,
  .friend-card:hover {
    transform: translateY(-4px);
    border-color: rgb(var(--accent-rgb) / 0.34);
    background: var(--surface-hover);
    box-shadow: inset 0 1px 0 var(--rim), var(--shadow-lift);
  }

  .friend-card:hover::after {
    transform: translate(2px, -2px);
    color: var(--accent);
    opacity: 1;
  }

  .friend-card:hover .friend-band::after {
    opacity: 0.32;
    transform: rotate(12deg) scale(1.06);
  }

  .friend-card:hover .friend-avatar,
  .friend-card:hover .friend-placeholder {
    transform: scale(1.06);
    border-color: rgb(var(--accent-rgb) / 0.35);
  }

  .friend-card:hover .friend-preview {
    transform: scale(1.04);
  }

  .friend-card--special:hover::before {
    opacity: 1;
    transform: translate3d(55%, 10%, 0);
  }

  .friend-card:hover .friend-mark svg {
    transform: scale(1.06);
  }

  .friend-card:hover .friend-mark .orbit-a {
    transform: rotate(22deg);
  }

  .friend-card:hover .friend-mark .orbit-b {
    transform: rotate(-20deg);
  }

  .friend-card:hover .friend-mark .star-core {
    transform: scale(1.16);
  }

  .friend-card:hover .friend-mark .sr-outer {
    transform: rotate(18deg) scale(1.05);
  }

  .friend-card:hover .friend-mark .sr-inner {
    transform: rotate(-18deg) scale(1.08);
  }

  .friend-card--celestial-star:hover .friend-orbit-ring {
    opacity: 1;
    scale: 1.08;
    color: var(--accent);
  }

  .lead:hover .lead-cover img {
    transform: scale(1.03);
  }

  .lead:hover .read-more svg {
    transform: translateX(3px);
  }

  .post:hover,
  .archive article:hover {
    background: rgb(var(--accent-rgb) / 0.065);
  }

  .post:hover::after {
    opacity: 0.85;
    transform: scaleY(1);
  }

  .post:hover .post-day {
    color: var(--accent);
  }

  .post:hover::before,
  .post:hover + .post::before {
    opacity: 0;
  }

  .post:hover .post-title,
  .archive article:hover h3 {
    color: var(--accent);
  }

  .post:hover .post-thumb img {
    transform: scale(1.05);
  }

  .archive article:hover::after {
    opacity: 1;
    transform: none;
  }
}

/* ----- Keyboard focus and touch targets --------------------------------- */

/* Cards are links through their titles, so keyboard focus marks the whole card. */
.post:has(.post-title a:focus-visible),
.archive article:has(h3 a:focus-visible) {
  background: rgb(var(--accent-rgb) / 0.065);
}

.lead:has(.lead-title a:focus-visible),
.friend-card:has(.friend-heading h3 a:focus-visible) {
  border-color: rgb(var(--accent-rgb) / 0.45);
}

@media (pointer: coarse) {
  .site-footer nav a,
  .cookie-card-links a {
    min-height: 40px;
  }

  .cookie-card-links a {
    display: inline-flex;
    align-items: center;
  }

  /* iOS Safari zooms into fields set below 16px, so touch layouts use 16px text. */
  body:not([data-admin-app]) :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"]), select, textarea) {
    font-size: 16px;
  }
}

/* ----- Wide screens ----------------------------------------------------- */

@media (min-width: 1000px) {
  .masthead {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(56px, 7vw, 104px);
  }
}

/* ----- Narrow screens --------------------------------------------------- */

@media (max-width: 860px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: 14px;
    padding-block: 20px 14px;
  }

  .site-nav ~ .site-tools {
    margin-left: auto;
  }

  .site-nav {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: flex-start;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .site-nav > a,
  .nav-group-trigger {
    flex: 0 1 auto;
    text-align: center;
  }

  .nav-group {
    position: static;
  }

  .nav-group[open] {
    flex-basis: 100%;
  }

  .nav-group-menu {
    position: static;
    max-width: none;
    margin-top: 6px;
    box-shadow: none;
  }

  /*
   * The sticky bar keeps one compact row: the name, the navigation (scrolling
   * sideways when it runs long) and the tools. Group menus open as a panel
   * under the bar, so the scrolling row never clips them.
   */
  body > .site-header {
    flex-wrap: nowrap;
    gap: 14px;
    padding-block: 8px;
  }

  body > .site-header .wordmark {
    flex: none;
    gap: 9px;
  }

  body > .site-header .wordmark-name {
    font-size: 27px;
  }

  body > .site-header .site-nav {
    order: 0;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 16px;
    margin-left: auto;
    padding: 0;
    border-top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  body > .site-header .site-nav::-webkit-scrollbar {
    display: none;
  }

  /* site.js marks which ends hide more links; those edges fade out. */
  body > .site-header .site-nav[data-overflow="end"] {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }

  body > .site-header .site-nav[data-overflow="start"] {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
  }

  body > .site-header .site-nav[data-overflow="both"] {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  }

  /* An open group panel sits outside the row and must not be masked. */
  body > .site-header .site-nav:has(.nav-group[open]) {
    -webkit-mask-image: none;
    mask-image: none;
  }

  body > .site-header .site-nav > a,
  body > .site-header .nav-group-trigger {
    flex: none;
    padding-block: 8px;
    white-space: nowrap;
  }

  body > .site-header .site-nav > a[aria-current]::after,
  body > .site-header .nav-group-trigger.is-current::after {
    bottom: 2px;
  }

  body > .site-header .site-nav ~ .site-tools {
    margin-left: 0;
  }

  body > .site-header .nav-group[open] {
    flex-basis: auto;
  }

  body > .site-header .nav-group-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: var(--gutter);
    left: var(--gutter);
    margin: 0;
    box-shadow: var(--shadow-float);
  }

  .has-masthead:not(.has-custom-brand) .site-header:not(.shows-brand) .wordmark {
    visibility: visible;
    opacity: 1;
  }

  .masthead {
    padding-top: 28px;
  }

}

@media (max-width: 700px) {
  .post {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    padding-block: 18px;
  }

  .post-date {
    display: none;
  }

  .post-date + .post-body .entry-meta > time {
    display: inline;
  }

  .post-date + .post-body .entry-meta > time + :not(.tag)::before {
    content: "·";
  }

  .post-date + .post-body .entry-meta > time + .tag {
    margin-left: 0.9em;
  }

  .post-title {
    font-size: 17.5px;
  }

  .post-excerpt {
    font-size: 14.5px;
  }

  .post-thumb {
    width: 88px;
    aspect-ratio: 1;
    border-radius: 10px;
  }

  .section-head {
    flex-wrap: wrap;
  }

  .section-head .label {
    flex-basis: 100%;
  }

  .search {
    flex: 1 1 100%;
  }

  .masthead {
    row-gap: 24px;
    padding-block: 20px 28px;
  }

  .masthead-kicker {
    margin-bottom: 12px;
  }

  .masthead-description {
    margin-top: 14px;
    font-size: 15.5px;
  }

  .masthead-links {
    margin-top: 16px;
  }

  .lead-cover {
    aspect-ratio: 2 / 1;
  }

  .archive-toolbar .search {
    flex: 1 1 100%;
    max-width: none;
    margin-left: 0;
  }

  .archive article {
    grid-template-columns: minmax(48px, max-content) minmax(0, 1fr);
    column-gap: 14px;
  }

  .archive article::after {
    display: none;
  }

  .comment {
    padding-left: 46px;
  }

  .comment-avatar {
    width: 34px;
    height: 34px;
  }

  .comment-form {
    padding: 16px;
  }

  .settings-section,
  .settings-page fieldset {
    padding: 20px;
  }

  .site-footer nav {
    order: 3;
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 520px) {
  .masthead {
    row-gap: 20px;
    padding-block: 16px 24px;
  }

  .masthead-title {
    gap: 14px;
  }

  .masthead-name {
    font-size: clamp(42px, 11vw, 56px);
  }

  .seal-lg {
    font-size: 17px;
  }

  .masthead-description {
    margin-top: 12px;
    font-size: 15px;
  }

  .lead-body {
    padding: 18px 18px 20px;
  }

  .prose {
    font-size: 16px;
    line-height: 1.9;
  }

  .prose pre {
    margin-inline: -8px;
    padding: 16px;
    border-radius: 14px;
    font-size: 12.5px;
  }

  .reading > .reading-cover {
    margin-bottom: 36px;
  }

  .reading-cover img {
    border-radius: 14px;
  }

  .cookie-card {
    bottom: 12px;
    left: 12px;
    width: calc(100% - 24px);
    padding: 20px;
  }

  .lightbox-controls {
    gap: 8px;
  }

  .comments > .comments-title {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .comments > .comment-jump-compose {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    margin-top: 8px;
  }

  .comments:not(:has(> .comment-order:not([hidden]))) > .comment-jump-compose {
    grid-column: 1;
  }

  .comments > .comment-order {
    grid-column: 2 / -1;
    grid-row: 2;
    justify-self: end;
    margin-top: 8px;
  }
}

@media (max-width: 420px) {
  body > .site-header {
    gap: 10px;
  }

  body > .site-header .header-search-link,
  body > .site-header .header-account-link,
  body > .site-header .appearance-selector .appearance-trigger {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  body > .site-header .header-account-link.is-signed-in .comment-avatar {
    width: 26px;
    height: 26px;
  }
}

/* ----- Motion ----------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .bloom-a {
    animation: drift-a 28s ease-in-out infinite alternate;
  }

  .bloom-b {
    animation: drift-b 34s ease-in-out infinite alternate;
  }

  .masthead-intro > *,
  .lead,
  .journal,
  .post,
  .archive-year,
  .archive article,
  .reading-head,
  .reading-cover {
    animation: rise 0.85s var(--ease) backwards;
  }

  .masthead-intro > :nth-child(2) {
    animation-delay: 70ms;
  }

  .masthead-intro > :nth-child(3) {
    animation-delay: 140ms;
  }

  .masthead-intro > :nth-child(4) {
    animation-delay: 210ms;
  }

  .lead {
    animation-delay: 180ms;
  }

  .journal {
    animation-delay: 220ms;
  }

  .reading-cover {
    animation-delay: 120ms;
  }

  .post:nth-child(1),
  .archive article:nth-of-type(1) {
    animation-delay: 200ms;
  }

  .post:nth-child(2),
  .archive article:nth-of-type(2) {
    animation-delay: 250ms;
  }

  .post:nth-child(3),
  .archive article:nth-of-type(3) {
    animation-delay: 300ms;
  }

  .post:nth-child(4),
  .archive article:nth-of-type(4) {
    animation-delay: 350ms;
  }

  .post:nth-child(n + 5),
  .archive article:nth-of-type(n + 5) {
    animation-delay: 390ms;
  }

  .cookie-card {
    animation: rise 0.6s var(--ease) 0.4s backwards;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
  }

  @keyframes drift-a {
    to {
      transform: translate3d(7vmax, 5vmax, 0) scale(1.08);
    }
  }

  .friend-card--hoshivel .friend-mark--hoshivel {
    animation: celestia-float-soft 5.5s ease-in-out infinite alternate;
  }

  .friend-card--shattered-realms .friend-mark--sr {
    animation: celestia-float-soft 6s ease-in-out infinite alternate;
  }

  .friend-card--celestial-star .friend-orbit-ring {
    animation: celestia-friend-orbit 24s linear infinite;
  }

  .friend-card--aurora-prism .friend-band {
    animation: celestia-aurora-shift 9s ease-in-out infinite alternate;
  }

  @keyframes celestia-friend-orbit {
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes celestia-float-soft {
    from {
      transform: translateY(0);
    }
    to {
      transform: translateY(-2.5px);
    }
  }

  @keyframes celestia-aurora-shift {
    from {
      transform: scale(1) translate3d(0, 0, 0);
    }
    to {
      transform: scale(1.06) translate3d(-4%, 4%, 0);
    }
  }

  @keyframes drift-b {
    to {
      transform: translate3d(-6vmax, -5vmax, 0) scale(1.06);
    }
  }
}

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

/* ----- Pinning, priority filters, author links & member profiles -------- */

.lead-flag--pinned {
  background: color-mix(in srgb, var(--seal) 14%, transparent);
  color: var(--seal);
}

.entry-pin-badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  margin-right: 8px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--seal) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--seal) 10%, transparent);
  color: var(--seal);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.entry-author-link,
.entry-author-name {
  position: relative;
  z-index: 2;
  color: var(--ink-2);
  text-decoration: none;
}

.entry-author-link {
  transition: color 0.2s ease;
}

.entry-author-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.archive-item-meta {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.archive-item-meta .entry-pin-badge {
  margin-right: 0;
}

.entry-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.entry-filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.entry-filters select {
  width: auto;
  min-width: 7.5rem;
  height: 34px;
  min-height: 34px;
  margin: 0;
  padding: 0 32px 0 12px;
  border-radius: 999px;
  background-color: var(--paper);
  font-size: 13px;
  background-position: right 12px center;
}

.entry-filters .entry-filters-submit {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.entry-filters .entry-filters-clear,
.archive-sort .archive-filters-clear {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.profile-page {
  display: grid;
  gap: 28px;
}

.profile-hero {
  max-width: var(--mid);
}

.profile-kicker {
  margin: 0;
}

.profile-name {
  font-size: 24px;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 2px 0 0;
  font-size: 13.5px;
}

.profile-tabs,
.profile-sort-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tabs .chip[aria-current="page"],
.profile-sort-links .chip[aria-current="true"] {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.profile-section {
  max-width: var(--mid);
  padding-top: 0;
}

.profile-section .section-head {
  flex-wrap: wrap;
  gap: 12px;
}

.profile-comment-list {
  display: grid;
  gap: 14px;
}

.profile-comment-card {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.profile-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.profile-comment-entry {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.profile-comment-entry:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.profile-comment-head time {
  color: var(--ink-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.profile-comment-card .comment-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-comment-foot {
  display: flex;
  justify-content: flex-end;
}

.profile-comment-jump {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.profile-comment-jump:hover {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.profile-hidden-note {
  max-width: var(--mid);
}

.profile-hidden-note p {
  margin: 0;
}

.profile-visibility-form {
  display: grid;
  gap: 10px;
}

.profile-visibility-form .muted {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.profile-visibility-form button[type="submit"] {
  justify-self: start;
}

@media (max-width: 640px) {
  .archive article {
    grid-template-columns: minmax(52px, max-content) minmax(0, 1fr);
    row-gap: 4px;
  }

  .archive-item-meta {
    grid-column: 2;
    justify-self: start;
  }

  .entry-filters {
    padding: 12px;
  }

  .profile-comment-card {
    padding: 16px;
  }
}

/* ----- Print ------------------------------------------------------------ */

@media print {
  .backdrop,
  .site-header,
  .site-footer,
  .comments,
  .friends,
  .pagination,
  .cookie-card {
    display: none !important;
  }

  html {
    background: #fff;
  }

  .prose a {
    color: inherit;
  }
}
