/**
 * Shared spacing for section.seo-link-section bands + in-page link strips + footer list overflow.
 * Loaded after page stylesheets. Spacing/overflow only; class names unchanged.
 * Universal: all .seo-link-section (profile, category, area) share the same width and grid.
 */
section.seo-link-section {
  width: 92%;
  max-width: 1200px;
  margin: 24px auto 8px !important;
  padding: 18px 16px 14px 16px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14, 7, 34, 0.92), rgba(10, 4, 26, 0.88));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

section.seo-link-section h2,
section.seo-link-section h3 {
  margin: 0 0 0.7rem;
  line-height: 1.35;
  padding: 0 0.1rem 0.1rem;
}

section.seo-link-section .seo-link-grid {
  display: grid !important;
  align-items: stretch !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

section.seo-link-section .seo-link-grid > div {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* IMPORTANT */
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 14px 16px;
}

section.seo-link-section .seo-link-grid h4 {
  margin: 0 0 0.5rem;
  line-height: 1.3;
  padding: 0 0.1rem;
}

section.seo-link-section .seo-link-grid ul {
  list-style: disc;
  list-style-position: outside;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 1.1rem;
}

section.seo-link-section .seo-link-grid > div > *:last-child {
  margin-bottom: 0 !important;
}

section.seo-link-section .seo-link-grid li {
  margin: 0 0 0.45rem 0.12rem;
  line-height: 1.5;
  padding: 0;
}

section.seo-link-section .seo-link-grid a {
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.5;
}

/* Optional in-page "Related links" strip: overflow only, keep page CSS for layout */
.seo-footer-links {
  max-width: 100%;
  box-sizing: border-box;
}

.seo-footer-links a {
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Tuck footer to SEO block without double gap (page CSS often sets large margin-top) */
footer.site-footer {
  margin-top: 0 !important;
}

/* Footer: internal columns + link lists */
body footer.site-footer .footer-top {
  min-width: 0;
  align-items: start;
}

body footer.site-footer .footer-top > div {
  min-width: 0;
}

body footer.site-footer .footer-list li {
  margin-bottom: 0.4rem;
}

body footer.site-footer .footer-list a,
body footer.site-footer .footer-bottom a {
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.5;
}

body footer.site-footer .footer-cta a {
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 700px) {
  section.seo-link-section .seo-link-grid {
    grid-template-columns: 1fr !important;
  }

  section.seo-link-section {
    padding: 0.9rem 0.75rem;
  }
}

/* If a template uses flex-wrap for .seo-footer-links, keep link rows from crowding (layout still from page CSS) */
@media (max-width: 640px) {
  .seo-footer-links ul {
    row-gap: 0.4rem;
  }
}

/* Breadcrumb in <main> must not use global header `nav` flex + `margin-left: auto` (moves the trail right). */
body main > nav.seo-breadcrumb,
body main > nav.seo-breadcrumb.container {
  display: block !important;
  box-sizing: border-box;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 92% !important;
  max-width: 1200px !important;
  text-align: left;
  white-space: normal !important;
}

/* Category guide: bullets under "Who this page is for" only (ul carries .who-page-for-list) */
ul.who-page-for-list {
  list-style-position: inside;
  padding-left: 0;
  margin-left: 0;
}

/* -------------------------------------------------------------------------- */
/* Mobile (max-width: 768px): compact top spacing; hero → next section normalized */
/* to avoid margin + padding stack. (main padding-top clears fixed header.)       */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  main {
    padding-top: 60px !important;
  }

  body:has(main .areas-hero) main {
    padding-top: 44px !important;
  }

  main > .container:first-child,
  main > nav.seo-breadcrumb {
    margin-top: 8px !important;
  }

  .seo-breadcrumb {
    margin-bottom: 10px !important;
    padding-top: 0 !important;
  }

  .page-hero,
  .hero,
  .hero-section,
  .profile-hero,
  .area-hero,
  .category-hero,
  .blog-hero,
  .areas-hero,
  .hero-area {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
    margin-bottom: 12px !important;
  }

  .page-hero + section,
  .hero + section,
  .hero-section + section,
  .profile-hero + section,
  .area-hero + section,
  .category-hero + section,
  .blog-hero + section,
  .areas-hero + section,
  .hero-area + section {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  main > section {
    margin-top: 16px;
  }

  main > section:first-of-type {
    margin-top: 8px !important;
  }

  main > .profile-main:first-child {
    margin-top: 8px !important;
  }

  main section {
    scroll-margin-top: 70px;
  }
}

/* Profile Introduction: single-column grid after empty column removal */
.detail-grid.detail-grid-single {
  grid-template-columns: 1fr !important;
}

.detail-grid.detail-grid-single > div {
  grid-column: 1 / -1;
}
