/* Use-case story pages. Loaded only on pages with _orbitek_case (see inc/case-study.php). */

:root :is(.cs-hero, .cs-hero-grid, .cs-client, .cs-stats, .cs-stat, .build, .cmp-wrap, .o-compare, .ring-head, .o-ring, .gal-head, .gal, .story, .cs-aside, .chapters, .chapter, .tl, .tl-item) > * { margin-block: 0; }

/* Hero */
.cs-hero { background: linear-gradient(180deg, #EEF3F9 0%, var(--page) 100%); }
.cs-hero > .o-in { padding-block: 40px 72px; display: grid; gap: 28px; }
.crumb { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.cs-hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 56px; align-items: end; }
.cs-hero h1 { font: 600 clamp(34px, 5vw, 62px)/1.04 var(--display); letter-spacing: -.035em; }
.cs-hero h1 em { font-style: normal; color: var(--coral); }
.cs-client { display: flex; align-items: center; gap: 14px; margin-top: 22px !important; }
.cs-client p { font-size: 13.5px; color: var(--muted); }
.cs-client strong { display: block; font-size: 15px; color: var(--ink); }
.cs-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; background: var(--page); overflow: hidden; }
.cs-facts li { padding: 16px 18px; border-bottom: 1px solid var(--line); min-width: 0; font-size: 14.5px; font-weight: 600; display: grid; gap: 4px; }
.cs-facts li:nth-child(odd) { border-right: 1px solid var(--line); }
.cs-facts li:nth-last-child(-n+2) { border-bottom: 0; }
.cs-facts li em { font: 400 13.5px/1.3 var(--body); color: var(--muted); font-style: normal; }
.cs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px; }
.cs-stat { background: var(--night); color: #FFFFFF; border-radius: 14px; padding: 26px 26px 22px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.cs-stat::after { content: ""; position: absolute; right: -50px; top: -50px; width: 170px; height: 170px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 0 0 28px rgba(255, 255, 255, .03); }
.cs-stat .num { font: 700 clamp(40px, 5vw, 64px)/1 var(--display); letter-spacing: -.045em; color: #FFFFFF; }
.cs-stat p { color: var(--on-night-muted); font-size: 15px; max-width: 34ch; }
.cs-hero .cs-src { font-size: 13.5px; color: var(--muted); margin-top: -14px !important; }

/* Render to real */
.build { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 56px; align-items: center; }
.build h2, .gal-head h2, .ring-head h2, .story h2 { font: 600 clamp(26px, 3.2vw, 40px)/1.12 var(--display); letter-spacing: -.025em; }
.cmp-wrap { display: grid; gap: 14px; min-width: 0; }
.cmp-wrap .lede { font-size: 17px; }
.o-phone { position: relative; width: 100%; max-width: 300px; aspect-ratio: 9/19.2; border-radius: 42px; background: var(--night); padding: 10px; box-shadow: 0 40px 80px rgba(10, 20, 34, .22), inset 0 0 0 2px #26344A; justify-self: center; margin: 0 0 38px; }
.o-phone video { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 33px; background: #000000; }
.o-phone .notch { position: absolute; top: 18px; left: 50%; width: 86px; height: 22px; margin-left: -43px; border-radius: 12px; background: var(--night); z-index: 2; }
.o-phone figcaption { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); white-space: nowrap; font-size: 13px; color: var(--muted); }
.o-compare { position: relative; aspect-ratio: 1200/760; border-radius: 16px; overflow: hidden; background: var(--soft); box-shadow: 0 24px 60px rgba(10, 20, 34, .12); --pos: 50%; touch-action: pan-y; }
.o-compare figure { position: absolute; inset: 0; margin: 0; }
.o-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; border-radius: 0 !important; }
.o-compare figcaption { position: absolute; top: 14px; left: 14px; margin: 0; font: 600 12px/1 var(--body); padding: 7px 10px; border-radius: 4px; background: rgba(7, 15, 28, .72); color: #FFFFFF; }
.o-compare figure + figure { clip-path: inset(0 0 0 var(--pos)); }
.o-compare figure + figure figcaption { left: auto; right: 14px; }
.o-compare .bar { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #FFFFFF; box-shadow: 0 0 0 1px rgba(10, 20, 34, .15); pointer-events: none; }
.o-compare .knob { position: absolute; top: 50%; left: var(--pos); width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 8px 24px rgba(10, 20, 34, .25); display: grid; place-items: center; pointer-events: none; }
.o-compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.o-compare:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 3px; }
.cs-small { font-size: 14px; color: var(--muted); }

/* 3D ring */
.ring-sec { background: radial-gradient(120% 80% at 50% 0%, var(--night-2) 0%, var(--night) 60%); color: var(--on-night); overflow: hidden; }
.ring-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 18px 40px; }
.ring-head h2 { color: #FFFFFF; }
.ring-head p { color: var(--on-night-muted); max-width: 46ch; }
.o-ring { margin-top: 28px !important; }
.o-ring:not(.is-ready) { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.o-ring:not(.is-ready) figure { margin: 0; }
.o-ring:not(.is-ready) figcaption { display: none; }
.stage { --cw: 300px; position: relative; height: calc(var(--cw) * 1.25 + 150px); perspective: 1700px; perspective-origin: 50% 38%; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; outline: none; }
.stage.dragging { cursor: grabbing; }
.stage:focus-visible { outline: 2px solid var(--teal); outline-offset: -6px; border-radius: 18px; }
.ring { position: absolute; left: 50%; top: 40px; width: var(--cw); height: calc(var(--cw) * 1.25); margin-left: calc(var(--cw) / -2); transform-style: preserve-3d; }
.ring .card { position: absolute; inset: 0; margin: 0; border-radius: 14px; overflow: hidden; background: var(--bg-top, #CFEBFF); box-shadow: 0 30px 70px rgba(0, 0, 0, .45); backface-visibility: hidden; -webkit-backface-visibility: hidden; will-change: transform, opacity, filter; }
.ring .card::before { content: ""; position: absolute; inset: 50% 0 0; background: var(--bg-bot, #FFFFFF); }
.ring .card img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; border-radius: 0 !important; }
.ring .card figcaption { display: none; }
.ring .card.is-front { box-shadow: 0 40px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .18); }
.floor { position: absolute; left: 50%; top: calc(var(--cw) * 1.25 + 52px); width: min(720px, 90%); height: 60px; transform: translateX(-50%); background: radial-gradient(50% 50% at 50% 50%, rgba(43, 194, 185, .22), rgba(43, 194, 185, 0) 70%); pointer-events: none; }
.ring-ui { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-top: -56px; position: relative; z-index: 2; }
.ring-ui .arrow { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .04); color: #FFFFFF; cursor: pointer; display: grid; place-items: center; transition: background .2s ease; }
.ring-ui .arrow:hover { background: rgba(255, 255, 255, .12); }
.ring-ui .cap { text-align: center; min-width: 0; }
.ring-ui .cap b { display: block; font: 600 18px/1.3 var(--display); letter-spacing: -.01em; color: #FFFFFF; }
.ring-ui .cap span { font-size: 14px; color: var(--on-night-muted); }
.ring-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ring-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .25); cursor: pointer; transition: width .4s var(--ease), background .2s ease; }
.ring-dots button[aria-current="true"] { width: 26px; border-radius: 9px; background: var(--coral); }
.ring-hint { font-size: 13px; color: var(--on-night-muted); text-align: center; margin-top: 16px; opacity: .8; }

/* Gallery */
.gal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 14px 40px; margin-bottom: 28px !important; }
.gal-head p { max-width: 44ch; font-size: 14.5px; color: var(--muted); }
.gal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: clamp(150px, 16vw, 220px); gap: 12px; }
.gal figure.wp-block-image { position: relative; border-radius: 12px; overflow: hidden; background: var(--soft); min-width: 0; margin: 0; }
.gal figure.wp-block-image img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0 !important; transition: transform 1.2s var(--ease); }
.gal figure.wp-block-image:hover img { transform: scale(1.04); }
.gal figure.wp-block-image figcaption { position: absolute; left: 10px; bottom: 10px; margin: 0; font: 500 12px/1.2 var(--body); color: #FFFFFF; background: rgba(7, 15, 28, .6); padding: 6px 8px; border-radius: 4px; }
.gal .g1 { grid-column: span 2; grid-row: span 2; }
.gal .g4 { grid-column: span 2; }
.gal .film { grid-column: 1 / -1; grid-row: span 2; border-radius: 14px; overflow: hidden; background: var(--night); margin: 0; position: relative; }
.gal .film video { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--night); }
.gal .film figcaption { position: absolute; left: 12px; top: 12px; font-size: 12.5px; color: #FFFFFF; background: rgba(7, 15, 28, .6); padding: 6px 9px; border-radius: 4px; pointer-events: none; }

/* Story + timeline */
.story { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 64px; }
.cs-aside { position: sticky; top: 110px; align-self: start; display: grid; gap: 18px; }
.chapter { display: grid; gap: 12px; padding-block: 26px; border-top: 1px solid var(--line); }
.chapter:first-child { border-top: 0; padding-top: 0; }
.chapter h3 { font: 600 19px/1.3 var(--display); letter-spacing: -.01em; }
.chapter p, .chapter li { color: var(--ink-2); max-width: 62ch; }
.chapter ul { padding-left: 20px; display: grid; gap: 6px; margin: 0; }
.tl { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 48px !important; }
.tl-item { position: relative; padding: 28px 18px 0 0; display: grid; gap: 6px; min-width: 0; align-content: start; }
.tl-item::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line); }
.tl-item::after { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--page); border: 3px solid var(--teal); box-sizing: border-box; }
.tl-item:last-child::after { background: var(--coral); border-color: var(--coral); }
.tl-item .when { font-size: 13px; font-weight: 600; color: var(--teal-ink); }
.tl-item .what { font-size: 15px; font-weight: 600; line-height: 1.35; }
.tl-item .desc { font-size: 14px; color: var(--muted); }

/* Client quote slot (filled only with a written quote) */
.cs-quote { margin: 0; border: 1px dashed #D8C38F; background: #FFFBF0; border-radius: 18px; padding: 30px 32px; display: grid; gap: 10px; }
.cs-quote p { margin: 0; font: 600 clamp(19px, 2.2vw, 24px)/1.4 var(--display); letter-spacing: -.015em; color: var(--ink-2); }
.cs-quote figcaption { font-size: 14px; color: var(--muted); }
.cs-quote .pill { justify-self: start; font: 600 12px/1 var(--body); padding: 6px 9px; border-radius: 4px; background: #FFF4DB; color: #7A5200; }
.chapters { min-width: 0; }

/* Next case */
.cs-next { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 26px 30px; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; background: var(--page); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.cs-next:hover { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(10, 20, 34, .08); }
.cs-next small { font-size: 13px; color: var(--muted); }
.cs-next b { display: block; font: 600 clamp(20px, 2.4vw, 28px)/1.2 var(--display); letter-spacing: -.02em; margin-top: 4px; }
.cs-next span.sub { color: var(--muted); font-size: 14.5px; }

@media (max-width: 900px) {
	.cs-hero-grid, .story { grid-template-columns: minmax(0, 1fr); gap: 28px; }
	.cs-aside { position: static; }
	.build { grid-template-columns: minmax(0, 1fr); gap: 40px; }
	.o-phone { max-width: 250px; }
}
@media (max-width: 820px) {
	.tl { grid-template-columns: minmax(0, 1fr); gap: 22px; }
	.tl-item { padding: 0 0 0 30px; }
	.tl-item::before { left: 6px; right: auto; top: 20px; bottom: -26px; width: 2px; height: auto; }
	.tl-item:last-child::before { display: none; }
	.tl-item::after { top: 2px; }
}
@media (max-width: 760px) {
	.gal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.gal .g1, .gal .g4 { grid-column: span 2; }
	.gal .g1 { grid-row: span 1; }
	.gal .film { grid-row: span 1; }
}
@media (max-width: 640px) {
	.stage { --cw: 210px; }
	.ring-ui { gap: 10px; margin-top: -40px; }
	.ring-ui .arrow { width: 44px; height: 44px; }
	.ring-ui .cap b { font-size: 15.5px; }
}
@media (max-width: 560px) {
	.cs-facts { grid-template-columns: minmax(0, 1fr); }
	.cs-facts li { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
	.cs-facts li:last-child { border-bottom: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
	.gal figure.wp-block-image img, .cs-next, .ring-dots button { transition: none; }
}
