/* =====================================================================
   coursematter — legal pages (Views/Policy/*, layout Views/Shared/_CmxDocLayout)
   Loaded after co-home.css and uses its tokens, top bar and footer.
   Everything is scoped under .cmx-doc.

   The idea: the fine print, set like a well-made book. A quiet hero with a
   big serif section mark, an "at a glance" card, then a reading column
   with a sticky index that tracks where you are. No loud motion — the only
   moving thing is the thin progress line under the top bar.
   ===================================================================== */

.cmx-doc { min-height: 100vh; }

/* reading progress, pinned above everything */
.cmx-doc-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1040; pointer-events: none; }
.cmx-doc-progress span {
    display: block; height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--violet), #b58cff 60%, var(--gold));
    transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- hero ---------- */
.cmx-doc-hero { position: relative; padding: 56px 0 72px; overflow: hidden; }
.cmx-doc-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(79,48,224,.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(79,48,224,.06) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(ellipse 50% 80% at 78% 40%, #000 25%, transparent 75%);
    mask-image: radial-gradient(ellipse 50% 80% at 78% 40%, #000 25%, transparent 75%);
}
.cmx-doc-mark {
    position: absolute; right: 38%; top: -70px; z-index: 0;
    font: 400 460px/1 var(--serif); color: rgba(109,74,255,.07);
    pointer-events: none; user-select: none;
}
.cmx-doc-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 64px; align-items: center; }

.cmx-doc-switch {
    display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px;
    background: rgba(255,255,255,.7); border: 1px solid var(--line);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.cmx-doc-switch a {
    padding: 8px 16px; border-radius: 999px; text-decoration: none !important;
    font-size: 14.5px; font-weight: 600; color: var(--muted) !important; transition: color .2s ease, background-color .2s ease;
}
.cmx-doc-switch a:hover { color: var(--ink) !important; }
.cmx-doc-switch a.is-current { background: var(--ink); color: #fff !important; }

.cmx-doc-hero h1 {
    margin-top: 28px !important;
    font-size: clamp(48px, 7vw, 96px); line-height: .92; font-weight: 700; letter-spacing: -0.045em; text-wrap: balance;
}
.cmx-doc-hero h1 em {
    font-family: var(--serif); font-style: normal; font-weight: 400; letter-spacing: -0.01em;
    color: var(--violet-ink);
}
.cmx-doc-lede { margin-top: 22px !important; font-size: 19px; max-width: 30em; }

.cmx-doc-meta { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cmx-doc-meta li {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.8); border: 1px solid var(--line);
    font-size: 14.5px; color: var(--ink-2);
}
.cmx-doc-meta li[hidden] { display: none; }
.cmx-doc-meta i { color: var(--violet); }
.cmx-doc-meta strong { color: var(--ink); font-weight: 600; }

/* at a glance */
.cmx-doc-glance {
    --notch: 30px;
    position: relative; padding: 30px 30px 24px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 40px 80px -48px rgba(28,22,70,.35);
}
.cmx-doc-glance-title { font-family: var(--serif) !important; font-size: 30px; color: var(--ink) !important; line-height: 1; }
.cmx-doc-glance ul { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 4px; }
.cmx-doc-glance a {
    display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: center;
    padding: 10px 10px 10px 8px; margin: 0 -8px; border-radius: 14px;
    text-decoration: none !important; color: var(--ink-2) !important; font-size: 15.5px; line-height: 1.4;
    transition: background-color .2s ease;
}
.cmx-doc-glance a:hover { background: var(--wash); }
.cmx-doc-glance strong { color: var(--ink); }
.cmx-doc-glance-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; }
.cmx-doc-glance-icon.is-violet { background: var(--violet-soft); color: var(--violet-ink); }
.cmx-doc-glance-icon.is-gold { background: #fdf1d6; color: #a86d00; }
.cmx-doc-glance-icon.is-mint { background: #dcf3ec; color: #0b7a5e; }
.cmx-doc-glance-icon.is-live { background: #fde3e6; color: #c9283a; }
.cmx-doc-glance-note { margin-top: 14px !important; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted) !important; }

/* ---------- body: index + reading column ---------- */
.cmx-doc-body {
    display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 72px; align-items: start;
    padding-top: 8px; padding-bottom: 120px;
}

.cmx-doc-toc { position: sticky; top: 96px; }
.cmx-doc-toc[hidden] { display: none; }
.cmx-doc-toc details { border-radius: var(--r-md); }
.cmx-doc-toc summary {
    list-style: none; display: flex; align-items: center; gap: 10px; cursor: default;
    font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
    padding-bottom: 14px; margin-bottom: 10px; border-bottom: 1px solid var(--line);
}
.cmx-doc-toc summary::-webkit-details-marker { display: none; }
.cmx-doc-toc summary .bi { display: none; }
.cmx-doc-toc-pct { margin-left: auto; font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--violet-ink); }
.cmx-doc-toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.cmx-doc-toc a {
    position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: baseline;
    padding: 8px 10px 8px 14px; border-radius: 10px;
    text-decoration: none !important; font-size: 15px; line-height: 1.35; color: var(--muted) !important;
    transition: color .2s ease, background-color .2s ease;
}
.cmx-doc-toc a::before {
    content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px;
    background: var(--line); transition: background-color .2s ease;
}
.cmx-doc-toc a:hover { color: var(--ink) !important; background: rgba(255,255,255,.7); }
.cmx-doc-toc-n { font: 400 17px/1 var(--serif); color: inherit; }
.cmx-doc-toc a.is-read { color: var(--ink-2) !important; }
.cmx-doc-toc a.is-read::before { background: #c9bdfd; }
.cmx-doc-toc a.is-current { color: var(--ink) !important; background: #fff; font-weight: 600; box-shadow: 0 10px 24px -18px rgba(28,22,70,.5); }
.cmx-doc-toc a.is-current::before { background: var(--violet); }
.cmx-doc-toc a.is-current .cmx-doc-toc-n { color: var(--violet-ink); }

/* the document itself */
.cmx-doc-article {
    max-width: 780px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 56px 64px 44px;
    box-shadow: 0 50px 90px -70px rgba(28,22,70,.45);
}
.cmx-doc-article p, .cmx-doc-article li { font-size: 17px; line-height: 1.7; color: var(--ink-2); }
.cmx-doc-article p + p { margin-top: 14px !important; }
.cmx-doc-article strong { color: var(--ink); font-weight: 600; }
.cmx-doc-article a { color: var(--violet-ink) !important; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.cmx-doc-article a.cmx-btn { text-decoration: none; }

.cmx-doc-intro { padding-bottom: 36px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.cmx-doc-intro p:first-child { font-size: 20px; line-height: 1.6; color: var(--ink); }

.cmx-doc-sec { padding: 40px 0 8px; scroll-margin-top: 96px; }
.cmx-doc-sec + .cmx-doc-sec { border-top: 1px solid var(--line); margin-top: 32px; }
.cmx-doc-sec h2 {
    display: flex; align-items: baseline; gap: 16px;
    font-size: clamp(24px, 2.4vw, 30px); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em;
    margin-bottom: 18px !important;
}
.cmx-doc-num {
    flex: none; min-width: 44px;
    font: 400 44px/.8 var(--serif); letter-spacing: -0.02em; color: var(--violet);
}
.cmx-doc-sec h3 {
    display: flex; align-items: center; gap: 10px;
    margin: 28px 0 10px !important;
    font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.cmx-doc-sec h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* lists: a small notched marker, the wordmark's cut */
.cmx-doc-article ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.cmx-doc-article ul li { position: relative; padding-left: 26px; }
.cmx-doc-article ul li::before {
    content: ""; position: absolute; left: 4px; top: .66em; width: 9px; height: 9px;
    background: var(--violet);
    clip-path: polygon(0 0, 55% 0, 100% 45%, 100% 100%, 0 100%);
}
.cmx-doc-article ul ul { margin-top: 8px; padding: 12px 16px; border-radius: 14px; background: var(--wash); }
.cmx-doc-article ul ul li::before { background: #b9a8ff; width: 7px; height: 7px; }
.cmx-doc-article ul ul li { font-size: 16px; }
.cmx-doc-article em { font-style: italic; color: var(--ink); }

/* four short items read better as tiles */
.cmx-doc-article ul.cmx-doc-grid-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.cmx-doc-article ul.cmx-doc-grid-list li {
    padding: 14px 16px 14px 40px; border: 1px solid var(--line); border-radius: 14px; background: #fcfcfe; line-height: 1.45;
}
.cmx-doc-article ul.cmx-doc-grid-list li::before { left: 18px; top: 1.3em; }

.cmx-doc-callout {
    display: flex; align-items: center; gap: 14px;
    margin: 6px 0 18px !important; padding: 16px 18px; border-radius: 16px;
    background: var(--violet-soft); color: var(--ink) !important; font-size: 17.5px !important;
}
.cmx-doc-callout i { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--violet-ink); font-size: 17px; }
.cmx-doc-callout.is-warn { background: #fff5dc; margin-top: 18px !important; }
.cmx-doc-callout.is-warn i { color: #a86d00; }

.cmx-doc-contact {
    --notch: 26px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    padding: 28px 30px; border-radius: 22px; margin-top: 6px;
    background-color: var(--night); color: #fff;
    background-image: radial-gradient(ellipse 60% 90% at 100% 0%, rgba(236,220,255,.35), transparent 70%), linear-gradient(125deg, #5b3fc4 0%, #7a58d6 45%, #9370db 100%);
}
.cmx-doc-contact p { color: rgba(255,255,255,.78) !important; font-size: 16px !important; line-height: 1.6 !important; }
.cmx-doc-contact p + p { margin-top: 2px !important; }
.cmx-doc-contact a:not(.cmx-btn) { color: #fff !important; }
.cmx-doc-contact-name { font-family: var(--serif); font-size: 28px !important; line-height: 1.1 !important; color: #fff !important; margin-bottom: 8px !important; }
.cmx-doc-contact .cmx-btn { color: #fff !important; }

.cmx-doc-copy { margin-top: 40px !important; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px !important; color: var(--muted) !important; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1100px) {
    .cmx-doc-body { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
    .cmx-doc-article { padding: 44px 44px 36px; }
}

@media (max-width: 960px) {
    .cmx-doc-hero { padding: 36px 0 40px; }
    .cmx-doc-hero-grid { grid-template-columns: 1fr; gap: 32px; }
    .cmx-doc-mark { right: -40px; top: -40px; font-size: 300px; }

    .cmx-doc-body { grid-template-columns: 1fr; gap: 16px; padding-bottom: 72px; }

    /* the index folds into a bar that sticks under the top bar */
    .cmx-doc-toc { top: 64px; z-index: 5; }
    .cmx-doc-toc details {
        background: rgba(255,255,255,.92); border: 1px solid var(--line);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        box-shadow: 0 16px 30px -24px rgba(28,22,70,.45);
    }
    .cmx-doc-toc summary { cursor: pointer; padding: 14px 16px; margin: 0; border-bottom: 0; }
    .cmx-doc-toc summary .bi { display: inline-block; transition: transform .2s ease; }
    .cmx-doc-toc details[open] summary { border-bottom: 1px solid var(--line); }
    .cmx-doc-toc details[open] summary .bi { transform: rotate(180deg); }
    .cmx-doc-toc ol { padding: 8px; max-height: 55vh; overflow: auto; }
    .cmx-doc-toc-pct { margin-left: auto; }
}

@media (max-width: 640px) {
    .cmx-doc-hero h1 { font-size: clamp(44px, 13vw, 60px); }
    .cmx-doc-lede { font-size: 17px; }
    .cmx-doc-switch a { padding: 7px 12px; font-size: 13.5px; }
    .cmx-doc-glance { padding: 24px 20px 18px; }

    /* the reading column goes edge to edge */
    .cmx-doc-body { padding-left: 0; padding-right: 0; }
    .cmx-doc-toc { margin: 0 12px; }
    .cmx-doc-article { border-radius: 0; border-left: 0; border-right: 0; padding: 32px 20px 28px; box-shadow: none; }
    .cmx-doc-intro p:first-child { font-size: 18px; }
    .cmx-doc-sec h2 { gap: 12px; }
    .cmx-doc-num { min-width: 34px; font-size: 36px; }
    .cmx-doc-article ul.cmx-doc-grid-list { grid-template-columns: 1fr; }
    .cmx-doc-contact { padding: 24px 22px; }
    .cmx-doc-contact .cmx-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .cmx-doc *, .cmx-doc *::before { transition: none !important; }
}

@media print {
    .cmx-bar, .cmx-foot, .cmx-doc-toc, .cmx-doc-progress, .cmx-doc-glance, .cmx-doc-switch, .cmx-doc-mark { display: none !important; }
    .cmx-doc, .cmx-doc-hero { background: #fff !important; }
    .cmx-doc-body { display: block; }
    .cmx-doc-article { border: 0; box-shadow: none; padding: 0; max-width: none; }
}
