/**
 * Licence restriction consent dialog.
 *
 * Global, not checkout-scoped. The dialog is raised from anywhere the shopper
 * can start a purchase - including the Buy Now button on a song page, which
 * never loads checkout.css. These rules originally lived there, so the dialog
 * rendered completely unstyled everywhere except the checkout page.
 *
 * Paired with js/license-consent.js; both are enqueued site-wide.
 */


.tfp-consent-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
}

.tfp-consent-dialog {
    width: min(560px, 100%);
    max-height: min(80vh, 720px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 16px;
    background: var(--md-sys-color-surface, #fffbfe);
    color: var(--md-sys-color-on-surface, #1c1b1f);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.tfp-consent-dialog h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    line-height: 1.3;
}

.tfp-consent-region {
    margin: 0 0 16px;
    font-size: 0.88rem;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-consent-item {
    padding: 12px 0;
    border-top: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
}

.tfp-consent-item-title {
    margin: 0 0 6px;
    font-weight: 600;
    font-size: 0.98rem;
}

.tfp-consent-item ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tfp-consent-item li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.88rem;
    line-height: 1.4;
}

.tfp-consent-item li md-icon {
    --md-icon-size: 17px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.tfp-consent-item .is-missing {
    color: var(--md-sys-color-error, #b3261e);
}

.tfp-consent-item .is-included {
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-consent-agree {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0 6px;
    padding: 12px;
    border-radius: 10px;
    background: var(--md-sys-color-surface-container-low, #f7f2fa);
    font-size: 0.92rem;
    line-height: 1.45;
    cursor: pointer;
}

.tfp-consent-agree input {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    flex: 0 0 auto;
    cursor: pointer;
}

.tfp-consent-refund {
    margin: 0 0 16px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .tfp-consent-dialog {
        padding: 18px;
        max-height: 88vh;
    }

    .tfp-consent-actions {
        flex-direction: column-reverse;
    }

    .tfp-consent-actions md-filled-button,
    .tfp-consent-actions md-text-button {
        width: 100%;
    }
}

/* ==========================================================================
   Song page: "Licensing & availability" trigger + dialog

   The trigger sits under the song title. Green/verified when everything is
   available to this visitor, red/warning when anything is not - so the state
   is readable without opening anything, and the detail is one tap away.
   ========================================================================== */

/* .hero-title keeps margin-bottom: 24px for pages where the subtitle follows
   it directly. That margin does not collapse with this control, so a negative
   margin-top here only nibble a few pixels of a 24px gap - and the excerpt
   <p> inside .hero-subtitle adds another ~1em that the link's margin-bottom
   cannot cancel. Pull those neighbours in so this element's own margins win. */
.hero-title:has(+ .song-licensing-link) {
    margin-bottom: 4px;
}

.hero-text:has(> .song-licensing-link) .hero-subtitle > :first-child {
    margin-top: 0;
}

.song-licensing-link {
    /* Block-level flex so vertical margins apply; fit-content so it stays
       a short text link instead of stretching the full hero column. */
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    cursor: pointer;
}

@media (max-width: 768px) {
    /* .hero-content is text-align:center on small screens; inline-flex used
       to pick that up for free. A block-level flex needs the auto sides. */
    .song-licensing-link {
        margin-left: auto;
        margin-right: auto;
    }
}

.song-licensing-link md-icon {
    --md-icon-size: 16px;
    flex: 0 0 auto;
}

.song-licensing-link.is-clear {
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.song-licensing-link.is-restricted {
    color: var(--md-sys-color-error, #b3261e);
}

.song-licensing-link:hover,
.song-licensing-link:focus-visible {
    text-decoration-thickness: 2px;
}

.song-licensing-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 2px;
}

.tfp-licensing-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
}

.tfp-licensing-backdrop[hidden] {
    display: none;
}

.tfp-licensing-dialog {
    width: min(560px, 100%);
    max-height: min(82vh, 760px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 16px;
    background: var(--md-sys-color-surface, #fffbfe);
    color: var(--md-sys-color-on-surface, #1c1b1f);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    text-align: left;
}

.tfp-licensing-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--md-sys-color-on-surface, #1c1b1f);
}

.tfp-licensing-head.is-restricted {
    color: var(--md-sys-color-error, #b3261e);
}

.tfp-licensing-head md-icon {
    --md-icon-size: 26px;
    flex: 0 0 auto;
}

.tfp-licensing-head h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    color: inherit;
}

.tfp-licensing-region {
    margin: 0 0 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-licensing-section {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
}

.tfp-licensing-section h3 {
    margin: 0 0 10px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-licensing-parts {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tfp-licensing-parts li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.tfp-licensing-parts li md-icon {
    --md-icon-size: 18px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.tfp-licensing-parts li.is-available md-icon {
    color: #1a7f37;
}

.tfp-licensing-parts li.is-restricted md-icon {
    color: var(--md-sys-color-error, #b3261e);
}

.tfp-licensing-parts li.is-restricted span {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-licensing-message {
    margin: 12px 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 500;
    color: var(--md-sys-color-error, #b3261e);
}

.tfp-licensing-allgood {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.tfp-licensing-grants {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tfp-licensing-grants li {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
    border-radius: 10px;
    background: var(--md-sys-color-surface-container-low, #f7f2fa);
}

.grant-publisher {
    font-weight: 600;
    font-size: 0.95rem;
}

.grant-detail {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.grant-label {
    font-weight: 600;
    margin-right: 4px;
}

.tfp-licensing-empty {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-licensing-note {
    margin: 16px 0 0;
    font-size: 0.79rem;
    line-height: 1.45;
    color: var(--md-sys-color-on-surface-variant, #5f6368);
}

.tfp-licensing-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

@media (max-width: 600px) {
    .tfp-licensing-dialog {
        padding: 18px;
        max-height: 88vh;
    }

    .tfp-licensing-actions md-filled-button {
        width: 100%;
    }
}
