/* ============================================================
   Aeronation — Legal Pages (Night Meridian)
   ============================================================ */

.page-legal {
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Hero */
.legal-hero {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 52px 48px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.legal-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -15%;
    width: 55%;
    height: 120%;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 65%);
    pointer-events: none;
}

.legal-hero::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--secondary-border), var(--accent-border), transparent);
}

.legal-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: end;
}

.legal-hero-main { max-width: 580px; }

.legal-hero-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-bright);
    margin-bottom: 24px;
    box-shadow: 0 8px 32px var(--accent-soft);
}

.legal-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(30px, 3.5vw, 42px);
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 16px;
    line-height: 1.05;
}

.legal-lead {
    max-width: 520px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.7;
}

.legal-hero-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legal-meta-chip {
    padding: 16px 22px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 140px;
    transition: border-color 0.3s;
}

.legal-meta-chip:hover { border-color: var(--border-hover); }

.legal-meta-chip strong {
    display: block;
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 900;
    background: var(--grad-accent-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 6px;
}

.legal-meta-chip span {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.legal-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: -8px;
}

.legal-jump a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.25s var(--ease-out);
}

.legal-jump a:hover {
    color: var(--accent-bright);
    background: var(--accent-soft);
    border-color: var(--accent-border);
    transform: translateY(-2px);
}

.legal-jump-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    background: var(--accent-soft);
    color: var(--accent-bright);
}

/* Categories */
.legal-category { margin-bottom: 8px; scroll-margin-top: 100px; }

.legal-category-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.legal-category-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

.legal-category-icon--general {
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-bright);
}

.legal-category-icon--rating {
    background: var(--cat-rating-bg);
    border: 1px solid var(--cat-rating-border);
    color: var(--cat-rating);
}

.legal-category-icon--finance {
    background: var(--cat-finance-bg);
    border: 1px solid var(--cat-finance-border);
    color: var(--cat-finance);
}

.legal-category-icon--services {
    background: var(--cat-services-bg);
    border: 1px solid var(--cat-services-border);
    color: var(--cat-services);
}

/* Document cards */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 18px;
}

.doc-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.35s var(--ease-out), border-color 0.35s, box-shadow 0.35s;
    backdrop-filter: blur(8px);
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--doc-accent, var(--accent));
    opacity: 0.6;
    transition: opacity 0.35s, width 0.35s;
}

.doc-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.doc-card:hover::before { opacity: 1; width: 4px; }

.doc-card--general { --doc-accent: var(--accent); }
.doc-card--rating { --doc-accent: var(--cat-rating); }
.doc-card--finance { --doc-accent: var(--cat-finance); }
.doc-card--services { --doc-accent: var(--cat-services); }

.doc-card-inner {
    padding: 26px 26px 26px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.doc-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.doc-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex-grow: 1;
}

.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s var(--ease-out);
    text-decoration: none;
    border: 1px solid transparent;
}

.doc-btn:hover { transform: translateY(-1px); }

.doc-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.doc-btn--view {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--text);
}

.doc-btn--view:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.doc-btn--download {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
    color: var(--text-secondary);
}

.doc-btn--download:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text);
}

/* Single document page */
.doc-page { max-width: 900px; }

.doc-page h1 {
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.doc-page .doc-viewer {
    background: var(--doc-viewer-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 70vh;
    margin-bottom: 20px;
}

.doc-page .doc-viewer iframe {
    display: block;
    width: 100%;
    height: 78vh;
    border: 0;
}

.doc-page .doc-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.doc-page .doc-back {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.doc-page .doc-back:hover { color: var(--accent-bright); }

/* PDF modal */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pdf-modal[hidden] { display: none; }

.pdf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pdf-modal-box {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pdf-modal-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
}

.pdf-modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.pdf-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.pdf-modal-body {
    flex: 1;
    min-height: 70vh;
    position: relative;
    background: var(--doc-viewer-bg);
}

.pdf-modal-body iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.pdf-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 24px 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 360px;
}

/* Legal document text */
.doc-text {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 52px;
    max-width: 820px;
    line-height: 1.75;
    font-size: 15px;
    color: var(--text-secondary);
    backdrop-filter: blur(12px);
}

.doc-text h1 {
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    line-height: 1.25;
    text-align: center;
}

.doc-text .doc-subtitle {
    text-align: center;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.doc-text .doc-date {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.doc-notice {
    margin-bottom: 28px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    overflow: hidden;
}

.doc-notice summary {
    padding: 14px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-bright);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    user-select: none;
}

.doc-notice summary::-webkit-details-marker { display: none; }
.doc-notice summary::marker { content: ''; }

.doc-notice summary::before {
    content: '▸';
    font-size: 13px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.doc-notice[open] summary::before { transform: rotate(90deg); }
.doc-notice summary:hover { background: var(--accent-soft); }

.doc-notice-body {
    padding: 10px 20px 20px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.doc-notice-body p { margin: 0 0 12px; font-size: 13.5px; }

.doc-notice-body .doc-notice-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.doc-notice-body .doc-notice-meta {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--accent-border);
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.7;
}

.doc-toc {
    margin: 0 0 32px;
    padding: 22px 26px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.doc-toc-title {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.doc-toc ol {
    margin: 0;
    padding: 0;
    list-style: none !important;
    counter-reset: toc;
}

.doc-toc li { margin-bottom: 6px; counter-increment: toc; }

.doc-toc li a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.2s;
}

.doc-toc li a:hover { color: var(--accent-bright); }

.doc-toc li a::before {
    content: counter(toc) ".";
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--accent-bright);
    min-width: 22px;
    flex-shrink: 0;
}

.doc-text h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 44px 0 16px;
    letter-spacing: -0.02em;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    scroll-margin-top: 100px;
}

.doc-text h2:first-of-type { border-top: none; padding-top: 0; }
.doc-text h2 .doc-num { color: var(--accent-bright); font-weight: 800; }

.doc-text h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 24px 0 12px;
    scroll-margin-top: 100px;
}

.doc-text h3 .doc-num { color: var(--accent-bright); font-weight: 700; }

.doc-text h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 10px;
}

.doc-text .pn {
    color: var(--accent-bright);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-right: 0.35em;
}

.doc-notice-actions .doc-btn { text-decoration: none; }

.doc-text .doc-meta {
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 24px;
    line-height: 1.6;
}

.doc-text p { margin: 0 0 12px; line-height: 1.75; }

.doc-text ul, .doc-text ol { margin: 8px 0 16px; padding-left: 24px; }
.doc-text ul { list-style: disc; }
.doc-text ol { list-style: decimal; }

.doc-text li { margin-bottom: 8px; line-height: 1.65; }
.doc-text li .pn { font-size: 0.95em; }

.doc-text strong { color: var(--text); font-weight: 600; }

.doc-text a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.doc-text a:hover { color: var(--accent-bright); }

.doc-text .doc-sign {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-muted);
}

.doc-text .doc-sign strong {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.doc-text .doc-formula {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 16px 20px;
    margin: 16px 0;
    font-family: 'Cambria Math', 'Times New Roman', serif;
    font-size: 16px;
    color: var(--text);
    text-align: center;
    overflow-x: auto;
}

.doc-i18n-banner {
    margin: 0 0 28px;
    padding: 16px 18px;
    border-radius: var(--radius-xs, 12px);
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.doc-i18n-banner p {
    margin: 0;
}

@media (max-width: 1024px) {
    .doc-grid { grid-template-columns: 1fr; }
    .legal-hero-inner { grid-template-columns: 1fr; }
    .legal-hero-meta { flex-direction: row; }
}

@media (max-width: 768px) {
    .legal-hero { padding: 32px 24px; }
    .legal-hero-icon { width: 52px; height: 52px; margin-bottom: 18px; }
    .legal-hero-meta { flex-direction: column; }
    .legal-meta-chip { min-width: 100%; }
    .legal-jump { gap: 8px; }
    .legal-jump a { font-size: 12px; padding: 8px 14px; }
    .doc-card-inner { padding: 22px; }
    .doc-actions { flex-direction: column; }
    .doc-btn { justify-content: center; }
    .doc-text { padding: 28px 20px; font-size: 14px; }
    .doc-text h1 { font-size: 20px; }
    .doc-text h2 { font-size: 18px; margin: 32px 0 14px; }
    .doc-notice-body .doc-notice-actions { flex-direction: column; }
    .pdf-modal-box { max-height: 85vh; }
    .pdf-modal-header { padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .doc-card, .doc-btn { transition: none; }
}
