/* ========================================
   HOME / LANDING + SHARED PRIMITIVES - ROYAL HERITAGE
   Loaded on every page via base.html, so the first block only
   contains primitives other templates rely on (.btn family,
   .logo, ambient background, video modal). Landing-page layout
   lives under the "Landing" heading and is scoped to its own
   class names. All colours/spacing come from --bl-* tokens in
   base.css.
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--bl-font-body);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bl-bg);
    color: var(--bl-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

img,
video,
svg {
    max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Ambient background wash */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at 15% 15%, var(--bl-info-soft) 0%, transparent 45%),
                radial-gradient(circle at 85% 85%, var(--bl-accent-soft) 0%, transparent 45%),
                var(--bl-bg);
    opacity: 0.9;
}

.glow-sphere {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--bl-info-soft) 0%, transparent 70%);
    filter: blur(80px);
    border-radius: 50%;
    animation: bl-drift 20s infinite alternate;
}

@keyframes bl-drift {
    from { transform: translate(-30%, -30%); }
    to { transform: translate(30%, 30%); }
}

/* Brand lockup (footer + standalone headers) */
.logo {
    display: flex;
    align-items: center;
    gap: var(--bl-space-3);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.logo-img {
    height: 80px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    background: var(--bl-gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
    min-height: 48px;
    padding: 12px 28px;
    border-radius: var(--bl-radius-pill);
    font-size: var(--bl-text-md);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--bl-space-2);
    line-height: 1.2;
    text-align: center;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--bl-primary), var(--bl-secondary));
    color: var(--bl-surface);
    box-shadow: var(--bl-shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--bl-primary-hover), var(--bl-secondary));
    transform: translateY(-2px);
    box-shadow: var(--bl-shadow-lg);
}

.btn-secondary {
    background: var(--bl-surface);
    color: var(--bl-text-primary);
    border-color: var(--bl-border-focus);
    box-shadow: var(--bl-shadow-sm);
}

.btn-secondary:hover {
    background: var(--bl-surface-subtle);
    border-color: var(--bl-text-muted);
    transform: translateY(-2px);
    box-shadow: var(--bl-shadow-md);
}

.btn-icon {
    width: 1.4em;
    height: 1.4em;
    object-fit: contain;
}

.btn-full {
    width: 100%;
}

/* ---------- Demo video modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bl-deep-slate);
    background: color-mix(in srgb, var(--bl-deep-slate) 80%, transparent);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-overlay .video-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 1000px);
    max-width: 92vw;
    max-height: 86vh;
    aspect-ratio: 16 / 9;
    background: var(--bl-deep-slate);
    border-radius: var(--bl-radius-lg);
    overflow: hidden;
    box-shadow: var(--bl-shadow-lg);
}

.modal-close-btn {
    position: absolute;
    top: var(--bl-space-3);
    right: var(--bl-space-3);
    width: 44px;
    height: 44px;
    background: var(--bl-deep-slate);
    color: var(--bl-surface);
    border: 1px solid var(--bl-surface);
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.modal-close-btn .icon {
    width: 20px;
    height: 20px;
}

.modal-close-btn:hover {
    background: var(--bl-primary);
    transform: scale(1.06);
}

.video-wrapper,
.video-wrapper video {
    width: 100%;
    height: 100%;
}

.video-wrapper video {
    object-fit: contain;
}

/* ========================================
   LANDING PAGE (home.html)
   ======================================== */

.landing {
    width: 100%;
}

.landing-section {
    padding: var(--bl-space-6) clamp(var(--bl-space-4), 6vw, 8%);
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.landing-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--bl-space-2);
    padding: var(--bl-space-1) var(--bl-space-3);
    border-radius: var(--bl-radius-pill);
    background: var(--bl-accent-soft);
    color: var(--bl-accent-hover);
    font-size: var(--bl-text-sm);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: var(--bl-space-4);
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: clamp(var(--bl-space-5), 5vw, 80px);
    padding-top: var(--bl-space-6);
    padding-bottom: var(--bl-space-6);
    position: relative;
    z-index: 5;
}

.hero-content {
    text-align: left;
    position: relative;
}

.hero h1 {
    font-family: var(--bl-font-display);
    font-size: clamp(2.25rem, 5.2vw, 3.9rem);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: var(--bl-space-4);
    color: var(--bl-primary);
    letter-spacing: -0.01em;
}

.hero h1 .brand-highlight {
    color: var(--bl-accent-hover);
    font-style: italic;
}

.hero-lead {
    font-size: var(--bl-text-lg);
    max-width: 36rem;
    color: var(--bl-text-secondary);
    line-height: 1.65;
    margin-bottom: var(--bl-space-5);
}

.cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bl-space-3);
    justify-content: flex-start;
}

.hero-assurances {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--bl-space-2) var(--bl-space-5);
    margin-top: var(--bl-space-5);
    color: var(--bl-text-secondary);
    font-size: var(--bl-text-sm);
    font-weight: 500;
}

.hero-assurances li {
    display: inline-flex;
    align-items: center;
    gap: var(--bl-space-2);
}

.hero-assurances svg {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--bl-success);
}

.watch-demo-btn {
    background: var(--bl-info-soft);
    border-color: var(--bl-info);
    color: var(--bl-primary);
}

.watch-demo-btn:hover {
    background: var(--bl-surface);
    border-color: var(--bl-primary);
}

.play-icon {
    width: 18px;
    height: 18px;
    flex: none;
}

.hero-tree {
    display: block;
    width: min(100%, 360px);
    height: auto;
    margin-top: var(--bl-space-6);
    opacity: 0.95;
}

.hero-tree-wrap {
    display: block;
}

/* Decorative family-tree illustration (heritage palette) */
.tree-bg {
    fill: var(--bl-parchment);
    stroke: var(--bl-parchment-dark);
    stroke-width: 2;
}

.tree-branch {
    stroke: var(--bl-bark);
}

.tree-ground {
    stroke: var(--bl-bark-dark);
}

.tree-node {
    fill: var(--bl-leaf);
    stroke: var(--bl-parchment);
    stroke-width: 3;
}

.tree-node--gold {
    fill: var(--bl-accent);
}

#auth-section {
    scroll-margin-top: calc(var(--bl-nav-height) + var(--bl-space-4));
}

/* Feature sections */
.landing-heading {
    text-align: center;
    max-width: 40rem;
    margin: 0 auto var(--bl-space-6);
}

.landing-heading h2 {
    font-family: var(--bl-font-display);
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
    font-weight: 700;
    color: var(--bl-primary);
    margin-bottom: var(--bl-space-3);
}

.landing-heading p {
    color: var(--bl-text-secondary);
    font-size: var(--bl-text-md);
    line-height: 1.65;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: var(--bl-space-5);
}

.feature-card {
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    padding: var(--bl-space-6) var(--bl-space-5);
    border-radius: var(--bl-radius-lg);
    box-shadow: var(--bl-shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.feature-card:hover {
    border-color: var(--bl-secondary);
    transform: translateY(-4px);
    box-shadow: var(--bl-shadow-md);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--bl-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bl-parchment);
    border: 1px solid var(--bl-parchment-dark);
    color: var(--bl-bark);
    margin-bottom: var(--bl-space-4);
}

.feature-icon svg {
    width: 26px;
    height: 26px;
}

.feature-card h3 {
    font-size: var(--bl-text-xl);
    margin-bottom: var(--bl-space-2);
    color: var(--bl-deep-slate);
    font-weight: 700;
}

.feature-card p {
    color: var(--bl-text-secondary);
    line-height: 1.6;
    font-size: var(--bl-text-md);
}

/* How it works */
.steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: var(--bl-space-5);
    counter-reset: step;
}

.steps li {
    position: relative;
    padding: var(--bl-space-5);
    padding-top: var(--bl-space-6);
    background: var(--bl-surface-subtle);
    border-radius: var(--bl-radius-lg);
    border: 1px solid var(--bl-border);
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    top: calc(var(--bl-space-4) * -1);
    left: var(--bl-space-5);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bl-primary);
    color: var(--bl-surface);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.steps h3 {
    font-size: var(--bl-text-lg);
    color: var(--bl-deep-slate);
    margin-bottom: var(--bl-space-2);
}

.steps p {
    color: var(--bl-text-secondary);
    line-height: 1.6;
}

/* Closing call to action */
.landing-cta {
    background: var(--bl-parchment);
    border: 1px solid var(--bl-parchment-dark);
    border-radius: var(--bl-radius-lg);
    padding: var(--bl-space-6) var(--bl-space-5);
    text-align: center;
    margin-bottom: var(--bl-space-6);
}

.landing-cta-wrap {
    padding-top: 0;
}

.landing-cta h2 {
    font-family: var(--bl-font-display);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    color: var(--bl-bark-dark);
    margin-bottom: var(--bl-space-2);
}

.landing-cta p {
    color: var(--bl-bark-dark);
    max-width: 34rem;
    margin: 0 auto var(--bl-space-5);
    line-height: 1.6;
}

.landing-cta .cta-group {
    justify-content: center;
}

/* Tablet / phone */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        gap: var(--bl-space-6);
    }

    .hero-content,
    .hero h1,
    .hero-lead {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .cta-group,
    .hero-assurances {
        justify-content: center;
    }

    .hero-tree-wrap {
        display: none;
    }
}

@media (max-width: 768px) {
    /* base.css forces h1 to 1.6rem on phones; keep the hero headline prominent */
    .hero h1 {
        font-size: clamp(2rem, 9vw, 2.6rem) !important;
    }
}

@media (max-width: 480px) {
    .cta-group .btn {
        width: 100%;
    }

    .landing-section {
        padding-top: var(--bl-space-5);
        padding-bottom: var(--bl-space-5);
    }
}
