/* =========================================
   SINGLE POST REDESIGN FROM SCRATCH
========================================= */

/* --- GENERAL RESET & BASE --- */
.single-page-wrapper {
  background-color: var(--bg-dark);
  color: var(--text-light);
  font-family: var(--font-body);
  padding-bottom: 5rem;
  position: relative;
}

.single-container {
  max-width: 75rem; /* ~1200px */
  margin: 0 auto;
  padding: 0 1.5rem;
  /* To ensure enough space on the left so the social bar doesn't overlap text on large screens if desired.
     But social bar is fixed. */
}

/* --- SOCIAL SHARE BAR (FIXED LEFT) --- */
.single-social-bar {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: #1C1C1E; /* Dark gray like Figma */
  border-radius: 0 1rem 1rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.single-social-bar a {
  color: var(--text-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
}

.single-social-bar a:hover {
  color: #FFF;
  background: var(--accent-purple);
  transform: translateY(-2px);
}

/* Mobile Social Bar (Bottom) - Hidden, moved to end of content */
@media (max-width: 1024px) {
  .single-social-bar {
    display: none;
  }
}

/* --- BREADCRUMBS --- */
.single-breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-gray);
  margin: 8rem 0 3rem 0; /* Top margin accounts for fixed header */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.single-breadcrumbs a {
  color: var(--text-gray);
  text-decoration: none;
  transition: color 0.3s ease;
}

.single-breadcrumbs a:hover {
  color: var(--accent-purple);
}

@media (max-width: 1024px) {
  .single-breadcrumbs {
    margin: 6rem 0 2rem 0;
  }
}

/* --- HERO SECTION --- */
.single-hero-grid {
  display: grid;
  grid-template-columns: 55% 40%;
  gap: 5%;
  align-items: center;
  margin-bottom: 3rem;
}

.single-hero-image {
  width: 100%;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.single-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 16/10;
}

.single-hero-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.single-category-pill {
  border: 1px solid rgba(171, 142, 247, 0.4);
  color: var(--accent-purple);
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  background: rgba(171, 142, 247, 0.1);
}

.single-title {
  font-size: 2.5rem; /* 40px */
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  font-family: var(--font-heading);
}

.single-meta {
  color: var(--text-gray);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 1024px) {
  .single-hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .single-hero-image {
    border-radius: 1rem;
  }
  .single-title {
    font-size: 1.5rem; /* 24px */
  }
}

/* --- BODY GRID (MAIN CONTENT & SIDEBAR) --- */
.single-body-grid {
  display: grid;
  grid-template-columns: 60% 35%;
  gap: 5%;
}

@media (max-width: 1024px) {
  .single-body-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

/* --- TOC BOX (MAIN COLUMN) --- */
.single-toc-box {
  background: #1C1C1E; /* Figma dark box */
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  margin-bottom: 3rem;
}

.toc-toggle-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-light);
}

.toc-toggle-btn h2 {
  font-size: 1.25rem;
  font-family: var(--font-heading);
  margin: 0;
  font-weight: 700;
}

.toc-chevron {
  color: var(--text-light);
  transition: transform 0.3s ease;
}

.toc-toggle-btn.is-closed .toc-chevron {
  transform: rotate(-90deg);
}

.toc-list-wrapper {
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-list-wrapper ul {
  list-style: none;
  padding: 1.5rem 0 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toc-anchor {
  color: var(--text-gray);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s ease;
  line-height: 1.5;
  display: block;
}

.toc-anchor:hover {
  color: var(--accent-purple);
}

/* --- POST CONTENT --- */
.single-content-area {
  font-size: 1rem; /* 16px */
  line-height: 1.8;
  color: #E5E5E5;
}

.single-content-area p {
  margin-bottom: 1.5rem;
}

/* Lists inside content */
.single-content-area ul,
.single-content-area ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.single-content-area li {
  margin-bottom: 0.5rem;
}

/* Images inside content */
.single-content-area img {
  border-radius: 16px;
  margin-bottom: 20px;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Links inside content */
.single-content-area a {
  color: #C7B7FB; /* Light purple */
  text-decoration: underline;
}

.single-content-area a:hover {
  color: var(--accent-purple);
}

.single-content-area h2 {
  font-size: 2rem; /* 32px */
  font-weight: 700;
  line-height: 1.25;
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-light);
}

.single-intro {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-gray);
  margin-bottom: 3rem !important;
}

/* Mobile share section at the bottom of content */
.mobile-share-section {
  display: none;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-share-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  font-family: var(--font-heading);
}

.mobile-share-icons {
  display: flex;
  gap: 1rem;
}

.mobile-share-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.mobile-share-icons a:hover {
  background: var(--accent-purple);
}

@media (max-width: 1024px) {
  .single-content-area h2 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.4;
  }
  .mobile-share-section {
    display: block;
  }
  .toc-anchor {
    font-size: 0.875rem; /* 14px */
  }
  .single-toc-box {
    padding: 1rem 1.25rem;
  }
  .toc-toggle-btn h2 {
    font-size: 1.125rem; /* 18px */
  }
}

/* --- SIDEBAR & STICKY SUBSCRIBE FORM --- */
.single-sidebar-column {
  /* No specific styles needed, just a container */
}

.sticky-sidebar {
  position: sticky;
  top: 8rem; /* Keeps it below the header when scrolling */
}

.subscribe-card {
  background: #1C1C1E;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.subscribe-card h3 {
  font-size: 1.5rem;
  font-family: var(--font-heading);
  margin-bottom: 1rem;
}

.subscribe-card p {
  font-size: 0.9rem;
  color: var(--text-gray);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subscribe-form input {
  padding: 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.subscribe-form input:focus {
  border-color: var(--accent-purple);
}

.subscribe-form button {
  width: 100%;
  border-radius: 0.5rem; /* slightly different radius if needed */
}

.subscribe-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.subscribe-message.is-success {
  background: rgba(74, 222, 128, 0.1);
  color: #4ADE80; /* Bright Green */
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.subscribe-message.is-error {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444; /* Red */
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.subscribe-message.fade-out {
  opacity: 0;
}

/* --- FLOATING MAGIC TOC BUTTON --- */
.floating-toc-btn {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #FFF;
  border: none;
  box-shadow: 0 10px 25px rgba(171, 142, 247, 0.4);
  cursor: pointer;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-toc-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.floating-toc-btn:hover {
  transform: scale(1.05) translateY(0);
  background: #C7B7FB;
}

@media (max-width: 1024px) {
  .floating-toc-btn {
    bottom: 5rem; /* Above mobile social bar */
    right: 1.5rem;
  }
}

/* --- FLOATING MAGIC TOC MODAL --- */
.floating-toc-modal {
  position: fixed;
  bottom: 100px;
  right: 2.5rem;
  width: calc(100% - 3rem);
  max-width: 350px;
  z-index: 100;
  
  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.floating-toc-modal.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.modal-toc-box {
  background: #1C1C1E;
  border: 1px solid rgba(171, 142, 247, 0.3); /* Purple border highlight */
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

.modal-toc-box h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-family: var(--font-heading);
}

.modal-toc-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 50vh;
  overflow-y: auto;
}

.modal-toc-box ul::-webkit-scrollbar {
  width: 4px;
}

.modal-toc-box ul::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.modal-toc-anchor {
  color: var(--text-gray);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.modal-toc-anchor:hover {
  color: #FFF;
}

/* ScrollSpy highlight */
.modal-toc-anchor.is-active-spy {
  color: var(--accent-purple);
  font-weight: 700;
}

@media (max-width: 1024px) {
  .floating-toc-modal {
    bottom: 140px;
    right: 1.5rem;
  }
}
