/* DiveLog — chrome for the home hero "Share" action: the button itself and
 * the preview modal.
 *
 * The modal extends the shared dialog primitives in common/css/dl-modal.css
 * rather than standing up a second overlay implementation: .dl-modal,
 * .dl-modal-card, .dl-modal-title and .dl-modal-actions all come from there,
 * so THAT FILE MUST BE LINKED FIRST.
 *
 * This is app chrome, not the export — every colour is a theme token. The
 * card itself is drawn on a canvas with a hardcoded palette; see
 * common/js/dl-share-stats.js for why.
 */

/* Wider than the 420px confirm/alert card so the 1200:630 preview has
   room to breathe. */
.dl-modal-card--sharestats {
    width: min(760px, 94vw);
}

.dl-sharestats-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.dl-sharestats-head .dl-modal-title {
    margin: 0;
}

.dl-sharestats-close {
    font-size: var(--font-size-lg);
    line-height: 1;
}

/* Fixed aspect box so the modal never changes height between the loading,
   ready and error states — the layout must not jump under the pointer. */
.dl-sharestats-stage {
    aspect-ratio: 1200 / 630;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
}

.dl-sharestats-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.dl-sharestats-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.dl-sharestats-status p {
    margin: 0;
}

.dl-sharestats-err {
    color: var(--err);
}

.dl-sharestats-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: var(--radius-pill);
    animation: dl-sharestats-spin 800ms linear infinite;
}

@keyframes dl-sharestats-spin {
    to { transform: rotate(360deg); }
}

/* Mirrors the reduce blocks in dl.css: the ring stays as a static
   progress hint rather than spinning. */
@media (prefers-reduced-motion: reduce) {
    .dl-sharestats-spinner { animation: none; }
}

/* Bottom sheet on phones — near-full width, anchored to the bottom edge,
   primary action nearest the thumb. */
@media (max-width: 640px) {
    .dl-sharestats { align-items: flex-end; }

    .dl-modal-card--sharestats {
        width: 100%;
        max-width: 100%;
        margin-top: auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .dl-modal-card--sharestats .dl-modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}
