/* ============================================================
   POST — SINGLE ARTICLE STYLES
   ============================================================ */

/* ── Reading Progress Bar ──────────────────────────────────── */

.post-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 100;
  background: transparent;
  pointer-events: none;
}

.post-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  box-shadow: 0 0 12px rgba(255, 80, 4, 0.5);
  transition: width 0.08s linear;
}

.post {
  padding-top: calc(var(--nav-height) + var(--space-16));
  padding-bottom: var(--space-16);
  background: var(--color-bg);
}

.post__loading {
  padding-block: var(--space-4);
}

.post-skeleton {
  max-width: 820px;
  margin-inline: auto;
}

.post-skeleton__block {
  border-radius: 8px;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.09) 37%,
    rgba(255, 255, 255, 0.04) 63%
  );
  background-size: 400% 100%;
  animation: post-skeleton-pulse 1.6s ease-in-out infinite;
}

@keyframes post-skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.post-skeleton__category {
  width: 120px;
  height: 12px;
  margin-bottom: var(--space-4);
}

.post-skeleton__title {
  width: 90%;
  height: 44px;
  margin-bottom: var(--space-3);
}

.post-skeleton__title--short {
  width: 55%;
  height: 44px;
  margin-bottom: var(--space-6);
}

.post-skeleton__meta {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.post-skeleton__meta span {
  width: 90px;
  height: 12px;
  display: block;
}

.post-skeleton__cover {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  margin: 0 auto var(--space-12);
}

.post-skeleton__line {
  max-width: 720px;
  height: 16px;
  margin: 0 auto var(--space-4);
}

.post-skeleton__line--w90 { width: 90%; }
.post-skeleton__line--w80 { width: 80%; }
.post-skeleton__line--w95 { width: 95%; }
.post-skeleton__line--w60 { width: 60%; margin-bottom: var(--space-8); }

.post__not-found {
  text-align: center;
  padding-block: var(--space-20);
}

.post__not-found h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  margin-bottom: var(--space-4);
}

.post__not-found p {
  color: var(--color-text-muted);
}

/* ── Post Content ───────────────────────────────────────────── */

.post__header {
  max-width: 820px;
  margin-inline: auto;
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-12);
}

.post__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  transition: color var(--transition-fast);
}

.post__back svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.post__header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.post__header-top .post__back {
  margin-bottom: 0;
}

.post__theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.post__theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
}

.post__theme-toggle svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post__category {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.post__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: var(--weight-black);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
}

.post__meta {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.post__meta-author {
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

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

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

.post__meta-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.post__meta-tag {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.post__cover {
  max-width: 960px;
  margin-inline: auto;
  margin-bottom: var(--space-12);
  border-radius: 14px;
  overflow: hidden;
}

.post__cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  display: block;
  transform: scale(1.08);
  opacity: 0;
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
  will-change: transform;
}

.post__cover img.is-loaded {
  transform: scale(1);
  opacity: 1;
}

.post__content {
  max-width: 720px;
  margin-inline: auto;
  font-size: var(--text-md);
  line-height: 1.85;
  color: var(--color-text);
}

/* Scroll-reveal for direct content children */
.post__content > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.post__content > *.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .post__content > *,
  .post__cover img {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

.post__content h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--nav-height) + var(--space-8));
}

.post__content h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  scroll-margin-top: calc(var(--nav-height) + var(--space-8));
}

.post__content p {
  margin-bottom: var(--space-5);
  color: rgba(255, 255, 255, 0.85);
}

.post__content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

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

.post__content ul,
.post__content ol {
  margin-bottom: var(--space-5);
  padding-left: var(--space-6);
}

.post__content li {
  margin-bottom: var(--space-2);
  color: rgba(255, 255, 255, 0.85);
}

.post__content blockquote {
  position: relative;
  max-width: 640px;
  margin: var(--space-12) auto;
  padding: 0 var(--space-8);
  text-align: center;
  border-left: none;
  font-style: normal;
  font-weight: var(--weight-semi);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.post__content blockquote::before {
  content: '"';
  display: block;
  font-size: 3.5rem;
  font-weight: var(--weight-black);
  line-height: 1;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
  opacity: 0.85;
}

.post__content blockquote p {
  margin-bottom: 0;
  color: inherit;
}

.post__content img {
  max-width: 100%;
  border-radius: 10px;
  margin: var(--space-6) 0;
  border: 1px solid var(--color-border);
}

.post__content figure {
  margin: var(--space-8) 0;
}

.post__content figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
}

/* ── Social Share ──────────────────────────────────────────── */

.post-share {
  position: fixed;
  right: var(--space-6);
  top: calc(50% + 170px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.post-share.visible {
  opacity: 1;
  pointer-events: all;
}

.post-share__btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-share__btn:hover {
  color: var(--color-text);
  border-color: rgba(255, 80, 4, 0.4);
  transform: scale(1.1);
}

.post-share__btn.is-copied {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.post-share__btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-share__inline {
  display: none;
}

@media (max-width: 1180px) {
  .post-share {
    display: none;
  }

  .post-share__inline {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
  }

  .post-share__inline-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .post-share__inline .post-share__btn {
    width: 32px;
    height: 32px;
  }
}

/* ── Newsletter Prompt (end of post) ──────────────────────── */

.post-newsletter {
  max-width: 720px;
  margin: var(--space-16) auto 0;
  padding: var(--space-10) var(--space-8);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  text-align: center;
}

.post-newsletter__headline {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.post-newsletter__sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 420px;
  margin-inline: auto;
}

.post-newsletter__form {
  display: flex;
  gap: var(--space-3);
  max-width: 420px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.post-newsletter__form input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.2s;
}

.post-newsletter__form input:focus {
  border-color: var(--color-accent);
}

.post-newsletter__form button {
  padding: 12px 22px;
  border-radius: 8px;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.post-newsletter__form button:hover {
  background: var(--color-accent-dim);
  transform: translateY(-1px);
}

/* ── Light Mode (post page only) ──────────────────────────── */
/* Scoped via [data-post-theme="light"] on <body>, only ever set
   by post.js on this page. Overrides the same custom properties
   post.css already relies on, so no other selectors are needed
   for the article itself. Nav/footer colors depend on nav.css /
   footer.css — if those files use hardcoded colors rather than
   these variables, they won't invert; share nav.css/footer.css
   if you want the toggle to affect them too. */

body[data-post-theme="light"] {
  --color-bg: #ffffff;
  --color-text: #1a0a2e;
  --color-text-muted: #6b5b7a;
  --color-border: #e6dff0;
  --color-accent: #FF5004;
  --color-accent-dim: #cc4003;
}

body[data-post-theme="light"] .post__content p,
body[data-post-theme="light"] .post__content li {
  color: rgba(26, 10, 46, 0.82);
}

body[data-post-theme="light"] .post-skeleton__block {
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.08) 37%,
    rgba(0, 0, 0, 0.04) 63%
  );
  background-size: 400% 100%;
}

body[data-post-theme="light"] .post-toc__line {
  background: rgba(0, 0, 0, 0.08);
}

body[data-post-theme="light"] .post-toc__dot {
  background: rgba(0, 0, 0, 0.18);
}

body[data-post-theme="light"] .post-toc__label,
body[data-post-theme="light"] .post-toc__toggle,
body[data-post-theme="light"] .post-toc__drawer {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a0a2e;
}

body[data-post-theme="light"] .post-share__btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

body[data-post-theme="light"] .post-newsletter {
  background: rgba(0, 0, 0, 0.02);
}

body[data-post-theme="light"] .post-newsletter__form input {
  background: #fff;
}

.post-toc {
  position: fixed;
  right: var(--space-6);
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.post-toc.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Progress Line ─────────────────────────────────────────── */

.post-toc__line {
  position: relative;
  width: 2px;
  height: 120px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: visible;
  flex-shrink: 0;
}

.post-toc__line-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: height 0.1s linear;
}

/* ── Dots ───────────────────────────────────────────────────── */

.post-toc__dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.post-toc__dot-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-toc__dot-wrapper:hover {
  transform: scale(1.2);
}

.post-toc__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.post-toc__dot-wrapper.active .post-toc__dot {
  background: var(--color-accent);
  box-shadow: 0 0 20px rgba(255, 80, 4, 0.3);
  width: 8px;
  height: 8px;
}

/* ── Tooltip Labels ────────────────────────────────────────── */

.post-toc__label {
  position: absolute;
  right: calc(100% + var(--space-4));
  top: 50%;
  transform: translateY(-50%);
  background: rgba(11, 1, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--color-text);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%) translateX(8px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.post-toc__dot-wrapper:hover .post-toc__label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ── Toggle Button ─────────────────────────────────────────── */

.post-toc__toggle {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-8);
  z-index: 51;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 1, 20, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--color-text-muted);
}

.post-toc__toggle:hover {
  border-color: rgba(255, 80, 4, 0.3);
  color: var(--color-text);
  transform: scale(1.05);
}

.post-toc__toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-toc__toggle.active {
  background: rgba(255, 80, 4, 0.15);
  border-color: rgba(255, 80, 4, 0.3);
  color: var(--color-accent);
}

/* ── Mobile Drawer ─────────────────────────────────────────── */

.post-toc__drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 49;
  background: rgba(11, 1, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: var(--space-6) var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.4);
}

.post-toc__drawer.open {
  transform: translateY(0);
}

.post-toc__drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.post-toc__drawer-label {
  font-size: 10px;
  font-weight: var(--weight-semi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.post-toc__drawer-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--space-2);
  transition: color var(--transition-fast);
}

.post-toc__drawer-close:hover {
  color: var(--color-text);
}

.post-toc__drawer-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-toc__drawer-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-toc__drawer-link {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-radius: 8px;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.post-toc__drawer-link:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
}

.post-toc__drawer-link.active {
  color: var(--color-accent);
  background: rgba(255, 80, 4, 0.08);
}

/* ── Desktop: Hide drawer, show floating TOC ──────────────── */

@media (min-width: 769px) {
  .post-toc__drawer {
    display: none;
  }
  
  .post-toc__toggle {
    display: none;
  }
  
  .post-toc {
    display: flex;
  }
}

/* ── Tablet: Show toggle button, hide floating TOC ────────── */

@media (max-width: 768px) {
  .post-toc {
    display: none;
  }
  
  .post-toc__toggle {
    display: flex;
  }
  
  .post-toc__toggle.visible {
    display: flex;
  }
}

/* ── Responsive tweaks ─────────────────────────────────────── */

@media (max-width: 768px) {
  .post__header {
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-8);
  }

  .post__content {
    font-size: var(--text-base);
  }

  .post__content h2 {
    font-size: var(--text-lg);
  }

  .post__meta {
    gap: var(--space-4);
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  .post-toc__drawer {
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  }
  
  .post-toc__drawer-link {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-3);
  }
}