:root {
  --width: 740px;
  --font-main: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;

  /* Light palette — Refined editorial alabaster & warm ginger-cat accent */
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-hover: #f7f6f3;
  --subtle-bg: #f3f2ef;
  --heading: #141416;
  --text: #36363c;
  --muted: #71717a;
  --border: #e8e7e3;
  --border-strong: #d4d3ce;
  --accent: #b86234;
  --accent-soft: rgba(184, 98, 52, 0.1);
  --link: #141416;
  --link-underline: rgba(184, 98, 52, 0.45);
  --code-bg: #f5f4f1;
  --code-header: #eeede9;
  --code-text: #27272a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
  --backdrop: rgba(20, 20, 22, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --surface: #17171a;
    --surface-hover: #1d1d21;
    --subtle-bg: #1f1f24;
    --heading: #f4f4f5;
    --text: #c9c9d1;
    --muted: #8a8a96;
    --border: #26262c;
    --border-strong: #383842;
    --accent: #e09162;
    --accent-soft: rgba(224, 145, 98, 0.14);
    --link: #f4f4f5;
    --link-underline: rgba(224, 145, 98, 0.5);
    --code-bg: #18181c;
    --code-header: #202026;
    --code-text: #e4e4e7;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.55);
    --backdrop: rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
  --bg: #111113;
  --surface: #17171a;
  --surface-hover: #1d1d21;
  --subtle-bg: #1f1f24;
  --heading: #f4f4f5;
  --text: #c9c9d1;
  --muted: #8a8a96;
  --border: #26262c;
  --border-strong: #383842;
  --accent: #e09162;
  --accent-soft: rgba(224, 145, 98, 0.14);
  --link: #f4f4f5;
  --link-underline: rgba(224, 145, 98, 0.5);
  --code-bg: #18181c;
  --code-header: #202026;
  --code-text: #e4e4e7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.65);
}

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

html {
  background-color: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 15.5px;
  line-height: 1.8;
  margin: 0 auto;
  padding: 36px 22px 64px;
  max-width: var(--width);
  background-color: var(--bg);
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* Reading Progress Bar (Post Pages) */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 100;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* Header & Line-Art Cat Divider */
header {
  position: relative;
  margin-bottom: 2.75rem;
  padding-bottom: 1.85rem;
  border-bottom: 1px solid var(--border);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--heading);
}

.site-brand:hover .brand-kaomoji {
  color: var(--accent);
}

.brand-title {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand-kaomoji {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

nav a:hover {
  color: var(--heading);
  background-color: var(--subtle-bg);
}

nav a.active {
  color: var(--heading);
  font-weight: 550;
  background-color: var(--subtle-bg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 30px;
  padding: 0 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--heading);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.icon-btn kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Minimalist Line-Art Cat perched on the header divider */
.divider-cat {
  position: absolute;
  right: 14px;
  bottom: -14px;
  width: 56px;
  height: 44px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.divider-cat:hover {
  color: var(--accent);
}

.divider-cat .cat-tail {
  transform-origin: 41px 30px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.divider-cat:hover .cat-tail,
.divider-cat.happy .cat-tail {
  transform: rotate(-14deg);
}

.divider-cat .cat-eyes-open {
  opacity: 1;
  transition: opacity 0.12s ease;
}

.divider-cat .cat-eyes-happy {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.divider-cat:hover .cat-eyes-open,
.divider-cat.happy .cat-eyes-open {
  opacity: 0;
}

.divider-cat:hover .cat-eyes-happy,
.divider-cat.happy .cat-eyes-happy {
  opacity: 1;
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: 680;
}

h1 {
  font-size: 1.7rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.28rem;
  margin: 2.2rem 0 0.75rem;
}

h3 {
  font-size: 1.08rem;
  margin: 1.65rem 0 0.55rem;
}

h4 {
  font-size: 0.98rem;
  margin: 1.35rem 0 0.45rem;
}

.heading-anchor {
  color: var(--muted);
  text-decoration: none;
  margin-left: 0.35rem;
  opacity: 0;
  font-weight: 400;
  font-size: 0.85em;
  transition: opacity 0.15s ease, color 0.15s ease;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 0.75;
}

.heading-anchor:hover {
  color: var(--accent);
}

p {
  margin: 0 0 1.1rem;
}

main a:not(.post-card):not(.tag):not(.nav-card):not(.heading-anchor):not(.section-more):not(.back-link) {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

main a:not(.post-card):not(.tag):not(.nav-card):not(.heading-anchor):not(.section-more):not(.back-link):hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

strong,
b {
  color: var(--heading);
  font-weight: 620;
}

hr {
  border: 0;
  border-top: 1px dashed var(--border-strong);
  margin: 2.25rem 0;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Home Hero / Intro */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.65rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.4rem;
}

.hero p:last-of-type {
  margin-bottom: 0;
}

.hero-stats {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-stats-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hero-stats-group a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.hero-stats-group a:hover {
  color: var(--accent);
}

.hero-dot {
  color: var(--border-strong);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
  color: var(--heading);
}

.section-more {
  font-size: 0.86rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Rich Post Cards */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}

.post-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.post-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.post-card-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 640;
  color: var(--heading);
  transition: color 0.15s ease;
}

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

.post-card-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

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

.post-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mini-tag {
  background: var(--subtle-bg);
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
}

/* Tags Bar */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 1.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--muted);
  background-color: var(--surface);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  transition: all 0.15s ease;
}

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

button.tag {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tag-count {
  font-size: 0.72rem;
  opacity: 0.75;
}

.tag-filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.tag-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  padding: 0.16rem 0.55rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-clear-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.tag-clear-btn[hidden],
.post-card[hidden],
.tag-empty[hidden] {
  display: none;
}

.tag-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Post Header & Meta */
.post-header {
  margin-bottom: 1.8rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

.post-header .tags {
  margin: 0.9rem 0 0;
}

/* Collapsible Table of Contents (TOC) */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1.15rem;
  margin: 0 0 1.85rem;
  font-size: 0.88rem;
}

.toc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--heading);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

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

.toc summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--muted);
  font-weight: 400;
}

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

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0.7rem 0 0;
  border-top: 1px dashed var(--border);
  padding-top: 0.65rem;
}

.toc-list li {
  margin: 0.28rem 0;
}

.toc-list li.toc-h3 {
  padding-left: 1rem;
  font-size: 0.84rem;
}

.toc-list a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Floating Left Collapsible TOC (appears when inline TOC scrolls out) */
.floating-toc {
  position: fixed;
  top: 92px;
  left: max(18px, calc(50% - 370px - 228px));
  width: 204px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, width 0.18s ease, box-shadow 0.2s ease;
}

.floating-toc.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.floating-toc.collapsed {
  width: auto;
}

.floating-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--heading);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.floating-toc-toggle:hover {
  color: var(--accent);
}

.floating-toc-chevron {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.floating-toc.collapsed .floating-toc-chevron {
  transform: rotate(180deg);
}

.floating-toc-body {
  overflow-y: auto;
  padding: 0 0.75rem 0.65rem;
  border-top: 1px dashed var(--border);
}

.floating-toc.collapsed .floating-toc-body {
  display: none;
}

.floating-toc-list {
  list-style: none;
  padding: 0;
  margin: 0.55rem 0 0;
}

.floating-toc-list li {
  margin: 0.22rem 0;
}

.floating-toc-list li.toc-h3 {
  padding-left: 0.75rem;
}

.floating-toc-list a {
  display: block;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  text-decoration: none;
  padding: 0.16rem 0.4rem;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.floating-toc-list a:hover {
  color: var(--heading);
  background: var(--subtle-bg);
}

.floating-toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 550;
}

@media (max-width: 1180px) {
  .floating-toc {
    left: 14px;
    top: 72px;
    box-shadow: var(--shadow-md);
  }
}

/* Markdown Body Elements */
blockquote {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--muted);
  padding: 0.75rem 1.1rem;
  margin: 1.4rem 0;
  border-radius: 0 8px 8px 0;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

blockquote p:last-child {
  margin-bottom: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background-color: var(--subtle-bg);
  color: var(--code-text);
  padding: 0.14em 0.38em;
  border-radius: 5px;
}

/* Code Block with Language Header & Copy Button */
.code-block {
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0.85rem;
  background: var(--code-header);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.code-lang {
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.code-copy {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 0.75rem;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-copy:hover {
  color: var(--heading);
  border-color: var(--border-strong);
  background: var(--surface);
}

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

.code-block pre {
  margin: 0;
  padding: 0.95rem 1.1rem;
  overflow-x: auto;
  line-height: 1.6;
  background: transparent;
}

.code-block pre code {
  background: none;
  padding: 0;
  font-size: 0.84rem;
  color: var(--code-text);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.4rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}

th,
td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

th {
  background-color: var(--subtle-bg);
  color: var(--heading);
  font-weight: 600;
  font-size: 0.86rem;
}

ul,
ol {
  padding-left: 1.45rem;
  margin: 0 0 1.1rem;
}

li {
  margin-bottom: 0.35rem;
}

li > input[type="checkbox"] {
  margin-right: 0.45rem;
  accent-color: var(--accent);
}

/* Pet the Cat & Back Link */
.pet-box {
  margin-top: 2.5rem;
  padding-top: 1.35rem;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pet-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-family: var(--font-main);
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.pet-btn:hover {
  border-color: var(--accent);
  color: var(--heading);
}

.pet-btn:active {
  transform: scale(0.97);
}

.pet-btn.petted {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pet-kaomoji {
  font-family: var(--font-mono);
}

.back-link {
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Prev / Next Navigation Cards */
.post-nav {
  margin-top: 1.65rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nav-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.nav-card.next {
  text-align: right;
  grid-column: 2;
}

.nav-card-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.nav-card-title {
  font-size: 0.92rem;
  font-weight: 580;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

  .nav-card.next {
    grid-column: 1;
    text-align: left;
  }
}

/* Search Modal (⌘K) */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 24px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.search-dialog {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: translateY(-6px);
  transition: transform 0.15s ease;
}

.search-overlay.open .search-dialog {
  transform: translateY(0);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--heading);
  font-family: var(--font-main);
  font-size: 0.96rem;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-esc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.search-results {
  max-height: 52vh;
  overflow-y: auto;
  padding: 0.45rem;
}

.search-item {
  display: block;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.search-item:hover,
.search-item.selected {
  background: var(--subtle-bg);
}

.search-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.search-item-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--heading);
}

.search-item-date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  flex-shrink: 0;
}

.search-item-desc {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* 404 */
.not-found {
  text-align: center;
  padding: 3.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.not-found .big-cat {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

@media (max-width: 600px) {
  body {
    padding: 24px 16px 48px;
  }

  .divider-cat {
    right: 6px;
    width: 48px;
    height: 38px;
  }

  .post-card-top {
    flex-direction: column;
    gap: 0.15rem;
  }
}
