/* ============================================================
   Case Study — shared styles for all case study pages
   ============================================================ */


.back-link {
    display: inline-block;
    font-size: 0.75em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: var(--space-5);
    text-decoration: none;
    border-bottom: none;
}
.back-link:hover {
    color: var(--color-accent);
}

.case-title {
    font-size: 2.4em;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0 0 0.3em;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.case-tagline {
    font-size: 1.1em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-4);
    line-height: 1.6;
}

.case-links {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: var(--space-6);
}
.case-links a.button {
    display: inline-flex !important;
    align-items: center !important;
    height: auto !important;
    line-height: normal !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0.02em !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--color-text-muted) !important;
    border-bottom: 1px solid var(--color-border) !important;
    white-space: nowrap !important;
    transition: color 0.2s ease, border-bottom-color 0.2s ease !important;
}

.case-links a.button:hover {
    background: transparent !important;
    color: var(--color-heading) !important;
    box-shadow: none !important;
    border-bottom-color: var(--color-heading) !important;
}

.case-meta {
    font-size: 0.72em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-3);
}

.case-section {
    margin-bottom: var(--space-6);
}
.case-section h4 {
    font-size: 0.78em;
    font-weight: 700;
    color: var(--color-heading);
    margin: 1.75em 0 0.4em;
    letter-spacing: 0.01em;
}
.case-section h4:first-child {
    margin-top: 0;
}
.case-section h3 {
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-2);
}
.case-section p {
    font-size: 1em;
    line-height: 1.8;
    color: var(--color-text);
    margin: 0 0 var(--space-2);
}
.case-section p:last-child {
    margin-bottom: 0;
}

.iframe-note {
    font-size: 0.78em;
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0;
    line-height: 1.5;
    font-style: italic;
    padding-left: var(--space-1);
    border-left: 2px solid var(--color-border);
}
.iframe-note-mobile { display: none; }

.mobile-only { display: none; }

@media (max-width: 600px) {
    .iframe-note-desktop { display: none; }
    .iframe-note-mobile { display: block; }
    .desktop-only { display: none; }
    .mobile-only { display: block; }
    .case-meta {
        letter-spacing: 0.05em;
        font-size: 0.68em;
    }
}

.screenshot-placeholder {
    border: 1.5px dashed var(--color-border);
    border-radius: 8px;
    padding: 4em 2em;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85em;
    letter-spacing: 0.04em;
    margin: 3em 0;
}

.phone-showcase {
    display: flex;
    justify-content: center;
    margin-top: var(--space-3);
    margin-bottom: var(--space-3);
}

/* iPhone mockup — frame comes from box-shadow rings, not padding */
.phone-mockup {
    width: 280px;
    background: #111113;
    border-radius: 40px;
    /* ultra-thin bezels: 4px sides, 4px top, 6px bottom chin */
    padding: 4px 4px 6px;
    position: relative;
    box-shadow:
        /* glass edge highlight */
        inset 0 0 0 1px rgba(255,255,255,0.1),
        /* titanium bright edge */
        0 0 0 1.5px #5c5c61,
        /* dark body gap */
        0 0 0 3.5px #111113,
        /* outer titanium band */
        0 0 0 5px #3e3e43,
        /* subtle drop shadow */
        0 8px 24px rgba(0,0,0,0.18);
}

/* Power / lock button — right side, positioned beyond the 5px box-shadow frame */
.phone-mockup::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 145px;
    width: 4px;
    height: 58px;
    background: #4a4a50;
    border-radius: 0 3px 3px 0;
    z-index: 15;
}

/* Left side buttons: mute switch */
.phone-btns-left {
    position: absolute;
    left: -8px;
    top: 92px;
    width: 4px;
    height: 10px;
    background: #4a4a50;
    border-radius: 3px 0 0 3px;
    z-index: 15;
}

/* Volume up */
.phone-btns-left::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 0;
    width: 4px;
    height: 34px;
    background: #4a4a50;
    border-radius: 3px 0 0 3px;
}

/* Volume down */
.phone-btns-left::after {
    content: '';
    position: absolute;
    top: 72px;
    left: 0;
    width: 4px;
    height: 34px;
    background: #4a4a50;
    border-radius: 3px 0 0 3px;
}

/* Dynamic island — sits inside the status bar area */
.phone-mockup::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 18px;
    background: #111113;
    border-radius: 9px;
    z-index: 10;
    pointer-events: none;
}

.phone-screen {
    border-radius: 36px;
    overflow: hidden;
    height: 580px;
    display: flex;
    flex-direction: column;
}

.phone-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.status-bar {
    height: 28px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 22px 0 26px;
    pointer-events: none;
    position: relative;
    z-index: 5;
    background: #f3edea;
}

.status-time {
    font-size: 12px;
    font-weight: 600;
    color: #1c1c1e;
    letter-spacing: -0.2px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* iframe rendered at 390px iPhone width, scaled down to fit the phone frame.
   Scale = (280px phone - 4px padding × 2) / 390px viewport = 272/390 ≈ 0.697 */
.phone-demo {
    position: absolute;
    top: 0;
    left: 0;
    width: 390px;
    height: 832px;
    border: none;
    transform: scale(0.6974);
    transform-origin: top left;
}

.case-video {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    display: block;
    margin-bottom: 0.75em;
}


/* Attribution line for iOS screens built by collaborators */
.ios-attribution {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0;
    font-style: italic;
    line-height: 1.5;
}

/* Horizontal screenshot scroll track — matches CoastCast pattern */
.screenshot-scroll-track {
    display: flex;
    gap: 2.4em;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 1.5em;
    -webkit-overflow-scrolling: touch;
    padding: 1em 2em 1.5em 0;
    margin: 0 0 1.5em;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.screenshot-scroll-track::before {
    content: '';
    flex: 0 0 1.5em;
    min-width: 1.5em;
}
.screenshot-scroll-track::-webkit-scrollbar { height: 6px; }
.screenshot-scroll-track::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.screenshot-scroll-item {
    flex: 0 0 auto;
    width: 280px;
    scroll-snap-align: start;
}
/* Phone mockup fills the scroll item width */
.screenshot-scroll-item .phone-mockup {
    width: 100%;
}
/* Suppress CSS Dynamic Island — static screenshots already have it baked in */
.screenshot-scroll-item .phone-mockup::after {
    display: none;
}
.screenshot-scroll-item .phone-screen-static {
    border-radius: 30px;
}
.screenshot-scroll-item p,
p.ipad-item-label {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin: 0.65em 0 0;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}
/* Lets iphone-bezel fill the scroll item instead of capping at 270px */
.screenshot-bezel { max-width: 100% !important; }

/* Desktop browser screenshot gallery */
.desktop-ss-item {
    flex: 0 0 auto;
    width: 440px;
    scroll-snap-align: start;
}
.desktop-ss-item img {
    width: 100%;
    display: block;
}
.ss-clickable {
    cursor: zoom-in;
}
.ss-clickable:hover {
    opacity: 0.92;
}
.desktop-ss-item p {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin: 0.65em 0 0;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}

/* Two iPhones side by side — reuses .phone-mockup, scaled to 240px */
.device-showcase-grid {
    display: flex;
    gap: var(--space-5);
    justify-content: center;
    margin-top: var(--space-3);
    margin-bottom: var(--space-3);
}

.device-showcase-grid .phone-mockup {
    width: 240px;
    border-radius: 34px;
    flex-shrink: 0;
}

/* Power button — rescaled */
.device-showcase-grid .phone-mockup::before {
    right: -8px;
    top: 124px;
    height: 50px;
    width: 4px;
}

/* Dynamic island — rescaled */
.device-showcase-grid .phone-mockup::after {
    top: 5px;
    height: 15px;
    border-radius: 8px;
}

/* Mute switch — rescaled */
.device-showcase-grid .phone-btns-left {
    left: -8px;
    top: 79px;
    height: 9px;
}

/* Volume up — rescaled */
.device-showcase-grid .phone-btns-left::before {
    top: 24px;
    height: 29px;
    width: 4px;
}

/* Volume down — rescaled */
.device-showcase-grid .phone-btns-left::after {
    top: 62px;
    height: 29px;
    width: 4px;
}

/* Live iframe phones inside device-showcase-grid (240px wide)
   Scale = (240 - 8px padding) / 390px = 232/390 ≈ 0.595
   Screen height = 832px iframe × 0.595 + 24px status bar = 519px → 520px (no cutoff) */
.device-showcase-grid .phone-screen {
    height: 520px;
    border-radius: 30px;
}
.device-showcase-grid .phone-demo {
    transform: scale(0.595);
}
.device-showcase-grid .status-bar {
    height: 24px;
    padding: 0 13px 0 16px;
}
.device-showcase-grid .status-time {
    font-size: 11px;
}
.device-showcase-grid .status-icons {
    gap: 4px;
}
.device-showcase-grid .status-icons svg {
    transform: scale(0.85);
    transform-origin: right center;
}

/* Wrapper for a phone + its label below */
.phone-label-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.case-section .phone-item-label {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0;
    text-align: center;
}

/* Static image phone screen — no status bar row, height driven by image */
.phone-screen-static {
    border-radius: 24px;
    overflow: hidden;
}

.phone-screen-static img {
    width: 100%;
    display: block;
}

/* iPad mockup — landscape, horizontal scroll track */
.ipad-showcase-grid {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 1.5em;
    -webkit-overflow-scrolling: touch;
    padding: 0.5em 2em 1.25em 0;
    margin: var(--space-3) 0 1.5em;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.ipad-showcase-grid::before {
    content: '';
    flex: 0 0 1.5em;
    min-width: 1.5em;
}

.ipad-showcase-grid::-webkit-scrollbar { height: 6px; }
.ipad-showcase-grid::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.ipad-showcase-grid .ipad-item {
    flex: 0 0 auto;
    width: 520px;
    scroll-snap-align: start;
}

.ipad-mockup {
    position: relative;
    background: #111113;
    border-radius: 14px;
    padding: 8px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.1),
        0 0 0 1.5px #5c5c61,
        0 0 0 3.5px #111113,
        0 0 0 5px #3e3e43,
        0 8px 24px rgba(0,0,0,0.18);
}

.ipad-screen {
    border-radius: 7px;
    overflow: hidden;
}

.ipad-screen img {
    width: 100%;
    display: block;
}

@media (max-width: 600px) {
    .device-showcase-grid {
        flex-direction: column;
        align-items: center;
        gap: var(--space-4);
    }
    /* Live iframe phones at 240px stacked on mobile — same size as desktop */
    .device-showcase-grid .phone-screen { height: 520px; border-radius: 30px; }
    .device-showcase-grid .phone-demo { transform: scale(0.595); }

    .device-showcase-grid .phone-mockup {
        width: 240px;
        border-radius: 34px;
    }
    .phone-screen-static { border-radius: 17px; }

    .ipad-mockup { border-radius: 10px; }

    /* iPad scroll — one item fills most of screen width so you see one at a time */
    .ipad-showcase-grid .ipad-item {
        width: calc(100vw - 3.5rem);
    }
    .ipad-showcase-grid {
        scroll-padding-left: 1rem;
    }
    .ipad-showcase-grid::before {
        flex: 0 0 1rem;
        min-width: 1rem;
    }
}


/* Small device-type label shown above browser or phone embeds */
.case-section .device-view-label {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: var(--space-5) 0 var(--space-2);
}

/* Side-by-side admin dashboard preview — browser left, phone right */
.admin-device-split {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    margin-top: var(--space-3);
}

.admin-device-split .browser-mockup {
    flex: 1;
    min-width: 0;
}

.admin-device-split .browser-mockup iframe {
    height: 560px;
}

.admin-device-split .phone-showcase {
    flex-shrink: 0;
    margin: 0;
}

@media (max-width: 600px) {
    .admin-device-split {
        justify-content: center;
    }
}

/* Browser window chrome for desktop embeds */
.browser-mockup {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.browser-bar {
    background: var(--color-surface);
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.browser-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.browser-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}
.browser-dot.close    { background: #ff5f57; }
.browser-dot.minimize { background: #febc2e; }
.browser-dot.maximize { background: #28c840; }

.browser-url {
    flex: 1;
    max-width: 340px;
    margin: 0 auto;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    font-size: 11.5px;
    color: var(--color-text-muted);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.1px;
    white-space: nowrap;
    overflow: hidden;
}

.browser-mockup iframe {
    width: 100%;
    height: 640px;
    border: none;
    display: block;
}

.case-caption {
    font-size: 0.82em;
    color: var(--color-text-muted);
    text-align: center;
    margin: -0.5em 0 1.5em;
    font-style: italic;
}

@media (max-width: 600px) {
    .phone-mockup {
        width: 240px;
    }
    .phone-screen {
        height: 500px;
    }
    /* scale = (240 - 8) / 390 = 232/390 ≈ 0.595 */
    .phone-demo {
        transform: scale(0.595);
    }
    .status-bar {
        height: 22px;
        padding: 0 21px 0 26px;
    }
    .status-time {
        font-size: 10px;
    }
    .status-icons {
        gap: 3px;
    }
    .status-icons svg {
        transform: scale(0.8);
        transform-origin: center;
    }
}

/* ── Technical collapsible ──────────────────────────────── */
.tech-details {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin: 0;
}

.tech-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9em 1.15em;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    list-style: none;
    user-select: none;
    gap: 1em;
}

.tech-details summary::-webkit-details-marker { display: none; }

.tech-details summary::after {
    content: '+';
    font-size: 1.4em;
    font-weight: 300;
    flex-shrink: 0;
    line-height: 1;
}

.tech-details[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.tech-details[open] summary::after {
    content: '−';
}

.tech-details-body {
    padding: 0.25em 1.15em 1.25em;
}
