/* ============================================================
   Loreto Horizontal Tabs — Elementor widget styles.

   Custom properties are scoped to .loreto-horizontal-tabs (not :root) so
   several tab widgets with different Elementor settings can coexist on one
   page. No page/body styling lives here.
   ============================================================ */

.loreto-horizontal-tabs {
  --loreto-navy: #1D68A2;
  --loreto-cream: #F9F9F4;
  --loreto-line: #1864A1;
  --lht-star-size: 70px;
  --lht-node-size: 18px;
  --lht-nav-pad: 26px;

  width: min(1400px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 5vw, 60px);
}

/* ---- Tab panels (the content that swaps) ---- */
.loreto-horizontal-tabs__panels {
  position: relative;
}

.loreto-horizontal-tabs__panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}

.loreto-horizontal-tabs__panel--active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.loreto-horizontal-tabs__panel-heading {
  margin: 0;
  color: #16609E;
  font-family: "Noto Serif Display", serif;
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.5em;
}

.loreto-horizontal-tabs__panel-subheading {
  margin: clamp(18px, 2.5vw, 28px) 0 0;
  color: #092D63;
  font-family: "Noto Sans", sans-serif;
  font-size: clamp(17px, 1.5vw, 20px);
  font-weight: 700;
}

.loreto-horizontal-tabs__panel-text {
  margin-top: 16px;
  max-width: 520px;
  color: #3A5A80;
  font-family: "Noto Sans", sans-serif;
  font-size: clamp(16px, 1.2vw, 16px);
  line-height: 1.7;
}

.loreto-horizontal-tabs__panel-text p {
  margin: 0 0 1em;
}

.loreto-horizontal-tabs__panel-text p:last-child {
  margin-bottom: 0;
}

.loreto-horizontal-tabs__panel-media {
  width: 100%;
  height: clamp(240px, 30vw, 400px);
  object-fit: cover;
  object-position: center center;
  border-radius: 2px;
}

/* ---- Bottom navigation ---- */
.loreto-horizontal-tabs__nav {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding-top: var(--lht-nav-pad);
}

/* the horizontal connector line running through the icons.
   Its vertical centre is derived from the marker size so it keeps meeting the
   circles when the Node Size control (or a breakpoint) changes them. */
.loreto-horizontal-tabs__nav-track {
  position: absolute;
  top: calc(var(--lht-nav-pad) + var(--lht-node-size) / 2);
  left: 8.33%;               /* overridden inline: centre of first tab  */
  right: 8.33%;              /* overridden inline: centre of last tab   */
  height: 1px;
  background: var(--loreto-line);
  transform: translateY(-50%);
  z-index: 0;
}

.loreto-horizontal-tabs__tab {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;              /* let tabs shrink below their label width */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

/* icon slot — CIRCLE when idle */
.loreto-horizontal-tabs__tab-icon {
  position: relative;
  flex: none;
  width: var(--lht-node-size);
  height: var(--lht-node-size);
  border-radius: 50%;
  border: 1.5px solid var(--loreto-navy);
  background: var(--loreto-cream);   /* masks the line passing behind it */
  display: grid;
  place-items: center;
  transition: border-color 0.3s ease, background 0.3s ease;
}

/* the STAR — hidden while idle, shown when active */
.loreto-horizontal-tabs__tab-star {
  position: absolute;
  width: var(--lht-star-size);
  height: var(--lht-star-size);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.4) rotate(-45deg);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}

.loreto-horizontal-tabs__tab-label {
  max-width: 100%;
  color: #203C72;
  font-family: "Noto Serif Display", serif;
  font-size: clamp(11px, 1.6vw, 22px);   /* fluid so labels never overflow */
  font-weight: 300;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: break-word;
  hyphens: auto;
  transition: opacity 0.3s ease, color 0.3s ease;
}

/* ---- ACTIVE tab: swap circle -> star, brighten label ---- */
.loreto-horizontal-tabs__tab--active .loreto-horizontal-tabs__tab-icon {
  border-color: transparent;
  background: transparent;
}

.loreto-horizontal-tabs__tab--active .loreto-horizontal-tabs__tab-star {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.loreto-horizontal-tabs__tab:hover .loreto-horizontal-tabs__tab-label {
  opacity: 0.85;
}

/* ============================ RESPONSIVE ============================
   The nav stays a horizontal row at every size (the point of a horizontal
   tab). Tabs shrink equally — min-width:0 plus a fluid label size keep all
   of them, and their labels, inside the widget without horizontal overflow.
   The connector line uses a per-instance % inset, so it meets the first and
   last markers at any width and any tab count. */

/* Tablet & below — stack the content panel into a single column */
@media (max-width: 820px) {
  .loreto-horizontal-tabs__panel {
    grid-template-columns: 1fr;
  }

  /* image first, text below reads better on narrow screens */
  .loreto-horizontal-tabs__panel-media {
    order: -1 !important;
  }
}

/* Large phone — tighter icon-to-label gap and a smaller marker */
@media (max-width: 560px) {
  .loreto-horizontal-tabs {
    --lht-node-size: 15px;
  }

  .loreto-horizontal-tabs__tab {
    gap: 12px;
    padding: 0 2px;
  }
}

/* Small phone — tighten the icon/label gap further */
@media (max-width: 400px) {
  .loreto-horizontal-tabs__tab {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loreto-horizontal-tabs__panel,
  .loreto-horizontal-tabs__tab-icon,
  .loreto-horizontal-tabs__tab-star,
  .loreto-horizontal-tabs__tab-label {
    transition: none !important;
  }
}
