/* The legal pages: long-form reading under the kit's banner (PageHero). The frame is wide enough for the banner; the text
   itself keeps a narrow measure and generous leading on a card of its own, with the other documents in a quiet column
   beside it that drops under the text on a narrow screen. Same tokens as the rest of the app. */

.legal {
    max-width: 68rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.legal__stamp { font-variant-numeric: tabular-nums; }

.legal__layout {
    display: grid;
    grid-template-columns: minmax(0, 46rem) minmax(13rem, 17rem);
    justify-content: center;
    align-items: start;
    gap: 1.25rem;
}

.legal__body {
    min-width: 0;
    margin: 0;
    padding: 1.6rem 2rem 1.9rem;
    font-size: 0.97rem;
    line-height: 1.65;
}

.legal__body > :first-child { margin-top: 0; }
.legal__body > :last-child { margin-bottom: 0; }
.legal__body h2 { margin: 2rem 0 0.5rem; font-size: 1.2rem; }
.legal__body p, .legal__body li { color: var(--rl-text); }
.legal__body ul { padding-left: 1.25rem; }
.legal__body li { margin: 0.3rem 0; }

.legal__table {
    width: 100%;
    margin: 0.75rem 0 1rem;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.5;
}

.legal__table th, .legal__table td {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--rl-border);
    vertical-align: top;
    text-align: left;
}

.legal__table thead th { background: var(--rl-surface-raised); font-weight: 600; }
.legal__table tbody th { font-weight: 600; background: var(--rl-surface-raised); white-space: nowrap; }
.legal__table code { font-size: 0.85em; overflow-wrap: anywhere; }

/* The other documents: a small card in the kit's language that stays in view while the text scrolls. */
.legal__more {
    position: sticky;
    top: 1rem;
    padding: 0.9rem 0.85rem 0.8rem;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    background: var(--rl-surface);
    box-shadow: inset 0 2px 0 color-mix(in srgb, var(--rl-accent) 75%, transparent), var(--rl-shadow-sm);
}

.legal__more h2 {
    margin: 0 0 0.5rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--rl-text-muted);
}

.legal__more ul { display: flex; flex-direction: column; gap: 0.1rem; margin: 0; padding: 0; list-style: none; }

.legal__more a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.45rem;
    border-radius: 10px;
    color: var(--rl-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background var(--rl-dur) var(--rl-ease);
}

.legal__more a:hover { background: var(--rl-surface-sunken); color: var(--rl-text); }
.legal__more a:focus-visible { outline: 2px solid var(--rl-accent); outline-offset: 1px; }

/* The index: the four documents as kit tiles, each with its whole summary rather than two clamped lines. */
.legal__cards { margin: 0; }
.legal__blurb { -webkit-line-clamp: 4; line-clamp: 4; }
.legal--index .ui-tile__title { font-size: 1.02rem; }
.legal--index .ui-tile__foot { justify-content: space-between; }

/* Small print at the foot of the sidebar. */
.side__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: auto;
    padding: 0.75rem 0.9rem 0.9rem;
    border-top: 1px solid var(--rl-border);
    font-size: 0.8rem;
}

.side__legal a { color: var(--rl-text-muted); text-decoration: none; }
.side__legal a:hover { color: var(--rl-text); text-decoration: underline; }

:root[data-sidebar="collapsed"] .side__legal { display: none; }

/* The register page's agreement line. */
.consent { margin: 0 0 1rem; font-size: 0.9rem; }
.consent .form-check { display: flex; align-items: flex-start; gap: 0.5rem; padding-left: 0; }
.consent .form-check-input { float: none; margin: 0.2rem 0 0; flex: none; }

@media (max-width: 64rem) {
    .legal__layout { grid-template-columns: minmax(0, 1fr); }
    .legal__more { position: static; }
    .legal__more ul { flex-direction: row; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
}

@media (max-width: 640px) {
    .legal { padding: 1rem 1rem 2.5rem; }
    .legal__body { padding: 1.1rem 1.1rem 1.4rem; }
    .legal__table th, .legal__table td { padding: 0.45rem 0.5rem; }
    .legal__table tbody th { white-space: normal; }
}

/* On paper the banner is just the title and its date in black, and the text runs the full width. */
@media print {
    .legal { max-width: none; padding: 0; }
    .legal__more { display: none; }
    .legal__layout { display: block; }
    .legal__body { padding: 0; border: 0; box-shadow: none; }
    .legal__hero { margin: 0 0 1rem; border: 0; box-shadow: none; color: #000; }
    .legal__hero .hero__art, .legal__hero .hero__icon, .legal__hero .hero__crumb { display: none; }
    .legal__hero .hero__body { padding: 0; }
    .legal__hero .hero__title, .legal__hero .hero__lede { color: #000; text-shadow: none; }
    .legal__hero .hero__chip { padding: 0; border: 0; background: none; color: #000; backdrop-filter: none; }
}
