/* SD Post Template Styles - scoped to .sd-post to avoid global bleed */

.sd-post {
  --sd-post-text: #1a1a1a;
  --sd-post-muted: #6b7280;
  --sd-post-accent: #789d4a;
  --sd-post-border: #c6c6af40;
  --sd-post-bg: #ffffff;
  --sd-post-top-spacing: clamp(1em, 5vh, 3em);
}

/* Center and constrain main sections */
.sd-post .sd-article-header,
.sd-post .sd-article-footer,
.sd-post .sd-author-box,
.sd-post .sd-post-body {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.sd-post .sd-article-header {
  /* padding-top: var(--sd-post-top-spacing); */
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--sd-post-border);
  margin-bottom: 2rem;
}

.sd-post .sd-breadcrumbs, .sd-post .sd-breadcrumbs p {
  font-size: 0.875rem;
  color: var(--sd-post-muted);
  margin-bottom: 0.75rem;
}

/* Rank Math breadcrumbs adjustments */
.sd-post .rank-math-breadcrumb a { color: var(--sd-post-muted); }
.sd-post .rank-math-breadcrumb a:hover { color: var(--sd-post-accent); }
.sd-post .rank-math-breadcrumb p { margin: 0; }

.sd-post .sd-title {
  font-size: clamp(2rem, 2.2vw + 1.2rem, 3rem);
  line-height: 1.15;
  margin: 0.25rem 0 0.75rem;
  color: var(--sd-post-text);
}

.sd-post .sd-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  color: var(--sd-post-muted);
  font-size: 0.95rem;
}

.sd-post .sd-meta__author {
  color: var(--sd-post-text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.sd-post .sd-meta__avatar, .sd-meta__author .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sd-post-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sd-post .sd-meta__author span {
  font-weight: 400;
  color: var(--sd-post-muted);
}

.sd-post .sd-meta__author-link {
  color: var(--sd-post-text);
  font-weight: 600;
  text-decoration: none;
}

.sd-post .sd-meta__author-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sd-post .sd-meta__dot { opacity: 0.4; }

.sd-post .sd-featured-image {
  margin-top: 1.25rem;
  border-radius: 12px;
  overflow: hidden;
  max-height: 500px;
  overflow: hidden;
}

.sd-post .sd-featured-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Content */
.sd-post .sd-content {
  color: var(--sd-post-text);
  line-height: 1.75;
  font-size: 1.0625rem;
}

.sd-post .sd-content > * + * { margin-top: 1.1em; }

.sd-post .sd-content h2,
.sd-post .sd-content h3,
.sd-post .sd-content h4 {
  line-height: 1.3;
  margin-top: 1em;
  margin-bottom: 0.6em;
  font-weight: 600 !important;
}

.sd-post .sd-content h2 { font-size: clamp(1.5rem, 1.2vw + 1rem, 2rem); }
.sd-post .sd-content h3 { font-size: clamp(1.25rem, 0.9vw + 0.9rem, 1.5rem); }
.sd-post .sd-content h4 { font-size: 1.125rem; }

.sd-post .sd-content p { margin: 0; }

.sd-post .sd-content a { color: var(--sd-post-accent); text-decoration: underline; text-underline-offset: 2px; }
.sd-post .sd-content a:hover { text-decoration-thickness: 2px; }

.sd-post .sd-content img,
.sd-post .sd-content figure,
.sd-post .sd-content .wp-caption {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
}

.sd-post .sd-content figure img { width: 100%; height: auto; border-radius: 8px; }
.sd-post .sd-content figcaption,
.sd-post .sd-content .wp-caption-text {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--sd-post-muted);
  text-align: center;
}

.sd-post .sd-content blockquote {
  border-left: 4px solid var(--sd-post-accent);
  padding: 0.5rem 1rem;
  background: #f8fafc;
  border-radius: 6px;
}

.sd-post .sd-content pre,
.sd-post .sd-content code,
.sd-post .sd-content kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.sd-post .sd-content pre {
  background: #0b1220;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

.sd-post .sd-content code {
  background: #f3f4f6;
  color: #111827;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.sd-post .sd-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.sd-post .sd-content table th,
.sd-post .sd-content table td {
  border: 1px solid var(--sd-post-border);
  padding: 0.6rem 0.75rem;
}

.sd-post .sd-content ul,
.sd-post .sd-content ol { padding-left: 1.2rem; }
.sd-post .sd-content li + li { margin-top: 0.35rem; }

/* Footer */
.sd-post .sd-article-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sd-post-border);
}

.sd-post .sd-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sd-post .sd-tags a {
  display: inline-block;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.875rem;
}
.sd-post .sd-tags a:hover { background: #e2e8f0; }

/* Author Box */
.sd-post .sd-author-box {
  margin-top: 3rem;
  padding: 2rem;
  background: #c6c6af40;
  border-radius: 16px;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.sd-post .sd-author-box__avatar img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--sd-post-bg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sd-post .sd-author-box__content {
  flex: 1;
}

.sd-post .sd-author-box__title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sd-post-muted);
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.sd-post .sd-author-box__name {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.sd-post .sd-author-box__name a {
  color: var(--sd-post-text);
  text-decoration: none;
}

.sd-post .sd-author-box__name a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sd-post .sd-author-box__bio {
  color: var(--sd-post-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.sd-post .sd-author-box__bio p {
  margin: 0;
}

.sd-post .sd-author-box__bio p + p {
  margin-top: 0.75rem;
}

.sd-post .sd-author-box__links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.sd-post .sd-author-box__link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--sd-post-accent);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.sd-post .sd-author-box__link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Mobile adjustments for author box */
@media (max-width: 640px) {
  .sd-post .sd-author-box {
    flex-direction: column;
    text-align: center;
  }
  
  .sd-post .sd-author-box__avatar {
    margin: 0 auto;
  }
  
  .sd-post .sd-author-box__links {
    justify-content: center;
  }
}

/* Desktop Table of Contents Styles */
.sd-post-toc-container {
  /* Base styles to ensure visibility */
  background: #ffffff;
  z-index: 100;
}

.sd-toc-widget {
  margin-bottom: 2rem;
  background: #c6c6af40;
  padding: 1.5rem;
  border-radius: 3px;
}

.sd-toc-widget h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--sd-post-text);
  margin-top: 0;
}

.sd-toc-widget__nav {
  font-size: 0.9375rem;
}

.sd-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sd-toc__list--nested {
  margin-top: 0.25rem;
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--sd-post-border);
}

.sd-toc__item {
  margin: 0;
}

.sd-toc__link {
  display: block;
  padding: 0.375rem 0;
  color: var(--sd-post-muted);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s ease;
  font-weight: 400;
  color: #000000;
}

.sd-toc__link:hover {
  color: var(--sd-post-accent);
}

.sd-toc__link.active {
  color: var(--sd-post-accent);
  font-weight: 600;
  position: relative;
}

.sd-toc__link.active::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  background: var(--sd-post-accent);
  border-radius: 2px;
}

/* Mobile Table of Contents Component */
.sd-mobile-toc {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

/* Only show on mobile */
@media (max-width: 991px) {
  .sd-mobile-toc {
    display: block;
  }
}

/* Dismissed state */
.sd-mobile-toc--dismissed {
  animation: slideDown 0.3s ease-out forwards;
}

/* Bottom bar (collapsed state) */
.sd-mobile-toc__bar {
  position: relative;
  background: #ffffff;
  border-top: 1px solid var(--sd-post-border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sd-mobile-toc__bar:hover {
  background: #fafbfc;
}

/* Progress indicator */
.sd-mobile-toc__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(14, 165, 233, 0.1);
  overflow: hidden;
}

.sd-mobile-toc__progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--sd-post-accent);
  width: 0;
  transition: width 0.2s ease;
}

/* Current section display */
.sd-mobile-toc__current {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sd-post-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1rem;
}

/* Control buttons */
.sd-mobile-toc__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sd-mobile-toc__expand,
.sd-mobile-toc__close {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--sd-post-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sd-mobile-toc__expand:hover,
.sd-mobile-toc__close:hover {
  background: #f3f4f6;
  color: var(--sd-post-text);
}

.sd-mobile-toc__expand svg,
.sd-mobile-toc__close svg {
  width: 20px;
  height: 20px;
}

.sd-mobile-toc__expand svg {
  transition: transform 0.2s ease;
}

.sd-mobile-toc--expanded .sd-mobile-toc__expand svg {
  transform: rotate(180deg);
}

.sd-mobile-toc__close:hover {
  background: rgba(14, 165, 233, 0.1);
  color: var(--sd-post-accent);
}

/* Overlay (expanded state) */
.sd-mobile-toc__overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sd-mobile-toc--expanded .sd-mobile-toc__overlay {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.sd-mobile-toc__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}

.sd-mobile-toc--expanded .sd-mobile-toc__panel {
  transform: translateY(0);
}

/* Panel header */
.sd-mobile-toc__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sd-post-border);
}

.sd-mobile-toc__panel-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--sd-post-text);
}

.sd-mobile-toc__panel-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--sd-post-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sd-mobile-toc__panel-close:hover {
  background: #f3f4f6;
  color: var(--sd-post-text);
}

/* Panel content */
.sd-mobile-toc__panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

.sd-mobile-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* TOC items */
.sd-mobile-toc__item a {
  display: block;
  padding: 0.625rem 1.25rem;
  color: var(--sd-post-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

.sd-mobile-toc__item--level-2 a {
  padding-left: 1.25rem;
  font-weight: 500;
}

.sd-mobile-toc__item--level-3 a {
  padding-left: 2.5rem;
  font-size: 0.9375rem;
}

.sd-mobile-toc__item a:hover {
  background: #f8fafc;
  color: var(--sd-post-text);
}

.sd-mobile-toc__item a.active {
  color: var(--sd-post-accent);
  font-weight: 600;
}

.sd-mobile-toc__item a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--sd-post-accent);
}

/* Animations */
@keyframes slideDown {
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* Responsive tweaks */
@media (min-width: 980px) {
  .sd-post .sd-article-header { padding-bottom: 2.5rem; margin-bottom: 2.5rem; }
} 

/* Top spacing for content (header starts absolute, not fixed) */
/* body.sd-template .sd-post .sd-article-header {
  padding-top: var(--sd-post-top-spacing);
} */

@media (min-width: 768px) {
  body.sd-template .sd-post .sd-article-header {
    padding-top: var(--sd-post-top-spacing);
  }
}

/* Related Guides Section
   ========================================================================== */
.sd-related-guides {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--sd-post-border);
}

.sd-related-guides__header {
  margin-bottom: 2rem;
}

.sd-related-guides__heading {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  font-weight: 600;
  color: var(--sd-post-text);
  margin: 0;
}

/* Cards Grid */
.sd-related-guides__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Individual Card */
.sd-related-guides__card {
  background: var(--sd-post-bg);
  border: 1px solid var(--sd-post-border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.sd-related-guides__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--sd-post-accent);
}

/* Card Image */
.sd-related-guides__card-image {
  position: relative;
  width: 100%;
  padding-top: 66.67%; /* 3:2 aspect ratio */
  overflow: hidden;
  background: #f8f9fa;
}

.sd-related-guides__card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sd-related-guides__card:hover .sd-related-guides__card-image img {
  transform: scale(1.05);
}

/* Card Content */
.sd-related-guides__card-content {
  padding: 1.5rem;
}

/* Card Category */
.sd-related-guides__card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sd-post-accent);
  margin-bottom: 0.5rem;
}

/* Card Title */
.sd-related-guides__card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.75rem;
}

.sd-related-guides__card-title a {
  color: var(--sd-post-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.sd-related-guides__card-title a:hover {
  color: var(--sd-post-accent);
}

/* Card Excerpt */
.sd-related-guides__card-excerpt {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--sd-post-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Meta */
.sd-related-guides__card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--sd-post-muted);
}

.sd-related-guides__card-author {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.sd-related-guides__card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.sd-related-guides__card-date {
  white-space: nowrap;
}

/* Navigation Buttons (Mobile) */
.sd-related-guides__navigation {
  display: none;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.sd-related-guides__nav-prev,
.sd-related-guides__nav-next {
  width: 44px;
  height: 44px;
  background: var(--sd-post-bg);
  border: 1px solid var(--sd-post-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--sd-post-text);
}

.sd-related-guides__nav-prev:hover,
.sd-related-guides__nav-next:hover {
  background: var(--sd-post-accent);
  border-color: var(--sd-post-accent);
  color: white;
}

.sd-related-guides__nav-prev:focus,
.sd-related-guides__nav-next:focus {
  outline: 2px solid var(--sd-post-accent);
  outline-offset: 2px;
}

/* Tablet Responsive */
@media (max-width: 980px) {
  .sd-related-guides__cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .sd-related-guides {
    margin-top: 3rem;
    padding-top: 2rem;
  }

  .sd-related-guides__heading {
    font-size: 1.375rem;
  }

  .sd-related-guides__cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 1rem;
    padding-bottom: 1rem;
    /* margin: 0 -1rem; */
    padding-left: 1rem;
    padding-right: 1rem;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .sd-related-guides__cards::-webkit-scrollbar {
    display: none;
  }

  .sd-related-guides__card {
    flex: 0 0 85%;
    scroll-snap-align: start;
  }

  .sd-related-guides__card-content {
    padding: 1.25rem;
  }

  .sd-related-guides__card-title {
    font-size: 1.0625rem;
  }

  .sd-related-guides__navigation {
    display: flex;
  }
}

/* Small Mobile */
@media (max-width: 479px) {
  .sd-related-guides__card {
    flex: 0 0 90%;
  }

  .sd-related-guides__card-excerpt {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
} 