@charset "UTF-8";

/* ---------------------------------------------------------------
   Notes / personal site
   Warm paper, ink, violet. Serif for reading, mono for metadata.
   --------------------------------------------------------------- */

:root {
  --bg: #fbf9f4;
  --bg-soft: #f3efe6;
  --bg-elev: #fffdf8;
  --ink: #191521;
  --ink-2: #4f4859;
  --ink-3: #7d7589;
  --line: #e5dfd2;
  --line-strong: #d1c8b6;
  --accent: #5a1fd0;
  --accent-2: #8b5cf6;
  --accent-soft: #efe9ff;
  --mark: #fff0a8;
  --code-bg: #f2eee4;
  --shadow: 0 1px 2px rgba(25, 21, 33, 0.04), 0 18px 40px -24px rgba(25, 21, 33, 0.22);
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC",
    "Source Han Serif SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "Maple Mono NF CN", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --max: 1180px;
  --radius: 10px;
  --head-h: 64px;
}

[data-theme="dark"] {
  --bg: #0c0a11;
  --bg-soft: #121019;
  --bg-elev: #17131f;
  --ink: #ece8f4;
  --ink-2: #b6aec6;
  --ink-3: #837b94;
  --line: #262130;
  --line-strong: #3a3348;
  --accent: #a78bfa;
  --accent-2: #c4b5fd;
  --accent-soft: #1d1533;
  --mark: #4a3b00;
  --code-bg: #14111c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 50px -28px rgba(0, 0, 0, 0.8);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] body::before {
  opacity: 0.05;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em 0;
}

kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.icon {
  flex: none;
  vertical-align: -0.16em;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 400;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.wrap-narrow {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.site-main {
  min-height: 60vh;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 18px 0 0;
  max-width: 56ch;
  font-size: 17.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding-bottom: 1px;
}

.text-link:hover {
  border-color: var(--accent);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-head .eyebrow {
  margin-bottom: 6px;
}

.section-head.compact {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-head.compact h2 {
  font-size: 20px;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

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

.section-link .icon {
  transition: transform 0.2s ease;
}

.section-link:hover .icon {
  transform: translateX(3px);
}

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--head-h);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-head {
    background: var(--bg);
  }
}

.head-inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 40px);
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
}

[data-theme="dark"] .brand-mark {
  background: var(--accent);
  color: #0c0a11;
}

.brand-name {
  font-weight: 600;
}

.brand-slash {
  color: var(--ink-3);
  opacity: 0.6;
}

.brand-section {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.08em;
}

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

.nav-link {
  position: relative;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  padding: 4px 0;
  white-space: nowrap;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 0.22s ease;
}

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

.nav-link:hover::after,
.nav-link.is-active::after {
  right: 0;
}

.nav-link.is-active {
  color: var(--accent);
}

.nav-vault,
.nav-public {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--ink-2);
}

.nav-vault::after,
.nav-public::after {
  display: none;
}

.nav-vault:hover,
.nav-public:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease;
}

.icon-btn:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.theme-icon {
  display: inline-flex;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.menu-toggle,
.explorer-toggle,
.explorer-close {
  display: none;
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(64px, 11vw, 128px) 0 clamp(40px, 6vw, 72px);
}

.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  right: -120px;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 13%, transparent) 0%,
    transparent 66%
  );
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(circle at 78% 26%, #000 0%, transparent 58%);
  opacity: 0.28;
  pointer-events: none;
}

[data-theme="dark"] .hero::after {
  opacity: 0.16;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  max-width: 13ch;
  font-family: var(--serif);
  font-size: clamp(44px, 7.4vw, 92px);
  font-weight: 500;
  line-height: 0.99;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero .lede {
  max-width: 48ch;
  font-size: clamp(16px, 1.6vw, 18.5px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 44px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero-stats strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 11px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

[data-theme="dark"] .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0a11;
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.home-section {
  padding-top: clamp(40px, 6vw, 72px);
}

.home-split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: clamp(32px, 5vw, 72px);
  padding-bottom: 40px;
}

.about-card {
  align-self: start;
  margin-top: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

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

.about-card .eyebrow {
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------
   Clippings
   --------------------------------------------------------------- */

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

.clip-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 26px;
  gap: 18px;
  align-items: start;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.5s both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

.clip-row:first-child {
  border-top: 1px solid var(--line);
}

.clip-date {
  padding-top: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.clip-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.clip-title a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.25s ease, color 0.2s ease;
}

.clip-row:hover .clip-title a {
  color: var(--accent);
  background-size: 100% 1px;
}

.clip-desc {
  margin: 7px 0 0;
  max-width: 78ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

.clip-meta .sep {
  opacity: 0.45;
}

.mini-tag {
  color: var(--ink-3);
}

.mini-tag:hover {
  color: var(--accent);
}

.clip-arrow {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  color: var(--ink-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.clip-row:hover .clip-arrow {
  opacity: 1;
  transform: none;
  color: var(--accent);
}

.archive-head {
  padding-top: clamp(48px, 7vw, 80px);
}

.archive-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 22px;
}

.archive-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 30px;
  padding-bottom: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.chip span {
  color: var(--ink-3);
  font-size: 9px;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip.is-active span {
  color: color-mix(in srgb, var(--bg) 60%, transparent);
}

.archive {
  padding-top: 20px;
  padding-bottom: 60px;
}

.month-group {
  position: relative;
}

.month-label {
  position: sticky;
  top: var(--head-h);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 0 10px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.month-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.month-count {
  font-size: 9px;
  opacity: 0.7;
}

.empty-state {
  padding: 40px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

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

.crumb-sep {
  opacity: 0.45;
}

/* ---------------------------------------------------------------
   Note
   --------------------------------------------------------------- */

.note-head {
  padding-top: clamp(44px, 6vw, 72px);
  padding-bottom: 10px;
}

.note-head h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5.2vw, 60px);
  font-weight: 500;
  line-height: 1.07;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.note-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kicker-badge {
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  color: var(--accent);
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
}

.source-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.note-author {
  color: var(--ink-3);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.tag-count {
  font-size: 8.5px;
  color: var(--ink-3);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}

.note-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
  padding-top: 28px;
}

.note-rail {
  position: sticky;
  top: calc(var(--head-h) + 24px);
  max-height: calc(100vh - var(--head-h) - 48px);
  overflow: auto;
  padding-top: 6px;
}

.rail-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.toc ul {
  margin: 12px 0 0;
  padding: 0 0 0 1px;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
  border-left: 1px solid transparent;
  margin-left: -1px;
}

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

.toc-l3 a {
  padding-left: 24px;
  font-size: 11.5px;
}

.rail-block {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-list {
  margin: 12px 0 0;
}

.detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 11px;
}

.detail-list dt {
  color: var(--ink-3);
}

.detail-list dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-2);
  text-align: right;
}

.source-card {
  display: grid;
  gap: 4px;
  margin-top: 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  transition: border-color 0.18s ease;
}

.source-card:hover {
  border-color: var(--accent);
}

.source-domain {
  font-size: 12px;
  color: var(--ink);
}

.source-url {
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  color: var(--ink-3);
  word-break: break-all;
}

.backlinks {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.backlinks h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-left: 6px;
}

.backlink-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.backlink-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.backlink-list a {
  font-size: 14px;
  color: var(--ink);
}

.backlink-list a:hover {
  color: var(--accent);
}

.backlink-list p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.note-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
}

.pager-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.pager-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pager-next {
  text-align: right;
}

.note-back {
  margin-top: 36px;
  padding-bottom: 20px;
}

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

.prose {
  min-width: 0;
  max-width: 74ch;
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink);
}

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

.prose p {
  margin: 1.05em 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  position: relative;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.22;
  text-wrap: balance;
}

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

.prose h2 {
  margin: 2.6em 0 0.7em;
  padding-top: 0.9em;
  border-top: 1px solid var(--line);
  font-size: 1.55em;
}

.prose h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 34px;
  height: 2px;
  background: var(--accent);
}

.prose h3 {
  margin: 2.1em 0 0.55em;
  font-size: 1.24em;
}

.prose h4 {
  margin: 1.8em 0 0.5em;
  font-family: var(--mono);
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 34%, transparent);
  text-underline-offset: 3px;
}

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

.prose strong {
  font-weight: 650;
}

.prose em {
  font-style: italic;
}

.prose ul,
.prose ol {
  margin: 1em 0;
  padding-left: 1.4em;
}

.prose li {
  margin: 0.35em 0;
}

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

.prose blockquote {
  margin: 1.7em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.08em;
  line-height: 1.75;
  color: var(--ink-2);
}

.prose blockquote p {
  margin: 0.5em 0;
}

.prose code {
  padding: 0.12em 0.38em;
  border-radius: 4px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.86em;
}

.prose pre {
  margin: 1.5em 0;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}

.prose pre code {
  display: block;
  padding: 14px 16px;
  background: transparent;
  font-size: inherit;
}

.code-block {
  margin: 1.7em 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--code-bg);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.copy-code {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

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

.copy-code.is-copied {
  border-color: var(--accent);
  color: var(--accent);
}

.code-block pre {
  margin: 0;
  border-radius: 0;
  background: transparent;
}

.code-block pre.shiki {
  padding: 14px 16px;
  overflow-x: auto;
}

.code-block pre.shiki code {
  padding: 0;
}

.prose pre.shiki,
.code-block pre.shiki {
  background: transparent !important;
}

html[data-theme="light"] .shiki span {
  color: var(--shiki-light) !important;
  background-color: transparent !important;
}

html[data-theme="dark"] .shiki span {
  color: var(--shiki-dark) !important;
  background-color: transparent !important;
}

.prose table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 13.5px;
}

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

.prose th {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.prose tbody tr:hover {
  background: var(--bg-soft);
}

.prose img {
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.prose figure,
.embed {
  margin: 1.8em 0;
}

.prose figure img {
  display: block;
  width: 100%;
}

.prose figcaption {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.6;
  text-align: center;
  color: var(--ink-3);
}

.lightbox {
  display: block;
  cursor: zoom-in;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1.5em 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--ink);
  transition: border-color 0.18s ease;
}

.file-card:hover {
  border-color: var(--accent);
}

.file-ext {
  flex: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.file-name {
  flex: 1;
  font-size: 12.5px;
  word-break: break-all;
}

.file-arrow {
  color: var(--ink-3);
}

.embed-video,
.embed-audio {
  width: 100%;
  margin: 1.5em 0;
  border-radius: 8px;
}

.callout {
  margin: 1.8em 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 3px solid var(--callout-color, var(--accent));
  border-radius: 8px;
  background: var(--bg-elev);
}

.callout-head,
.callout summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.callout summary {
  cursor: pointer;
  list-style: none;
}

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

.callout summary::after {
  content: "+";
  margin-left: auto;
  color: var(--ink-3);
}

.callout[open] summary::after {
  content: "−";
}

.callout-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--callout-color, var(--accent));
  font-weight: 700;
}

.callout-body {
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.75;
}

.callout-body > *:first-child {
  margin-top: 0.4em;
}

.callout-body > *:last-child {
  margin-bottom: 0.4em;
}

.callout-note,
.callout-info {
  --callout-color: var(--accent);
}

.callout-abstract,
.callout-summary,
.callout-tldr {
  --callout-color: #3b6ea5;
}

.callout-tip,
.callout-hint,
.callout-success,
.callout-check,
.callout-done {
  --callout-color: #2f8f5b;
}

.callout-warning,
.callout-caution,
.callout-attention,
.callout-question,
.callout-help,
.callout-faq {
  --callout-color: #b7791f;
}

.callout-danger,
.callout-error,
.callout-failure,
.callout-fail,
.callout-missing,
.callout-bug {
  --callout-color: #c2413a;
}

.callout-example {
  --callout-color: #7c3aed;
}

.callout-quote,
.callout-cite {
  --callout-color: var(--ink-3);
}

.math {
  overflow-x: auto;
  overflow-y: hidden;
}

.math-block {
  margin: 1.6em 0;
  text-align: center;
}

.mermaid-wrap {
  margin: 1.8em 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  text-align: center;
}

.mermaid-wrap svg {
  max-width: 100%;
  height: auto;
}

.prose mark {
  padding: 0 2px;
  background: var(--mark);
  color: inherit;
}

.header-anchor {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.52em;
  color: var(--accent);
  opacity: 0;
  text-decoration: none !important;
  transition: opacity 0.18s ease;
}

.prose h1:hover .header-anchor,
.prose h2:hover .header-anchor,
.prose h3:hover .header-anchor,
.prose h4:hover .header-anchor {
  opacity: 1;
}

.wikilink {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 32%, transparent);
  text-underline-offset: 3px;
}

.private-ref {
  color: var(--ink-3) !important;
  text-decoration: none !important;
  border-bottom: 1px dashed var(--line-strong);
  cursor: help;
}

.private-ref .lock {
  margin-left: 2px;
  font-size: 0.75em;
  opacity: 0.6;
}

.tag-inline {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.86em;
  text-decoration: none !important;
}

.broken-link,
.broken-asset {
  color: #c2413a;
  border-bottom: 1px dotted #c2413a;
}

.footnotes {
  margin-top: 3em;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
}

.footnotes-sep {
  display: none;
}

.task-list-item {
  list-style: none;
}

.task-list-item-checkbox {
  margin-right: 6px;
  accent-color: var(--accent);
}

/* ---------------------------------------------------------------
   Vault shell
   --------------------------------------------------------------- */

.vault-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 216px;
  gap: clamp(24px, 3.4vw, 44px);
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 40px);
  align-items: start;
}

.vault-shell.no-rail {
  grid-template-columns: 248px minmax(0, 1fr);
}

.explorer {
  position: sticky;
  top: var(--head-h);
  max-height: calc(100vh - var(--head-h));
  overflow: auto;
  padding: 20px 16px 40px 0;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.explorer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.explorer-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 10px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-3);
}

.explorer-filter input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink);
}

.explorer-filter input::placeholder {
  color: var(--ink-3);
}

.tree {
  font-size: 12px;
  line-height: 1.5;
}

.tree-fallback {
  display: grid;
  gap: 2px;
}

.tree-fallback a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--ink-2);
}

.tree-fallback a:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.tree-folder {
  margin: 1px 0;
}

.tree-folder-head {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
}

.tree-folder-head:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.tree-toggle {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  color: var(--ink-3);
  transition: transform 0.18s ease;
}

.tree-folder.is-open > .tree-folder-head .tree-toggle {
  transform: rotate(90deg);
}

.tree-children {
  display: none;
  margin-left: 9px;
  padding-left: 7px;
  border-left: 1px solid var(--line);
}

.tree-folder.is-open > .tree-children {
  display: block;
}

.tree-count {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--ink-3);
  opacity: 0.7;
}

.tree-note a {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
}

.tree-note a:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.tree-note.is-active a {
  background: var(--accent-soft);
  color: var(--accent);
}

.tree-note .icon {
  margin-top: 2px;
  opacity: 0.5;
}

.tree-empty {
  padding: 10px 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

.vault-main {
  min-width: 0;
  padding-bottom: 60px;
}

.rail {
  position: sticky;
  top: var(--head-h);
  max-height: calc(100vh - var(--head-h));
  overflow: auto;
  padding-top: 56px;
}

/* ---------------------------------------------------------------
   Vault home
   --------------------------------------------------------------- */

.vault-hero {
  padding-top: clamp(48px, 7vw, 80px);
  padding-bottom: 12px;
}

.vault-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 82px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.vault-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 36px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dash-stats > div {
  display: grid;
  gap: 2px;
  padding-right: 16px;
}

.dash-stats > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.dash-stats strong {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 500;
  line-height: 1;
}

.dash-stats span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.vault-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 28px;
  padding-bottom: 8px;
}

.section-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-elev);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.section-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.section-card-icon {
  grid-row: span 2;
  color: var(--accent);
}

.section-card-name {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.2;
}

.section-card-desc {
  grid-column: 2;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.section-card-count {
  grid-column: 2;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------
   Folder + note lists
   --------------------------------------------------------------- */

.folder-head {
  padding-top: clamp(40px, 6vw, 64px);
  padding-bottom: 16px;
}

.folder-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.folder-body {
  padding-bottom: 60px;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: 18px 0 28px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--ink);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.folder-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.folder-icon {
  color: var(--accent);
}

.folder-name {
  flex: 1;
  font-size: 13px;
}

.folder-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

.note-list {
  border-top: 1px solid var(--line);
}

.note-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.45s both;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.note-row-main {
  min-width: 0;
}

.note-row-main h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.35;
}

.note-row-main h3 a:hover {
  color: var(--accent);
}

.note-row-main p {
  margin: 4px 0 0;
  max-width: 72ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-row-meta {
  display: flex;
  gap: 10px;
  flex: none;
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   Tags
   --------------------------------------------------------------- */

.tag-page .archive-head {
  padding-bottom: 8px;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 340px);
  margin-top: 20px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-3);
}

.inline-filter input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink);
}

.tag-index {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 26px;
  padding-bottom: 64px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

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

.tag-pill-count {
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 8.5px;
  color: var(--ink-3);
}

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

.search-head {
  padding-top: clamp(44px, 6vw, 72px);
  padding-bottom: 8px;
}

.search-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding: 10px 0;
  border-bottom: 2px solid var(--ink);
  color: var(--ink-3);
}

.search-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: clamp(19px, 2.4vw, 26px);
  color: var(--ink);
}

.search-form input::placeholder {
  color: var(--ink-3);
  opacity: 0.65;
}

.search-hint {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
}

.search-results {
  padding-top: 24px;
  padding-bottom: 80px;
}

.result {
  display: block;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.35s both;
}

.result-title {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink);
}

.result:hover .result-title {
  color: var(--accent);
}

.result-excerpt {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

.result-kind {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result mark,
.palette-item mark {
  background: var(--mark);
  color: inherit;
  padding: 0 1px;
}

/* ---------------------------------------------------------------
   Palette
   --------------------------------------------------------------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 300;
}

.palette[hidden] {
  display: none;
}

.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 17, 0.46);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.palette-panel {
  position: relative;
  width: min(92vw, 640px);
  margin: 11vh auto 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  animation: palette-in 0.18s ease both;
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}

.palette-input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
}

.palette-results {
  max-height: 52vh;
  overflow: auto;
}

.palette-item {
  display: grid;
  gap: 2px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.palette-item:last-child {
  border-bottom: 0;
}

.palette-item.is-selected,
.palette-item:hover {
  background: var(--accent-soft);
}

.palette-title {
  font-size: 13.5px;
  line-height: 1.4;
}

.palette-meta {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.palette-empty {
  padding: 28px 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: center;
  color: var(--ink-3);
}

.palette-foot {
  display: flex;
  gap: 14px;
  padding: 7px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------
   Graph
   --------------------------------------------------------------- */

.graph-head {
  padding-top: clamp(36px, 5vw, 56px);
  padding-bottom: 12px;
}

.graph-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.graph-filter {
  margin-top: 0;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.graph-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.graph-legend .dot {
  width: 7px;
  height: 7px;
}

.dot-areas {
  background: #7c5cff;
}

.dot-resources {
  background: #2f9e8f;
}

.dot-life {
  background: #d08a3e;
}

.graph-hint {
  margin-left: auto;
  opacity: 0.8;
}

.graph-stage {
  position: relative;
  height: calc(100vh - 230px);
  min-height: 520px;
  margin: 8px clamp(20px, 4vw, 40px) 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: radial-gradient(
      circle at 30% 20%,
      color-mix(in srgb, var(--accent) 7%, transparent),
      transparent 55%
    ),
    var(--bg-elev);
}

#graph-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#graph-svg.is-dragging {
  cursor: grabbing;
}

.graph-link {
  stroke: var(--line-strong);
  stroke-width: 0.8;
  opacity: 0.45;
}

.graph-node circle {
  stroke: var(--bg-elev);
  stroke-width: 1.4;
  cursor: pointer;
  transition: opacity 0.18s ease, r 0.18s ease;
}

.graph-node text {
  fill: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  paint-order: stroke;
  stroke: var(--bg-elev);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.graph-node.is-dim {
  opacity: 0.12;
}

.graph-node.is-active circle {
  stroke: var(--accent);
  stroke-width: 2.4;
}

.graph-tools {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.graph-tooltip {
  position: absolute;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 9.5px;
  pointer-events: none;
  transform: translate(-50%, -140%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   About / 404
   --------------------------------------------------------------- */

.about-hero {
  padding-top: clamp(44px, 6vw, 72px);
  padding-bottom: 16px;
}

.about-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(44px, 6vw, 68px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.about-prose {
  padding-top: 16px;
  padding-bottom: 80px;
}

.not-found {
  padding: clamp(80px, 14vw, 160px) 0;
}

.not-found h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

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

.site-foot {
  margin-top: clamp(48px, 8vw, 96px);
  border-top: 1px solid var(--line);
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 40px) 40px;
}

.foot-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

.foot-links a,
.foot-private {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
}

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

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

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kind-note .reading-progress {
  opacity: 1;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

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

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 8, 14, 0.94);
  cursor: zoom-out;
  animation: fade-in 0.2s ease both;
}

.lightbox-overlay img {
  max-width: 94vw;
  max-height: 90vh;
  border: 0;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  opacity: 0.7;
}

.lightbox-close:hover {
  opacity: 1;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

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

@media (max-width: 1180px) {
  .vault-shell {
    grid-template-columns: 220px minmax(0, 1fr) 196px;
    gap: 26px;
  }
  .vault-shell.no-rail {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 1040px) {
  .note-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .note-rail {
    display: none;
  }
  .vault-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .vault-shell .rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-grid;
  }
  .explorer-toggle {
    display: inline-grid;
  }
  .site-nav {
    display: none;
  }
  .site-nav.is-open {
    position: fixed;
    top: var(--head-h);
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin: 0;
    padding: 10px 24px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-elev);
    box-shadow: var(--shadow);
  }
  .site-nav.is-open .nav-link {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
  }
  .site-nav.is-open .nav-link:last-child {
    border-bottom: 0;
  }
  .site-nav.is-open .nav-vault,
  .site-nav.is-open .nav-public {
    border: 0;
    border-radius: 0;
    padding: 10px 0;
  }
  .vault-shell,
  .vault-shell.no-rail {
    display: block;
    padding-inline: 0;
  }
  .explorer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 150;
    width: min(86vw, 330px);
    max-height: none;
    padding: 18px 16px 40px;
    border-right: 1px solid var(--line);
    background: var(--bg);
    transform: translateX(-102%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow);
  }
  .explorer.is-open {
    transform: none;
  }
  .explorer-close {
    display: inline-grid;
  }
  .vault-main {
    padding-inline: clamp(20px, 4vw, 40px);
  }
  .home-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .about-card {
    margin-top: 8px;
  }
  .graph-stage {
    height: calc(100vh - 260px);
  }
}

@media (max-width: 760px) {
  :root {
    --head-h: 58px;
  }
  .brand-section {
    display: none;
  }
  .hero h1 {
    max-width: 11ch;
  }
  .clip-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0;
  }
  .clip-arrow {
    display: none;
  }
  .clip-desc {
    -webkit-line-clamp: 3;
  }
  .archive-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .archive-title .search-cta {
    align-self: flex-start;
  }
  .note-pager {
    grid-template-columns: 1fr;
  }
  .pager-next {
    text-align: left;
  }
  .dash-stats {
    grid-template-columns: 1fr 1fr;
    gap: 14px 0;
  }
  .dash-stats > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .vault-sections {
    grid-template-columns: 1fr;
  }
  .note-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .note-row-main {
    width: 100%;
  }
  .note-row-meta {
    padding-top: 0;
  }
  .graph-legend .graph-hint {
    display: none;
  }
  .graph-stage {
    margin-inline: 14px;
  }
  .foot-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .graph-node text {
    display: none;
  }
  .hero-stats {
    gap: 9px;
    font-size: 9px;
  }
  .hero-stats strong {
    font-size: 10px;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar {
    display: none;
  }
  .chip {
    flex: none;
  }
  .search-form input {
    font-size: 17px;
  }
  .palette-panel {
    margin-top: 6vh;
  }
  .prose {
    font-size: 16px;
  }
  .callout-body {
    padding-inline: 12px;
  }
}

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

@media print {
  :root {
    --bg: #fff;
    --bg-elev: #fff;
    --bg-soft: #fff;
    --ink: #000;
    --ink-2: #222;
    --ink-3: #555;
    --line: #ccc;
    --accent: #000;
  }
  body::before,
  .site-head,
  .site-foot,
  .explorer,
  .rail,
  .note-rail,
  .palette,
  .reading-progress,
  .note-pager,
  .note-back,
  .skip-link {
    display: none !important;
  }
  .note-layout {
    display: block;
    padding: 0;
  }
  .prose {
    max-width: none;
    font-size: 11pt;
  }
  .prose a {
    color: #000;
  }
  .prose h2 {
    break-after: avoid;
  }
  .callout,
  .code-block,
  figure {
    break-inside: avoid;
  }
}
