/* ============================================================================
   design-share-view.css — the device stage for a Delphos Design share link.

   ── Why this is additive rather than a whole stylesheet ──
   The viewer's chrome (top bar, mode badge, file list, editor, notices, passcode
   gate, footer) is the same surface as the Code share viewer, so it reuses
   code-share-view.css's `.csv-*` verbatim and the root element keeps the `csv`
   class. Only ONE thing genuinely differs: a design is reviewed AT A DEVICE SIZE,
   so the preview pane is a stage holding a fixed-size frame rather than a frame
   that fills the pane. That is what this file adds, and nothing else.

   ── The layout rule that matters ──
   `.dsv-frame` is sized to the device's real CSS pixel dimensions and then
   visually scaled with a transform. It is NOT sized to the available space. A
   media query inside the design must see the width it was written for, or a phone
   layout resolves as a desktop one — which is the exact thing the reviewer opened
   the link to check.
   ========================================================================== */

/* ── the toolbar above the stage ─────────────────────────────────────────── */
.dsv .dsv-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px;
    background: var(--csv-raised);
    border-bottom: 1px solid var(--csv-line);
}

.dsv .dsv-screen {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--csv-muted);
}
.dsv .dsv-screen .material-symbols-rounded { font-size: 16px; color: var(--csv-faint); }
.dsv .dsv-screen select {
    max-width: 34ch;
    height: 28px;
    padding: 0 8px;
    color: var(--csv-text);
    background: var(--csv-control);
    border: 1px solid var(--csv-line);
    border-radius: 8px;
    font-family: var(--csv-mono);
    font-size: 11.5px;
    cursor: pointer;
    outline: none;
}
.dsv .dsv-screen select:focus-visible { border-color: var(--csv-ring); }
.dsv .dsv-screen-static {
    font-family: var(--csv-mono);
    font-size: 11.5px;
    color: var(--csv-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 34ch;
}

/* ── device pills ────────────────────────────────────────────────────────── */
.dsv .dsv-devices {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: none;
    padding: 3px;
    border-radius: 999px;
    background: var(--csv-control);
    border: 1px solid var(--csv-line);
}
.dsv .dsv-device {
    width: 30px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--csv-muted);
    transition: color .13s var(--csv-ease), background-color .13s var(--csv-ease);
}
.dsv .dsv-device:hover { color: var(--csv-text); }
.dsv .dsv-device.is-on { color: var(--csv-accent); background: var(--csv-soft); }
.dsv .dsv-device .material-symbols-rounded { font-size: 17px; }

/* The measured size is diagnostic text, so it is monospaced and quiet — but it is
   always present, because "is this the mobile layout?" must never be a guess. */
.dsv .dsv-size {
    flex: none;
    font-family: var(--csv-mono);
    font-size: 10.5px;
    color: var(--csv-faint);
    white-space: nowrap;
}

/* ── the stage ───────────────────────────────────────────────────────────── */
.dsv .dsv-stage {
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: auto;
    /* A neutral checkered ground, so a design with a transparent or white
       background still reads as an object sitting ON something rather than as the
       page itself. */
    background-color: #171615;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .022) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .022) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, .022) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .022) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 11px 11px;
}

.dsv .dsv-frame {
    /* top left, not center: fitStage() compensates for the scale with negative
       right/bottom margins so the layout box matches the visual box, and that
       arithmetic only holds if shrinking happens toward one fixed corner. */
    transform-origin: top left;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .42), 0 0 0 1px var(--csv-line);
    /* Scale changes are animated so switching device does not feel like a reload,
       but the transform itself is set inline by fitStage(). */
    transition: transform .18s var(--csv-ease);
}
/* Beats code-share-view.css's `.csv-pane iframe { flex: 1; width: 100% }`, which
   is correct for a code project filling its pane and wrong for a fixed device
   viewport. The exact pixel width and height are written inline by fitStage() from
   the device table, so they are not restated here. */
.dsv .dsv-frame iframe {
    display: block;
    flex: none;
    border: 0;
    background: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .dsv .dsv-frame { transition: none; }
}

/* ── narrow windows ─────────────────────────────────────────────────────────
   On a phone the toolbar cannot hold a screen selector, ten device pills, a theme
   toggle and a readout. The device pills and the size readout are what a reviewer
   is actually there for, so the screen path — which is also visible in the file
   list — is what gives way. */
@media (max-width: 780px) {
    .dsv .dsv-bar { height: auto; flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
    .dsv .dsv-screen select, .dsv .dsv-screen-static { max-width: 18ch; }
    .dsv .dsv-stage { padding: 14px; }
}
