/* ============================================
   Rootmesh v6 — G3b Grounded Weave
   Red Hat Display + Work Sans. Dark mode ready.
   Logo picker, font selector, data protection.
   ============================================ */

/* --- Fonts --- */
@font-face {
    font-family: 'Red Hat Display';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('fonts/red-hat-display-latin-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Red Hat Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/red-hat-display-latin-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Work Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/work-sans-latin-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Work Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/work-sans-latin-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Work Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/work-sans-latin-600.woff2') format('woff2');
}

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

/* --- Design Tokens --- */
:root {
    --accent: #2d7a65;
    --accent-hover: #24664f;
    --accent-light: #e6f4ef;
    --accent-text: #1d6a55;
    --navy: #0F1B2D;
    --navy-light: #162236;
    --surface: #F5F8F6;
    --surface-alt: #DDE6E0;
    --text: #1A1A1A;
    --text-secondary: #4A5260;
    --text-light: #E8E6E3;
    --border: #BDC9C2;
    --card-bg: #FFFFFF;
    --card-shadow: rgba(15, 27, 45, 0.08);
    --nav-bg: rgba(245, 248, 246, 0.85);
    --nav-bg-solid: rgba(245, 248, 246, 0.95);
    --btn-text: #FFFFFF;
    --hover-subtle: rgba(0, 0, 0, 0.04);

    --contact-text: rgba(232, 230, 227, 0.75);
    --footer-text: rgba(232, 230, 227, 0.65);
    --footer-link: rgba(232, 230, 227, 0.7);
    --footer-link-hover: rgba(232, 230, 227, 0.9);

    --font-display: 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

    --container: 1140px;
    --container-narrow: 720px;
    --nav-height: 64px;
    --radius: 6px;
    --radius-lg: 8px;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;
    --space-5xl: 128px;

    color-scheme: light dark;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
    --accent: #3EAD8A;
    --accent-hover: #4FC49E;
    --accent-light: rgba(62, 173, 138, 0.12);
    --accent-text: #3EAD8A;
    --btn-text: #0F1A1F;
    --surface: #0F1A1F;
    --surface-alt: #162530;
    --text: #E0E8E5;
    --text-secondary: #8BAAAB;
    --text-light: #E0E8E5;
    --border: #264050;
    --card-bg: #1A2D38;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --nav-bg: rgba(15, 26, 31, 0.85);
    --nav-bg-solid: rgba(15, 26, 31, 0.95);
    --hover-subtle: rgba(255, 255, 255, 0.06);
    --navy: #081218;
    --navy-light: #0C1820;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

html {
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.menu-open { overflow: hidden; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Utilities --- */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; top: -100%; left: var(--space-md);
    background: var(--accent); color: #FFFFFF; padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius); font-size: 0.875rem; z-index: 200; transition: top 0.15s ease;
}
.skip-link:focus { top: var(--space-sm); color: #FFFFFF; }

/* --- Container --- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}
.container-narrow { max-width: var(--container-narrow); }

/* --- Navigation --- */
.nav {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nav-height); z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}
@supports not (backdrop-filter: blur(1px)) {
    .nav { background: var(--nav-bg-solid); }
}
.nav-scrolled {
    box-shadow: 0 1px 0 var(--border);
    background: var(--nav-bg-solid);
}

.nav-inner {
    max-width: var(--container); margin: 0 auto; padding: 0 var(--space-lg);
    height: 100%; display: flex; align-items: center; justify-content: space-between;
}

.nav-logo {
    display: flex; align-items: center; gap: var(--space-sm);
    color: var(--text); transition: color 0.15s ease;
}
.nav-logo:hover { color: var(--accent); }

.nav-mark { width: 20px; height: 25px; }

.nav-wordmark {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.0625rem;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex; align-items: center; gap: var(--space-xl);
}
.nav-links a {
    color: var(--text-secondary); font-size: 0.9375rem; font-weight: 400;
    transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }

.nav-links .nav-cta {
    background: var(--accent); color: var(--btn-text);
    padding: 8px 20px; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-links .nav-cta:hover { background: var(--accent-hover); color: var(--btn-text); }
.nav-links .nav-cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.nav-actions { display: flex; align-items: center; gap: var(--space-xs); }

/* Theme toggle */
.theme-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary); width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); background: var(--hover-subtle); }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }

/* Hamburger */
.nav-toggle {
    display: none; background: none; border: none; cursor: pointer;
    width: 44px; height: 44px; position: relative;
}
.nav-toggle span {
    display: block; width: 20px; height: 1.5px; background: var(--text);
    position: absolute; left: 12px; transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span:first-child { top: 18px; }
.nav-toggle span:last-child { top: 25px; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg) translate(2.5px, 2.5px); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg) translate(2.5px, -2.5px); }

/* Mobile menu */
.mobile-menu {
    display: none; position: fixed; top: var(--nav-height); left: 0; right: 0; bottom: 0;
    background: var(--surface); z-index: 99; padding: var(--space-2xl) var(--space-lg);
    flex-direction: column; gap: var(--space-lg);
    overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    color: var(--text); font-size: 1.25rem; padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border); min-height: 44px;
    display: flex; align-items: center;
}

/* --- Hero --- */
.hero {
    padding: calc(var(--nav-height) + var(--space-5xl)) 0 var(--space-4xl);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3xl);
    align-items: center;
}

.hero-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.75rem, 7vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--text);
    max-width: 700px;
}

.hero-sub {
    margin-top: var(--space-xl);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 560px;
}

.hero-actions {
    margin-top: var(--space-xl);
    display: flex; gap: var(--space-md); flex-wrap: wrap;
}

.hero-mark {
    color: var(--accent);
    opacity: 0.12;
}
.hero-mark svg,
.hero-mark-svg {
    width: 160px;
    height: 200px;
}

.hero-trust {
    margin-top: var(--space-3xl);
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center;
    padding: 12px 28px; border-radius: var(--radius);
    font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 500;
    cursor: pointer; border: 1.5px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn-primary {
    background: var(--accent); color: var(--btn-text); border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover); border-color: var(--accent-hover); color: var(--btn-text);
    transform: translateY(-1px);
}
.btn-primary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn-ghost {
    background: transparent; color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--text-secondary); color: var(--text); }

/* --- Sections --- */
.section { padding: var(--space-4xl) 0; }
.section-compact { padding: var(--space-3xl) 0; }
.section-alt { background: var(--surface-alt); }
.section-dark { background: var(--navy); color: var(--text-light); }

.section-label {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    display: flex; align-items: center; gap: var(--space-sm);
}
.section-label::before {
    content: '';
    width: 12px; height: 2px;
    background: var(--accent);
    flex-shrink: 0;
}

.section-intro {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 720px;
    margin-bottom: var(--space-2xl);
}

/* --- Use Case Cards --- */
.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
}

.card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-2xl);
    display: flex; flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 16px var(--card-shadow);
}

.card-icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-light); border-radius: 12px;
    color: var(--accent); margin-bottom: var(--space-lg);
}
.card-icon svg { width: 24px; height: 24px; }

.card h3 {
    font-family: var(--font-sans); font-weight: 500;
    font-size: 1.1875rem; line-height: 1.35;
    color: var(--text); margin-bottom: var(--space-md);
}
.card p {
    font-size: 0.9375rem; line-height: 1.6; color: var(--text-secondary);
}

.card-stack {
    margin-top: auto; padding-top: var(--space-lg);
    display: flex; flex-wrap: wrap; gap: var(--space-sm);
}
.card-stack span {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--text-secondary); background: var(--surface);
    padding: 3px 10px; border-radius: 4px; border: 1px solid var(--border);
}
[data-theme="dark"] .card-stack span { background: var(--surface-alt); }

/* --- Data Protection Approaches --- */
.protection-approaches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.approach-card {
    padding: var(--space-xl);
    border-left: 2px solid var(--accent);
}

.approach-card h3 {
    font-family: var(--font-sans); font-weight: 500;
    font-size: 1.0625rem; line-height: 1.35;
    color: var(--text); margin-bottom: var(--space-sm);
}

.approach-card p {
    font-size: 0.9375rem; line-height: 1.6;
    color: var(--text-secondary); margin-bottom: var(--space-md);
}

.approach-card .card-stack {
    padding-top: 0; margin-top: 0;
}

/* --- Sovereignty --- */
.sovereignty-lead {
    font-size: 1.0625rem; line-height: 1.7;
    color: var(--text-secondary); max-width: 720px;
}
.providers {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg); margin-top: var(--space-2xl);
}
.provider { padding: var(--space-lg); border-left: 2px solid var(--accent); }
.provider-name { font-weight: 500; font-size: 1rem; color: var(--text); margin-bottom: var(--space-xs); }
.provider-detail { font-size: 0.875rem; line-height: 1.6; color: var(--text-secondary); }
.sovereignty-note {
    margin-top: var(--space-2xl); font-size: 0.875rem; line-height: 1.7;
    color: var(--text-secondary); max-width: 720px;
}

/* --- Steps --- */
.steps {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2xl);
}
.step { padding-top: var(--space-lg); border-top: 2px solid var(--accent); }
.step-num {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--text-secondary); display: block; margin-bottom: var(--space-md);
}
.step h3 { font-weight: 500; font-size: 1.0625rem; margin-bottom: var(--space-sm); color: var(--text); }
.step p { font-size: 0.9375rem; line-height: 1.55; color: var(--text-secondary); }

/* --- Honest section --- */
.honest-inner {
    border-left: 2px solid var(--accent); padding-left: var(--space-xl);
}
.honest-heading {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 500;
    line-height: 1.3; color: var(--text); margin-bottom: var(--space-lg);
}
.honest-text { font-size: 0.9375rem; line-height: 1.7; color: var(--text-secondary); }
.honest-text + .honest-text { margin-top: var(--space-md); }
.honest-cta { margin-top: var(--space-lg); font-size: 0.9375rem; font-weight: 500; }

/* --- About --- */
.about-heading {
    font-family: var(--font-display); font-size: 1.75rem; font-weight: 500;
    line-height: 1.3; color: var(--text); margin-bottom: var(--space-xl);
}
.about-text {
    font-size: 1.0625rem; line-height: 1.7;
    color: var(--text-secondary); margin-bottom: var(--space-lg);
}
.about-text:last-of-type { margin-bottom: 0; }

/* --- Contact --- */
.contact-heading {
    font-family: var(--font-display); font-size: 2rem; font-weight: 500;
    line-height: 1.2; color: var(--text-light); margin-bottom: var(--space-lg);
}
.contact-text {
    font-size: 1rem; line-height: 1.65;
    color: var(--contact-text); margin-bottom: var(--space-xl); max-width: 480px;
}
.section-dark .contact-email {
    display: inline-block; font-size: 1.5rem; font-weight: 400;
    color: var(--accent); transition: opacity 0.15s ease;
}
.section-dark .contact-email:hover { opacity: 0.8; color: var(--accent); }

/* --- Footer --- */
.footer { background: var(--navy-light); padding: var(--space-xl) 0; }
.footer-inner {
    max-width: var(--container); margin: 0 auto; padding: 0 var(--space-lg);
    display: flex; align-items: center; justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: var(--space-md); }
.footer-mark { width: 20px; height: 25px; color: var(--accent); }
.footer-wordmark {
    font-family: var(--font-display); font-weight: 500;
    font-size: 0.9375rem; color: var(--footer-text); letter-spacing: 0.06em;
}
.footer-links { display: flex; gap: var(--space-lg); }
.footer-links a {
    font-size: 0.8125rem; color: var(--footer-link); padding: var(--space-sm) 0;
    transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--footer-link-hover); }
.footer-meta {
    max-width: var(--container); margin: var(--space-md) auto 0;
    padding: var(--space-md) var(--space-lg) 0; border-top: 1px solid rgba(232, 230, 227, 0.08);
    display: flex; justify-content: center; gap: var(--space-sm);
    font-size: 0.75rem; color: var(--footer-link); flex-wrap: wrap;
}
/* --- Responsive --- */
@media (max-width: 900px) {
    .cards { grid-template-columns: 1fr; gap: var(--space-md); }
    .providers { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: repeat(2, 1fr); }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-mark { display: none; }
    .protection-approaches { grid-template-columns: 1fr; gap: var(--space-md); }
}

@media (max-width: 768px) {
    :root { --space-4xl: 64px; --space-5xl: 80px; }
    .nav-links { display: none; }
    .nav-toggle { display: block; }
    .hero-headline { font-size: 2.5rem; }
    .hero-sub { font-size: 1rem; }
    .steps { grid-template-columns: 1fr; }
    .providers { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; }
    .btn { text-align: center; justify-content: center; }
    .card { padding: var(--space-lg); }
    .footer-inner { flex-direction: column; gap: var(--space-md); text-align: center; }
    .footer-meta { flex-wrap: wrap; }

    .picker-panel {
        right: 12px; left: 12px;
        width: auto; max-width: 320px;
        bottom: 76px;
    }
    .logo-toggle {
        bottom: 16px; right: 16px;
    }
}

/* --- Scroll animations --- */
@media (prefers-reduced-motion: no-preference) {
    .card, .step, .provider, .approach-card {
        opacity: 0; transform: translateY(14px);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }
    .card.visible, .step.visible, .provider.visible, .approach-card.visible {
        opacity: 1; transform: translateY(0);
    }
    .card:nth-child(2) { transition-delay: 0.12s; }
    .card:nth-child(3) { transition-delay: 0.24s; }
    .card:nth-child(4) { transition-delay: 0.36s; }
    .card:nth-child(5) { transition-delay: 0.48s; }
    .step:nth-child(2) { transition-delay: 0.08s; }
    .step:nth-child(3) { transition-delay: 0.16s; }
    .step:nth-child(4) { transition-delay: 0.24s; }
    .provider:nth-child(2) { transition-delay: 0.12s; }
    .provider:nth-child(3) { transition-delay: 0.24s; }
    .provider:nth-child(4) { transition-delay: 0.36s; }
    .approach-card:nth-child(2) { transition-delay: 0.12s; }
    .approach-card:nth-child(3) { transition-delay: 0.24s; }
    .approach-card:nth-child(4) { transition-delay: 0.36s; }
    .approach-card:nth-child(5) { transition-delay: 0.48s; }
    .sovereignty-lead {
        opacity: 0; transform: translateY(14px);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }
    .sovereignty-lead.visible { opacity: 1; transform: translateY(0); }
    .honest-inner {
        opacity: 0; transform: translateX(-12px);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }
    .honest-inner.visible { opacity: 1; transform: translateX(0); }
}
