/* =============================================================================
   STACKING CARDS — four sticky "phase" cards (the .sx component)
   Shared by the Service Landing template (page-service-landing.php) and the homepage
   (front-page.php #our-approach). Markup comes from dm_sx_render() in
   inc/service-landing/stacking-cards.php. Enqueued on those two only (functions.php).
   Relies on tokens.css / homepage.css: --header-h, --font-head, --font-body, --color-primary,
   --color-accent, --text-eyebrow, --ls-eyebrow, --radius-full, --max-width, --gutter.
   .sx--narrow = homepage-width variant. No .sl-page dependency.
   ============================================================================= */

/* ── 5. System — four stacking phase cards ─────────────────────────────────── */

.sx {
    /* Sticky offset: clear the sticky theme header (--header-h: 80px, 64px at <=767px) plus a gap. */
    --sl-stick: calc(var(--header-h) + 12px);
    position: relative;
    overflow-x: clip;
    background: #121619;
    color: #f6f6f4;
    font-family: var(--font-body);
}
.sx *,
.sx *::before,
.sx *::after { box-sizing: border-box; }
.sx h2, .sx h3, .sx-big-num, .sx-visual-center strong { font-family: var(--font-head); }

.sx-inner {
    position: relative;
    max-width: 1500px;
    margin: auto;
    padding: 96px clamp(16px, 4vw, 60px) 72px;
}
.sx-intro { text-align: center; margin: 0 auto 56px; max-width: 960px; }
.sx-intro h2 {
    font-size: clamp(36px, 4.6vw, 64px);
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: 0 0 20px;
    font-weight: 800;
    color: #ffffff;
}
.sx-intro h2 em { font-style: normal; color: var(--color-primary); }
.sx-intro p { color: rgba(255, 255, 255, 0.72); font-size: 20px; line-height: 1.55; margin: 0; }

/* Lime pill above the section title (same look as .sl-pill on the landing page). */
.sx .sx-pill {
    display: inline-block;
    font-size: var(--text-eyebrow);
    font-weight: 600;
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.12);
    border: 1px solid rgba(var(--color-primary-rgb), 0.25);
    padding: 6px 18px;
    border-radius: var(--radius-full);
    margin-bottom: 20px;
}

.sx-stack { position: relative; }

/* One card: sticky, fixed height, stacked by z-index. Spacer elements (not margins) between cards. */
.sx-phase {
    position: sticky;
    top: var(--sl-stick);
    height: min(800px, calc(100vh - var(--header-h) - 10px));
    min-height: 580px;
    margin-bottom: 0;
    filter: drop-shadow(0 -6px 15px rgba(0, 0, 0, 0.15));
}
@supports (height: 100dvh) {
    .sx-phase { height: min(800px, calc(100dvh - var(--header-h) - 10px)); }
}
.sx-phase-1 { z-index: 1; --tab-bg: #f1f1ef; --tab-fg: #171a1c; --sub: #171a1c; --meta: rgba(23, 26, 28, 0.65); }
.sx-phase-2 { z-index: 2; --tab-bg: #55564f; --tab-fg: #f7f7f4; --sub: #f7f7f4; --meta: rgba(247, 247, 244, 0.65); }
.sx-phase-3 { z-index: 3; --tab-bg: #d9d9d4; --tab-fg: #151718; --sub: #151718; --meta: rgba(21, 23, 24, 0.65); }
.sx-phase-4 { z-index: 4; --tab-bg: #414141; --tab-fg: #f7f7f4; --sub: #f7f7f4; --meta: rgba(247, 247, 244, 0.65); }

.sx-tab-row {
    height: 55px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: end;
}
.sx-phase-tab {
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tab-bg);
    color: var(--tab-fg);
    border-radius: 30px 30px 0 0;
    font-size: clamp(11px, 1.2vw, 15px);
    letter-spacing: 0.16em;
    font-weight: 700;
    white-space: nowrap;
}
.sx-phase-1 .sx-phase-tab { grid-column: 1; }
.sx-phase-2 .sx-phase-tab { grid-column: 2; }
.sx-phase-3 .sx-phase-tab { grid-column: 3; }
.sx-phase-4 .sx-phase-tab { grid-column: 4; }

.sx-panel {
    position: relative;
    height: calc(100% - 55px);
    background: var(--tab-bg);
    color: var(--tab-fg);
    border-radius: 58px 58px 12px 12px;
    padding: clamp(32px, 4vw, 56px) clamp(32px, 4.6vw, 72px);
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: clamp(24px, 5vw, 80px);
    align-items: center;
    overflow: hidden;
}
.sx-phase-1 .sx-panel { border-top-left-radius: 0; }
.sx-phase-4 .sx-panel { border-top-right-radius: 0; }

.sx-copy { max-width: 650px; }
.sx-eyebrow { font-size: 12px; letter-spacing: 0.12em; font-weight: 600; color: var(--meta); margin-bottom: 20px; }
.sx-copy h3 {
    font-size: clamp(32px, 3.4vw, 52px);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 20px;
    font-weight: 800;
    color: inherit;   /* theme sets h1-h6 to near-black; the panel colour must win */
}
.sx-lead { font-size: clamp(17px, 1.6vw, 22px); line-height: 1.55; margin: 0 0 20px; font-weight: 500; color: var(--sub); }
.sx-copy ul {
    --lh: 1.65;      /* keep in step with line-height below: used to centre each tick on the first line */
    --tick: 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: clamp(14px, 1.25vw, 17px);
    line-height: var(--lh);
    color: var(--sub);
}
.sx-copy li {
    position: relative;
    padding-left: calc(var(--tick) + 14px);
    margin: 9px 0;
}
/* Tick: filled circle in the panel's text colour with the check cut in the panel's own background,
   so it reads on all four panel colours. */
.sx-copy li::before {
    content: '';
    position: absolute;
    left: 0;
    top: calc((var(--lh) * 1em - var(--tick)) / 2);
    width: var(--tick);
    height: var(--tick);
    border-radius: 50%;
    background: var(--tab-fg);
}
.sx-copy li::after {
    content: '';
    position: absolute;
    left: calc(var(--tick) * 0.37);
    top: calc((var(--lh) * 1em - var(--tick)) / 2 + var(--tick) * 0.2);
    width: calc(var(--tick) * 0.24);
    height: calc(var(--tick) * 0.46);
    border: solid var(--tab-bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sx-visual {
    height: 100%;
    min-height: 300px;
    border-radius: 24px;
    background: #20262b;
    color: #f6f6f4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px;
    overflow: hidden;
    position: relative;
    border: 1px solid #3d454a;
}
.sx-visual::before {
    content: '';
    position: absolute;
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 70%);
    right: -30%;
    top: 8%;
    pointer-events: none;
}
.sx-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1.5px, transparent 1.5px);
    background-size: 32px 32px;
    pointer-events: none;
}
.sx-visual-top, .sx-visual-bottom {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #adb6b9;
    font-weight: 600;
}
.sx-visual-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.sx-big-num {
    font-size: clamp(85px, 12vw, 175px);
    line-height: 0.9;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.06em;
}
.sx-visual-line { width: 100%; height: 1px; background: linear-gradient(90deg, var(--color-primary), transparent); }
.sx-visual-center strong { font-size: clamp(18px, 2.1vw, 30px); letter-spacing: -0.02em; }
.sx-visual-center small { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; color: var(--color-accent); }
.sx-visual-bottom { gap: 10px; justify-content: stretch; }
.sx-visual-bottom span { height: 5px; border-radius: 5px; background: var(--color-primary); flex: 1; opacity: 0.25; }
/* Progress bars: phase N lights N bars */
.sx-phase-1 .sx-visual-bottom span:nth-child(-n+1),
.sx-phase-2 .sx-visual-bottom span:nth-child(-n+2),
.sx-phase-3 .sx-visual-bottom span:nth-child(-n+3),
.sx-phase-4 .sx-visual-bottom span:nth-child(-n+4) { opacity: 1; }
.sx-phase-4 .sx-visual { border-color: var(--color-primary); }

.sx-phase-gap { height: 210px; }
.sx-cta { position: relative; z-index: 10; display: flex; justify-content: center; margin-top: 72px; }

/* Mobile: cards keep stacking, but each has the same fixed minimum height */
@media (max-width: 800px) {
    .sx-inner { padding: 64px 14px 48px; }
    .sx-intro { margin-bottom: 40px; }
    .sx-phase { top: calc(var(--header-h) + 4px); height: auto; min-height: 0; margin-bottom: 0; }
    .sx-phase-gap { height: 120px; }
    .sx-tab-row, .sx-phase-tab { height: 37px; }
    .sx-phase-tab { border-radius: 13px 13px 0 0; font-size: clamp(10px, 2.6vw, 12px); letter-spacing: 0.04em; }
    .sx-panel {
        height: auto;
        min-height: 720px;
        padding: 30px 22px;
        border-radius: 26px 26px 10px 10px;
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .sx-phase-1 .sx-panel { border-top-left-radius: 0; }
    .sx-phase-4 .sx-panel { border-top-right-radius: 0; }
    .sx-eyebrow { margin-bottom: 13px; }
    .sx-copy h3 { font-size: clamp(27px, 6.5vw, 42px); margin-bottom: 13px; }
    .sx-lead { font-size: 16px; margin-bottom: 10px; }
    .sx-copy ul { --lh: 1.55; --tick: 18px; font-size: 13px; }
    .sx-copy li { margin: 6px 0; }
    .sx-visual { height: 190px; min-height: 190px; padding: 15px; }
    .sx-visual-center { gap: 5px; }
    .sx-big-num { font-size: 72px; }
    .sx-visual-center strong { font-size: 17px; }
    .sx-visual-center small { font-size: 11px; }
    .sx-visual-top { font-size: 10px; }
    .sx-cta { margin-top: 48px; }
}
@media (max-width: 420px) {
    .sx-panel { min-height: 780px; }
    .sx-phase-tab { font-size: 10px; letter-spacing: 0; }
    .sx-visual { height: 155px; min-height: 155px; }
}

/* ── Narrow variant: lines the cards up with the homepage .container ─────────────
   Same max-width and gutters as .container (tokens.css / homepage.css): 1280px max,
   80px gutter, 48px at <=1023px, 24px at <=767px. --gutter is switched by homepage.css. */
.sx--narrow .sx-inner {
    max-width: var(--max-width);
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

@media (max-width: 767px) {
    .sx-inner { padding-top: 64px; }
}
