/* ========================================
   MagiScan - Main Styles
   ======================================== */

/* --- CSS Variables --- */
:root {
    --magi-black: #000000;
    --magi-green: #22c55e;
    --magi-white: #ffffff;
    --magi-gray: #0f0f0f;
    --header-height: 5rem; /* h-20, matches fixed header */
}

/* --- Content below fixed header (blog, privacy, terms) --- */
body:has(header.fixed) main,
body.page-below-fixed-header main {
    padding-top: calc(var(--header-height) + 1.5rem);
}

/* --- Base Styles --- */
body {
    background-color: var(--magi-black);
    color: var(--magi-white);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

/* --- Hero Section --- */
#hero-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 10;
}

/* --- Buttons --- */
.btn-store {
    background: var(--magi-white);
    color: var(--magi-black);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-store:hover {
    background: var(--magi-green);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.3);
}

/* --- Ecosystem Cards --- */
#ecosystem .grid {
    grid-auto-rows: minmax(320px, 1fr);
}

.eco-card {
    background: var(--magi-gray);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s ease;
    min-height: 280px;
    height: 100%;
    position: relative;
}

.eco-card:hover {
    border-color: var(--magi-green);
    transform: scale(1.02);
    background: #141414;
}

/* Video: cover by default, hide on card hover */
.eco-card-video-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.eco-card:hover .eco-card-video-cover {
    opacity: 0;
}

/* Video: blur background (YouTube-style) + sharp video in center */
.eco-card-video-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Blurred layer fills card; by edges it's blurred so no empty bars */
.eco-card-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: blur(20px);
    transform: scale(1.15);
    opacity: 0.4;
    pointer-events: none;
}

.eco-card-video-wrap:hover .eco-card-video-bg {
    opacity: 0.5;
}

/* Sharp video centered, contain (vertical video leaves blurred sides) */
.eco-card-video-wrap .eco-card-video {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    z-index: 1;
}

/* Icon cover for ecosystem cards (e.g. AVA, Orthio) */
.eco-card-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.eco-card-cover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* --- Typography --- */
.neon-accent {
    color: var(--magi-green);
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.metric-value {
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 1;
    letter-spacing: -0.05em;
    font-weight: 900;
}

.validation-text {
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.glow-text {
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 255, 255, 0.2);
}

/* --- Use Case Cards --- */
.case-card {
    background: #0a0a0a;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.case-card.visible {
    display: block;
    animation: cardFadeIn 0.6s forwards;
}

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

.case-card:hover {
    transform: translateY(-8px);
    border-color: rgba(34, 197, 94, 0.3);
    background: #111;
}

.case-preview {
    height: 160px;
    background: radial-gradient(circle at center, #1a1a1a, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-3d-canvas-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.card-3d-canvas-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#viewer-3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.case-overlay {
    padding: 1.25rem;
    background: #0a0a0a;
}

/* --- Filter Buttons --- */
.filter-btn {
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: white;
    color: black;
    border-color: white;
}

/* --- Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- Partner Logos --- */
.partner-logo {
    opacity: 1;
}

/* --- Join Card Pulse Animation --- */
@keyframes pulse-border {
    0%, 100% { border-color: rgba(255, 255, 255, 0.1); box-shadow: none; }
    50% { border-color: rgba(34, 197, 94, 0.4); box-shadow: 0 0 20px rgba(34, 197, 94, 0.1); }
}

/* Карточка «?» на десктопе: строго по центру, ширина = 1.66 от одной ячейки (сетка 3 кол., gap 2rem) */
.join-card-wrap {
    display: contents;
}
@media (min-width: 1024px) {
    .join-card-wrap {
        display: flex !important;
        justify-content: center;
    }
    .join-card-desktop {
        width: calc((100% - 4rem) / 3 * 1.66);
        min-width: 0;
    }
}

#join-card {
    animation: pulse-border 3s ease-in-out infinite;
}

#join-card:hover {
    animation: none;
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.15);
}

#join-card:hover .join-card-question {
    color: #fff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5), 0 0 60px rgba(255, 255, 255, 0.3), 0 0 90px rgba(255, 255, 255, 0.2);
}
.join-card-question {
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

#join-card:focus-visible {
    outline: 2px solid rgba(34, 197, 94, 0.8);
    outline-offset: 2px;
}

/* --- Modal open: lock body scroll --- */
body.modal-open {
    overflow: hidden;
}

/* --- 3D Viewer Loader --- */
.viewer-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.viewer-loader-ring {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(34, 197, 94, 0.15);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: viewer-spin 0.9s linear infinite;
}

.viewer-loader-text {
    margin-top: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes viewer-spin {
    to { transform: rotate(360deg); }
}

