/**
 * @file
 * MLT Modern — Taxonomy term landing page component.
 *
 * Used by both:
 *   - templates/taxonomy-term--services.html.twig
 *   - templates/taxonomy-term--locations.html.twig
 *
 * Renders a full landing page with hero, main content + sidebar layout,
 * related posts grid, and final CTA band. SEO-optimised with Schema.org
 * markup emitted by the templates themselves.
 *
 * All colours flow from --mlt-* tokens.
 */

/* =======================================================================
 * BASE WRAPPER
 * ======================================================================= */

.mlt-tax-landing {
  font-family: var(--mlt-font-body);
  line-height: 1.6;
  color: var(--mlt-text);
}

.mlt-tax-landing h1,
.mlt-tax-landing h2,
.mlt-tax-landing h3,
.mlt-tax-landing h4 {
  font-family: var(--mlt-font-heading);
  margin: 0 0 16px;
  line-height: 1.2;
  font-weight: 700;
}

.mlt-tax-landing img {
  max-width: 100%;
  height: auto;
}

.mlt-tax-landing a:not([class*="mlt-tax-landing__btn"]):not([class*="mlt-btn"]) {
  color: var(--mlt-primary);
  text-decoration: none;
}

.mlt-tax-landing a:not([class*="mlt-tax-landing__btn"]):not([class*="mlt-btn"]):hover {
  text-decoration: underline;
}

.mlt-tax-landing__container {
  max-width: var(--mlt-container-max);
  margin: 0 auto;
  padding: 0 var(--mlt-container-pad);
}

/* =======================================================================
 * HERO
 * ======================================================================= */

.mlt-tax-landing__hero {
  position: relative;
  overflow: hidden;
  background: var(--mlt-primary);
  color: #fff;
  padding: 60px 0;
}

.mlt-tax-landing__hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.mlt-tax-landing__hero-grid--single {
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.mlt-tax-landing__hero h1 {
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 20px;
  color: inherit;
}

.mlt-tax-landing__hero h1 .mlt-tax-landing__highlight {
  color: var(--mlt-accent);
}

.mlt-tax-landing__hero-bullets {
  font-size: 17px;
  margin: 0 0 28px;
  opacity: 0.95;
}

.mlt-tax-landing__hero-bullets ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mlt-tax-landing__hero-bullets li {
  padding: 6px 0 6px 28px;
  position: relative;
}

.mlt-tax-landing__hero-bullets li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--mlt-accent);
  font-weight: 900;
  font-size: 18px;
}

.mlt-tax-landing__hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.mlt-tax-landing__hero-grid--single .mlt-tax-landing__hero-cta {
  justify-content: center;
}

/* =======================================================================
 * BUTTONS
 * ======================================================================= */

.mlt-tax-landing__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: var(--mlt-radius-md);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none !important;
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
  cursor: pointer;
  line-height: 1.2;
}

.mlt-tax-landing__btn svg {
  width: 18px;
  height: 18px;
}

.mlt-tax-landing__btn--primary {
  background: var(--mlt-accent);
  color: var(--mlt-accent-contrast);
}

.mlt-tax-landing__btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsla(var(--mlt-accent-value), 0.4);
}

.mlt-tax-landing__btn--secondary {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

.mlt-tax-landing__btn--secondary:hover {
  background: #fff;
  color: var(--mlt-primary);
}

.mlt-tax-landing__btn--white {
  background: #fff;
  color: var(--mlt-primary);
}

.mlt-tax-landing__btn--white:hover {
  background: var(--mlt-bg-soft);
}

.mlt-tax-landing__btn--outline-white {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

.mlt-tax-landing__btn--outline-white:hover {
  background: #fff;
  color: var(--mlt-primary);
}

/* =======================================================================
 * MAIN CONTENT + SIDEBAR
 * ======================================================================= */

.mlt-tax-landing__main {
  padding: 60px 0;
  background: #fff;
}

.mlt-tax-landing__layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}

.mlt-tax-landing__body {
  font-size: 16px;
  line-height: 1.7;
}

.mlt-tax-landing__body h2 {
  font-size: 28px;
  color: var(--mlt-primary);
  margin: 32px 0 14px;
}

.mlt-tax-landing__body h2:first-child {
  margin-top: 0;
}

.mlt-tax-landing__body h3 {
  font-size: 22px;
  color: var(--mlt-primary);
  margin: 24px 0 12px;
}

.mlt-tax-landing__body p {
  margin: 0 0 16px;
}

.mlt-tax-landing__body ul,
.mlt-tax-landing__body ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.mlt-tax-landing__body li {
  margin-bottom: 8px;
}

/* =======================================================================
 * SIDEBAR
 * ======================================================================= */

.mlt-tax-landing__sidebar {
  align-self: start;
}

.mlt-tax-landing__card {
  background: var(--mlt-bg-soft);
  border-radius: var(--mlt-radius-lg);
  padding: 28px;
  border: 1px solid var(--mlt-border);
}

.mlt-tax-landing__card h3 {
  font-size: 20px;
  color: var(--mlt-primary);
  margin: 0 0 18px;
}

.mlt-tax-landing__contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--mlt-text);
}

.mlt-tax-landing__contact-item svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--mlt-primary);
  margin-top: 2px;
}

.mlt-tax-landing__contact-item a {
  color: var(--mlt-text);
  text-decoration: none;
}

.mlt-tax-landing__contact-item a:hover {
  color: var(--mlt-primary);
}

/* =======================================================================
 * RELATED POSTS GRID
 * ======================================================================= */

.mlt-tax-landing__related {
  padding: 60px 0;
  background: var(--mlt-bg-soft);
}

.mlt-tax-landing__related-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 40px;
}

.mlt-tax-landing__related-label {
  display: inline-block;
  background: var(--mlt-primary-light);
  color: var(--mlt-primary);
  padding: 6px 14px;
  border-radius: var(--mlt-radius-pill);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.mlt-tax-landing__related-header h2 {
  font-size: 32px;
  color: var(--mlt-primary);
  margin: 0 0 12px;
}

.mlt-tax-landing__related-header p {
  font-size: 17px;
  color: var(--mlt-text-light);
  margin: 0;
}

.mlt-tax-landing__related-grid .view-content,
.mlt-tax-landing__related-grid > .item-list > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mlt-tax-landing__related-grid .views-row,
.mlt-tax-landing__related-grid > .item-list > ul > li {
  list-style: none;
}

/* =======================================================================
 * FINAL CTA BAND
 * ======================================================================= */

.mlt-tax-landing__cta {
  background: linear-gradient(135deg, var(--mlt-primary) 0%, var(--mlt-primary-dark) 100%);
  color: #fff;
  padding: 70px 0;
  text-align: center;
}

.mlt-tax-landing__cta h2 {
  font-size: 36px;
  color: #fff;
  margin: 0 0 14px;
}

.mlt-tax-landing__cta p {
  font-size: 18px;
  max-width: 700px;
  margin: 0 auto 26px;
  opacity: 0.95;
}

.mlt-tax-landing__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* =======================================================================
 * EXTERNAL VIEW WRAPPER
 *
 * When a contrib view (e.g. Drupal's built-in "Taxonomy term" view or a
 * custom locations_taxonomy_term / services_taxonomy_term view) renders
 * the term page, the term entity ends up inside the view's header and
 * the tagged-content list sits below — OUTSIDE our taxonomy-term
 * template, in markup we don't control.
 *
 * Markup pattern (confirmed via view-source on jjb /electrician-in-hertfordshire):
 *
 *   .mlt-page--taxonomy
 *     main.mlt-main--taxonomy
 *       .mlt-region--content
 *         #block-...-mainpagecontent
 *           .views-element-container        ← view wrapper (full-width)
 *             .js-view-dom-id-...
 *               header                       ← our taxonomy-term template
 *               div                          ← views-view-list wrapper (no class!)
 *                 ul.row.list-unstyled.mb-0  ← the grid <ul>
 *                   li.col-lg-4.col-md-6.views-row  ← each tile
 *
 * Selectors below target the actual classes present in the DOM. The
 * earlier attempt used `.views-view-list` which doesn't exist on the
 * markup (that's the THEME HOOK name, not a CSS class) — that's why
 * the previous fix didn't apply.
 *
 * Scoped to .mlt-page--taxonomy so no other view on the site is touched.
 * ======================================================================= */

/* Full-width band behind the grid — soft grey extends edge-to-edge. */
.mlt-page--taxonomy .views-element-container {
  background: var(--mlt-bg-soft);
}

/* The grid <ul> — Bootstrap's .row + .list-unstyled is a distinctive
 * combination that's unlikely to appear elsewhere on a term page.
 * Constrain to container width, centre it, add vertical padding. */
.mlt-page--taxonomy .views-element-container ul.row.list-unstyled {
  max-width: var(--mlt-container-max);
  margin: 0 auto;
  padding: 60px var(--mlt-container-pad);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  list-style: none;
  /* Override Bootstrap's negative gutters that would push content outside. */
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

/* Each tile <li> — override Bootstrap col-* widths. With CSS Grid above,
 * the parent decides sizing; we just need to neutralise Bootstrap's
 * flex/width rules on each list item. */
.mlt-page--taxonomy .views-element-container ul.row.list-unstyled > li.views-row {
  width: auto;
  max-width: none;
  flex: none;
  padding-left: 0;
  padding-right: 0;
  list-style: none;
}

/* Belt-and-braces: Bootstrap col-lg-4 / col-md-6 use
 * `flex: 0 0 auto; width: 33.33%;` at certain breakpoints. Re-override. */
.mlt-page--taxonomy .views-element-container [class*="col-"] {
  flex: none;
  max-width: none;
  width: auto;
}

/* =======================================================================
 * RESPONSIVE
 * ======================================================================= */

@media (max-width: 991px) {
  .mlt-tax-landing__hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center;
  }
  .mlt-tax-landing__hero-grid .mlt-tax-landing__hero-cta {
    justify-content: center;
  }
  .mlt-tax-landing__hero-bullets li {
    text-align: left;
  }

  .mlt-tax-landing__layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .mlt-tax-landing__hero h1 {
    font-size: clamp(26px, 6vw, 36px);
  }
}

@media (max-width: 540px) {
  .mlt-tax-landing__main,
  .mlt-tax-landing__related,
  .mlt-tax-landing__cta {
    padding: 40px 0;
  }
  .mlt-tax-landing__hero {
    padding: 40px 0;
  }
  .mlt-tax-landing__cta h2 {
    font-size: 26px;
  }
  .mlt-tax-landing__cta-buttons {
    flex-direction: column;
  }
  .mlt-tax-landing__cta-buttons .mlt-tax-landing__btn {
    width: 100%;
    justify-content: center;
  }
  .mlt-page--taxonomy .views-element-container ul.row.list-unstyled {
    padding: 40px var(--mlt-container-pad);
  }
}
