/*
 * Legal notice page: the hero of the game page, then the table of contents, sticky beside the sections on wide screens
 * and above them on phones. Sections are numbered in Roman numerals, like the articles of the rules page.
 */
.legal-page {
    --legal-width: 72rem;
}

/* A longer title than the game page, hence a smaller size. */
.legal-hero__title {
    font-size: clamp(2.5rem, 7vw, 6rem);
    text-wrap: balance;
}

.legal {
    display: grid;
    grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
    align-items: start;
    gap: clamp(2rem, 5vw, 4rem);
    max-width: var(--legal-width);
    /* Leaves room below the name engraved at the bottom of the hero. */
    margin: clamp(2rem, 5vw, 3.5rem) auto 0;
    padding: 0 var(--home-gutter) var(--home-section-space);
    counter-reset: legal-section;
}

/* Table of contents */
.legal-contents {
    position: sticky;
    top: var(--space-l);
    display: grid;
    gap: var(--space-m);
    padding: var(--space-l);
    border: 1px solid var(--home-line);
    border-radius: var(--home-radius-inner);
    background-color: var(--home-surface);
}

.legal-contents__title {
    margin: 0;
    color: var(--home-gold);
    font-family: var(--font-family-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.legal-contents__list {
    display: grid;
    gap: var(--space-s);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: legal-contents;
}

.legal-contents__list li {
    display: grid;
    grid-template-columns: 2.25rem 1fr;
    counter-increment: legal-contents;
}

.legal-contents__list li::before {
    content: counter(legal-contents, upper-roman) '.';
    color: var(--home-gold);
    font-family: var(--font-family-display);
    font-size: 0.875rem;
    line-height: 1.6;
}

.legal-contents__list a {
    color: var(--home-text);
    text-decoration: none;
}

.legal-contents__list a:hover {
    color: var(--home-gold);
    text-decoration: underline;
    text-decoration-color: var(--home-gold);
}

.legal-contents__updated {
    margin: 0;
    padding-top: var(--space-m);
    border-top: 1px dashed var(--home-line);
    color: var(--home-text-muted);
    font-size: 0.9375rem;
    font-style: italic;
}

/* Sections */
.legal__sections {
    display: grid;
    gap: clamp(2.5rem, 6vw, 4rem);
    min-width: 0;
}

.legal-section {
    display: grid;
    gap: var(--space-m);
    max-width: 48rem;
    font-size: clamp(1.0625rem, 1.3vw, 1.1875rem);
    line-height: 1.6;
    text-wrap: pretty;
    counter-increment: legal-section;
    scroll-margin-top: var(--space-l);
}

.legal-section p {
    margin: 0;
}

.legal-section a {
    color: var(--home-gold);
    text-decoration-color: currentColor;
}

.legal-section__title {
    display: grid;
    gap: var(--space-xs);
    margin: 0 0 var(--space-s);
    padding-bottom: var(--space-m);
    border-bottom: 1px solid var(--home-line);
    font-size: clamp(1.5rem, 3vw, 2.125rem);
    line-height: 1.15;
}

.legal-section__title::before {
    content: counter(legal-section, upper-roman) / '';
    color: var(--home-gold);
    font-family: var(--font-family-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
}

/* The disclaimer of affiliation, set apart so that it cannot be missed. */
.legal-section__notice {
    padding: var(--space-m) var(--space-l);
    border-left: 3px solid var(--home-gold);
    border-radius: 0 var(--home-radius-inner) var(--home-radius-inner) 0;
    background-color: var(--home-glass);
    font-style: italic;
}

.legal-section__external {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.legal-section__icon {
    width: 1em;
    height: 1em;
}

.legal-list {
    display: grid;
    gap: var(--space-s);
    margin: 0;
    padding-left: 1.5rem;
}

.legal-list li::marker {
    content: '✦  ';
    color: var(--home-gold);
    font-size: 0.75em;
}

/* Opt-out of the audience measurement: hidden until its Stimulus controller connects. */
.legal-opt-out {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    cursor: pointer;
}

.legal-opt-out[hidden] {
    display: none;
}

.legal-opt-out__box {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--home-gold);
}

/* Identity cards of the publisher and the host. */
.legal-card {
    display: grid;
    gap: var(--space-s);
    margin: 0;
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border: 1px solid var(--home-line);
    border-radius: var(--home-radius-inner);
    background:
        radial-gradient(ellipse 40% 60% at 0 0, var(--color-chrome-haze), transparent 70%),
        var(--home-surface);
}

.legal-card__name {
    font-family: var(--font-family-display);
    font-size: 1.25rem;
}

.legal-card__details {
    color: var(--home-text-muted);
    font-size: 0.9375rem;
}

.legal-card__list {
    display: grid;
    gap: var(--space-s);
    margin: var(--space-s) 0 0;
}

.legal-card__row {
    display: grid;
    grid-template-columns: minmax(8rem, 14rem) 1fr;
    gap: var(--space-m);
}

.legal-card__row dt {
    color: var(--home-text-muted);
    font-family: var(--font-family-ui);
    font-size: 0.875rem;
    line-height: 1.8;
}

.legal-card__row dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Below this width the table of contents moves above the sections and no longer follows the scroll. */
@media (max-width: 56rem) {
    .legal {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-contents {
        position: static;
    }
}

@media (max-width: 36rem) {
    .legal-card__row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
