* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Light Mode Defaults */

:root {
    color-scheme: light dark;

    --black: #555555;
    --white: #ffffff;

    --page-background: #ffffff;
    --surface-background: #f7f7f7;
    --footer-background: #f4f4f4;

    --ink: #171717;
    --text: #252525;
    --muted: #626262;
    --line: #dedede;

    --link: #424245;
    --footer-muted: #6e6e73;
    --footer-divider: #86868b;

    --todo-background: #fff4c2;
    --active-background: rgba(0, 0, 0, 0.04);

    --error: #8a1f11;

    --body-font: 'Fira Sans', sans-serif;
    --title-font: 'League Spartan', sans-serif;
}

/* Dark Mode */

@media (prefers-color-scheme: dark) {
    :root {
        --black: #f2f2f2;
        --white: #111111;

        --page-background: #111111;
        --surface-background: #1a1a1a;
        --footer-background: #1a1a1a;

        --ink: #f5f5f5;
        --text: #e5e5e5;
        --muted: #b5b5b5;
        --line: #333333;

        --link: #d8d8d8;
        --footer-muted: #b5b5b5;
        --footer-divider: #666666;

        --todo-background: #4a3f12;
        --active-background: rgba(255, 255, 255, 0.08);

        --error: #ffb4a8;
    }
}

/* Base */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 64px;
}

body {
    min-height: 100vh;
    background-color: var(--page-background);
    color: var(--ink);
    font-family: var(--body-font);
    line-height: 1.42;
}

img {
    user-select: none;
    -webkit-user-drag: none;
}

a {
    color: inherit;
}

.title-font {
    font-family: var(--title-font);
    font-weight: 700;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    height: 48px;
    padding: 0 18px;

    display: flex;
    align-items: center;

    background: #111111;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: #ffffff;
    text-decoration: none;
    line-height: 1;
}

.brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;

    filter: none;

    user-select: none;
    -webkit-user-drag: none;
}

.brand span {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Logo Colors */

.site-header .brand img {
    filter: none;
}

.footer-logo {
    flex: 0 0 auto;
    margin-left: auto;
}

.footer-logo img {
    filter: brightness(0) saturate(100%);
}

@media (prefers-color-scheme: dark) {
    .footer-logo img {
        filter: brightness(0) invert(1);
    }
}

/* Hero */

.legal-hero {
    border-bottom: 1px solid var(--line);
    padding: 14px 32px 16px;
    background: var(--surface-background);
}

.legal-hero > div {
    max-width: 1250px;
    margin: 0 auto;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.legal-hero h1 {
    color: var(--black);
    font-size: clamp(1.45rem, 3vw, 2.3rem);
    line-height: 1;
    margin-bottom: 5px;
    text-align: left;
}

.legal-hero p:last-child {
    max-width: 920px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.32;
}

/* Layout */

.legal-layout {
    display: grid;
    grid-template-columns: 225px minmax(0, 940px);
    gap: 26px;
    max-width: 1250px;
    margin: 0 auto;
    padding: 12px 32px 36px;
    align-items: start;
    background-color: var(--page-background);
}

/* Table of Contents */

.legal-toc {
    position: sticky;
    top: 62px;
    max-height: calc(100vh - 74px);
    overflow: auto;
    border-right: 1px solid var(--line);
    padding-right: 12px;
}

.toc-title {
    color: var(--black);
    font-weight: 700;
    font-size: 0.82rem;
    margin-bottom: 5px;
}

.legal-toc a {
    display: block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.78rem;
    line-height: 1.15;
    border-left: 3px solid transparent;
    padding: 3px 0 3px 7px;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background-color 0.15s ease;
}

.legal-toc a:hover {
    color: var(--black);
    text-decoration: underline;
}

.legal-toc a.active {
    color: var(--black);
    font-weight: 700;
    border-left-color: var(--black);
    background-color: var(--active-background);
}

/* Legal Document */

.legal-document {
    min-width: 0;
}

.legal-document h2 {
    color: var(--black);
    font-size: 1.2rem;
    line-height: 1.12;
    margin: 20px 0 6px;
    padding-top: 3px;
    scroll-margin-top: 64px;
}

.legal-document h2:first-of-type {
    margin-top: 0;
}

.legal-document h3 {
    color: var(--black);
    font-size: 1rem;
    line-height: 1.18;
    margin: 14px 0 5px;
}

.legal-document p,
.legal-document li {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.36;
}

.legal-document p {
    margin: 0 0 6px;
}

/* Compact Lists */

.legal-document ul,
.legal-document ol {
    margin: 0 0 7px 18px;
    padding-left: 0;
}

.legal-document li {
    margin-bottom: 2px;
    padding-left: 1px;
}

.legal-document li:last-child {
    margin-bottom: 0;
}

.legal-document li p {
    margin-bottom: 4px;
}

/* Nested Lists */

.legal-document li ul,
.legal-document li ol {
    margin-top: 3px;
    margin-bottom: 3px;
    margin-left: 13px;
}

.legal-document ul + p,
.legal-document ol + p {
    margin-top: 4px;
}

.legal-document hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 14px 0;
}

.legal-document strong {
    font-weight: 700;
}

.placeholder,
.todo {
    background: var(--todo-background);
    border-radius: 4px;
    padding: 1px 3px;
}

/* Footer */

.site-footer {
    background-color: var(--footer-background);
    color: var(--ink);
}

.footer-main {
    background-color: var(--footer-background);
    color: var(--black);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 32px;
    max-height: 64px;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    line-height: 1.25;
}

.footer-contact a {
    color: var(--link);
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-logo img {
    height: 62px;
    width: auto;
}

/* Apple-style Legal Footer */

.footer-bottom {
    background-color: var(--footer-background);
    color: var(--footer-muted);
    display: block;
    padding: 9px 32px 10px;
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.25;
    text-align: left;
}

.footer-bottom span {
    display: block;
    color: var(--footer-muted);
    margin-bottom: 3px;
}

.footer-bottom a {
    display: inline;
    color: var(--link);
    text-decoration: none;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

.footer-bottom a:not(:last-child)::after {
    content: "|";
    color: var(--footer-divider);
    margin: 0 6px;
    text-decoration: none;
}

/* Loading and Error */

.legal-loading,
.legal-error {
    max-width: 940px;
    margin: 18px auto 36px;
    padding: 0 32px;
}

.legal-error {
    color: var(--error);
}

/* Tablet */

@media (max-width: 900px) {
    .site-header,
    .legal-hero,
    .legal-layout,
    .footer-main,
    .footer-bottom {
        padding-left: 18px;
        padding-right: 18px;
    }

    .legal-hero {
        padding-top: 12px;
        padding-bottom: 13px;
    }

    .legal-layout {
        display: block;
        padding-top: 12px;
        padding-bottom: 30px;
    }

    .legal-toc {
        position: static;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 0 0 9px;
        margin-bottom: 12px;
    }

    .legal-toc a {
        display: inline-block;
        margin-right: 7px;
        margin-bottom: 3px;
        padding: 3px 0 3px 7px;
    }

    .footer-main {
        min-height: auto;
        max-height: none;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    .footer-logo img {
        height: 56px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .site-header {
        height: 44px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .brand {
        gap: 7px;
    }

    .brand img {
        width: 30px;
        height: 30px;
    }

    .brand span {
        font-size: 1rem;
    }

    html {
        scroll-padding-top: 58px;
    }

    .legal-document h2 {
        scroll-margin-top: 58px;
    }
}

@media (max-width: 520px) {
    body {
        line-height: 1.35;
    }

    .legal-hero,
    .legal-layout,
    .footer-main,
    .footer-bottom {
        padding-left: 14px;
        padding-right: 14px;
    }

    .legal-hero {
        padding-top: 10px;
        padding-bottom: 12px;
    }

    .eyebrow {
        font-size: 0.64rem;
        margin-bottom: 2px;
    }

    .legal-hero h1 {
        font-size: 1.35rem;
        margin-bottom: 4px;
    }

    .legal-hero p:last-child {
        font-size: 0.82rem;
        line-height: 1.28;
    }

    .legal-layout {
        padding-top: 10px;
        padding-bottom: 26px;
    }

    .toc-title {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .legal-toc {
        padding-bottom: 8px;
        margin-bottom: 10px;
    }

    .legal-toc a {
        font-size: 0.76rem;
        line-height: 1.12;
        padding-top: 2px;
        padding-bottom: 2px;
        margin-right: 6px;
        margin-bottom: 2px;
    }

    .legal-document h2 {
        font-size: 1.08rem;
        margin: 17px 0 5px;
    }

    .legal-document h3 {
        font-size: 0.96rem;
        margin: 12px 0 4px;
    }

    .legal-document p,
    .legal-document li {
        font-size: 0.86rem;
        line-height: 1.32;
    }

    .legal-document p {
        margin-bottom: 5px;
    }

    .legal-document ul,
    .legal-document ol {
        margin: 0 0 6px 16px;
    }

    .legal-document li {
        margin-bottom: 1px;
        padding-left: 0;
    }

    .legal-document li ul,
    .legal-document li ol {
        margin-top: 2px;
        margin-bottom: 2px;
        margin-left: 12px;
    }

    .footer-main {
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .footer-contact {
        font-size: 0.78rem;
    }

    .footer-logo img {
        height: 48px;
    }

    .footer-bottom {
        padding-top: 8px;
        padding-bottom: 9px;
        font-size: 0.72rem;
        line-height: 1.22;
    }

    .footer-bottom a {
        display: inline;
    }

    .footer-bottom a:not(:last-child)::after {
        margin: 0 5px;
    }
}

/* Print */

@media print {
    :root {
        --page-background: #ffffff;
        --surface-background: #ffffff;
        --footer-background: #ffffff;

        --ink: #000000;
        --text: #000000;
        --black: #000000;
        --muted: #000000;
        --line: #cccccc;
    }

    body {
        background: #ffffff;
        color: #000000;
        line-height: 1.25;
    }

    .site-header,
    .legal-toc,
    .site-footer {
        display: none;
    }

    .legal-hero,
    .legal-layout {
        padding: 0;
        background: #ffffff;
        color: #000000;
        border: 0;
    }

    .legal-layout {
        display: block;
    }

    .legal-document h2 {
        margin: 14px 0 4px;
        font-size: 1.05rem;
        scroll-margin-top: 0;
    }

    .legal-document h3 {
        margin: 10px 0 3px;
        font-size: 0.95rem;
    }

    .legal-document p,
    .legal-document li {
        font-size: 0.82rem;
        line-height: 1.25;
    }

    .legal-document p {
        margin-bottom: 4px;
    }

    .legal-document ul,
    .legal-document ol {
        margin: 0 0 5px 16px;
    }

    .legal-document li {
        margin-bottom: 1px;
    }
}