/* ==========================================================================
   Pure for Halo
   Visual language adapted from Astro Theme Pure (Apache-2.0)
   ========================================================================== */

:root {
  /* Accent: overridden inline from theme settings */
  --accent: #517e94;
  --accent-ink: var(--accent);
  --container: 70rem;

  /* Astro Theme Pure palette */
  --bg: #fcfcfd;
  --fg: #09090b;
  --fg-muted: #45454a;
  --fg-subtle: #71717a;
  --card: #ffffff;
  --muted: #f4f4f5;
  --border: #dfdfe2;
  --border-strong: #c4c4cb;
  --code-bg: #f4f4f5;

  --radius: 0.5rem;
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;

  --font-sans: "Satoshi", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Songti SC", "Noto Serif SC", serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
    "Yuanti SC", "PingFang SC", var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  --font-body: var(--font-sans);

  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --header-h: 4rem;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(39, 39, 42, 0.08),
    0 4px 6px -4px rgba(39, 39, 42, 0.08);
}

html[data-scheme="dark"] {
  --accent-ink: #b4ebfd;

  --bg: #0b0b10;
  --fg: #fafafa;
  --fg-muted: #b9b9c2;
  --fg-subtle: #8e8e98;
  --card: #111116;
  --muted: #1f1f23;
  --border: #38383d;
  --border-strong: #4b4b53;
  --code-bg: #15151b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.45),
    0 4px 6px -4px rgba(0, 0, 0, 0.45);
}

@supports (color: color-mix(in srgb, red, blue)) {
  html[data-scheme="dark"] {
    --accent-ink: color-mix(in srgb, var(--accent) 35%, white);
  }
}

html[data-fonts="serif"] {
  --font-body: var(--font-serif);
}

html[data-fonts="rounded"] {
  --font-body: var(--font-rounded);
}

html[data-radius="small"] {
  --radius: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-md: 0.375rem;
  --radius-sm: 0.25rem;
}

html[data-radius="medium"] {
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-md: 0.625rem;
  --radius-sm: 0.5rem;
}

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  transition: none !important;
  animation: none !important;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--muted);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: var(--accent-ink);
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--container);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 2.5rem;
}

.page-main {
  flex: 1;
  width: 100%;
}

.page-narrow {
  max-width: 52rem;
  margin: 0 auto;
}

.page-glow {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 0;
  height: 52vh;
  pointer-events: none;
  background: radial-gradient(
    50% 60% at 50% 0%,
    rgba(81, 126, 148, 0.18),
    transparent 70%
  );
}

@supports (color: color-mix(in srgb, red, blue)) {
  .page-glow {
    background: radial-gradient(
      50% 60% at 50% 0%,
      color-mix(in srgb, var(--accent) 22%, transparent),
      transparent 70%
    );
  }
}

html[data-scheme="dark"] .page-glow {
  opacity: 0.55;
}

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

.site-header {
  position: sticky;
  top: 1rem;
  z-index: 50;
  margin-bottom: 3rem;
  transition: transform 0.3s var(--ease);
}

.site-header.is-hidden {
  transform: translateY(-6rem);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease), padding 0.3s var(--ease),
    margin 0.3s var(--ease);
}

.site-header.is-stuck .header-inner {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

@media (min-width: 800px) {
  .site-header.is-stuck {
    margin-inline: 8%;
  }
}

html[data-scheme="dark"] .site-header.is-stuck .header-inner {
  background: var(--muted);
}

.brand {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: margin 0.3s var(--ease), color 0.2s var(--ease);
}

.site-header.is-stuck .brand {
  margin-inline-start: 0.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}

.nav-item {
  position: relative;
}

.nav-item > a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-item > a:hover {
  color: var(--accent-ink);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 11rem;
  padding: 0.375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
    visibility 0.2s;
}

.nav-item.has-children:hover .nav-dropdown,
.nav-item.has-children:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.nav-dropdown a:hover {
  color: var(--accent-ink);
  background: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.icon-button:hover {
  background: var(--muted);
  color: var(--accent-ink);
}

.icon-button-plain {
  border-color: transparent;
}

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

/* Theme toggle: system / light / dark */
.icon-system,
.icon-sun,
.icon-moon {
  display: none;
}

html[data-theme-mode="system"] .icon-system,
html[data-theme-mode="light"] .icon-sun,
html[data-theme-mode="dark"] .icon-moon {
  display: block;
}

html:not([data-theme-mode]) .icon-system {
  display: block;
}

.menu-toggle {
  display: none;
  width: 2rem;
  height: 2rem;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--fg);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.site-header.nav-open .menu-toggle span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.site-header.nav-open .menu-toggle span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* Hero -------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  max-width: 46rem;
  margin: 0.5rem auto 3.5rem;
  text-align: center;
}

.hero-avatar {
  width: 7rem;
  height: 7rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  object-fit: cover;
}

.hero h1 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  max-width: 38rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--fg-muted);
}

.hero-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.75rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-label svg {
  width: 1.125rem;
  height: 1.125rem;
}

.hero-label strong {
  font-weight: 500;
  color: var(--fg);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: box-shadow 0.2s var(--ease), color 0.2s var(--ease);
}

.hero-cta:hover {
  color: var(--fg);
  box-shadow: var(--shadow-md);
}

.hero-dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #4ade80;
}

.hero-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #4ade80;
  animation: hero-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes hero-ping {
  75%,
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Home about -------------------------------------------------------------- */

.home-about {
  max-width: 46rem;
  margin: 0 auto 3.5rem;
  text-align: center;
}

.home-about-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.home-about-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--fg-muted);
}

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

.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 900px) {
  .blog-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 2rem;
  }
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.section-meta a {
  color: var(--fg-muted);
}

.section-meta a:hover {
  color: var(--accent-ink);
}

/* Back button ------------------------------------------------------------- */

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.back-button:hover {
  background: var(--card);
  color: var(--accent-ink);
}

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

/* Post rows --------------------------------------------------------------- */

.post-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-row {
  margin: 0;
}

.post-row-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.post-row-link:hover {
  background: var(--muted);
  border-color: var(--border-strong);
  color: var(--accent-ink);
}

.post-row time {
  flex: none;
  min-width: 5.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.post-row-title {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}

.post-row-arrow {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--fg-muted);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.post-row-link:hover .post-row-arrow {
  color: var(--accent-ink);
  transform: translateX(4px);
}

/* Post cards -------------------------------------------------------------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  position: relative;
  margin: 0;
}

.post-card-inner {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.post-card-inner:hover {
  background: var(--muted);
  border-color: var(--border-strong);
  color: var(--accent-ink);
}

.post-card-cover {
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  z-index: 0;
  width: 60%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  transition: opacity 0.3s var(--ease);
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 100%
  );
}

.post-card-inner:hover .post-card-cover {
  opacity: 0.7;
}

.post-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Stretch the title link over the whole card. */
.post-card-title a {
  color: inherit;
}

.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card time {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.post-card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.post-card-pinned {
  margin-inline-end: 0.25rem;
  font-size: 0.8em;
  font-weight: 500;
  color: var(--accent-ink);
}

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

.post-card-tags {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.post-card-tags a {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: 0.75rem;
  color: var(--fg-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.post-card-tags a:hover {
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}

.post-card-arrow {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  width: 1rem;
  height: 1rem;
  color: var(--fg-muted);
  pointer-events: none;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.post-card-inner:hover .post-card-arrow {
  color: var(--accent-ink);
  transform: translateX(4px);
}

/* Sidebar ----------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 6rem;
  align-self: start;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.sidebar-title svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar .tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sidebar-more {
  display: block;
  margin-top: 1rem;
  text-align: right;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.sidebar-more:hover {
  color: var(--accent-ink);
}

/* Tag cloud --------------------------------------------------------------- */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.tag-pill:hover {
  background: var(--card);
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}

.tag-pill em,
.tag-pill sup {
  font-style: normal;
  font-size: 0.6875rem;
  color: var(--fg-subtle);
}

.tag-pill.is-medium {
  font-size: 1rem;
}

.tag-pill.is-large {
  padding: 0.35rem 0.85rem;
  font-size: 1.125rem;
}

.tag-cloud-page {
  gap: 0.75rem;
}

/* Archives ---------------------------------------------------------------- */

.archive-list {
  margin-top: 6rem;
}

.archive-year {
  position: relative;
  margin-top: 5rem;
}

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

.archive-year-label {
  position: absolute;
  inset-inline-start: -1.5rem;
  top: -4.5rem;
  z-index: 0;
  margin: 0;
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  opacity: 0.12;
  pointer-events: none;
  -webkit-text-stroke: 2px var(--fg);
}

html[data-scheme="dark"] .archive-year-label {
  opacity: 0.25;
}

.archive-month {
  position: relative;
  z-index: 1;
  margin: 1.5rem 0 0.5rem;
  padding-inline: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

.archive-year .post-rows {
  position: relative;
  z-index: 1;
}

/* Categories -------------------------------------------------------------- */

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.category-item:hover {
  background: var(--muted);
  border-color: var(--border-strong);
}

.category-copy {
  flex: 1;
  min-width: 0;
}

.category-copy h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.category-copy p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--fg-muted);
}

.category-count {
  flex: none;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

.category-arrow {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--fg-muted);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.category-item:hover .category-arrow {
  color: var(--accent-ink);
  transform: translateX(4px);
}

/* Author ------------------------------------------------------------------ */

.author-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.author-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  object-fit: cover;
}

.author-copy h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.author-copy p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--fg-muted);
}

/* Page head --------------------------------------------------------------- */

.page-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.page-cover {
  display: block;
  width: 100%;
  margin: 0 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Post -------------------------------------------------------------------- */

.post-wrap {
  max-width: 100%;
}

.post-header {
  max-width: 48rem;
  margin: 1.5rem 0 2rem;
}

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

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

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

.post-title {
  margin: 1rem 0 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.post-excerpt {
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--fg-muted);
}

.post-excerpt q {
  quotes: "\201C" "\201D";
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.post-tags a {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: 0.75rem;
  color: var(--fg-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.post-tags a:hover {
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}

.post-divider {
  width: 50%;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 1080px) {
  .post-layout:has(.toc:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 15rem;
  }
}

.post-body {
  max-width: 48rem;
}

.post-aside {
  display: none;
  position: sticky;
  top: 6rem;
}

@media (min-width: 1080px) {
  .post-aside {
    display: block;
  }
}

.toc {
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  font-size: 0.8125rem;
}

.toc-title {
  margin: 0 0 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.toc-list a {
  display: block;
  margin-left: -1px;
  padding: 0.25rem 0 0.25rem 0.75rem;
  border-left: 1px solid transparent;
  line-height: 1.5;
  color: var(--fg-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.toc-list a[data-level="3"] {
  padding-left: 1.5rem;
  font-size: 0.78125rem;
}

.toc-list a:hover,
.toc-list a.is-active {
  color: var(--accent-ink);
}

.toc-list a.is-active {
  border-left-color: var(--accent-ink);
}

.post-footer {
  max-width: 48rem;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.post-nav-item:hover {
  background: var(--muted);
  border-color: var(--border-strong);
}

.post-nav-item span {
  font-size: 0.6875rem;
  color: var(--fg-subtle);
}

.post-nav-item strong {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
}

.post-nav-item.align-right {
  text-align: right;
  align-items: flex-end;
}

.comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 500;
}

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

.prose {
  max-width: 100%;
  overflow-wrap: break-word;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--fg-muted);
}

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

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

.prose p {
  margin: 1.1rem 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--fg);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  scroll-margin-top: 6rem;
}

.prose h1 {
  margin: 2.25rem 0 0.875rem;
  font-size: 1.75rem;
}

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.375rem;
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.125rem;
}

.prose h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.prose a:hover {
  color: var(--accent-ink);
  text-decoration-thickness: 2px;
}

.prose strong {
  font-weight: 600;
  color: var(--fg);
}

.prose ul,
.prose ol {
  margin: 1.1rem 0;
  padding-inline-start: 1.625rem;
}

.prose li {
  margin: 0.5rem 0;
  padding-inline-start: 0.25rem;
}

.prose li > p {
  margin: 0.35rem 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--muted);
  color: var(--fg-muted);
  font-style: italic;
}

.prose blockquote p {
  margin: 0.35rem 0;
}

.prose code {
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--fg);
}

.prose pre {
  position: relative;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  font-size: 0.875rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

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

.prose img {
  display: block;
  margin: 1.5rem auto;
  border-radius: var(--radius-md);
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
}

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

.prose th {
  font-weight: 500;
  color: var(--fg);
}

.prose iframe,
.prose video {
  max-width: 100%;
  border-radius: var(--radius-md);
}

.prose .highlight,
.prose figure.highlight {
  margin: 1.5rem 0;
}

.code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  opacity: 0;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}

.prose pre:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .code-copy {
    opacity: 1;
  }
}

.code-copy:hover {
  color: var(--accent-ink);
}

/* Moments ----------------------------------------------------------------- */

.moment-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.moment-tags .tag-pill.is-active {
  background: var(--card);
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}

.moment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.moment-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.moment-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.moment-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  object-fit: cover;
}

.moment-avatar-fallback {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
}

.moment-author {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.moment-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.moment-time {
  font-size: 0.75rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

.moment-link {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.moment-link:hover {
  color: var(--accent-ink);
}

.moment-content {
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--fg-muted);
}

.moment-content p {
  margin: 0.5rem 0;
}

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

.moment-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.moment-media img,
.moment-media video {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  object-fit: cover;
}

.moment-media audio {
  width: 100%;
}

.moment-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.moment-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.moment-tag-list a {
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.moment-tag-list a:hover {
  color: var(--accent-ink);
}

.moment-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.moment-stats span,
.moment-stats a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.moment-stats svg {
  width: 0.875rem;
  height: 0.875rem;
}

.moment-detail {
  max-width: 48rem;
  margin-top: 1.5rem;
}

.moment-detail .moment-content {
  font-size: 1rem;
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.875rem;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
  color: var(--fg-muted);
}

.pagination-link:hover {
  color: var(--accent-ink);
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

/* Buttons / empty --------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.button:hover {
  background: var(--card);
  color: var(--accent-ink);
}

.button-ahead {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.button-ahead:hover {
  background: var(--card);
  color: var(--accent-ink);
}

.blog-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  padding: 3rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--fg-subtle);
}

.empty-mark {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  color: var(--border-strong);
}

.empty-mark svg {
  width: 100%;
  height: 100%;
}

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

.site-footer {
  margin-top: 4rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.footer-left a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer-left a:hover {
  color: var(--accent-ink);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--fg-muted);
}

.footer-social a:hover {
  color: var(--accent-ink);
}

.footer-social svg {
  width: 1rem;
  height: 1rem;
}

.footer-meta {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.footer-meta a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer-meta a:hover {
  color: var(--accent-ink);
}

/* Search ------------------------------------------------------------------ */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  background: color-mix(in srgb, #000 38%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.search-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(36rem, 100%);
  max-height: 76vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: 0 32px 80px -32px rgba(0, 0, 0, 0.5);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.search-field svg {
  flex: none;
  width: 1.0625rem;
  height: 1.0625rem;
  color: var(--fg-subtle);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.search-field input::placeholder {
  color: var(--fg-subtle);
}

.search-field:focus-within {
  border-bottom-color: var(--accent-ink);
}

.search-field kbd {
  flex: none;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--fg-subtle);
}

.search-results {
  flex: 1;
  margin: 0;
  padding: 0.5rem;
  overflow-y: auto;
  list-style: none;
}

.search-results li {
  margin: 0;
}

.search-results a {
  display: block;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s var(--ease);
}

.search-results a:hover,
.search-results a.is-active {
  background: var(--muted);
}

.search-results strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
}

.search-results span {
  display: -webkit-box;
  margin-top: 0.2rem;
  overflow: hidden;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--fg-subtle);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-empty,
.search-hint {
  margin: 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.search-hint {
  border-top: 1px solid var(--border);
}

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

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 2px;
  background: var(--accent-ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.1s linear;
  pointer-events: none;
}

/* Lightbox ---------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.78);
  background: color-mix(in srgb, #000 78%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, 0.8);
}

/* Error ------------------------------------------------------------------- */

.error-page {
  padding: 5rem 0;
  text-align: center;
}

.error-code {
  margin: 0;
  font-size: clamp(4rem, 13vw, 7rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  color: transparent;
  opacity: 0.25;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 2px var(--fg);
}

.error-page h1 {
  margin: 1rem 0 0;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.error-detail {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1024px) {
  .page-shell {
    padding: 0 1.75rem;
  }
}

@media (max-width: 860px) {
  .page-shell {
    padding: 0 1.125rem;
  }

  .site-header {
    margin-bottom: 2rem;
  }

  .menu-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
    margin: 0;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
      visibility 0.2s;
  }

  .site-header.nav-open .site-nav {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-item > a {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
  }

  .nav-item > a:hover {
    background: var(--muted);
  }

  .nav-dropdown {
    position: static;
    display: block;
    min-width: 0;
    padding: 0 0 0 0.75rem;
    border: 0;
    box-shadow: none;
    background: transparent;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .hero {
    margin-bottom: 2.5rem;
  }

  .hero h1 {
    font-size: 1.625rem;
  }

  .post-row-link {
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
  }

  .post-row time {
    min-width: 0;
  }

  .post-row-arrow {
    margin-left: auto;
  }

  .post-card-cover {
    width: 100%;
    height: 66%;
    -webkit-mask-image: linear-gradient(
      to top,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 1) 100%
    );
    mask-image: linear-gradient(
      to top,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 1) 100%
    );
  }

  .post-card-inner.has-cover {
    padding-top: 7rem;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav-item.align-right {
    text-align: left;
    align-items: flex-start;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .archive-year-label {
    inset-inline-start: -0.75rem;
    top: -3rem;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 0 1rem;
  }

  .hero-avatar {
    width: 5.5rem;
    height: 5.5rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .section-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .post-card-inner {
    padding: 1rem;
  }

  .post-card-title {
    font-size: 1rem;
  }

  .post-card-arrow {
    top: 1rem;
    right: 1rem;
  }

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

  .post-divider {
    width: 100%;
  }

  .moment-card {
    padding: 1rem;
  }

  .search-modal {
    padding-top: 6vh;
  }

  .archive-year {
    margin-top: 3.5rem;
  }
}

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