/* Vessel Showcase — see elements/vessel-showcase.php and _/js/vessel-showcase.js */
.vessel-showcase {
  --vs-din: "din-2014", "DIN 2014", "DIN Next", "Archivo", system-ui, sans-serif;
  --vs-orange: var(--mor-orange, #f47b20);
  --vs-bg: #1c1d20;
  --vs-ink: #fff;
  --vs-muted: #c8cdd2;
  --vs-nav-bg: #222428;
  --vs-nav-color: #c8cdd2;
  --vs-nav-active: var(--vs-orange);
  --vs-nav-sep: var(--vs-orange);
  --vs-nav-h: 58px;          /* same bar as Industries */
  --vs-nav-gutter: clamp(18px, 6vw, 88px);
  --vs-menu-bg: var(--vs-nav-bg);
  --vs-gutter: clamp(18px, 6vw, 128px);
  --vs-height: clamp(480px, 47vw, 920px); /* builder preview only */
  --vs-media-w: 58%;
  --vs-content-w: 480px;
  --vs-menu-pad: 26px;       /* dropdown inset, either side of the option text */
  --vs-duration: .8s;        /* crossfade between vessels, as Industries */
  --vs-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --vs-slide-ease: cubic-bezier(.2, .7, .2, 1); /* image settle and copy slide, as Industries */
  --vs-shift: 28px;          /* how far the copy slides as it comes in */
  /* pinned top: room for a fixed header (set inline from the element settings) */
  --vs-top: var(--vs-offset, 120px);
  --vs-pin-h: calc(100vh - var(--vs-top));

  position: relative;
  width: 100%;
  /* the scroll track: the panel stays pinned for one viewport plus a stretch per vessel (--vs-stops is set inline) */
  height: calc(var(--vs-pin-h) * (1 + var(--vs-stops, 1) * var(--vs-length, 0.75)));
  background: var(--vs-bg);
  color: var(--vs-ink);
  font-family: "Karla", system-ui, sans-serif;
}
/* phones: the small viewport height, so the panel fits with the toolbars showing */
@supports (height: 100svh) {
  .vessel-showcase { --vs-pin-h: calc(100svh - var(--vs-top)); }
}
.vessel-showcase *, .vessel-showcase *::before, .vessel-showcase *::after { box-sizing: border-box; }

.vessel-showcase .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- pinned panel ------------------------------------------------------ */
.vessel-showcase__pin {
  position: sticky;
  top: var(--vs-top);
  height: var(--vs-pin-h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- nav --------------------------------------------------------------- */
.vessel-showcase__nav {
  position: relative;
  z-index: 5;
  flex: none;
  display: flex;
  align-items: center;
  min-height: var(--vs-nav-h);
  padding-inline: var(--vs-nav-gutter);
  background: var(--vs-nav-bg);
}

.vessel-showcase__groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.vessel-showcase__group {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}
.vessel-showcase__group + .vessel-showcase__group::before {
  content: "";
  flex: none;
  width: 1px;
  height: 20px;
  margin-inline: clamp(20px, 3vw, 52px);
  background: var(--vs-nav-sep);
}

.vessel-showcase__group-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--vs-nav-color);
  font-family: "Karla", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color .25s ease;
}
.vessel-showcase__group-btn:hover,
.vessel-showcase__group-btn:focus-visible { color: var(--vs-ink); }
.vessel-showcase__group-btn[aria-expanded="true"],
.vessel-showcase__group.is-current .vessel-showcase__group-btn { color: var(--vs-nav-active); }
.vessel-showcase__group-btn:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.vessel-showcase__chevron {
  flex: none;
  transition: transform .25s var(--vs-ease);
}
.vessel-showcase__group-btn[aria-expanded="true"] .vessel-showcase__chevron { transform: rotate(180deg); }

/* ---- dropdowns --------------------------------------------------------- */
.vessel-showcase__menu {
  position: absolute;
  top: 100%;
  left: calc(var(--vs-menu-pad) * -1);
  /* option text lines up with the label, after the separator */
  translate: var(--vs-menu-x, 0) 0;
  /* as wide as the category button above (the li minus its separator), plus the inset */
  width: calc(100% - var(--vs-menu-x, 0px) + var(--vs-menu-pad) * 2);
  margin: 0;
  padding: 0 0 12px;
  list-style: none;
  /* same colour as the nav bar, so it reads as hanging off it */
  background: var(--vs-menu-bg);
  border-radius: 0 0 6px 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s var(--vs-ease), visibility 0s .2s;
}
.vessel-showcase__group + .vessel-showcase__group .vessel-showcase__menu { --vs-menu-x: calc(clamp(20px, 3vw, 52px) * 2 + 1px); }
.vessel-showcase__group.is-open .vessel-showcase__menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s ease, transform .2s var(--vs-ease);
}
.vessel-showcase__menu li { margin: 0; }

.vessel-showcase__option {
  display: block;
  width: 100%;
  padding: 5px var(--vs-menu-pad);
  border: 0;
  background: none;
  color: var(--vs-muted);
  font: inherit;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 1px;
  text-align: left;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.vessel-showcase__option:hover,
.vessel-showcase__option:focus-visible { color: var(--vs-ink); outline: none; }
.vessel-showcase__option[aria-current="true"] { color: var(--vs-nav-active); }

/* ---- slides ------------------------------------------------------------ */
/* All slides share one grid cell filling the pinned panel below the nav */
.vessel-showcase__slides {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  overflow: hidden;
}

.vessel-showcase__slide {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  min-height: 0;
  opacity: 0;
  visibility: hidden;
  /* crossfade: the leaving vessel fades out while the arriving one fades in */
  transition: opacity var(--vs-duration) ease, visibility 0s var(--vs-duration);
}
.vessel-showcase__slide.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--vs-duration) ease;
}

/* The image/video (angled edge and overlaps built in) spans the whole panel behind the
   copy at the panel's height, keeping its aspect ratio: on wide screens it stays pinned
   to its side, on narrow ones the far side crops */
.vessel-showcase__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.vessel-showcase__asset {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  /* settles from a slight zoom as its vessel arrives, scaled from its pinned side */
  transform: scale(1.06);
  transform-origin: left center;
  transition: transform 1.6s var(--vs-slide-ease);
  pointer-events: none;
}
/* Detail-page stills are reserved for phones. */
.vessel-showcase__asset--mobile { display: none; }

/* Safari shows a big play button over a video whose autoplay was blocked (e.g. Low Power Mode); keep the poster clean */
video.vessel-showcase__asset::-webkit-media-controls,
video.vessel-showcase__asset::-webkit-media-controls-start-playback-button,
video.vessel-showcase__asset::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
}
.vessel-showcase__slide--image-right .vessel-showcase__asset { left: auto; right: 0; transform-origin: right center; }
.vessel-showcase__slide.is-active .vessel-showcase__asset { transform: none; }

.vessel-showcase__body {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - var(--vs-media-w));
  margin-left: auto;
  padding: clamp(40px, 6vw, 96px) var(--vs-gutter) clamp(40px, 6vw, 96px) clamp(24px, 4vw, 64px);
}
.vessel-showcase__content { width: 100%; max-width: var(--vs-content-w); }

/* image on the right: mirror the copy */
.vessel-showcase__slide--image-right .vessel-showcase__body {
  margin-left: 0;
  margin-right: auto;
  padding-left: var(--vs-gutter);
  padding-right: clamp(24px, 4vw, 64px);
}

/* The arriving copy slides in from the side the scroll comes from: up from below
   when scrolling down, down from above (.is-before) when scrolling up. The JS
   places it instantly (.is-instant) before setting .is-active; the leaving copy
   stays put and fades with its slide. */
.vessel-showcase__content {
  opacity: 0;
  transform: translateY(var(--vs-shift));
  transition: opacity .45s ease, transform .6s var(--vs-slide-ease);
}
.vessel-showcase__content.is-before { transform: translateY(calc(-1 * var(--vs-shift))); }
.vessel-showcase__content.is-active {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease .2s, transform .8s var(--vs-slide-ease) .15s;
}
.vessel-showcase__content.is-instant { transition: none !important; }

.vessel-showcase__title {
  margin: 0 0 18px;
  color: var(--vs-ink);
  font-family: var(--vs-din);
  font-size: clamp(32px, 3.4vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
}
.vessel-showcase__subtitle {
  margin: 0 0 22px;
  color: var(--vs-muted);
  font-size: 18px;
  line-height: 1.4;
}
.vessel-showcase__text {
  margin: 0 0 40px;
  color: var(--vs-ink);
  font-size: 19px;
  line-height: 1.85;
}

/* button styling comes from Bricks' theme style (.bricks-button.bricks-background-primary) */

/* ---- tablet: tighter nav ----------------------------------------------- */
@media (max-width: 1024px) {
  .vessel-showcase__group-btn { gap: 10px; }
  .vessel-showcase__group + .vessel-showcase__group::before { margin-inline: 18px; }
  .vessel-showcase__group + .vessel-showcase__group .vessel-showcase__menu { --vs-menu-x: 37px; }
}

/* phones only */
.vessel-showcase__nav-toggle { display: none; }

/* ---- phones: "Vessels" bar opens a category accordion over the vessel,
   image above copy ------------------------------------------------------ */
@media (max-width: 767px) {
  /* clear the 88px sticky mobile header */
  .vessel-showcase { --vs-shift: 20px; --vs-top: var(--vs-offset-mobile, 88px); --vs-gutter: 24px; --vs-rule: rgba(255, 255, 255, .1); }

  .vessel-showcase__nav { display: block; min-height: 0; padding: 0; }

  .vessel-showcase__nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 22px var(--vs-gutter);
    border: 0;
    background: none;
    color: var(--vs-ink);
    font-family: "Karla", system-ui, sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
  }
  .vessel-showcase__nav-toggle:focus-visible { outline: 1px solid currentColor; outline-offset: -4px; }
  .vessel-showcase__caret { flex: none; color: var(--vs-muted); transition: transform .25s var(--vs-ease); }
  .vessel-showcase__nav-toggle[aria-expanded="true"] .vessel-showcase__caret { transform: rotate(180deg); }

  /* the category list drops down over the vessel, scrolling if it outgrows the panel */
  .vessel-showcase__groups {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    max-height: calc(var(--vs-pin-h) - 66px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--vs-nav-bg);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .35);
  }
  .vessel-showcase__nav.is-open .vessel-showcase__groups { display: flex; }

  .vessel-showcase__group { flex-direction: column; align-items: stretch; border-top: 1px solid var(--vs-rule); }
  .vessel-showcase__group + .vessel-showcase__group::before { display: none; }
  .vessel-showcase__group-btn {
    justify-content: space-between;
    width: 100%;
    padding: 15px var(--vs-gutter);
    font-size: 15px;
    letter-spacing: 2px;
    white-space: normal;
    text-align: left;
  }
  .vessel-showcase__group-btn:focus-visible { outline-offset: -4px; }
  .vessel-showcase__chevron { color: var(--vs-orange); }

  /* each category's vessels open in place, accordion style */
  .vessel-showcase__menu,
  .vessel-showcase__group + .vessel-showcase__group .vessel-showcase__menu {
    position: static;
    display: none;
    width: auto;
    padding: 0 0 14px;
    translate: none;
    background: none;
    border-radius: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .vessel-showcase__group.is-open .vessel-showcase__menu { display: block; }
  .vessel-showcase__option { padding: 7px var(--vs-gutter); font-size: 16px; white-space: normal; }

  .vessel-showcase__slide { flex-direction: column; }
  /* fixed 16:10 box, capped on short screens so the copy still fits */
  .vessel-showcase__media {
    position: relative;
    inset: auto;
    flex: none;
    width: 100%;
    height: clamp(140px, 62.5vw, 34svh);
  }
  /* Use the whole detail-page photo on phones, centered independently of
     the desktop left/right composition. Keep it still so no transition crops it. */
  .vessel-showcase__asset--desktop { display: none; }
  .vessel-showcase__asset--mobile,
  .vessel-showcase__slide--image-right .vessel-showcase__asset--mobile {
    display: block;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    transform: none;
    transition: none;
  }

  .vessel-showcase__body,
  .vessel-showcase__slide--image-right .vessel-showcase__body {
    flex: 1 0 auto;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 36px var(--vs-gutter) 28px;
  }
  .vessel-showcase__title { margin-bottom: 8px; font-size: clamp(28px, 4.6svh, 36px); }
  .vessel-showcase__subtitle { margin-bottom: 16px; font-size: 16px; }
  .vessel-showcase__text { margin-bottom: 24px; font-size: clamp(14px, 2.2svh, 16px); line-height: 1.65; }
}

@media (prefers-reduced-motion: reduce) {
  .vessel-showcase__slide,
  .vessel-showcase__slide.is-active,
  .vessel-showcase__menu,
  .vessel-showcase__chevron,
  .vessel-showcase__asset,
  .vessel-showcase__content { transition: none !important; }
  .vessel-showcase__asset,
  .vessel-showcase__content { transform: none !important; }
}

/* ---- builder: no scroll track, the first vessel at preview height ------ */
body.bricks-is-builder .vessel-showcase,
.brx-body.iframe .vessel-showcase { height: auto; }
body.bricks-is-builder .vessel-showcase__pin,
.brx-body.iframe .vessel-showcase__pin { position: relative; top: auto; height: auto; overflow: visible; }
body.bricks-is-builder .vessel-showcase__slide,
.brx-body.iframe .vessel-showcase__slide { min-height: var(--vs-height); }
@media (max-width: 767px) {
  body.bricks-is-builder .vessel-showcase__slide,
  .brx-body.iframe .vessel-showcase__slide { min-height: 0; }
  body.bricks-is-builder .vessel-showcase__media,
  .brx-body.iframe .vessel-showcase__media { flex: none; }
}
