/* Explain: Styles for share buttons, QR code, and overlay. */
/* ---------- Share buttons & share sheet ---------- */

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1rem;
    padding: 0.5rem 1.1rem;
    min-height: 44px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.share-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(201, 162, 39, 0.08);
}

.share-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.tl-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.tl-actions .tl-more,
.tl-actions .share-btn {
    margin-top: 0;
}

.tl-list-link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    color: inherit;
    text-decoration: none;
}

/* ---------- Book chapter share button ---------- */
.book-listen-wrap {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.book-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.7rem 1.45rem;
    min-height: 44px;
    border-radius: 9999px;
    border: 1px solid var(--paper-border);
    background: rgba(120, 95, 45, 0.08);
    color: var(--ink-muted);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.book-share-btn:hover {
    background: rgba(120, 95, 45, 0.18);
    border-color: #8a6d14;
    color: #8a6d14;
    transform: translateY(-2px);
}

.book-share-btn:focus-visible {
    outline: 2px solid #8a6d14;
    outline-offset: 3px;
}

/* ---------- Share sheet ---------- */
.share-overlay {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(4, 4, 5, 0.88);
    backdrop-filter: blur(6px);
}

.share-overlay[hidden] {
    display: none !important;
}

.share-sheet {
    width: 100%;
    max-width: 26rem;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem 1.35rem;
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.share-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.share-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.share-close {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.share-close:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.share-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.share-sub {
    margin-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 0.65rem;
    margin-top: 1.1rem;
}

.share-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 0.6rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: var(--surface-2);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.share-target:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.share-target:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.share-target .fa-brands,
.share-target .fa-solid {
    font-size: 1.25rem;
}

.share-target-label {
    line-height: 1.35;
    text-align: center;
}

.share-status {
    margin-top: 1rem;
    min-height: 1.3rem;
    color: var(--secondary-color);
    font-size: 0.88rem;
    text-align: center;
}

/* ---------- QR code ---------- */
.share-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: var(--surface-2);
}

.share-qr[hidden] {
    display: none;
}

.share-qr.is-loading .share-qr-img {
    opacity: 0;
}

.share-qr-img {
    width: 13rem;
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    background: #ffffff;
    padding: 0.5rem;
    transition: opacity 0.25s ease;
}

.share-qr-url {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ---------- Standalone share area ---------- */
.share-area-grid {
    display: grid;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .share-area-grid {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 3rem;
    }
}

/* ---------- Prominent share panel ---------- */
.share-promo {
    position: relative;
    overflow: hidden;
    max-width: 60rem;
    margin-inline: auto;
    padding: 2rem 1.35rem;
    border: 2px solid var(--primary-color);
    border-radius: 1.5rem;
    background:
        radial-gradient(circle at 12% 0%, rgba(201, 162, 39, 0.2), transparent 55%),
        radial-gradient(circle at 92% 100%, rgba(46, 196, 182, 0.14), transparent 55%),
        linear-gradient(180deg, var(--surface-color), var(--surface-2));
    box-shadow: 0 26px 60px rgba(96, 74, 28, 0.18);
}

@media (min-width: 768px) {
    .share-promo {
        padding: 2.75rem 2.5rem;
    }
}

.share-promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--primary-color), #e6c552);
    color: #12100a;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    box-shadow: 0 12px 28px rgba(201, 162, 39, 0.35);
}

.share-promo .share-area-grid {
    align-items: center;
}

.share-promo .share-qr {
    border: 2px solid var(--gold-line);
    box-shadow: var(--shadow-soft);
}

.share-promo .share-qr-img {
    width: 15rem;
}

.share-promo .share-target {
    border-width: 1px;
    background: var(--surface-color);
}

@media (prefers-reduced-motion: reduce) {
    .share-btn,
    .share-target,
    .book-share-btn {
        transition: none;
        transform: none;
    }

    .share-qr-img {
        transition: none;
    }
}

/* ---------- Printable QR card ---------- */
.share-print-title,
.share-print-caption {
    display: none;
}

.share-print-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
}

.share-print-caption {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

@media print {
    html.printing-share,
    html.printing-share body {
        background: #ffffff !important;
    }

    html.printing-share .site-header,
    html.printing-share .site-footer,
    html.printing-share .a11y-widget,
    html.printing-share .robi-widget,
    html.printing-share main > section:not(#share-area) {
        display: none !important;
    }

    html.printing-share #share-area {
        padding-block: 0;
        background: none;
    }

    html.printing-share #share-area .container-museum {
        max-width: none;
        padding-inline: 0;
    }

    html.printing-share #share-area > .container-museum > .text-center,
    html.printing-share #shareAreaText {
        display: none !important;
    }

    html.printing-share .share-area-grid {
        display: block;
        margin-top: 0;
    }

    html.printing-share #shareAreaQrCard {
        max-width: 22rem;
        margin: 1.5rem auto 0;
        border-width: 2px;
        box-shadow: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    html.printing-share #shareAreaQrCard,
    html.printing-share #share-area .reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    html.printing-share .share-qr-img {
        width: 16rem;
        opacity: 1 !important;
    }

    html.printing-share .share-print-title,
    html.printing-share .share-print-caption {
        display: block;
    }
}