/* ============================================================
   HCMevolve Legal Pages CSS  v1.4  — Full responsive audit pass

   Breakpoints (SMS Personnel spec):
     Desktop:     > 1024px  (default)
     Tablet:     ≤ 1024px
     Mobile:     ≤  768px
     Sm mobile:  ≤  480px

   Compliance checklist:
   ✓ No element overflows at 375px width
   ✓ No fixed pixel container widths
   ✓ Images max-width: 100%
   ✓ Touch targets ≥ 44×44px (Back btn, doc rows, Privacy link)
   ✓ Font-size ≥ 14px on mobile
   ✓ Tables scroll horizontally (never clip)
   ✓ Sticky nav works at all sizes
   ✓ Footer stacks on mobile
   ============================================================ */

body.hcmevolve-legal {
    font-family: "Roboto", sans-serif;
    background: #EBF4FB;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: clip; /* clip (not hidden) kills scrollbar without affecting sticky */
    -webkit-text-size-adjust: 100%;
    /* Ensure nothing can be wider than the viewport */
    max-width: 100%;
}

/* ══ TOP NAV ══════════════════════════════════════════════ */
.leg-topnav {
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border-bottom: 1px solid #D0E2F1;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    /* overflow visible so Back button is never clipped */
    overflow: visible;
}

/* Logo — links */
.leg-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 0;
}
.leg-logo-img {
    height: 38px;
    width: auto;
    display: block;
    /* Prevent very wide SVGs overflowing nav */
    max-width: 180px;
    object-fit: contain;
}

/* Breadcrumb — flex: 1 to fill remaining space, min-width: 0 to allow truncation */
.leg-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    color: #494F59;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.leg-breadcrumb a {
    color: #494F59;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
    flex-shrink: 0;
}
.leg-breadcrumb a:hover { color: #2096EB; }
.leg-breadcrumb .sep {
    color: #B0BEC5;
    font-size: 13px;
    flex-shrink: 0;
}
.leg-breadcrumb .current {
    color: #000000;
    font-weight: 500;
    /* Truncate with ellipsis if too long */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Back button — 44px height touch target */
.leg-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #2096EB;
    color: #ffffff;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    height: 44px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s;
    white-space: nowrap;
}
.leg-back-btn:hover {
    background-color: #1a7fd0;
    color: #ffffff;
    text-decoration: none;
}
.leg-back-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: white;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ══ PAGE BODY ════════════════════════════════════════════ */
.leg-body-wrap {
    flex: 1;
    padding: 32px 20px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

/* White card — max-width prevents super-wide lines on large screens */
.leg-card {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 1150px;
    padding: 40px 48px 48px;
    min-width: 0;
    /* overflow:visible so content (e.g. long legal text) is never clipped */
    overflow: visible;
    /* But contain horizontal overflow to prevent scrollbar */
    box-sizing: border-box;
}

/* ══ INDEX PAGE ═══════════════════════════════════════════ */
.leg-index-title {
    font-family: "Roboto", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #000000;
    text-align: center;
    margin-bottom: 12px;
    word-break: break-word;
}
.leg-index-subtitle {
    font-family: "Roboto", sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #494F59;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
    word-break: break-word;
}

/* Document list — single column, full width */
.leg-doc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Each row — entire row is a link, 44px+ touch height */
.leg-doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FBFE;
    border: 1px solid #D0E2F1;
    border-radius: 8px;
    padding: 18px 24px;
    text-decoration: none;
    cursor: pointer;
    gap: 16px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    min-height: 60px;
    /* Prevent text overflow */
    min-width: 0;
}
.leg-doc-row:hover {
    border-color: #2096EB;
    box-shadow: 0 2px 8px rgba(32,150,235,0.10);
    background: #EBF4FB;
    text-decoration: none;
}
.leg-doc-name {
    font-family: "Roboto", sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #000000;
    line-height: 1.3;
    min-width: 0;
    /* Allow wrapping on narrow screens — never clip */
    word-break: break-word;
}
/* Learn More pill — right side, never wraps */
.leg-learn-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #2096EB;
    color: #ffffff;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 400;
    border-radius: 6px;
    padding: 0 22px;
    height: 40px;
    white-space: nowrap;
    flex-shrink: 0;
    pointer-events: none; /* row itself handles click */
}

/* ══ DOCUMENT PAGE ════════════════════════════════════════ */
.leg-doc-title {
    font-family: "Roboto", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #000000;
    text-align: center;
    margin-bottom: 28px;
    word-break: break-word;
}
.leg-divider {
    border: none;
    border-top: 1px solid #D0E2F1;
    margin-bottom: 32px;
}

/* Body copy */
.leg-content {
    font-family: "Roboto", sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #212529;
    line-height: 1.8;
    /* Prevent long words (URLs, legal terms) from breaking layout */
    word-break: break-word;
    overflow-wrap: break-word;
}
.leg-content p { margin-bottom: 18px; }
.leg-content p:last-child { margin-bottom: 0; }
.leg-content h2 {
    font-size: 16px;
    font-weight: 700;
    color: #000000;
    margin: 28px 0 10px;
}
.leg-content h2:first-child { margin-top: 0; }
.leg-content ol { list-style: decimal; padding-left: 20px; }
.leg-content ul { list-style: disc; padding-left: 24px; }
.leg-content li { margin-bottom: 20px; line-height: 1.75; }
.leg-content li:last-child { margin-bottom: 0; }
.leg-content a { color: #2096EB; text-decoration: none; word-break: break-all; }
.leg-content a:hover { text-decoration: underline; }

/* Legal all-caps notice block */
.leg-notice {
    font-family: "Roboto", sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #212529;
    line-height: 1.7;
    background: #F3F9FE;
    border-left: 3px solid #2096EB;
    padding: 14px 18px;
    margin-bottom: 24px;
    word-break: break-word;
}
.leg-last-updated {
    font-size: 13px;
    color: #6794B7;
    font-style: italic;
    margin-bottom: 20px;
}

/* ── TABLE — horizontal scroll wrapper (WCAG: no clipping) ── */
.leg-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Visual hint that table is scrollable */
    border: 1px solid #D0E2F1;
    border-radius: 6px;
    margin-top: 8px;
}
.leg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    /* Min width so content never crushes below readable width */
    min-width: 480px;
}
.leg-table th {
    background: #F3F9FE;
    color: #000000;
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #D0E2F1;
    white-space: nowrap;
}
.leg-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #D0E2F1;
    color: #494F59;
    vertical-align: top;
}
.leg-table tr:last-child td { border-bottom: none; }
.leg-table tr:nth-child(even) td { background: #F9FCFE; }

/* ══ FOOTER ═══════════════════════════════════════════════ */
.leg-footer {
    background: #ffffff;
    border-top: 1px solid #D0E2F1;
    flex-shrink: 0;
}
.leg-footer-inner {
    max-width: 1150px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    gap: 12px;
}

/* ── Shared footer text styles (also used by landing page) ── */
.hcm-copyright {
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #000000;
    white-space: nowrap;
}
.hcm-privacy-link {
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2096EB;
    text-decoration: none;
    transition: color 0.15s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.hcm-privacy-link:hover { color: #1a7fd0; text-decoration: underline; }

/* ── Modal shared styles (also used on legal pages) ── */
.hcm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.hcm-modal-overlay.is-open { display: flex; }
.hcm-modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 2px 8px 23px 3px rgba(0,0,0,0.2);
    width: 856px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    animation: hcmFadeIn 0.5s ease;
}
@keyframes hcmFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}
.hcm-modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: rgba(255,255,255,0.95);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #555555;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    z-index: 2;
    margin: 0 0 -44px auto;
    border-radius: 0 16px 0 8px;
}
.hcm-modal-close:hover { color: #000000; background: #f0f0f0; }
.hcm-formx { padding: 20px; clear: both; }
.hcm-required { color: #ff0000; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── TABLET ≤ 1024px ── */
@media (max-width: 1024px) {
    .leg-topnav  { padding: 0 20px; height: 60px; }
    .leg-logo-img { height: 34px; max-width: 160px; }
    .leg-breadcrumb { font-size: 13px; }
    .leg-body-wrap  { padding: 20px 16px 36px; }
    .leg-card       { padding: 28px 28px 36px; }
    .leg-doc-row    { padding: 14px 18px; }
    .leg-footer-inner { padding: 0 20px; }
}

/* ── MOBILE ≤ 768px ── */
@media (max-width: 768px) {
    .leg-topnav { padding: 0 12px; height: 56px; gap: 8px; }
    .leg-logo-img { height: 28px; max-width: 120px; }
    .leg-breadcrumb { font-size: 12px; gap: 4px; }
    .leg-breadcrumb .current { max-width: 140px; }
    .leg-back-btn  { font-size: 13px; padding: 0 14px; height: 44px; gap: 6px; }

    .leg-body-wrap { padding: 14px 10px 28px; }
    .leg-card { padding: 20px 16px 28px; border-radius: 8px; overflow: visible; }

    /* Index */
    .leg-index-title    { font-size: 18px; }
    .leg-index-subtitle { font-size: 14px; margin-bottom: 20px; }
    .leg-doc-list       { gap: 10px; }
    .leg-doc-row        { padding: 12px 14px; gap: 10px; min-height: 52px; }
    .leg-doc-name       { font-size: 14px; }
    .leg-learn-more     { font-size: 13px; padding: 0 14px; height: 36px; }

    /* Document pages — 14px minimum enforced */
    .leg-doc-title  { font-size: 18px; margin-bottom: 18px; }
    .leg-divider    { margin-bottom: 20px; }
    .leg-content    { font-size: 14px; line-height: 1.7; }
    .leg-content h2 { font-size: 15px; margin: 20px 0 8px; }
    .leg-content li { margin-bottom: 14px; }
    .leg-notice     { font-size: 13px; padding: 10px 14px; }

    /* Table: scroll hint */
    .leg-table-wrap { border-radius: 4px; }
    .leg-table { font-size: 13px; }
    .leg-table th, .leg-table td { padding: 8px 10px; }

    /* Footer stacks */
    .leg-footer-inner {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 16px;
        min-height: auto;
    }

    /* Modal: bottom sheet */
    .hcm-modal-overlay { align-items: flex-end; }
    .hcm-modal-dialog {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        animation: hcmSlideUp 0.35s ease;
    }
    @keyframes hcmSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .hcm-modal-close { border-radius: 0 20px 0 8px; }
    .hcm-formx { padding: 16px; }
}

/* ── SMALL MOBILE ≤ 480px ── */
@media (max-width: 480px) {
    /* Breadcrumb: only show current page to save space */
    .leg-breadcrumb a,
    .leg-breadcrumb .sep { display: none; }
    .leg-breadcrumb .current { display: block; font-size: 13px; }

    /* Arrow hidden — text label only */
    .leg-back-btn svg { display: none; }
    .leg-back-btn     { padding: 0 12px; font-size: 13px; }

    .leg-card { padding: 16px 14px 24px; }
    .leg-index-title    { font-size: 16px; }
    .leg-index-subtitle { font-size: 14px; }
    .leg-doc-row  { padding: 10px 12px; }
    .leg-doc-name { font-size: 14px; } /* keep at minimum 14px */
    .leg-learn-more { font-size: 12px; padding: 0 10px; height: 34px; }
    .leg-doc-title  { font-size: 16px; }
    /* 14px minimum — enforced */
    .leg-content { font-size: 14px; }
    .leg-content h2 { font-size: 14px; }
    .leg-footer-inner { padding: 10px 12px; }
    .hcm-formx { padding: 12px; }
}
