/* Shared tablet/mobile header. Desktop page headers remain page-owned. */
.tfs-responsive-header {
  display: none;
}

@media (min-width: 1321px) {
  body.tfs-unified-header-ready .tfs-original-header {
    display: none !important;
  }

  .tfs-responsive-header {
    --tfs-header-ink: #050505;
    --tfs-header-paper: #fff;
    --tfs-header-cyan: #00e5cc;
    --tfs-header-violet: #9b59ff;
    position: sticky;
    top: 0;
    z-index: 100000;
    display: block;
    min-height: 98px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(5, 5, 5, 0.16);
    color: var(--tfs-header-ink);
    box-shadow: 0 8px 24px rgba(5, 5, 5, 0.06);
  }

  .tfs-responsive-header__inner {
    position: relative;
    z-index: 2;
    width: min(100% - 56px, 1360px);
    min-height: 98px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .tfs-responsive-header__logo {
    display: inline-flex;
    width: min(280px, 22vw);
    pointer-events: auto;
  }
  .tfs-responsive-header__compact-languages { display: none; }
  .tfs-responsive-header__logo img { display: block; width: auto; height: 82px; max-width: 100%; object-fit: contain; }
  .tfs-responsive-header__toggle,
  .tfs-responsive-header__menu { display: none !important; }

  .tfs-responsive-header__desktop-nav {
    position: absolute;
    inset: 0;
    width: min(100% - 56px, 1360px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
  }
  .tfs-responsive-header__desktop-group { display: flex; align-items: center; gap: clamp(10px, 1.3vw, 20px); pointer-events: auto; }
  .tfs-responsive-header__desktop-group--left { padding-right: min(22vw, 300px); }
  .tfs-responsive-header__desktop-group--right { padding-left: min(22vw, 300px); }
  .tfs-responsive-header__desktop-nav a,
  .tfs-responsive-header__desktop-languages {
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: clamp(14px, 1.18vw, 17px);
    font-style: italic;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .tfs-responsive-header__desktop-nav a:hover,
  .tfs-responsive-header__desktop-nav a:focus-visible { color: #5530a3; text-decoration: underline; text-decoration-color: var(--tfs-header-cyan); text-underline-offset: 4px; }
  .tfs-responsive-header__desktop-languages { display: inline-flex; gap: 4px; }
  .tfs-responsive-header__language-button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid rgba(5, 5, 5, 0.4);
    background: var(--tfs-header-paper);
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: 14px;
    font-style: italic;
    font-weight: 800;
    cursor: pointer;
  }
  .tfs-responsive-header__language-button[aria-pressed="true"] { background: var(--tfs-header-ink); color: #fff; }
  .tfs-responsive-header__language-button:focus-visible { outline: 3px solid var(--tfs-header-violet); outline-offset: 2px; }
  .tfs-responsive-header__desktop-cta { padding: 12px 15px; border: 2px solid var(--tfs-header-ink); background: linear-gradient(90deg, var(--tfs-header-cyan), #55aaff, var(--tfs-header-violet)); }
}

/* The compact shell is the existing fit-preserving behavior below this width.
   Above it, the bounded desktop adjustments keep six labels, language controls,
   and the CTA clear of the centered mark. */
@media (min-width: 1321px) and (max-width: 1500px) {
  .tfs-responsive-header__logo { width: 220px; }
  .tfs-responsive-header__logo img { height: 68px; }
  .tfs-responsive-header__desktop-group { gap: clamp(8px, 0.8vw, 12px); }
  .tfs-responsive-header__desktop-nav a,
  .tfs-responsive-header__desktop-languages { font-size: clamp(13px, 1.05vw, 15px); }
}

@media (max-width: 1320px) {
  .tfs-responsive-header__desktop-nav { display: none !important; }

  html.tfs-menu-open,
  html.tfs-menu-open body {
    overflow: hidden !important;
  }

  body.tfs-unified-header-ready {
    padding-top: 0 !important;
    overflow-x: clip;
  }

  body.tfs-unified-header-ready #nav.tfs-original-header,
  body.tfs-unified-header-ready nav.tfs-original-header,
  body.tfs-unified-header-ready header.tfs-original-header,
  body.tfs-unified-header-ready .tfs-original-header,
  body.tfs-unified-header-ready .urgency-bar,
  body.tfs-unified-header-ready .top,
  body.tfs-unified-header-ready .top-urgency-bar,
  body.tfs-unified-header-ready .funnel-urgency-bar,
  body.tfs-unified-header-ready .tfs-urgency {
    display: none !important;
  }

  .tfs-responsive-header {
    --tfs-header-ink: #050505;
    --tfs-header-paper: #fff;
    --tfs-header-cream: #fff8f5;
    --tfs-header-cyan: #00e5cc;
    --tfs-header-violet: #9b59ff;
    position: sticky;
    top: 0;
    z-index: 100000;
    display: block;
    width: 100%;
    max-width: 100vw;
    min-height: 82px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(5, 5, 5, 0.16);
    color: var(--tfs-header-ink);
    font-family: "DM Sans", Arial, sans-serif;
    box-shadow: 0 8px 24px rgba(5, 5, 5, 0.06);
  }

  .tfs-responsive-header__inner {
    position: relative;
    width: min(100% - 40px, 1180px);
    min-height: 82px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tfs-responsive-header__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(230px, 52vw);
    min-height: 64px;
    z-index: 1;
  }

  .tfs-responsive-header__compact-languages {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transform: translateY(-50%);
  }

  .tfs-responsive-header__compact-languages .tfs-responsive-header__language-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 2px solid var(--tfs-header-ink);
    background: var(--tfs-header-paper);
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: 14px;
    font-style: italic;
    font-weight: 800;
  }
  .tfs-responsive-header__compact-languages .tfs-responsive-header__language-button[aria-pressed="true"] { background: var(--tfs-header-ink); color: #fff; }

  .tfs-responsive-header__logo img {
    display: block;
    width: auto;
    height: 72px;
    max-width: 100%;
    object-fit: contain;
  }

  .tfs-responsive-header__toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 2px solid var(--tfs-header-ink);
    border-radius: 0;
    background: var(--tfs-header-paper);
    color: var(--tfs-header-ink);
    cursor: pointer;
  }

  .tfs-responsive-header__toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .tfs-responsive-header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .tfs-responsive-header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .tfs-responsive-header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .tfs-responsive-header__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px max(20px, calc((100vw - 1180px) / 2)) 24px;
    background: rgba(255, 248, 245, 0.995);
    border-bottom: 2px solid var(--tfs-header-ink);
    box-shadow: 0 24px 48px rgba(5, 5, 5, 0.2);
  }

  .tfs-responsive-header__menu[hidden] {
    display: none !important;
  }

  .tfs-responsive-header__links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(5, 5, 5, 0.16);
    border-left: 1px solid rgba(5, 5, 5, 0.16);
  }

  .tfs-responsive-header__links a {
    min-width: 0;
    min-height: 52px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(5, 5, 5, 0.16);
    border-bottom: 1px solid rgba(5, 5, 5, 0.16);
    background: var(--tfs-header-paper);
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: 18px;
    font-style: italic;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.05;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    overflow-wrap: anywhere;
  }

  .tfs-responsive-header__links a:focus-visible,
  .tfs-responsive-header__links a:hover {
    background: linear-gradient(90deg, rgba(0, 229, 204, 0.22), rgba(85, 170, 255, 0.18), rgba(155, 89, 255, 0.2));
    outline: 2px solid var(--tfs-header-ink);
    outline-offset: -2px;
  }

  .tfs-responsive-header__footer {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr);
    gap: 14px;
    align-items: stretch;
    margin-top: 16px;
  }

  .tfs-responsive-header__languages {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid rgba(5, 5, 5, 0.2);
    background: var(--tfs-header-paper);
  }

  .tfs-responsive-header__languages a {
    min-width: 52px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
  }

  .tfs-responsive-header__languages a[aria-current="true"] {
    background: var(--tfs-header-ink);
    color: #fff;
  }

  .tfs-responsive-header__cta {
    min-height: 52px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--tfs-header-ink);
    background: linear-gradient(90deg, var(--tfs-header-cyan), #55aaff, var(--tfs-header-violet));
    color: var(--tfs-header-ink);
    font-family: "Barlow Condensed", Impact, sans-serif;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.05;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
  }

  body.tfs-unified-header-ready .page-shell {
    padding-top: 36px !important;
  }

  body.tfs-unified-header-ready .offer-hero {
    padding-top: 58px !important;
  }

  body.tfs-unified-header-ready.tfs-header-route-academy .hero {
    padding-top: 64px !important;
  }
}

/* Reference-aligned pages provide the same shared destinations through their
   approved reference shell; never stack the compact shell over it. */
body.tfs-reference-aligned .tfs-responsive-header { display: none !important; }

@media (max-width: 560px) {
  .tfs-responsive-header,
  .tfs-responsive-header__inner {
    min-height: 74px;
  }

  .tfs-responsive-header__inner {
    width: calc(100% - 28px);
  }

  .tfs-responsive-header__logo {
    left: 55%;
    width: min(150px, 40vw);
    min-height: 56px;
  }

  .tfs-responsive-header__logo img {
    height: 62px;
  }

  .tfs-responsive-header__toggle {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .tfs-responsive-header__menu {
    max-height: calc(100dvh - 74px);
    padding: 14px 14px 20px;
  }

  .tfs-responsive-header__links {
    grid-template-columns: 1fr;
  }

  .tfs-responsive-header__links a {
    justify-content: flex-start;
    min-height: 48px;
    padding: 11px 14px;
    font-size: 17px;
    text-align: left;
  }

  .tfs-responsive-header__footer {
    grid-template-columns: 1fr;
  }

  .tfs-responsive-header__languages,
  .tfs-responsive-header__cta {
    width: 100%;
  }

  .tfs-responsive-header__languages a {
    flex: 1;
  }

  body.tfs-unified-header-ready .page-shell {
    padding-top: 24px !important;
  }

  body.tfs-unified-header-ready .offer-hero,
  body.tfs-unified-header-ready.tfs-header-route-academy .hero {
    padding-top: 48px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tfs-responsive-header *,
  .tfs-responsive-header *::before,
  .tfs-responsive-header *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Long product/package titles keep the first action above the first-visit consent surface. */
@media (max-width: 760px) {
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero {
    min-height: auto !important;
    padding-top: 56px !important;
  }

  /* Several legacy pages use #hero > .hero-content for their own large lead-in.
     The shared sticky header already occupies document flow, so trim that second
     lead-in at the component boundary instead of routing around a single page. */
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero {
    min-height: auto !important;
    padding-top: 0 !important;
  }

  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero .hero-content,
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero .hero-body {
    min-height: auto !important;
    padding-top: 48px !important;
  }

  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero h1 {
    font-size: clamp(42px, 12vw, 54px) !important;
    line-height: 0.94 !important;
  }

  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero .hxl,
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero h1.hxl.pps-swap,
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero .headline-xl,
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero .hero-title {
    font-size: clamp(46px, 12.8vw, 54px) !important;
    line-height: 0.9 !important;
  }
}

@media (min-width: 761px) and (max-width: 1320px) {
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) .hero {
    min-height: auto !important;
    padding-top: 72px !important;
  }

  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero {
    min-height: auto !important;
    padding-top: 0 !important;
  }

  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero .hero-content,
  body.tfs-unified-header-ready:not(.tfs-reference-aligned) #hero .hero-body {
    min-height: auto !important;
    padding-top: 64px !important;
  }
}

body.tfs-unified-header-ready :target { scroll-margin-top: 106px; }
