/* ============================================================
   DEVICE SWITCHER — iPhone / iPhone Duo / iPad on every app visual
   The chosen device is set on <html data-device="…"> by js/devices.js.
   Every visual sits in a box of fixed size (the iPhone's height), so
   switching device never moves the rest of the page.
   ============================================================ */

:root {
    --device-box-w: 480px;
    --device-box-h: 600px;
}

/* --- Switcher (segmented control above each visual) --- */
.device-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin: 0 auto 18px;
    border-radius: 50px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.device-switch button {
    font: 600 0.82rem/1 var(--font-stack);
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: 50px;
    padding: 9px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.device-switch button:hover { color: var(--text-primary); }
.device-switch button[aria-pressed="true"] { background: var(--primary); color: var(--white); }
.device-switch button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* On the hero gradient: translucent glass version */
.hero .device-switch {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}
.hero .device-switch button { color: rgba(255, 255, 255, 0.92); }
.hero .device-switch button[aria-pressed="true"] { background: var(--white); color: var(--primary); }

/* --- Stage: switcher, fixed box, badge --- */
.device-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* The box never changes size; the device is centred inside it. */
.device-box {
    width: var(--device-box-w);
    max-width: 100%;
    height: var(--device-box-h);
    display: grid;
    place-items: center;
}
/* Tab screens of a feature row share the box. */
.device-box > .fm-screen { grid-area: 1 / 1; }

.hero-mockup { flex: 0 0 var(--device-box-w); }

/* --- "Made for iPhone Duo" badge --- */
.duo-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 12px;
    border-radius: 12px;
    background: #111114;
    color: #fff;
    text-decoration: none;
    line-height: 1.1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.duo-badge svg { width: 30px; height: 22px; flex: none; }
.duo-badge small { display: block; font-size: 0.66rem; font-weight: 500; opacity: 0.8; letter-spacing: 0.02em; }
.duo-badge strong { display: block; font-size: 0.98rem; font-weight: 700; }

.hero-duo { margin-top: 18px; }
/* Under each visual: its place is always kept, it only fades in for the Duo. */
.device-stage .duo-badge { margin-top: 16px; transform: scale(0.92); transition: opacity 0.25s ease; }
html:not([data-device="duo"]) .device-stage .duo-badge { opacity: 0; visibility: hidden; }
/* The hero already shows the badge beside the platforms. */
.hero .device-stage .duo-badge { display: none; }

/* --- Frames (sizes derived from the fixed box) --- */
.device-box .phone-frame { transition: opacity 0.18s ease; }
.device-box.is-swapping .phone-frame { opacity: 0; }

/* iPhone: as before, the box height is its own */
html[data-device="iphone"] .device-box .phone-frame,
html:not([data-device]) .device-box .phone-frame { width: calc(var(--device-box-h) * 0.47); }

/* iPad: portrait, thin even bezel, no Dynamic Island */
html[data-device="ipad"] .device-box .phone-frame {
    width: calc(var(--device-box-h) * 0.71);
    border-radius: 28px;
    border-width: 10px;
}
html[data-device="ipad"] .device-box .phone-frame::before { display: none; }
html[data-device="ipad"] .device-box .phone-mockup-img img { border-radius: 18px; }

/* iPhone Duo: unfolded, landscape, two panes and a hinge in the middle */
html[data-device="duo"] .device-box .phone-frame {
    width: var(--device-box-w);
    max-width: 100%;
    border-radius: 26px;
    border-width: 10px;
}
html[data-device="duo"] .device-box .phone-frame::before {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 10px;
    height: auto;
    border-radius: 0;
    transform: translateX(-50%);
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.10) 45%, rgba(255, 255, 255, 0.22) 55%, rgba(0, 0, 0, 0));
    pointer-events: none;
}
html[data-device="duo"] .device-box .phone-mockup-img img { border-radius: 17px; }

@media (max-width: 1100px) {
    :root { --device-box-w: 440px; --device-box-h: 560px; }
}

@media (max-width: 600px) {
    :root { --device-box-w: min(400px, 90vw); --device-box-h: min(520px, 117vw); }
    .device-switch button { padding: 8px 11px; font-size: 0.78rem; }
    html[data-device="duo"] .device-box .phone-frame { border-width: 7px; border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .device-box .phone-frame, .device-switch button, .device-stage .duo-badge { transition: none; }
}
