/*
 * Careers section type `join-cta`: the closing band (live `.seciton-footer-breaker`
 * holding `.section-header-cta` + `.footerbreaker_button_wrapper`; every careers
 * page). DS CTABanner, variant compact (live's 7-row band). Linked on careers
 * pages only (CAREERS_STYLESHEETS). Type-level: every `:join-cta` slot.
 *
 * Careers is a copy of the UAE Webflow build and its closing band is the same
 * type as UAE's `join-cta` (public/region-looks/ae/shared.css), so these rules
 * are copied from there (never linked), with the UAE Home 9-row and market
 * `trade-today` rules left out. Live careers measured 2026-11-11 (1440 / 1024 /
 * 768 / 390): band 672 / 478 / 358 / 654px, 15 columns of 96px at 1440 and
 * 100vw/15 below 1280, heading 80/88 (64/72 at 768, 48/56 at 390) weight 800,
 * -0.56px, white; the button keeps its own width (227px) on live's slate.
 */
/*
 * Live closer (`.seciton-footer-breaker`, measured 2026-11-01): who-we-are and
 * kyc-guide 672px at 1440 (Home is the taller standard band, 864px), 654px on
 * phones (Home 715px) with 70px avatars; headline spans the 16px-gutter
 * column; the button keeps its own width (165px) and live's slate
 * rgb(24,28,37) fill.
 */
[data-raven-slot$=":join-cta"] .ctab__hero .button.black_primary {
  background-color: #181c25;
}
@media (min-width: 992px) {
  [data-raven-slot$=":join-cta"] .ctab--compact {
    --ctab-stage-height: 42rem;
    --ctab-section-min-height: 42rem;
  }
}
/*
 * 768–1279 (live `.footer-breaker_grid`, measured 2026-11-03): the grid is
 * 15 equal columns across the full width (68px at 1024, 51px at 768), Home 9
 * rows tall, the other pages 7; avatars fill one cell, on the same
 * desktop layout at tablet as at 1024. Our 13-column avatar layout sits one
 * cell in from the left. Headline column: 48px gutters, at most 832px
 * (Arabic 960px); the button keeps its own width.
 */
@media (min-width: 768px) and (max-width: 1279px) {
  [data-raven-slot$=":join-cta"] .ctab {
    --ctab-grid-cell: calc(100vw / 15);
    --ctab-avatar-size: calc(100vw / 15);
    --ctab-avatar-radius: calc(100vw / 60);
    --ctab-hero-max-width: 832px;
    --ctab-stage-height: calc(100vw / 15 * 9);
    --ctab-section-min-height: calc(100vw / 15 * 9);
  }
  [data-raven-slot$=":join-cta"] .ctab--compact {
    --ctab-stage-height: calc(100vw / 15 * 7);
    --ctab-section-min-height: calc(100vw / 15 * 7);
  }
  [data-raven-slot$=":join-cta"] .ctab__grid {
    background-position: 0 calc(1px - var(--ctab-grid-cell));
  }
  [data-raven-slot$=":join-cta"] .ctab__inner {
    max-width: calc(100vw / 15 * 13);
    padding-inline: 0;
  }
  /* Live sets the copy a little below the middle: 24px on Home, 36px on the 7-row band. */
  [data-raven-slot$=":join-cta"] .ctab__hero {
    max-width: calc(100vw - 96px);
    flex-shrink: 0;
    top: 24px;
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__hero {
    top: 36px;
  }
  [data-raven-slot$=":join-cta"] .ctab__avatar {
    left: var(--av-d-left, auto);
    right: var(--av-d-right, auto);
    top: var(--av-d-top, auto);
  }
  [data-raven-slot$=":join-cta"] .ctab__avatar--desktop-only {
    display: block;
  }
  [data-raven-slot$=":join-cta"] .ctab__hero a,
  [data-raven-slot$=":join-cta"] .ctab__hero .button {
    width: auto;
  }
}
/*
 * ≥1280 (live at 1440, measured 2026-11-07 on who-we-are and MT5): the same
 * as the market closer in markets.css: 96px cells from the left edge and the
 * copy 24px below the middle. The 7-row band only: Home's 9-row band
 * already matched. Without it the heading sat 24px high (Who we
 * are −26px, MT5 −19px at 1440; checker r2 minor 6).
 */
@media (min-width: 1280px) {
  [data-raven-slot$=":join-cta"] .ctab--compact {
    --ctab-grid-cell: 96px;
    --ctab-avatar-size: 96px;
    --ctab-avatar-radius: 24px;
    --ctab-hero-max-width: 832px;
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__grid {
    background-position: calc(50vw - 624px) calc(1px - var(--ctab-grid-cell));
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__inner {
    max-width: 1248px;
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__hero {
    top: 24px;
  }
}
/* Tablet: live keeps only the top and bottom rows of avatars (the inner ones stay transparent).
 * Matched on the inline position. Both spellings: the reveal animation rewrites
 * the style attribute with a space after each colon. */
@media (min-width: 768px) and (max-width: 991px) {
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top:calc(var(--ctab-grid-cell) * 2)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top: calc(var(--ctab-grid-cell) * 2)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top:calc(var(--ctab-grid-cell) * 4)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top: calc(var(--ctab-grid-cell) * 4)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top:calc(var(--ctab-grid-cell) * 6)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-top: calc(var(--ctab-grid-cell) * 6)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-left:calc(var(--ctab-grid-cell) * 6)"][style*="--av-d-top:calc(var(--ctab-grid-cell) * 7)"],
  [data-raven-slot$=":join-cta"] .ctab__avatar[style*="--av-d-left: calc(var(--ctab-grid-cell) * 6)"][style*="--av-d-top: calc(var(--ctab-grid-cell) * 7)"],
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar[style*="--av-d-top:calc(var(--ctab-grid-cell) * 3)"],
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar[style*="--av-d-top: calc(var(--ctab-grid-cell) * 3)"] {
    display: none;
  }
}
@media (max-width: 767px) {
  [data-raven-slot$=":join-cta"] .ctab {
    --ctab-grid-cell: 70px;
    --ctab-avatar-size: 70px;
    --ctab-hero-max-width: 100%;
    /* Live sizes the band from the screen width: ten grid cells of 100vw / 6,
       plus 4px (537px at 320, 654px at 390, 1282px at 767; measured
       2026-11-15). A fixed 654px left smaller phones with the bottom photos
       pressed against the button and an empty strip below. */
    --ctab-stage-height: calc(100vw / 6 * 10 + 4px);
    --ctab-section-min-height: calc(100vw / 6 * 10 + 4px);
  }
  [data-raven-slot$=":join-cta"] .ctab__inner {
    padding-inline: 16px;
  }
  /* Careers (live 2026-11-11 at 767 / 600 / 480 / 390): the button spans the
     headline column (342px at 390), unlike UAE's content-width button. */
  [data-raven-slot$=":join-cta"] .ctab__hero a,
  [data-raven-slot$=":join-cta"] .ctab__hero .button {
    width: 100%;
  }
}
/*
 * Closing band motion as live (same as the market `:trade-today` band in
 * markets.css): the heading, button and tiles never fade or slide; only the
 * tiles blur, 4px below the screen to 0 about 90% of the band in. The DS
 * block writes opacity/transform inline, hence !important; the blur is a
 * scroll-driven animation (without scroll timelines it ends at blur 0).
 */
[data-raven-slot$=":join-cta"] .ctab {
  view-timeline: --careers-join-cta-band block;
}
[data-raven-slot$=":join-cta"] :is(.ctab__grid, .ctab__hero, .ctab__avatar) {
  opacity: 1 !important;
  transform: none !important;
}
[data-raven-slot$=":join-cta"] .ctab__avatar {
  animation: careers-join-cta-tile-blur linear both;
  animation-timeline: --careers-join-cta-band;
  animation-range: entry 0% entry 90%;
}
@keyframes careers-join-cta-tile-blur {
  from { filter: blur(4px); }
  to { filter: blur(0); }
}

/*
 * Tile order in the 7-row closing band (X1, checker r2 minor 10; live
 * 2026-11-07 on forex, stocks, who-we-are and MT5). Live's tiles in page order
 * go top-left, top-centre, top-right; the design system puts the first avatar
 * top-centre and the second top-left, so the first two came out swapped (forex:
 * UK/CA where live shows US/JP). On phones live's top row is left, right,
 * centre. The avatars carry their places as inline variables; these win over
 * them. Home's 9-row band uses another layout and is not changed.
 */
[data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(1) {
  --av-d-left: calc(var(--ctab-grid-cell) * 2) !important;
}
[data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(2) {
  --av-d-left: calc(50% - var(--ctab-avatar-size) / 2) !important;
}
/*
 * Phones, the 7-row join-cta band (who-we-are, MT5; live at 390 2026-11-07):
 * the same tiles as the market closer (markets.css): six 65px cells, the top
 * row in page order left, right, then centre half a cell lower, the bottom
 * row at 7.5 and 8.5 cells. Ours had 70px tiles 37px and 107px lower.
 */
@media (max-width: 767px) {
  [data-raven-slot$=":join-cta"] .ctab--compact {
    --ctab-grid-cell: calc(100vw / 6);
    --ctab-avatar-size: calc(100vw / 6);
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(3) {
    top: calc(var(--ctab-grid-cell) * 1.5);
    left: calc(50% - var(--ctab-avatar-size) / 2);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(6) {
    top: calc(var(--ctab-grid-cell) * 8.5);
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(1),
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(2) {
    top: calc(var(--ctab-grid-cell) * 0.5);
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(4),
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(5) {
    top: calc(var(--ctab-grid-cell) * 7.5);
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(1),
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(4) {
    left: calc(var(--ctab-grid-cell) / 2 - 16px);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(2),
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__avatar:nth-child(5) {
    left: auto;
    right: calc(var(--ctab-grid-cell) / 2 - 16px);
  }
}

/*
 * Phones, "Join 3M+" band grid and photos (frame item 6, T5 checker M4; live
 * 2026-11-08 on Who we are and a market-news post at 390).
 * - Grid: live draws 1px rgb(255,126,136) lines on cells of 100vw / 6, starting
 *   half a cell in (the 7-row band's rows too; Home's rows start at the top),
 *   so they run along the tile edges, and fades them to the band colour
 *   towards the corners (a radial overlay). Ours kept the design system's
 *   faint white lines a whole cell in, masked at the edges.
 * - Photos: live shows six phone-only photos (`is-mobile`); PageRenderer adds
 *   them after the seven desktop tiles (`ctab--ae-phone-tiles`,
 *   lib/shared/site/ae-join-cta.ts). In the 7-row band they take the places
 *   the first six tiles had (Home's take the design system's phone places);
 *   they never show from 768px up.
 */
@media (max-width: 767px) {
  [data-raven-slot$=":join-cta"] .ctab__grid {
    background-image:
      linear-gradient(to right, transparent calc(100% - 1px), rgb(255, 126, 136) calc(100% - 1px)),
      linear-gradient(to bottom, transparent calc(100% - 1px), rgb(255, 126, 136) calc(100% - 1px));
    background-size: calc(100vw / 6) calc(100vw / 6);
    background-position: calc(100vw / -12) 0;
    -webkit-mask-image: radial-gradient(circle, #000, transparent);
    mask-image: radial-gradient(circle, #000, transparent);
  }
  /* The 7-row band's rows start half a cell down too (Home's start at the top). */
  [data-raven-slot$=":join-cta"] .ctab--compact .ctab__grid {
    background-position: calc(100vw / -12) calc(100vw / -12);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(10) {
    top: calc(var(--ctab-grid-cell) * 1.5);
    left: calc(50% - var(--ctab-avatar-size) / 2);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(13) {
    top: calc(var(--ctab-grid-cell) * 8.5);
    left: calc(50% - var(--ctab-avatar-size) / 2);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(8),
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(9) {
    top: calc(var(--ctab-grid-cell) * 0.5);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(11),
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(12) {
    top: calc(var(--ctab-grid-cell) * 7.5);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(8),
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(11) {
    left: calc(var(--ctab-grid-cell) / 2 - 16px);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(9),
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles .ctab__avatar:nth-child(12) {
    left: auto;
    right: calc(var(--ctab-grid-cell) / 2 - 16px);
  }
  /* Home: its 12 desktop tiles come first; the phone tiles (13-18) take the
     places tiles 1, 3, 4, 5, 7 and 8 had (rules further down), mirrored in Arabic. */
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(13), :nth-child(14)) {
    top: var(--ctab-grid-cell);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:nth-child(15) {
    top: calc(var(--ctab-grid-cell) * 2);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(16), :nth-child(17)) {
    top: calc(var(--ctab-grid-cell) * 8);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:nth-child(18) {
    top: calc(var(--ctab-grid-cell) * 9);
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(15), :nth-child(18)) {
    left: calc(50% - var(--ctab-avatar-size) / 2);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(13), :nth-child(16)),
  [dir="rtl"] [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(14), :nth-child(17)) {
    left: calc(var(--ctab-grid-cell) / 2 - 16px);
    right: auto;
  }
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(14), :nth-child(17)),
  [dir="rtl"] [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:is(:nth-child(13), :nth-child(16)) {
    left: auto;
    right: calc(var(--ctab-grid-cell) / 2 - 16px);
  }
}
@media (min-width: 768px) {
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles.ctab--compact .ctab__avatar:nth-child(n + 8),
  [data-raven-slot$=":join-cta"] .ctab--ae-phone-tiles:not(.ctab--compact) .ctab__avatar:nth-child(n + 13) {
    display: none;
  }
}

/*
 * Closing band depth motion (S1 checker N1; live 2026-11-07 on who-we-are,
 * forex at 1440/1024/768/600/390): live's tiles sit under a 4000px perspective
 * centred on the band and start pushed 600px towards the viewer (300px on
 * phones), so they look ~18% larger and spread from the centre (7% on phones).
 * They settle, eased, from the moment the band enters until its centre reaches
 * about 70% of the viewport height (phones: 15vh past the middle of the band
 * entering). Ours were still. Scroll-driven, on the band's stage (the tiles'
 * parent); `translate` leaves the frozen DS `transform` alone. It also carries
 * the existing blur, so MT5 and the market band (which set their own) use one
 * timeline. Without scroll timelines or with reduced motion: no motion.
 */
@media (prefers-reduced-motion: no-preference) {
  /* `clip` clips like `hidden` but is not a scroll container, so the stage's
     view timeline follows the page scroll (with `hidden` it never moved). */
  [data-raven-slot$=":join-cta"] .ctab {
    overflow: clip;
  }
  [data-raven-slot$=":join-cta"] .ctab__stage {
    view-timeline: --careers-closer-stage block;
    perspective: 4000px;
    perspective-origin: 50% 50%;
    --careers-closer-depth: 600px;
    --careers-closer-end: calc(50% + 30vh);
  }
  [data-raven-slot$=":join-cta"][data-raven-slot] .ctab__stage > .ctab__avatar {
    animation: careers-join-cta-tile-blur linear both, careers-closer-depth ease-in-out both;
    animation-timeline: --careers-closer-stage, --careers-closer-stage;
    animation-range: entry 0% entry 90%, entry 0% entry var(--careers-closer-end);
  }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {
  [data-raven-slot$=":join-cta"] .ctab__stage {
    --careers-closer-depth: 300px;
  }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 479px) {
  [data-raven-slot$=":join-cta"] .ctab__stage {
    --careers-closer-end: calc(50% + 15vh);
  }
}
@keyframes careers-closer-depth {
  from { translate: 0 0 var(--careers-closer-depth); }
  to { translate: 0 0 0; }
}

/*
 * Careers differences from UAE (live careers.deriv.com, 2026-11-11): the
 * heading block is centred in the band at every width (UAE's sits 24-36px
 * low), and from 768 to 1279 it is only as wide as its content, up to 832px
 * (at 768 the one-line heading is 708px wide, 30px in; UAE's 96px gutters
 * wrapped it onto two lines).
 */
[data-raven-slot$=":join-cta"] .ctab--compact .ctab__hero {
  top: 0;
}
@media (min-width: 768px) and (max-width: 1279px) {
  [data-raven-slot$=":join-cta"] .ctab__hero {
    max-width: min(832px, 100vw);
  }
}

/*
 * Careers headline column (live careers.deriv.com `.section-header-cta`, measured
 * 2026-11-11 on /locations/mauritius and /ar/locations/london): at most 832px in
 * BOTH languages (UAE's Arabic is 960px; careers' is not), with 24px gutters below
 * 880px (720px at 768). Longer city headings ("Join our Mauritius team") wrap as live.
 */
@media (min-width: 768px) {
  [data-raven-slot$=":join-cta"] .ctab .ctab__hero {
    max-width: min(832px, calc(100vw - 48px));
  }
}

/* Live's headline letter spacing (-0.56px, measured 2026-11-11 on careers Home at 768). */
[data-raven-slot$=":join-cta"] .ctab__headline {
  letter-spacing: -0.56px;
}
/* Phones: live keeps 24px gutters around the headline column (342px at 390). */
@media (max-width: 767px) {
  [data-raven-slot$=":join-cta"] .ctab .ctab__hero {
    max-width: calc(100vw - 48px);
    margin-inline: auto;
  }
}

/* Hover as live: the slate button fades to 80% (background-color 0.15s
   cubic-bezier(0.65, 0, 0.35, 1)). */
[data-raven-slot$=":join-cta"] .ctab__hero .button.black_primary {
  transition: background-color 0.15s cubic-bezier(0.65, 0, 0.35, 1);
}
[data-raven-slot$=":join-cta"] .ctab__hero a:hover .button.black_primary,
[data-raven-slot$=":join-cta"] .ctab__hero .button.black_primary:hover {
  background-color: rgba(24, 28, 37, 0.8);
}

/*
 * Grid lines as live: `.footer-breaker_box` cells draw 1px solid #ff7e88 lines on the
 * coral band (measured 2026-11-20 at 1440). The DS grid draws them in 16% white, which
 * on coral is much fainter; same geometry and edge fade, live's colour.
 */
[data-raven-slot$=":join-cta"] .ctab__grid {
  background-image:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--ctab-grid-cell) - 1px),
      #ff7e88 calc(var(--ctab-grid-cell) - 1px),
      #ff7e88 var(--ctab-grid-cell)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--ctab-grid-cell) - 1px),
      #ff7e88 calc(var(--ctab-grid-cell) - 1px),
      #ff7e88 var(--ctab-grid-cell)
    );
}
