/**
 * @file
 * Tabbed content styles. A white tab strip centred above a grey panel, with the
 * active tab painted in the panel's surface colour so the two read as joined.
 */

.ln-tabs {
  /* 0: this block has no box of its own, so layout.css owns the gap between
     sections. Kept as a token so a one-off placement can pad itself.
     --ln-tabs-panel-padding is the padding inside the panel and is separate. */
  --ln-tabs-padding-block: 0;
  --ln-tabs-padding-inline: var(--ln-container-gutter, 32px);
  --ln-tabs-max-width: var(--ln-container-max, 1440px);

  --ln-tabs-fg: #000000;
  --ln-tabs-muted: #63666a;
  --ln-tabs-accent: #cf0000;
  --ln-tabs-accent-hover: #961f00;
  --ln-tabs-strip-bg: #ffffff;

  /* The active tab and the panel are one surface, so both read this. Shared
     with the carousel, which sits near it on the page. */
  --ln-tabs-surface: var(--ln-color-surface-gray, #ededed);
  --ln-tabs-panel-radius: 24px;

  /* Tab widths fall out of the arithmetic: the tabs stay on flex: 1 so the
     strip still divides correctly if a fourth tier is added. */
  --ln-tabs-tab-radius: 16px;
  --ln-tabs-strip-width: 808px;
  --ln-tabs-strip-pad: 8px;
  --ln-tabs-tab-gap: 8px;
  --ln-tabs-tab-height: 61px;
  --ln-tabs-tab-pad-block: 14px;
  --ln-tabs-tab-pad-inline: 10px;
  --ln-tabs-panel-padding: 80px;
  --ln-tabs-column-gap: 64px;

  /* Ratio of the delivered panel animations. See .ln-video--tabs. */
  --ln-tabs-video-ratio: 1216 / 762;

  /* Pills on this surface are white; the pill's own #ececec default would be
     near-invisible against it. */
  --ln-pill-bg: #ffffff;

  --ln-tabs-font: Outfit, sans-serif;

  box-sizing: border-box;
  padding-block: var(--ln-tabs-padding-block);
  color: var(--ln-tabs-fg);
  font-family: var(--ln-tabs-font);
}

.ln-tabs *,
.ln-tabs *::before,
.ln-tabs *::after {
  box-sizing: inherit;
}

/* Gutter and max-width on the same box, so the 1440 is the outer edge. */
.ln-tabs__inner {
  max-width: var(--ln-tabs-max-width);
  margin-inline: auto;
  padding-inline: var(--ln-tabs-padding-inline);
}

.ln-tabs__strip {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* No bottom padding: the tabs sit flush on the panel, which is what joins them. */
.ln-tabs__list {
  display: flex;
  gap: var(--ln-tabs-tab-gap);
  width: 100%;
  max-width: var(--ln-tabs-strip-width);
  margin: 0;
  padding: var(--ln-tabs-strip-pad) var(--ln-tabs-strip-pad) 0;
  background-color: var(--ln-tabs-strip-bg);
  list-style: none;
}

/* The margin and padding resets are load-bearing: Site Studio styles li
   globally and its bottom spacing opens a gap between the strip and the panel. */
.ln-tabs__item {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* min-height, not height, so a long or translated label grows the tab. */
.ln-tabs__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: var(--ln-tabs-tab-height);
  padding: var(--ln-tabs-tab-pad-block) var(--ln-tabs-tab-pad-inline);
  border-radius: var(--ln-tabs-tab-radius) var(--ln-tabs-tab-radius) 0 0;
  color: var(--ln-tabs-muted);
  font-size: 20px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}

/* .is-active is set by tabs.js; before it runs no tab is marked, which is
   correct because every panel is visible at that point. */
.ln-tabs__tab.is-active {
  background-color: var(--ln-tabs-surface);
  color: var(--ln-tabs-accent);
  font-weight: 700;
}

.ln-tabs__tab:hover,
.ln-tabs__tab:focus {
  color: var(--ln-tabs-accent);
  text-decoration: none;
}

.ln-tabs__tab:focus-visible {
  outline: 2px solid var(--ln-tabs-accent);
  outline-offset: -4px;
}

.ln-tabs__panels {
  border-radius: var(--ln-tabs-panel-radius);
  background-color: var(--ln-tabs-surface);
}

/**
 * Scroll offset for a deep link: the id is on the panel and the strip sits
 * above it, so the offset is derived from the site header height plus the
 * strip's own height (tab-height + strip-pad).
 *
 * The [id] takes this to (0,3,0) so it beats `.layout__region [id]` in
 * css/layout.css; two classes would only tie with it.
 */
.ln-tabs__panels .ln-tabs__panel[id] {
  scroll-margin-top: calc(
    var(--ln-site-header-height, 60px) +
    var(--ln-tabs-tab-height) +
    var(--ln-tabs-strip-pad) +
    24px
  );
}

.ln-tabs__panel {
  padding: var(--ln-tabs-panel-padding);
}

/* Before the script runs every panel is visible, so a rule separates them. */
.ln-tabs:not(.ln-tabs--enhanced) .ln-tabs__panel + .ln-tabs__panel {
  border-top: 1px solid rgb(0 0 0 / 10%);
}

.ln-tabs__panel:focus-visible {
  outline: 2px solid var(--ln-tabs-accent);
  outline-offset: -4px;
}

.ln-tabs__heading {
  margin: 0;
  color: var(--ln-tabs-accent);
  font-size: clamp(2rem, 3.5vw, 48px);
  font-weight: 700;
  line-height: 1.1;
}

/* A div, not a p: the field renders its own <p> and a <p> cannot nest. */
.ln-tabs__subheading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

.ln-tabs__subheading > p {
  margin: 0;
}

/* The glyph is 29x21, not square, so the box takes the asset's dimensions. */
.ln-tabs__icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 29px;
  height: 21px;
  color: currentColor;
}

.ln-tabs__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Two columns: copy left, image right. */
.ln-tabs__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ln-tabs-column-gap);
  align-items: start;
  margin-top: 3rem;
}

.ln-tabs__copy {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}

/* Also on the paragraphs: the WYSIWYG can nest content whose own line-height
   would win over the inherited value. */
.ln-tabs__copy p {
  line-height: 1.3;
}

.ln-tabs__copy > :first-child {
  margin-top: 0;
}

.ln-tabs__copy > :last-child {
  margin-bottom: 0;
}

/* Checklist: a red bubble tick as a background image rather than a marker, so
   it sits beside multi-line items. Inlined because a list-style-image cannot
   inherit currentColor. */
.ln-tabs__copy :is(ul) {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.ln-tabs__copy :is(ul) li {
  position: relative;
  margin: 0;
  padding: 0 0 0 2.25rem;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.3;
}

.ln-tabs__copy :is(ul) li + li {
  margin-top: 1rem;
}

.ln-tabs__copy :is(ul) li::before {
  content: '';
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath fill='%23cf0000' fill-rule='evenodd' d='M9.12209 2.22385C10.3055.862875 12.0519 0 14 0c1.948 0 3.6943.86279 4.8777 2.22365 1.7994-.12571 3.6447.49904 5.0223 1.87666 1.3776 1.37761 2.0023 3.22289 1.8766 5.02222C27.1373 10.3059 28 12.0522 28 14c0 1.9482-.863 3.6947-2.2241 4.8781.1254 1.7991-.4993 3.644-1.8767 5.0214-1.3774 1.3773-3.2223 2.0021-5.0213 1.8767C17.6944 27.1371 15.948 28 14 28c-1.9479 0-3.6943-.8628-4.87769-2.2236-1.79935.1257-3.64466-.499-5.02229-1.8767-1.37762-1.3776-2.00238-3.2229-1.87666-5.0222C.862666 17.6941 0 15.9478 0 14c0-1.9479.862753-3.6942 2.22356-4.87766C2.09799 7.32315 2.72276 5.47805 4.10026 4.10055 5.47777 2.72304 7.32289 2.09827 9.12209 2.22385ZM19.184 11.3952c.3457-.484.2336-1.1566-.2504-1.5023-.4839-.3457-1.1565-.2336-1.5022.2504L12.7857 16.6473l-2.3319-2.3319c-.4206-.4205-1.10241-.4205-1.52297 0-.42057.4206-.42057 1.1025 0 1.523l3.23077 3.2308c.2238.2238.5348.3379.8503.3117.3155-.0261.6035-.1897.7875-.4473l5.3846-7.5384Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

.ln-tabs__cta {
  margin-top: 2rem;
}

.ln-tabs__cta a {
  color: var(--ln-tabs-accent);
  font-weight: 600;
  text-decoration: none;
}

.ln-tabs__cta a:hover,
.ln-tabs__cta a:focus {
  color: var(--ln-tabs-accent-hover);
  text-decoration: underline;
}

.ln-tabs__media img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* The panel clips' aspect ratio, which belongs to the delivered asset. It must
   match the file or object-fit letterboxes the difference. */
.ln-video--tabs {
  --ln-video-ratio: var(--ln-tabs-video-ratio);
}

@media (max-width: 60rem) {
  .ln-tabs {
    --ln-tabs-panel-padding: 32px;
    --ln-tabs-tab-height: 52px;
    --ln-tabs-tab-pad-block: 10px;
    --ln-tabs-column-gap: 32px;
  }

  .ln-tabs__body {
    grid-template-columns: 1fr;
  }

  .ln-tabs__tab {
    font-size: 16px;
  }
}

/**
 * Phone: the section's inline padding goes to zero so the grey panel is
 * full-bleed, and the strip re-creates an inset of its own. Padding the strip
 * rather than the list, which uses its own padding for the white surround.
 */
@media (max-width: 47.99rem) {
  .ln-tabs {
    --ln-tabs-padding-inline: 0px;
  }

  .ln-tabs__strip {
    padding-inline: 62px;
  }

  /* Visual order only, and safe only while the media holds nothing focusable —
     if a link is ever added inside it, focus order diverges from reading order. */
  .ln-tabs__media {
    order: -1;
  }
}
