/**
 * =============================================================================
 * CKCM Research Portal — Premium Animation Engine
 * Covers: page load, cards, buttons, tables, stat counters,
 *         page transitions, scroll reveals, skeleton loaders,
 *         toast notifications, landing particle background.
 * =============================================================================
 */

/* =============================================================================
   A. GLOBAL KEYFRAMES
   ============================================================================= */

/* Page/content entrance */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* Fade in from side */
@keyframes fadeSlideLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Scale spring pop */
@keyframes scalePop {
    0%   { opacity: 0; transform: scale(0.9); }
    70%  { transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* Toast slide-in from bottom-right */
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast slide-out */
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(12px) scale(0.96); }
}

/* Skeleton shimmer wave */
@keyframes skeletonShimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

/* Number count-up blur flash */
@keyframes counterFlash {
    0%   { opacity: 0.4; filter: blur(4px); }
    100% { opacity: 1;   filter: blur(0); }
}

/* Table row stagger entrance */
@keyframes rowSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Floating particle drift */
@keyframes particleDrift {
    0%   { transform: translateY(0)   translateX(0)   scale(1);   opacity: 0.5; }
    33%  { transform: translateY(-28px) translateX(14px) scale(1.1); opacity: 0.8; }
    66%  { transform: translateY(-10px) translateX(-8px)  scale(0.95); opacity: 0.6; }
    100% { transform: translateY(0)   translateX(0)   scale(1);   opacity: 0.5; }
}

/* Soft gradient breathing animation for hero bg */
@keyframes heroGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.8; }
    50%       { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

/* Ripple press effect */
@keyframes rippleExpand {
    from { transform: scale(0); opacity: 0.6; }
    to   { transform: scale(4); opacity: 0; }
}

/* Nav link active underline slide */
@keyframes navUnderlineSlide {
    from { width: 0; opacity: 0; }
    to   { width: 14px; opacity: 1; }
}

/* Notification bell ring */
@keyframes bellRing {
    0%   { transform: rotate(0deg); }
    10%  { transform: rotate(14deg); }
    20%  { transform: rotate(-10deg); }
    30%  { transform: rotate(8deg); }
    40%  { transform: rotate(-6deg); }
    50%  { transform: rotate(4deg); }
    60%  { transform: rotate(-2deg); }
    100% { transform: rotate(0deg); }
}

/* Card shine sweep */
@keyframes cardShine {
    0%   { left: -80%; }
    100% { left: 130%; }
}

/* Avatar presence pulse */
@keyframes avatarPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

/* Accordion/panel expand */
@keyframes panelExpand {
    from { opacity: 0; transform: scaleY(0.92); transform-origin: top; }
    to   { opacity: 1; transform: scaleY(1);    transform-origin: top; }
}

/* =============================================================================
   B. PAGE LOAD — Staggered Fade-in
   ============================================================================= */

/* Wrap main content for entrance */
body > main,
.main-content {
    animation: fadeSlideUp 0.45s var(--ease-spring) both;
    animation-delay: 0.05s;
}

/* Header slides down from top */
header {
    animation: fadeSlideLeft 0.35s var(--ease-smooth) both;
}

/* Executive banner / page header */
.executive-banner,
.page-header-clean,
.page-header-executive {
    animation: fadeSlideUp 0.4s var(--ease-spring) both;
    animation-delay: 0.08s;
}

/* =============================================================================
   C. STAT CARDS — Staggered Entrance + Counter Animation
   ============================================================================= */

.stats-grid > .stat-card,
.stat-grid > .stat-card {
    animation: fadeSlideUp 0.42s var(--ease-spring) both;
}
.stats-grid > .stat-card:nth-child(1),
.stat-grid > .stat-card:nth-child(1) { animation-delay: 0.04s; }
.stats-grid > .stat-card:nth-child(2),
.stat-grid > .stat-card:nth-child(2) { animation-delay: 0.10s; }
.stats-grid > .stat-card:nth-child(3),
.stat-grid > .stat-card:nth-child(3) { animation-delay: 0.16s; }
.stats-grid > .stat-card:nth-child(4),
.stat-grid > .stat-card:nth-child(4) { animation-delay: 0.22s; }

/* Number flash on load */
.stat-value[data-counter] {
    animation: counterFlash 0.6s var(--ease-smooth) both;
    animation-delay: 0.3s;
}

/* Card hover shine sweep overlay */
.stat-card,
.card,
.manuscripts-card,
.paper-card {
    position: relative;
    overflow: hidden;
}
.stat-card::after,
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%
    );
    transform: skewX(-15deg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.stat-card:hover::after,
.card:hover::after {
    opacity: 1;
    animation: cardShine 0.55s ease forwards;
}

/* =============================================================================
   D. TABLE ROW STAGGER ENTRANCE
   ============================================================================= */

.table tbody tr {
    animation: rowSlideIn 0.3s var(--ease-spring) both;
    animation-fill-mode: both;
}
/* Give each row a tiny delay for a cascade effect */
.table tbody tr:nth-child(1)  { animation-delay: 0.03s; }
.table tbody tr:nth-child(2)  { animation-delay: 0.06s; }
.table tbody tr:nth-child(3)  { animation-delay: 0.09s; }
.table tbody tr:nth-child(4)  { animation-delay: 0.12s; }
.table tbody tr:nth-child(5)  { animation-delay: 0.15s; }
.table tbody tr:nth-child(6)  { animation-delay: 0.18s; }
.table tbody tr:nth-child(7)  { animation-delay: 0.21s; }
.table tbody tr:nth-child(8)  { animation-delay: 0.24s; }
.table tbody tr:nth-child(9)  { animation-delay: 0.27s; }
.table tbody tr:nth-child(10) { animation-delay: 0.30s; }

/* Stronger hover lift on rows */
.table tbody tr:hover td {
    background-color: var(--accent-subtle);
    transform: translateX(2px);
    transition: background-color 0.18s ease, transform 0.18s var(--ease-spring);
}

/* =============================================================================
   E. BUTTON ANIMATIONS — Press Ripple + Hover Glow
   ============================================================================= */

.btn {
    position: relative;
    overflow: hidden;
}

/* Ripple element injected by JS */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.32);
    pointer-events: none;
    width: 10px;
    height: 10px;
    transform: scale(0);
    animation: rippleExpand 0.55s ease-out forwards;
}

/* Secondary ripple uses accent color */
.btn-secondary .btn-ripple {
    background: rgba(29, 78, 216, 0.18);
}

.btn-primary {
    transition: all 0.2s var(--ease-spring), filter 0.2s ease;
}
.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(29, 78, 216, 0.42);
}
.btn-primary:active {
    transform: translateY(1px) scale(0.975);
    filter: brightness(0.96);
}

.btn-secondary:active,
.btn-ghost:active {
    transform: translateY(1px) scale(0.975);
}

/* =============================================================================
   F. NAVIGATION LINK ANIMATIONS
   ============================================================================= */

.nav-link {
    transition: color 0.2s var(--ease-spring);
}

.nav-link:hover {
    transform: none;
}

.nav-link.active::after {
    display: none !important;
}

/* =============================================================================
   G. SCROLL REVEAL (handled via JS IntersectionObserver)
   ============================================================================= */

/* Initial hidden state */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-spring),
                transform 0.5s var(--ease-spring);
}

/* When JS adds .is-visible */
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay utilities */
.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.12s; }
.reveal-delay-3 { transition-delay: 0.19s; }
.reveal-delay-4 { transition-delay: 0.26s; }

/* =============================================================================
   H. SKELETON LOADER & ROLE-AWARE DASHBOARD SKELETON
   ============================================================================= */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(226, 232, 240, 0.6) 0%,
        rgba(241, 245, 249, 0.95) 50%,
        rgba(226, 232, 240, 0.6) 100%
    );
    background-size: 600px 100%;
    animation: skeletonShimmer 1.4s infinite linear;
    border-radius: 6px;
    display: inline-block;
    vertical-align: middle;
}

html[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.11) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 600px 100%;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-33 { width: 33%; }

.skeleton-title {
    height: 22px;
    width: 60%;
    margin-bottom: 12px;
    border-radius: 6px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.skeleton-badge {
    height: 22px;
    border-radius: 999px;
    flex-shrink: 0;
}

.skeleton-btn {
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
}

.skeleton-btn-primary {
    background: linear-gradient(
        90deg,
        rgba(14, 77, 37, 0.15) 0%,
        rgba(16, 185, 129, 0.25) 50%,
        rgba(14, 77, 37, 0.15) 100%
    ) !important;
    background-size: 600px 100% !important;
}

html[data-theme="dark"] .skeleton-btn-primary {
    background: linear-gradient(
        90deg,
        rgba(16, 185, 129, 0.12) 0%,
        rgba(52, 211, 153, 0.25) 50%,
        rgba(16, 185, 129, 0.12) 100%
    ) !important;
    background-size: 600px 100% !important;
}

.skeleton-bar {
    height: 8px;
    border-radius: 999px;
}

.skeleton-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeSlideUp 0.35s var(--ease-spring) both;
}

/* ── Role Skeleton Dashboard Container ────────────────────────────── */
.portal-role-skeleton {
    width: 100%;
    padding-top: 24px;
    margin-bottom: 24px;
    animation: fadeSlideUp 0.32s var(--ease-spring) both;
    user-select: none;
    pointer-events: none;
}

.portal-role-skeleton.skeleton-fade-out {
    opacity: 0 !important;
    transform: translateY(-6px) !important;
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    pointer-events: none !important;
}

.portal-role-skeleton.skeleton-hidden {
    display: none !important;
}

/* Header Skeleton */
.skeleton-header-wrap {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    width: 100%;
}

.skeleton-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Stat Cards Skeleton */
.skeleton-stat-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 16px !important;
    cursor: default !important;
    pointer-events: none !important;
}

.skeleton-analytics-card,
.skeleton-table-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-default) !important;
    cursor: default !important;
}

/* Body Loading States during Skeleton Display */
body.portal-content-loading main > *:not(#portalRoleSkeleton):not(#portalLaunchScreen),
body.portal-content-loading .page-header {
    display: none !important;
}

body.portal-content-ready main > *:not(#portalRoleSkeleton):not(#portalLaunchScreen):not(.modal-overlay):not(.modal-backdrop):not(.ckcm-confirm-modal-overlay):not(.poster-lightbox-overlay):not(script):not(style),
body.portal-content-ready .page-header {
    animation: fadeSlideUp 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================================
   I. TOAST NOTIFICATION SYSTEM
   ============================================================================= */

#ckcm-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.ckcm-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.12);
    min-width: 280px;
    max-width: 380px;
    pointer-events: all;
    animation: toastSlideIn 0.36s var(--ease-spring) both;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ckcm-toast.toast-leaving {
    animation: toastSlideOut 0.28s ease forwards;
}

.ckcm-toast.toast-success {
    border-left: 3.5px solid #10B981;
    background: rgba(16, 185, 129, 0.06);
}

.ckcm-toast.toast-error {
    border-left: 3.5px solid #EF4444;
    background: rgba(239, 68, 68, 0.06);
}

.ckcm-toast.toast-info {
    border-left: 3.5px solid var(--accent);
    background: rgba(29, 78, 216, 0.06);
}

.ckcm-toast.toast-warning {
    border-left: 3.5px solid #F59E0B;
    background: rgba(245, 158, 11, 0.06);
}

.ckcm-toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.ckcm-toast-body {
    flex: 1;
    line-height: 1.45;
}

.ckcm-toast-title {
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 13px;
}

.ckcm-toast-msg {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.ckcm-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.ckcm-toast-close:hover {
    color: var(--text-primary);
    background: var(--muted-bg);
}

/* Mobile toast positioning */
@media (max-width: 640px) {
    #ckcm-toast-container {
        bottom: 16px;
        right: 12px;
        left: 12px;
    }
    .ckcm-toast {
        min-width: unset;
        max-width: 100%;
    }
}

/* =============================================================================
   J. LANDING PAGE — Particle Background & Hero Animation
   ============================================================================= */

/* Animated floating orbs behind hero */
.landing-hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(48px);
    opacity: 0.55;
}

.landing-hero-orb-1 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(29, 78, 216, 0.18) 0%, transparent 70%);
    top: -80px;
    left: 10%;
    animation: particleDrift 10s ease-in-out infinite;
}

.landing-hero-orb-2 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.14) 0%, transparent 70%);
    top: 30px;
    right: 12%;
    animation: particleDrift 13s ease-in-out infinite reverse;
    animation-delay: 2s;
}

.landing-hero-orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    top: 60%;
    left: 5%;
    animation: particleDrift 16s ease-in-out infinite;
    animation-delay: 4s;
}

html[data-theme="dark"] .landing-hero-orb-1 {
    background: radial-gradient(circle, rgba(14, 77, 37, 0.25) 0%, transparent 70%);
    opacity: 0.7;
}
html[data-theme="dark"] .landing-hero-orb-2 {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.18) 0%, transparent 70%);
}

/* Hero text stagger */
.landing-hero .hero-pill-badge {
    animation: scalePop 0.5s var(--ease-spring) both;
    animation-delay: 0.1s;
}
.landing-hero h1 {
    animation: fadeSlideUp 0.55s var(--ease-spring) both;
    animation-delay: 0.2s;
}
.landing-hero p {
    animation: fadeSlideUp 0.55s var(--ease-spring) both;
    animation-delay: 0.3s;
}
.landing-search-bar {
    animation: fadeSlideUp 0.55s var(--ease-spring) both;
    animation-delay: 0.4s;
}
.stat-banner-grid {
    animation: fadeSlideUp 0.5s var(--ease-spring) both;
    animation-delay: 0.5s;
}

/* Landing paper cards stagger */
.landing-paper-card:nth-child(1) { animation-delay: 0.05s; }
.landing-paper-card:nth-child(2) { animation-delay: 0.10s; }
.landing-paper-card:nth-child(3) { animation-delay: 0.15s; }
.landing-paper-card:nth-child(4) { animation-delay: 0.20s; }
.landing-paper-card:nth-child(5) { animation-delay: 0.25s; }
.landing-paper-card:nth-child(6) { animation-delay: 0.30s; }
.landing-paper-card:nth-child(7) { animation-delay: 0.35s; }
.landing-paper-card:nth-child(8) { animation-delay: 0.40s; }
.landing-paper-card:nth-child(9) { animation-delay: 0.45s; }

/* =============================================================================
   K. FORM & MODAL ANIMATIONS
   ============================================================================= */

/* Form step cards slide in */
.form-step-card {
    animation: fadeSlideUp 0.38s var(--ease-spring) both;
}
.form-step-card:nth-child(1) { animation-delay: 0.05s; }
.form-step-card:nth-child(2) { animation-delay: 0.12s; }
.form-step-card:nth-child(3) { animation-delay: 0.19s; }
.form-step-card:nth-child(4) { animation-delay: 0.26s; }

/* Input focus glow effect */
.input-control:focus,
.form-control:focus {
    transform: translateY(-1px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s var(--ease-spring);
}

/* Alert pop */
.alert, .status-alert {
    animation: scalePop 0.32s var(--ease-spring) both;
}

/* Modal spring entrance */
.modal-box {
    animation: modalSpringPop 0.38s var(--ease-spring) both;
}

/* =============================================================================
   L. AVATAR & NOTIFICATION BELL
   ============================================================================= */

.avatar-online-dot {
    animation: avatarPulse 2.2s infinite ease-in-out;
}

.notif-bell-btn:hover svg {
    animation: bellRing 0.6s ease;
}

/* =============================================================================
   M. PAGE TRANSITION OVERLAY (injected & removed by JS)
   ============================================================================= */

#page-transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--accent-gradient);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
}

#page-transition-overlay.active {
    opacity: 0.12;
}

/* =============================================================================
   N. FILTER PILL ANIMATIONS
   ============================================================================= */

.filter-pill {
    transition: all 0.18s var(--ease-spring);
}
.filter-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.15);
}
.filter-pill.active {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.28);
}

/* =============================================================================
   P. FLUTTER HERO LAUNCH ANIMATION (DailyFlutterUI Signature Style)
   ============================================================================= */

.portal-flutter-launch {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #080D14;
    background: radial-gradient(circle 900px at 50% 50%, #0D1C24 0%, #08111B 50%, #04070D 100%);
    overflow: hidden;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, visibility;
}

/* Light Theme Variant */
html:not([data-theme="dark"]) .portal-flutter-launch {
    background: #F8FAFC;
    background: radial-gradient(circle 900px at 50% 50%, #FFFFFF 0%, #ECFDF5 50%, #E2E8F0 100%);
}

.portal-flutter-launch.launch-fading {
    opacity: 0 !important;
    pointer-events: none !important;
}

.flutter-launch-backdrop {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.14) 0%, transparent 65%);
    pointer-events: none;
}

.flutter-launch-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Ambient Multi-Tier Glowing Aura */
.flutter-launch-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(16, 185, 129, 0.48) 0%, rgba(5, 150, 105, 0.25) 30%, rgba(245, 158, 11, 0.15) 52%, transparent 75%);
    filter: blur(28px);
    pointer-events: none;
    opacity: 0;
    animation: flutterGlowEnter 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

html:not([data-theme="dark"]) .flutter-launch-glow {
    background: radial-gradient(circle, rgba(14, 77, 37, 0.26) 0%, rgba(16, 185, 129, 0.14) 32%, rgba(245, 158, 11, 0.1) 52%, transparent 75%);
    filter: blur(24px);
}

@keyframes flutterGlowEnter {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
    60%  { opacity: 0.95; transform: translate(-50%, -50%) scale(1.12); }
    100% { opacity: 0.75; transform: translate(-50%, -50%) scale(1); }
}

/* Dual Concentric Orbital Rings Embellishment */
.flutter-orbital-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.flutter-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-sizing: border-box;
}

.flutter-ring-inner {
    width: 220px;
    height: 220px;
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.25), inset 0 0 16px rgba(16, 185, 129, 0.14);
    animation: flutterRingIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

html:not([data-theme="dark"]) .flutter-ring-inner {
    border-color: rgba(14, 77, 37, 0.35);
    box-shadow: 0 0 18px rgba(14, 77, 37, 0.18);
}

.flutter-ring-outer {
    width: 290px;
    height: 290px;
    border: 1px dashed rgba(245, 158, 11, 0.42);
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.18);
    animation: flutterRingIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.08s, flutterRingRotate 24s linear infinite;
}

html:not([data-theme="dark"]) .flutter-ring-outer {
    border-color: rgba(217, 119, 6, 0.38);
    box-shadow: 0 0 18px rgba(217, 119, 6, 0.14);
}

.flutter-ring-satellite {
    position: absolute;
    top: -5px;
    left: 50%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10B981;
    transform: translateX(-50%);
    box-shadow: 0 0 12px #10B981, 0 0 24px rgba(16, 185, 129, 0.9);
}

@keyframes flutterRingIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    70%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes flutterRingRotate {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* The Hero Logo Box (Grand & Prominent at Launch: 176px) */
.flutter-hero-logo-box {
    position: relative;
    width: 176px;
    height: 176px;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
    animation: flutterHeroSpringEnter 0.62s cubic-bezier(0.34, 1.35, 0.64, 1);
}

@keyframes flutterHeroSpringEnter {
    0% {
        opacity: 0;
        transform: scale(0.35) translateY(32px);
        filter: blur(12px);
    }
    65% {
        opacity: 1;
        transform: scale(1.08) translateY(-4px);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.flutter-hero-logo {
    width: 168px;
    height: 168px;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 18px 42px rgba(0, 0, 0, 0.58)) drop-shadow(0 0 26px rgba(16, 185, 129, 0.38));
    transition: filter 0.3s ease;
}

html:not([data-theme="dark"]) .flutter-hero-logo {
    filter: drop-shadow(0 14px 32px rgba(14, 77, 37, 0.28)) drop-shadow(0 0 20px rgba(16, 185, 129, 0.24));
}

/* Specular Light Sheen / Glint Sweep across Seal */
.flutter-hero-sheen {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

.flutter-hero-sheen::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.18) 42%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(245, 158, 11, 0.45) 54%,
        transparent 68%
    );
    transform: translateX(-120%) translateY(-120%) rotate(25deg);
    animation: flutterSheenSweep 1.1s cubic-bezier(0.4, 0, 0.2, 1) 0.25s;
}

@keyframes flutterSheenSweep {
    0% {
        transform: translateX(-120%) translateY(-120%) rotate(25deg);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        transform: translateX(120%) translateY(120%) rotate(25deg);
        opacity: 0;
    }
}

/* Luminous Starlight Sparkle Accents */
.flutter-hero-sparkle {
    position: absolute;
    color: #F59E0B;
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
    z-index: 4;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.9), 0 0 18px rgba(245, 158, 11, 0.55);
    animation: flutterSparkleTwinkle 1.5s ease-in-out infinite alternate;
}

.flutter-hero-sparkle.sp-1 { top: -8px; right: 16px; animation-delay: 0.25s; }
.flutter-hero-sparkle.sp-2 { bottom: 12px; right: -10px; font-size: 16px; animation-delay: 0.5s; }
.flutter-hero-sparkle.sp-3 { bottom: -8px; left: 20px; animation-delay: 0.15s; }
.flutter-hero-sparkle.sp-4 { top: 22px; left: -12px; font-size: 12px; animation-delay: 0.4s; }

@keyframes flutterSparkleTwinkle {
    0%   { opacity: 0.2; transform: scale(0.6) rotate(0deg); }
    50%  { opacity: 1; transform: scale(1.25) rotate(45deg); }
    100% { opacity: 0.35; transform: scale(0.8) rotate(90deg); }
}

/* Hero Title, Acronym, and Badge */
.flutter-hero-text {
    margin-top: 24px;
    text-align: center;
    padding: 0 20px;
    max-width: 92vw;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: flutterTextFadeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes flutterTextFadeIn {
    0%   { opacity: 0; transform: translateY(14px); filter: blur(5px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* GLIDE STATE: Kill keyframe locks and cleanly fade embellishments */
.portal-flutter-launch.launch-gliding .flutter-hero-logo-box {
    animation: none !important;
}

.portal-flutter-launch.launch-gliding .flutter-hero-text,
.portal-flutter-launch.launch-gliding .flutter-orbital-rings,
.portal-flutter-launch.launch-gliding .flutter-launch-glow,
.portal-flutter-launch.launch-gliding .flutter-hero-sparkle,
.portal-flutter-launch.launch-gliding .flutter-hero-sheen {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, transform 0.25s ease !important;
}

.portal-flutter-launch.launch-gliding .flutter-hero-text {
    transform: translateY(12px) scale(0.92) !important;
}

.portal-flutter-launch.launch-gliding .flutter-orbital-rings {
    transform: translate(-50%, -50%) scale(0.78) !important;
}

.portal-flutter-launch.launch-gliding .flutter-launch-glow {
    transform: translate(-50%, -50%) scale(0.55) !important;
}

.flutter-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: #10B981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.32);
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

html:not([data-theme="dark"]) .flutter-hero-badge {
    color: #0E4D25;
    background: rgba(14, 77, 37, 0.08);
    border-color: rgba(14, 77, 37, 0.25);
    box-shadow: 0 2px 8px rgba(14, 77, 37, 0.1);
}

.badge-pulsar {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 6px #10B981;
    animation: pulsarPulse 1.8s infinite;
}

@keyframes pulsarPulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.flutter-hero-title {
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #FFFFFF;
    line-height: 1.35;
    margin: 10px 0 4px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

html:not([data-theme="dark"]) .flutter-hero-title {
    color: #0E4D25;
    text-shadow: none;
}

.flutter-hero-sub {
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.02em;
    line-height: 1.4;
}

html:not([data-theme="dark"]) .flutter-hero-sub {
    color: #475569;
}

@media (max-width: 480px) {
    .flutter-hero-logo-box {
        width: 112px;
        height: 112px;
    }
    .flutter-hero-logo {
        width: 104px;
        height: 104px;
    }
    .flutter-orbital-rings {
        width: 210px;
        height: 210px;
    }
    .flutter-ring-inner {
        width: 140px;
        height: 140px;
    }
    .flutter-ring-outer {
        width: 180px;
        height: 180px;
    }
    .flutter-hero-badge {
        font-size: 9.5px;
        letter-spacing: 0.18em;
        padding: 4px 11px;
    }
    .flutter-hero-title {
        font-size: 16px;
    }
    .flutter-hero-sub {
        font-size: 11px;
    }
}

/* Page Cascade Effect when launch reveals - No layout shifts (translateY: 0 preserved) */
body.portal-launch-active header,
body.portal-launch-active main,
body.portal-launch-active .container {
    opacity: 0.01 !important;
    pointer-events: none !important;
    filter: blur(5px);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), filter 0.55s ease;
}

body.portal-launch-revealed header,
body.portal-launch-revealed main,
body.portal-launch-revealed .container {
    opacity: 1 !important;
    pointer-events: auto !important;
    filter: blur(0) !important;
}

/* =============================================================================
   O. REDUCE MOTION SAFETY NET
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
