/* ============================================
   TSN — Animations & Premium Visual Effects
   Zero dependencies, pure CSS
   ============================================ */

/* ===== ANIMATED GRADIENT TITLE ===== */
.hero-title-gradient {
    background: linear-gradient(
        270deg,
        #a5b4fc,
        #a5b4fc,
        #c7d2fe,
        #c7d2fe,
        #a5b4fc
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== TYPEWRITER EFFECT ===== */
.typewriter-line {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid rgba(165,180,252, 0.6);
    width: 0;
    animation: typewrite 2.5s steps(60, end) 0.8s forwards,
               blinkCursor 0.75s step-end infinite;
}
.typewriter-line.typed {
    width: 100%;
    border-right-color: transparent;
    animation: none;
}
@keyframes typewrite {
    from { width: 0; }
    to { width: 100%; }
}
@keyframes blinkCursor {
    50% { border-right-color: transparent; }
}

/* ===== HERO STAT GLOW PULSE ===== */
.hero-stat-v2 {
    position: relative;
}
.hero-stat-v2 .stat-number {
    text-shadow: 0 0 20px rgba(165,180,252, 0.4);
    animation: statGlowPulse 3s ease-in-out infinite;
}
@keyframes statGlowPulse {
    0%, 100% { text-shadow: 0 0 30px rgba(165,180,252, 0.5); transform: scale(1); }
    50% { text-shadow: 0 0 60px rgba(165,180,252, 0.8), 0 0 100px rgba(165,180,252, 0.3); transform: scale(1.03); }
}

/* ===== STAGGERED ANIMATIONS ===== */
.stagger-children > * {
    opacity: 0;
    transform: translateY(60px) rotateX(12deg);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.12s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.19s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.26s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.33s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.40s; }
.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

/* ===== SECTION HEADER ANIMATED UNDERLINE ===== */
.section-header-v2 h2 {
    position: relative;
    display: inline-block;
}
.section-header-v2 h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #a5b4fc, #c7d2fe);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 2px;
}
.section-header-v2.visible h2::after,
.reveal-v2.visible .section-header-v2 h2::after,
.section-header-v2 h2.line-visible::after {
    width: 80px;
    left: calc(50% - 40px);
}

/* ===== CARD ROTATING BORDER GRADIENT ===== */
.card-v2 {
    position: relative;
    overflow: hidden;
}
.card-v2::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(
        from var(--border-angle, 0deg),
        transparent 0%,
        transparent 25%,
        #a5b4fc 50%,
        #c7d2fe 75%,
        transparent 100%
    );
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
    animation: rotateBorder 4s linear infinite;
}
.card-v2:hover::before {
    opacity: 1;
}
.card-v2::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--card, rgba(12, 20, 33, 0.75));
    border-radius: inherit;
    z-index: -1;
}
@keyframes rotateBorder {
    from { --border-angle: 0deg; }
    to { --border-angle: 360deg; }
}
/* Fallback: animate via transform on a pseudo */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ===== CARD GLOW ON HOVER ===== */
.card-v2:hover,
.node-type-card:hover,
.net-info-card:hover {
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(165,180,252, 0.15),
        0 0 120px rgba(199,210,254, 0.1);
}

/* ===== ICON PULSE GLOW ===== */
.card-icon-v2 {
    animation: iconPulse 3s ease-in-out infinite;
}
@keyframes iconPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(165,180,252, 0);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(165,180,252, 0.15);
        filter: brightness(1.1);
    }
}

/* ===== PARALLAX SECTIONS ===== */
.section {
    position: relative;
}
.section::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse 600px 300px at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(165,180,252, 0.02),
        transparent
    );
    z-index: 0;
    transition: background 0.3s ease;
}

/* ===== ANIMATED SECTION DIVIDERS ===== */
.section-divider {
    position: relative;
    border: none;
    height: 1px;
    background: transparent;
    overflow: visible;
    margin: 0;
}
.section-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(165,180,252, 0.3) 30%,
        rgba(199,210,254, 0.5) 50%,
        rgba(165,180,252, 0.3) 70%,
        transparent 100%
    );
    filter: blur(0px);
    box-shadow: 0 0 4px rgba(165,180,252, 0.3);
    animation: dividerGlow 3s ease-in-out infinite;
}
@keyframes dividerGlow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ===== GRADIENT ORBS (FLOATING BLOBS) ===== */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    will-change: transform;
}
.bg-orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(165,180,252, 0.12), transparent 70%);
    top: 10%;
    left: -10%;
    animation: orbFloat1 20s ease-in-out infinite;
}
.bg-orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(199,210,254, 0.12), transparent 70%);
    top: 40%;
    right: -10%;
    animation: orbFloat2 25s ease-in-out infinite;
}
.bg-orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.12), transparent 70%);
    bottom: 10%;
    left: 20%;
    animation: orbFloat3 18s ease-in-out infinite;
}
@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(80px, 60px); }
    50% { transform: translate(40px, 120px); }
    75% { transform: translate(-40px, 60px); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-60px, 80px); }
    50% { transform: translate(-120px, 40px); }
    75% { transform: translate(-60px, -40px); }
}
@keyframes orbFloat3 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(100px, -50px); }
    66% { transform: translate(-50px, -100px); }
}

/* ===== NOISE TEXTURE OVERLAY ===== */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== MAGNETIC BUTTONS ===== */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--btn-x, 50%) var(--btn-y, 50%),
        rgba(165,180,252, 0.15),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s;
}
.btn:hover::before {
    opacity: 1;
}
.btn-primary {
    position: relative;
}
.btn-primary::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #a5b4fc, #c7d2fe);
    z-index: -1;
    opacity: 0;
    filter: blur(12px);
    transition: opacity 0.4s;
}
.btn-primary:hover::after {
    opacity: 0.4;
}

/* ===== NAV UNDERLINE ANIMATION ===== */
header nav a {
    position: relative;
}
header nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, #a5b4fc, #c7d2fe);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 1px;
}
header nav a:hover::after {
    width: 100%;
    left: 0;
}

/* ===== CURSOR GLOW ===== */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(165,180,252, 0.07),
        transparent 70%
    );
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    will-change: left, top;
    transition: opacity 0.3s;
    mix-blend-mode: screen;
}

/* ===== NETWORK STATUS BAR ENHANCED ===== */
.net-status-dot {
    position: relative;
}
.net-status-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(165,180,252, 0.3);
    animation: dotRipple 2s ease-out infinite;
}
@keyframes dotRipple {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(3); opacity: 0; }
}

.net-stat-value {
    transition: color 0.3s, text-shadow 0.3s;
}
.net-stat-value.flash {
    color: #a5b4fc !important;
    text-shadow: 0 0 12px rgba(165,180,252, 0.5);
}

/* ===== TERMINAL TYPING ANIMATION ===== */
.terminal-body .term-line {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s, transform 0.3s;
}
.terminal-body.animate .term-line {
    opacity: 1;
    transform: translateX(0);
}
.terminal-body.animate .term-line:nth-child(1) { transition-delay: 0.1s; }
.terminal-body.animate .term-line:nth-child(2) { transition-delay: 0.4s; }
.terminal-body.animate .term-line:nth-child(3) { transition-delay: 0.7s; }
.terminal-body.animate .term-line:nth-child(4) { transition-delay: 1.0s; }
.terminal-body.animate .term-line:nth-child(5) { transition-delay: 1.3s; }
.terminal-body.animate .term-line:nth-child(6) { transition-delay: 1.6s; }
.terminal-body.animate .term-line:nth-child(7) { transition-delay: 1.9s; }
.terminal-body.animate .term-line:nth-child(8) { transition-delay: 2.2s; }
.terminal-body.animate .term-line:nth-child(9) { transition-delay: 2.5s; }
.terminal-body.animate .term-line:nth-child(10) { transition-delay: 2.8s; }

.term-cmd {
    color: #a5b4fc !important;
}
.term-success {
    color: #2ecc71 !important;
}
.term-prompt {
    color: #c7d2fe !important;
    font-weight: 700;
}

/* ===== ENHANCED REVEAL ANIMATIONS ===== */
.reveal-v2 {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-v2.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide from left */
.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide from right */
.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale reveal */
.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===== HERO SVG BACKGROUND (hexagonal grid) ===== */
.hero-bg-svg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    height: 100%;
    pointer-events: none;
    opacity: 0.15;
    z-index: 0;
}

/* ===== ROADMAP TIMELINE ENHANCED ===== */
.tl-item {
    position: relative;
}
.tl-item.done .tl-content {
    border-left-color: rgba(165,180,252, 0.3);
}
.tl-item.active .tl-content {
    border-left-color: rgba(165,180,252, 0.6);
    background: rgba(165,180,252, 0.02);
}

/* ===== FAQ ENHANCED ===== */
.faq-item {
    transition: all 0.3s ease;
}
.faq-item:hover {
    border-color: rgba(165,180,252, 0.2);
}
.faq-chevron {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

/* ===== TECH TAGS FLOAT ===== */
.tech-tag {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tech-tag:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(165,180,252, 0.15);
    border-color: rgba(165,180,252, 0.4);
    color: #a5b4fc;
}

/* ===== ORG CHART ENHANCED ===== */
.org-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.org-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3),
                0 0 30px rgba(165,180,252, 0.08);
}

/* ===== SPLASH ENHANCED ===== */
.splash-social {
    position: relative;
    overflow: hidden;
}
.splash-social::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(165,180,252, 0.2), transparent 70%);
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.splash-social:hover::before {
    transform: scale(2);
}

/* ===== HERO HEXAGONAL GRID SVG ANIMATION ===== */
.hex-grid-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawHex 3s ease-out forwards;
}
.hex-grid-line:nth-child(odd) { animation-delay: 0.5s; }
.hex-grid-line:nth-child(even) { animation-delay: 1s; }
@keyframes drawHex {
    to { stroke-dashoffset: 0; }
}

/* ===== NODE TYPE CARDS ENHANCED ===== */
.node-type-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.node-type-card:hover {
    transform: translateY(-12px) scale(1.02);
}

/* ===== STATS BAR GLOW ===== */
.stats-bar-v2 {
    position: relative;
}
.stats-bar-v2::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(165,180,252, 0.1), rgba(199,210,254, 0.1));
    z-index: -1;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.5s;
}
.stats-bar-v2:hover::before {
    opacity: 1;
}

/* ===== SMOOTH SCROLL ENHANCED ===== */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* ===== CONSTELLATION CANVAS ===== */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== PERFORMANCE ===== */
.tilt-card,
.btn,
.card-v2,
.node-type-card,
.bg-orb,
.cursor-glow {
    will-change: transform;
}

/* ===== WORD-BY-WORD ANIMATION ===== */
/* ===== HERO TITLE SHIMMER ===== */
@keyframes shimmer {
    0% { background-position: -200% 50%; }
    100% { background-position: 200% 50%; }
}
#hero h1 {
    background-size: 400% 300% !important;
    animation: hero-gradient-flow 8s ease-in-out infinite, shimmer 6s linear infinite !important;
}

/* ===== WORD GLOW FLASH ===== */
.hero-sub .word.glow-flash {
    filter: brightness(1.8);
    text-shadow: 0 0 12px rgba(165,180,252, 0.6);
}

.hero-sub .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.hero-sub .word.visible {
    opacity: 1;
    transform: translateY(0);
}
