/* Subpages — shared design system (docs, compare, legal, onboarding) */

body.page-sub {
    min-height: 100vh;
    width: 100%;
}

/* —— Ambient backgrounds (low-intensity hero wave) —— */
.subpage-hero-wrap {
    width: 100%;
    position: relative;
    overflow: hidden;
    margin-top: -52px;
    padding: calc(32px + 52px) 0 48px;
}

.subpage-hero-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 50%, transparent) 80px, transparent 160px),
        var(--hero-glow);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] .subpage-hero-wrap::before {
    animation: hero-glow-breathe 20s ease-in-out infinite;
}

.subpage-hero-wrap::after {
    content: "";
    position: absolute;
    top: -120px;
    right: -280px;
    width: min(70vw, 900px);
    height: min(90vh, 720px);
    z-index: 0;
    pointer-events: none;
    border-radius: 66% 24% 30% 60% / 58% 20% 32% 54%;
    background:
        radial-gradient(74% 82% at 14% 44%, rgba(99, 102, 241, 0.14) 0%, transparent 70%),
        radial-gradient(68% 78% at 26% 62%, rgba(236, 72, 153, 0.1) 0%, transparent 72%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.4) 0%, transparent 72%);
    opacity: 0.45;
    transform: rotate(-5deg);
    clip-path: ellipse(64% 74% at 60% 50%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.75) 30%, #000 100%);
}

[data-theme="light"] .subpage-hero-wrap[data-ambient="compare"]::after {
    opacity: 0.38;
    animation: stripe-wave-float 28s ease-in-out infinite;
}

[data-theme="light"] .subpage-hero-wrap[data-ambient="docs"]::after {
    right: auto;
    left: -320px;
    transform: rotate(5deg) scale(0.92);
    opacity: 0.32;
}

[data-theme="light"] .subpage-hero-wrap[data-ambient="legal"]::after {
    opacity: 0.22;
    width: min(55vw, 680px);
}

[data-theme="dark"] .subpage-hero-wrap::after {
    opacity: 0.12;
}

.subpage-hero {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.subpage-hero--wide { max-width: 880px; }

.subpage-hero--compact {
    max-width: 640px;
    padding-bottom: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--heading); }

.breadcrumb-sep { opacity: 0.45; user-select: none; }

.subpage-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.subpage-hero h1 {
    font-size: clamp(2rem, 5.5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin: 0 0 16px;
    color: var(--heading);
}

.subpage-lead {
    font-size: clamp(1rem, 2.2vw, 1.125rem);
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 560px;
    margin: 0 auto 24px;
}

.subpage-meta {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin: 0;
}

.subpage-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.subpage-body {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto 80px;
}

/* Legacy alias — compare-hero maps to subpage hero styles */
.compare-hero h1 {
    font-size: clamp(2rem, 5.5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 16px;
    line-height: 1.1;
    color: var(--heading);
}

.title-gradient {
    background: linear-gradient(90deg, var(--heading) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.compare-hero p,
.compare-hero .subpage-lead {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 0 auto;
    line-height: 1.6;
}

/* —— Compare decision page —— */
.compare-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 90%;
    max-width: 1100px;
    margin: 0 auto 40px;
}

.compare-summary-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.compare-summary-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.compare-summary-item i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.compare-summary-item h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--heading);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.compare-summary-item p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.compare-table-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto 64px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.vs-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.vs-table thead th {
    position: static;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-strong);
}

.vs-table thead th.col-orriva {
    background: var(--accent-muted);
}

.vs-table th,
.vs-table td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--table-row-border);
    line-height: 1.55;
    vertical-align: top;
}

.vs-table tbody tr:last-child td {
    border-bottom: none;
}

.vs-table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.vs-table td { font-size: 0.875rem; color: var(--text-secondary); }

.col-feature {
    width: 14%;
    min-width: 9.5rem;
    font-weight: 600;
    color: var(--heading);
    border-right: 1px solid var(--border);
    white-space: normal;
    word-break: break-word;
}

.col-mee6 {
    width: 22%;
    border-right: 1px solid var(--border);
}

.col-orriva {
    width: 28%;
    background: var(--accent-muted);
    color: var(--text);
    font-weight: 500;
    border-right: 1px solid var(--border);
}

.col-advantage { width: 34%; font-size: 0.8125rem; }

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 4px;
}

.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 4px;
}

.compare-mobile-card { display: none; }

.compare-mobile-stack { display: none; }

/* —— Onboarding steps (docs / permissions) —— */
.onboarding-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 48px;
}

.onboarding-step {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.onboarding-step:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.onboarding-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 700;
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}

.onboarding-step h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--heading);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.onboarding-step p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.docs-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
    align-items: start;
}

.docs-toc {
    position: sticky;
    top: 88px;
}

.docs-toc-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin: 0 0 12px;
}

.docs-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs-toc-list a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.docs-toc-list a:hover {
    background: var(--bg-muted);
    color: var(--heading);
}

.cmd-copy-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cmd-copy-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: border-color 0.15s, color 0.15s;
}

.cmd-copy-btn:hover,
.cmd-copy-btn.is-copied {
    border-color: var(--accent);
    color: var(--accent);
}

/* —— Permissions —— */
.perm-layout {
    display: grid;
    grid-template-columns: minmax(260px, 380px) 1fr;
    gap: 32px;
    align-items: start;
}

.perm-screenshot {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: block;
    margin: 0 auto;
}

.perm-accordion { display: flex; flex-direction: column; gap: 8px; }

.perm-accordion-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s;
}

.perm-accordion-item.is-open { border-color: var(--border-strong); }

.perm-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: var(--heading);
    font-weight: 600;
    font-size: 0.9375rem;
}

.perm-accordion-trigger i.fa-chevron-down {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.perm-accordion-item.is-open .perm-accordion-trigger i.fa-chevron-down {
    transform: rotate(180deg);
}

.perm-accordion-panel {
    padding: 0 16px 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.perm-accordion-panel p { margin: 0; }

/* —— Use cases bento —— */
.use-case-bento {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
}

.use-case-card {
    scroll-margin-top: 100px;
    padding: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.use-case-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.use-case-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.use-case-card h2 {
    font-size: 1.25rem;
    color: var(--heading);
    margin: 0 0 10px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.use-case-card p {
    margin: 0 0 10px;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.use-case-metric {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 100px;
    background: var(--bg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

.use-case-rules {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.legal-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    width: 90%;
    max-width: 960px;
    margin: 0 auto 100px;
    align-items: start;
}

.legal-wrapper {
    width: 90%;
    max-width: 880px;
    margin: 40px auto 100px;
}

.legal-header {
    text-align: center;
    margin-bottom: 40px;
}

.legal-header h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin: 0 0 12px;
    color: var(--heading);
}

.legal-header .last-updated {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-toc-panel {
    position: sticky;
    top: 88px;
}

.legal-toc-panel[hidden] { display: none; }

.legal-toc-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin: 0 0 12px;
}

.legal-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legal-toc-list a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}

.legal-toc-list a:hover {
    background: var(--bg-muted);
    color: var(--heading);
}

.legal-toc-sub a {
    padding-left: 18px;
    font-size: 0.75rem;
}

.legal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(28px, 5vw, 44px);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.75;
    max-width: 65ch;
    box-shadow: var(--shadow-sm);
}

.legal-content h2 {
    color: var(--heading);
    font-size: 1.25rem;
    margin-top: 36px;
    margin-bottom: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    scroll-margin-top: 96px;
}

.legal-content h2:first-of-type { margin-top: 0; }

.legal-content h3 {
    color: var(--text);
    font-size: 1.05rem;
    margin-top: 24px;
    margin-bottom: 10px;
    font-weight: 600;
    scroll-margin-top: 96px;
}

.legal-content p { margin-bottom: 16px; }
.legal-content ul { margin: 0 0 20px; padding-left: 1.25rem; }
.legal-content li { margin-bottom: 6px; }
.legal-content strong { color: var(--heading); }

.legal-tldr {
    background: var(--accent-muted);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 18px 20px;
    margin-bottom: 28px;
    font-size: 0.9375rem;
}

.legal-tldr h2 {
    margin: 0 0 10px;
    padding: 0;
    border: none;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.legal-tldr ul {
    margin: 0;
    padding-left: 1.1rem;
}

.legal-tldr li {
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.legal-note {
    background: var(--bg-muted);
    border-left: 3px solid var(--accent);
    padding: 16px 18px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 20px 0;
    font-size: 0.9375rem;
    color: var(--text);
}

.legal-note.warning {
    border-left-color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.legal-note.warning strong { color: var(--danger); }

.legal-content a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.legal-content a:hover { text-decoration: underline; }

.legal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 24px auto 0;
    width: 90%;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.legal-tab {
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.legal-tab:hover {
    border-color: var(--border-strong);
    color: var(--heading);
}

.legal-tab.is-active {
    background: var(--heading);
    color: var(--bg);
    border-color: var(--heading);
}

/* —— CTA bands (mesh styles in site.css) —— */

/* —— 404 —— */
.error-page-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 80px;
}

.error-brand-card {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 520px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: clamp(36px, 6vw, 52px);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.error-brand-code {
    font-size: clamp(3.5rem, 12vw, 5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.05em;
    color: var(--heading);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.error-brand-title {
    font-size: clamp(1.2rem, 3vw, 1.45rem);
    font-weight: 600;
    color: var(--heading);
    margin: 0 0 10px;
}

.error-brand-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 28px;
    line-height: 1.6;
}

.error-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.error-quick-links a {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    transition: border-color 0.15s, color 0.15s;
}

.error-quick-links a:hover {
    border-color: var(--border-strong);
    color: var(--heading);
}

.error-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 90%;
    max-width: 560px;
    padding: 48px 0 80px;
}

/* —— Responsive —— */
@media (max-width: 1000px) {
    .compare-summary { grid-template-columns: 1fr; }
    .onboarding-track { grid-template-columns: repeat(2, 1fr); }
    .docs-layout,
    .legal-layout,
    .perm-layout { grid-template-columns: 1fr; }
    .docs-toc,
    .legal-toc-panel { position: static; }
    .use-case-bento { grid-template-columns: 1fr; max-width: none; }
    .vs-table { display: none; }
    .compare-mobile-stack { display: block; }
    .compare-mobile-card {
        display: block;
        background: var(--bg-elevated);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 18px;
        margin-bottom: 12px;
    }
    .compare-mobile-feature {
        font-size: 0.9375rem;
        font-weight: 600;
        color: var(--heading);
        margin: 0 0 12px;
    }
    .compare-mobile-cols {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .compare-mobile-col {
        padding: 12px;
        border-radius: var(--radius-md);
        font-size: 0.8125rem;
        line-height: 1.5;
    }
    .compare-mobile-them { background: var(--bg-muted); }
    .compare-mobile-us { background: var(--accent-muted); }
    .compare-mobile-label {
        display: block;
        font-size: 0.625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-tertiary);
        margin-bottom: 6px;
    }
    .compare-mobile-why {
        margin: 12px 0 0;
        font-size: 0.8125rem;
        color: var(--text-secondary);
        line-height: 1.5;
    }
}

@media (max-width: 640px) {
    .onboarding-track { grid-template-columns: 1fr; }
    .subpage-hero-wrap::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    [data-theme="light"] .subpage-hero-wrap::before,
    [data-theme="light"] .subpage-hero-wrap::after {
        animation: none;
    }
}
