/* ============================================================
   CABBAGGE.COM — Fashion Editorial Stylesheet
   ============================================================ */

/* ===== 1. Design Tokens ===== */
:root {
  --cabbage-ink:   #1f1f1f;
  --cabbage-leaf:  #5a7d4d;
  --cabbage-heart: #88a86e;
  --cabbage-cream: #f7f4ee;
  --cabbage-cream2:#f6f1e7;
  --accent-rose:   #c56c74;
  --border-soft:   #e6e1d9;
  --text-muted:    #6e6a64;
  --text-teaser:   #5b574f;
}

/* ===== 2. Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  background: var(--cabbage-cream);
  color: var(--cabbage-ink);
}
a { color: var(--cabbage-leaf); text-decoration: none; }
a:hover { color: var(--accent-rose); }
img { max-width: 100%; height: auto; }

/* ===== 3. Typography ===== */
.title-serif {
  font-family: "Didot", "Bodoni MT", "Playfair Display", "Noto Serif Display", Georgia, serif;
}
.eyebrow {
  font-size: .7rem;
  letter-spacing: .08em;
  font-weight: 700;
  color: #4a6b3f;
  text-transform: uppercase;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 4. Navigation ===== */
.topbar {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
  z-index: 1030;
}
.topbar.shadow { box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.brand-wordmark {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--cabbage-ink);
  letter-spacing: 3px;
}
.brand-dot { color: var(--cabbage-leaf); }
.nav-cat a {
  font-weight: 600;
  color: var(--cabbage-ink);
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .2s;
}
.nav-cat a:hover { color: var(--cabbage-leaf); text-decoration: none; }
.nav-cat .nav-link.active { color: var(--cabbage-leaf); }
.offcanvas-title {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
}

/* ===== 5. Promo Banner ===== */
.promo-banner {
  background: var(--cabbage-cream2);
  color: #111;
  border-top: 1px solid #ece5da;
  border-bottom: 1px solid #ece5da;
}
.promo-banner .close { opacity: .7; background: none; border: 0; color: inherit; }
.promo-banner .close:hover { opacity: 1; }

/* ===== 6. Buttons ===== */
.btn-leaf {
  background: var(--cabbage-leaf);
  color: #fff;
  border: 0;
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: .03em;
  transition: background .2s;
}
.btn-leaf:hover { background: var(--cabbage-heart); color: #fff; }
.badge-cat {
  background: var(--cabbage-heart);
  color: #fff;
  border-radius: 2px;
  font-weight: 600;
  font-size: .7rem;
  letter-spacing: .04em;
  padding: .35em .7em;
}

/* ===== 7. Hero ===== */
.hero-wrap {
  position: relative;
  overflow: hidden;
  border-radius: .25rem;
}
.hero-img {
  width: 100%;
  height: min(72vh, 720px);
  object-fit: cover;
  display: block;
}
.hero-copy {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2rem 2rem 2.5rem;
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,.45) 55%,
    rgba(0,0,0,.7) 100%
  );
}
.hero-copy .eyebrow { color: rgba(255,255,255,.85); }
.hero-copy h1 { font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.3); }

/* Video hero */
.video-hero {
  border-radius: .25rem;
  overflow: hidden;
}
.video-hero video {
  width: 100%;
  display: block;
}

/* ===== 8. Section Headers ===== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--cabbage-ink);
}
.section-head h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: .03em;
}
.section-head a {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== 9. Editors' Picks — Alternating Horizontal Cards ===== */
.card-h {
  display: flex;
  gap: 1.5rem;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--border-soft);
  padding: 1.5rem 0;
  margin: 0;
}
.card-h .media { flex: 0 0 50%; max-width: 50%; }
.card-h img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: .25rem;
  transition: transform .4s ease;
}
/* hover: see section 30 */
.card-h .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card-h .body h3 { margin-bottom: .25rem; }
.card-h .teaser {
  color: var(--text-teaser);
  line-height: 1.7;
  font-size: 1rem;
  margin-top: .35rem;
}
.card-h.alt { flex-direction: row-reverse; }
@media (max-width: 992px) {
  .card-h, .card-h.alt { flex-direction: column; }
  .card-h .media { max-width: 100%; }
}

/* ===== 10. Featured Mosaic (1 large + 3 portrait) ===== */
.feature-big img {
  width: 100%;
  aspect-ratio: 16/11;
  object-fit: cover;
  border-radius: .25rem;
  transition: transform .4s ease;
}
/* hover: see section 30 */
.feature-small img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: .25rem;
  transition: transform .4s ease;
}
/* hover: see section 30 */
.feature-small .teaser {
  color: var(--text-teaser);
  margin-top: .25rem;
  font-size: .9rem;
}

/* ===== 11. Gallery Grid — Elle.com Style Mixed Orientations ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}
.gallery-grid .g-item {
  overflow: hidden;
  position: relative;
}
.gallery-grid .g-item a {
  display: block;
  overflow: hidden;
  border-radius: .25rem;
}
.gallery-grid .g-item img {
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}
/* hover: see section 30 */
.gallery-grid .g-item .g-meta { margin-top: .5rem; }
.gallery-grid .g-item .g-meta h4 { font-size: 1.05rem; margin-bottom: .15rem; }
.gallery-grid .g-item .g-meta .teaser {
  color: var(--text-teaser);
  font-size: .9rem;
  line-height: 1.5;
}

/* 5-item repeating pattern for visual variety */
.gallery-grid .g-item:nth-child(5n+1) { grid-column: span 7; }
.gallery-grid .g-item:nth-child(5n+1) img { aspect-ratio: 16/10; }

.gallery-grid .g-item:nth-child(5n+2) { grid-column: span 5; }
.gallery-grid .g-item:nth-child(5n+2) img { aspect-ratio: 3/4; }

.gallery-grid .g-item:nth-child(5n+3) { grid-column: span 4; }
.gallery-grid .g-item:nth-child(5n+3) img { aspect-ratio: 1/1; }

.gallery-grid .g-item:nth-child(5n+4) { grid-column: span 4; }
.gallery-grid .g-item:nth-child(5n+4) img { aspect-ratio: 16/10; }

.gallery-grid .g-item:nth-child(5n+5) { grid-column: span 4; }
.gallery-grid .g-item:nth-child(5n+5) img { aspect-ratio: 3/4; }

/* Tablet: 2 columns */
@media (min-width: 769px) and (max-width: 992px) {
  .gallery-grid .g-item { grid-column: span 6 !important; }
  .gallery-grid .g-item img { aspect-ratio: 4/3 !important; }
}
/* Mobile: single column */
@media (max-width: 768px) {
  .gallery-grid .g-item { grid-column: span 12 !important; }
  .gallery-grid .g-item img { aspect-ratio: 16/10 !important; }
}

/* ===== 12. More Stories — Simple Grid Fallback ===== */
.more-card img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: .25rem;
  transition: transform .4s ease;
}
/* hover: see section 30 */
.more-card .teaser {
  color: var(--text-teaser);
  line-height: 1.6;
  margin-top: .35rem;
  font-size: .9rem;
}

/* ===== 13. Post / Article Page ===== */
.post h1 {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.08;
  margin-bottom: .75rem;
  letter-spacing: -.01em;
}
.post .dek {
  font-size: 1.15rem;
  color: var(--text-teaser);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.post .post-meta {
  font-size: .82rem;
  color: var(--text-muted);
}
.post figure { margin: 2rem 0; }
.post figure img {
  width: 100%;
  height: auto;
  border-radius: .25rem;
}
.post figure figcaption {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .5rem;
  font-style: italic;
}
.post .post-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--cabbage-ink);
}
.post .post-body h2 {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: 1.6rem;
  margin-top: 2rem;
  margin-bottom: .75rem;
}
.post .post-body h3 {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: .5rem;
}
.post .post-body img {
  width: 100%;
  height: auto;
  border-radius: .25rem;
  margin: 1.5rem 0;
}
.post .post-body blockquote {
  border-left: 3px solid var(--cabbage-leaf);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-teaser);
  font-style: italic;
  font-size: 1.1rem;
}
.post .post-body ul, .post .post-body ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}
.post .post-body li { margin-bottom: .4rem; }

/* Photo post hero */
.photo-hero {
  margin-bottom: 2rem;
}
.photo-hero img {
  width: 100%;
  max-height: 85vh;
  object-fit: cover;
  display: block;
}

/* ===== 14. Footer ===== */
.footer {
  background: #fff;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
}

/* ===== 15. Loading / Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, #ebe6de 25%, #f0ece5 50%, #ebe6de 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: .25rem;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-text { height: 1rem; margin-bottom: .5rem; }
.skeleton-title { height: 1.8rem; width: 60%; margin-bottom: .75rem; }
.skeleton-img { aspect-ratio: 16/10; }

/* ===== 16. Transitions & Hover Effects ===== */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 17. Empty State ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  color: var(--cabbage-ink);
  margin-bottom: .5rem;
}

/* ===== 18. Category Filter Pills ===== */
.cat-filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.cat-pill {
  padding: .35rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cabbage-ink);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--cabbage-leaf);
  color: #fff;
  border-color: var(--cabbage-leaf);
}

/* ===== 19. Reading Progress Bar ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--cabbage-leaf), var(--cabbage-heart));
  z-index: 9999;
  transition: width 50ms linear;
}

/* ===== 20. Social Share Buttons ===== */
.share-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 0;
}
.share-bar .share-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--cabbage-ink);
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.share-btn:hover {
  background: var(--cabbage-leaf);
  color: #fff;
  border-color: var(--cabbage-leaf);
  text-decoration: none;
}
.share-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ===== 21. Image Lightbox ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  transform: scale(.95);
  transition: transform .3s ease;
}
.lightbox-overlay.active img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  opacity: .7;
  transition: opacity .2s;
  line-height: 1;
}
.lightbox-close:hover { opacity: 1; }

/* ===== 22. Scroll-Triggered Subscribe Slide-Up ===== */
.subscribe-slide {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border-soft);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 1rem 2rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: bottom .4s cubic-bezier(.4,0,.2,1);
  max-width: 600px;
  width: 90%;
}
.subscribe-slide.visible { bottom: 0; }
.subscribe-slide .sub-text {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: .95rem;
  flex: 1;
}
.subscribe-slide .sub-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: .5;
  padding: 0 4px;
}
.subscribe-slide .sub-close:hover { opacity: 1; }

/* ===== 23. Drop Cap for first paragraph ===== */
.post .post-body > p:first-of-type::first-letter {
  float: left;
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: 3.5rem;
  line-height: .8;
  padding-right: .15rem;
  padding-top: .1rem;
  color: var(--cabbage-leaf);
  font-weight: 700;
}

/* ===== 24. Pull Quote ===== */
.pull-quote {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--cabbage-leaf);
  text-align: center;
  padding: 2rem 1.5rem;
  margin: 2rem 0;
  border-top: 2px solid var(--border-soft);
  border-bottom: 2px solid var(--border-soft);
  font-style: italic;
}

/* ===== 25. Related Posts ===== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.related-grid .related-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: .25rem;
  transition: transform .4s ease;
}
/* hover: see section 30 */
.related-grid .related-card h5 {
  font-size: .95rem;
  margin-top: .5rem;
  margin-bottom: .15rem;
}
@media (max-width: 768px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* ===== 26. Divider ===== */
.editorial-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  color: var(--border-soft);
}
.editorial-divider::before,
.editorial-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
.editorial-divider span {
  font-size: .7rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== 27. Skip-to-Content ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cabbage-leaf);
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 0 0 .25rem .25rem;
  font-size: .9rem;
  font-weight: 600;
  z-index: 9999;
  transition: top .2s ease;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid var(--cabbage-ink);
  outline-offset: 2px;
  color: #fff;
}

/* ===== 28. Focus Visible ===== */
:focus-visible {
  outline: 2px solid var(--cabbage-leaf);
  outline-offset: 2px;
}
.btn-leaf:focus-visible {
  outline-color: var(--cabbage-ink);
  box-shadow: 0 0 0 3px rgba(90,125,77,.3);
}
.share-btn:focus-visible,
.cat-pill:focus-visible {
  outline-color: var(--cabbage-leaf);
}
.nav-cat a:focus-visible {
  outline-offset: 4px;
}

/* ===== 29. Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in { opacity: 1; transform: none; }
  .skeleton { animation: none; }
  .subscribe-slide { transition: none; }
}

/* ===== 30. Hover — Pointer Devices Only ===== */
@media (hover: hover) {
  .card-h:hover img { transform: scale(1.02); }
  .feature-big:hover img { transform: scale(1.02); }
  .feature-small:hover img { transform: scale(1.02); }
  .gallery-grid .g-item:hover img { transform: scale(1.03); }
  .more-card:hover img { transform: scale(1.02); }
  .related-grid .related-card:hover img { transform: scale(1.02); }
}

/* ===== 31. Print Styles ===== */
@media print {
  .topbar, .promo-banner, .offcanvas, .subscribe-slide,
  .reading-progress, .lightbox-overlay, .share-bar,
  .cat-filters, .footer, .modal, .toast,
  #subscribeSlide, #promoBanner, #prevNext, .skip-link {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .post .post-body {
    font-size: 12pt;
    line-height: 1.6;
  }
  a { color: #000; text-decoration: underline; }
  .post .post-body img {
    max-width: 100%;
    page-break-inside: avoid;
  }
  h1, h2, h3 { page-break-after: avoid; }
}

/* ===== 32. Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --cabbage-ink:   #e8e4de;
    --cabbage-cream: #1a1a1a;
    --cabbage-cream2:#222;
    --border-soft:   #333;
    --text-muted:    #9a968f;
    --text-teaser:   #b0aba3;
  }
  html, body { background: #1a1a1a; color: #e8e4de; }
  a { color: var(--cabbage-heart); }
  a:hover { color: #d4868d; }

  /* Nav */
  .topbar { background: #1e1e1e; border-bottom-color: #333; }
  .topbar.shadow { box-shadow: 0 6px 24px rgba(0,0,0,.4); }
  .navbar.bg-white { background: #1e1e1e !important; }
  .brand-wordmark { color: #e8e4de; }
  .nav-cat a { color: #ccc; }
  .nav-cat a:hover, .nav-cat .nav-link.active { color: var(--cabbage-heart); }
  .offcanvas { background: #1e1e1e; color: #e8e4de; }
  .navbar-toggler-icon { filter: invert(1); }

  /* Promo banner */
  .promo-banner { background: #252525; color: #ccc; border-color: #333; }

  /* Buttons */
  .btn-leaf { background: var(--cabbage-leaf); }
  .btn-outline-dark { color: #ccc; border-color: #555; }
  .btn-outline-dark:hover { background: #333; color: #fff; border-color: #666; }

  /* Cards & content */
  .card-h { border-bottom-color: #333; }
  .section-head { border-bottom-color: #444; }
  img { opacity: .92; }

  /* Footer */
  .footer { background: #1e1e1e; border-top-color: #333; }

  /* Modal */
  .modal-content { background: #252525; color: #e8e4de; }
  .modal-header { border-bottom-color: #333; }
  .modal-footer { border-top-color: #333; }
  .form-control, .form-select { background: #333; color: #e8e4de; border-color: #444; }
  .form-control:focus, .form-select:focus { background: #3a3a3a; color: #e8e4de; border-color: var(--cabbage-leaf); }
  .btn-close { filter: invert(1); }

  /* Skeleton */
  .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 400% 100%;
  }

  /* Post page */
  .post .post-body blockquote { border-left-color: var(--cabbage-heart); }
  .post .post-body > p:first-of-type::first-letter { color: var(--cabbage-heart); }
  .badge-cat { background: var(--cabbage-leaf); }

  /* Share buttons */
  .share-btn { background: #2a2a2a; border-color: #444; color: #ccc; }
  .share-btn:hover { background: var(--cabbage-leaf); color: #fff; border-color: var(--cabbage-leaf); }

  /* Lightbox */
  .lightbox-overlay { background: rgba(0,0,0,.96); }

  /* Subscribe slide */
  .subscribe-slide { background: #252525; border-color: #333; }

  /* Category pills */
  .cat-pill { border-color: #444; color: #ccc; }
  .cat-pill:hover, .cat-pill.active { background: var(--cabbage-leaf); color: #fff; border-color: var(--cabbage-leaf); }

  /* Toast */
  .toast { background: #333 !important; }

  /* Related posts */
  .editorial-divider { color: #444; }
  .editorial-divider::before, .editorial-divider::after { background: #444; }

  /* Empty state */
  .empty-state { color: #9a968f; }
  .empty-state h3 { color: #e8e4de; }

  /* Eyebrow darken override for dark mode */
  .eyebrow { color: var(--cabbage-heart); }
  .hero-copy .eyebrow { color: rgba(255,255,255,.85); }
}

/* Dark mode manual toggle override — mirrors all @media rules above */
[data-theme="dark"] {
  --cabbage-ink:   #e8e4de;
  --cabbage-cream: #1a1a1a;
  --cabbage-cream2:#222;
  --border-soft:   #333;
  --text-muted:    #9a968f;
  --text-teaser:   #b0aba3;
}
[data-theme="dark"] html, [data-theme="dark"] body,
html[data-theme="dark"], body[data-theme="dark"] { background: #1a1a1a; color: #e8e4de; }
[data-theme="dark"] a { color: var(--cabbage-heart); }
[data-theme="dark"] a:hover { color: #d4868d; }
[data-theme="dark"] .topbar { background: #1e1e1e; border-bottom-color: #333; }
[data-theme="dark"] .topbar.shadow { box-shadow: 0 6px 24px rgba(0,0,0,.4); }
[data-theme="dark"] .navbar.bg-white { background: #1e1e1e !important; }
[data-theme="dark"] .brand-wordmark { color: #e8e4de; }
[data-theme="dark"] .nav-cat a { color: #ccc; }
[data-theme="dark"] .nav-cat a:hover, [data-theme="dark"] .nav-cat .nav-link.active { color: var(--cabbage-heart); }
[data-theme="dark"] .offcanvas { background: #1e1e1e; color: #e8e4de; }
[data-theme="dark"] .navbar-toggler-icon { filter: invert(1); }
[data-theme="dark"] .promo-banner { background: #252525; color: #ccc; border-color: #333; }
[data-theme="dark"] .btn-leaf { background: var(--cabbage-leaf); }
[data-theme="dark"] .btn-outline-dark { color: #ccc; border-color: #555; }
[data-theme="dark"] .btn-outline-dark:hover { background: #333; color: #fff; border-color: #666; }
[data-theme="dark"] .card-h { border-bottom-color: #333; }
[data-theme="dark"] .section-head { border-bottom-color: #444; }
[data-theme="dark"] img { opacity: .92; }
[data-theme="dark"] .footer { background: #1e1e1e; border-top-color: #333; }
[data-theme="dark"] .modal-content { background: #252525; color: #e8e4de; }
[data-theme="dark"] .modal-header { border-bottom-color: #333; }
[data-theme="dark"] .modal-footer { border-top-color: #333; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: #333; color: #e8e4de; border-color: #444; }
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus { background: #3a3a3a; color: #e8e4de; border-color: var(--cabbage-leaf); }
[data-theme="dark"] .btn-close { filter: invert(1); }
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
  background-size: 400% 100%;
}
[data-theme="dark"] .post .post-body blockquote { border-left-color: var(--cabbage-heart); }
[data-theme="dark"] .post .post-body > p:first-of-type::first-letter { color: var(--cabbage-heart); }
[data-theme="dark"] .badge-cat { background: var(--cabbage-leaf); }
[data-theme="dark"] .share-btn { background: #2a2a2a; border-color: #444; color: #ccc; }
[data-theme="dark"] .share-btn:hover { background: var(--cabbage-leaf); color: #fff; border-color: var(--cabbage-leaf); }
[data-theme="dark"] .lightbox-overlay { background: rgba(0,0,0,.96); }
[data-theme="dark"] .subscribe-slide { background: #252525; border-color: #333; }
[data-theme="dark"] .cat-pill { border-color: #444; color: #ccc; }
[data-theme="dark"] .cat-pill:hover, [data-theme="dark"] .cat-pill.active { background: var(--cabbage-leaf); color: #fff; border-color: var(--cabbage-leaf); }
[data-theme="dark"] .toast { background: #333 !important; }
[data-theme="dark"] .editorial-divider { color: #444; }
[data-theme="dark"] .editorial-divider::before, [data-theme="dark"] .editorial-divider::after { background: #444; }
[data-theme="dark"] .empty-state { color: #9a968f; }
[data-theme="dark"] .empty-state h3 { color: #e8e4de; }
[data-theme="dark"] .eyebrow { color: var(--cabbage-heart); }
[data-theme="dark"] .hero-copy .eyebrow { color: rgba(255,255,255,.85); }
[data-theme="dark"] .search-box { background: #252525; }
[data-theme="dark"] .back-to-top { background: #333; color: #ccc; border-color: #444; }

/* Light mode manual override — force light when system is dark */
[data-theme="light"] {
  --cabbage-ink:   #1f1f1f;
  --cabbage-cream: #f7f4ee;
  --cabbage-cream2:#f6f1e7;
  --border-soft:   #e6e1d9;
  --text-muted:    #6e6a64;
  --text-teaser:   #5b574f;
}
html[data-theme="light"], html[data-theme="light"] body { background: #f7f4ee; color: #1f1f1f; }
[data-theme="light"] .topbar { background: #fff; border-bottom-color: #e6e1d9; }
[data-theme="light"] .navbar.bg-white { background: #fff !important; }
[data-theme="light"] .brand-wordmark { color: #1f1f1f; }
[data-theme="light"] .nav-cat a { color: var(--cabbage-ink); }
[data-theme="light"] .offcanvas { background: #fff; color: #1f1f1f; }
[data-theme="light"] .navbar-toggler-icon { filter: none; }
[data-theme="light"] .footer { background: #fff; border-top-color: #e6e1d9; }
[data-theme="light"] .modal-content { background: #fff; color: #1f1f1f; }
[data-theme="light"] .form-control, [data-theme="light"] .form-select { background: #fff; color: #1f1f1f; border-color: #dee2e6; }
[data-theme="light"] .btn-close { filter: none; }
[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
  background-size: 400% 100%;
}
[data-theme="light"] img { opacity: 1; }
[data-theme="light"] .search-box { background: #fff; }
[data-theme="light"] .back-to-top { background: #fff; }

/* ===== 33. Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cabbage-leaf);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s, transform .3s, background .2s;
  pointer-events: none;
  z-index: 1050;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover { background: var(--cabbage-heart); }

/* ===== 34. Search Overlay ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.search-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.search-box {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 560px;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .search-box { background: #252525; }
}
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: .75rem 1rem;
  gap: .75rem;
  border-bottom: 1px solid var(--border-soft);
}
.search-input-wrap svg { width: 20px; height: 20px; fill: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  color: var(--cabbage-ink);
  outline: none;
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
  font-size: .7rem;
  padding: 2px 6px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: inherit;
}
.search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: .5rem;
}
.search-results:empty::after {
  content: 'Start typing to search...';
  display: block;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.search-result {
  display: block;
  padding: .75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--cabbage-ink);
  transition: background .15s;
}
.search-result:hover, .search-result.active {
  background: var(--cabbage-cream2);
  text-decoration: none;
  color: var(--cabbage-ink);
}
.search-result .sr-title {
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.search-result .sr-desc {
  font-size: .82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result .sr-meta {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.search-no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ===== 35. Table of Contents (post page) ===== */
.toc-wrap {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 1rem;
}
.toc-title {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-list li {
  margin-bottom: .4rem;
}
.toc-list a {
  font-size: .82rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 2px 0 2px 0;
  border-left: 2px solid transparent;
  padding-left: .75rem;
  transition: all .2s;
  line-height: 1.4;
}
.toc-list a:hover {
  color: var(--cabbage-leaf);
}
.toc-list a.active {
  color: var(--cabbage-leaf);
  border-left-color: var(--cabbage-leaf);
  font-weight: 600;
}
.toc-list .toc-h3 {
  padding-left: 1.5rem;
  font-size: .78rem;
}
@media (max-width: 1199px) {
  .toc-sidebar { display: none; }
}

/* ===== 36. Theme Toggle Button ===== */
.theme-toggle {
  border: 1px solid var(--border-soft);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
  color: var(--text-muted);
}
.theme-toggle:hover { background: var(--cabbage-cream2); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle { border-color: #444; color: #ccc; }
[data-theme="dark"] .theme-toggle:hover { background: #333; }

/* ===== 37. Multi-Image Lightbox Nav ===== */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  z-index: 9999;
  line-height: 1;
  opacity: .7;
}
.lightbox-nav:hover { background: rgba(255,255,255,.3); opacity: 1; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .05em;
  pointer-events: none;
}
.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.8);
  font-size: .85rem;
  text-align: center;
  max-width: 70%;
  pointer-events: none;
}
@media (max-width: 576px) {
  .lightbox-nav { width: 36px; height: 36px; font-size: 1.5rem; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* ===== 38. Bookmark Button ===== */
.bookmark-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all .2s;
  color: #666;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.bookmark-btn:hover { background: #fff; color: var(--cabbage-leaf); transform: scale(1.1); }
.bookmark-btn.saved { color: var(--cabbage-leaf); background: #fff; }
.bookmark-btn svg { width: 16px; height: 16px; fill: currentColor; }
[data-theme="dark"] .bookmark-btn { background: rgba(30,30,30,.85); color: #999; }
[data-theme="dark"] .bookmark-btn:hover { background: #333; color: var(--cabbage-leaf); }
[data-theme="dark"] .bookmark-btn.saved { color: var(--cabbage-leaf); background: #333; }
.post-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  transition: all .2s;
}
.post-bookmark-btn:hover { border-color: var(--cabbage-leaf); color: var(--cabbage-leaf); }
.post-bookmark-btn.saved { border-color: var(--cabbage-leaf); color: var(--cabbage-leaf); }
.post-bookmark-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ===== 39. Saved Articles Overlay ===== */
.saved-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.saved-overlay.active { opacity: 1; pointer-events: auto; }
.saved-box {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
[data-theme="dark"] .saved-box { background: #252525; }
.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  font-family: "Didot","Bodoni MT","Playfair Display",Georgia,serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cabbage-ink);
}
.saved-header button {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.saved-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: var(--cabbage-ink);
  transition: background .15s;
}
.saved-item:hover { background: var(--cabbage-cream2); text-decoration: none; color: var(--cabbage-ink); }
.saved-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.saved-item-info { flex: 1; min-width: 0; }
.saved-item-title {
  font-family: "Didot","Bodoni MT","Playfair Display",Georgia,serif;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.saved-item-meta { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.saved-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  flex-shrink: 0;
  transition: color .2s;
}
.saved-item-remove:hover { color: var(--accent-rose); }
.saved-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.saved-count {
  background: var(--cabbage-leaf);
  color: #fff;
  font-size: .6rem;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  top: -6px;
  margin-left: -4px;
  font-weight: 700;
}
