@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   LIGHT MODE (default)
   ============================================================ */
:root {
    --primary:         hsl(218, 74%, 36%);
    --primary-light:   hsl(218, 74%, 50%);
    --accent:          hsl(50, 100%, 50%);

    --bg-page:         hsl(210, 20%, 97%);
    --bg-card:         hsl(0, 0%, 100%);
    --bg-card-alpha:   hsla(0, 0%, 100%, 0.88);
    --bg-subtle:       hsla(218, 74%, 36%, 0.04);
    --bg-table-alt:    hsla(218, 74%, 36%, 0.03);
    --bg-table-hover:  hsla(218, 74%, 36%, 0.07);

    --text-main:       hsl(210, 15%, 12%);
    --text-muted:      hsl(210, 10%, 42%);

    --border:          hsl(210, 20%, 88%);
    --border-strong:   hsl(210, 20%, 78%);

    --alert-bg:        hsla(12, 90%, 50%, 0.06);
    --alert-border:    hsl(12, 90%, 50%);
    --alert-text:      hsl(12, 90%, 35%);

    --shadow:          0 4px 24px rgba(31, 38, 135, 0.07), 0 1px 4px rgba(0,0,0,0.04);
    --radius:          16px;
}

/* ============================================================
   DARK MODE — applied via :root[data-theme="dark"]  AND
               @media prefers-color-scheme (auto-fallback)
   ============================================================ */
:root[data-theme="dark"],
:root[data-theme="auto"]:has(+ * ) {
    --primary:         hsl(218, 74%, 65%);
    --primary-light:   hsl(218, 74%, 78%);
    --accent:          hsl(50, 100%, 55%);

    --bg-page:         hsl(215, 18%, 9%);
    --bg-card:         hsl(215, 18%, 13%);
    --bg-card-alpha:   hsla(215, 18%, 13%, 0.92);
    --bg-subtle:       hsla(218, 74%, 65%, 0.08);
    --bg-table-alt:    hsla(218, 74%, 65%, 0.05);
    --bg-table-hover:  hsla(218, 74%, 65%, 0.12);

    --text-main:       hsl(210, 15%, 90%);
    --text-muted:      hsl(210, 10%, 58%);

    --border:          hsl(215, 18%, 22%);
    --border-strong:   hsl(215, 18%, 30%);

    --alert-bg:        hsla(12, 90%, 50%, 0.1);
    --alert-border:    hsl(12, 80%, 60%);
    --alert-text:      hsl(12, 80%, 70%);

    --shadow:          0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0,0,0,0.3);
}

/* Auto-system dark mode (used when no explicit toggle has been set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --primary:         hsl(218, 74%, 65%);
        --primary-light:   hsl(218, 74%, 78%);
        --accent:          hsl(50, 100%, 55%);
        --bg-page:         hsl(215, 18%, 9%);
        --bg-card:         hsl(215, 18%, 13%);
        --bg-card-alpha:   hsla(215, 18%, 13%, 0.92);
        --bg-subtle:       hsla(218, 74%, 65%, 0.08);
        --bg-table-alt:    hsla(218, 74%, 65%, 0.05);
        --bg-table-hover:  hsla(218, 74%, 65%, 0.12);
        --text-main:       hsl(210, 15%, 90%);
        --text-muted:      hsl(210, 10%, 58%);
        --border:          hsl(215, 18%, 22%);
        --border-strong:   hsl(215, 18%, 30%);
        --alert-bg:        hsla(12, 90%, 50%, 0.1);
        --alert-border:    hsl(12, 80%, 60%);
        --alert-text:      hsl(12, 80%, 70%);
        --shadow:          0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0,0,0,0.3);
    }
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   BASE
   ============================================================ */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card-alpha);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section img {
    height: 38px;
    width: auto;
}

/* Logo switching — controlled by JS toggle + system media query */
.logo-light { display: block; }
.logo-dark  { display: none;  }

:root[data-theme="dark"] .logo-light  { display: none;  }
:root[data-theme="dark"] .logo-dark   { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-light { display: none;  }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-dark  { display: block; }
}

.last-updated {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
#theme-toggle {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 6px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
}

#theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-table-hover);
}

#theme-toggle .icon {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.4s ease;
}

#theme-toggle:hover .icon {
    transform: rotate(20deg);
}

/* ============================================================
   SVG ICON STYLES
   ============================================================ */

/* Toggle button icon wrapper */
#theme-toggle .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.4s ease;
}

#theme-toggle:hover .icon {
    transform: rotate(20deg);
}

#theme-toggle .icon svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Contact row icons */
.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 8px;
    color: var(--primary);
    position: relative;
    top: 1px;
    flex-shrink: 0;
}

.contact-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Alert heading icons (warning triangle, lock) */
.compliance-alert strong,
.compliance-box strong:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-icon svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

/* ============================================================
   PAGE CONTAINER
   ============================================================ */
.page-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    margin: 36px 0;
    padding: 80px 40px;
    background: linear-gradient(135deg, hsla(218, 74%, 22%, 0.96), hsla(218, 74%, 40%, 0.92)), url('assets/hero.webp');
    background-size: cover;
    background-position: center;
    border-radius: var(--radius);
    color: white;
    text-align: center;
    box-shadow: var(--shadow);
}

.hero h1, .hero h2 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    color: white;
    border: none;
    padding: 0;
}

.hero p {
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0 auto;
    opacity: 0.9;
    color: white;
}

/* ============================================================
   KEY POINTS SUMMARY
   ============================================================ */
.key-points-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 36px;
    box-shadow: var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.key-points-summary h3 {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0 0 6px;
    border: none;
    padding: 0;
    font-weight: 800;
}

.key-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.key-point-item {
    font-size: 0.93rem;
    padding: 16px;
    background: var(--bg-subtle);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.key-point-item strong {
    display: block;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 0.97rem;
    font-weight: 700;
}

.key-point-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.88rem;
}

/* ============================================================
   CONTENT CARD
   ============================================================ */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 36px;
    box-shadow: var(--shadow);
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background 0.3s ease, border-color 0.3s ease;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin: 24px 0 12px;
    font-weight: 700;
}

h4 {
    font-size: 1.05rem;
    margin: 20px 0 10px;
    font-weight: 700;
    color: var(--text-main);
}

p { margin-bottom: 15px; }

ul, ol { margin: 12px 0 14px 22px; }
li      { margin-bottom: 8px; line-height: 1.6; }

a { color: var(--primary); }

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */
.toc {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 36px;
    transition: background 0.3s ease;
}

.toc h4 {
    margin-top: 0;
    margin-bottom: 14px;
    color: var(--text-main);
    font-size: 1rem;
}

.toc ul {
    list-style: none;
    margin: 0;
}

.toc a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.92rem;
    display: block;
    padding: 5px 0;
    transition: all 0.2s;
    font-weight: 500;
}

.toc a:hover {
    color: var(--primary-light);
    transform: translateX(4px);
}

/* ============================================================
   SECTIONS
   ============================================================ */
section {
    margin-bottom: 28px;
}

/* ============================================================
   SECTIONS & SECTION HEADERS
   ============================================================ */
section {
    margin-bottom: 36px;
}

section[id] {
    scroll-margin-top: 90px;
}

.legal-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 42px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.section-num {
    background: var(--primary);
    color: #ffffff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    line-height: 1;
}

:root[data-theme="dark"] .section-num {
    background: var(--primary);
    color: #ffffff;
}

.legal-section-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.015em;
    font-size: 1.15rem;
    line-height: 1.4;
}

/* ============================================================
   IN-SHORT BOX (Executive Summary Callout)
   ============================================================ */
.in-short-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin: 18px 0 22px;
    border-radius: 8px;
    font-style: normal;
    color: var(--text-main);
    font-size: 0.92rem;
    line-height: 1.65;
    transition: background 0.3s ease;
}

.in-short-box strong {
    font-style: normal;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--primary);
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

/* ============================================================
   COMPLIANCE ALERT (Refined Notice Box)
   ============================================================ */
.compliance-alert {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 8px;
    font-size: 0.92rem;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 6px;
    line-height: 1.65;
    transition: background 0.3s ease;
}

.compliance-alert strong {
    color: hsl(12, 75%, 45%);
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

:root[data-theme="dark"] .compliance-alert strong {
    color: hsl(12, 80%, 68%);
}

/* ============================================================
   COMPLIANCE INFO BOX (blue)
   ============================================================ */
.compliance-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin: 20px 0;
    line-height: 1.75;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.compliance-box a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.compliance-box p {
    margin-bottom: 6px;
}

/* ============================================================
   LEGAL TABLE
   ============================================================ */
.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0 24px;
    font-size: 0.88rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.legal-table thead tr {
    background: var(--primary);
    color: #fff;
    text-align: left;
}

.legal-table th,
.legal-table td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.5;
    transition: background 0.3s ease;
}

.legal-table th {
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-color: hsla(218, 74%, 50%, 0.35);
}

.legal-table tbody tr:nth-child(even) {
    background: var(--bg-table-alt);
}

.legal-table tbody tr:hover {
    background: var(--bg-table-hover);
}

/* ============================================================
   LEGAL DEFINITION INLINE
   ============================================================ */
.legal-definition {
    font-weight: 600;
    color: var(--primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn {
    padding: 12px 26px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-outline {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--bg-subtle);
    border-color: var(--primary-light);
}

.btn:active {
    opacity: 0.88;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    text-align: center;
    padding: 50px 20px;
    border-top: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

.footer-disclaimer {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 28px auto 0;
    max-width: 620px;
    line-height: 1.6;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .hero { padding: 56px 24px; }
    .hero h1, .hero h2 { font-size: 2rem; }
    .hero p { font-size: 0.97rem; }

    .content-card { padding: 24px 18px; }
    .key-points-grid { grid-template-columns: 1fr; }

    .legal-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .legal-table { font-size: 0.78rem; }
    .legal-table th,
    .legal-table td { padding: 8px 10px; }

    .compliance-box { padding: 20px; }
    header { flex-wrap: wrap; gap: 10px; }
    .last-updated { font-size: 0.72rem; }
}

/* ============================================================
   MINIMALIST 2-COLUMN LEGAL HUB (Apple / Tesla Style)
   ============================================================ */
.hub-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 28px 0;
}

.hub-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hub-card-item:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.hub-card-tag {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}

.hub-card-item h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 12px 0;
    letter-spacing: -0.015em;
    border: none;
    padding: 0;
}

.hub-card-item p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 24px 0;
    flex-grow: 1;
}

.hub-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.hub-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.hub-card-footer .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.hub-notice {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-top: 12px;
    margin-bottom: 36px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.hub-notice strong {
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
    font-size: 0.92rem;
}

@media (max-width: 680px) {
    .hub-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .hub-card-item {
        padding: 24px 20px;
    }

    .hub-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .hub-card-footer .btn {
        width: 100%;
    }
}