/* QLOGIX "Quarter" - the four case-study pages (aog, automotive, electronics, oversized-cargo), one template.
   Loaded after styles.css (tokens, .label, .bar, .h2, .btn, .tlink, .art, [data-reveal]) and sub.css (sp-crumbs,
   sp-hero, sp-band, sp-cta). Everything here is prefixed cs-.
   The pages' own idea: the job told as a route. 01 the challenge, 02 the solution and 03 the results stand on one
   numeral column; between them runs a rail of minute ticks (the dial laid flat) whose spine fills with blue as the
   story is read and ends in the position dot. The results are set huge on the navy band and rise into view. */

.cs-story, .cs-res { --num: clamp(84px, 11vw, 184px); }

/* ---------- hero: crumbs, label with the 01 / 04 counter, the title, the facts of the job; the drawing right ---------- */
.cs-count { color: var(--navy-950); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-hero__art { aspect-ratio: 5 / 4; border-radius: var(--r) var(--q) var(--r) var(--r); }

.cs-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px clamp(16px, 2.2vw, 32px); margin-top: clamp(30px, 4.6vh, 54px); }
.cs-meta > div { display: grid; align-content: start; gap: 8px; padding-top: 14px; border-top: 1.5px solid var(--navy-900); }
.cs-meta dt { font-size: .8125rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; color: var(--brand-700); }
.cs-meta dd { font-family: var(--display); font-weight: 600; font-size: clamp(1.0625rem, 1.3vw, 1.25rem); line-height: 1.3; letter-spacing: -.01em; color: var(--navy-950); overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 14 6 6; }
.js .sp-hero__h1[data-reveal] { transition-delay: .08s; }
.js .cs-meta[data-reveal] { transition-delay: .2s; }

/* ---------- the story: numeral column, heading, text ---------- */
.cs-story { --gap: clamp(72px, 8vw, 132px); padding-block: clamp(56px, 6.5vw, 112px) var(--sec); }
.cs-step { display: grid; grid-template-columns: var(--num) minmax(0, .9fr) minmax(0, 1.1fr); column-gap: clamp(24px, 4vw, 72px); align-items: start; }
.cs-step + .cs-step { margin-top: var(--gap); }
.cs-step__n { align-self: stretch; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.cs-step__n > span {
  font-family: var(--display); font-weight: 800; font-size: clamp(3.25rem, 6.2vw, 6.5rem);
  line-height: .78; letter-spacing: -.05em; font-variant-numeric: tabular-nums; color: var(--brand-400);
}
.cs-step__h {
  padding-top: .05em;
  font-family: var(--display); font-weight: 750; font-size: clamp(2.1rem, 3.7vw, 3.6rem);
  line-height: 1; letter-spacing: -.032em; font-variation-settings: "opsz" 96;
  text-wrap: balance; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 14 6 6;
}
.cs-step__b { display: grid; gap: 22px; padding-top: .3em; }
.cs-step__b p { max-width: 60ch; font-size: 1.1875rem; line-height: 1.6; color: var(--muted); }
.cs-step__b p:first-child { max-width: 44ch; font-size: clamp(1.25rem, 1.65vw, 1.5rem); line-height: 1.5; color: var(--navy-900); }

/* the rail: a spine with minute ticks, a longer one every fifth; it runs from one numeral to the next */
.cs-rail {
  position: relative; flex: 1 1 auto; width: 26px; min-height: 96px; margin: 0 0 calc(-1 * var(--gap) + 22px) 6px;
  background:
    linear-gradient(var(--navy-100), var(--navy-100)) 0 0 / 3px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--navy-200) 0 3px, transparent 3px 70px) 0 0 / 24px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--navy-200) 0 3px, transparent 3px 14px) 0 0 / 12px 100% no-repeat;
}
.cs-rail::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-400); transform-origin: 50% 0; }
.cs-step--end .cs-rail { margin-bottom: 0; }
.cs-step--end .cs-rail::after { /* the position dot: where the job stands at the end of the story */
  content: ""; position: absolute; left: 1.5px; bottom: 0; width: 18px; height: 18px; margin: 0 0 -9px -9px;
  border-radius: 50%; background: var(--brand-400); box-shadow: 0 0 0 9px rgba(41, 182, 232, .25);
}

/* ---------- results: navy band, the four figures set huge ---------- */
.cs-res .cs-step { grid-template-columns: var(--num) minmax(0, 1fr); }
.cs-res .cs-step__h { color: #fff; }
.cs-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px clamp(20px, 2.6vw, 44px); margin-top: clamp(48px, 6vw, 96px); }
.cs-m { position: relative; display: grid; align-content: start; gap: 14px; padding-top: clamp(24px, 2.4vw, 36px); border-top: 1.5px solid rgba(255, 255, 255, .18); }
.cs-m::before { content: ""; position: absolute; left: 0; top: -3.75px; width: 34px; height: 6px; background: var(--brand-400); border-radius: 1px; transform-origin: 0 50%; }
.cs-m__v {
  display: block; overflow: hidden; padding-top: .06em;
  font-family: var(--display); font-weight: 800; font-size: clamp(3.5rem, 7.4vw, 8rem);
  line-height: .96; letter-spacing: -.045em; white-space: nowrap; color: #fff;
}
.cs-m__v > span { display: inline-block; }
.cs-m__v small { font-size: .25em; font-weight: 600; letter-spacing: 0; color: var(--brand-300); }
.cs-m__l { max-width: 19ch; font-size: 1.0625rem; line-height: 1.4; color: var(--on-dark); }

/* ---------- next case study: one wide link with its drawing ---------- */
.cs-next { padding-block: var(--sec) calc(var(--sec) * .9); }
.cs-next__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; margin-bottom: clamp(18px, 2.2vw, 30px); }
.cs-next__card { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(24px, 4vw, 72px); text-decoration: none; color: inherit; }
.cs-next__card:focus-visible { outline-offset: 8px; border-radius: var(--r); }
.cs-next__art { aspect-ratio: 5 / 4; border-radius: var(--r) calc(var(--q) * .6) var(--r) var(--r); }
.cs-next__art > svg { transition: transform 1.2s var(--ease); }
.cs-next__b { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 16px; border-top: 1.5px solid var(--navy-900); }
.cs-next__tag { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; font-weight: 600; letter-spacing: .04em; color: var(--brand-700); }
.cs-next__tag span { color: var(--navy-950); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-next__h { max-width: 15ch; font-family: var(--display); font-weight: 750; font-size: clamp(2.1rem, 4.4vw, 4.5rem); line-height: 1; letter-spacing: -.034em; font-variation-settings: "opsz" 96; text-wrap: balance; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 14 6 6; }
.cs-next__p { max-width: 44ch; font-size: 1.125rem; line-height: 1.55; color: var(--muted); }
.cs-next__go {
  position: relative; display: grid; place-items: center; width: 72px; height: 72px; margin-top: auto; overflow: hidden; isolation: isolate;
  border-radius: 16px 32px 16px 16px; background: var(--navy-950); color: #fff;
}
.cs-next__go::before { /* the button's quarter fill, as on .btn */
  content: ""; position: absolute; z-index: -1; left: 0; bottom: 0; width: 240%; aspect-ratio: 1; border-radius: 0 100% 0 0;
  background: var(--brand-700); transform: scale(0); transform-origin: 0 100%; transition: transform .6s var(--ease);
}
.cs-next__go .arr { width: 22px; }
.cs-next__card:focus-visible .cs-next__art > svg { transform: scale(1.05); }
.cs-next__card:focus-visible .cs-next__go::before { transform: scale(1); }
@media (hover: hover) {
  .cs-next__card:hover .cs-next__art > svg { transform: scale(1.05); }
  .cs-next__card:hover .cs-next__go::before { transform: scale(1); }
  .cs-next__card:hover .cs-next__go .arr { transform: translateX(5px); }
}

/* ---------- motion (JS + motion allowed only; without them everything stands in its final state) ---------- */
@media screen and (prefers-reduced-motion: no-preference) {
  .js .cs-rail::before { transform: scaleY(0); transition: transform 1.8s .5s var(--ease-in-out); }
  .js .cs-step.is-seen .cs-rail::before { transform: none; }
  .js .cs-step--end .cs-rail::after { opacity: 0; transform: scale(.3); transition: opacity .5s 2.1s, transform .7s 2.1s var(--ease); }
  .js .cs-step--end.is-seen .cs-rail::after { opacity: 1; transform: none; }

  .js .cs-metrics .cs-m__v > span { transform: translateY(108%); transition: transform 1.1s .3s var(--ease); }
  .js .cs-metrics .cs-m::before { transform: scaleX(0); transition: transform .9s .2s var(--ease-in-out); }
  .js .cs-metrics.is-seen .cs-m__v > span, .js .cs-metrics.is-seen .cs-m::before { transform: none; }
  .js .cs-metrics .cs-m:nth-child(2) .cs-m__v > span { transition-delay: .42s; }
  .js .cs-metrics .cs-m:nth-child(3) .cs-m__v > span { transition-delay: .54s; }
  .js .cs-metrics .cs-m:nth-child(4) .cs-m__v > span { transition-delay: .66s; }
  .js .cs-metrics .cs-m:nth-child(2)::before { transition-delay: .32s; }
  .js .cs-metrics .cs-m:nth-child(3)::before { transition-delay: .44s; }
  .js .cs-metrics .cs-m:nth-child(4)::before { transition-delay: .56s; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .cs-step { grid-template-columns: var(--num) minmax(0, 1fr); }
  .cs-step__n { grid-row: 1 / span 2; }
  .cs-step__b { grid-column: 2; margin-top: clamp(20px, 2.6vw, 30px); padding-top: 0; }
  .cs-step__b p:first-child { max-width: 52ch; }
}
@media (max-width: 960px) {
  .cs-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-m__v { font-size: clamp(3.5rem, 11.5vw, 7rem); }
  .cs-next__card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cs-story, .cs-res { --num: 52px; }
  .cs-story { --gap: 64px; }
  .cs-meta { grid-template-columns: 1fr; gap: 0; }
  .cs-meta > div { grid-template-columns: 6.75rem minmax(0, 1fr); align-items: baseline; gap: 14px; padding-block: 12px; border-top-color: var(--navy-100); }
  .cs-meta > div:first-child { border-top-color: var(--navy-900); }
  .cs-meta dt { font-size: .75rem; letter-spacing: .12em; }
  .cs-step { column-gap: 16px; }
  .cs-step__n { gap: 16px; }
  .cs-step__n > span { font-size: 2.5rem; }
  .cs-step__h { font-size: clamp(1.9rem, 9vw, 2.4rem); padding-top: 0; }
  .cs-step__b { gap: 18px; }
  .cs-step__b p { font-size: 1.0625rem; }
  .cs-step__b p:first-child { font-size: 1.1875rem; }
  .cs-rail { margin-left: 4px; margin-bottom: calc(-1 * var(--gap) + 16px); }
  .cs-step--end .cs-rail { margin-bottom: 0; }
  .cs-metrics { gap: 36px 16px; }
  .cs-m { gap: 10px; padding-top: 20px; }
  .cs-m__v { font-size: min(15vw, 4.5rem); }
  .cs-m__l { font-size: 1rem; }
  .cs-next__card { grid-template-columns: 1fr; gap: 22px; }
  .cs-next__h { font-size: clamp(1.9rem, 8.4vw, 2.6rem); }
  .cs-next__go { width: 60px; height: 60px; }
}

@media print {
  .cs-rail, .cs-next__go { display: none; }
  .cs-res { background: none; color: var(--navy-950); }
  .cs-res .cs-step__h, .cs-m__v { color: var(--navy-950); }
  .cs-m { border-top-color: var(--navy-200); }
  .cs-m__l { color: var(--muted); }
}
