body {
    margin: 0;
    font-family: var(--font-sans);
}

/* Reading page (see DESIGN.md): the title sits in a full-width band ruled off
   from the text; the text column is capped for readable line lengths, and its
   sections are divided by hairline rules. */
.legal-hero {
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface-hover);
}

.legal-hero__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    max-width: 760px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.5rem;
}

.legal-wrapper {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

.legal-content {
    display: flex;
    flex-direction: column;
}

.legal-content > .legal-section {
    padding-block: 2rem;
}

.legal-content > .legal-section + .legal-section {
    border-top: 1px solid var(--color-border);
}

.legal-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legal-section.gap-small {
    gap: 0.5rem;
}

.legal-section.gap-large {
    gap: 1.5rem;
}

.legal-title {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    font-weight: 700;
    margin: 0;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--color-heading);
}

.legal-meta-text {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.legal-section-title {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    font-weight: 700;
    margin: 0;
    font-size: 1.375rem;
    line-height: 1.3;
    color: var(--color-heading);
}

.legal-subtitle {
    margin: 0.5rem 0 0;
    font-size: 1.0625rem;
    line-height: 1.4;
    color: var(--color-text);
}

.legal-text,
.legal-list-item {
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
}

.legal-list {
    margin: 0;
    padding-left: 1.25rem;
}

.legal-list-item::marker {
    color: var(--color-accent);
}

.legal-list-item + .legal-list-item {
    margin-top: 0.375rem;
}

.legal-list-item .legal-text {
    display: inline;
}

.legal-wrapper a {
    color: var(--color-accent);
    text-underline-offset: 2px;
}

.legal-wrapper a:hover {
    color: var(--color-accent-hover);
}

/* Collapsible data groups (<details>/<summary>), closed by default. Stacked
   with shared borders rather than as separate boxes. */
.legal-groups {
    display: flex;
    flex-direction: column;
}

.legal-group {
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
}

.legal-group + .legal-group {
    border-top: none;
}

.legal-group__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--color-accent);
    transition: background-color 0.15s ease-in-out;
}

.legal-group__summary::-webkit-details-marker {
    display: none;
}

.legal-group__summary:hover {
    background-color: var(--color-surface-hover);
}

.legal-group__summary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Chevron arrow: points down when closed, flips up when open */
.legal-group__summary::after {
    content: "";
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: -0.25rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease-in-out, margin-top 0.2s ease-in-out;
}

.legal-group[open] > .legal-group__summary::after {
    margin-top: 0.25rem;
    transform: rotate(-135deg);
}

.legal-group[open] > .legal-group__summary {
    border-bottom: 1px solid var(--color-border);
}

.legal-group__body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
}

.legal-wrapper a,
.legal-wrapper code {
    overflow-wrap: anywhere;
}

.legal-wrapper code {
    padding: 0.05rem 0.3rem;
    background-color: var(--color-surface-muted);
    font-size: 0.9em;
}

/* Rendered Markdown (data-disclosure/content/*.md) has no classes, so style
   plain elements to match the legal-* classes above. */
.legal-prose > * {
    margin: 0;
}

.legal-prose h2 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    font-weight: 700;
    font-size: 1.375rem;
    line-height: 1.3;
    color: var(--color-heading);
}

.legal-prose h3 {
    margin-top: 0.75rem;
    font-size: 1.0625rem;
    line-height: 1.4;
    color: var(--color-text);
}

.legal-prose p,
.legal-prose li {
    font-size: 1rem;
    line-height: 1.65;
}

.legal-prose ul,
.legal-prose ol {
    padding-left: 1.25rem;
}

.legal-prose li::marker {
    color: var(--color-accent);
}

.legal-prose li + li {
    margin-top: 0.375rem;
}

.legal-prose blockquote {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--color-accent);
    background-color: var(--color-surface-hover);
    font-style: italic;
}

.legal-prose blockquote p {
    margin: 0;
}

/* Citation lists: any list whose items start with a .legal-ref-tag gets a
   hanging indent and no bullets */
.legal-prose ul:has(.legal-ref-tag) {
    padding-left: 0;
    list-style: none;
}

.legal-prose ul:has(.legal-ref-tag) li {
    padding-left: 1.5rem;
    text-indent: -1.5rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.legal-prose ul:has(.legal-ref-tag) li + li {
    margin-top: 0.625rem;
}

.legal-ref-tag {
    display: inline-block;
    margin-right: 0.375rem;
    padding: 0 0.4rem;
    background-color: var(--color-tag-bg);
    color: var(--color-tag-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-indent: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

@media (max-width: 600px) {
    .legal-hero__inner {
        padding: 2rem 1rem 1.25rem;
    }

    .legal-wrapper {
        padding-inline: 1rem;
    }

    .legal-title {
        font-size: 1.625rem;
    }
}
