/* /portfolio/{brand}/{slug} — case page. Dark theme, shared tokens. */

.case { padding-top: var(--header-height); padding-bottom: 96px; }
.case-breadcrumbs { display: flex; gap: 8px; align-items: center; padding: 16px 0; font-size: .78rem; color: var(--text-faint); }
.case-breadcrumbs a { color: var(--text-soft); text-decoration: none; }
.case-breadcrumbs a:hover { color: var(--text-light); }

/* Hero — contained card. 16:9 to match the cover so the car isn't over-cropped;
 * height clamped between min/max (§5.2). Hero is a photo: text-on-photo stays
 * white in both themes; the dark wash overlay stays dark. */
.case-hero { position: relative; width: 100%; height: clamp(380px, 48vw, 660px); margin-top: 8px; display: flex; align-items: flex-end; border-radius: var(--radius-lg, 16px); overflow: hidden; background: var(--media-tile-bg); background-size: cover; background-position: center; }
.case-hero.no-image { background: linear-gradient(135deg, #2a2a2a, #1a1a1a); }
.case-hero-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,10,10,.95) 0%, rgba(10,10,10,.4) 50%, rgba(10,10,10,.15) 100%); }
.case-hero-inner { position: relative; width: 100%; padding: 32px; }
.case-hero-brand { font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; color: rgba(255,90,0,.95); margin: 0 0 8px; }
.case-hero-title { font-size: 2.4rem; font-weight: 500; color: #fff; margin: 0 0 10px; line-height: 1.1; }
.case-hero-year { opacity: .6; font-weight: 400; font-size: 1.5rem; }
.case-hero-sub { color: rgba(255,255,255,.78); max-width: 620px; margin: 0 0 20px; }
.case-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.case-body { }
.case-section { margin-top: 48px; }
.section-title { color: var(--text-strong); }

/* Spec */
.case-spec { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 16px 0 0; }
.case-spec-cell { background: var(--surface-1); border: .5px solid var(--border-soft); border-radius: var(--radius-md, 12px); padding: 16px; }
.case-spec dt { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.case-spec dd { margin: 6px 0 0; color: var(--text-strong); font-weight: 600; }

/* Section header with right-aligned hint (before/after) */
.case-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.case-section-head .section-title { margin: 0; }
.case-ba-hint { flex: none; font-size: .72rem; color: var(--text-faint); }

/* Before/after slider — fixed-height comparison (§5.4): photos cover-cropped,
 * not stretched to their full (often huge) natural size. */
.case-ba-list { display: flex; flex-direction: column; gap: 24px; margin-top: 16px; }
.case-ba-figure { width: 100%; max-width: 440px; margin: 0 auto; }
.ba { position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-md, 8px); overflow: hidden; user-select: none; touch-action: none; }
.ba-after, .ba-before { display: block; width: 100%; height: 100%; object-fit: cover; }
.ba-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.ba-divider { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; background: #fff; transform: translateX(-1px); pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.ba-handle { position: absolute; top: 50%; left: var(--pos, 50%); width: 36px; height: 36px; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #fff; color: #1a1a1a; box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none; }
.ba-handle svg { width: 18px; height: 18px; display: block; }
.ba-label { position: absolute; top: 12px; padding: 4px 8px; font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: rgba(0,0,0,.65); border-radius: 3px; pointer-events: none; }
.ba-label-before { left: 12px; }
.ba-label-after { right: 12px; }
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.case-ba-caption { margin-top: 8px; font-size: .82rem; color: var(--text-soft); }

/* Gallery */
.case-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.case-gallery-item { display: block; aspect-ratio: 4 / 5; border-radius: var(--radius-md, 12px); overflow: hidden; background: var(--media-tile-bg); }
.case-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-fast, .15s ease); }
.case-gallery-item:hover img { transform: scale(1.04); }

/* Narrative */
.case-narrative-text { color: var(--text-body); line-height: 1.7; max-width: 720px; margin-top: 12px; }

/* Related */
.case-related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.case-related-card { position: relative; min-height: 200px; display: flex; align-items: flex-end; padding: 16px; border-radius: var(--radius-md, 12px); background-color: var(--media-tile-bg); background-image: url("/assets/images/placeholder.svg"); background-size: cover; background-position: center; text-decoration: none; overflow: hidden; border: .5px solid var(--border-soft); }
.case-related-card:hover { border-color: rgba(255,90,0,.4); }
.case-related-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,10,10,.92), rgba(10,10,10,.2)); }
.case-related-body { position: relative; display: flex; flex-direction: column; gap: 2px; color: #fff; }
.case-related-brand { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,90,0,.95); }
.case-related-title { font-weight: 600; }

/* CTA */
.case-cta { margin-top: 56px; }
.case-cta-box { background: var(--cta-card-bg); border: .5px solid var(--cta-card-border); border-radius: var(--radius-lg, 16px); padding: 36px 32px; text-align: center; }
.case-cta-title { color: var(--cta-card-text); font-size: 1.5rem; margin: 0 0 .5rem; }
.case-cta-sub { color: var(--cta-card-muted); margin: 0 0 20px; }
.case-cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-whatsapp { display: inline-flex; align-items: center; gap: 8px; background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #20bd5a; }

/* Mobile sticky-bar — frosted, theme-aware (same modal token as the request modal). */
.case-stickybar { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--modal-bg); border-top: .5px solid var(--border-medium); backdrop-filter: blur(8px); }
.case-stickybar .btn { flex: 1; }

/* Lightbox */
/* z-index above the fixed header (1000) AND above the mobile sticky-bar
   (z=40) so the full-screen viewer covers everything (FE-02). */
.lb-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.95); display: none; align-items: center; justify-content: center; padding: 16px; }
.lb-overlay.is-open { display: flex; }
/* Figure is the flex item that the overlay centers — reset UA defaults
   (browsers add `margin: 1em 40px` to <figure>) so it doesn't push the
   image off-center / off-screen on tight viewports. */
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; max-height: 100%; }
.lb-img { max-width: 90vw; max-height: 82vh; width: auto; height: auto; object-fit: contain; display: block; }
.lb-cap { color: #ccc; text-align: center; font-size: .85rem; max-width: 90vw; }
.lb-close, .lb-prev, .lb-next { position: absolute; background: none; border: 0; color: #fff; cursor: pointer; line-height: 1; z-index: 1; }
.lb-close { top: 16px; right: 20px; font-size: 2rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2.6rem; padding: 0 16px; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-counter { position: absolute; top: 20px; left: 20px; color: #aaa; font-size: .85rem; z-index: 1; }

@media (max-width: 960px) {
    .case-stickybar { display: flex; }
    .case { padding-bottom: 80px; }
    /* On mobile the sticky-bar already shows the two primary CTAs,
       so the in-hero buttons just clutter the photo. Hide them. */
    .case-hero-actions { display: none; }
}
@media (max-width: 768px) {
    .case-hero { height: 280px; }
    .case-hero-inner { padding: 16px; }
    .case-hero-title { font-size: 1.7rem; }
    .case-spec { grid-template-columns: 1fr 1fr; }
    .case-gallery, .case-related { grid-template-columns: 1fr 1fr; }
    .ba-handle { width: 40px; height: 40px; }
    .ba-label { top: 8px; }
    .lb-prev, .lb-next { display: none; }
}
@media (max-width: 480px) {
    .case-related { grid-template-columns: 1fr; }
}
