/* ============================================
   Skalven Ghost Theme - Main Styles
   ============================================ */

/* ---- CSS Variables (Theme System) ---- */
:root {
  /* Light theme (default) */
  --bg-body: #ffffff;
  --bg-card: #f3f4f6;
  --bg-sidebar: #ffffff;
  --bg-nav-hover: #f3f4f6;
  --bg-quote: #ffffff;
  --bg-input: #f9fafb;
  
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-on-primary: #ffffff;
  
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #ede9fe;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  
  --nav-width: 240px;
  --sidebar-width: 360px;
  --content-max: 780px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
  
  --transition: 0.2s ease;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-body: #111827;
  --bg-card: #1f2937;
  --bg-sidebar: #111827;
  --bg-nav-hover: #1f2937;
  --bg-quote: #1f2937;
  --bg-input: #1f2937;
  
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  
  --border-color: #374151;
  --border-light: #1f2937;
}

/* ==========================================
   GHOST PORTAL OVERRIDES
   ========================================== */

/* Light mode - sync Portal colors with theme */
.gh-portal-popup-container {
  --white: var(--bg-card);
  --whitergb: 243, 244, 246;
  --grey0: var(--text-primary);
  --grey1: var(--text-primary);
  --grey2: var(--text-secondary);
  --grey3: var(--text-secondary);
  --grey4: var(--text-muted);
  --grey5: var(--text-muted);
  --grey6: var(--text-muted);
  --grey8: var(--border-color);
  --grey9: var(--text-muted);
  --grey10: var(--border-color);
  --grey11: var(--border-color);
  --grey12: var(--border-color);
  --grey13: var(--bg-input);
  --grey14: var(--bg-body);
  background: var(--bg-card) !important;
  color: var(--text-primary);
}

/* Dark mode overrides */
[data-theme="dark"] .gh-portal-popup-container {
  --white: var(--bg-card);
  --whitergb: 31, 41, 55;
  --grey0: var(--text-primary);
  --grey1: var(--text-primary);
  --grey2: var(--text-secondary);
  --grey3: var(--text-secondary);
  --grey4: var(--text-muted);
  --grey5: var(--text-muted);
  --grey6: var(--text-muted);
  --grey8: var(--border-color);
  --grey9: var(--text-muted);
  --grey10: var(--border-color);
  --grey11: var(--border-color);
  --grey12: var(--border-color);
  --grey13: var(--bg-input);
  --grey14: var(--bg-body);
}

/* Portal popup wrapper background (the blur overlay area) */
.gh-portal-popup-wrapper {
  background: var(--bg-body) !important;
}

/* Portal input fields */
.gh-portal-input {
  color: var(--text-primary) !important;
  background: var(--bg-input) !important;
  border-color: var(--border-color) !important;
}
.gh-portal-input::placeholder {
  color: var(--text-muted) !important;
}

/* Portal list containers */
.gh-portal-list {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

/* Portal close icon */
.gh-portal-closeicon {
  color: var(--text-muted) !important;
}
.gh-portal-closeicon:hover {
  color: var(--text-primary) !important;
}

/* Portal links */
.gh-portal-link {
  color: var(--accent) !important;
}

/* Portal error text */
.gh-portal-error {
  color: #ef4444 !important;
}

/* Portal product card */
.gh-portal-product-card {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

/* Portal buttons - keep branded color for primary actions */
.gh-portal-btn-primary {
  background: var(--accent) !important;
  color: #fff !important;
}
.gh-portal-btn-primary:hover {
  background: var(--accent-hover) !important;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

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

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ---- Layout ---- */
.app-layout {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr var(--sidebar-width);
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

.main-content {
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  min-height: 100vh;
  overflow-y: auto;
}

/* ---- Navigation Sidebar ---- */
.nav-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
}

.nav-sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 8px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.site-brand__logo {
  height: 28px;
  width: auto;
}

.site-brand__name {
  color: var(--text-primary);
}

.nav-sidebar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.search-toggle:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

/* Close button - hidden on desktop, shown in drawer mode */
.nav-sidebar__close {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-sidebar__close:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

/* Nav Menu */
.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-menu__item:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.nav-menu__item.active {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-menu__icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-menu__icon svg {
  width: 100%;
  height: 100%;
}

.nav-menu__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.nav-menu__avatar-placeholder {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-menu__label {
  flex: 1;
}

.nav-menu__count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.nav-menu__item--secondary {
  font-size: 13px;
  padding-left: 42px;
}

/* Nav Section Headers */
.nav-section-header {
  padding: 16px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Bottom CTA */
.nav-sidebar__bottom {
  padding: 16px 8px 0;
  margin-top: auto;
}

/* ---- Right Sidebar ---- */
.right-sidebar {
  position: sticky;
  top: 0;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  z-index: 60;
  max-height: calc(100vh);
  overflow-y: auto;
}

.right-sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar-section {
  margin-bottom: 20px;
  overflow: visible;
}

.sidebar-section__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ==========================================
   SIDEBAR SECTIONS (Author / TOC / Related / Recommendations)
   ========================================== */

/* Base section title - used for Author & TOC (no icon) */
.sidebar-section__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Section title with icon - for Related & Recommendations */
.sidebar-section__title--icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-section__title--icon::before {
  font-size: 15px;
  line-height: 1;
}

/* Related Posts icon ☰ */
.sidebar-section__title--related::before {
  content: "☰";
}

/* Recommendations icon 👍 */
.sidebar-section__title--recommend::before {
  content: "👍";
}

/* Author Section */
.sidebar-author {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

a.sidebar-author__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
  transition: opacity var(--transition);
}

a.sidebar-author__profile:hover {
  opacity: 0.7;
}

.sidebar-author__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.sidebar-author__avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.sidebar-author__info {
  flex: 1;
  min-width: 0;
}

.sidebar-author__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.sidebar-author__location {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-author__bio {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.sidebar-author__social {
  display: flex;
  gap: 12px;
}

.sidebar-author__social a {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: color var(--transition);
}

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

.sidebar-author__social svg {
  width: 18px;
  height: 18px;
}

/* TOC in Sidebar - "On this page" style */
.sidebar-toc {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.toc-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-link {
  display: block;
  padding: 3px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  border-radius: 4px;
}

.toc-link:hover {
  color: var(--text-primary);
}

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

.toc-link--h3 {
  padding-left: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.toc-link--h4 {
  padding-left: 24px;
  font-size: 11px;
  color: var(--text-muted);
}

.toc-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

/* Related Posts Section */
.sidebar-related {
  padding-bottom: 20px;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.related-item {
  display: block;
  transition: opacity var(--transition);
}

.related-item:hover {
  opacity: 0.7;
}

.related-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.related-item__excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================
   SIDEBAR WIDGETS (Author Page)
   You might like / Featured / Recommendations
   ========================================== */

/* Section title with inline SVG icon */
.sidebar-section__title--icon svg {
  flex-shrink: 0;
}

/* Remove old pseudo-element icons */
.sidebar-section__title--related::before,
.sidebar-section__title--recommend::before {
  content: none;
}

/* --- You might like --- */
.sidebar-authors {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.widget-authors-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.widget-author-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition);
}

.widget-author-item:hover {
  opacity: 0.7;
}

.widget-author-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.widget-author-item__avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.widget-author-item__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.widget-author-item__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.widget-author-item__location {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* --- Subscribe CTA --- */
.sidebar-subscribe {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-subscribe__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sidebar-subscribe__form {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border-light);
  border-radius: 100px;
  overflow: hidden;
  background: var(--bg-primary);
  transition: border-color var(--transition);
}

.sidebar-subscribe__form:focus-within {
  border-color: var(--accent);
}

.sidebar-subscribe__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 0;
}

.sidebar-subscribe__input::placeholder {
  color: var(--text-muted);
}

.sidebar-subscribe__btn {
  border: none;
  outline: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  margin: 3px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.sidebar-subscribe__btn:hover {
  opacity: 0.85;
}

.sidebar-subscribe__message {
  font-size: 12px;
  margin-top: 8px;
  color: var(--success, #22c55e);
}

.sidebar-subscribe__message.is-error {
  color: var(--error, #ef4444);
}

.sidebar-subscribe__form.is-error {
  border-color: var(--error, #ef4444);
}

/* --- Featured --- */
.sidebar-featured {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

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

.widget-featured-item {
  display: block;
  transition: opacity var(--transition);
}

.widget-featured-item:hover {
  opacity: 0.7;
}

.widget-featured-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.widget-featured-item__excerpt {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Recommendations --- */
.sidebar-recommendations {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.widget-recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.widget-recommendation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.widget-recommendation-item:hover {
  background: var(--bg-card);
}

.widget-recommendation-item__favicon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}

.widget-recommendation-item__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Subscribe Form */
.sidebar-subscribe .subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subscribe-form__input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.subscribe-form__input:focus {
  border-color: var(--accent);
}

.subscribe-form__input::placeholder {
  color: var(--text-muted);
}

.subscribe-form__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subscribe-form__hint::before {
  content: "✨";
}

/* Quote Card */
.sidebar-quote {
  background: var(--bg-quote);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-style: italic;
}

/* Tag Cloud */
.tag-cloud {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

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

.tag-chip__image,
.tag-chip__emoji {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  font-size: 14px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-on-primary);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn--secondary:hover {
  background: var(--border-color);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ---- Content Area ---- */
.content-wrapper {
  padding: 32px 40px;
  max-width: var(--content-max);
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.breadcrumbs__sep {
  color: var(--text-muted);
}

/* ---- Our Authors Grid (Homepage) ---- */
.authors-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.author-card-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.author-card-home:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.author-card-home__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 2px solid var(--border-light);
}

.author-card-home__avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.author-card-home__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.author-card-home__bio {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-card-home__location {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Page Header ---- */
.page-header {
  margin-bottom: 32px;
}

.page-header__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}

.page-header__title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.page-header__desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
}

/* ==========================================
   SERIES HERO (Tag page hub)
   ========================================== */

.series-hero {
  margin: 0 0 32px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.series-hero__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.series-hero__content {
  padding: 28px 32px;
}

.series-hero__badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-light);
  margin-bottom: 12px;
}

.series-hero__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
  line-height: 1.3;
}

.series-hero__desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  max-width: 600px;
}

/* ==========================================
   SERIES TOC (Table of Contents)
   ========================================== */

.series-toc {
  margin-bottom: 40px;
}

.series-toc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--text-primary);
}

.series-toc__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.series-toc__count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.series-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: series-chapter;
}

.series-toc__item {
  margin: 0;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.series-toc__item:first-child {
  border-top: 1px solid var(--border-light);
}

.series-toc__item:hover {
  background: var(--bg-card);
}

.series-toc__link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
}

.series-toc__number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.series-toc__info {
  flex: 1;
  min-width: 0;
}

.series-toc__chapter-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.4;
}

.series-toc__excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 6px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.series-toc__meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.series-toc__arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.series-toc__link:hover .series-toc__arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.series-toc__link:hover .series-toc__chapter-title {
  color: var(--accent);
}

/* Start Reading CTA */
.series-toc__start {
  margin-top: 28px;
  text-align: center;
}

.series-toc__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.series-toc__cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ==========================================
   SERIES WORKS (Home page)
   ========================================== */

.series-works-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.series-works-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.series-works-item:hover {
  background: var(--accent-light);
}

.series-works-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.series-works-item:hover .series-works-num {
  background: var(--accent);
  color: white;
}

.series-works-info {
  flex: 1;
  min-width: 0;
}

.series-works-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-works-item:hover .series-works-title {
  color: var(--accent);
}

.series-works-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-works-meta {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Series tag list below cards */
.series-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.series-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.15s ease;
}

.series-tag-chip:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent-light);
}

/* ==========================================
   ALL SERIES PAGE (page-series.hbs)
   ========================================== */

.series-all-chapters {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.series-all-chapters__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.series-all-chapters__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.series-all-chapters__item {
  margin: 0;
}

.series-all-chapters__link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.series-all-chapters__link:hover {
  background: var(--accent-light);
}

.series-all-chapters__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.series-all-chapters__link:hover .series-all-chapters__num {
  background: var(--accent);
  color: white;
}

.series-all-chapters__info {
  flex: 1;
  min-width: 0;
}

.series-all-chapters__tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 2px;
  display: block;
}

.series-all-chapters__chapter-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-all-chapters__link:hover .series-all-chapters__chapter-title {
  color: var(--accent);
}

.series-all-chapters__meta {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.filter-tab:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--accent);
  color: var(--text-on-primary);
  border-color: var(--accent);
}

/* ---- Hero Carousel (Home) ---- */
.hero-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 8px;
}

.hero-carousel__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-carousel__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 1;
}

.hero-carousel__slide.is-active {
  opacity: 1;
  z-index: 2;
}

.hero-carousel__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.hero-carousel__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.15) 100%);
  z-index: 2;
}

.hero-carousel__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 40px 48px;
  max-width: 600px;
}

.hero-carousel__tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero-carousel__title {
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hero-carousel__excerpt {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-carousel__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: #fff;
  color: #000;
  font-size: 14px;
  font-weight: 600;
  border-radius: 100px;
  text-decoration: none;
  transition: opacity var(--transition);
}

.hero-carousel__btn:hover {
  opacity: 0.85;
}

.hero-carousel__btn span {
  transition: transform var(--transition);
}

.hero-carousel__btn:hover span {
  transform: translateX(4px);
}

/* Arrows */
.hero-carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  opacity: 0;
}

.hero-carousel:hover .hero-carousel__arrow {
  opacity: 1;
}

.hero-carousel__arrow:hover {
  background: rgba(255,255,255,0.3);
}

.hero-carousel__arrow--prev {
  left: 16px;
}

.hero-carousel__arrow--next {
  right: 16px;
}

/* Dots */
.hero-carousel__dots {
  position: absolute;
  bottom: 16px;
  right: 48px;
  z-index: 4;
  display: flex;
  gap: 8px;
  align-items: center;
}

.hero-carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.hero-carousel__dot.is-active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.section-link {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

/* ---- Post Cards (Horizontal) ---- */
.post-card {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  transition: opacity var(--transition);
}

/* Horizontal related post card (with background) */
.related-posts .post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.related-posts .post-card:hover {
  border-color: var(--accent);
}

.post-card__image {
  width: 140px;
  height: 100px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

/* Ensure image-link participates in flex ordering */
.post-card__image-link {
  order: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.post-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.post-card__excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-card__meta-sep {
  color: var(--text-muted);
}

/* Author info: hidden on desktop, shown on mobile */
.post-card__author {
  display: none;
}

/* Desktop: ensure single image display */
.post-card__image-link {
  display: block;
}

/* Desktop: time hidden by default */
.post-card__time {
  display: none;
}

/* Desktop: avatar left + title/tag/time right */
.post-card__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.post-card__top .post-card__author-link {
  display: flex;
  flex-shrink: 0;
  text-decoration: none;
}

.post-card__author-img,
.post-card__author-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
}

/* Title + tag + time + bookmark: desktop layout */
.post-card__header {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
  margin-bottom: 0;
  position: relative;
  padding-right: 28px; /* space for bookmark button */
}

/* Tag below title on desktop */
.post-card__header .post-card__tag {
  order: 0;
  margin-top: 0;
  margin-bottom: 2px;
}

/* Bookmark button absolute positioned on desktop */
.post-card__header .bookmark-btn {
  position: absolute;
  top: 0;
  right: 0;
}

/* Image fallback gradient */
.post-card__image--fallback {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

/* Post card tag (primary tag below title) */
.post-card__tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
  margin-bottom: 4px;
}

/* ---- Card Grid (Readings/Projects) ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-item {
  display: block;
}

.card-item__image {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  background: var(--bg-card);
  transition: transform var(--transition);
}

.card-item:hover .card-item__image {
  transform: scale(1.02);
}

.card-item__chapter-num {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

.card-item__author {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.card-item__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.card-item__date {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Podcast List ---- */
.podcast-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.podcast-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.podcast-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  font-size: 16px;
}

.podcast-item__content {
  flex: 1;
}

.podcast-item__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.podcast-item__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.podcast-item__date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================
   READING PROGRESS BAR
   ========================================== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
}

.reading-progress__bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* ==========================================
   POST HEADER
   ========================================== */
.post-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.post-title {
  font-size: 40px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

/* Author row below title */
.post-header__author {
  display: flex;
  align-items: center;
  gap: 16px;
}

.post-header__author-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.post-header__author-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.post-header__author-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.post-header__author-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.post-header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

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

.post-visibility {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(199, 69, 104, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ==========================================
   POST CONTENT
   ========================================== */
.post-content {
  font-size: 18px;
  line-height: 1.7;
  color: #374151;
  text-align: justify;
  max-width: 680px;
}

[data-theme="dark"] .post-content {
  color: #d1d5db;
}

.post-content p {
  margin-bottom: 28px;
}

/* Headings with left accent line */
.post-content h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 56px 0 24px;
  letter-spacing: -0.02em;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
  line-height: 1.35;
  color: var(--text-primary);
}

[data-theme="dark"] .post-content h2 {
  color: #f9fafb;
}

.post-content h3 {
  font-size: 21px;
  font-weight: 600;
  margin: 44px 0 18px;
  letter-spacing: -0.01em;
  line-height: 1.4;
  text-align: left;
  padding-left: 14px;
  border-left: 3px solid var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .post-content h3 {
  color: #f9fafb;
  border-left-color: #4b5563;
}

.post-content h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 14px;
  color: var(--accent);
}

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

.post-content a:hover {
  text-decoration-thickness: 2px;
}

/* Blockquote redesign */
.post-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 24px 28px;
  margin: 36px 0;
  background: #f9fafb;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: normal;
  color: #4b5563;
  font-size: 18px;
  line-height: 1.7;
}

[data-theme="dark"] .post-content blockquote {
  background: #1f2937;
  color: #d1d5db;
}

.post-content blockquote p {
  margin-bottom: 18px;
}

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

/* Inline code */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(199, 69, 104, 0.08);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--accent);
  font-weight: 500;
}

/* Code block - dark theme */
.post-content pre {
  background: #1e1e2e;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid rgba(255,255,255,0.06);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: #e4e4e8;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 400;
}

.post-content img {
  border-radius: var(--radius-md);
  margin: 28px 0;
}

.post-content ul,
.post-content ol {
  margin: 24px 0;
  padding-left: 28px;
}

.post-content li {
  margin-bottom: 12px;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 48px 0;
}

/* Floating toolbar */
.floating-toolbar {
  display: none; /* hidden on desktop, shown when right-sidebar is hidden */
}

.toolbar-handle {
  display: none;
  width: 28px;
  height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  flex-shrink: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.toolbar-handle svg path:not([fill="none"]) {
  fill: var(--text-secondary) !important;
}

.toolbar-handle:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.toolbar-body {
  display: contents; /* default: buttons are direct children */
}

.toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}

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

/* ---- Tags Page ---- */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tag-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

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

.tag-card__image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.tag-card__info {
  flex: 1;
}

.tag-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.tag-card__count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Authors Page ---- */
.authors-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pagination__btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}

.pagination__btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.pagination__info {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Theme Switcher ---- */
.theme-switcher {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.theme-btn {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

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

.theme-btn.active {
  background: var(--text-primary);
  color: var(--bg-body);
  border-color: var(--text-primary);
}

/* ==========================================
   PAGE STYLES
   ========================================== */

/* Page Hero with feature image */
.page-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 240px;
  max-height: 360px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  margin-bottom: 16px;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1) 100%);
}

.page-hero__content {
  position: relative;
  z-index: 2;
  padding: 40px 32px;
  width: 100%;
}

.page-hero__title {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.page-hero__desc {
  font-size: 15px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  max-width: 600px;
}

/* Page meta (last updated) */
.page-meta {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.page-meta__updated {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Page content tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.post-content thead {
  background: var(--bg-card);
}

.post-content th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-content td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.post-content tbody tr:hover {
  background: var(--bg-card);
}

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

/* Page navigation - other pages */
.page-nav {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border-color);
}

.page-nav__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.page-nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.page-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.page-nav__item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.page-nav__thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.page-nav__label {
  font-size: 14px;
  font-weight: 500;
}

/* ==========================================
   AUTHOR PAGE
   ========================================== */

.author-card {
  margin: 0 0 32px;
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.author-card__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
}

.author-card__avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 32px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.author-card__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px;
  line-height: 1.4;
}

.author-card__location {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.author-card__bio {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 12px;
}

.author-card__social {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.author-card__social-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s ease;
}

.author-card__social-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.author-card__count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.author-posts-section {
  margin-bottom: 40px;
}

.author-posts-section__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text-primary);
}

.author-posts-list {
  display: flex;
  flex-direction: column;
}

/* ---- Site Footer (in sidebar) ---- */
.site-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.site-footer__copy,
.site-footer__credit {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.site-footer__credit a {
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* Footer visibility: desktop shows sidebar footer, mobile shows bottom footer */
.site-footer--bottom {
  display: none;
}

.site-footer--sidebar {
  display: block;
}

/* ---- KG Cards (Ghost Editor) ---- */
.kg-card {
  margin: 24px 0;
}

.kg-image-card img {
  border-radius: var(--radius-md);
}

.kg-bookmark-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.kg-bookmark-content {
  flex: 1;
  padding: 16px;
}

.kg-bookmark-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.kg-bookmark-description {
  font-size: 13px;
  color: var(--text-secondary);
}

.kg-bookmark-thumbnail img {
  width: 160px;
  height: 100%;
  object-fit: cover;
}

/* ---- Mobile Header (docs.ghost.org style) ---- */
.mobile-header {
  display: none;
}

/* ---- Mobile Menu Toggle ---- */
.mobile-menu-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: background var(--transition);
}

.mobile-menu-toggle:hover {
  background: var(--bg-nav-hover);
}

.mobile-menu-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 90;
}

/* ==========================================
   PAYWALL (Membership Gates)
   ========================================== */

.paywall {
  text-align: center;
  padding: 48px 32px;
  margin: 32px 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.paywall__icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.paywall__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.paywall__desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.paywall .btn {
  margin-bottom: 16px;
}

.paywall__hint {
  font-size: 13px;
  color: var(--text-muted);
}

.paywall__hint a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* Bookmark button */
.bookmark-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.bookmark-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
}

.bookmark-btn[data-bookmarked="true"] {
  color: var(--accent);
}

.bookmark-btn[data-bookmarked="true"] svg {
  fill: var(--accent-light);
}

/* Comments section */
.comments-section {
  margin-top: 40px;
}

.comments-section .gh-comments {
  margin-top: 16px;
}

/* Post visibility badge */
.post-visibility {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================
   POST STYLES
   ========================================== */

/* Post content heading anchors */
.post-content h2[id],
.post-content h3[id],
.post-content h4[id] {
  scroll-margin-top: 24px;
}

/* Author bio card */
.author-bio-card {
  margin-top: 32px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.author-bio-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-bio-card__avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.author-bio-card__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.author-bio-card__bio {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* Post tags bar */
.post-tags-bar {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-tag-chip {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.post-tag-chip:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* ==========================================
   POST SHARE BAR
   ========================================== */
.post-share {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
}

.post-share__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.post-share__buttons {
  display: flex;
  gap: 8px;
}

.post-share__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.post-share__btn:hover {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
  transform: translateY(-1px);
}

.post-share__btn--copied {
  background: #22c55e !important;
  border-color: #22c55e !important;
  color: #fff !important;
}

/* ==========================================
   POST NAVIGATION (Prev / Next)
   ========================================== */
.post-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.post-nav__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: all 0.2s ease;
}

.post-nav__link:hover {
  border-color: var(--accent);
  background: rgba(199, 69, 104, 0.03);
}

.post-nav__link--next {
  text-align: right;
  align-items: flex-end;
}

.post-nav__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.post-nav__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Single link (only prev or only next) */
.post-nav__link:only-child {
  grid-column: span 1;
}

.post-nav__link--prev:only-child {
  grid-column: 1;
}

.post-nav__link--next:first-child:last-child {
  grid-column: 2;
}

/* Related posts */
.related-posts {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.related-posts__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Comments section */
.comments-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

/* Comments CTA - for non-members */
.comments-cta {
  margin-top: 40px;
  padding: 40px 24px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.comments-cta__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.comments-cta__text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.comments-cta__btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.comments-cta__btn:hover {
  opacity: 0.85;
}

.comments-cta__signin {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.comments-cta__signin a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.comments-cta__signin a:hover {
  text-decoration: underline;
}

/* ==========================================
   FOOTNOTES
   ========================================== */

.footnotes {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--border-color);
}

.footnotes h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1em;
}

.footnotes-list {
  list-style: decimal;
  padding-left: 1.5em;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.footnotes-list li {
  margin-bottom: 0.5em;
  padding-left: 0.5em;
}

.footnote-backref {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  margin-left: 4px;
}

.footnote-backref:hover {
  text-decoration: underline;
}

/* Footnote anchor scroll offset - prevent jumping to very top */
[id^="fnref-"] {
  scroll-margin-top: 120px;
}

[id^="footnote-"] {
  scroll-margin-top: 120px;
}

/* Fix empty anchor tags that Ghost creates for footnote refs */
.post-content a:empty,
.post-content a:not([href]) {
  cursor: default;
}

.post-content a:empty:has(sup),
.post-content a:not([href]):has(sup) {
  cursor: pointer;
  color: var(--accent);
}

/* ==========================================
   SERIES NAVIGATION (Header)
   Only shows for articles with #code-after-series tag
   ========================================== */

.series-nav {
  margin: 20px 0;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.series-nav__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.series-nav__tag {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.series-nav__tag:hover {
  text-decoration: underline;
}

.series-nav__sep {
  color: var(--text-muted);
}

.series-nav__position {
  color: var(--text-muted);
}

.series-nav__toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.series-nav__toggle:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

.series-nav__toggle svg {
  transition: transform 0.2s ease;
}

.series-nav__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Series article list */
.series-nav__list {
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border-light);
  list-style: none;
  animation: seriesFadeIn 0.2s ease;
}

@keyframes seriesFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.series-nav__item {
  font-size: 13px;
  line-height: 1.5;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.series-nav__item a {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

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

.series-nav__num {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  min-width: 1.5em;
  flex-shrink: 0;
}

.series-nav__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-nav__item--current {
  background: var(--accent-bg);
}

.series-nav__item--current .series-nav__num {
  color: var(--accent);
  font-weight: 600;
}

.series-nav__item--current .series-nav__title {
  color: var(--accent);
  font-weight: 600;
}

/* ==========================================
   CHAPTER NAVIGATION (Footer)
   Previous / Next chapter links
   ========================================== */

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0;
  padding: 24px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.chapter-nav__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  text-decoration: none;
  transition: all 0.2s ease;
  max-width: 45%;
  min-width: 0;
  flex: 1;
}

.chapter-nav__link:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.chapter-nav__prev {
  align-items: flex-start;
}

.chapter-nav__next {
  align-items: flex-end;
  text-align: right;
}

.chapter-nav__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.chapter-nav__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.chapter-nav__link:hover .chapter-nav__title {
  color: var(--accent);
}

.chapter-nav__disabled {
  opacity: 0.5;
  cursor: default;
}

.chapter-nav__disabled:hover {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.chapter-nav__disabled .chapter-nav__title {
  color: var(--text-muted);
}

.chapter-nav__divider {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 8px;
}

.chapter-nav__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
}

.chapter-nav__dot--active {
  background: var(--accent);
}

/* ==========================================
   MOBILE BOTTOM NAV (Visible on small screens)
   ========================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-body);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.mobile-bottom-nav__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
  flex: none;
  position: relative;
}

/* Tooltip: text label on hover */
.mobile-bottom-nav__item::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 200;
}

.mobile-bottom-nav__item:hover::after {
  opacity: 1;
}

.mobile-bottom-nav__item:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.mobile-bottom-nav__item.active {
  color: var(--text-primary);
}

.mobile-bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  :root {
    --nav-width: 220px;
    --sidebar-width: 320px;
  }
  
  .content-wrapper {
    padding: 24px 28px;
  }
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 1fr var(--sidebar-width);
  }

  .breadcrumbs {
    display: none;
  }

  body {
    padding-bottom: 0;
  }

  .right-sidebar {
    padding-top: 120px; /* compensate for fixed mobile-header: 52px + 44px + gap */
    max-height: calc(100vh);
    overflow-y: auto;
  }

  /* Hide entire membership section in drawer mode */
  .nav-sidebar .nav-section-header,
  .nav-menu__account,
  .nav-sidebar a[data-portal="account"],
  .nav-sidebar a[data-portal="plans"],
  .nav-sidebar a[data-portal="signin"],
  .nav-sidebar a[data-portal="signup"],
  .nav-sidebar__bottom {
    display: none !important;
  }

  /* Left nav becomes a fixed drawer */
  .nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    background: var(--bg-body);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-sidebar.is-open {
    transform: translateX(0);
  }

  /* Show close button in drawer mode */
  .nav-sidebar__close {
    display: flex;
  }

  /* Show hamburger button */
  .mobile-menu-toggle {
    display: flex;
  }

  /* ---- Mobile Header ---- */
  .mobile-header {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 70;
    background: var(--bg-body);
  }

  .mobile-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
  }

  .mobile-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    min-width: 0;
  }

  .mobile-header__logo {
    height: 26px;
    width: auto;
  }

  .mobile-header__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .mobile-header__btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
  }

  .mobile-header__btn:hover {
    background: var(--bg-nav-hover);
    color: var(--text-primary);
  }

  .mobile-header__more {
    position: relative;
  }

  .mobile-more-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: flex;
    flex-direction: column;
    z-index: 60;
  }

  .mobile-more-dropdown[hidden] {
    display: none;
  }

  .mobile-more-dropdown a {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background var(--transition);
  }

  .mobile-more-dropdown a:hover {
    background: var(--bg-nav-hover);
  }

  .mobile-header__sub {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 12px;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-header__chevron {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
  }

  .mobile-header__breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
  }

  .mobile-header__breadcrumb a {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    transition: color var(--transition);
  }

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

  .mobile-header__breadcrumb span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .mobile-header__sep {
    color: var(--text-muted);
    font-weight: 400;
    flex-shrink: 0;
    margin: 0 2px;
  }

  .main-content {
    border-left: none;
  }

  .content-wrapper {
    padding: 112px 24px 40px;
    max-width: 100%;
  }

  /* Overlay for drawer */
  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
  }

  .mobile-overlay.is-active {
    display: block;
    opacity: 1;
  }
}

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

  .right-sidebar {
    display: none;
  }

  /* Hide sections when mobile-bottom-nav is visible */
  .hide-on-mobile {
    display: none !important;
  }

  /* Skeleton loading for infinite scroll - visible immediately */
  .latest-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
  }

  .skeleton-card {
    height: 120px;
    background: linear-gradient(
      90deg,
      var(--bg-card) 25%,
      var(--border-light) 50%,
      var(--bg-card) 75%
    );
    background-size: 200% 100%;
    border-radius: var(--radius-lg);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
  }

  .latest-end {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 14px;
  }

  .mobile-menu-toggle {
    display: none;
  }

  body {
    padding-bottom: 64px;
  }

  .site-footer--sidebar {
    display: none;
  }

  .site-footer--bottom {
    display: block;
    padding-left: 20px;
    padding-right: 20px;
  }

  .main-content {
    border-right: none;
  }

  .content-wrapper {
    padding: 112px 20px 80px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .floating-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    gap: 4px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Collapsed: only handle visible */
  .floating-toolbar.is-collapsed .toolbar-body {
    display: none;
  }

  .floating-toolbar.is-collapsed .toolbar-handle {
    display: flex;
  }

  /* Expanded: hide handle, show buttons */
  .floating-toolbar.is-expanded .toolbar-handle {
    display: none;
  }

  .floating-toolbar.is-expanded .toolbar-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 6px;
    box-shadow: var(--shadow-lg);
  }

  /* Auto-collapse after inactivity */
  .floating-toolbar.is-auto-collapsed .toolbar-body {
    display: none;
  }

  .floating-toolbar.is-auto-collapsed .toolbar-handle {
    display: flex;
  }

  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
  }
}

@media (max-width: 768px) {
  .authors-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .content-wrapper {
    padding: 100px 16px 72px;
  }

  .authors-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .author-card-home {
    padding: 16px 12px;
  }

  .author-card-home__avatar,
  .author-card-home__avatar-placeholder {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  .author-card-home__name {
    font-size: 14px;
  }

  .author-card-home__bio {
    font-size: 12px;
  }

  .chapter-nav {
    gap: 8px;
    margin: 24px 0;
    padding: 16px 0;
  }

  .chapter-nav__link {
    padding: 10px 12px;
  }

  .chapter-nav__title {
    font-size: 13px;
  }

  .chapter-nav__divider {
    display: none;
  }
  
  /* Mobile: feed-style post cards (compact layout) */
  .post-card {
    position: relative; /* For bookmark absolute positioning */
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    gap: 0;
    overflow: hidden; /* Clip image inside card border-radius */
  }

  .post-card__image-link {
    order: 2;
    margin: 12px 0;
    overflow: hidden;
    border-radius: var(--radius-md);
  }

  .post-card__image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    object-fit: cover;
  }

  .post-card__image-link .post-card__image--fallback {
    border-radius: 0;
    aspect-ratio: 16 / 9;
  }

  /* Top row: avatar + title inline */
  .post-card__top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }

  .post-card__top .post-card__author-link {
    display: flex;
    flex-shrink: 0;
    text-decoration: none;
  }

  .post-card__author-img,
  .post-card__author-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
  }

  /* Title + time + bookmark in header */
  .post-card__header {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .post-card__title {
    font-size: 16px;
    -webkit-line-clamp: 2;
    margin-bottom: 0;
  }

  .post-card__time {
    font-size: 12px;
    color: var(--text-muted);
  }

  .post-card__header .bookmark-btn {
    position: absolute;
    right: 16px;
    top: 16px;
  }

  /* Show time on mobile */
  .post-card__time {
    display: block;
  }

  .post-card__tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    margin-top: 2px;
    margin-bottom: 2px;
  }

  /* Excerpt - 6 lines on mobile */
  .post-card .post-card__excerpt {
    order: 3;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    margin-bottom: 0;
  }

  /* Meta - hidden on mobile */
  .post-card__meta {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .card-grid--2 {
    grid-template-columns: 1fr;
  }
  
  .tags-grid {
    grid-template-columns: 1fr;
  }
  
  /* Hide Latest Articles header on mobile */
  #latestArticles .section-header {
    display: none;
  }

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

  .post-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
  }

  .post-header__author {
    gap: 12px;
  }

  .post-header__author-img,
  .post-header__author-placeholder {
    width: 38px;
    height: 38px;
  }

  .post-header__author-name {
    font-size: 14px;
  }

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

  .post-nav__link--next:first-child:last-child {
    grid-column: 1;
  }

  .post-nav__link--next {
    text-align: left;
    align-items: flex-start;
  }

  .post-share {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header__title {
    font-size: 24px;
  }
  
  .mobile-header__bar {
    height: 48px;
    padding: 0 12px;
  }

  .mobile-header__sub {
    height: 40px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .podcast-item {
    gap: 12px;
  }
  
  .podcast-item__icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .post-content {
    font-size: 16px;
  }

  .post-content h2 {
    font-size: 22px;
    margin: 40px 0 20px;
  }

  .post-content h3 {
    font-size: 18px;
    margin: 32px 0 14px;
  }

  .post-content blockquote {
    padding: 18px 20px;
    font-size: 16px;
  }
  
  .mobile-bottom-nav {
    height: 52px;
  }
  
  .mobile-bottom-nav__item {
    width: 36px;
    height: 36px;
    padding: 0;
  }
}

/* ---- TOC Bottom Sheet (Mobile) ---- */
.toc-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toc-sheet-overlay.is-open {
  display: block;
  opacity: 1;
}

.toc-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--bg-body);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  z-index: 151;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.toc-sheet.is-open {
  transform: translateY(0);
}

.toc-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.toc-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.toc-sheet__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.toc-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.toc-sheet__close:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.toc-sheet__nav {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 24px;
  flex: 1;
}

.toc-sheet__nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.toc-sheet__nav a:hover,
.toc-sheet__nav a.active {
  background: var(--bg-nav-hover);
  color: var(--accent);
}

.toc-sheet__nav a.toc-link--h3 {
  padding-left: 26px;
  font-size: 13px;
}

.toc-sheet__nav a.toc-link--h4 {
  padding-left: 40px;
  font-size: 12px;
}

.toc-sheet__nav .toc-empty {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Series Bottom Sheet (Mobile) ---- */
.series-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.series-sheet-overlay.is-open {
  display: block;
  opacity: 1;
}

.series-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--bg-body);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  z-index: 151;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.series-sheet.is-open {
  transform: translateY(0);
}

.series-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.series-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.series-sheet__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.series-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.series-sheet__close:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.series-sheet__nav {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 24px;
  flex: 1;
}

.series-sheet__nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.series-sheet__nav a:hover,
.series-sheet__nav a.is-current {
  background: var(--bg-nav-hover);
  color: var(--accent);
}

.series-sheet__nav a.is-current {
  font-weight: 600;
}

.series-sheet__nav .series-part-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 36px;
}

.series-sheet__nav .series-part-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide series-nav on mobile when floatingToolbar shows it */
@media (max-width: 700px) {
  .series-nav {
    display: none;
  }
}

/* Show TOC/Series sheet only on mobile */
@media (min-width: 861px) {
  .toc-sheet,
  .toc-sheet-overlay,
  .series-sheet,
  .series-sheet-overlay {
    display: none !important;
  }
}

/* ==========================================
   AVATAR INITIAL (Letter Avatar)
   ========================================== */

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  flex-shrink: 0;
  /* Override any existing background */
  background: none !important;
}

/* Gradient backgrounds for different letters */
.avatar-initial--a { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.avatar-initial--b { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.avatar-initial--c { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.avatar-initial--d { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.avatar-initial--e { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.avatar-initial--f { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.avatar-initial--g { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.avatar-initial--h { background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%); }
.avatar-initial--i { background: linear-gradient(135deg, #fdcbf1 0%, #e6dee9 100%); }
.avatar-initial--j { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.avatar-initial--k { background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }
.avatar-initial--l { background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%); }
.avatar-initial--m { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.avatar-initial--n { background: linear-gradient(135deg, #fad0c4 0%, #ffd1ff 100%); }
.avatar-initial--o { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.avatar-initial--p { background: linear-gradient(135deg, #ff8a80 0%, #ea6100 100%); }
.avatar-initial--q { background: linear-gradient(135deg, #80cbc4 0%, #26a69a 100%); }
.avatar-initial--r { background: linear-gradient(135deg, #ce93d8 0%, #ab47bc 100%); }
.avatar-initial--s { background: linear-gradient(135deg, #90caf9 0%, #42a5f5 100%); }
.avatar-initial--t { background: linear-gradient(135deg, #a5d6a7 0%, #66bb6a 100%); }
.avatar-initial--u { background: linear-gradient(135deg, #ffcc80 0%, #ffa726 100%); }
.avatar-initial--v { background: linear-gradient(135deg, #ef9a9a 0%, #ef5350 100%); }
.avatar-initial--w { background: linear-gradient(135deg, #b39ddb 0%, #7e57c2 100%); }
.avatar-initial--x { background: linear-gradient(135deg, #81d4fa 0%, #29b6f6 100%); }
.avatar-initial--y { background: linear-gradient(135deg, #c5e1a5 0%, #9ccc65 100%); }
.avatar-initial--z { background: linear-gradient(135deg, #ffab91 0%, #ff7043 100%); }

/* Default for non-letters */
.avatar-initial--default { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); }

/* ==========================================
   POPULAR TAGS
   ========================================== */

.popular-tags-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.popular-tag-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.popular-tag-item:hover {
  background: var(--bg-nav-hover);
}

.popular-tag-item__image,
.popular-tag-item__placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.popular-tag-item__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.popular-tag-item__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popular-tag-item__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.popular-tag-item__count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================
   GHOST PORTAL OVERRIDES
   ========================================== */
.ghost-portal-root {
  z-index: 9999 !important;
}

/* ---- Hero Carousel Responsive ---- */
@media (max-width: 860px) {
  .hero-carousel {
    max-height: 360px;
  }

  .hero-carousel__content {
    padding: 28px 32px;
  }

  .hero-carousel__title {
    font-size: 24px;
  }

  .hero-carousel__excerpt {
    font-size: 13px;
  }

  .hero-carousel__arrow {
    opacity: 1;
    width: 36px;
    height: 36px;
  }

  .hero-carousel__dots {
    right: 24px;
  }
}

@media (max-width: 640px) {
  .hero-carousel {
    max-height: 320px;
    border-radius: var(--radius-md);
  }

  .hero-carousel__content {
    padding: 24px 20px;
    max-width: none;
  }

  .hero-carousel__title {
    font-size: 20px;
  }

  .hero-carousel__excerpt {
    -webkit-line-clamp: 2;
  }

  .hero-carousel__btn {
    padding: 9px 20px;
    font-size: 13px;
  }

  .hero-carousel__arrow {
    display: none;
  }

  .hero-carousel__dots {
    right: 50%;
    transform: translateX(50%);
  }
}

/* ---- Reading Progress ---- */
.reading-progress {
  position: fixed;
  top: 0;
  left: var(--nav-width);
  right: var(--sidebar-width);
  height: 3px;
  background: var(--accent);
  transform-origin: left;
  z-index: 50;
}

/* ---- Selection ---- */
::selection {
  background: var(--accent-light);
  color: var(--accent);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- Section Dividers ---- */
.content-section {
  padding: 28px 0;
  border-top: 1px solid var(--border-light);
}

.content-section:first-of-type {
  border-top: none;
}

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state__desc {
  font-size: 14px;
}

/* ==========================================
   Koenig Editor Styles (Required by Ghost)
   ========================================== */

/* Wide images - extend beyond content width */
.kg-width-wide {
  position: relative;
  width: calc(100% + 80px);
  max-width: calc(100% + 80px);
  margin-left: -40px;
  margin-right: -40px;
}

.kg-width-wide img {
  width: 100%;
  border-radius: var(--radius-md);
}

/* Full-width images - span entire main column */
.kg-width-full {
  position: relative;
  width: calc(100% + 80px);
  max-width: calc(100% + 80px);
  margin-left: -40px;
  margin-right: -40px;
}

.kg-width-full img {
  width: 100%;
  border-radius: 0;
}

/* Gallery card */
.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kg-gallery-row {
  display: flex;
  gap: 8px;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Audio card */
.kg-audio-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* Video card */
.kg-video-card video {
  width: 100%;
  border-radius: var(--radius-md);
}

/* File card */
.kg-file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.kg-file-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.kg-file-card-contents {
  flex: 1;
  min-width: 0;
}

.kg-file-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.kg-file-card-caption {
  font-size: 12px;
  color: var(--text-muted);
}

.kg-file-card-metadata {
  font-size: 12px;
  color: var(--text-muted);
}

/* Product card */
.kg-product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
}

.kg-product-card-image img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.kg-product-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.kg-product-card-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Toggle card */
.kg-toggle-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
}

.kg-toggle-heading {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kg-toggle-content {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* NFT card */
.kg-nft-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* Callout card */
.kg-callout-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.kg-callout-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.kg-callout-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.kg-callout-card.kg-style-accent {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Responsive Koenig styles */
@media (max-width: 640px) {
  .kg-width-wide,
  .kg-width-full {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}


/* ==========================================
   AUTH FULLSCREEN PAGE (signup/signin)
   Uses default.hbs layout but hides nav/sidebar
   ========================================== */

/* When auth page is present, override the 3-column layout */
.app-layout:has(.auth-page-fullscreen) {
  display: block;
  width: 100vw;
  min-height: 100vh;
}

.app-layout:has(.auth-page-fullscreen) .nav-sidebar,
.app-layout:has(.auth-page-fullscreen) .right-sidebar,
.app-layout:has(.auth-page-fullscreen) .mobile-overlay,
.app-layout:has(.auth-page-fullscreen) .mobile-bottom-nav,
body:has(.auth-page-fullscreen) .mobile-header,
body:has(.auth-page-fullscreen) .mobile-menu-toggle,
body:has(.auth-page-fullscreen) .mobile-bottom-nav,
body:has(.auth-page-fullscreen) .mobile-overlay {
  display: none !important;
}

.app-layout:has(.auth-page-fullscreen) .main-content {
  width: 100%;
  max-width: none;
  padding: 0;
  overflow: visible;
  border: none;
}

/* ==========================================
   PORTAL AVATAR OVERRIDE (Letter Avatar)
   ========================================== */

/* Hide broken avatar images in Portal */
.gh-portal-avatar img[src=""],
.gh-portal-avatar img:not([src]),
.gh-portal-avatar img[src*="gravatar"],
.gh-portal-list-avatar img[src=""],
.gh-portal-list-avatar img:not([src]) {
  display: none !important;
}

/* Style Portal avatar container as letter avatar */
.gh-portal-avatar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
}

/* Portal member name - extract first letter */
.gh-portal-avatar::before {
  content: attr(data-initial);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 20px;
}

/* Also style list avatars */
.gh-portal-list-avatar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 12px !important;
}

/* Auth page fullscreen */
.auth-page-fullscreen {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  margin-left: calc(-1 * var(--nav-width));
}

/* Left side - Image */
.auth-page-fullscreen__image {
  width: 50%;
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

/* Right side - Content */
.auth-page-fullscreen__content {
  width: 50%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 80px;
  position: relative;
}

/* Back to home */
.auth-page-fullscreen__back {
  position: absolute;
  top: 32px;
  left: 80px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.auth-page-fullscreen__back:hover {
  color: var(--text-primary);
}

/* Title */
.auth-page-fullscreen__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

/* Description */
.auth-page-fullscreen__desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Form */
.auth-form-full {
  margin-bottom: 24px;
}

.auth-form-full__field {
  margin-bottom: 12px;
}

.auth-form-full__input {
  width: 100%;
  max-width: 400px;
  padding: 14px 18px;
  font-size: 15px;
  border: 1px solid var(--border-light);
  border-radius: 100px;
  background: #f5f5f5;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.auth-form-full__input:focus {
  border-color: var(--accent);
  background: var(--bg-primary);
}

.auth-form-full__input::placeholder {
  color: var(--text-muted);
}

/* Submit button */
.auth-form-full__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #000;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: opacity var(--transition);
  margin-top: 4px;
}

.auth-form-full__btn:hover {
  opacity: 0.85;
}

.auth-form-full__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Message */
.auth-form-full__message {
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

.auth-form-full__message.is-error {
  color: var(--error, #ef4444);
}

/* Portal inline container */
.portal-inline {
  width: 100%;
  max-width: 400px;
}

.portal-inline iframe {
  width: 100% !important;
  border: none !important;
  background: transparent !important;
}

/* Footer text */
.auth-page-fullscreen__footer-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-page-fullscreen__footer-text a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

/* Footer */
.auth-page-fullscreen__footer {
  position: absolute;
  bottom: 24px;
  left: 80px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-page-fullscreen__footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* ==========================================
   AUTH FULLSCREEN PAGE (Responsive)
   ========================================== */

@media (max-width: 860px) {
  .auth-page-fullscreen__image {
    display: none;
  }

  .auth-page-fullscreen {
    margin-left: 0;
  }

  .auth-page-fullscreen__content {
    width: 100%;
    padding: 40px 32px;
  }

  .auth-page-fullscreen__back {
    left: 32px;
  }

  .auth-page-fullscreen__footer {
    left: 32px;
  }

  .app-layout:has(.auth-page-fullscreen) .main-content {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .auth-page-fullscreen__content {
    padding: 80px 24px 40px;
    justify-content: flex-start;
  }

  .auth-page-fullscreen__back {
    top: 24px;
    left: 24px;
  }

  .auth-page-fullscreen__title {
    font-size: 28px;
  }

  .auth-page-fullscreen__footer {
    position: static;
    margin-top: 40px;
    left: auto;
  }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
