/* ==========================================================================
   GeoBlog Modern UI — Design Tokens, Light/Dark Mode, Grid & Mobile-First
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Surface & Background */
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #f0f3f7;
  --surface-glass: rgba(255, 255, 255, 0.84);

  /* Typography */
  --text: #1f2328;
  --text-secondary: #4b5563;
  --text-muted: #5f6975;

  /* Brand Accent (WCAG AA >= 4.5:1 on white) */
  --accent: #007b8a;
  --accent-hover: #00626e;
  --accent-decor: #00b3c6;
  --accent-soft: rgba(0, 179, 198, 0.10);

  /* Borders & Shadows */
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.14);

  /* Radii & Motion */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Fonts */
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Comments bridge */
  --card: var(--surface);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --surface: #161c23;
    --surface-elevated: #1d252e;
    --surface-muted: #1e2630;
    --surface-glass: rgba(22, 28, 35, 0.86);

    --text: #e6edf3;
    --text-secondary: #adbac7;
    --text-muted: #8b949e;

    --accent: #38d9e8;
    --accent-hover: #64e5f1;
    --accent-decor: #38d9e8;
    --accent-soft: rgba(56, 217, 232, 0.13);

    --border: rgba(240, 246, 252, 0.10);
    --border-strong: rgba(240, 246, 252, 0.18);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #161c23;
  --surface-elevated: #1d252e;
  --surface-muted: #1e2630;
  --surface-glass: rgba(22, 28, 35, 0.86);

  --text: #e6edf3;
  --text-secondary: #adbac7;
  --text-muted: #8b949e;

  --accent: #38d9e8;
  --accent-hover: #64e5f1;
  --accent-decor: #38d9e8;
  --accent-soft: rgba(56, 217, 232, 0.13);

  --border: rgba(240, 246, 252, 0.10);
  --border-strong: rgba(240, 246, 252, 0.18);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* ---------- Reset & Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 var(--sans);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

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

button {
  font: inherit;
  color: inherit;
}

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* Reading Progress Bar */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent-decor), var(--accent));
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 120;
  pointer-events: none;
}

/* ---------- Sticky Glass Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 0;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  transition: transform 0.22s var(--ease);
}

.brand:hover .brand-logo {
  transform: scale(1.06);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* Desktop Navigation */
.desktop-nav {
  display: flex;
  align-items: center;
  margin-left: 12px;
  flex: 1;
  min-width: 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu > li {
  position: relative;
}

.nav-menu > li > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-menu .has-children > a::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  margin-left: 2px;
  opacity: 0.7;
}

.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
  z-index: 80;
}

.nav-menu li.has-children:hover > .sub-menu,
.nav-menu li.has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu .sub-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-menu .sub-menu a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.search-pill {
  position: relative;
  display: flex;
  align-items: center;
}

.search-pill .ico {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-pill input[type="search"] {
  width: 190px;
  height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: width 0.22s var(--ease), border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.search-pill input[type="search"]:focus {
  width: 240px;
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

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

.mobile-only {
  display: none;
}

/* Mobile Search Panel */
.mobile-search-panel {
  padding: 10px 0 14px;
  border-top: 1px solid var(--border);
}

.mobile-search-form {
  display: flex;
  gap: 8px;
}

.mobile-search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* Prevents iOS zoom */
}

.mobile-search-form button {
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Mobile Slide-out Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.drawer-backdrop.open {
  opacity: 1;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(300px, 84vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateX(100%);
  transition: transform 0.25s var(--ease);
  overflow-y: auto;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
}

.drawer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.drawer-nav a:hover,
.drawer-nav li.current-menu-item > a {
  background: var(--accent-soft);
  color: var(--accent);
}

.drawer-nav .sub-menu {
  list-style: none;
  margin: 2px 0 6px 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.drawer-nav .sub-menu a {
  min-height: 40px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ---------- Geo Contour Home Hero ---------- */

.geo-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 260px at 85% -20%, var(--accent-soft), transparent 65%),
    var(--surface);
  padding: 22px 0;
}

.geo-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160' viewBox='0 0 240 160'%3E%3Cg fill='none' stroke='%2300b3c6' stroke-opacity='0.14' stroke-width='1'%3E%3Cpath d='M0 30 Q60 10 120 35 T240 28'/%3E%3Cpath d='M0 70 Q70 50 140 75 T240 65'/%3E%3Cpath d='M0 115 Q55 95 125 118 T240 110'/%3E%3Cpath d='M40 0 V160 M120 0 V160 M200 0 V160' stroke-dasharray='3 4'/%3E%3C/g%3E%3C/svg%3E");
}

.geo-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.geo-hero-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.geo-hero-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.geo-hero-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  transition: all 0.16s var(--ease);
}

.chip-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ---------- Main Two-Column Grid ---------- */

.preview-notice {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.layout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
  padding-top: 24px;
  padding-bottom: 48px;
}

.layout-content {
  min-width: 0;
}

/* ---------- Feed List & Cards ---------- */

.feed-list-head {
  padding: 18px 22px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.feed-list-head h1,
.feed-list-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.feed-list-head p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-card {
  display: flex;
  gap: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.feed-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.feed-card-thumb {
  position: relative;
  flex-shrink: 0;
  width: 224px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.feed-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease);
}

.feed-card:hover .feed-card-thumb img {
  transform: scale(1.04);
}

.feed-card-thumb-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, var(--accent-soft), var(--surface-muted)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M0 32 H64 M32 0 V64' stroke='%2300b3c6' stroke-opacity='0.18' stroke-width='1'/%3E%3Ccircle cx='32' cy='32' r='16' fill='none' stroke='%2300b3c6' stroke-opacity='0.18' stroke-width='1'/%3E%3C/svg%3E");
  color: var(--accent);
}

.feed-card-cat {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  line-height: 1.5;
}

.feed-card-cat:empty {
  display: none;
}

.feed-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.feed-card-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.feed-card-title a {
  color: var(--text);
}

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

.feed-card-excerpt {
  margin: 0 0 auto;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-card-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.feed-card-topic {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.feed-card-topic:hover {
  background: var(--accent);
  color: #fff;
}

.feed-card-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.feed-card-time .ico {
  width: 13px;
  height: 13px;
}

/* Pagination */
.pager-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.16s var(--ease);
}

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

.pager-btn.next {
  margin-left: auto;
}

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

.sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-head .ico {
  color: var(--accent);
}

.ad-placeholder {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 250px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hot-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hot-rank-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.hot-rank-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hot-rank-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}

.hot-rank-item:nth-child(1) .hot-rank-num,
.hot-rank-item:nth-child(2) .hot-rank-num,
.hot-rank-item:nth-child(3) .hot-rank-num {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-decor), var(--accent));
}

.hot-rank-thumb {
  flex-shrink: 0;
  width: 64px;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.hot-rank-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hot-rank-thumb-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-muted));
}

.hot-rank-info {
  flex: 1;
  min-width: 0;
}

.hot-rank-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 4px;
}

.hot-rank-item-title:hover {
  color: var(--accent);
}

.hot-rank-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Desktop Sticky TOC */
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list a {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
}

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

.toc-list .toc-h3 a {
  padding-left: 20px;
  font-size: 12.5px;
}

/* ---------- Single Post & Pages ---------- */

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  min-width: 0;
}

.post-header {
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.post-title {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.post-title a {
  color: inherit;
}

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

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.post-meta a {
  color: var(--accent);
  font-weight: 500;
}

/* Mobile Collapsible TOC */
.post-toc-mobile {
  display: none;
  margin-bottom: 20px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.post-toc-mobile summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.post-toc-mobile .toc-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  max-height: none;
}

/* Prose Typography */
.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  min-width: 0;
}

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

.post-content p {
  margin: 0 0 1.15em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 1.8em 0 0.7em;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text);
  scroll-margin-top: 82px;
}

.post-content h2 {
  font-size: 22px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.post-content h3 {
  font-size: 18.5px;
}

.post-content h4 {
  font-size: 16.5px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}

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

.post-content ul,
.post-content ol {
  margin: 0 0 1.2em;
  padding-left: 1.5em;
}

.post-content li + li {
  margin-top: 0.35em;
}

.post-content blockquote {
  margin: 1.4em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
}

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

.post-content code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.code-block-wrap {
  position: relative;
  margin: 1.4em 0;
  border-radius: var(--radius-md);
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.code-block-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #c9d1d9;
  font: inherit;
  font-size: 11px;
  text-transform: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.post-content pre {
  margin: 1.4em 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #161b22;
  color: #e6edf3;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
}

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

.post-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.post-content img {
  margin: 1.2em auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.post-content iframe,
.post-content video {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: var(--radius-md);
}

/* Responsive Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.post-content th,
.post-content td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background: var(--surface-muted);
  font-weight: 650;
  white-space: nowrap;
}

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

/* AdSense Slots (CLS prevention) */
.ad-slot {
  min-height: 250px;
  margin: 1.6em 0;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 100%;
}

.ad-slot .adsbygoogle {
  max-width: 100% !important;
}

/* Post Category & Tags Footer */
.post-cat-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.post-cat-tags p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.post-cat-tags a {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
}

.post-cat-tags a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Prev / Next Post Cards */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

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

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

.post-nav-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.post-nav-title {
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* ---------- Archive / Categories / Tags / 404 ---------- */

.archive-year {
  margin-top: 24px;
}

.archive-year h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.term-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.term-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}

.term-list li:last-child {
  border-bottom: 0;
}

.term-list a {
  color: var(--text);
  font-weight: 500;
  line-height: 1.45;
}

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

.term-list .date {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.16s var(--ease);
}

.tag-cloud a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tag-cloud small {
  opacity: 0.75;
  font-size: 12px;
}

.error-page {
  text-align: center;
  padding: 40px 24px;
}

.error-code {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 12px;
}

.error-page .mobile-search-form {
  max-width: 420px;
  margin: 20px auto;
}

/* Lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  cursor: zoom-out;
}

.img-lightbox img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

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

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.footer-col h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-col a {
  font-size: 13.5px;
  color: var(--text-secondary);
}

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

.footer-tags {
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 6px !important;
}

.footer-tags a {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 12.5px;
}

.footer-tags a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.textwidget {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.credits {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--text-muted);
}

.credits-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.credits a {
  color: var(--text-secondary);
}

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

.tothetop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

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

/* ==========================================================================
   Responsive Breakpoints: 1024px | 768px | 480px
   ========================================================================== */

@media (max-width: 1024px) {
  .layout-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .toc-card-desktop {
    display: none;
  }

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

@media (max-width: 768px) {
  .desktop-nav,
  .search-pill,
  .brand-desc {
    display: none;
  }

  .mobile-only {
    display: inline-grid;
  }

  .header-bar {
    height: 56px;
  }

  .container {
    padding-inline: 16px;
  }

  .geo-hero {
    padding: 16px 0;
  }

  .geo-hero-title {
    font-size: 19px;
  }

  .article-card {
    padding: 20px 18px;
  }

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

  .post-nav {
    grid-template-columns: 1fr;
  }

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

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (max-width: 640px) {
  /* Featured 1st card: wide 16:9 top thumbnail */
  .feed-list .feed-card:first-child {
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .feed-list .feed-card:first-child .feed-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  /* Compact cards from 2nd onwards: left text + right small thumb */
  .feed-list .feed-card:not(:first-child) {
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    padding: 14px;
  }

  .feed-list .feed-card:not(:first-child) .feed-card-thumb {
    width: 108px;
    aspect-ratio: 3 / 2;
    border-radius: var(--radius-sm);
  }

  .feed-list .feed-card:not(:first-child) .feed-card-thumb.is-empty {
    display: none;
  }

  .feed-list .feed-card:not(:first-child) .feed-card-cat {
    display: none;
  }

  .feed-list .feed-card:not(:first-child) .feed-card-excerpt {
    display: none;
  }

  .feed-list .feed-card:not(:first-child) .feed-card-title {
    font-size: 15.5px;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .feed-list .feed-card:not(:first-child) .feed-card-meta {
    margin-top: 4px;
    gap: 6px 10px;
  }

  .tag-cloud a {
    padding: 8px 14px;
    min-height: 40px;
  }

  .term-list li {
    flex-direction: column;
    gap: 3px;
  }
}
