/*
Theme Name: Spaceship Manual
Theme URI: https://github.com/spaceship-manual
Author: Spaceship
Author URI: https://spaceship.example.com
Description: A modern, feature-rich documentation theme for WordPress.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: spaceship-manual
Tags: documentation, manual, two-columns, left-sidebar, custom-colors, custom-menu
*/

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  /* Brand — Sky Blue / Teal */
  --color-primary:       #0284C7;
  --color-primary-dark:  #0369A1;
  --color-primary-light: #38BDF8;
  --color-primary-bg:    #F0F9FF;
  --color-primary-ring:  rgba(2,132,199,.18);
  --color-accent:        #0D9488;

  /* Semantic */
  --color-success:  #10B981;
  --color-warning:  #F59E0B;
  --color-danger:   #EF4444;
  --color-info:     #0EA5E9;
  --color-note:     #7C3AED;

  /* Background */
  --bg:           #FFFFFF;
  --bg-alt:       #F8FAFC;
  --bg-hover:     #F1F5F9;
  --bg-active:    #F0F9FF;

  /* Sidebar */
  --sidebar-bg:         #F1F5F9;
  --sidebar-width:      288px;
  --sidebar-border:     #E2E8F0;

  /* Text */
  --text:         #0F172A;
  --text-secondary: #334155;
  --text-muted:   #64748B;
  --text-light:   #94A3B8;
  --text-xlight:  #CBD5E1;

  /* Border */
  --border:       #E2E8F0;
  --border-strong: #CBD5E1;

  /* Code */
  --code-bg:      #1A1F2E;
  --code-text:    #E2E8F0;
  --inline-code-bg:   #F0F9FF;
  --inline-code-text: #0369A1;

  /* Typography */
  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Sizing */
  --header-height:     58px;
  --content-max:       820px;
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  20px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md:  0 8px 24px rgba(0,0,0,.10), 0 3px 8px rgba(0,0,0,.04);
  --shadow-lg:  0 16px 40px rgba(0,0,0,.12), 0 6px 12px rgba(0,0,0,.05);
  --shadow-inner: inset 0 1px 3px rgba(0,0,0,.06);

  /* Motion */
  --ease:     cubic-bezier(.16,1,.3,1);
  --ease-out: cubic-bezier(.22,1,.36,1);
  --t:        150ms;
  --t-slow:   300ms;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: 'palt';
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--color-primary-dark); }
button { cursor: pointer; font-family: inherit; }
ul, ol { padding-left: 1.5rem; }
::selection { background: var(--color-primary); color: #fff; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Layout Shell
   ============================================================ */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-height);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 100;
}

/* Left zone — same width as sidebar */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: none;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: background var(--t), color var(--t);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; }

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  min-width: 0;
}

.site-logo img { height: 30px; width: auto; border-radius: var(--radius-sm); }

.site-logo-placeholder {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8125rem;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(2,132,199,.3);
}

.site-title-text {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-tagline {
  font-size: 0.6875rem;
  color: var(--text-light);
  line-height: 1;
  margin-top: 1px;
}

/* Center zone — search */
.header-center {
  flex: 1;
  max-width: 480px;
}

/* Right zone */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

/* ============================================================
   Search
   ============================================================ */
.search-wrapper { position: relative; width: 100%; }

.search-input {
  width: 100%;
  height: 36px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0 2.25rem 0 2.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  outline: none;
}
.search-input::placeholder { color: var(--text-light); }
.search-input:focus {
  border-color: var(--color-primary-light);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.search-icon {
  position: absolute;
  left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  width: 15px; height: 15px;
}

.search-kbd {
  position: absolute;
  right: 0.75rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.6875rem;
  color: var(--text-light);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-family: var(--font-mono);
  pointer-events: none;
  line-height: 1.6;
}

/* Search dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.search-results-dropdown.active { display: block; }

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
  color: var(--text);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item.focused { background: var(--bg-alt); }

.search-result-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.search-result-excerpt {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-meta {
  display: flex;
  gap: 0.375rem;
  margin-top: 3px;
  font-size: 0.6875rem;
  color: var(--text-light);
  align-items: center;
}
.search-result-meta-badge {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
}
.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============================================================
   Header Buttons
   ============================================================ */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  transition: all var(--t);
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}
.icon-btn svg { width: 16px; height: 16px; }

/* Version badge */
.version-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.175rem 0.5rem;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid rgba(2,132,199,.2);
  border-radius: 999px;
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ============================================================
   User menu
   ============================================================ */
.user-menu { position: relative; }

.user-avatar-btn {
  display: flex; align-items: center; gap: 0.4375rem;
  height: 32px;
  padding: 0 0.5rem 0 0.3125rem;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
}
.user-avatar-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}
.user-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem; font-weight: 800;
  color: #fff; flex-shrink: 0;
}
.user-avatar-btn svg { width: 13px; height: 13px; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 196px;
  z-index: 200;
  display: none;
  overflow: hidden;
}
.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: 0.875rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.user-dropdown-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.user-dropdown-item {
  display: flex; align-items: center; gap: 0.5625rem;
  padding: 0.5625rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--t);
  background: none; border: none;
  width: 100%; cursor: pointer;
  font-family: inherit; text-align: left;
}
.user-dropdown-item:hover { background: var(--bg-alt); color: var(--text); }
.user-dropdown-item svg { width: 14px; height: 14px; color: var(--text-light); flex-shrink: 0; }
.user-dropdown-item.danger:hover { background: rgba(239,68,68,.06); color: var(--color-danger); }
.user-dropdown-item.danger:hover svg { color: var(--color-danger); }

/* ============================================================
   Sidebar — E-learning Course Outline Style
   ============================================================ */
.site-sidebar {
  position: fixed;
  top: var(--header-height); left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto; overflow-x: hidden;
  z-index: 50;
  display: flex; flex-direction: column;
  transition: transform var(--t-slow) var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.site-sidebar::-webkit-scrollbar { width: 4px; }
.site-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-inner { padding: 0.5rem 0 2rem; flex: 1; }

/* Section label — separates top-level groups */
.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 1.5rem 1.25rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-section-label::before { display: none; }

/* Nav container */
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0; }

/* ── Top-level chapter toggle (depth 0) ── */
.sidebar-nav > ul > li { padding: 0 0.625rem 0.125rem; }

.sidebar-nav > ul > li > .nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 0.875rem;
  font-size: 0.875rem; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left; cursor: pointer;
  transition: all var(--t);
  gap: 0.5rem;
  box-shadow: var(--shadow-xs);
}
.sidebar-nav > ul > li > .nav-group-toggle:hover {
  border-color: var(--color-primary-light);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.sidebar-nav > ul > li > .nav-group-toggle[aria-expanded="true"] {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
  box-shadow: none;
}

/* ── Second-level section toggle (depth 1) ── */
.sidebar-nav .sub-menu { padding: 0.25rem 0 0.375rem; }
.sidebar-nav .sub-menu .nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 0.3125rem 0.75rem 0.3125rem 1rem;
  font-size: 0.8125rem; font-weight: 600;
  color: var(--text-muted);
  background: none; border: none;
  text-align: left; cursor: pointer;
  transition: all var(--t);
  gap: 0.5rem;
  border-radius: var(--radius);
  letter-spacing: 0.01em;
}
.sidebar-nav .sub-menu .nav-group-toggle:hover {
  background: rgba(2,132,199,.06);
  color: var(--color-primary-dark);
}
.sidebar-nav .sub-menu .nav-group-toggle[aria-expanded="true"] {
  color: var(--color-primary-dark);
}

.nav-group-label {
  display: flex; align-items: center; gap: 0.5rem;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-group-label svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .6; }

.toggle-icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--text-light);
  transition: transform var(--t) var(--ease);
}
.nav-group-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(90deg); }

.nav-group-items { overflow: hidden; }
.nav-group-items[hidden] { display: none; }

/* ── Lesson links (posts) ── */
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 0.75rem 0.375rem 1.5rem;
  font-size: 0.875rem; line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all var(--t);
  position: relative;
}
/* Lesson dot */
.sidebar-nav a::before {
  content: '';
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--text-xlight);
  background: transparent;
  transition: all var(--t);
}
.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(2,132,199,.07);
}
.sidebar-nav a:hover::before {
  border-color: var(--color-primary-light);
}
.sidebar-nav a.current-menu-item,
.sidebar-nav a[aria-current="page"] {
  color: var(--color-primary-dark);
  background: var(--color-primary-bg);
  font-weight: 600;
}
.sidebar-nav a.current-menu-item::before,
.sidebar-nav a[aria-current="page"]::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(2,132,199,.2);
  width: 7px; height: 7px;
}

/* 3rd-level links */
.sidebar-nav .sub-menu .sub-menu a {
  padding-left: 2rem;
  font-size: 0.8125rem;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.75rem;
  color: var(--text-light);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-footer a { color: var(--text-light); text-decoration: none; transition: color var(--t); }
.sidebar-footer a:hover { color: var(--text-muted); }

/* ============================================================
   Main Content
   ============================================================ */
.site-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-with-toc {
  display: grid;
  grid-template-columns: 1fr 256px;
  gap: 3.5rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
  width: 100%;
  align-items: start;
}

.content-full-width {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
  width: 100%;
}

/* ============================================================
   Breadcrumbs
   ============================================================ */
.breadcrumbs {
  display: flex; align-items: center; gap: 0.25rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumbs a { color: var(--text-muted); transition: color var(--t); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumb-sep { color: var(--text-xlight); margin: 0 0.125rem; }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ============================================================
   Article Header — Lesson Style
   ============================================================ */
.entry-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.entry-label {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid rgba(2,132,199,.2);
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}

.entry-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1rem;
}

.entry-meta {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  font-size: 0.875rem; color: var(--text-muted);
}
.entry-meta-item { display: flex; align-items: center; gap: 0.35rem; }
.entry-meta-item svg { width: 14px; height: 14px; }

/* ============================================================
   Article Body
   ============================================================ */
.entry-content {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}

.entry-content > * + * { margin-top: 1.5rem; }

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.entry-content h2 {
  font-size: 1.5rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-left: 0.875rem;
  border-left: 3px solid var(--color-primary);
}

.entry-content h3 {
  font-size: 1.25rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-left: 0.625rem;
  border-left: 2px solid rgba(2,132,199,.4);
}

.entry-content h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.heading-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  font-size: 0.8em;
  color: var(--text-light);
  text-decoration: none;
  transition: opacity var(--t);
}
.entry-content h2:hover .heading-anchor,
.entry-content h3:hover .heading-anchor,
.entry-content h4:hover .heading-anchor { opacity: 1; }

.entry-content p { margin-bottom: 0.5rem; }

.entry-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(2,132,199,.3);
  transition: text-decoration-color var(--t);
}
.entry-content a:hover { text-decoration-color: var(--color-primary); }

.entry-content strong { font-weight: 700; color: var(--text); }

.entry-content ul,
.entry-content ol { padding-left: 1.5rem; }
.entry-content li { margin-bottom: 0.45rem; }
.entry-content li::marker { color: var(--color-primary); }

/* Blockquote */
.entry-content blockquote {
  border-left: 3px solid var(--color-primary-light);
  padding: 1rem 1.25rem;
  background: var(--color-primary-bg);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  color: var(--text-muted);
  font-style: normal;
}
.entry-content blockquote p { margin: 0; }

/* Inline code */
.entry-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 0.15em 0.425em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 500;
}

/* Code blocks */
.entry-content pre {
  background: var(--code-bg);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,.04);
}

.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.625rem 1rem;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.code-block-lang {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.code-copy-btn {
  display: flex; align-items: center; gap: 0.3rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #64748B;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem; font-family: inherit;
  cursor: pointer; transition: all var(--t);
}
.code-copy-btn:hover { background: rgba(255,255,255,.12); color: #CBD5E1; }
.code-copy-btn.copied { color: #10B981; border-color: rgba(16,185,129,.4); }
.code-copy-btn svg { width: 12px; height: 12px; }

.entry-content pre code {
  display: block;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--code-text);
  tab-size: 2;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-xs);
}
.table-wrapper table { margin: 0; }
.entry-content table {
  width: 100%; border-collapse: collapse;
  font-size: 1rem;
}
.entry-content th {
  background: var(--bg-alt);
  padding: 0.75rem 1.125rem;
  text-align: left;
  font-size: 0.875rem; font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.entry-content td {
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
}
.entry-content tr:last-child td { border-bottom: none; }
.entry-content tbody tr:hover { background: var(--bg-alt); }

/* HR */
.entry-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Images */
.entry-content img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ============================================================
   Callout Boxes
   ============================================================ */
.callout {
  display: flex; gap: 0.875rem;
  padding: 1.125rem 1.25rem;
  border-radius: var(--radius-lg);
  margin: 1.75rem 0;
  border-left: 3px solid;
  font-size: 1rem;
}
.callout-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.callout-content p { margin: 0; }
.callout-title {
  font-weight: 700; margin-bottom: 0.3rem;
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.callout-info    { background: rgba(59,130,246,.05);  border-color: var(--color-info);    color: var(--text); }
.callout-success { background: rgba(16,185,129,.05);  border-color: var(--color-success); color: var(--text); }
.callout-warning { background: rgba(245,158,11,.06);  border-color: var(--color-warning); color: var(--text); }
.callout-danger  { background: rgba(239,68,68,.05);   border-color: var(--color-danger);  color: var(--text); }
.callout-note    { background: rgba(139,92,246,.05);  border-color: var(--color-note);    color: var(--text); }
.callout-info    .callout-icon, .callout-info    .callout-title { color: var(--color-info); }
.callout-success .callout-icon, .callout-success .callout-title { color: var(--color-success); }
.callout-warning .callout-icon, .callout-warning .callout-title { color: var(--color-warning); }
.callout-danger  .callout-icon, .callout-danger  .callout-title { color: var(--color-danger); }
.callout-note    .callout-icon, .callout-note    .callout-title { color: var(--color-note); }

/* ============================================================
   TOC
   ============================================================ */
.toc-container {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.toc-inner {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1rem 0.875rem;
}
.toc-title {
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 0.625rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.375rem;
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list a {
  display: block;
  font-size: 0.8125rem; color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  margin-bottom: 1px;
  transition: all var(--t);
  line-height: 1.45;
}
.toc-list a:hover { color: var(--text); background: var(--bg-hover); }
.toc-list a.active {
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border-left-color: var(--color-primary);
  font-weight: 600;
}
.toc-level-3 { padding-left: 0.75rem; }
.toc-level-4 { padding-left: 1.5rem; }

/* ============================================================
   Post Footer
   ============================================================ */
.entry-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  margin-bottom: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.375rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: border-color var(--t), background var(--t), box-shadow var(--t), transform var(--t);
}
.post-nav-link:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  box-shadow: 0 4px 16px rgba(2,132,199,.12);
  transform: translateY(-2px);
}
.post-nav-link.next { text-align: right; }
.post-nav-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.post-nav-link.next .post-nav-label { justify-content: flex-end; }
.post-nav-label svg { width: 14px; height: 14px; flex-shrink: 0; }
.post-nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Feedback */
.feedback-widget {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 0.625rem;
  padding: 1.375rem 1.25rem;
  background: linear-gradient(135deg, var(--bg-alt), #f0f4ff);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
}
.feedback-question { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.feedback-buttons { display: flex; gap: 0.625rem; }
.feedback-btn {
  display: flex; align-items: center; gap: 0.4375rem;
  padding: 0.4375rem 1.125rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.875rem; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all var(--t);
  box-shadow: var(--shadow-xs);
}
.feedback-btn:hover { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-1px); }
.feedback-btn svg { width: 16px; height: 16px; }
.feedback-btn[data-value="yes"]:hover { background: rgba(16,185,129,.06); border-color: var(--color-success); color: var(--color-success); }
.feedback-btn[data-value="no"]:hover  { background: rgba(239,68,68,.06);  border-color: var(--color-danger);  color: var(--color-danger); }

/* ============================================================
   Homepage / Front Page
   ============================================================ */
.front-page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 3rem 4rem;
}

/* Hero */
.front-hero {
  text-align: center;
  padding: 4rem 2rem 4rem;
  position: relative;
}
.front-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(2,132,199,.07) 0%, transparent 70%);
  pointer-events: none;
}

.front-hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid rgba(2,132,199,.2);
  border-radius: 999px;
  padding: 0.3rem 0.875rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.front-hero h1 {
  font-size: 2.875rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1rem;
}
.front-hero h1 span {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.front-hero p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 2.25rem;
  line-height: 1.65;
}

.front-hero-actions {
  display: flex; gap: 0.625rem; justify-content: center; flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  border-radius: 999px;
  font-size: 0.9375rem; font-weight: 600;
  text-decoration: none;
  transition: all var(--t);
  border: 1.5px solid transparent;
  cursor: pointer; font-family: inherit;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(2,132,199,.35);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2,132,199,.4);
}
.btn-outline {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  background: var(--bg-alt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn svg { width: 17px; height: 17px; }

/* Stats strip */
.front-stats {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin: 0 auto 3.5rem;
  max-width: 560px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.front-stat {
  flex: 1;
  padding: 1rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.front-stat:last-child { border-right: none; }
.front-stat-value {
  font-size: 1.375rem; font-weight: 800;
  letter-spacing: -0.03em; color: var(--text);
}
.front-stat-label {
  font-size: 0.75rem; color: var(--text-muted);
  margin-top: 2px; font-weight: 500;
}

/* Category Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.375rem;
  text-decoration: none;
  transition: all 200ms var(--ease);
  display: flex; flex-direction: column; gap: 0.625rem;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary-bg), transparent 60%);
  opacity: 0;
  transition: opacity 200ms;
}
.card:hover {
  border-color: rgba(2,132,199,.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card:hover::before { opacity: 1; }

.card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
  position: relative;
}

.card-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.3;
  position: relative;
}
.card-desc {
  font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; flex: 1;
  position: relative;
}
.card-arrow {
  display: flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; font-weight: 600; color: var(--color-primary);
  margin-top: 0.25rem; position: relative;
  opacity: 0; transform: translateX(-4px);
  transition: all 200ms var(--ease);
}
.card:hover .card-arrow { opacity: 1; transform: translateX(0); }
.card-arrow svg { width: 13px; height: 13px; }

/* Section headers */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.375rem;
}
.section-title {
  font-size: 1.125rem; font-weight: 800;
  letter-spacing: -0.025em; color: var(--text);
}
.section-link {
  font-size: 0.8125rem; color: var(--color-primary); text-decoration: none; font-weight: 500;
}
.section-link:hover { text-decoration: underline; }

/* Recent posts list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list-item { border-bottom: 1px solid var(--border); }
.post-list-item:last-child { border-bottom: none; }
.post-list-link {
  display: flex; gap: 1rem; align-items: center;
  padding: 1rem 0; text-decoration: none;
  transition: all var(--t);
  border-radius: var(--radius-lg);
}
.post-list-link:hover { padding-left: 0.5rem; }
.post-list-body { flex: 1; min-width: 0; }
.post-list-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  margin-bottom: 0.25rem; transition: color var(--t);
}
.post-list-link:hover .post-list-title { color: var(--color-primary); }
.post-list-excerpt {
  font-size: 0.875rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.post-list-meta {
  display: flex; gap: 0.5rem; margin-top: 0.375rem;
  font-size: 0.8125rem; color: var(--text-light); align-items: center;
}
.post-list-meta-badge {
  background: var(--bg-alt); border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 6px; border-radius: 999px; font-size: 0.6875rem; font-weight: 500;
}

/* ============================================================
   Archive / Search
   ============================================================ */
.archive-header {
  margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border);
}
.archive-title {
  font-size: 1.625rem; font-weight: 800;
  letter-spacing: -0.03em; color: var(--text); margin-bottom: 0.375rem;
}
.archive-count { font-size: 0.875rem; color: var(--text-muted); }

/* ============================================================
   404 Page
   ============================================================ */
.error-page {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; padding: 3rem 2rem;
}
.error-code {
  font-size: 6rem; font-weight: 900;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1; margin-bottom: 1rem;
}
.error-title { font-size: 1.75rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.error-desc  { font-size: 1rem; color: var(--text-muted); max-width: 380px; margin: 0 auto 2rem; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 1.25rem 2.5rem;
  font-size: 0.8125rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color var(--t); }
.footer-links a:hover { color: var(--color-primary); }

/* ============================================================
   Scroll Progress
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: var(--header-height); left: var(--sidebar-width); right: 0;
  height: 2px; background: transparent; z-index: 90;
}
.scroll-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  width: 0%; transition: width 60ms linear;
  border-radius: 0 999px 999px 0;
}

/* ============================================================
   Back to Top
   ============================================================ */
.back-to-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 38px; height: 38px;
  background: var(--bg); color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--t);
  opacity: 0; pointer-events: none; transform: translateY(6px);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover {
  background: var(--color-primary); color: #fff;
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(2,132,199,.4);
}
.back-to-top svg { width: 16px; height: 16px; }

/* ============================================================
   Sidebar Overlay (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 40; backdrop-filter: blur(2px);
}

/* ============================================================
   Tags / Badges
   ============================================================ */
.tag {
  display: inline-flex; align-items: center;
  font-size: 0.6875rem; font-weight: 500;
  padding: 0.175rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none; transition: all var(--t);
}
.tag:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tags-list { display: flex; gap: 0.375rem; flex-wrap: wrap; margin-top: 0.625rem; }

/* ============================================================
   Skeleton
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--bg-hover) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .content-with-toc { grid-template-columns: 1fr 200px; gap: 2rem; padding: 2rem 1.75rem; }
}
@media (max-width: 1024px) {
  .content-with-toc { grid-template-columns: 1fr; }
  .toc-container { display: none; }
}
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .header-left { width: auto; }
  .site-title-text, .version-badge { display: none; }

  .site-sidebar { transform: translateX(-100%); z-index: 60; }
  .site-sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.active { display: block; }
  .site-main { margin-left: 0; }
  .scroll-progress { left: 0; }

  .content-with-toc,
  .content-full-width,
  .front-page-wrap { padding: 1.5rem 1.5rem; }

  .front-hero h1 { font-size: 1.875rem; }
  .entry-title   { font-size: 1.625rem; }
  .post-nav { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; text-align: center; }
  .card-grid { grid-template-columns: 1fr; }
  .front-stats { flex-direction: column; border-radius: var(--radius-lg); }
  .front-stat { border-right: none; border-bottom: 1px solid var(--border); }
  .front-stat:last-child { border-bottom: none; }
}
@media (max-width: 480px) {
  .header-center { display: none; }
  .front-hero h1 { font-size: 1.625rem; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  /* ── Hide all UI chrome ── */
  .site-header,
  .site-sidebar,
  .sidebar-overlay,
  .toc-container,
  .entry-footer,
  .back-to-top,
  .scroll-progress,
  .site-footer,
  .lightbox-overlay,
  .welcome-modal-overlay,
  .breadcrumbs,
  .feedback-widget,
  .related-articles,
  .post-nav,
  .code-copy-btn,
  .heading-anchor,
  .tags-list { display: none !important; }

  /* ── Reset layout ── */
  html { font-size: 11pt; }
  body { color: #000; background: #fff; }

  .site-wrapper {
    display: block !important;
    padding-top: 0 !important;
  }
  .site-main {
    margin-left: 0 !important;
    display: block !important;
  }
  .content-with-toc,
  .content-full-width,
  .front-page-wrap {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  /* ── Article ── */
  .entry-header { border-bottom: 1px solid #ccc; padding-bottom: 0.75cm; margin-bottom: 0.75cm; }
  .entry-title  { font-size: 20pt; color: #000; letter-spacing: -0.01em; }
  .entry-label  { display: none !important; }
  .entry-meta   { font-size: 9pt; color: #555; }

  .entry-content {
    font-size: 11pt;
    line-height: 1.65;
    color: #111;
  }
  .entry-content > * + * { margin-top: 0.6em; }
  .entry-content h2 { font-size: 15pt; margin-top: 1.4em; margin-bottom: 0.4em; border-left: none !important; padding-left: 0 !important; border-bottom: 1px solid #ddd; padding-bottom: 0.2em; page-break-after: avoid; }
  .entry-content h3 { font-size: 13pt; margin-top: 1.2em; margin-bottom: 0.3em; border-left: none !important; padding-left: 0 !important; page-break-after: avoid; }
  .entry-content h4 { font-size: 11pt; margin-top: 1em; margin-bottom: 0.25em; page-break-after: avoid; }

  .entry-content a { color: #000; text-decoration: underline; }
  .entry-content a[href^="http"]::after,
  .entry-content a[href^="https"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #666; }
  .entry-content a[href^="#"]::after { content: ""; }

  /* ── Code blocks ── */
  .code-block-header { display: none !important; }
  .entry-content pre {
    background: #f4f4f4 !important;
    color: #111 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    white-space: pre-wrap !important;
    word-break: break-all;
    margin: 0.75em 0;
    page-break-inside: avoid;
  }
  .entry-content pre code {
    color: #111 !important;
    font-size: 9pt !important;
    line-height: 1.5 !important;
    padding: 0.5em 0.75em !important;
  }
  /* kill Prism colors */
  .token { color: #111 !important; }

  /* ── Inline code ── */
  .entry-content code:not(pre code) {
    background: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    font-size: 9.5pt !important;
  }

  /* ── Tables ── */
  .table-wrapper { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: auto; }
  .entry-content table { font-size: 10pt; }
  .entry-content th { background: #f0f0f0 !important; color: #000; font-size: 9.5pt; padding: 4pt 8pt; }
  .entry-content td { color: #111; padding: 4pt 8pt; }

  /* ── Callouts ── */
  .callout {
    border: 1px solid #ccc !important;
    background: #f9f9f9 !important;
    color: #000 !important;
    page-break-inside: avoid;
  }
  .callout-title,
  .callout-icon { color: #333 !important; }

  /* ── Steps ── */
  .step-number { background: #222 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .step-item::after { background: #ccc !important; }

  /* ── Images ── */
  .entry-content img {
    max-width: 100% !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    cursor: default !important;
    page-break-inside: avoid;
  }

  /* ── Blockquote ── */
  .entry-content blockquote {
    background: #f5f5f5 !important;
    border-left: 3px solid #999 !important;
    color: #333 !important;
  }

  /* ── Page breaks ── */
  .entry-content h2 { page-break-before: auto; }
  .callout, .step-item { page-break-inside: avoid; }

  /* ── Print URL in header ── */
  @page {
    margin: 1.5cm 1.5cm 2cm;
    size: A4;
  }
}

/* ============================================================
   Syntax Highlight Tokens (dark code bg)
   ============================================================ */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #4B5563; font-style: italic; }
.token.punctuation   { color: #94A3B8; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant { color: #FB923C; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin { color: #34D399; }
.token.operator, .token.entity, .token.url { color: #67E8F9; }
.token.atrule, .token.attr-value, .token.keyword { color: #A78BFA; }
.token.function, .token.class-name { color: #60A5FA; }
.token.regex, .token.important, .token.variable { color: #FCD34D; }

/* ============================================================
   Steps Shortcode [steps][step title="..."]
   ============================================================ */
.steps {
  counter-reset: step-counter;
  padding: 0;
  margin: 1.75rem 0;
  list-style: none;
}
.step-item {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.25rem;
  position: relative;
}
.step-item:not(:last-child) {
  padding-bottom: 1.5rem;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 1.0625rem;
  top: 2.375rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.step-number {
  flex-shrink: 0;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  counter-increment: step-counter;
}
.step-number::before {
  content: counter(step-counter);
}
.step-body {
  flex: 1;
  padding-top: 0.25rem;
  padding-bottom: 0.5rem;
  min-width: 0;
}
.step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}
.step-content > *:first-child { margin-top: 0; }
.step-content > *:last-child  { margin-bottom: 0; }

/* ============================================================
   Image Lightbox
   ============================================================ */
.entry-content img { cursor: zoom-in; }
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  cursor: default;
  animation: lb-in 0.2s ease;
}
@keyframes lb-in {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  transition: background 0.15s;
  line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }
.lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-size: 0.8125rem;
  text-align: center;
  max-width: 60ch;
  pointer-events: none;
}

/* ============================================================
   Read Tracker — Sidebar Progress
   ============================================================ */
.sidebar-progress {
  padding: 0.75rem 1rem 0.875rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-xlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.sidebar-progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.sidebar-progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}
.nav-read-check {
  margin-left: auto;
  flex-shrink: 0;
  color: #10B981;
  display: none;
}
.nav-read-check.visible { display: flex; }
.nav-read-check svg { width: 14px; height: 14px; }

/* ============================================================
   Search Highlight
   ============================================================ */
mark.search-highlight {
  background: rgba(245,158,11,0.22);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: inherit;
}

/* ============================================================
   Related Articles
   ============================================================ */
.related-articles {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.related-articles-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-xlight);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 1rem;
}
.related-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.related-article-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  background: var(--bg);
}
.related-article-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(2,132,199,0.1);
  transform: translateY(-2px);
  color: var(--text);
  text-decoration: none;
}
.related-article-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 0.375rem;
}
.related-article-card-meta {
  font-size: 0.75rem;
  color: var(--text-xlight);
}

/* ============================================================
   Changelog Page Template
   ============================================================ */
.changelog-page { max-width: 780px; margin: 0 auto; }
.changelog-header { margin-bottom: 2.5rem; }
.changelog-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.changelog-header p {
  color: var(--text-light);
  margin: 0;
}
.changelog-timeline {
  position: relative;
  padding-left: 2rem;
}
.changelog-timeline::before {
  content: '';
  position: absolute;
  left: 0.625rem;
  top: 0.75rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.changelog-entry {
  position: relative;
  margin-bottom: 2.75rem;
}
.changelog-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.5rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border);
}
.changelog-entry.latest .changelog-dot {
  background: #10B981;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
}
.changelog-version {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.25rem;
}
.changelog-version-badge {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}
.changelog-latest-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(16,185,129,0.12);
  color: #059669;
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.changelog-date {
  font-size: 0.8125rem;
  color: var(--text-xlight);
  margin-bottom: 1rem;
}
.changelog-items {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
}
.changelog-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.changelog-item:last-child { border-bottom: none; }
.changelog-tag {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}
.changelog-tag-new     { background: rgba(2,132,199,0.1);  color: #0284C7; }
.changelog-tag-fix     { background: rgba(239,68,68,0.1);  color: #DC2626; }
.changelog-tag-improve { background: rgba(6,182,212,0.1);  color: #0891B2; }
.changelog-tag-remove  { background: rgba(107,114,128,0.1); color: #6B7280; }
@media (max-width: 768px) {
  .related-articles-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Welcome / Starter Guide Modal
   ============================================================ */
.welcome-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.welcome-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.welcome-modal {
  background: var(--bg);
  border-radius: var(--radius-2xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.22), 0 8px 24px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s var(--ease-out);
}
.welcome-modal-overlay.active .welcome-modal {
  transform: translateY(0) scale(1);
}

.welcome-modal-hero {
  background: linear-gradient(135deg, #0284C7 0%, #0D9488 100%);
  padding: 2.25rem 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}
.welcome-modal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.welcome-modal-logo {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: #fff;
  margin-bottom: 1rem;
  position: relative;
}
.welcome-modal-hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  position: relative;
}
.welcome-modal-hero p {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.6;
  position: relative;
  margin: 0;
}

.welcome-modal-body {
  padding: 1.75rem 2.5rem 2rem;
}

.welcome-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.welcome-feature {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.welcome-feature-icon {
  flex-shrink: 0;
  width: 2.25rem; height: 2.25rem;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.welcome-feature-text strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
}
.welcome-feature-text span {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.welcome-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.welcome-skip-btn {
  font-size: 0.875rem;
  color: var(--text-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0;
  font-family: inherit;
  transition: color var(--t);
}
.welcome-skip-btn:hover { color: var(--text-muted); }
.welcome-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(2,132,199,0.35);
  transition: all var(--t);
}
.welcome-start-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2,132,199,0.4);
}
.welcome-start-btn svg { width: 16px; height: 16px; }

@media (max-width: 540px) {
  .welcome-modal-hero { padding: 1.75rem 1.5rem 1.5rem; }
  .welcome-modal-body { padding: 1.5rem 1.5rem 1.75rem; }
  .welcome-modal-hero h2 { font-size: 1.25rem; }
}

/* ============================================================
   Playlist Navigation (fixed bottom bar)
   ============================================================ */
.playlist-nav {
  position: fixed;
  bottom: 0; left: var(--sidebar-width); right: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border);
  z-index: 80;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out);
  box-shadow: 0 -4px 24px rgba(0,0,0,.07);
}
.playlist-nav.visible { transform: translateY(0); }

.playlist-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Progress strip */
.playlist-nav-meta {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
  min-width: 0;
}
.playlist-nav-category {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-nav-count {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  background: var(--color-primary-bg);
  padding: 0.175rem 0.625rem;
  border-radius: 999px;
}
.playlist-progress-wrap {
  width: 96px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.playlist-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Controls */
.playlist-nav-controls {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-end;
}

.playlist-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: all var(--t);
  max-width: 300px;
  min-width: 0;
}
.playlist-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  box-shadow: var(--shadow-sm);
}
.playlist-btn-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--t);
}
.playlist-btn:hover .playlist-btn-icon {
  background: var(--color-primary);
  color: #fff;
}
.playlist-btn-icon svg { width: 14px; height: 14px; }
.playlist-btn-body { min-width: 0; }
.playlist-btn-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-xlight);
  display: block;
  line-height: 1;
  margin-bottom: 0.2rem;
}
.playlist-btn-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 220px;
}
.playlist-btn:hover .playlist-btn-title { color: var(--color-primary-dark); }

.playlist-btn-prev .playlist-btn-body { text-align: left; }
.playlist-btn-next .playlist-btn-body { text-align: right; }
.playlist-btn-next { flex-direction: row-reverse; }

/* Push content up so it's not hidden behind playlist nav */
body.has-playlist-nav .site-main {
  padding-bottom: 72px;
}

@media (max-width: 1024px) {
  .playlist-nav { left: 0; }
}
@media (max-width: 640px) {
  .playlist-nav-inner { padding: 0.625rem 1rem; gap: 0.75rem; }
  .playlist-nav-meta { display: none; }
  .playlist-btn-title { max-width: 130px; }
}

/* ============================================================
   Feedback Stats (admin view)
   ============================================================ */
.feedback-stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.875rem 1.25rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 1rem;
  font-size: 0.875rem;
}
.feedback-stats-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-xlight);
  flex-shrink: 0;
}
.feedback-stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.feedback-stat-yes { color: var(--color-success); font-weight: 700; }
.feedback-stat-no  { color: var(--color-danger);  font-weight: 700; }
.feedback-stat-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}
.feedback-stat-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #34D399);
  border-radius: 3px;
  transition: width 0.6s ease;
}
