/* ==========================================================================
   Interactive components (services / case studies, only when used):
   tabs, feature explorer, before/after, timeline.
   ========================================================================== */

.cmp { padding-block: calc(var(--section-y) * 0.55); }
.cmp__head { margin-bottom: 28px; }
.cmp__title { font-size: clamp(30px, 3vw, 44px); max-width: 16em; }
.cmp__intro { margin-top: 10px; max-width: 620px; font-size: 18px; line-height: 1.55; }

/* ---------- Tabs ---------- */
.tabs__list { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px; border-radius: 14px; background: var(--c-surface); width: fit-content; max-width: 100%; }
.tabs__tab { min-height: 44px; padding: 8px 18px; border-radius: 10px; font-weight: 600; transition: background-color var(--t-swap), color var(--t-swap); }
.tabs__tab[aria-selected="true"] { background: var(--c-accent); color: var(--c-white); } /* orange, never black */
.tabs__tab:not([aria-selected="true"]):hover { background: var(--c-bg); }
.tabs__panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; margin-top: 28px; }
.tabs__panel:not(:has(.tabs__media)) { grid-template-columns: minmax(0, 760px); }
.tabs__media { border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 3 / 2; }
.tabs__media img { width: 100%; height: 100%; object-fit: cover; }
.js .tabs__panel[hidden] { display: none; }
html:not(.js) .tabs__panel + .tabs__panel { border-top: 1px solid var(--c-border-strong); padding-top: 28px; }

/* ---------- Feature explorer ---------- */
.explorer { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
.explorer__list { display: grid; gap: 8px; }
.explorer__item {
	display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 18px 20px; text-align: left;
	border-radius: var(--radius); background: var(--c-surface); border: 1px solid var(--c-border);
	transition: border-color var(--t-swap), background-color var(--t-swap);
}
.explorer__item[aria-selected="true"] { border-color: var(--c-blue); background: var(--c-surface-2); }
.explorer__name { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.explorer__summary { font-size: 15px; color: var(--c-muted); }
.explorer__detail { padding: 24px; border-radius: var(--radius-lg); background: var(--c-surface); }
.explorer__media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; margin-bottom: 18px; }
.explorer__media img { width: 100%; height: 100%; object-fit: cover; }
.explorer__title { font-size: 28px; margin-bottom: 8px; }
.js .explorer__detail[hidden] { display: none; }
html:not(.js) .explorer__detail + .explorer__detail { margin-top: 16px; }

/* ---------- Before / after ---------- */
.compare__stage { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 16 / 10; background: var(--c-surface); --pos: 50%; }
.compare__img { position: absolute; inset: 0; }
.compare__img img { width: 100%; height: 100%; object-fit: cover; }
.compare__img--before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__tag { position: absolute; top: 14px; padding: 4px 10px; border-radius: var(--radius-sm); background: rgba(30, 30, 30, 0.7); color: #fff; font-size: 13px; font-weight: 600; }
.compare__tag--before { left: 14px; }
.compare__tag--after { right: 14px; }
.compare__handle {
	position: absolute; top: 50%; left: var(--pos); translate: -50% -50%; display: flex; align-items: center; justify-content: center;
	width: 48px; height: 48px; border-radius: 50%; background: var(--c-white); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); pointer-events: none;
}
.compare__handle .icon { width: 16px; height: 16px; }
.compare__handle::before { content: ""; position: absolute; left: 50%; top: -100vh; bottom: -100vh; width: 2px; translate: -50% 0; background: var(--c-white); z-index: -1; }
.compare__range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare__range:focus-visible + * , .compare__stage:has(.compare__range:focus-visible) .compare__handle { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.compare__caption { margin-top: 10px; font-size: 15px; color: var(--c-muted); text-align: center; }
/* Without JS: side by side. */
html:not(.js) .compare__stage { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
html:not(.js) .compare__img { position: relative; }
html:not(.js) .compare__img--before { clip-path: none; order: -1; }
html:not(.js) .compare__handle, html:not(.js) .compare__range { display: none; }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; padding-top: 30px; --progress: 0; }
.timeline::before, .timeline::after { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; border-radius: 2px; }
.timeline::before { background: var(--c-border-strong); }
.timeline::after { background: var(--c-blue); transform-origin: left; transform: scaleX(var(--progress)); transition: transform 1.2s var(--ease-out); }
.timeline__step { position: relative; }
.timeline__step::before { content: ""; position: absolute; top: -30px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--c-bg); border: 3px solid var(--c-blue); }
.timeline__marker { display: inline-block; font-size: 13px; font-weight: 600; color: var(--c-accent); margin-bottom: 6px; }
.timeline__title { font-size: 24px; }
.timeline__text { margin-top: 6px; line-height: 1.55; }
.timeline.is-in { --progress: 1; }
html:not(.js) .timeline { --progress: 1; }

@media (max-width: 1023px) {
	.tabs__panel, .explorer { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
	.timeline { grid-template-columns: 1fr; padding-top: 0; padding-left: 30px; gap: 22px; }
	.timeline::before, .timeline::after { left: 7px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
	.timeline::after { transform-origin: top; transform: scaleY(var(--progress)); }
	.timeline__step::before { top: 2px; left: -30px; }
	.tabs__list { width: 100%; }
	.tabs__tab { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
	.timeline::after { transition: none; }
}
