/* ==========================================================================
   LocalizAR Legal Suite - Design System & Styles
   ========================================================================== */

:root {
    --primary: #3D78BC;
    --primary-hover: #2d619b;
    --primary-light: #eff6ff;
    --primary-glow: rgba(61, 120, 188, 0.25);
    --secondary: #EF811A;
    --secondary-light: #fff7ed;
    --accent-teal: #0d9488;
    
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F1F5F9;
    
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-light: #94A3B8;
    
    --border-color: #E2E8F0;
    --border-focus: #3D78BC;
    
    --danger: #EF4444;
    --danger-light: #FEF2F2;
    --danger-border: #FCA5A5;
    
    --success: #10B981;
    --success-light: #ECFDF5;
    --success-border: #A7F3D0;
    
    --warning: #F59E0B;
    --warning-light: #FFFBEB;
    --warning-border: #FDE68A;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Header & Navbar */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.reading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary) 0%, #38BDF8 60%, var(--secondary) 100%);
    z-index: 110;
    transition: width 0.1s linear;
    pointer-events: none;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.brand-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #3D78BC 0%, #2563EB 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(61, 120, 188, 0.35);
    flex-shrink: 0;
}

.brand-icon-wrapper img, .brand-logo img {
    height: 100%;
    width: 100%;
    object-fit: contain;
}

.brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--primary);
}

.brand-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-full);
    border: 1px solid rgba(61, 120, 188, 0.2);
    text-transform: uppercase;
}

/* Mobile Menu Toggle Button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(61, 120, 188, 0.4);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-item {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease-in-out;
}

.nav-item:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-item.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 700;
}

.nav-btn-highlight {
    background-color: var(--primary);
    color: #FFFFFF !important;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(61, 120, 188, 0.35);
}

.nav-btn-highlight:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(61, 120, 188, 0.45);
}

/* Off-Canvas Mobile Drawer */
.legal-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.legal-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.legal-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw);
    background: var(--bg-card);
    z-index: 210;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.legal-drawer.active {
    transform: translateX(0);
}

.legal-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
}

.legal-drawer-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.drawer-heading {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    line-height: 1.2;
}

.drawer-sub {
    font-size: 0.725rem;
    color: var(--text-light);
    font-weight: 600;
    display: block;
}

.drawer-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.drawer-close-btn:hover {
    background: var(--border-color);
    color: var(--text-main);
}

.legal-drawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.drawer-category-title {
    font-size: 0.725rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.drawer-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.drawer-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.drawer-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    border-left: 3px solid var(--primary);
}

.drawer-link.highlight-orange {
    color: var(--secondary);
}

.drawer-link.highlight-red {
    color: var(--danger);
}

.tag-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    background: var(--secondary-light);
    color: var(--secondary);
    margin-left: auto;
}

.tag-badge.tag-red {
    background: var(--danger-light);
    color: var(--danger);
}

.legal-drawer-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.drawer-footer-text {
    font-size: 0.75rem;
    color: var(--text-light);
}

.drawer-support-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

/* Mobile Collapsible TOC Component */
.mobile-toc-collapsible {
    display: none;
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.mobile-toc-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.mobile-toc-trigger::-webkit-details-marker {
    display: none;
}

.mobile-toc-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.mobile-toc-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

details[open] .mobile-toc-chevron {
    transform: rotate(180deg);
}

.mobile-toc-drawer {
    border-top: 1px solid var(--border-color);
    background: #FFFFFF;
    padding: 0.5rem 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.mobile-toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-toc-link {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.mobile-toc-link:hover,
.mobile-toc-link:active,
.mobile-toc-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

/* Headings and anchor scroll target offsets */
h2[id], h3[id], section[id] {
    scroll-margin-top: 5rem;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    color: #FFFFFF;
    padding: 4rem 1.5rem 3.5rem;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(61, 120, 188, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -10%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(239, 129, 26, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: #E2E8F0;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: #94A3B8;
    max-width: 650px;
    margin: 0 auto 1.5rem;
}

.hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #94A3B8;
    flex-wrap: wrap;
}

.hero-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Layout with Sidebar & Content */
.main-wrapper {
    max-width: 1200px;
    margin: -1.5rem auto 4rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 5;
}

.legal-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar Navigation */
.sidebar-sticky {
    position: sticky;
    top: 5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.toc-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.toc-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.toc-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 700;
    border-left: 3px solid var(--primary);
}

.sidebar-action-box {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-btn-primary {
    background: var(--primary);
    color: white;
}

.sidebar-btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.sidebar-btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.sidebar-btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Content Area */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.5rem 3rem;
    box-shadow: var(--shadow-sm);
}

.content-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin: 2.5rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.content-card h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.content-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 1.5rem 0 0.75rem;
}

.content-card p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

.content-card ul, .content-card ol {
    margin: 0.5rem 0 1.5rem 1.5rem;
    color: var(--text-muted);
}

.content-card li {
    margin-bottom: 0.6rem;
    line-height: 1.65;
}

.content-card strong {
    color: var(--text-main);
    font-weight: 700;
}

.content-card a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
}

.content-card a:hover {
    color: var(--primary-hover);
}

/* Callout Boxes */
.callout {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-sm);
    margin: 1.75rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.callout-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.callout-body h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.callout-body p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.callout-info {
    background-color: var(--primary-light);
    border: 1px solid rgba(61, 120, 188, 0.25);
    border-left: 4px solid var(--primary);
    color: #1E3A8A;
}

.callout-info .callout-body h4 {
    color: var(--primary);
}

.callout-warning {
    background-color: var(--warning-light);
    border: 1px solid var(--warning-border);
    border-left: 4px solid var(--warning);
    color: #92400E;
}

.callout-warning .callout-body h4 {
    color: #B45309;
}

.callout-danger {
    background-color: var(--danger-light);
    border: 1px solid var(--danger-border);
    border-left: 4px solid var(--danger);
    color: #991B1B;
}

.callout-danger .callout-body h4 {
    color: var(--danger);
}

.callout-success {
    background-color: var(--success-light);
    border: 1px solid var(--success-border);
    border-left: 4px solid var(--success);
    color: #065F46;
}

.callout-success .callout-body h4 {
    color: var(--success);
}

/* Summary Grid Cards */
.feature-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card-icon.orange {
    background: var(--secondary-light);
    color: var(--secondary);
}

.feature-card-icon.red {
    background: var(--danger-light);
    color: var(--danger);
}

.feature-card h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.feature-card-link {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Forms (e.g. Delete Account) */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.15s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-danger {
    background-color: var(--danger);
    color: #FFFFFF;
    width: 100%;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

.btn-secondary {
    background-color: var(--bg-card-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Footer */
.site-footer {
    background-color: #0F172A;
    color: #94A3B8;
    padding: 4rem 1.5rem 2rem;
    border-top: 1px solid #1E293B;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand h4 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 0.75rem;
}

.footer-brand p {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 400px;
}

.footer-col h5 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #FFFFFF;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-links a {
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: #FFFFFF;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid #1E293B;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: #CBD5E1;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 40;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ==========================================================================
   Responsive Overrides & Senior UX UI Refinements
   ========================================================================== */

@media (max-width: 900px) {
    .legal-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .sidebar-sticky {
        display: none;
    }
    .mobile-toc-collapsible {
        display: block;
    }
    .main-wrapper {
        margin: -2rem auto 3.5rem;
        padding: 0 1.25rem;
    }
    .content-card {
        padding: 2rem 1.5rem;
    }
    .hero-banner {
        padding: 3.25rem 1.25rem 3.25rem;
    }
    .hero-title {
        font-size: clamp(1.85rem, 5vw, 2.35rem);
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 860px) {
    /* Dual-Tier Header: Row 1 = Logo + Menu Button, Row 2 = Horizontal Pill Scroller */
    .header-container {
        flex-wrap: wrap;
        padding: 0.65rem 1rem 0.45rem;
        gap: 0.4rem 0;
    }
    .mobile-menu-btn {
        display: inline-flex;
    }
    .brand-logo {
        gap: 0.55rem;
    }
    .brand-icon-wrapper {
        width: 32px;
        height: 32px;
        padding: 4px;
        border-radius: 8px;
    }
    .brand-text {
        font-size: 1.18rem;
    }
    .brand-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.45rem;
    }
    nav, .nav-scroll-container {
        flex: 0 0 100%;
        width: 100%;
        order: 3;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0.25rem -1rem -0.25rem -1rem;
        padding: 0.25rem 1rem 0.5rem;
        mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 24px), transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 24px), transparent);
    }
    nav::-webkit-scrollbar, .nav-scroll-container::-webkit-scrollbar {
        display: none;
    }
    .nav-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        gap: 0.45rem;
        width: max-content;
        padding-right: 1.5rem;
    }
    .nav-item {
        display: inline-flex;
        align-items: center;
        white-space: nowrap !important;
        flex-shrink: 0;
        font-size: 0.8125rem;
        font-weight: 600;
        padding: 0.38rem 0.85rem;
        border-radius: var(--radius-full);
        background: #FFFFFF;
        border: 1px solid var(--border-color);
        color: var(--text-muted);
        text-decoration: none;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
        transition: all 0.15s ease;
    }
    .nav-item:hover {
        color: var(--primary);
        background: var(--primary-light);
        border-color: rgba(61, 120, 188, 0.4);
    }
    .nav-item.active {
        color: #FFFFFF !important;
        background: var(--primary) !important;
        border-color: var(--primary) !important;
        font-weight: 700;
        box-shadow: 0 2px 8px var(--primary-glow);
    }
    .nav-btn-highlight {
        background-color: #FEF2F2 !important;
        color: #DC2626 !important;
        border-color: #FCA5A5 !important;
        box-shadow: none;
    }
    .nav-btn-highlight:hover {
        background-color: #FEE2E2 !important;
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
    }
}

@media (max-width: 640px) {
    /* Critical Mobile Reading & Touch Spacing Optimization */
    .main-wrapper {
        margin: -1.75rem auto 2.5rem;
        padding: 0 0.75rem;
    }
    .content-card {
        padding: 1.35rem 1rem;
        border-radius: 14px;
        box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
    }
    .content-card h2 {
        font-size: 1.35rem;
        margin: 2rem 0 0.75rem;
        padding-top: 0.85rem;
        line-height: 1.3;
        scroll-margin-top: 6.5rem;
    }
    .content-card h3 {
        font-size: 1.1rem;
        margin: 1.25rem 0 0.5rem;
        scroll-margin-top: 6.5rem;
    }
    .content-card p {
        font-size: 0.95rem;
        line-height: 1.68;
        margin-bottom: 1rem;
    }
    .content-card ul, .content-card ol {
        margin: 0.4rem 0 1.25rem 1.25rem;
    }
    .content-card li {
        font-size: 0.925rem;
        margin-bottom: 0.45rem;
        line-height: 1.55;
    }
    .callout {
        padding: 0.95rem 1rem;
        gap: 0.75rem;
        border-radius: 12px;
        margin: 1.25rem 0;
    }
    .callout-icon {
        font-size: 1.25rem;
    }
    .callout-body h4 {
        font-size: 0.925rem;
        margin-bottom: 0.25rem;
    }
    .callout-body p {
        font-size: 0.875rem;
        line-height: 1.55;
    }
    .hero-banner {
        padding: 2.25rem 0.875rem 2.85rem;
    }
    .hero-tag {
        font-size: 0.72rem;
        padding: 0.25rem 0.7rem;
        margin-bottom: 0.85rem;
    }
    .hero-title {
        font-size: 1.65rem;
        line-height: 1.22;
        margin-bottom: 0.6rem;
    }
    .hero-subtitle {
        font-size: 0.92rem;
        line-height: 1.55;
        margin-bottom: 1rem;
    }
    .hero-meta {
        gap: 0.5rem;
        flex-direction: column;
        align-items: center;
    }
    .hero-meta-item {
        font-size: 0.775rem;
        padding: 0.25rem 0.65rem;
        background: rgba(255, 255, 255, 0.07);
        border-radius: var(--radius-full);
        border: 1px solid rgba(255, 255, 255, 0.08);
        text-align: center;
    }
    .feature-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1.25rem 0;
    }
    .feature-card {
        padding: 1.25rem 1.15rem;
        border-radius: 14px;
    }
    .deletion-steps {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    .step-card {
        padding: 1rem !important;
        display: flex !important;
        gap: 0.85rem !important;
        align-items: flex-start !important;
    }
    .step-number {
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
    }
    .form-input, .btn {
        font-size: 16px !important; /* Prevents iOS auto-zoom */
    }
    .btn {
        min-height: 48px;
    }
    .back-to-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 42px;
        height: 42px;
    }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }
}

@media (max-width: 380px) {
    /* Ultra-compact screens (e.g. 360px Android devices) */
    .brand-text {
        font-size: 1.05rem;
    }
    .brand-badge {
        display: none; /* Hide badge on extremely narrow screens to preserve logo clarity */
    }
    .hero-title {
        font-size: 1.45rem;
    }
    .main-wrapper {
        padding: 0 0.5rem;
    }
    .content-card {
        padding: 1.15rem 0.85rem;
        border-radius: 12px;
    }
}
