/* Family Heritage - Custom Styles & Tree Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Playfair Display', Georgia, Cambria, serif;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-serif-heading {
    font-family: var(--font-serif);
}

/* Subtle transitions and elevation */
.card-hover-effect {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-hover-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(15, 23, 42, 0.08);
}

/* ============================================================
   TREE CANVAS & VISUALIZATION STYLES
   ============================================================ */

.tree-workspace {
    position: relative;
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 560px;
    overflow: hidden;
    background-color: #fafaf9;
    background-image: radial-gradient(#d6d3d1 1px, transparent 1px);
    background-size: 24px 24px;
    user-select: none;
    touch-action: none;
    cursor: grab;
}

.tree-workspace.is-panning {
    cursor: grabbing;
}

.tree-canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
}

.tree-nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: auto;
}

/* Presentation Mode (Full Screen Canvas) */
body.presentation-mode {
    overflow: hidden !important;
}

body.presentation-mode header,
body.presentation-mode footer,
body.presentation-mode .tree-hide-on-presentation {
    display: none !important;
}

body.presentation-mode .tree-workspace {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000 !important;
    border-radius: 0 !important;
    border: none !important;
}

/* Generation Level Indicator Rails */
.generation-marker {
    position: absolute;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 1;
}

.generation-badge {
    background-color: rgba(245, 245, 244, 0.95);
    border: 1px solid rgba(214, 211, 209, 0.8);
    backdrop-filter: blur(4px);
    color: #57534e;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 9999px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Tree Person Card */
.tree-node-card {
    position: absolute;
    width: 220px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e7e5e4;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.tree-node-card:hover {
    border-color: #357260;
    box-shadow: 0 12px 24px -4px rgba(44, 91, 78, 0.15), 0 4px 8px -2px rgba(44, 91, 78, 0.06);
    transform: translateY(-2px);
    z-index: 20 !important;
}

/* Focused / Highlighted Node */
.tree-node-card.is-focused {
    border-color: #2c5b4e !important;
    box-shadow: 0 0 0 4px rgba(53, 114, 96, 0.25), 0 12px 28px -4px rgba(44, 91, 78, 0.3) !important;
    animation: pulse-ring 2.5s infinite;
    z-index: 30 !important;
}

.tree-node-card.is-dimmed {
    opacity: 0.25;
    filter: grayscale(80%);
    pointer-events: none;
}

@keyframes pulse-ring {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(53, 114, 96, 0.35), 0 12px 28px -4px rgba(44, 91, 78, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(53, 114, 96, 0.1), 0 12px 28px -4px rgba(44, 91, 78, 0.3);
    }
}

/* Deceased Badge Indicator */
.deceased-marker {
    color: #a8a29e;
    font-size: 10px;
    font-weight: 500;
}

/* Branch Collapse/Expand Toggle Button */
.branch-toggle-btn {
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background-color: #ffffff;
    border: 1.5px solid #d6d3d1;
    color: #57534e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 15;
}

.branch-toggle-btn:hover {
    background-color: #357260;
    border-color: #357260;
    color: #ffffff;
    transform: translateX(-50%) scale(1.1);
}

.branch-toggle-btn.is-collapsed {
    background-color: #78716c;
    border-color: #78716c;
    color: #ffffff;
}

/* SVG Line Connectors */
.line-spouse {
    stroke: #e11d48;
    stroke-width: 2.5px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-spouse-badge {
    fill: #ffffff;
    stroke: #e11d48;
    stroke-width: 1.5px;
}

.line-parent-child {
    stroke: #78716c;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.line-parent-child.is-adoptive {
    stroke: #2563eb;
    stroke-dasharray: 4 4;
}

.line-parent-child.is-step {
    stroke: #d97706;
    stroke-dasharray: 4 4;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f5f5f4;
}
::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a8a29e;
}
