/*
 * Share mode — the colourful, scannable cousin of the print sheet.
 *
 * Loaded ONLY on a share URL, on top of whatever stylesheet the page already uses. It never
 * touches the print rules: the same markup still prints exactly as it did, because everything
 * here is either screen-only or scoped to .share-mode. That is the point — share mode must not
 * become a second, drifting definition of the sheet.
 *
 * Colour comes from App\Support\Brand::cssVars(), written inline on the panel and on each
 * interlink card, so one stylesheet themes all three product lines.
 */

/* ── The page around the panel ─────────────────────────────────────────────── */

@media screen {
    /*
     * `body.zine-body` already sets a flat grey, and it out-specifies a lone class, so share mode
     * has to match on both or the tint silently loses. Same reason the width is restated here.
     */
    /*
     * grid.book.css pins `html, body { width: 6in; overflow: hidden }` to lock the BOOK's page
     * box, which is right for printing and wrong for a page someone opens on a phone: it clamps
     * the whole document to 576px and clips anything wider. Share mode releases it — screen only,
     * so the print box is untouched.
     */
    html.share-mode-root,
    html.share-mode-root body.share-mode {
        width: auto;
        overflow: visible;
    }

    body.share-mode {
        background:
            radial-gradient(circle at 12% 0%, var(--brand-100, #fee2e2) 0%, transparent 45%),
            radial-gradient(circle at 88% 8%, var(--brand-50, #fef2f2) 0%, transparent 40%),
            #ffffff;
        width: auto;
        min-width: 0;
        padding: 2rem 1rem;
    }

    /* The print instructions are noise to someone who just scanned a code on a phone. */
    .share-mode .prose.no-print,
    .share-mode .zine-nav {
        display: none;
    }

    /* Lift the printed sheet off the tinted ground so it reads as an object, not a background. */
    .share-mode .page {
        box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .10);
        border-radius: 10px;
    }
}

/* ── The panel ─────────────────────────────────────────────────────────────── */

.share-panel {
    max-width: 1000px;
    margin: 0 auto 2.5rem;
    padding: clamp(1.25rem, 4vw, 2.25rem);
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--brand-100, #fee2e2);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px rgba(15, 23, 42, .08);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #1b2330;
}

.share-panel-main {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1rem, 4vw, 2.5rem);
    align-items: center;
    justify-content: space-between;
}

.share-panel-text { flex: 1 1 320px; min-width: 260px; }

.share-panel-wordmark {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--brand-500, #ef4444);
}

.share-panel-title {
    margin: .35rem 0 0;
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    line-height: 1.1;
    letter-spacing: -.02em;
    font-weight: 800;
}

.share-panel-lead {
    margin: .6rem 0 0;
    font-size: clamp(1rem, 2.4vw, 1.15rem);
    line-height: 1.5;
    color: #4b5563;
    max-width: 46ch;
}

.share-panel-url {
    margin: 1rem 0 0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: .95rem;
    color: var(--brand-700, #b91c1c);
    word-break: break-all;
}

/* The code is the reason the page exists, so it is sized to be scanned across a table. */
.share-panel-qr {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem;
    background: #fff;
    border: 3px solid var(--brand-500, #ef4444);
    border-radius: 16px;
}

.share-panel-qr svg {
    display: block;
    width: clamp(180px, 42vw, 260px);
    height: auto;
}

.share-panel-scan {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--brand-600, #dc2626);
}

/* ── Interlinking ──────────────────────────────────────────────────────────── */

.share-panel-more {
    margin-top: clamp(1.25rem, 3vw, 2rem);
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.share-panel-more-label {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6b7280;
}

.share-panel-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .85rem;
    margin-top: .85rem;
}

/* Each card wears its OWN line's colour — that contrast is what makes the other
   products legible as separate things rather than more of the same page. */
.share-panel-link {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1.1rem;
    border-radius: 12px;
    text-decoration: none;
    color: #1b2330;
    background: var(--brand-50, #f8fafc);
    border: 2px solid var(--brand-200, #e5e7eb);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.share-panel-link:hover,
.share-panel-link:focus-visible {
    transform: translateY(-2px);
    border-color: var(--brand-500, #ef4444);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
}

.share-panel-link-glyph {
    font-size: 1.9rem;
    line-height: 1;
    color: var(--brand-500, #ef4444);
}

.share-panel-link-body { display: flex; flex-direction: column; }

.share-panel-link-name {
    font-weight: 750;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}

.share-panel-link-cta {
    font-size: .85rem;
    color: var(--brand-600, #dc2626);
    font-weight: 600;
}

/* ── Print ─────────────────────────────────────────────────────────────────── */

/*
 * Someone will print a share page. The sheet itself must come out exactly as the PDF does, so the
 * panel simply removes itself and takes its colour with it.
 */
@media print {
    .share-panel { display: none !important; }
    .share-mode  { background: #fff !important; }
    .share-mode .page { box-shadow: none !important; border-radius: 0 !important; }
}
