/**
 * post-details.css
 * Specialized Neo-Brutalist styling for blog post detail pages.
 * Handles: Typography, Carousels, Tables, TOC Drawer, and Scroll Utility.
 */

/* Unified Neo-Brutalist Styling (2px border, 4px shadow) for interactive elements */
.table-responsive,
.post-body-inner blockquote,
.post-body-inner img,
.post-body-inner pre,
.post-body-inner .iframe-wrapper {
  border: 2px solid var(--color-text) !important;
  box-shadow: 4px 4px 0px var(--color-text) !important;
  border-radius: 0 !important;
}

/* ── Carousel Widget Styling ── */
.carousel-widget {
  margin: 3rem 0;
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
}

.carousel-widget-header {
  background: var(--color-sherbet) !important;
  border-bottom: none;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--color-text);
}

.carousel-widget-view {
  position: relative;
  width: 100%;
  overflow: hidden;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-widget-track {
  display: flex;
  align-items: flex-start;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.carousel-widget-slide {
  flex: 0 0 100%;
  height: auto;
  width: 100%;
  min-height: 100px;
  /* padding: 24px; */
  background: var(--color-surface);
  box-sizing: border-box;
  border: none !important;
}

.carousel-widget-slide img,
.carousel-widget-slide blockquote,
.carousel-widget-slide pre {
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.carousel-widget-slide .table-responsive {
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.carousel-widget-slide table {
  margin: 0.5rem !important;
  border: none !important;
  width: calc(100% - 1rem) !important;
}

.carousel-widget-slide p {
  margin: 0.1em !important;
}

.carousel-nav-btn {
  width: 40px;
  height: 40px;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  box-shadow: 3px 3px 0px var(--color-text);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 10;
}

.carousel-nav-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px var(--color-text);
  background: var(--color-accent-soft);
}

.carousel-nav-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px var(--color-text);
}

.carousel-controls {
  display: flex;
  gap: 12px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  border-top: 2px solid var(--color-text);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--color-text);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.carousel-dot.active {
  background: var(--color-text);
  transform: scale(1.2);
}

/* ── Table Styling ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2.5rem 0;
  background: var(--color-surface);
}

.table-responsive table {
  margin: 0 !important;
  width: 100%;
  border-collapse: collapse;
  font-size: 1.15rem;
  min-width: 600px;
  border: none !important;
}

.table-responsive th,
.table-responsive td {
  padding: 10px 16px;
  border: 1px solid var(--color-text);
  text-align: left;
}

.table-responsive th {
  background: var(--color-accent-soft);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--color-text);
}

/* ── Post Body Content Styling ── */
.post-content {
  margin-top: 130px !important;
}

.post-body-inner blockquote {
  margin: 3rem 0;
  padding: 24px 32px;
  background: var(--color-accent-soft);
  font-size: 1.15rem;
  line-height: 1.7;
  font-style: italic;
  color: var(--color-text);
}

.post-body-inner p {
  margin-bottom: 0.6em;
}

.post-body-inner h1, 
.post-body-inner h2, 
.post-body-inner h3 {
  font-family: var(--font-display);
  font-weight: 800;
  margin-top: 0.8em;
  margin-bottom: 0.3em;
}

.post-body-inner ul, 
.post-body-inner ol {
  margin: 0.5em 0 0.5em 3rem;
  padding-left: 0;
}

.post-body-inner li {
  margin-bottom: 0;
}

.post-body-inner ul {
  list-style-type: none !important;
}

.post-body-inner ul li {
  list-style-type: none !important;
  position: relative;
}

.post-body-inner ul li::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 0.65em;
  width: 6.8px;
  height: 6.8px;
  background: var(--color-mint);
  border: 1.5px solid var(--color-text);
  box-shadow: none !important;
  flex-shrink: 0;
}

/* ── Table of Contents drawer ── */
.toc-toggle-btn {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  box-shadow: -4px 4px 0px var(--color-text);
  padding: 18px 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text);
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border-radius: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toc-btn-icon { display: none; }
.toc-btn-label { display: block; }

.toc-toggle-btn:hover { background: var(--color-mint); }

.toc-toggle-btn.toc-active {
  display: none !important;
}

.post-toc-widget {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--color-surface);
  border-left: 1.5px solid var(--color-text);
  box-shadow: -3px 0px 0px var(--color-text);
  padding: 2.5rem 2rem;
  z-index: 999;
  overflow-y: auto;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-toc-widget.toc-open { right: 0; }

.post-toc-widget .toc-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.post-toc-widget ul { list-style: none !important; padding: 0 !important; margin: 0 !important; }

.post-toc-widget li {
  margin-bottom: 0.8em !important;
  line-height: 1.4;
  position: relative;
  padding-left: 1.5rem;
}

.post-toc-widget li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  background: var(--color-mint);
  border: 1.5px solid var(--color-text);
  display: block;
}

.post-toc-widget a {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.post-toc-widget a:hover {
  color: var(--color-mint-down);
  transform: translateX(4px);
  text-decoration: underline;
}

.toc-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  box-shadow: 2px 2px 0px var(--color-text);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  z-index: 10;
}

.toc-close-btn:hover { 
  background: var(--color-danger);
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px var(--color-text);
}

.toc-close-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px var(--color-text);
}



.post-toc-widget .toc-h1 { margin-left: 0; font-size: 1.05rem; font-weight: 800; }
.post-toc-widget .toc-h2 { margin-left: 1rem; font-size: 0.95rem; }
.post-toc-widget .toc-h3 { margin-left: 2rem; font-size: 0.9rem; }
.post-toc-widget .toc-widget { margin-left: 0; font-style: italic; opacity: 0.85; }

/* ── Go to Top Floating Button ── */
.scroll-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 46px;
  height: 46px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  box-shadow: 3px 3px 0px var(--color-text);
  color: var(--color-text);
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0;
}

.scroll-to-top-btn.visible { opacity: 1; visibility: visible; }

.scroll-to-top-btn:hover {
  background: var(--color-mint);
  transform: translateY(-4px);
  box-shadow: 3px 7px 0px var(--color-text);
}

.scroll-to-top-btn:active {
  transform: translateY(2px);
  box-shadow: 0px 0px 0px var(--color-text);
}

@media (max-width: 768px) {
  .post-toc-widget { width: 280px; right: -300px; padding: 4rem 1.5rem 2rem; }
  
  .toc-toggle-btn {
    top: 15% !important;
    right: 0 !important;
    transform: none !important;
    writing-mode: horizontal-tb !important;
    padding: 10px !important;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    box-shadow: -3px 3px 0px var(--color-text) !important;
    border: 2px solid var(--color-text) !important;
  }

  .toc-btn-label { display: none; }
  .toc-btn-icon { display: block; }

  .toc-toggle-btn.toc-active { 
    display: none !important;
  }
  
  /* Hide Go to Top button for mobile view as requested */
  .scroll-to-top-btn {
    display: none !important;
  }
  
  /* Lift button above the mobile bottom navigation bar */
  .scroll-to-top-btn {
    bottom: 80px; 
    right: 20px;
    width: 40px;
    height: 40px;
    box-shadow: 2.5px 2.5px 0px var(--color-text);
  }
  
  .post-body-inner ul, .post-body-inner ol { margin-left: 1.5rem; }
  .table-responsive table { min-width: 500px; }
  .carousel-widget-slide { padding: 16px; }
  
  .table-responsive,
  .post-body-inner blockquote,
  .post-body-inner img,
  .post-body-inner pre,
  .post-body-inner .carousel-widget {
    box-shadow: 3px 3px 0px var(--color-text) !important;
    margin: 1.5rem 0;
  }
}
