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

:root {
  --primary: #c98292;
  --primary-dark: #9f6572;
  --primary-light: #e6b5c0;
  --primary-bg: rgba(201, 130, 146, 0.13);
  --primary-border: rgba(201, 130, 146, 0.3);
  --bg: #f5f0f2;
  --bg-flat: #f5f0f2;
  --bg-card: rgba(255, 251, 252, 0.72);
  --bg-card-strong: #fffafb;
  --surface-shell: rgba(255, 255, 255, 0.28);
  --surface-core: rgba(255, 251, 252, 0.9);
  --surface-inner-border: rgba(255, 255, 255, 0.66);
  --text: #211f23;
  --text-secondary: #575059;
  --text-muted: #827882;
  --border: rgba(97, 76, 86, 0.18);
  --border-light: rgba(97, 76, 86, 0.1);
  --header-bg: rgba(255, 250, 252, 0.72);
  --modal-bg: #fbfafb;
  --input-bg: rgba(255, 255, 255, 0.76);
  --code-inline-bg: rgba(201, 130, 146, 0.12);
  --code-block-bg: #111217;
  --code-block-border: rgba(201, 130, 146, 0.28);
  --drop-zone-bg: rgba(255, 255, 255, 0.58);
  --font-sans: 'Outfit', 'Avenir Next', 'Trebuchet MS', sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --max-width: 980px;
  --wide-width: 1180px;
  --article-width: 720px;
  --post-toc-width: clamp(10rem, 14vw, 14rem);
  --post-toc-gap: clamp(1.5rem, 2.5vw, 2.75rem);
  --post-side-rail-width: calc(var(--post-toc-width) + var(--post-toc-gap));
  --post-composition-width: calc(var(--article-width) + var(--post-side-rail-width) + var(--post-side-rail-width));
  --radius: 8px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow: 0 22px 68px rgba(72, 44, 56, 0.1);
  --shadow-hover: 0 30px 88px rgba(72, 44, 56, 0.15);
  --glow: 0 0 0 1px rgba(201, 130, 146, 0.25), 0 22px 70px rgba(201, 130, 146, 0.14);
  --sakura-glow: rgba(235, 160, 176, 0.36);
  --sakura-petal-edge: rgba(176, 92, 111, 0.28);
  --sakura-petal-vein: rgba(123, 63, 79, 0.28);
  --sakura-petal-shadow: rgba(201, 102, 126, 0.18);
  --sakura-post-opacity: 0.52;
  --motion-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --transition: 260ms var(--motion-ease);
  --sakura-opacity: 1;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #e0a8b5;
  --primary-dark: #f1c4cd;
  --primary-light: #f7d5dc;
  --primary-bg: rgba(224, 168, 181, 0.12);
  --primary-border: rgba(224, 168, 181, 0.28);
  --bg: #0f0d11;
  --bg-flat: #0f0d11;
  --bg-card: rgba(25, 22, 28, 0.7);
  --bg-card-strong: #1a171e;
  --surface-shell: rgba(255, 228, 235, 0.055);
  --surface-core: rgba(23, 20, 26, 0.86);
  --surface-inner-border: rgba(255, 232, 237, 0.08);
  --text: #f1ebe3;
  --text-secondary: #d2c5c0;
  --text-muted: #9e929b;
  --border: rgba(239, 211, 218, 0.16);
  --border-light: rgba(239, 211, 218, 0.08);
  --header-bg: rgba(24, 20, 27, 0.72);
  --modal-bg: #1a171e;
  --input-bg: rgba(16, 14, 19, 0.82);
  --code-inline-bg: rgba(224, 168, 181, 0.14);
  --code-block-bg: #0b0c10;
  --code-block-border: rgba(224, 168, 181, 0.28);
  --drop-zone-bg: rgba(24, 20, 27, 0.72);
  --shadow: 0 24px 76px rgba(14, 8, 15, 0.36);
  --shadow-hover: 0 34px 96px rgba(14, 8, 15, 0.44);
  --glow: 0 0 0 1px rgba(224, 168, 181, 0.3), 0 22px 70px rgba(224, 168, 181, 0.12);
  --sakura-glow: rgba(244, 183, 196, 0.42);
  --sakura-petal-edge: rgba(255, 218, 228, 0.18);
  --sakura-petal-vein: rgba(255, 223, 232, 0.24);
  --sakura-petal-shadow: rgba(244, 183, 196, 0.18);
  --sakura-post-opacity: 0.42;
  --sakura-opacity: 0.95;
  color-scheme: dark;
}

html {
  font-size: 16px;
  min-height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--text);
  line-height: 1.7;
  background:
    linear-gradient(90deg, rgba(201, 130, 146, 0.045) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(0deg, rgba(201, 130, 146, 0.035) 1px, transparent 1px) 0 0 / 46px 46px,
    radial-gradient(ellipse at 22% 0%, rgba(201, 130, 146, 0.15), transparent 42%),
    radial-gradient(ellipse at 84% 10%, rgba(255, 239, 243, 0.44), transparent 38%),
    var(--bg-flat);
  transition: background 420ms var(--motion-ease), color 420ms var(--motion-ease);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(90deg, rgba(224, 168, 181, 0.045) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(0deg, rgba(224, 168, 181, 0.03) 1px, transparent 1px) 0 0 / 46px 46px,
    radial-gradient(ellipse at 50% -10%, rgba(224, 168, 181, 0.13), transparent 44%),
    radial-gradient(ellipse at 12% 12%, rgba(112, 65, 82, 0.16), transparent 32%),
    var(--bg-flat);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(115deg, transparent 0 19px, rgba(201, 130, 146, 0.055) 20px 21px, transparent 22px 44px);
  opacity: 0.36;
  mix-blend-mode: soft-light;
}

.main-content,
.site-footer {
  position: relative;
  z-index: 2;
}

.sakura-field {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 88dvh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint size;
  opacity: var(--sakura-opacity);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 38%, rgba(0, 0, 0, 0.58) 62%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 38%, rgba(0, 0, 0, 0.58) 62%, transparent 100%);
}

body[data-route="home"] .sakura-field,
body[data-route="folder"] .sakura-field {
  opacity: var(--sakura-opacity);
}

body[data-route="post"] .sakura-field {
  height: 52dvh;
  opacity: var(--sakura-post-opacity);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 28%, rgba(0, 0, 0, 0.45) 66%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 28%, rgba(0, 0, 0, 0.45) 66%, transparent 100%);
}

.sakura-field::before,
.sakura-field::after {
  content: "";
  position: absolute;
  inset: auto auto auto 50%;
  width: min(46rem, 82vw);
  height: 16rem;
  border-radius: 999px;
  transform: translate3d(-50%, -22%, 0);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 28% 42%, rgba(255, 232, 238, 0.18), transparent 46%),
    radial-gradient(ellipse at 70% 42%, var(--sakura-glow), transparent 58%);
  filter: blur(20px);
  opacity: 0.42;
}

.sakura-field::before {
  top: 3rem;
}

.sakura-field::after {
  top: 12rem;
  width: min(34rem, 70vw);
  height: 9rem;
  opacity: 0.22;
  transform: translate3d(-10%, -12%, 0);
}

body[data-route="post"] .sakura-field::before,
body[data-route="post"] .sakura-field::after {
  opacity: 0.18;
}

.sakura-petal {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--petal-size);
  height: calc(var(--petal-size) * 0.68);
  border-radius: 90% 18% 88% 24%;
  background:
    radial-gradient(circle at 30% 32%, rgba(255, 255, 255, 0.72), transparent 24%),
    var(--petal-tint);
  opacity: 0;
  box-shadow:
    0 0 0 1px var(--sakura-petal-edge) inset,
    0 0 12px var(--sakura-petal-shadow);
  filter: drop-shadow(0 0 6px rgba(244, 183, 196, var(--petal-glow)));
  transform: translate3d(var(--petal-x), var(--petal-y), 0) rotate(var(--petal-rotation));
  animation: sakuraDrift var(--petal-duration) var(--motion-ease) var(--petal-delay) infinite;
}

.sakura-petal-glow {
  box-shadow:
    0 0 0 1px var(--sakura-petal-edge) inset,
    0 0 18px rgba(244, 183, 196, 0.2),
    0 0 34px rgba(224, 168, 181, 0.12);
}

.sakura-petal::after {
  content: "";
  position: absolute;
  inset: 35% 12% auto auto;
  width: 46%;
  height: 1px;
  background: var(--sakura-petal-vein);
  transform: rotate(-24deg);
  transform-origin: right center;
}

.sakura-petal-1 {
  border-radius: 22% 86% 28% 88%;
}

.sakura-petal-2 {
  width: calc(var(--petal-size) * 0.72);
  border-radius: 50% 78% 48% 80%;
}

.sakura-petal-3 {
  height: calc(var(--petal-size) * 0.5);
  border-radius: 80% 28% 76% 34%;
}

@keyframes sakuraDrift {
  0% {
    opacity: 0;
    transform: translate3d(var(--petal-x), var(--petal-y), 0) rotate(var(--petal-rotation));
  }
  14% {
    opacity: var(--petal-opacity);
  }
  72% {
    opacity: var(--petal-opacity);
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--petal-x) + var(--petal-drift)), 74vh, 0) rotate(calc(var(--petal-rotation) + 240deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sakura-petal {
    animation: none;
    opacity: 0.14;
  }
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition), text-decoration-color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

:where(a, button, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 500;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  background: var(--bg-card-strong);
  color: var(--text);
  transform: translateY(-140%);
  transition: transform var(--transition);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1rem 0.35rem;
  background: transparent;
  pointer-events: none;
}

.site-header::after {
  display: none;
}

.header-inner {
  width: min(var(--wide-width), calc(100% - 1rem));
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0.48rem 0.55rem 0.48rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--header-bg);
  box-shadow:
    inset 0 1px 0 var(--surface-inner-border),
    0 18px 56px rgba(83, 45, 61, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

.header-right,
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-width: 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  transition: color var(--transition), transform var(--transition);
}

.site-logo:hover {
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.site-logo .accent,
.site-footer .accent {
  color: var(--primary);
}

.logo-mark {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 1px solid var(--primary);
  transform: rotate(45deg);
  position: relative;
  box-shadow: 0 0 18px rgba(214, 161, 173, 0.18);
}

.logo-mark::before,
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 0.45rem;
  height: 1px;
  background: var(--primary);
  transform: translate(-50%, -50%);
}

.logo-mark::after {
  width: 1px;
  height: 0.45rem;
}

.main-content {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.7rem 1.5rem 4.5rem;
  flex: 1;
}

.main-content.wide {
  max-width: calc(var(--post-composition-width) + 3rem);
}

.main-content:focus {
  outline: none;
}

.reveal-in {
  opacity: 0;
  transform: translate3d(0, 1.4rem, 0);
  transition:
    opacity 820ms var(--motion-ease),
    transform 820ms var(--motion-ease);
}

.reveal-in.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.reveal-delay-1 {
  transition-delay: 110ms;
}

.surface-shell,
.card-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 0.42rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 42%),
    var(--surface-shell);
  box-shadow: var(--shadow);
}

.surface-core,
.card-core {
  position: relative;
  height: 100%;
  border: 1px solid var(--surface-inner-border);
  border-radius: calc(var(--radius-xl) - 0.42rem);
  background: var(--surface-core);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(132, 82, 96, 0.04);
}

.home-hero {
  margin: 0 0 1.6rem;
}

.hero-core {
  min-height: 17rem;
  padding: 2.35rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem);
  gap: 2rem;
  align-items: end;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 45%),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(224, 168, 181, 0.045) 22px 23px, transparent 23px 46px),
    var(--surface-core);
}

.hero-core::before {
  content: "";
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 6rem;
  height: 6rem;
  border-top: 1px solid var(--primary-border);
  border-right: 1px solid var(--primary-border);
  opacity: 0.72;
}

.hero-core::after {
  content: "";
  position: absolute;
  left: 1.1rem;
  bottom: 1.1rem;
  width: 7.6rem;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--primary-border) 0 10px, transparent 10px 15px);
}

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

.home-hero h1 {
  max-width: 11ch;
  margin-top: 0.25rem;
  font-family: var(--font-serif);
  font-size: 3.25rem;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: 0;
  text-wrap: balance;
}

.home-hero p {
  max-width: 40rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.8;
  text-wrap: pretty;
}

.hero-mini-panel {
  position: relative;
  z-index: 1;
  justify-self: end;
  width: min(100%, 18rem);
  padding: 0.9rem;
  border: 1px solid var(--primary-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 var(--surface-inner-border);
}

.hero-mini-panel span,
.hero-mini-panel em {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-style: normal;
}

.hero-mini-panel strong {
  display: block;
  margin: 0.35rem 0 0.45rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.25;
}

.index-panel {
  margin-bottom: 0.5rem;
}

.index-core {
  padding: 1.3rem;
}

.kicker {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-title {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
  text-wrap: balance;
}

.page-subtitle {
  margin-top: 0.35rem;
  margin-bottom: 1.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.folder-description {
  margin-bottom: 0;
}

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

.index-header {
  align-items: center;
}

.folder-header {
  margin-bottom: 1.7rem;
}

.folder-header-core {
  padding: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 14rem;
  width: 100%;
  padding: 0.86rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 var(--surface-inner-border);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
}

.search-input::placeholder,
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  padding: 0.48rem 0.64rem 0.48rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px) scale(1.01);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #141114;
  box-shadow: 0 10px 28px rgba(185, 121, 135, 0.18);
}

:root[data-theme="dark"] .btn-primary {
  color: #121015;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--glow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  border-color: var(--border);
}

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

.btn-danger {
  background: rgba(186, 87, 96, 0.08);
  color: #d6828a;
  border-color: rgba(186, 87, 96, 0.28);
}

.btn-danger:hover {
  background: rgba(186, 87, 96, 0.16);
  border-color: rgba(186, 87, 96, 0.45);
}

.btn-sm {
  min-height: 2rem;
  padding: 0.34rem 0.62rem 0.34rem 0.74rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform var(--transition), color var(--transition), border-color var(--transition), background var(--transition);
}

.btn-icon:hover {
  color: var(--primary-dark);
  border-color: var(--primary-border);
  background: var(--primary-bg);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0) scale(0.98);
}

.btn-icon.btn-sm {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
}

.ui-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  transition: transform var(--transition), background var(--transition), color var(--transition);
}

.btn .ui-icon {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0.32rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.btn:hover .ui-icon {
  transform: translate3d(0.08rem, -0.04rem, 0) scale(1.04);
}

.tags-bar,
.post-card-tags,
.post-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tags-bar {
  margin-bottom: 1.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.18rem 0.52rem;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tag:hover,
.tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #151216;
}

.folders-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.folder-card,
.post-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.folder-card::before,
.post-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.folder-card:hover,
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-hover);
  background: rgba(255, 255, 255, 0.08);
}

.folder-card:hover::before,
.post-card:hover::before {
  opacity: 1;
}

.folder-card {
  grid-column: span 1;
  min-height: 12.5rem;
}

.folder-card:first-child {
  grid-column: span 2;
}

.folder-card-core {
  min-height: 12.2rem;
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
}

.folder-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.folder-card-icon {
  width: 2.9rem;
  height: 2.35rem;
  border: 1px solid var(--primary-border);
  border-radius: 5px;
  position: relative;
  background:
    linear-gradient(90deg, transparent 0 42%, var(--primary-border) 42% 43%, transparent 43%),
    var(--primary-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.folder-card-icon::before,
.folder-card-icon::after {
  content: "";
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  height: 1px;
  background: var(--primary-border);
}

.folder-card-icon::before {
  top: 0.72rem;
}

.folder-card-icon::after {
  top: 1.2rem;
}

.folder-card-icon span {
  position: absolute;
  right: 0.38rem;
  bottom: 0.32rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1px solid var(--primary);
  border-bottom: 1px solid var(--primary);
}

.folder-card-name {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
  transition: color var(--transition);
}

.folder-card:hover .folder-card-name,
.post-card:hover .post-card-title {
  color: var(--primary-dark);
}

.folder-card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.55rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.folder-card-count {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 0.18rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
}

.folder-card-actions {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.folder-card:hover .folder-card-actions,
.folder-card:focus-within .folder-card-actions {
  opacity: 1;
}

.posts-grid {
  display: grid;
  gap: 0.9rem;
}

.post-card {
  padding: 0.35rem;
}

.post-card-core {
  padding: 1.05rem 1.15rem;
}

.post-card-kicker {
  margin-bottom: 0.35rem;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-card-title {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
  transition: color var(--transition);
}

.post-card-desc {
  margin-top: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.post-card-tags {
  margin-top: 0.75rem;
}

.post-card-tags .tag {
  font-size: 0.68rem;
}

.empty-state {
  width: 100%;
  padding: 4rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
  text-align: center;
}

.empty-state-wide {
  grid-column: 1 / -1;
}

.empty-state svg {
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: 0.9rem;
  color: var(--primary);
  opacity: 0.65;
}

.empty-state h3 {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.empty-state p {
  max-width: 32rem;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color var(--transition), transform var(--transition);
}

.back-link:hover {
  color: var(--primary-dark);
  transform: translateX(-2px);
}

.post-page-grid {
  width: min(100%, var(--post-composition-width));
  max-width: none;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, var(--post-side-rail-width)) minmax(0, var(--article-width)) minmax(0, var(--post-side-rail-width));
  column-gap: 0;
  row-gap: 1.35rem;
  align-items: start;
}

.post-page-grid-no-toc {
  width: min(100%, var(--article-width));
  max-width: none;
  grid-template-columns: minmax(0, var(--article-width));
}

.post-page-grid-no-toc .post-header,
.post-page-grid-no-toc .post-content,
.post-page-grid-no-toc .toc-mobile-toggle,
.post-page-grid-no-toc .toc-mobile {
  grid-column: 1;
}

.post-header {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: none;
  margin: 0;
}

.post-header-core {
  padding: 1.55rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.breadcrumb a {
  color: var(--text-muted);
  cursor: pointer;
}

.breadcrumb a:hover {
  color: var(--primary-dark);
}

.breadcrumb .sep {
  color: var(--border);
}

.post-title {
  margin-top: 0.45rem;
  margin-bottom: 0.85rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 2.55rem;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: balance;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.post-meta span {
  display: inline-flex;
  align-items: center;
}

.post-meta span + span::before {
  content: "";
  width: 0.22rem;
  height: 0.22rem;
  margin-right: 0.85rem;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
}

.post-tags {
  margin-top: 0.95rem;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.post-content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  width: 100%;
}

.article-shell {
  padding: 0.35rem;
}

.article-core {
  padding: 2rem;
}

.markdown-body {
  max-width: var(--article-width);
  font-size: 1.035rem;
  line-height: 1.88;
  color: var(--text-secondary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  scroll-margin-top: 6rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
}

.markdown-body h1 {
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--primary-border);
  font-size: 1.9rem;
  line-height: 1.2;
}

.markdown-body h2 {
  position: relative;
  margin: 2.1rem 0 0.7rem;
  padding-left: 0.85rem;
  font-size: 1.52rem;
  line-height: 1.25;
}

.markdown-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.markdown-body h3 {
  margin: 1.75rem 0 0.55rem;
  font-size: 1.22rem;
  line-height: 1.3;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.35rem 0 0.45rem;
  font-size: 1.04rem;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin-bottom: 1.18rem;
  text-wrap: pretty;
}

.markdown-body strong {
  color: var(--text);
  font-weight: 600;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.95rem 0 1.35rem;
  padding-left: 1.55rem;
}

.markdown-body li {
  margin-bottom: 0.42rem;
  padding-left: 0.1rem;
}

.markdown-body li::marker {
  color: var(--primary);
}

.markdown-body blockquote {
  margin: 1.45rem 0;
  padding: 1rem 1.1rem 1rem 1.2rem;
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background:
    linear-gradient(90deg, var(--primary-bg), transparent 115%),
    rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  box-shadow: inset 0 1px 0 var(--surface-inner-border);
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.markdown-body :not(pre) > code {
  padding: 0.16em 0.38em;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  background: var(--code-inline-bg);
  color: var(--primary-dark);
  white-space: break-spaces;
}

.markdown-body pre {
  position: relative;
  margin: 1.45rem -0.35rem;
  padding: 3.2rem 1.1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--code-block-border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 3.1rem),
    var(--code-block-bg);
  color: #d8dee9;
  box-shadow: 0 20px 56px rgba(13, 8, 14, 0.24);
  line-height: 1.72;
}

.markdown-body pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.72rem;
  left: 0.9rem;
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.markdown-body pre::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  top: 2.35rem;
  height: 1px;
  background: linear-gradient(90deg, var(--primary-border), transparent);
}

.markdown-body pre code,
.markdown-body pre code.hljs {
  display: block;
  min-width: max-content;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.86rem;
  line-height: inherit;
  tab-size: 2;
}

.code-copy {
  position: absolute;
  top: 0.52rem;
  right: 0.58rem;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8dee9;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.28rem 0.5rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.code-copy:hover {
  border-color: var(--primary-border);
  background: rgba(214, 161, 173, 0.14);
  color: #fff;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  margin: 1.45rem 0;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.45rem 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 0.92rem;
}

.markdown-body th,
.markdown-body td {
  padding: 0.68rem 0.82rem;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: top;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

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

.markdown-body th {
  background: var(--primary-bg);
  color: var(--text);
  font-weight: 600;
}

.markdown-body hr {
  border: 0;
  height: 1px;
  margin: 2.2rem 0;
  background: linear-gradient(90deg, transparent, var(--primary-border), transparent);
}

.markdown-body a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-decoration-color: var(--primary-border);
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  text-decoration-color: var(--primary);
}

.toc-sidebar {
  grid-column: 3;
  grid-row: 2;
  width: var(--post-toc-width);
  margin-left: var(--post-toc-gap);
  justify-self: start;
  position: sticky;
  top: 6.1rem;
  max-height: calc(100dvh - 7.5rem);
  overflow-y: auto;
  padding: 0.7rem 0 0.3rem;
}

.toc-inner {
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-right: 1px solid var(--primary-border);
  border-radius: var(--radius) 0 0 var(--radius);
  background: transparent;
}

.toc-title {
  margin-bottom: 0.55rem;
  padding-right: 0.35rem;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.toc-link {
  display: block;
  margin-right: -0.83rem;
  padding: 0.28rem 0.5rem;
  border-right: 2px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.toc-link:hover,
.toc-link.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.toc-link.active {
  border-right-color: var(--primary);
  font-weight: 600;
}

.toc-link.toc-h3 {
  padding-left: 1.15rem;
  font-size: 0.74rem;
}

.toc-link.toc-h4 {
  padding-left: 1.65rem;
  font-size: 0.7rem;
}

.toc-mobile-toggle {
  grid-column: 2;
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  background: var(--primary-bg);
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}

.toc-mobile-toggle:hover {
  border-color: var(--primary);
  background: rgba(214, 161, 173, 0.18);
}

.toc-mobile {
  grid-column: 2;
  display: none;
  margin-bottom: 1.35rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}

.toc-mobile.open {
  display: block;
}

.toc-mobile .toc-title {
  padding: 0.75rem 1rem 0;
}

.toc-mobile .toc-nav {
  padding: 0.6rem 1rem 0.9rem;
}

.toc-mobile .toc-link {
  margin-left: 0;
  margin-right: 0;
  border-left: 0;
  border-right: 0;
}

.toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-border);
  border-radius: 4px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 8, 10, 0.58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  width: 90%;
  max-width: 35rem;
  max-height: 90dvh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--modal-bg);
  box-shadow: var(--shadow-hover);
  transform: translateY(1rem) scale(0.98);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-sm {
  max-width: 25rem;
}

.modal-md {
  max-width: 29rem;
}

.modal-editor {
  max-width: 44rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.modal-close:hover {
  border-color: var(--border);
  background: var(--primary-bg);
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
}

.form-group {
  margin-bottom: 1.05rem;
}

.form-label {
  display: block;
  margin-bottom: 0.36rem;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
}

.form-muted {
  color: var(--text-muted);
  font-weight: 400;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.66rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
}

.form-textarea {
  min-height: 8rem;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
}

.edit-content-area {
  min-height: 25rem;
}

.form-hint {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.drop-zone {
  padding: 1.55rem 1rem;
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius);
  background: var(--drop-zone-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: inset 0 0 0 1px var(--primary-border);
}

.drop-zone p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.drop-zone .icon {
  width: 2rem;
  height: 2.4rem;
  margin: 0 auto 0.65rem;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  position: relative;
  background: var(--primary-bg);
}

.drop-zone .icon::before,
.drop-zone .icon::after {
  content: "";
  position: absolute;
  left: 0.42rem;
  right: 0.42rem;
  height: 1px;
  background: var(--primary-border);
}

.drop-zone .icon::before {
  top: 0.85rem;
}

.drop-zone .icon::after {
  top: 1.28rem;
}

.drop-zone .file-name {
  margin-top: 0.6rem;
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

.tab-bar {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.tab-bar button {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tab-bar button:hover,
.tab-bar button.active {
  color: var(--text);
  border-color: var(--primary-border);
  background: var(--primary-bg);
}

.admin-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.52rem;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.toast {
  max-width: 22rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  animation: slideIn 0.28s ease;
}

.toast.success {
  border-color: rgba(91, 154, 114, 0.36);
}

.toast.error {
  border-color: rgba(186, 87, 96, 0.42);
  color: #d6828a;
}

@keyframes slideIn {
  from {
    transform: translateX(1rem);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.loading {
  width: 100%;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.spinner {
  width: min(16rem, 100%);
  height: 4.8rem;
  margin: 0 auto 0.85rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(var(--border-light) 1px, transparent 1px) 0 1rem / 100% 0.82rem,
    var(--bg-card);
}

.spinner::before {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  top: 1rem;
  height: 1px;
  background: var(--primary);
  box-shadow: 0 0 16px rgba(214, 161, 173, 0.42);
  animation: scan 1.25s var(--motion-ease) infinite;
}

.spinner::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  bottom: 0.65rem;
  width: 2.8rem;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--primary-border) 0 0.45rem, transparent 0.45rem 0.7rem);
}

@keyframes scan {
  from {
    transform: translateY(-0.75rem);
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: translateY(2.65rem);
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .reveal-in {
    opacity: 1;
    transform: none;
  }
}

.site-footer {
  margin-top: auto;
  padding: 1.4rem 1.5rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.site-footer span:first-child {
  color: var(--text-secondary);
  font-weight: 700;
}

.site-footer span + span::before {
  content: "/";
  margin-right: 0.55rem;
  color: var(--primary-border);
}

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  color: var(--primary-dark);
  border-color: var(--primary-border);
  background: var(--primary-bg);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

.page-title-accent {
  display: inline-block;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.15rem;
}

@media (max-width: 1150px) {
  .post-page-grid,
  .post-page-grid-no-toc {
    width: min(100%, var(--article-width));
    max-width: none;
    display: block;
  }

  .toc-sidebar {
    display: none;
  }

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

  .toc-mobile-toggle {
    display: flex;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .toc-mobile {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 768px) {
  body::before {
    opacity: 0.3;
  }

  .site-header {
    padding: 0.75rem 0.6rem 0.25rem;
  }

  .header-inner {
    width: 100%;
    padding: 0.42rem 0.48rem 0.42rem 0.72rem;
  }

  .site-logo {
    font-size: 0.98rem;
  }

  .main-content {
    padding: 1.1rem 1rem 3rem;
  }

  .surface-shell,
  .card-shell {
    border-radius: 18px;
    padding: 0.32rem;
  }

  .surface-core,
  .card-core {
    border-radius: calc(18px - 0.32rem);
  }

  .home-hero {
    margin-bottom: 1.15rem;
  }

  .hero-core {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1.35rem;
  }

  .home-hero h1 {
    max-width: 100%;
    font-size: 2.25rem;
  }

  .home-hero p {
    font-size: 0.98rem;
  }

  .hero-mini-panel {
    justify-self: stretch;
    width: 100%;
  }

  .index-core,
  .folder-header-core,
  .post-header-core,
  .article-core {
    padding: 1rem;
  }

  .page-title {
    font-size: 1.45rem;
  }

  .section-header,
  .index-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar {
    flex-direction: column;
  }

  .folders-grid {
    grid-template-columns: 1fr;
  }

  .folder-card,
  .folder-card:first-child {
    grid-column: auto;
  }

  .folder-header-core {
    flex-direction: column;
    align-items: stretch;
  }

  .btn span.hide-mobile {
    display: none;
  }

  .folder-card-actions {
    opacity: 1;
  }

  .post-title {
    font-size: 2rem;
  }

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

  .post-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.32rem;
  }

  .post-meta span + span::before {
    display: none;
  }

  .markdown-body {
    font-size: 1rem;
    line-height: 1.82;
  }

  .markdown-body h1 {
    font-size: 1.55rem;
  }

  .markdown-body h2 {
    font-size: 1.32rem;
  }

  .markdown-body pre {
    margin-left: 0;
    margin-right: 0;
    padding: 3rem 0.85rem 1rem;
    border-radius: var(--radius);
  }

  .markdown-body pre code,
  .markdown-body pre code.hljs {
    font-size: 0.82rem;
  }

  .post-actions,
  .form-footer {
    flex-direction: column;
  }

  .post-actions .btn,
  .form-footer .btn {
    width: 100%;
  }

  .modal {
    width: 100%;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .header-inner {
    padding: 0.62rem 0.75rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .site-logo {
    gap: 0.4rem;
  }

  .logo-mark {
    width: 0.86rem;
    height: 0.86rem;
  }

  .hero-core {
    padding: 1.1rem;
  }

  .home-hero h1 {
    font-size: 1.9rem;
  }

  .folder-card,
  .post-card {
    padding: 0.32rem;
  }

  .folder-card-core,
  .post-card-core {
    padding: 1rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .code-copy {
    font-size: 0.64rem;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  body::before,
  .site-header,
  .site-footer,
  .post-actions,
  .breadcrumb,
  .filter-bar,
  .tags-bar,
  .toc-sidebar,
  .toc-mobile,
  .toc-mobile-toggle,
  .code-copy {
    display: none !important;
  }

  .main-content,
  .main-content.wide,
  .post-page-grid,
  .post-layout,
  .post-header,
  .markdown-body {
    max-width: 100%;
  }
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 7px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-border);
}
