/* 🐘 Royal Tuskers of Sri Dalada Maligawa - Custom Design System */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Gemunu+Libre:wght@400;600;700;800&family=Noto+Sans+Sinhala:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --gold-primary: #d97706;
    --gold-bright: #ffd700;
    --maroon-deep: #400000;
    --maroon-dark: #2b0000;
    --onyx-bg: #0c0a09;
}

body {
    font-family: 'Noto Sans Sinhala', 'Plus Jakarta Sans', sans-serif;
    background-color: #0c0a09;
    color: #f1f5f9;
    overflow-x: hidden;
}

.font-display {
    font-family: 'Gemunu Libre', 'Noto Sans Sinhala', sans-serif;
}

.font-cinzel {
    font-family: 'Cinzel Decorative', serif;
}

/* Glassmorphism Panels */
.glass-panel {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.glass-panel-gold {
    background: linear-gradient(135deg, rgba(69, 26, 3, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Golden Glow Effects */
.glow-gold {
    box-shadow: 0 0 25px rgba(217, 119, 6, 0.35);
}

.glow-gold-text {
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}

/* 3D Canvas Containers */
.canvas-container-3d {
    position: relative;
    width: 100%;
    height: 480px;
    border-radius: 1.25rem;
    overflow: hidden;
    background: radial-gradient(circle at center, #1c1917 0%, #0c0a09 100%);
}

@media (min-width: 768px) {
    .canvas-container-3d {
        height: 560px;
    }
}

.compare-canvas-3d {
    position: relative;
    width: 100%;
    height: 420px;
    border-radius: 1.25rem;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

@media (min-width: 768px) {
    .compare-canvas-3d {
        height: 480px;
    }
}

/* Floating 3D Dimension Badge */
.dim-badge {
    animation: floatGlow 3s ease-in-out infinite alternate;
}

@keyframes floatGlow {
    0% {
        transform: translateY(0px);
        box-shadow: 0 4px 15px rgba(217, 119, 6, 0.2);
    }
    100% {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(217, 119, 6, 0.45);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0c0a09;
}

::-webkit-scrollbar-thumb {
    background: #78350f;
    border-radius: 5px;
    border: 2px solid #0c0a09;
}

::-webkit-scrollbar-thumb:hover {
    background: #d97706;
}

/* Torchlight Embers Effect in Background */
.torch-ember {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #f59e0b;
    border-radius: 50%;
    pointer-events: none;
    animation: emberRise 4s linear infinite;
}

@keyframes emberRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-200px) translateX(20px) scale(0.2);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   🔄 360° TURNTABLE — museum plinth, drag to rotate, true-scale overlay
   ═══════════════════════════════════════════════════════════════════ */

.tt {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.tt-stage {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 1.25rem;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    background:
        radial-gradient(ellipse 60% 34% at 50% 88%, rgba(217, 119, 6, 0.16) 0%, transparent 70%),
        radial-gradient(ellipse at 50% 38%, #221d18 0%, #100d0b 58%, #080706 100%);
    border: 1px solid rgba(217, 119, 6, 0.28);
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.85), 0 18px 50px rgba(0, 0, 0, 0.5);
}

.tt-stage:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
}

.tt-stage.is-dragging { cursor: grabbing; }

/* The plinth the animal appears to stand on. */
.tt-stage::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4%;
    width: 62%;
    height: 5%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, transparent 72%);
    pointer-events: none;
}

.tt-canvas,
.tt-scale {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.tt-canvas { z-index: 1; }
.tt-scale  { z-index: 2; opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }
.tt-scale.is-on { opacity: 1; }

/* Measurement furniture */
.tt-rod       { stroke: rgba(251, 191, 36, 0.85); stroke-width: 3; }
.tt-tick      { stroke: rgba(251, 191, 36, 0.7);  stroke-width: 2; }
.tt-ground    { stroke: rgba(251, 191, 36, 0.35); stroke-width: 2; stroke-dasharray: 10 9; }
.tt-shoulder  { stroke: var(--gold-bright); stroke-width: 2.5; stroke-dasharray: 14 8; }
.tt-human     { fill: rgba(226, 232, 240, 0.5); }
.tt-tick-label,
.tt-human-label { fill: rgba(251, 191, 36, 0.85); font-size: 26px; font-family: 'Inter', sans-serif; text-anchor: end; }
.tt-human-label { text-anchor: middle; fill: rgba(226, 232, 240, 0.75); }
.tt-measure     { fill: var(--gold-bright); font-size: 42px; font-weight: 700; font-family: 'Cinzel Decorative', serif; }
.tt-measure-sub { fill: rgba(251, 191, 36, 0.7); font-size: 26px; font-family: 'Inter', sans-serif; }

.tt-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    background: rgba(8, 7, 6, 0.85);
    color: var(--gold-bright);
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
}

.tt-fail { font-size: 0.95rem; color: rgba(251, 191, 36, 0.6); letter-spacing: 0.04em; }

.tt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.tt-btn {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(217, 119, 6, 0.4);
    background: rgba(69, 26, 3, 0.35);
    color: #fcd34d;
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tt-btn:hover { background: rgba(120, 53, 15, 0.5); border-color: rgba(251, 191, 36, 0.7); }
.tt-btn.is-off { opacity: 0.45; }
.tt-btn.is-on  { background: var(--gold-primary); color: #1c1207; border-color: var(--gold-bright); }
.tt-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.tt-readout {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.05rem;
    color: rgba(251, 191, 36, 0.9);
    min-width: 4.2rem;
    text-align: center;
}

.tt-hint {
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(214, 211, 209, 0.42);
}

/* ═══════════════════════════════════════════════════════════════════
   🕰️ LIFE-EVENT TIMELINE
   ═══════════════════════════════════════════════════════════════════ */

.tl { position: relative; padding-left: 2.6rem; }

.tl::before {
    content: "";
    position: absolute;
    left: 0.72rem;
    top: 0.6rem;
    bottom: 0.6rem;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(217, 119, 6, 0.55) 12%, rgba(217, 119, 6, 0.55) 88%, transparent);
}

.tl-item { position: relative; padding-bottom: 2.4rem; }

.tl-dot {
    position: absolute;
    left: -2.6rem;
    top: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #100d0b;
    border: 2px solid var(--gold-primary);
    box-shadow: 0 0 0 4px rgba(12, 10, 9, 1), 0 0 18px rgba(217, 119, 6, 0.4);
    font-size: 0.7rem;
}

.tl-item[data-kind="death"]  .tl-dot { border-color: #7f1d1d; box-shadow: 0 0 0 4px #0c0a09, 0 0 18px rgba(127, 29, 29, 0.6); }
.tl-item[data-kind="ordeal"] .tl-dot { border-color: #b45309; }
.tl-item[data-kind="honour"] .tl-dot { border-color: var(--gold-bright); box-shadow: 0 0 0 4px #0c0a09, 0 0 22px rgba(255, 215, 0, 0.55); }
.tl-item[data-kind="legacy"] .tl-dot { border-color: #a8a29e; }

.tl-year {
    font-family: 'Cinzel Decorative', serif;
    font-size: 0.95rem;
    color: var(--gold-bright);
    letter-spacing: 0.05em;
}

.tl-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: #fef3c7;
    margin: 0.2rem 0 0.45rem;
    line-height: 1.35;
}

.tl-text { color: #d6d3d1; line-height: 1.85; font-size: 0.97rem; }

.tl-img {
    margin-top: 1rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(217, 119, 6, 0.3);
    max-width: 100%;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   📐 3D SCALE ARENA
   ═══════════════════════════════════════════════════════════════════ */

.arena-stage {
    position: relative;
    width: 100%;
    height: min(70vh, 620px);
    border-radius: 1.25rem;
    overflow: hidden;
    border: 1px solid rgba(217, 119, 6, 0.28);
    background: radial-gradient(ellipse at 50% 30%, #1b1712 0%, #0b0908 70%);
    cursor: grab;
    touch-action: none;
}

.arena-stage.is-dragging { cursor: grabbing; }
.arena-stage canvas { display: block; width: 100%; height: 100%; }

.arena-legend {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-width: calc(100% - 2rem);
    z-index: 2;
}

.arena-chip {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(12, 10, 9, 0.8);
    border: 1px solid rgba(217, 119, 6, 0.4);
    color: #fcd34d;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.arena-hint {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(214, 211, 209, 0.45);
}

.section-eyebrow {
    font-family: 'Cinzel Decorative', serif;
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--gold-primary);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(217, 119, 6, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════
   📏 TRUE-SCALE LINEUP (2D, no GPU required)
   ═══════════════════════════════════════════════════════════════════ */

.lineup {
    position: relative;
    width: 100%;
    border-radius: 1.25rem;
    padding: 1rem 0.5rem 0.25rem;
    border: 1px solid rgba(217, 119, 6, 0.28);
    background:
        radial-gradient(ellipse 70% 50% at 50% 92%, rgba(217, 119, 6, 0.1) 0%, transparent 70%),
        linear-gradient(180deg, #14110e 0%, #0a0908 100%);
    overflow-x: auto;
}

.lineup-canvas { display: block; margin: 0 auto; }

.lineup-status {
    padding: 3rem 0;
    text-align: center;
    color: rgba(251, 191, 36, 0.6);
    font-family: 'Cinzel Decorative', serif;
}

.lineup.is-scrollable::after {
    content: "↔";
    position: absolute;
    top: 0.6rem;
    right: 0.9rem;
    color: rgba(251, 191, 36, 0.5);
    font-size: 0.9rem;
    pointer-events: none;
}
