/* ============================================================================
   LEGAL — Direction A consolidated policies page
   ============================================================================
   Single page with sidebar nav + hash routing across 5 documents:
   Privacy Policy, Terms of Service, HIPAA Notice, Shipping & Returns, Refunds.

   Namespace: `ps-legal-*`
   Reuses .ps-page / .ps-eyebrow / .ps-nav / .ps-footer.
   ============================================================================ */

/* ────────────────────────────────────────────────────────────────────────────
   HERO
   ──────────────────────────────────────────────────────────────────────────── */
.ps-legal-hero {
    background: var(--ps-bg);
    padding: 96px 24px 48px;
    border-bottom: 1px solid var(--ps-line);
}
.ps-legal-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
}
.ps-legal-hero-title {
    font-family: var(--ps-font-display);
    font-weight: 400;
    font-size: clamp(48px, 7vw, 72px);
    line-height: 1.02;
    letter-spacing: -2px;
    color: var(--ps-ink);
    margin: 20px 0 16px;
}
.ps-legal-hero-effective {
    font-size: 14px;
    font-style: italic;
    color: var(--ps-ink-muted);
    margin: 0;
}

/* ────────────────────────────────────────────────────────────────────────────
   SHELL — 2-column grid (sidebar + doc viewer)
   ──────────────────────────────────────────────────────────────────────────── */
.ps-legal-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 96px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 64px;
    align-items: start;
}

/* ────────────────────────────────────────────────────────────────────────────
   SIDEBAR
   ──────────────────────────────────────────────────────────────────────────── */
.ps-legal-sidebar {
    position: sticky;
    top: 96px;
    align-self: start;
}
.ps-legal-sidebar-inner {
    display: flex;
    flex-direction: column;
}
.ps-legal-sidebar-eyebrow {
    font-family: var(--ps-font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--ps-ink-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 18px;
}
.ps-legal-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}
.ps-legal-nav li {
    margin: 0;
}
.ps-legal-nav a {
    display: block;
    text-align: left;
    padding: 12px 16px;
    min-height: 44px;
    font-family: var(--ps-font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--ps-ink-muted);
    text-decoration: none;
    background: transparent;
    border-left: 2px solid var(--ps-line);
    transition: color var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}
.ps-legal-nav a:hover {
    color: var(--ps-ink);
    background: rgba(15, 30, 28, 0.03);
}
.ps-legal-nav a:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: 2px;
}
.ps-legal-nav a[aria-current="page"] {
    color: var(--ps-ink);
    border-left-color: var(--ps-teal);
    font-weight: 600;
    background: rgba(14, 93, 89, 0.04);
}

/* ── Paper-copy info card ── */
.ps-legal-paper-card {
    margin-top: 32px;
    padding: 20px;
    background: var(--ps-card);
    border: 1px solid var(--ps-line);
    border-radius: 12px;
}
.ps-legal-paper-eyebrow {
    font-size: 11px;
    font-weight: 600;
    color: var(--ps-teal);
    text-transform: uppercase;
    letter-spacing: 1.3px;
    margin: 0 0 8px;
}
.ps-legal-paper-body {
    font-size: 13px;
    color: var(--ps-ink-muted);
    line-height: 1.5;
    margin: 0;
}
.ps-legal-paper-body a {
    color: var(--ps-ink);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
.ps-legal-paper-body a:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: 2px;
}

/* ────────────────────────────────────────────────────────────────────────────
   DOC VIEWER
   ──────────────────────────────────────────────────────────────────────────── */
.ps-legal-doc {
    max-width: 720px;
    color: var(--ps-ink);
}

/* Override global `p { color: --color-text-secondary }` cascade from base.css —
   fails 4.5:1 contrast on the legal page's cream surface. Inherit from
   .ps-legal-doc above (which uses --ps-ink, passing comfortably). */
.ps-legal-doc p {
    color: inherit;
}

.ps-legal-doc-head {
    padding: 0 0 24px;
    border-bottom: 1px solid var(--ps-line);
    margin-bottom: 32px;
}
.ps-legal-doc-eyebrow {
    margin-bottom: 14px;
}
.ps-legal-doc-title {
    font-family: var(--ps-font-display);
    font-weight: 400;
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1.05;
    letter-spacing: -1.5px;
    color: var(--ps-ink);
    margin: 14px 0 12px;
}
.ps-legal-doc-effective {
    font-size: 13px;
    font-style: italic;
    color: var(--ps-ink-muted);
    margin: 0;
}

/* ── HIPAA highlight box (regulation-required all-caps callout) ── */
.ps-legal-highlight {
    background: var(--ps-cream);
    border-left: 4px solid var(--ps-accent);
    padding: 20px 24px;
    border-radius: 8px;
    margin-bottom: 28px;
    color: var(--ps-ink);
}
.ps-legal-highlight p {
    font-family: var(--ps-font-body);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
    letter-spacing: 0.3px;
    margin: 0;
    text-transform: uppercase;
}

/* ── Intro lede ── */
.ps-legal-intro {
    font-size: 16px;
    line-height: 1.7;
    color: var(--ps-ink-muted);
    margin: 0 0 32px;
}

/* ── Section + subsection ── */
.ps-legal-section {
    margin-bottom: 32px;
}
.ps-legal-section.is-sub {
    margin-bottom: 20px;
}
.ps-legal-section h2 {
    font-family: var(--ps-font-display);
    font-weight: 400;
    font-size: 28px;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--ps-ink);
    margin: 0 0 14px;
}
.ps-legal-section h3 {
    font-family: var(--ps-font-body);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.1px;
    line-height: 1.35;
    color: var(--ps-ink);
    margin: 0 0 10px;
}

/* ── Body text ── */
.ps-legal-section p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ps-ink-muted);
    margin: 0 0 16px;
}
.ps-legal-section ul {
    margin: 0 0 16px;
    padding-left: 22px;
    list-style: disc;
}
.ps-legal-section li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ps-ink-muted);
    margin-bottom: 6px;
}

/* ── Inline links inside the doc viewer ── */
.ps-legal-section a,
.ps-legal-intro a {
    color: var(--ps-teal);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.ps-legal-section a:hover,
.ps-legal-intro a:hover {
    color: var(--ps-teal-deep);
}
.ps-legal-section a:focus-visible,
.ps-legal-intro a:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: 2px;
}

/* ── Doc footer card ── */
.ps-legal-doc-footer {
    margin-top: 64px;
    padding: 24px 28px;
    background: var(--ps-cream);
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ps-ink-muted);
}
.ps-legal-doc-footer a {
    color: var(--ps-teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
.ps-legal-doc-footer a:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: 2px;
}

/* ────────────────────────────────────────────────────────────────────────────
   RESPONSIVE — collapse to single column on mobile, sidebar becomes a
   horizontal scroll strip pinned beneath the main nav.
   ──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .ps-legal-hero {
        padding: 64px 20px 32px;
    }

    .ps-legal-shell {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px 20px 64px;
    }

    .ps-legal-sidebar {
        position: sticky;
        top: 64px;
        z-index: var(--z-sticky);
        margin: 0 -20px;
        padding: 0;
        background: var(--ps-bg);
        border-bottom: 1px solid var(--ps-line);
        /* Contain horizontal overflow from the nav chip strip below so it
           doesn't expand document scrollWidth past the viewport. The inner
           <ul> still scrolls horizontally via overflow-x: auto. */
        overflow: hidden;
    }

    .ps-legal-sidebar-inner {
        padding: 12px 20px 8px;
    }

    .ps-legal-sidebar-eyebrow {
        margin-bottom: 8px;
    }

    .ps-legal-nav ul {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 4px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        margin: 0 -20px;
        padding: 0 20px 8px;
    }

    .ps-legal-nav li {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .ps-legal-nav a {
        white-space: nowrap;
        padding: 10px 14px;
        border-left: none;
        border-bottom: 2px solid var(--ps-line);
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .ps-legal-nav a[aria-current="page"] {
        border-left: none;
        border-bottom-color: var(--ps-teal);
        background: transparent;
    }

    .ps-legal-paper-card {
        margin-top: 16px;
        margin-bottom: 8px;
    }

    .ps-legal-doc {
        max-width: 100%;
    }

    .ps-legal-section h2 {
        font-size: 24px;
    }

    .ps-legal-section h3 {
        font-size: 17px;
    }

    .ps-legal-doc-footer {
        margin-top: 48px;
        padding: 20px 22px;
    }
}

/* ────────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ──────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ps-legal-nav a,
    .ps-legal-nav ul {
        transition: none;
        scroll-behavior: auto;
    }
    html {
        scroll-behavior: auto;
    }
}
