/* ==========================================================================
   Single case study. Loaded only on portfolio pages, after the design skin.
   Colours come from the theme tokens, so dark and mixed both work.
   ========================================================================== */

/* ---------- Hero ---------- */
:root[data-design="aurora"] .project-hero__row { flex-direction: column; align-items: center; gap: 28px; }
:root[data-design="aurora"] .project-hero__summary { max-width: 760px; }
:root[data-design="aurora"] .project-hero .hero-row__actions { justify-content: center; }

.project-facts {
	max-width: 920px;
	border: 1px solid var(--line); border-radius: var(--radius);
	background: var(--surface);
}
.project-facts > div, .project-facts > div + div { padding: 20px 24px; }
.project-facts > div + div { border-left: 1px solid var(--line); }

/* ---------- Cover: shown whole, never cropped ---------- */
.cs-cover { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 40px 90px -50px rgba(16, 38, 74, .55); }
.cs-cover img { display: block; width: 100%; height: auto; }

/* ---------- Part heading (projects with several parts) ---------- */
.cs-part + .cs-part { margin-top: var(--section); }
.cs-part__head { display: flex; align-items: baseline; gap: clamp(14px, 2vw, 28px); padding-top: var(--section); }
.cs-part__no { font: 500 clamp(18px, 2vw, 28px)/1 var(--font-head); color: var(--accent-text); }

/* ---------- Overview ---------- */
.cs-brief__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 4vw, 64px); }
.cs-client { display: flex; flex-direction: column; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cs-client .kicker { align-self: flex-start; margin: 2px 0 0 2px; }
.cs-client__logo { flex: 1; display: grid; place-items: center; min-height: clamp(170px, 16vw, 240px); padding: clamp(20px, 2.4vw, 36px); border-radius: calc(var(--radius-lg) - 12px); background: #fff; }
.cs-client__logo img { width: auto; max-width: min(100%, 320px); height: auto; max-height: clamp(90px, 9vw, 140px); object-fit: contain; }
.cs-client__name { color: #0d1b33; font: 500 clamp(26px, 2.7vw, 42px)/1.08 var(--font-head); letter-spacing: -.02em; text-align: center; }
.cs-brief__text p { max-width: 62ch; margin: 18px 0 0; color: var(--muted); font-size: var(--fs-lg); line-height: 1.65; }
.cs-brief__text p:first-child { margin-top: 0; }
.cs-brief__text .cs-brief__lead { max-width: 30em; color: var(--text); font: 500 clamp(24px, 2.7vw, 42px)/1.22 var(--font-head); letter-spacing: -.02em; }

/* ---------- Challenges & objectives ---------- */
.cs-goals__title { margin: 0 0 clamp(32px, 4vw, 56px); text-align: center; }
.cs-goals__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.cs-card { padding: clamp(24px, 3vw, 44px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cs-card__label { margin: 0 0 clamp(16px, 2vw, 26px); font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }
.cs-list { margin: 0; padding: 0; list-style: none; }
.cs-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding-block: 16px; border-top: 1px solid var(--line); line-height: 1.5; }
.cs-list li:first-child { padding-top: 0; border-top: 0; }
.cs-list li:last-child { padding-bottom: 0; }
.cs-list__mark { font: 500 14px/1.7 var(--font-head); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.cs-list__mark .icon { width: 20px; height: 20px; margin-top: 2px; }

/* ---------- Screens ---------- */
.cs-screens__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: clamp(28px, 3.5vw, 48px); }
.cs-screens__count { flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.cs-screens__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.cs-screens__grid > .cs-frame:last-child:nth-child(odd) { grid-column: 1 / -1; }
.cs-screens__grid > .cs-frame:last-child:nth-child(odd) .cs-frame__view { aspect-ratio: 16 / 7; }

.cs-frame { margin: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: 0 30px 70px -45px rgba(16, 38, 74, .55); }
.cs-frame__bar { display: flex; align-items: center; gap: 14px; height: 42px; padding-inline: 14px; border-bottom: 1px solid var(--line); }
.cs-frame__dots { display: flex; flex: none; gap: 6px; }
.cs-frame__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.cs-frame__url { overflow: hidden; padding: 3px 12px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }

.cs-frame__view { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg-2, var(--surface)); }
.cs-frame__view:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.cs-frame__view img { position: absolute; top: 0; left: 0; width: 100%; height: auto; max-width: none; transition: top .9s var(--ease-out), transform .9s var(--ease-out); }
.cs-frame__view.is-static img { height: 100%; object-fit: cover; object-position: top; }
.cs-frame__view:not(.is-static):hover img,
.cs-frame__view:not(.is-static):focus-visible img,
.cs-frame__view.is-playing img { top: 100%; transform: translateY(-100%); transition: top var(--cs-dur, 8s) linear, transform var(--cs-dur, 8s) linear; }

.cs-frame__hint { position: absolute; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 99px; background: rgba(10, 14, 24, .72); color: #fff; font-size: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .3s; }
.cs-frame__hint-t { display: none; }
.cs-frame__view:hover .cs-frame__hint, .cs-frame__view.is-playing .cs-frame__hint { opacity: 0; }
@media (hover: none) {
	.cs-frame__hint-h { display: none; }
	.cs-frame__hint-t { display: inline; }
}

/* ---------- Solution ---------- */
.cs-solution { padding-top: 0; }
.cs-solution__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 4vw, 64px); }
.cs-solution__side > * { position: sticky; top: calc(var(--header-h) + 24px); }
.cs-step { display: grid; grid-template-columns: clamp(40px, 5vw, 76px) minmax(0, 1fr); gap: 12px; padding-block: clamp(24px, 2.6vw, 38px); border-top: 1px solid var(--line); }
.cs-step:first-child { padding-top: 0; border-top: 0; }
.cs-step__no { font: 500 15px/1.9 var(--font-head); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.cs-step__title { margin: 0 0 12px; font: 500 clamp(21px, 1.9vw, 30px)/1.2 var(--font-head); letter-spacing: -.015em; }
.cs-step p { max-width: 68ch; margin: 0 0 12px; color: var(--muted); line-height: 1.65; }
.cs-step p a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.cs-bullets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted); line-height: 1.5; }
.cs-bullets li { position: relative; padding-left: 18px; }
.cs-bullets li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

/* ---------- Outcome ---------- */
.cs-outcome { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); padding: clamp(28px, 5vw, 72px); border-radius: var(--radius-lg); color: #fff; background: radial-gradient(70% 120% at 100% 0%, rgba(110, 193, 228, .5), transparent 60%), linear-gradient(135deg, var(--navy), var(--primary)); }
.cs-outcome__side { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.cs-outcome .section-title { color: #fff; }
.cs-stack .cs-card__label { margin-bottom: 12px; color: rgba(255, 255, 255, .78); }
.cs-stack__list { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.cs-stack__list li { display: grid; place-items: center; width: 74px; height: 74px; padding: 12px; border-radius: 16px; background: #fff; }
.cs-stack__list img { width: 100%; height: 100%; object-fit: contain; }
.cs-outcome__list { margin: 0; padding: 0; list-style: none; }
.cs-outcome__list li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; padding-block: 15px; border-top: 1px solid rgba(255, 255, 255, .22); font-size: var(--fs-lg); line-height: 1.45; }
.cs-outcome__list li:first-child { padding-top: 0; border-top: 0; }
.cs-outcome__list li:last-child { padding-bottom: 0; }
.cs-outcome__tick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.cs-outcome__tick .icon { width: 15px; height: 15px; }

/* ---------- Client review ---------- */
.cs-review { padding-bottom: 0; }
.cs-review figure { max-width: 900px; margin: 0 auto; text-align: center; }
.cs-review__mark .icon { width: 36px; height: 36px; color: var(--primary); }
.cs-review blockquote { margin: 18px 0 26px; font: 500 clamp(24px, 2.8vw, 42px)/1.25 var(--font-head); letter-spacing: -.02em; }
.cs-review figcaption { display: inline-flex; align-items: center; gap: 12px; text-align: left; color: var(--muted); font-size: 14px; }
.cs-review figcaption img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.cs-review figcaption b { display: block; color: var(--text); font-size: 16px; }

/* ---------- More projects ---------- */
.cs-more { padding-top: var(--section); }
.cs-more__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.cs-more__link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); transition: color .3s; }
.cs-more__link:hover { color: var(--text); }
.cs-more__link .icon { width: 18px; height: 18px; }
.cs-more__link .flip { transform: scaleX(-1); }
.cs-more__link b { color: var(--text); font-weight: 500; }
.cs-more .next-project { padding-top: 0; padding-bottom: var(--section); }
:root[data-design] .next-project .kicker { background: rgba(10, 14, 24, .55); border-color: rgba(255, 255, 255, .28); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.cs-brief__grid, .cs-solution__grid, .cs-goals__grid, .cs-outcome { grid-template-columns: minmax(0, 1fr); }
	.cs-solution__side > * { position: static; }
	.cs-screens__grid { grid-template-columns: minmax(0, 1fr); }
	.cs-screens__grid > .cs-frame:last-child:nth-child(odd) .cs-frame__view { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
	.project-facts { grid-template-columns: minmax(0, 1fr); }
	.project-facts > div, .project-facts > div + div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 18px; text-align: right; }
	.project-facts > div + div { border-left: 0; border-top: 1px solid var(--line); }
	.project-facts dd { margin: 0; }
	.cs-bullets { grid-template-columns: minmax(0, 1fr); }
	.cs-cover img { aspect-ratio: 4 / 3; object-fit: cover; }
	.cs-more__bar b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.cs-frame__view img { transition: none !important; }
}

/* ---------- Mobile screens: static phone mockups ---------- */
.cs-phones { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(24px, 4vw, 56px); margin-top: clamp(28px, 4vw, 56px); padding: clamp(32px, 5vw, 64px) 16px; border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(80% 90% at 50% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%), var(--surface); }
.cs-phones--solo { margin-top: 0; }
.cs-phone { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(300px, 78vw); margin: 0; }
.cs-phone__device { position: relative; width: 100%; padding: 11px; border-radius: 46px; background: linear-gradient(145deg, #2b313b, #0b0e13); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14), 0 40px 80px -40px rgba(16, 38, 74, .7); }
.cs-phone__island { position: absolute; top: 21px; left: 50%; z-index: 2; width: 31%; height: 24px; border-radius: 99px; background: #05070a; transform: translateX(-50%); }
.cs-phone__screen { overflow: hidden; padding-top: 44px; border-radius: 36px; background: #fff; }
.cs-phone__screen img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; object-position: top; }
.cs-phone__caption { color: var(--muted); font-size: 13px; text-align: center; }
/* One desktop screen + phones: side by side. */
.cs-screens__body.is-duo { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: clamp(14px, 1.6vw, 24px); }
.cs-screens__body.is-duo .cs-screens__grid { grid-template-columns: minmax(0, 1fr); }
.cs-screens__body.is-duo .cs-frame { display: flex; flex-direction: column; }
.cs-screens__body.is-duo .cs-screens__grid > .cs-frame:last-child:nth-child(odd) .cs-frame__view { flex: 1; aspect-ratio: auto; min-height: 420px; }
.cs-screens__body.is-duo .cs-phones { flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; margin-top: 0; padding: 28px clamp(20px, 2.4vw, 36px); }
.cs-screens__body.is-duo .cs-phone { width: clamp(220px, 21vw, 290px); }
@media (max-width: 900px) {
	.cs-screens__body.is-duo { grid-template-columns: minmax(0, 1fr); }
	.cs-screens__body.is-duo .cs-screens__grid > .cs-frame:last-child:nth-child(odd) .cs-frame__view { aspect-ratio: 4 / 3; min-height: 0; }
}

/* Next project: brand-colour gradient (same colour as the project's cover). */
.next-project__link--brand { background: radial-gradient(120% 140% at 85% 20%, var(--brand) 0%, color-mix(in srgb, var(--brand) 56%, #000) 45%, color-mix(in srgb, var(--brand) 20%, #000) 100%); }
.next-project__link--brand .next-project__media { background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: linear-gradient(90deg, #000, transparent 75%); mask-image: linear-gradient(90deg, #000, transparent 75%); }
.next-project__link--brand .next-project__media::after { display: none; }
.next-project__link--brand::after { content: ""; position: absolute; right: -10%; bottom: -40%; z-index: -1; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .07), transparent 65%); transition: transform 1.2s var(--ease-out); }
.next-project__link--brand:hover::after { transform: translate(-6%, -8%) scale(1.08); }

/* ---------- Before & after ---------- */
.cs-compare__head { display: grid; justify-items: center; gap: 10px; margin-bottom: clamp(28px, 3.5vw, 48px); text-align: center; }
.cs-compare__head .section-title { margin: 0; }
.cs-compare__sub { margin: 0; color: var(--muted); }
.cs-compare__tag { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.cs-compare__tag--before { background: rgba(10, 14, 22, .7); color: #fff; border: 1px solid rgba(255, 255, 255, .2); }
.cs-compare__tag--after { background: var(--primary); color: #fff; }

/* Desktop: two browser frames side by side, each scrolls its full-page shot. */
.cs-compare__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.cs-compare__frame .cs-frame__bar .cs-compare__tag { flex: none; margin-left: auto; height: 24px; }
.cs-compare__frame--after { border-color: color-mix(in srgb, var(--primary) 55%, var(--line-strong)); box-shadow: 0 40px 90px -45px color-mix(in srgb, var(--primary) 60%, transparent); }
.cs-compare__frame .cs-compare__view { aspect-ratio: 16 / 11; }

.cs-compare__phones { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(24px, 6vw, 96px); margin-top: clamp(20px, 2.4vw, 32px); padding: clamp(32px, 5vw, 64px) 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: radial-gradient(80% 90% at 50% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%), var(--surface); }
.cs-compare__phone { width: min(290px, 70vw); }
.cs-compare__phone .cs-phone__screen { background: #0b0e13; }
.cs-compare__phone .cs-compare__view { aspect-ratio: 9 / 19; background: #0b0e13; }
.cs-compare__phone .cs-compare__view img { max-height: none; height: auto; object-fit: initial; }
.cs-compare__phone .cs-frame__hint { left: 50%; bottom: 16px; transform: translateX(-50%); white-space: nowrap; }
.cs-compare__phone--before .cs-phone__device { opacity: .92; }
.cs-compare__cap { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

/* ---------- PageSpeed scores ---------- */
.cs-perf__head { display: grid; justify-items: center; gap: 10px; margin-bottom: clamp(28px, 3.5vw, 48px); text-align: center; }
.cs-perf__head .section-title { margin: 0; }
.cs-perf__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.cs-perf__card { padding: clamp(22px, 2.6vw, 36px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cs-perf__rings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.cs-ring { --c: #0cce6b; display: grid; justify-items: center; gap: 10px; text-align: center; }
.cs-ring.is-ok { --c: #ffa400; }
.cs-ring.is-poor { --c: #ff4e42; }
.cs-ring__dial { position: relative; display: grid; place-items: center; width: clamp(68px, 7vw, 96px); aspect-ratio: 1; }
.cs-ring__dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.cs-ring__dial circle { fill: none; stroke-width: 8; }
.cs-ring__track { stroke: color-mix(in srgb, var(--c) 18%, transparent); fill: color-mix(in srgb, var(--c) 8%, transparent) !important; }
.cs-ring__bar { stroke: var(--c); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--score)); }
.cs-ring__dial b { position: relative; color: var(--c); font: 600 clamp(22px, 2.2vw, 30px)/1 var(--font-head); font-variant-numeric: tabular-nums; }
.cs-ring__label { color: var(--text); font-size: 13px; line-height: 1.3; }
.cs-ring__was { color: var(--muted); font-size: 12px; }
.cs-perf__metrics { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: clamp(18px, 2vw, 28px) 0 0; padding: 0; list-style: none; }
.cs-perf__metrics li { display: grid; gap: 2px; min-width: 200px; padding: 14px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.cs-perf__metrics b { color: #0cce6b; font: 600 24px/1.1 var(--font-head); }
.cs-perf__metrics span { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
	.cs-compare__pair { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.cs-perf__rings { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; }
}
