/* ============================================================
   Duckzilla Blog — styles.css
   Palette mirrors Duckzilla-Website/public/styles.css exactly
   ============================================================ */

:root {
  --bg: #0b0d12;
  --bg-elev: #141822;
  --bg-elev-hover: #1b2030;
  --border: #232938;
  --text: #e6e9ef;
  --text-muted: #9aa3b2;
  --accent: #7c9cff;
  --accent-glow: rgba(124, 156, 255, 0.18);
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --max-w: 1100px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(124, 156, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(168, 85, 247, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Layout ---- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 24px 60px;
}

/* ---- Navigation ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-nav__brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav__cats {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav__toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.site-nav__toggle:hover {
  background: var(--bg-elev);
  border-color: rgba(124, 156, 255, 0.4);
}

.site-nav__toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-nav.is-open .site-nav__toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.site-nav.is-open .site-nav__toggle-bar:nth-child(2) {
  opacity: 0;
}
.site-nav.is-open .site-nav__toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.site-nav__cat {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav__cat:hover {
  color: var(--text);
  background: var(--bg-elev);
}

/* ---- Dropdown for parent categories with children ---- */
.site-nav__dropdown {
  position: relative;
  display: inline-block;
}

.site-nav__cat--has-children {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.site-nav__caret {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.site-nav__dropdown:hover .site-nav__caret,
.site-nav__dropdown:focus-within .site-nav__caret {
  transform: rotate(180deg);
  color: var(--accent);
}

.site-nav__dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.45);
  z-index: 200;
}

.site-nav__dropdown:hover .site-nav__dropdown-menu,
.site-nav__dropdown:focus-within .site-nav__dropdown-menu {
  display: flex;
}

.site-nav__dropdown-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav__dropdown-item:hover {
  color: var(--text);
  background: var(--bg-elev-hover);
}

/* ---- Hero ---- */
.hero { margin-bottom: 48px; }

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hero__sub {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

/* ---- Section title ---- */
.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* ---- Post grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ---- Post card ---- */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  color: var(--text);
}

.post-card:hover {
  transform: translateY(-3px);
  background: var(--bg-elev-hover);
  border-color: rgba(124, 156, 255, 0.4);
  box-shadow: 0 12px 32px -12px rgba(124, 156, 255, 0.25);
}

.post-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
}

.post-card__thumb--placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--accent-glow);
  border-radius: var(--radius) var(--radius) 0 0;
}

.post-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-card__cat {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.post-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
}

.post-card__excerpt {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* ---- Article 2-column layout ---- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  align-items: start;
}

/* ---- Article content typography ---- */
.article-content { min-width: 0; }

.article-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0 0 24px;
  display: block;
  border: 1px solid var(--border);
}

.article-thumb--placeholder {
  background:
    radial-gradient(600px 200px at 30% 0%, rgba(124, 156, 255, 0.18), transparent 60%),
    radial-gradient(400px 180px at 80% 100%, rgba(168, 85, 247, 0.15), transparent 60%),
    var(--bg-elev);
}

.article-content .post-card__cat { margin-bottom: 8px; display: block; }

/* ---- Breadcrumb on article ---- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.breadcrumb__link {
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.breadcrumb__link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb__sep {
  color: var(--border);
  font-weight: 300;
}

.breadcrumb__current {
  color: var(--text);
  font-weight: 500;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-content h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.article-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.article-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Share buttons ---- */
.article-share {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

.article-share__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.article-share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.article-share__btn:hover {
  color: var(--accent);
  border-color: rgba(124, 156, 255, 0.4);
  background: var(--accent-glow);
}

.article-share__copy {
  font-family: inherit;
}

/* ---- Table of Contents ---- */
.article-toc {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 32px 0;
}

.article-toc__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.article-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-toc__item a {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: color 0.15s ease;
}

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

.article-toc__item--lvl2 { padding-left: 0; }
.article-toc__item--lvl3 { padding-left: 16px; }
.article-toc__item--lvl4 { padding-left: 32px; }
.article-toc__item--lvl5 { padding-left: 48px; }
.article-toc__item--lvl6 { padding-left: 64px; }

/* ---- Draft preview banner ---- */
.preview-banner {
  margin: 0 0 24px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-glow);
  color: var(--text);
  font-size: 0.9rem;
}

/* ---- Image lightbox ---- */
.article-content img,
.article-thumb:not(.article-thumb--placeholder) {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(5, 7, 12, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: zoom-out;
  animation: lightbox-fade 0.18s ease;
}

@keyframes lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox.is-open { display: flex; }

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: default;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

/* ---- Floating TOC toggle (shows after scrolling past inline TOC) ---- */
.toc-floater {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.toc-floater.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.toc-floater__btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toc-floater__btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.toc-floater__btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toc-floater__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(320px, calc(100vw - 48px));
  max-height: min(60vh, 480px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toc-floater__panel[hidden] {
  display: none;
}

.toc-floater__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.toc-floater__panel .article-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* anchor offset for sticky header */
.article-content :is(h1, h2, h3, h4, h5, h6) {
  scroll-margin-top: 80px;
}

/* ---- Comments (Giscus) ---- */
.comments {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.comments__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--text);
}

.giscus, .giscus-frame {
  width: 100%;
}

.article-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2em 0 0.6em; }
.article-content h3 { font-size: 1.2rem; font-weight: 600; margin: 1.8em 0 0.5em; }
.article-content h4 { font-size: 1.05rem; font-weight: 600; margin: 1.6em 0 0.4em; }
.article-content h5, .article-content h6 { font-size: 1rem; font-weight: 600; margin: 1.4em 0 0.4em; }

.article-content p { margin: 0 0 1em; }

.article-content ul, .article-content ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}

.article-content li { margin-bottom: 0.3em; }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 0.6em 1em;
  color: var(--text-muted);
  font-style: italic;
}

.article-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
}

.article-content pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.875rem;
}

.article-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1em 0;
  display: block;
}

.article-content a {
  color: var(--accent);
  text-decoration: none;
}

.article-content a:hover { text-decoration: underline; }

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.sidebar-widget {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.sidebar-widget__title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.sidebar-widget__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-widget__item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.35;
  transition: color 0.15s ease;
}

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

.sidebar-widget__thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-widget__thumb--placeholder {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-widget__item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-widget__empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.875rem;
  text-align: center;
  padding: 8px 0;
}

/* ---- Category page header ---- */
.cat-header { margin-bottom: 40px; }

.cat-header h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0 0 6px;
}

.cat-header__count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: 80px;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.site-footer__copy { margin: 0; }

.site-footer__links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer__links a {
  color: var(--text-muted);
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer__links a:hover {
  color: var(--accent);
  border-bottom-color: rgba(124, 156, 255, 0.4);
}

/* ---- Error pages ---- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  gap: 16px;
  padding: 40px 0;
}

.error-page__code {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
}

.error-page h2 { font-size: 1.2rem; font-weight: 600; margin: 8px 0 16px; }
.error-page p { color: var(--text-muted); max-width: 480px; margin: 0 auto 32px; }

.error-page__btn {
  display: inline-block;
  background: var(--accent-glow);
  border: 1px solid rgba(124, 156, 255, 0.4);
  color: var(--accent);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.error-page__btn:hover {
  background: rgba(124, 156, 255, 0.28);
  border-color: rgba(124, 156, 255, 0.65);
}

/* ---- Heart (footer) ---- */
.heart {
  color: #ff4d6d;
  display: inline-block;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ---- Lazyload sentinel & spinner ---- */
.lazyload-sentinel {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.lazyload-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lazyload-spin 0.8s linear infinite;
}

@keyframes lazyload-spin {
  to { transform: rotate(360deg); }
}

/* ---- Search bar in nav ---- */
.site-nav__search {
  flex: 0 1 240px;
  display: flex;
}

.site-nav__search input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-nav__search input::placeholder { color: var(--text-muted); }

.site-nav__search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

@media (max-width: 600px) {
  .site-nav__search { display: none; }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 600px) {
  .site-nav__inner { flex-wrap: wrap; gap: 12px; }
  .site-nav__toggle { display: inline-flex; }

  .site-nav__cats {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
  }

  .site-nav.is-open .site-nav__cats { display: flex; }

  .site-nav__cat,
  .site-nav__dropdown { width: 100%; }

  .site-nav__cat { padding: 10px 12px; }

  .site-nav__dropdown-menu {
    position: static;
    display: flex !important;
    flex-direction: column;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0 0 0 12px;
    min-width: 0;
  }

  .site-nav__caret { display: none; }

  .container { padding: 64px 16px 48px; }

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

/* ---- Tag pills ---- */
.article-tags {
  margin: 12px 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.tag-pill:hover {
  color: var(--accent);
  border-color: rgba(124, 156, 255, 0.4);
  background: var(--accent-glow);
}

/* ---- Series link on article ---- */
.article-series-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 8px;
}
.article-series-link:hover { text-decoration: underline; }
