/* ============================================================
 * MobileHub API — Public legal pages stylesheet
 *
 * Styles the standalone HTML rendered by Mhapi_page::view() — the
 * Terms / Privacy / About pages the mobile app embeds via WebView.
 *
 * Two design tokens are injected per request from the controller
 * (--mhp-primary, --mhp-accent) because they come from buyer-set
 * App Settings; everything else is static and ships in this file.
 * ============================================================ */

:root {
    --mhp-ink:    #0f172a;
    --mhp-body:   #334155;
    --mhp-muted:  #64748b;
    --mhp-line:   #e2e8f0;
    --mhp-soft:   #f1f5f9;
    --mhp-canvas: #f7f9fc;
    --mhp-card:   #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    background: var(--mhp-canvas);
    color: var(--mhp-ink);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.mhp-header {
    background: #fff;
    border-bottom: 1px solid var(--mhp-line);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: saturate(180%) blur(6px);
}
.mhp-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 28px;
    width: 100%;
}
.mhp-header__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.mhp-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--mhp-ink);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
}
.mhp-brand img { height: 32px; width: auto; border-radius: 6px; }
.mhp-brand__mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--mhp-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10);
}
.mhp-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.mhp-nav a {
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.mhp-nav__link { color: var(--mhp-body); }
.mhp-nav__link:hover { background: var(--mhp-soft); color: var(--mhp-ink); }
.mhp-nav__cta {
    background: var(--mhp-primary);
    color: #fff !important;
    padding: 9px 18px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}
.mhp-nav__cta:hover { filter: brightness(1.05); }

/* ===== CONTENT ===== */
.mhp-main { flex: 1; padding: 28px 0 56px; }

.mhp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--mhp-muted);
    font-size: 13.5px;
    font-weight: 500;
    padding: 6px 10px;
    margin-bottom: 16px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.mhp-back:hover { background: var(--mhp-soft); color: var(--mhp-ink); }
.mhp-back i { font-style: normal; font-size: 16px; line-height: 1; }

.mhp-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
}
@media (min-width: 1024px) {
    .mhp-layout { grid-template-columns: 1fr 280px; }
}

.mhp-article {
    background: var(--mhp-card);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
                0 4px 16px rgba(15, 23, 42, 0.04);
    padding: 56px 64px;
}
.mhp-article__head {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--mhp-soft);
}
.mhp-article__eyebrow {
    display: inline-block;
    background: color-mix(in srgb, var(--mhp-primary) 10%, #fff);
    color: var(--mhp-primary);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.mhp-article h1 {
    font-size: 36px;
    margin: 0 0 10px;
    letter-spacing: -0.025em;
    color: var(--mhp-ink);
    line-height: 1.15;
}
.mhp-article__meta {
    font-size: 13px;
    color: var(--mhp-muted);
    margin: 0;
}

/* ===== BODY (rendered HTML from page.content) ===== */
.mhp-body p, .mhp-body li { font-size: 15.5px; color: var(--mhp-body); }
.mhp-body p { margin: 0 0 16px; }
.mhp-body p.lead { font-size: 17px; color: var(--mhp-ink); line-height: 1.6; }
.mhp-body strong { color: var(--mhp-ink); }
.mhp-body h2 {
    font-size: 21px;
    margin: 36px 0 12px;
    color: var(--mhp-ink);
    letter-spacing: -0.015em;
    line-height: 1.3;
}
.mhp-body h3 {
    font-size: 16.5px;
    margin: 24px 0 10px;
    color: var(--mhp-ink);
}
.mhp-body ul, .mhp-body ol { padding-left: 22px; margin: 0 0 16px; }
.mhp-body li { margin-bottom: 6px; }
.mhp-body a {
    color: var(--mhp-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.mhp-body a:hover { border-bottom-color: var(--mhp-primary); }
.mhp-body code {
    background: var(--mhp-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--mhp-ink);
}
.mhp-body blockquote {
    margin: 18px 0;
    padding: 12px 18px;
    border-left: 3px solid var(--mhp-primary);
    background: var(--mhp-soft);
    color: var(--mhp-body);
    font-style: italic;
}

/* ===== SIDEBAR (sticky on desktop) ===== */
.mhp-side {
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.mhp-side__card {
    background: var(--mhp-card);
    border-radius: 14px;
    padding: 22px 22px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
                0 2px 10px rgba(15, 23, 42, 0.03);
}
.mhp-side__card h4 {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--mhp-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.mhp-side__list { list-style: none; padding: 0; margin: 0; }
.mhp-side__list li { margin-bottom: 8px; }
.mhp-side__list li:last-child { margin-bottom: 0; }
.mhp-side__list a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--mhp-body);
    font-size: 14px;
    padding: 9px 12px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.mhp-side__list a:hover { background: var(--mhp-soft); color: var(--mhp-ink); }
.mhp-side__list a::before {
    content: "›";
    color: var(--mhp-muted);
    font-weight: 600;
    margin-right: 2px;
    transition: color 0.15s, transform 0.15s;
    display: inline-block;
}
.mhp-side__list a:hover::before {
    color: var(--mhp-primary);
    transform: translateX(2px);
}

.mhp-side__support {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--mhp-primary) 8%, #fff),
        color-mix(in srgb, var(--mhp-primary) 3%, #fff)
    );
    border: 1px solid color-mix(in srgb, var(--mhp-primary) 15%, #fff);
}
.mhp-side__support h4 { color: var(--mhp-ink); }
.mhp-side__support p {
    margin: 0 0 10px;
    font-size: 13.5px;
    color: var(--mhp-body);
    line-height: 1.55;
}
.mhp-side__support a {
    color: var(--mhp-primary);
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    word-break: break-all;
}
.mhp-side__support a:hover { text-decoration: underline; }

/* ===== FOOTER ===== */
.mhp-footer {
    background: #fff;
    border-top: 1px solid var(--mhp-line);
    padding: 28px 0;
    color: var(--mhp-muted);
    font-size: 13px;
}
.mhp-footer__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.mhp-footer__copy { color: var(--mhp-muted); }
.mhp-footer__links {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.mhp-footer__links a {
    color: var(--mhp-body);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.mhp-footer__links a:hover { background: var(--mhp-soft); color: var(--mhp-ink); }
.mhp-footer__sep { color: var(--mhp-line); user-select: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 880px) {
    .mhp-shell      { padding: 0 18px; }
    .mhp-article    { padding: 32px 26px; }
    .mhp-article h1 { font-size: 28px; }
    .mhp-body h2    { font-size: 19px; margin-top: 28px; }
    .mhp-nav__link  { display: none; }
    .mhp-footer__row { flex-direction: column; gap: 12px; text-align: center; }
}
@media (max-width: 480px) {
    .mhp-article    { padding: 24px 18px; border-radius: 12px; }
    .mhp-article h1 { font-size: 24px; }
    .mhp-nav__cta   { padding: 8px 14px !important; font-size: 13px; }
}
