/* ---------- Services, chapter 2: Freight Services (#freight) ----------
   The light sky of Our Services: the heading, the Sea / Land / Air selector, one large photographic panel whose
   three slides it chooses between (js/freight.js), and the cargo types beneath. With motion it is a view of the
   stage (css/stage.css); a view taller than the screen (phones) scrolls inside itself. The blue band and the gold
   line (.sf-dusk, .sf-horizon) show only while Customs <-> Freight (js/customs.js) plays. All rules are scoped to
   .sf-*. */

.sf {
  --sf-navy: #071b33;
  --sf-ink: #3a5673;
  --sf-gold: #c79a2b;
  --sf-gold-soft: rgba(199, 154, 43, 0.55);
  --sf-grey: #c7d2de;
  --sf-pad: clamp(24px, 4vw, 64px);
  --sf-top: 146px; /* clears the nav */
  --sf-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
  color: var(--sf-navy);
  background: #eaf5ff;
}

.sf-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
}

/* ---------- The sky: Our Services' own, without its navy ---------- */
.sf-sky {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 50% 30% at 50% 12%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 75%),
    linear-gradient(180deg, #f3f9ff 0%, #eaf5ff 28%, #dceeff 62%, #eef6fe 100%);
}
.sf-sky__photo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: min(100%, 110vh);
  max-width: none;
  object-fit: cover;
  object-position: 50% 0;
  opacity: 0.5;
  filter: saturate(0.6) brightness(1.1);
  -webkit-mask-image: linear-gradient(180deg, #000 0, rgba(0, 0, 0, 0.75) 45%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0, rgba(0, 0, 0, 0.75) 45%, transparent 85%);
}

/* ---------- The content ---------- */
.sf-content {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(1400px, calc(100% - 2 * var(--sf-pad)));
  margin: 0 auto;
  padding: var(--sf-top) 0 18px;
}

.sf-head { text-align: center; }
.sf-label,
.sf-cargo__label {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-nav);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sf-navy);
}
.sf-label::before,
.sf-cargo__label::before { content: ""; width: 40px; height: 1px; background: var(--sf-gold); }
.sf-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.3rem, 3vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.005em;
  color: var(--sf-navy);
}
.sf-trade {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.5vw, 1.6rem);
  line-height: 1.25;
  color: var(--sf-navy);
}

/* ---------- The selector: one glass pill; a white thumb slides beneath the chosen mode ---------- */
.sf-modes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(900px, 100%);
  margin: 26px auto 0;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 34px -12px rgba(7, 27, 51, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}
.sf-modes__thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 3);
  border: 1px solid rgba(199, 154, 43, 0.32);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 22px -8px rgba(7, 27, 51, 0.2);
  transform: translateX(calc(var(--i, 0) * 100%)); /* --i: the chosen mode (js/freight.js) */
  transition: transform 0.75s var(--sf-ease);
}
.sf-mode {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 50px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: var(--sf-navy);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sf-mode__icon {
  flex: none;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.62;
  transition: opacity 0.4s ease;
}
.sf-mode__label { position: relative; opacity: 0.66; transition: opacity 0.4s ease; }
.sf-mode__label::after { /* the gold underline */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  margin: 0 auto;
  width: 38px;
  border-radius: 2px;
  background: var(--sf-gold);
  transform: scaleX(0);
  transition: transform 0.5s var(--sf-ease);
}
.sf-mode.is-active .sf-mode__icon,
.sf-mode.is-active .sf-mode__label { opacity: 1; }
.sf-mode.is-active .sf-mode__label::after { transform: scaleX(1); transition-delay: 0.15s; }
@media (hover: hover) {
  .sf-mode:hover .sf-mode__icon,
  .sf-mode:hover .sf-mode__label { opacity: 0.9; }
}
.sf-mode:focus-visible { outline: 2px solid var(--sf-gold); outline-offset: -4px; }

/* ---------- The panel: three slides, one photograph each, the copy on its glass left side ---------- */
.sf-show {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  max-height: 470px;
  margin-top: 16px;
}
.sf-slides {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: #e6f1fb;
  box-shadow: 0 30px 60px -28px rgba(7, 27, 51, 0.42), 0 2px 8px rgba(7, 27, 51, 0.06);
  touch-action: pan-y;
}
.sf-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}
.sf-slide:not(.is-active):not(.is-moving) { visibility: hidden; }
.sf-media { position: absolute; inset: 0; }
.sf-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: var(--sf-focus, 50% 55%);
}
#sf-slide-sea { --sf-focus: 50% 58%; }
#sf-slide-land { --sf-focus: 50% 54%; } /* the truck's cab clear of the panel's top on wide, short panels */
#sf-slide-air { --sf-focus: 50% 60%; }
.sf-slide::before { /* the glass the copy stands on, clearing into the photograph */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(246, 250, 255, 0.95) 0, rgba(246, 250, 255, 0.9) 30%, rgba(246, 250, 255, 0.55) 44%, rgba(246, 250, 255, 0.12) 56%, rgba(246, 250, 255, 0) 64%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 40%, transparent 62%);
  mask-image: linear-gradient(90deg, #000 0, #000 40%, transparent 62%);
}
.sf-copy {
  position: relative;
  z-index: 2;
  width: min(48%, 620px);
  padding: 26px clamp(24px, 3vw, 44px) 26px clamp(56px, 6vw, 96px);
}
.sf-count {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-nav);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--sf-gold);
}
.sf-count::before { content: ""; width: 36px; height: 1px; background: var(--sf-gold); }
.sf-slide__title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 2.8vw, 2.9rem);
  line-height: 1.05;
  color: var(--sf-navy);
}
.sf-slide__head {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.5vw, 1.5rem);
  line-height: 1.25;
  color: var(--sf-navy);
}
.sf-slide__text {
  max-width: 440px;
  margin-top: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--sf-ink);
}
.sf-perks {
  display: flex;
  flex-wrap: wrap;
  row-gap: 10px;
  margin-top: 18px;
  list-style: none;
}
.sf-perk {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--sf-navy);
}
.sf-perk + .sf-perk { padding-left: 18px; border-left: 1px solid rgba(7, 27, 51, 0.14); }
.sf-perk svg {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 7px;
  border: 1px solid var(--sf-gold-soft);
  border-radius: 50%;
  fill: none;
  stroke: var(--sf-gold);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The arrows sit on the panel's edges. */
.sf-arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px -8px rgba(7, 27, 51, 0.3);
  color: var(--sf-navy);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.sf-arrow--prev { left: -24px; }
.sf-arrow--next { right: -24px; }
.sf-arrow svg,
.sf-cargo__btn svg,
.sf-card__go svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .sf-arrow:hover { color: var(--sf-gold); border-color: var(--sf-gold-soft); background: #fff; }
}
.sf-arrow:focus-visible,
.sf-dot:focus-visible,
.sf-cargo__btn:focus-visible,
.sf-card__go:focus-visible { outline: 2px solid var(--sf-gold); outline-offset: 3px; }

.sf-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.sf-dot {
  width: 14px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--sf-grey);
  cursor: pointer;
  transition: width 0.5s var(--sf-ease), background-color 0.5s ease;
}
.sf-dot.is-active { width: 30px; background: var(--sf-gold); }

/* ---------- The cargo types: one row, scrolled sideways (only the row) where the seven do not fit ---------- */
.sf-cargo { margin-top: 16px; }
.sf-cargo__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
}
.sf-cargo__label { font-size: 0.68rem; }
.sf-cargo__nav { display: none; gap: 8px; }
.sf-cargo.is-overflow .sf-cargo__nav { display: flex; }
.sf-cargo__btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(7, 27, 51, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--sf-navy);
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}
.sf-cargo__btn:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) {
  .sf-cargo__btn:not(:disabled):hover { color: var(--sf-gold); border-color: var(--sf-gold-soft); }
}
.sf-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 14px;
  margin: 8px -6px 0;
  padding: 4px 6px 14px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 6px;
  scrollbar-width: none;
}
.sf-cards::-webkit-scrollbar { display: none; }
.sf-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(240, 247, 255, 0.95) 0, #fff 58%);
  box-shadow: 0 12px 26px -16px rgba(7, 27, 51, 0.32);
  text-align: center;
  scroll-snap-align: start;
}
.sf-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(70px, 8vh, 90px);
  border-radius: 11px;
  background: radial-gradient(ellipse 70% 60% at 50% 60%, #fff 0, rgba(255, 255, 255, 0) 100%), #e9f3fd;
}
.sf-card__media img {
  width: auto;
  height: auto;
  max-width: 84%;
  max-height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(7, 27, 51, 0.16));
}
.sf-card__title { /* room for two lines (LCL), so every card's words and arrow line up */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4em;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--sf-navy);
}
.sf-card__trade {
  margin: 2px 0 10px;
  font-size: 0.76rem;
  color: #5d7189;
}
.sf-card__go {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: auto;
  border: 1px solid var(--sf-gold-soft);
  border-radius: 50%;
  color: var(--sf-gold);
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
@media (hover: hover) {
  .sf-card__go:hover { color: #fff; background: var(--sf-gold); border-color: var(--sf-gold); }
}

/* ---------- Customs <-> Freight (js/customs.js places and moves both) ---------- */
.sf-dusk,
.sf-horizon {
  display: none;
  position: absolute;
  left: 0;
  pointer-events: none;
}
.sf.is-crossing .sf-dusk,
.sf.is-crossing .sf-horizon { display: block; }
.sf-dusk { z-index: 0; width: 100%; }
.sf-horizon { /* one thin Clarion gold rule, feathered at its ends */
  z-index: 3;
  height: 1px;
  background: linear-gradient(90deg, rgba(199, 154, 43, 0) 0, var(--sf-gold) 10%, var(--sf-gold) 90%, rgba(199, 154, 43, 0) 100%);
  transform-origin: 0 0;
}

/* ---------- Laptop screens: a tighter heading and cargo row, so the panel keeps its size ---------- */
@media (min-width: 760px) and (max-height: 940px) {
  .sf-title { font-size: clamp(2.1rem, 2.7vw, 2.6rem); }
  .sf-trade { font-size: clamp(1.1rem, 1.4vw, 1.3rem); }
  .sf-modes { margin-top: 20px; }
  .sf-mode { min-height: 46px; }
  .sf-show { min-height: 250px; margin-top: 12px; }
  .sf-copy { padding-top: 20px; padding-bottom: 20px; }
  .sf-slide__text { margin-top: 8px; font-size: 0.9rem; }
  .sf-perks { margin-top: 14px; }
  .sf-perk svg { width: 36px; height: 36px; padding: 6px; }
  .sf-dots { margin-top: 10px; }
  .sf-cargo { margin-top: 6px; }
  .sf-cards { margin-top: 6px; padding-bottom: 12px; }
  .sf-card { padding: 8px 8px 10px; }
  .sf-card__media { height: 68px; }
  .sf-card__title { margin-top: 5px; font-size: 0.94rem; }
  .sf-card__trade { margin-bottom: 7px; font-size: 0.72rem; }
  .sf-card__go { width: 26px; height: 26px; }
}
@media (min-width: 760px) and (max-height: 820px) {
  .sf { --sf-top: 140px; }
  .sf-content { padding-bottom: 8px; }
  .sf-title { font-size: clamp(2rem, 2.5vw, 2.25rem); }
  .sf-trade { font-size: 1.08rem; }
  .sf-modes { margin-top: 12px; }
  .sf-mode { min-height: 40px; font-size: 1rem; }
  .sf-mode__icon { width: 24px; height: 24px; }
  .sf-show { min-height: 230px; margin-top: 10px; }
  .sf-copy { padding-top: 12px; padding-bottom: 12px; }
  .sf-count { font-size: 0.68rem; }
  .sf-slide__title { margin-top: 6px; }
  .sf-perks { margin-top: 10px; }
  .sf-perk svg { width: 34px; height: 34px; }
  .sf-cargo { margin-top: 2px; }
  .sf-cargo__bar { min-height: 26px; }
  .sf-cards { padding-bottom: 10px; }
  .sf-card { padding: 6px 6px 8px; }
  .sf-slide__title { font-size: clamp(1.8rem, 2.4vw, 2.2rem); }
  .sf-slide__head { font-size: 1.12rem; }
  .sf-slide__text { font-size: 0.86rem; line-height: 1.55; }
  .sf-card__media { height: 48px; }
  .sf-card__title { margin-top: 3px; font-size: 0.9rem; }
}

/* ---------- Tablets ---------- */
@media (max-width: 1100px) {
  .sf-copy { width: min(56%, 560px); }
  .sf-slide::before {
    background: linear-gradient(90deg, rgba(246, 250, 255, 0.95) 0, rgba(246, 250, 255, 0.9) 38%, rgba(246, 250, 255, 0.5) 54%, rgba(246, 250, 255, 0) 70%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 48%, transparent 70%);
    mask-image: linear-gradient(90deg, #000 0, #000 48%, transparent 70%);
  }
  .sf-mode { font-size: 1rem; gap: 10px; }
  .sf-mode__icon { width: 24px; height: 24px; }
  /* The benefits in three even columns, each icon above its words. */
  .sf-perks { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; }
  .sf-perk { flex-direction: column; align-items: flex-start; gap: 6px; padding-right: 14px; font-size: 0.76rem; }
  .sf-perk + .sf-perk { padding-left: 14px; }
  #sf-slide-air .sf-perk { flex-direction: row; align-items: center; grid-column: 1 / -1; }
}
@media (min-width: 760px) and (min-height: 1000px) {
  .sf-show { max-height: 520px; }
}

/* ---------- Phones: the panel stands upright, the photograph above its copy ---------- */
@media (max-width: 759px) {
  .sf { --sf-pad: 16px; --sf-top: 114px; }
  .sf-content { justify-content: flex-start; padding-bottom: 28px; }
  .sf-title { font-size: clamp(2rem, 9vw, 2.4rem); }
  .sf-trade { font-size: 1.15rem; }
  .sf-modes { margin-top: 18px; padding: 4px; }
  .sf-modes__thumb { top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); }
  .sf-mode {
    flex-direction: column;
    gap: 3px;
    min-height: 58px;
    padding: 6px 4px 9px;
    font-size: 0.86rem;
    line-height: 1.1;
  }
  .sf-mode__icon { width: 22px; height: 22px; }
  .sf-mode__label::after { bottom: -5px; width: 26px; }
  .sf-show { flex: none; min-height: 0; max-height: none; margin-top: 14px; }
  .sf-slides { position: relative; display: grid; border-radius: 20px; background: #f6faff; }
  .sf-slide { position: relative; grid-area: 1 / 1; flex-direction: column; align-items: stretch; }
  .sf-slide::before { display: none; }
  .sf-media { position: relative; height: 0; padding-bottom: 58%; overflow: hidden; }
  .sf-media img { position: absolute; inset: 0; }
  #sf-slide-land { --sf-focus: 80% 50%; } /* the whole truck in the narrow crop, clear of the next arrow */
  .sf-copy { width: auto; padding: 16px 18px 18px; background: #f6faff; }
  .sf-count::before { width: 28px; }
  .sf-slide__title { margin-top: 8px; font-size: 1.85rem; }
  .sf-slide__head { margin-top: 4px; font-size: 1.1rem; }
  .sf-slide__text { margin-top: 8px; font-size: 0.88rem; line-height: 1.55; }
  .sf-perks { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
  .sf-perk { padding-right: 8px; font-size: 0.74rem; }
  .sf-perk + .sf-perk { padding-left: 12px; }
  .sf-perk svg { width: 32px; height: 32px; padding: 6px; }
  .sf-arrow { top: 0; width: 40px; height: 40px; margin-top: calc(29% - 20px); }
  .sf-arrow--prev { left: 10px; }
  .sf-arrow--next { right: 10px; }
  .sf-cargo { margin-top: 18px; }
  .sf-cards {
    grid-auto-columns: 156px;
    gap: 12px;
    margin: 8px calc(-1 * var(--sf-pad)) 0;
    padding: 4px var(--sf-pad) 14px;
    scroll-padding-inline: var(--sf-pad);
  }
  .sf-card__media { height: 88px; }
  .sf-card__title { font-size: 0.95rem; }
}
@media (max-width: 380px) {
  .sf-perk { font-size: 0.7rem; }
  .sf-perk + .sf-perk { padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-modes__thumb,
  .sf-mode__label::after,
  .sf-dot { transition: none !important; }
}
