/*
 * cst.css: /custom-software-cost/, light system.
 * Scope: body.apex-cst. Nothing else on the site loads this sheet.
 * Three objects carry the page: the stairs, the sheet and the receipt.
 */

body.apex-cst {
    --cst-hand: "Apex Hand", "Bradley Hand", "Segoe Print", cursive;
    --cst-step-2: #e3ebf6;
    --cst-step-3: #c6d6ec;
    background: var(--a-page);
    color: var(--a-body);
    font-family: var(--a-sans);
}

body.apex-cst .cst-main { overflow-x: clip; font-size: var(--a-t-body); line-height: 1.6 }
body.apex-cst :where(.cst-main :is(h1, h2, h3, p, ul, ol, fieldset, legend)) { margin: 0; padding: 0 }
body.apex-cst .cst-main :is(h1, h2, h3) {
    font-family: var(--a-sans);
    color: var(--a-ink);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.08;
    text-wrap: balance;
}
body.apex-cst .cst-shell { width: var(--a-shell); margin-inline: auto }
body.apex-cst .cst-head { font-size: var(--a-t-head) }
body.apex-cst :is(#cst-size, #pc-form) { scroll-margin-top: var(--a-anchor) }

/* ════ Controls ════ */
body.apex-cst .cst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: var(--a-btn-pad, .85rem 1.4rem);
    border: 1px solid transparent;
    border-radius: var(--a-btn-r);
    font: 600 var(--a-t-btn)/1.2 var(--a-sans);
    text-decoration: none;
    transition: background-color .2s var(--a-ease), border-color .2s var(--a-ease), color .2s var(--a-ease), transform .2s var(--a-ease);
}
body.apex-cst .cst-btn--solid { background: var(--a-brand); color: #fff }
body.apex-cst .cst-btn--solid:hover { background: var(--a-brand-deep); color: #fff; transform: translateY(-1px) }
body.apex-cst .cst-btn--quiet { border-color: var(--a-card-line); color: var(--a-ink); background: #fff }
body.apex-cst .cst-btn--quiet:hover { border-color: var(--a-brand); color: var(--a-brand) }
body.apex-cst .cst-main :is(a, input):focus-visible {
    outline: 2px solid var(--a-brand);
    outline-offset: 3px;
}

/* ════ Hero: the answer, then the stairs ════ */
body.apex-cst .cst-hero { padding-top: var(--a-hero-pt, clamp(8rem, 13vh, 10rem)) }
body.apex-cst .cst-hero__top {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: end;
}
body.apex-cst .cst-hero h1 { font-size: var(--a-t-h1); max-width: 15ch }
body.apex-cst .cst-hero__lede { font-size: var(--a-t-spoken); line-height: 1.5; max-width: 34em }
body.apex-cst .cst-hero__lede strong { color: var(--a-ink); font-weight: 600 }
body.apex-cst .cst-hero__acts { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem }

body.apex-cst .cst-climb { position: relative; margin-top: clamp(2.5rem, 5vw, 4rem) }
body.apex-cst .cst-climb__pen {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 13em;
    font: 400 2.05rem/1.1 var(--cst-hand);
    color: var(--a-brand);
    transform: rotate(-2deg);
}
body.apex-cst .cst-stairs {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 0;
    border-bottom: 1px solid var(--a-line);
    overflow: hidden;
}
body.apex-cst .cst-step {
    display: flex;
    border-radius: var(--a-r) var(--a-r) 0 0;
    color: var(--a-body);
}
body.apex-cst .cst-step__in { padding: 1.5rem clamp(1rem, 1.8vw, 1.6rem) }
body.apex-cst .cst-step--1 { min-height: 190px; background: var(--a-paper) }
body.apex-cst .cst-step--2 { min-height: 250px; background: var(--cst-step-2) }
body.apex-cst .cst-step--3 { min-height: 310px; background: var(--cst-step-3) }
body.apex-cst .cst-step--4 { min-height: 370px; background: var(--a-brand) }
body.apex-cst .cst-step__price {
    font-size: var(--a-t-sub);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--a-ink);
}
body.apex-cst .cst-main .cst-step__name {
    margin-top: .5rem;
    font-size: var(--a-t-body);
    line-height: 1.3;
    letter-spacing: 0;
}
body.apex-cst .cst-step__name a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px }
body.apex-cst .cst-step__why { margin-top: .35rem; font-size: .94rem; line-height: 1.45; max-width: 22em }
body.apex-cst .cst-step--4 .cst-step__price,
body.apex-cst .cst-main .cst-step--4 .cst-step__name { color: #fff }
body.apex-cst .cst-step .cst-step__why { color: var(--a-body) }
body.apex-cst .cst-step--4 .cst-step__why { color: #e8eefa }

/* ════ The build sheet ════ */
body.apex-cst .cst-size { padding-top: clamp(6rem, 10vw, 9rem) }
body.apex-cst .cst-build {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    margin-top: clamp(2rem, 4vw, 3.2rem);
}
body.apex-cst .cst-q { border: 0; min-width: 0 }
body.apex-cst .cst-q + .cst-q { margin-top: 1.7rem }
body.apex-cst .cst-q legend { font-weight: 600; color: var(--a-ink); margin-bottom: .6rem }
body.apex-cst .cst-q__opts { display: flex; flex-wrap: wrap; gap: .5rem }
body.apex-cst .cst-opt { position: relative; cursor: pointer }
body.apex-cst .cst-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer }
body.apex-cst .cst-opt span {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .5rem .95rem;
    border: 1px solid var(--a-card-line);
    border-radius: var(--a-r-sm);
    background: #fff;
    color: var(--a-ink);
    font-size: .95rem;
    line-height: 1.25;
    transition: background-color .18s var(--a-ease), border-color .18s var(--a-ease), color .18s var(--a-ease);
}
body.apex-cst .cst-opt:hover span { border-color: var(--a-brand) }
body.apex-cst .cst-opt input:checked + span { background: var(--a-brand); border-color: var(--a-brand); color: #fff }
body.apex-cst .cst-opt input:focus-visible + span { outline: 2px solid var(--a-brand); outline-offset: 3px }

body.apex-cst .cst-sheet {
    position: sticky;
    top: 104px;
    padding: 1.7rem clamp(1.3rem, 2.4vw, 2rem) 1.8rem;
    border: 1px solid var(--a-card-line);
    border-radius: var(--a-r);
    background: #fff;
    box-shadow: var(--a-card-shadow-2);
}
body.apex-cst .cst-main .cst-sheet__title { font-size: var(--a-t-sub) }
body.apex-cst .cst-sheet__lines { list-style: none; margin-top: .7rem }
body.apex-cst .cst-sheet__lines li {
    display: flex;
    align-items: flex-end;
    min-height: 3rem;
    padding-bottom: .25rem;
    border-bottom: 1px solid var(--a-line);
    font: 400 1.8rem/1.05 var(--cst-hand);
    color: var(--a-brand);
}
body.apex-cst .cst-sheet__lines li.is-new { animation: cst-write .55s var(--a-ease) both }
@keyframes cst-write {
    from { clip-path: inset(0 100% 0 0) }
    to   { clip-path: inset(0 0 0 0) }
}
body.apex-cst .cst-sheet__size { display: flex; align-items: flex-end; gap: 1.1rem; margin-top: 1.4rem }
body.apex-cst .cst-meter { flex: none; display: flex; align-items: flex-end; gap: 3px; height: 54px }
body.apex-cst .cst-meter i {
    display: block;
    width: 16px;
    background: var(--a-paper);
    box-shadow: inset 0 0 0 1px var(--a-card-line);
    border-radius: 4px 4px 0 0;
    transition: background-color .3s var(--a-ease), box-shadow .3s var(--a-ease);
}
body.apex-cst .cst-meter i:nth-child(1) { height: 22px }
body.apex-cst .cst-meter i:nth-child(2) { height: 38px }
body.apex-cst .cst-meter i:nth-child(3) { height: 54px }
body.apex-cst [data-level="1"] .cst-meter i:nth-child(-n+1),
body.apex-cst [data-level="2"] .cst-meter i:nth-child(-n+2),
body.apex-cst [data-level="3"] .cst-meter i:nth-child(-n+3) { background: var(--a-brand); box-shadow: none }
body.apex-cst .cst-sheet__word { font-size: var(--a-t-sub); font-weight: 600; line-height: 1.15; color: var(--a-ink) }
body.apex-cst .cst-sheet__say { margin-top: .2rem; font-size: .95rem; line-height: 1.4 }
body.apex-cst .cst-sheet__send { width: 100%; margin-top: 1.4rem }

/* ════ The receipt ════ */
body.apex-cst .cst-worth { padding-top: clamp(6rem, 10vw, 9rem) }
body.apex-cst .cst-worth__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
}
body.apex-cst .cst-worth__say p { margin-top: 1.1rem; max-width: 32em; font-size: var(--a-t-spoken); line-height: 1.5 }
body.apex-cst .cst-till {
    position: relative;
    padding: clamp(1.6rem, 3.5vw, 3rem);
    border-radius: var(--a-r);
    background: var(--a-paper);
}
body.apex-cst .cst-receipt {
    --tooth: 9px;
    width: min(100%, 350px);
    padding: 1.5rem 1.4rem calc(1.4rem + var(--tooth));
    background: #fff;
    color: var(--a-ink);
    font-family: var(--a-mono);
    font-size: .92rem;
    filter: drop-shadow(0 14px 18px rgba(10, 23, 48, .13));
    clip-path: polygon(0 0, 100% 0, 100% 100%, 95% calc(100% - var(--tooth)), 90% 100%, 85% calc(100% - var(--tooth)), 80% 100%, 75% calc(100% - var(--tooth)), 70% 100%, 65% calc(100% - var(--tooth)), 60% 100%, 55% calc(100% - var(--tooth)), 50% 100%, 45% calc(100% - var(--tooth)), 40% 100%, 35% calc(100% - var(--tooth)), 30% 100%, 25% calc(100% - var(--tooth)), 20% 100%, 15% calc(100% - var(--tooth)), 10% 100%, 5% calc(100% - var(--tooth)), 0 100%);
}
body.apex-cst .cst-main .cst-receipt__title {
    margin-bottom: .8rem;
    padding-bottom: .7rem;
    border-bottom: 1px dashed var(--a-line);
    font: 600 .95rem/1.3 var(--a-mono);
    letter-spacing: 0;
    text-align: center;
}
body.apex-cst .cst-receipt__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 46px;
}
body.apex-cst .cst-receipt__money { display: inline-flex; align-items: center; gap: .15rem }
body.apex-cst .cst-receipt input {
    width: 4.6em;
    min-height: 38px;
    padding: .2rem .4rem;
    border: 1px solid var(--a-brand);
    border-radius: 6px;
    background: #f7faff;
    color: var(--a-brand);
    font: 600 1rem/1.2 var(--a-mono);
    text-align: right;
}
body.apex-cst .cst-receipt__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .6rem;
    padding-top: .8rem;
    border-top: 1px dashed var(--a-line);
    font-weight: 600;
}
body.apex-cst .cst-receipt__total output { font-size: 1.7rem; line-height: 1.1; letter-spacing: -.02em }
body.apex-cst .cst-till__pen {
    position: absolute;
    left: calc(clamp(1.6rem, 3.5vw, 3rem) + 350px + 1.1rem);
    right: .8rem;
    top: clamp(5rem, 7vw, 6rem);
    font: 400 1.95rem/1.05 var(--cst-hand);
    color: var(--a-brand);
    transform: rotate(-3deg);
}
body.apex-cst .cst-till__sum { margin-top: 1.5rem; font-size: var(--a-t-spoken); line-height: 1.4; font-weight: 600; color: var(--a-ink) }
body.apex-cst .cst-till__small { margin-top: .45rem; font-size: var(--a-t-mark); line-height: 1.45; color: var(--a-soft) }

/* ════ Questions ════ */
body.apex-cst .cst-faq { padding-block: clamp(6rem, 10vw, 9rem) clamp(3rem, 6vw, 5rem) }
body.apex-cst .apex-faq {
    --faq-line:   var(--a-line);
    --faq-ink:    var(--a-ink);
    --faq-body:   var(--a-body);
    --faq-accent: var(--a-brand);
    margin-top: clamp(1.8rem, 3vw, 2.6rem);
    max-width: 860px;
}

/* ════ Motion: the stairs climb once, everything else arrives from visible ════ */
html.cst-anim body.apex-cst [data-cst-r] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .8s var(--a-ease), transform .9s var(--a-ease);
    transition-delay: calc(var(--i, 0) * 90ms);
}
html.cst-anim body.apex-cst [data-cst-r].is-in { opacity: 1; transform: none }
/* The first screen never waits for a script: the answer paints at once and the
   stairs climb on CSS alone. */
html.cst-anim body.apex-cst .cst-step {
    animation: cst-climb 1s var(--a-ease) both;
    animation-delay: calc(80ms + var(--i, 0) * 120ms);
}
@keyframes cst-climb { from { transform: translateY(102%) } to { transform: none } }
@keyframes cst-reach { from { transform: translateX(-104%) } to { transform: none } }

/* ════ Footer landing, as on the other light pages ════ */
body.apex-cst .nx-footer {
    position: relative;
    background: linear-gradient(to bottom, var(--footer-fade, #fff) 0, var(--footer-fade, #fff) 4px, #02122f 4px);
    padding-top: 0;
    overflow: hidden;
}
body.apex-cst .nx-footer__ridge { display: none }
body.apex-cst .nx-footer::before {
    content: "";
    display: block;
    width: 100%;
    aspect-ratio: 2172 / 374;
    background:
        linear-gradient(to bottom, var(--footer-fade, #fff) 0%, var(--footer-fade, #fff) 4%, rgba(255, 255, 255, 0) 55%) top center / 100% 100% no-repeat,
        url("../media/fx/fx-ice-shelf.webp") top center / 100% auto no-repeat;
}

/* ════ Narrower screens ════ */
@media (max-width: 980px) {
    body.apex-cst .cst-hero__top,
    body.apex-cst .cst-build,
    body.apex-cst .cst-worth__grid { grid-template-columns: minmax(0, 1fr) }
    body.apex-cst .cst-hero h1 { max-width: 18ch }
    body.apex-cst .cst-sheet { position: static }
    body.apex-cst .cst-step--1 { min-height: 240px }
    body.apex-cst .cst-step--2 { min-height: 290px }
    body.apex-cst .cst-step--3 { min-height: 340px }
    body.apex-cst .cst-step--4 { min-height: 390px }
    body.apex-cst .cst-climb__pen { max-width: 10em; font-size: 1.8rem }
}

/* On a phone the stairs turn on their side: each step reaches further across. */
@media (max-width: 720px) {
    body.apex-cst .cst-climb__pen { position: static; max-width: none; margin-bottom: .9rem }
    body.apex-cst .cst-stairs { grid-template-columns: minmax(0, 1fr); border-bottom: 0; gap: 4px; overflow: visible }
    body.apex-cst .cst-step { min-height: 0; border-radius: 0 var(--a-r-sm) var(--a-r-sm) 0 }
    body.apex-cst .cst-step__in { padding: 1rem 1.1rem }
    body.apex-cst .cst-step--1 { min-height: 0; width: 82% }
    body.apex-cst .cst-step--2 { min-height: 0; width: 88% }
    body.apex-cst .cst-step--3 { min-height: 0; width: 94% }
    body.apex-cst .cst-step--4 { min-height: 0; width: 100% }
    html.cst-anim body.apex-cst .cst-step { animation-name: cst-reach }
    body.apex-cst .cst-climb { overflow-x: clip }
    body.apex-cst .cst-hero__acts .cst-btn { flex: 1 1 100% }
    body.apex-cst .cst-till__pen { position: static; margin-top: 1rem }
    body.apex-cst .cst-receipt { width: 100% }
}

@media (prefers-reduced-motion: reduce) {
    body.apex-cst .cst-sheet__lines li.is-new { animation: none }
    body.apex-cst .cst-btn, body.apex-cst .cst-opt span, body.apex-cst .cst-meter i { transition: none }
}
