/* ============================================================
   keshavkaviti.com — Design System
   A long-form personal publication.
   Intelligent. Calm. Reflective. Timeless.
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,300;1,6..72,400;1,6..72,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,300;1,8..60,400;1,8..60,500&family=Inter:wght@300;400;500;600&display=swap');

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

/* --- Custom Properties --- */
:root {
  /* Colors */
  --ink:          hsl(220, 20%, 12%);
  --ink-light:    hsl(220, 15%, 28%);
  --paper:        hsl(40, 25%, 97%);
  --paper-warm:   hsl(38, 30%, 94%);
  --stone:        hsl(220, 10%, 45%);
  --stone-light:  hsl(220, 8%, 62%);
  --accent:       hsl(24, 60%, 48%);
  --accent-hover: hsl(24, 65%, 40%);
  --accent-soft:  hsl(24, 40%, 93%);
  --border:       hsl(40, 15%, 88%);
  --border-light: hsl(40, 12%, 92%);
  --highlight:    hsl(48, 80%, 92%);
  --shadow:       hsla(220, 20%, 12%, 0.06);

  /* Typography */
  --font-headline: 'Newsreader', Georgia, serif;
  --font-body:     'Source Serif 4', Georgia, serif;
  --font-ui:       'Inter', -apple-system, sans-serif;

  /* Sizes */
  --content-width: min(680px, 90vw);
  --wide-width:    min(960px, 94vw);
  --full-width:    min(1200px, 96vw);

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --duration: 0.25s;
}

/* --- Base --- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

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

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

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

/* --- Reading Progress Bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--duration) var(--ease);
}

.nav.scrolled {
  box-shadow: 0 1px 8px var(--shadow);
}

.nav-inner {
  max-width: var(--full-width);
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-logo:hover {
  color: var(--ink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--stone);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color var(--duration) var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
}

.nav-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--stone);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color var(--duration) var(--ease);
}

.nav-search-btn:hover {
  color: var(--ink);
}

.nav-search-btn svg {
  width: 18px;
  height: 18px;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 0.25rem;
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 599px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70vw;
    max-width: 280px;
    height: 100vh;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem;
    gap: 1.5rem;
    border-left: 1px solid var(--border);
    transition: right 0.35s var(--ease);
    box-shadow: -4px 0 20px var(--shadow);
    z-index: 100;
  }

  .nav-links.open {
    right: 0;
  }

  .nav-links a {
    font-size: 1rem;
  }

  .nav-overlay {
    position: fixed;
    inset: 0;
    background: hsla(220, 20%, 12%, 0.3);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
  }

  .nav-overlay.visible {
    opacity: 1;
    visibility: visible;
  }
}

/* --- Page Transitions --- */
.page {
  display: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.page.active {
  display: block;
  opacity: 1;
}

/* --- Hero (Home) --- */
.hero {
  position: relative;
  width: 100%;
  max-height: 65vh;
  min-height: 320px;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 65vh;
  min-height: 320px;
  object-fit: cover;
  object-position: center 40%;
  filter: brightness(0.85);
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
  background: linear-gradient(to top, hsla(220, 20%, 8%, 0.7), transparent);
}

.hero-title {
  font-family: var(--font-headline);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  color: white;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.9375rem, 2vw, 1.125rem);
  color: hsla(0, 0%, 100%, 0.82);
  max-width: 540px;
  line-height: 1.65;
  font-weight: 300;
  font-style: italic;
}

/* --- Section Headers --- */
.section-label {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-lg);
}

.section-label::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--border);
  margin-left: 0.75rem;
  vertical-align: middle;
}

/* --- Featured Article (Home) --- */
.home-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-3xl) 1.5rem;
}

.featured-card {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  cursor: pointer;
  transition: opacity var(--duration) var(--ease);
}

.featured-card:hover {
  opacity: 0.88;
}

.featured-card .card-category {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.featured-card .card-title {
  font-family: var(--font-headline);
  font-size: clamp(1.625rem, 3.5vw, 2.25rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: var(--space-md);
  letter-spacing: -0.015em;
}

.featured-card .card-excerpt {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--stone);
  line-height: 1.7;
  margin-bottom: var(--space-md);
  max-width: 580px;
}

.featured-card .card-meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--stone-light);
  letter-spacing: 0.02em;
}

.featured-card .card-meta span + span::before {
  content: '·';
  margin: 0 0.5em;
}

/* --- Recent Strip (Home) --- */
.recent-strip {
  margin-bottom: var(--space-2xl);
}

.recent-list {
  display: grid;
  gap: var(--space-lg);
}

.recent-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity var(--duration) var(--ease);
}

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

.recent-item:last-child {
  border-bottom: none;
}

.recent-item .ri-title {
  font-family: var(--font-headline);
  font-size: 1.125rem;
  color: var(--ink);
  flex: 1;
  line-height: 1.35;
}

.recent-item .ri-meta {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--stone-light);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.archive-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.03em;
  margin-top: var(--space-xl);
  transition: gap var(--duration) var(--ease);
}

.archive-link:hover {
  gap: 0.75rem;
  color: var(--accent-hover);
}

.archive-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--duration) var(--ease);
}

.archive-link:hover svg {
  transform: translateX(2px);
}

/* --- Ingest Page --- */
.ingest-header {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: var(--space-2xl) 1.5rem var(--space-xl);
}

.ingest-title {
  font-family: var(--font-headline);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xl);
}

/* Search */
.search-container {
  position: relative;
  max-width: 480px;
  margin-bottom: var(--space-lg);
}

.search-input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

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

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

/* Category Chips */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-lg);
}

.chip {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--stone);
  background: white;
  border: 1px solid var(--border);
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  user-select: none;
}

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

.chip.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

/* Sort & Count */
.ingest-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--stone-light);
}

.sort-select {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--stone);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}

/* Article Cards Grid */
.cards-grid {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem var(--space-3xl);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }
}

.article-card {
  cursor: pointer;
  transition: transform var(--duration) var(--ease), opacity var(--duration) var(--ease);
}

.article-card:hover {
  transform: translateY(-2px);
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: var(--space-md);
  background: var(--border-light);
}

.card-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--paper-warm), var(--border-light));
  border-radius: 4px;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-headline);
  font-size: 1.5rem;
  color: var(--border);
}

.article-card .card-category {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.375rem;
}

.article-card .card-title {
  font-family: var(--font-headline);
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.article-card .card-excerpt {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--stone);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .card-meta {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--stone-light);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.article-card .card-meta span + span::before {
  content: '·';
  margin: 0 0.4em;
}

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

.card-tag {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  color: var(--stone-light);
  background: var(--paper-warm);
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}

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

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl) 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--stone-light);
  font-style: italic;
}

/* --- Article Page --- */
.article-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2xl) 1.5rem var(--space-3xl);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 4rem;
  align-items: start;
}

@media (max-width: 768px) {
  .article-page {
    grid-template-columns: minmax(0, 1fr);
  }
}

.article-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  height: max-content;
  border-right: 1px solid var(--border);
  padding-right: 2rem;
}

@media (max-width: 768px) {
  .article-sidebar {
    display: none;
  }
}

.sidebar-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-item {
  cursor: pointer;
  group: hover;
}

.sidebar-item-title {
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

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

.sidebar-item-meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-light);
}

.sidebar-more-btn {
  margin-top: 1.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.5rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.sidebar-more-btn:hover {
  border-color: var(--text);
  background: var(--bg-alt);
}

.article-main {
  max-width: 760px;
}

.medium-header {
  margin-bottom: 2rem;
}

.medium-header h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  font-weight: 700;
  overflow-wrap: break-word;
}

.medium-author-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-alt);
}

.author-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.author-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text);
}

.author-follow {
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.author-follow:hover {
  opacity: 0.7;
}

.author-meta {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.medium-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  color: var(--text-light);
}

.action-group {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0;
  transition: color 0.2s;
}

.action-btn svg {
  width: 22px;
  height: 22px;
}

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

.article-header h1 {
  font-family: var(--font-headline);
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.article-header .article-meta {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--stone);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.article-header .article-meta span + span::before {
  content: '·';
  margin: 0 0.35em;
}

.article-hero-image {
  width: calc(100% + 3rem);
  margin-left: -1.5rem;
  margin-bottom: var(--space-2xl);
  max-height: 500px;
  object-fit: cover;
  border-radius: 0;
}

@media (min-width: 768px) {
  .article-hero-image {
    width: calc(100% + 6rem);
    margin-left: -3rem;
    border-radius: 4px;
  }
}

/* --- Article Body Typography --- */
.article-body {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 3vw, 1.125rem);
  line-height: 1.8;
  color: var(--ink);
}

.article-body p {
  margin-bottom: 1.5em;
}

.article-body h2 {
  font-family: var(--font-headline);
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 400;
  color: var(--ink);
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.article-body h3 {
  font-family: var(--font-headline);
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 500;
  color: var(--ink);
  margin-top: 2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.75em 0;
  padding: 0.5em 0 0.5em 1.5em;
  font-style: italic;
  color: var(--ink-light);
}

.article-body blockquote p {
  margin-bottom: 0.5em;
}

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

.article-body blockquote.pull-quote {
  border-left: none;
  border: none;
  background: var(--highlight);
  padding: 1.5em 2em;
  margin: 2em -1rem;
  border-radius: 4px;
  font-family: var(--font-headline);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink);
  position: relative;
}

@media (min-width: 768px) {
  .article-body blockquote.pull-quote {
    margin: 2em -2rem;
    padding: 2em 2.5em;
    font-size: 1.375rem;
  }
}

.article-body ul, .article-body ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.article-body li {
  margin-bottom: 0.5em;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: hsla(24, 60%, 48%, 0.3);
  transition: text-decoration-color var(--duration) var(--ease);
}

.article-body a:hover {
  text-decoration-color: var(--accent);
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.article-body figure {
  margin: 2em 0;
}

.article-body figure img {
  width: 100%;
  border-radius: 4px;
}

.article-body figcaption {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--stone-light);
  text-align: center;
  margin-top: 0.625rem;
  font-style: italic;
}

.article-body strong {
  font-weight: 600;
}

.article-body em {
  font-style: italic;
}

/* Video embeds */
.article-body .video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 2em 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--ink);
}

.article-body .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --- Article Footer --- */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.article-tag {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--stone);
  background: var(--paper-warm);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.article-tag:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Share Actions */
.share-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
}

.share-label {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: white;
  color: var(--stone);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

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

.share-btn svg {
  width: 15px;
  height: 15px;
}

.share-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: white;
  background: var(--ink);
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease);
  z-index: 1000;
}

.share-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- Related Articles --- */
.related-section {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

.related-grid {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 600px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.related-card {
  cursor: pointer;
  transition: opacity var(--duration) var(--ease);
}

.related-card:hover {
  opacity: 0.75;
}

.related-card .card-category {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.related-card .card-title {
  font-family: var(--font-headline);
  font-size: 1.0625rem;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.related-card .card-meta {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--stone-light);
}

/* --- About Page --- */
.about-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-3xl) 1.5rem;
}

.about-page h1 {
  font-family: var(--font-headline);
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 400;
  color: var(--ink);
  margin-bottom: var(--space-xl);
  letter-spacing: -0.02em;
}

.about-page p {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--ink-light);
  margin-bottom: 1.5em;
}

.about-page p:first-of-type {
  font-size: 1.1875rem;
  color: var(--ink);
}

.about-divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: var(--space-2xl) 0;
}

/* --- Footer --- */
.site-footer {
  max-width: var(--full-width);
  margin: 0 auto;
  padding: var(--space-xl) 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--stone-light);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.footer-links a {
  color: var(--stone-light);
  transition: color var(--duration) var(--ease);
}

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

/* --- Utility --- */
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* --- Loading state --- */
.loading-skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--paper-warm) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Print styles --- */
@media print {
  .nav, .reading-progress, .share-actions, .related-section, .site-footer {
    display: none !important;
  }

  body {
    font-size: 12pt;
    background: white;
  }

  .article-page {
    max-width: 100%;
    padding: 0;
  }
}

/* Modal CSS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: var(--bg);
  padding: 2.5rem;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}
.modal-overlay.active .modal-content {
  transform: translateY(0);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover {
  background: var(--stone);
  color: var(--text);
}
.modal-close svg {
  width: 20px;
  height: 20px;
}

/* Comments Panel */
.comments-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.comments-panel-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.primary-btn {
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 99px;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary-btn:hover {
  opacity: 0.85;
}
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.comments-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 100%;
  height: 100%;
  background: white;
  box-shadow: -5px 0 30px rgba(0,0,0,0.1);
  z-index: 9999;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.comments-panel.active {
  right: 0;
}
.comments-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.comments-header h2 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  color: #292929;
}
.comments-header .modal-close {
  color: #6b6b6b;
}
.comments-header .modal-close svg {
  width: 24px;
  height: 24px;
  stroke-width: 1;
}
.comments-form-container {
  padding: 1rem 1.5rem 2rem;
}
.comment-author-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.comment-author-row img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f2f2f2;
}
.comment-author-row span {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #292929;
}
.comment-input, .comment-textarea {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  background: #f9f9f9;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #292929;
  outline: none;
  transition: background 0.2s;
}
.comment-input:focus, .comment-textarea:focus {
  background: #f2f2f2;
}
.comment-input::placeholder, .comment-textarea::placeholder {
  color: #6b6b6b;
}
.comment-textarea {
  resize: vertical;
  min-height: 80px;
  margin-top: 0.75rem;
}
.comments-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}
.comments-list {
  padding: 0 1.5rem 1.5rem;
  flex: 1;
  overflow-y: auto;
}
.comment-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--stone);
}
.comment-item:last-child {
  border-bottom: none;
}
.comment-author {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}
.comment-date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}
.comment-body {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

