:root {
    --rt-primary: #2f6f5e;
    --rt-primary-dark: #234f43;
    --rt-primary-light: #e8f2ef;
    --rt-accent: #d97757;
    --rt-accent-light: #fbe9e2;
    --rt-ink: #1f2a27;
    --rt-muted: #6b7a76;
    --rt-surface: #ffffff;
    --rt-bg: #f6f8f7;
    --rt-border: #e3e9e6;
    --rt-shadow: 0 8px 24px -12px rgba(31, 42, 39, .18);
    --rt-shadow-lg: 0 20px 48px -16px rgba(31, 42, 39, .28);
    --rt-radius: 16px;
    --rt-transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--rt-border) transparent;
}

body {
    background-color: var(--rt-bg);
    color: var(--rt-ink);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand {
    font-family: 'Poppins', 'Inter', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    transition: color var(--rt-transition);
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: transform var(--rt-transition), box-shadow var(--rt-transition), background-color var(--rt-transition), border-color var(--rt-transition), color var(--rt-transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--rt-primary);
    border-color: var(--rt-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--rt-primary-dark);
    border-color: var(--rt-primary-dark);
    box-shadow: 0 8px 20px -8px rgba(47, 111, 94, .55);
}

.btn-outline-primary {
    color: var(--rt-primary);
    border-color: var(--rt-primary);
}

.btn-outline-primary:hover {
    background-color: var(--rt-primary);
    border-color: var(--rt-primary);
    box-shadow: 0 8px 20px -8px rgba(47, 111, 94, .45);
}

.text-primary {
    color: var(--rt-primary) !important;
}

.bg-primary {
    background-color: var(--rt-primary) !important;
}

/* Cards */
.card {
    border-radius: var(--rt-radius);
    box-shadow: var(--rt-shadow);
    transition: box-shadow var(--rt-transition), transform var(--rt-transition);
    animation: rt-fade-up 420ms cubic-bezier(.16, 1, .3, 1) both;
}

.card.card-hoverable:hover {
    transform: translateY(-3px);
    box-shadow: var(--rt-shadow-lg);
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: var(--rt-border);
    transition: border-color var(--rt-transition), box-shadow var(--rt-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--rt-primary);
    box-shadow: 0 0 0 .2rem rgba(47, 111, 94, .15);
}

.input-group-text {
    background-color: var(--rt-primary-light);
    border-color: var(--rt-border);
    color: var(--rt-primary);
}

/* Sticky app navbar */
.navbar-app {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rt-border);
    transition: box-shadow var(--rt-transition);
}

.navbar-app.is-scrolled {
    box-shadow: 0 4px 20px -12px rgba(31, 42, 39, .25);
}

.navbar-app .navbar-brand i {
    color: var(--rt-primary);
}

.navbar-app .nav-link {
    font-weight: 500;
    color: var(--rt-ink);
    position: relative;
}

.navbar-app .nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--rt-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--rt-transition);
}

.navbar-app .nav-link:hover::after {
    transform: scaleX(1);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--rt-radius);
    box-shadow: var(--rt-shadow-lg);
}

.modal.fade .modal-dialog {
    transform: translateY(24px) scale(.98);
    transition: transform 260ms cubic-bezier(.16, 1, .3, 1), opacity 260ms ease;
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* Person edit modal: pill-style tabs instead of Bootstrap's default
 * underline tabs, matching the app's rounded/soft visual language. */
.modal-body .nav-tabs {
    border-bottom: none;
    background: var(--rt-bg, #f4f7f6);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.modal-body .nav-tabs .nav-link {
    border: none;
    border-radius: 999px;
    color: var(--rt-text-muted, #6b7a76);
    font-size: .875rem;
    font-weight: 500;
    padding: .45rem 1rem;
    transition: background-color var(--rt-transition), color var(--rt-transition);
}

.modal-body .nav-tabs .nav-link:hover {
    background: rgba(47, 111, 94, .08);
    color: var(--rt-primary);
}

.modal-body .nav-tabs .nav-link.active {
    background: var(--rt-primary);
    color: #fff;
    box-shadow: var(--rt-shadow);
}

.modal-body .dropzone {
    border-style: dashed !important;
    border-color: var(--rt-border) !important;
    background: var(--rt-bg, #f4f7f6);
    transition: border-color var(--rt-transition), background-color var(--rt-transition);
}

.modal-body .dropzone:hover {
    border-color: var(--rt-primary) !important;
    background: var(--rt-primary-light);
}

/* Fade-up entrance utility */
@keyframes rt-fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rt-fade-up {
    animation: rt-fade-up 420ms cubic-bezier(.16, 1, .3, 1) both;
}

/* Opacity-only entrance for SVG elements positioned via transform attribute. */
@keyframes rt-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Tree canvas */
.tree-canvas {
    width: 100%;
    height: 70vh;
    min-height: 480px;
    overflow: auto;
    touch-action: none;
    background:
        radial-gradient(circle at 1px 1px, var(--rt-border) 1px, transparent 0) 0 0 / 24px 24px;
    border-radius: var(--rt-radius);
    border: 1px solid var(--rt-border);
    background-color: var(--rt-surface);
}

/*
 * .tree-card / .tree-add-button are SVG <g> elements positioned via a
 * transform="translate(x, y)" *attribute* (set by d3 in tree_controller.js).
 * A CSS `transform` (including one driven by an animation) always overrides
 * that attribute per the SVG/CSS transforms spec, so their entrance
 * animation must only touch opacity — never transform — or every card
 * collapses to the SVG's origin (top-left).
 */
.tree-card {
    cursor: pointer;
    transition: filter var(--rt-transition);
    opacity: 0;
    animation: rt-fade-in 320ms ease forwards;
}

.tree-card:hover {
    filter: drop-shadow(0 10px 16px rgba(31, 42, 39, .18));
}

.tree-add-button {
    cursor: pointer;
    opacity: 0;
    animation: rt-fade-in 320ms ease forwards;
    transition: opacity var(--rt-transition);
}

.tree-add-button:hover {
    opacity: .85;
}

.tree-edit-button {
    opacity: 0;
    transition: opacity var(--rt-transition);
}

.tree-card:hover .tree-edit-button {
    opacity: 1;
}

.tree-viewport.is-animated {
    transition: transform 220ms cubic-bezier(.4, 0, .2, 1);
}

.tree-toolbar {
    display: flex;
    gap: .5rem;
}

.tree-toolbar .btn {
    box-shadow: var(--rt-shadow);
}

/* Ancestry map (person.map, ancestry_map_controller.js) */
.rt-map-canvas {
    width: 100%;
    height: 70vh;
    min-height: 420px;
    border-radius: var(--rt-radius);
    border: 1px solid var(--rt-border);
    background-color: var(--rt-surface);
}

/* jsVectorMap's own hover handling overwrites a region's inline
 * fill on mouseenter and doesn't reliably restore it on mouseleave — an
 * !important stylesheet rule beats anything it sets afterward, keeping
 * our per-region color stable through hover (ancestry_map_controller.js). */
.rt-map-region-colored {
    fill: var(--rt-region-fill) !important;
}

.rt-map-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .rt-fade-up,
    .tree-card,
    .tree-add-button {
        animation: none !important;
        opacity: 1 !important;
    }

    .btn:hover,
    .modal.fade .modal-dialog {
        transform: none !important;
    }
}

/* ==========================================================================
   Landing page (templates/public/landing.html.twig + legal pages)
   ========================================================================== */

/* Solid, in-flow bar (not overlaid on the hero video) — the hero used to
   sit underneath it full-bleed, but the video's own on-screen text ended
   up clashing with the nav content, so the bar now takes up real space
   and the hero starts right below it. Stays sticky while scrolling. */
.landing-navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: .85rem 0;
    background: rgba(20, 32, 28, .96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: box-shadow var(--rt-transition), padding var(--rt-transition);
}

.landing-navbar .navbar-brand {
    color: #fff;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
}

.landing-navbar.is-scrolled {
    padding: .6rem 0;
    box-shadow: var(--rt-shadow);
}

.landing-hero {
    position: relative;
    min-height: calc(100vh - 74px);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--rt-primary-dark);
}

.landing-hero-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.landing-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(180deg, rgba(20, 32, 28, .78) 0%, rgba(20, 32, 28, .55) 45%, rgba(20, 32, 28, .88) 100%);
}

.landing-hero-content {
    position: relative;
    z-index: 3;
    color: #fff;
}

.landing-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    color: #fff;
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .02em;
    backdrop-filter: blur(6px);
    animation: rt-fade-up 600ms cubic-bezier(.16, 1, .3, 1) both;
}

.landing-hero-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6ee7b7;
    box-shadow: 0 0 0 0 rgba(110, 231, 183, .6);
    animation: rt-pulse 2s infinite;
}

@keyframes rt-pulse {
    0% { box-shadow: 0 0 0 0 rgba(110, 231, 183, .55); }
    70% { box-shadow: 0 0 0 8px rgba(110, 231, 183, 0); }
    100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

.landing-hero-title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    line-height: 1.12;
    margin: 1.25rem 0 1.1rem;
    animation: rt-fade-up 700ms 80ms cubic-bezier(.16, 1, .3, 1) both;
}

.landing-hero-subtitle {
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    color: rgba(255, 255, 255, .86);
    max-width: 620px;
    margin-bottom: 2rem;
    animation: rt-fade-up 700ms 160ms cubic-bezier(.16, 1, .3, 1) both;
}

.landing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    animation: rt-fade-up 700ms 240ms cubic-bezier(.16, 1, .3, 1) both;
}

.btn-landing-primary {
    background: var(--rt-accent);
    border-color: var(--rt-accent);
    color: #fff;
    font-weight: 600;
    padding: .85rem 1.6rem;
    border-radius: 12px;
    box-shadow: 0 12px 28px -10px rgba(217, 119, 87, .55);
    transition: transform var(--rt-transition), box-shadow var(--rt-transition), background-color var(--rt-transition);
}

.btn-landing-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px -10px rgba(217, 119, 87, .65);
    background: #c56a4d;
    color: #fff;
}

.btn-landing-secondary {
    background: rgba(255, 255, 255, .08);
    border: 1.5px solid rgba(255, 255, 255, .5);
    color: #fff;
    font-weight: 600;
    padding: .85rem 1.6rem;
    border-radius: 12px;
    backdrop-filter: blur(6px);
    transition: transform var(--rt-transition), background-color var(--rt-transition), border-color var(--rt-transition);
}

.btn-landing-secondary:hover {
    background: rgba(255, 255, 255, .18);
    border-color: #fff;
    color: #fff;
    transform: translateY(-2px);
}

.landing-hero-scroll {
    position: absolute;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    color: rgba(255, 255, 255, .75);
    font-size: 1.4rem;
    animation: rt-bounce 2.2s ease-in-out infinite;
}

@keyframes rt-bounce {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 10px); }
}

/* Section reveal-on-scroll, driven by IntersectionObserver in
   assets/controllers/landing_controller.js toggling .is-visible. */
.landing-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms cubic-bezier(.16, 1, .3, 1), transform 700ms cubic-bezier(.16, 1, .3, 1);
}

.landing-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.landing-section {
    padding: 6rem 0;
}

.landing-section-label {
    display: inline-block;
    color: var(--rt-primary);
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .6rem;
}

.landing-section-title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    color: var(--rt-ink);
}

.landing-legacy {
    background: linear-gradient(135deg, var(--rt-primary) 0%, var(--rt-primary-dark) 100%);
    color: #fff;
    border-radius: 28px;
    padding: 3.5rem;
    position: relative;
    overflow: hidden;
}

.landing-legacy::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .12) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    opacity: .5;
}

.landing-legacy-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(255, 255, 255, .16);
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.landing-legacy-points {
    position: relative;
    list-style: none;
    padding: 0;
    margin: 1.75rem 0 0;
    display: grid;
    gap: .9rem;
}

.landing-legacy-points li {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    font-weight: 500;
}

.landing-legacy-points i {
    color: #6ee7b7;
    margin-top: .2rem;
}

.landing-feature-card {
    border: 1px solid var(--rt-border);
    border-radius: 20px;
    padding: 2.25rem 1.75rem;
    height: 100%;
    background: #fff;
    transition: transform var(--rt-transition), box-shadow var(--rt-transition), border-color var(--rt-transition);
}

.landing-feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--rt-shadow-lg);
    border-color: transparent;
}

.landing-feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--rt-primary-light);
    color: var(--rt-primary);
    margin-bottom: 1.25rem;
    transition: transform var(--rt-transition);
}

.landing-feature-card:hover .landing-feature-icon {
    transform: scale(1.08) rotate(-4deg);
}

.landing-steps {
    counter-reset: rt-step;
}

.landing-step {
    position: relative;
    padding-left: 4.25rem;
    min-height: 3.5rem;
}

.landing-step + .landing-step {
    margin-top: 2.25rem;
}

.landing-step::before {
    counter-increment: rt-step;
    content: counter(rt-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: var(--rt-primary);
    color: #fff;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-cta {
    background: var(--rt-ink);
    color: #fff;
    border-radius: 28px;
    padding: 4rem 2rem;
    text-align: center;
}

.landing-footer {
    background: var(--rt-ink);
    color: rgba(255, 255, 255, .7);
    padding: 4rem 0 2rem;
}

.landing-footer a {
    color: rgba(255, 255, 255, .7);
    text-decoration: none;
    transition: color var(--rt-transition);
}

.landing-footer a:hover {
    color: #fff;
}

.landing-footer h6 {
    color: #fff;
    font-weight: 700;
    margin-bottom: 1rem;
}

.landing-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .12);
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    font-size: .85rem;
}

.landing-lang-dropdown .dropdown-menu {
    max-height: 320px;
    overflow-y: auto;
}

.landing-whatsapp-float {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1050;
    height: 60px;
    max-width: 60px;
    border-radius: 30px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    box-shadow: 0 10px 26px -6px rgba(37, 211, 102, .6);
    transition: transform var(--rt-transition), box-shadow var(--rt-transition), max-width 320ms cubic-bezier(.4, 0, .2, 1);
    animation: rt-fade-up 600ms 400ms cubic-bezier(.16, 1, .3, 1) both;
}

.landing-whatsapp-float:hover,
.landing-whatsapp-float:focus-visible {
    max-width: 280px;
    transform: scale(1.03);
    box-shadow: 0 14px 32px -6px rgba(37, 211, 102, .7);
    color: #fff;
    text-decoration: none;
}

.landing-whatsapp-float-icon {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
}

.landing-whatsapp-float-label {
    white-space: nowrap;
    font-weight: 600;
    font-size: .92rem;
    padding-right: 1.25rem;
    opacity: 0;
    transition: opacity 200ms ease 80ms;
}

.landing-whatsapp-float:hover .landing-whatsapp-float-label,
.landing-whatsapp-float:focus-visible .landing-whatsapp-float-label {
    opacity: 1;
}

.landing-whatsapp-float::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 30px;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, .5);
    animation: rt-pulse-wa 2.4s infinite;
    pointer-events: none;
}

@keyframes rt-pulse-wa {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .5); }
    70% { box-shadow: 0 0 0 14px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.legal-page h1 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
}

.legal-page h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 2rem;
}

.landing-cookie-bar {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1060;
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    color: var(--rt-ink);
    border-radius: 16px;
    box-shadow: var(--rt-shadow-lg);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    transform: translateY(140%);
    opacity: 0;
    transition: transform 320ms cubic-bezier(.16, 1, .3, 1), opacity 320ms cubic-bezier(.16, 1, .3, 1);
}

.landing-cookie-bar.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.landing-cookie-bar p {
    margin: 0;
    font-size: .88rem;
    flex: 1 1 260px;
}

.landing-cookie-bar a {
    color: var(--rt-primary);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .landing-reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    .landing-hero-badge,
    .landing-hero-title,
    .landing-hero-subtitle,
    .landing-hero-actions,
    .landing-whatsapp-float {
        animation: none !important;
    }
}
