/* =========================
   SERVICES GRID (listing)
========================= */
.tsm-services-grid {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: var(--tsm-container);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 40px;
  /* auto-fit + 1fr fills the full row edge-to-edge at every width, so the
     grid always lines up flush with the section heading above it instead
     of centering as a narrower block with dead space on both sides. */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
}

@media (min-width: 641px) {
  .tsm-services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tsm-services-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 80px;
  }
}

.tsm-related-section {
  width: 100%;
  min-width: 100% !important;
}

.tsm-back-anchor {
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s ease;
  color: #19191980;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
}

.tsm-back-anchor:hover {
  opacity: 0.7;
}

.tsm-service-card {
  background: #f7f7f7;
  border-radius: 30px;
  overflow: hidden;
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease !important;
  will-change: transform, box-shadow;
  height: 100%;
  transition-property: all;
}

.tsm-service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
}

.tsm-service-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.tsm-service-link:focus:not(:focus-visible),
.tsm-service-card:focus:not(:focus-visible) {
  outline: none;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.tsm-service-link:focus-visible,
.tsm-service-card:focus-visible {
  outline: 2px solid #ee2346;
  outline-offset: 2px;
}

.tsm-service-button:focus:not(:focus-visible) {
  outline: none;
  border: none;
}

.tsm-service-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.tsm-service-image {
  position: relative;
}

.tsm-service-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(244, 244, 244, 0) 67%,
    rgba(244, 244, 244, 0.5) 81%,
    rgba(244, 244, 244, 1) 96%
  );
  pointer-events: none;
}

.tsm-service-content {
  padding: 45px 40px 40px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tsm-service-content p {
  margin: 0;
  color: #191919b3;
}

.tsm-service-content h1,
.tsm-service-content h2,
.tsm-service-content h3 {
  font-weight: 700 !important;
}

.tsm-service-content h4 {
  font-size: 16px;
  color: #666;
  margin-bottom: 24px;
}

/* =========================
   SERVICE DETAIL PAGE
========================= */

/* Page container */
.tsm-container {
  margin: 0 auto;
  padding: 0 40px;
}

/* Hero */
.tsm-service-hero {
  padding: 0 40px;
  margin-top: 30px;
  margin-bottom: 75px;
}

.tsm-service-hero img {
  width: 100%;
  height: 520px;
  object-fit: cover;
  border-radius: 25px;
}

/* Layout columns */
.tsm-service-columns {
  display: flex;
  gap: 48px;
}

.tsm-main {
  flex: 0 0 70%;
}

.tsm-sidebar {
  flex: 0 0 30%;
  max-width: 420px;
}

/* Titles & text */
.tsm-service-title {
  font-size: 24px !important;
  line-height: 1.3 !important;
  /* Reserves space for 2 lines regardless of actual wrap, so a card with a
     one-line title ("Importación") and a card with a two-line title
     ("General Handling Agent (GHA)") both start their description at the
     same vertical offset instead of the shorter title's copy climbing up. */
  min-height: calc(1.3em * 2);
  margin-bottom: 24px !important;
  margin-top: 0;
  font-weight: 500 !important;
  color: #191919;
}

.tsm-service-subtitle {
  font-size: 16px !important;
  color: #191919b3;
  margin-bottom: 32px;
}

/* When card has button, remove bottom margin from subtitle */
.tsm-service-card.has-button .tsm-service-subtitle {
  margin-bottom: 0;
}

/* Ver detalles button for related products */
.tsm-service-button {
  display: block;
  width: 100%;
  text-align: center;
  font-weight: 500;
  transition: background-color 0.3s ease;
  margin-top: auto;
  padding-top: 30px;
  box-sizing: border-box;
}

.tsm-service-link:hover .tsm-service-button {
  background: #d91f35;
}

/* WP wraps the shortcode's raw output in a stray <p>; hide it except when
   it's the one wrapping the "Ver detalles" button (show_button="yes"). */
.tsm-service-link p:not(.tsm-service-subtitle):not(:has(.tsm-service-button)) {
  display: none;
}

.tsm-value-footer {
  text-align: center;
  display: flex;
  justify-content: flex-end;
}

.tsm-service-body {
  font-size: 16px;
  line-height: 1.7;
}

.tsm-service-body h1,
.tsm-service-body h2,
.tsm-service-body h3 {
  font-weight: 700 !important;
}

.tsm-service-body ul {
  padding-left: 20px;
}

/* Cards */
.tsm-card {
  background: #f7f7f7;
  padding: 40px 28px;
  border-radius: 16px;
  margin-bottom: 24px;
  color: #191919b3;
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;

  h3 {
    font-size: 24px;
    margin-bottom: 40px;
    font-weight: 700;
    color: #191919;
    margin-top: 0;
  }

  .tsm-contact-schedule {
    margin-bottom: 25px;
  }

  p {
    font-size: 14px;
    display: none;
  }

  span {
    font-size: 16px;
    font-weight: 500;
    color: #191919b3;
    margin-top: 0;
  }

  figure {
    margin: 0 !important;

    img {
      vertical-align: inherit;
    }
  }

  .tsm-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-bottom: 40px !important;

    span {
      font-size: 14px;
    }
  }

  .tsm-contact-item:hover {
    opacity: 0.8;
  }

  .tsm-contact-schedule {
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.tsm-section-title {
  font-size: 16px;
  font-weight: 500;
  color: #191919b3;
  margin-bottom: 15px;
}

/* Button */
.tsm-btn {
  display: inline-block;
  margin-top: 0;
  background: #ef2b45;
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  width: 100%;
  transition: all 0.3s ease;
}

.tsm-btn:hover {
  background: #d91f35;
  transform: translateY(-2px);
}

/* =========================
   Mobile
========================= */
@media (max-width: 900px) {
  .tsm-service-columns {
    flex-direction: column;
  }

  .tsm-main,
  .tsm-sidebar {
    flex: 1 1 100%;
    max-width: 420px;
  }
}

.tsm-service-detail {
  /* Clears the FIXED .tsm-header. This used to be a hardcoded 150px, which
     was ~7px SHORT of the real 156.8px desktop header — the "Volver a Inicio"
     link rendered on top of the header — while being ~40px too generous on
     mobile, where the header is only 109.5px tall.

     --tsm-header-h (theme global.css) tracks the header's actual height at
     each of its breakpoints; the +32px is this page's own breathing room.
     The fallback matches the desktop value in case the theme stylesheet is
     ever missing, so the worst case is a slightly large gap, never an
     overlap. */
  margin-top: calc(var(--tsm-header-h, 157px) + 32px);
}

.tsm-related-title {
  font-size: 28px;
  font-weight: 600;
  max-width: var(--tsm-container) !important;
  margin-top: 75px;
  margin-bottom: 50px;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Base typography for panel text */
.product-content p,
.product-content span,
.product-content li,
.product-content ul {
  font-size: 14px;
  color: #191919b3;
  margin-top: 0;
  font-weight: 500 !important;
}

.product-content ul {
  color: #191919b3;
}

.product-content h1,
.product-content h2,
.product-content h3,
.product-content h4,
.product-content h5,
.product-content h6 {
  color: #191919;
  margin-bottom: 15px !important;
}

.product-content strong, b {
  font-size: 14px;
}

.product-content h1,
.product-content h2,
.product-content h3 {
  font-weight: 700 !important;
}

/* =========================
   SERVICES CAROUSEL (home page, layout="carousel")
========================= */
.tsm-services-carousel {
  width: 100%;
  max-width: var(--tsm-container);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 40px;
}

@media (min-width: 1024px) {
  .tsm-services-carousel {
    margin-bottom: 80px;
  }
}

.tsm-services-carousel .splide__slide {
  height: auto;
}

/* .splide__track's overflow: hidden (needed to keep off-screen slides
   hidden) also clips .tsm-service-card's hover lift/shadow at the top and
   bottom edges, since the track's box otherwise hugs the cards exactly.
   Padding gives the clip box room to breathe; the matching negative margin
   cancels it back out so surrounding spacing is unaffected. */
.tsm-services-carousel .splide__track {
  padding-top: 32px;
  padding-bottom: 56px;
  margin-top: -32px;
  margin-bottom: -56px;
}

.tsm-services-carousel .splide__arrow {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  opacity: 1;
  transition: background-color 0.3s ease;
}

.tsm-services-carousel .splide__arrow svg {
  width: 16px;
  height: 16px;
  fill: #191919;
}

.tsm-services-carousel .splide__arrow:hover:not(:disabled) {
  background: #ee2346;
}

.tsm-services-carousel .splide__arrow:hover:not(:disabled) svg {
  fill: #fff;
}

.tsm-services-carousel .splide__arrow:disabled {
  opacity: 0.35;
}

.tsm-services-carousel .splide__arrow--prev {
  left: -22px;
}

.tsm-services-carousel .splide__arrow--next {
  right: -22px;
}

.tsm-services-carousel .splide__pagination {
  position: relative;
  bottom: auto;
  margin-top: 24px;
}

.tsm-services-carousel .splide__pagination__page {
  background-color: #d9d9d9;
  opacity: 1;
  width: 8px;
  height: 8px;
  margin: 0 6px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.tsm-services-carousel .splide__pagination__page.is-active {
  background-color: #ee2346;
  transform: none !important;
}

.tsm-services-carousel .splide__pagination__page:focus {
  outline-width: 0 !important;
}

/* Arrows would otherwise sit outside the viewport with no gutter to spare */
@media (max-width: 640px) {
  .tsm-services-carousel .splide__arrow--prev {
    left: 4px;
  }

  .tsm-services-carousel .splide__arrow--next {
    right: 4px;
  }
}
