/* =================================================================
   CASE-STUDY.CSS - Estilos para Páginas de Casos de Éxito
   Usamos variables de _tokens.css para consistencia
   ================================================================= */

/* =========================================
   HERO IMMERSIVE
   ========================================= */
.hero-immersive {
    background-color: var(--bunker-negro);
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 2rem 1.5rem;
}

@media (min-width: 768px) {
    .hero-immersive {
        padding: 3rem 2rem;
    }
}

/* Rejilla de fondo tecnológica */
.tech-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    z-index: 1;
    pointer-events: none;
}

/* Resplandor (Glow) - Variantes por tema */
.glow-spot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    filter: blur(80px);
    z-index: 0;
}

.glow-spot--olive {
    background: radial-gradient(circle, rgba(154, 177, 124, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
}

.glow-spot--beige {
    background: radial-gradient(circle, rgba(232, 225, 208, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
}

.glow-spot--lavender {
    background: radial-gradient(circle, rgba(173, 173, 214, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
}

/* Text Reveal Gradient */
.text-reveal {
    background: linear-gradient(to bottom, #ffffff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* =========================================
   BUNKER TAG (Pills/Badges)
   ========================================= */
.bunker-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.6em 1.5em;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    font-family: var(--font-family);
    font-size: var(--text-caption);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--bunker-negro);
    background: transparent;
    transition: all var(--duration-normal) var(--ease-out);
}

.bunker-tag:hover {
    background: var(--bunker-negro);
    color: white;
    border-color: var(--bunker-negro);
}

.bunker-tag.dark-mode {
    border-color: var(--border-on-dark);
    color: white;
}

.bunker-tag.dark-mode:hover {
    background: white;
    color: var(--bunker-negro);
    border-color: white;
}

/* =========================================
   STICKY COLUMN
   ========================================= */
.sticky-col {
    position: sticky;
    top: 120px;
    height: fit-content;
}

/* =========================================
   HERO FLOAT ANIMATION
   ========================================= */
.hero-float-img {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* =========================================
   LAPTOP/PHONE SHOWCASE
   ========================================= */
.laptop-showcase,
.phone-showcase {
    position: relative;
    z-index: 10;
    transition: transform 0.8s var(--ease-smooth);
    opacity: 0;
    animation: fadeUp 1.2s ease-out forwards 0.3s;
}

.laptop-showcase {
    margin-top: -80px;
    transform: perspective(1000px) rotateX(10deg) scale(0.9);
}

.hero-immersive:hover .laptop-showcase {
    transform: perspective(1000px) rotateX(2deg) scale(0.95);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: perspective(1000px) rotateX(20deg) translateY(50px) scale(0.85);
    }

    to {
        opacity: 1;
        transform: perspective(1000px) rotateX(10deg) translateY(0) scale(0.9);
    }
}

/* =========================================
   TIMELINE
   ========================================= */
.timeline-line-track {
    position: absolute;
    left: 1.75rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-on-dark);
}

.timeline-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 0%;
    background: linear-gradient(to bottom,
            var(--bunker-oliva) 0%,
            var(--bunker-lavanda) 50%,
            var(--bunker-beige) 100%);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    transition: height 0.1s linear;
}

/* Variante Pampa (más cálida) */
.timeline-line-fill--warm {
    background: linear-gradient(to bottom,
            var(--bunker-beige) 0%,
            var(--bunker-lavanda) 50%,
            var(--bunker-beige) 100%);
    box-shadow: 0 0 15px rgba(232, 225, 208, 0.5);
}

@media (min-width: 1024px) {
    .timeline-line-track {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Timeline Icon Box */
.timeline-icon-box {
    position: absolute;
    left: -50px;
    top: 0;
    width: 40px;
    height: 40px;
    background: var(--bunker-carbon);
    border: 1px solid var(--border-on-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.5s var(--ease-bounce);
    z-index: 10;
}

.timeline-icon-box svg {
    width: 18px;
    height: 18px;
}

@media (min-width: 1024px) {
    .timeline-icon-box {
        left: 50%;
        top: auto;
        width: 56px;
        height: 56px;
        transform: translateX(-50%);
    }

    .timeline-icon-box svg {
        width: 24px;
        height: 24px;
    }
}

/* Timeline Step Colors */
.timeline-step[data-color="olive"] .timeline-label {
    color: var(--bunker-oliva);
}

.timeline-step[data-color="lavender"] .timeline-label {
    color: var(--bunker-lavanda);
}

.timeline-step[data-color="beige"] .timeline-label {
    color: var(--bunker-beige);
}

.timeline-step[data-color="olive"].active .timeline-icon-box {
    background: var(--bunker-oliva);
    border-color: var(--bunker-oliva);
    color: var(--bunker-negro);
    box-shadow: 0 0 30px rgba(154, 177, 124, 0.6);
    transform: scale(1.1);
}

.timeline-step[data-color="lavender"].active .timeline-icon-box {
    background: var(--bunker-lavanda);
    border-color: var(--bunker-lavanda);
    color: var(--bunker-negro);
    box-shadow: 0 0 30px rgba(173, 173, 214, 0.6);
    transform: scale(1.1);
}

.timeline-step[data-color="beige"].active .timeline-icon-box {
    background: var(--bunker-beige);
    border-color: var(--bunker-beige);
    color: var(--bunker-negro);
    box-shadow: 0 0 30px rgba(232, 225, 208, 0.6);
    transform: scale(1.1);
}

@media (min-width: 1024px) {

    .timeline-step[data-color="olive"].active .timeline-icon-box,
    .timeline-step[data-color="lavender"].active .timeline-icon-box,
    .timeline-step[data-color="beige"].active .timeline-icon-box {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Timeline Content Animation */
.timeline-content,
.timeline-visual {
    opacity: 0.2;
    filter: blur(3px);
    transition: all 0.8s ease;
}

.timeline-step.active .timeline-content,
.timeline-step.active .timeline-visual {
    opacity: 1;
    filter: blur(0);
}

/* Mobile Timeline Adjustments */
@media (max-width: 1023px) {
    .timeline-step {
        margin-bottom: 4rem !important;
    }

    .timeline-content h3 {
        font-size: clamp(1.875rem, 5vw, 2.5rem) !important;
    }

    .timeline-content p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
}

/* =========================================
   VISUAL CARDS
   ========================================= */
.visual-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-on-dark);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform: translateY(20px);
    transition: transform 0.8s ease;
    padding-bottom: 1.5rem;
}

.timeline-step.active .visual-card {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .visual-card {
        padding-bottom: 0;
    }
}

/* =========================================
   METRIC CARDS
   ========================================= */
.metric-card-visual {
    background: var(--bunker-blanco);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--duration-slow) ease, box-shadow var(--duration-slow) ease;
}

@media (min-width: 768px) {
    .metric-card-visual {
        padding: 2.5rem;
    }
}

.metric-card-visual:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

/* Grid Background */
.grid-bg {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--border-light) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    pointer-events: none;
}

/* Circle Target (Metric Icons) */
.circle-target {
    background-color: transparent;
    border-width: 4px;
    border-style: solid;
    transition: background-color 0.5s ease, transform 0.3s ease, border-color 0.3s ease;
}

.circle-target svg {
    transition: color 0.5s ease;
}

/* Metric Card Colors */
.metric-card-visual[data-color="beige"] .circle-target {
    border-color: var(--bunker-beige);
}

.metric-card-visual[data-color="beige"] .circle-target svg {
    color: var(--bunker-beige);
}

.metric-card-visual[data-color="olive"] .circle-target {
    border-color: var(--bunker-oliva);
}

.metric-card-visual[data-color="olive"] .circle-target svg {
    color: var(--bunker-oliva);
}

.metric-card-visual[data-color="lavender"] .circle-target {
    border-color: var(--bunker-lavanda);
}

.metric-card-visual[data-color="lavender"] .circle-target svg {
    color: var(--bunker-lavanda);
}

/* Active States */
.metric-card-visual[data-color="beige"].visible .circle-target,
.metric-card-visual[data-color="beige"]:hover .circle-target {
    background-color: var(--bunker-beige);
}

.metric-card-visual[data-color="olive"].visible .circle-target,
.metric-card-visual[data-color="olive"]:hover .circle-target {
    background-color: var(--bunker-oliva);
}

.metric-card-visual[data-color="lavender"].visible .circle-target,
.metric-card-visual[data-color="lavender"]:hover .circle-target {
    background-color: var(--bunker-lavanda);
}

/* Icon color when filled */
.metric-card-visual.visible .circle-target svg,
.metric-card-visual:hover .circle-target svg {
    color: var(--bunker-negro);
}

/* Delay for visible state */
.metric-card-visual.visible .circle-target,
.metric-card-visual.visible .circle-target svg {
    transition-delay: 2s;
}

/* Instant hover */
.metric-card-visual:hover .circle-target {
    transition-delay: 0s;
    transform: scale(1.1);
}

.metric-card-visual:hover .circle-target svg {
    transition-delay: 0s;
}

/* Group hover text colors */
.metric-card-visual[data-color="beige"]:hover .group-hover\:text-color {
    color: var(--bunker-beige);
}

.metric-card-visual[data-color="olive"]:hover .group-hover\:text-color {
    color: var(--bunker-oliva);
}

.metric-card-visual[data-color="lavender"]:hover .group-hover\:text-color {
    color: var(--bunker-lavanda);
}

/* =========================================
   SEGMENT BARS (Charts)
   ========================================= */
.segment-bar {
    display: flex;
    gap: 4px;
    height: 12px;
    margin-top: 8px;
}

.segment {
    flex: 1;
    height: 100%;
    background: var(--border-light);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.metric-card-visual.visible .segment.filled-red {
    background: var(--chart-error);
    animation: fillSegment 0.5s forwards;
}

.metric-card-visual.visible .segment.filled-green {
    background: var(--chart-success);
    animation: fillSegment 0.5s forwards;
}

@keyframes fillSegment {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Graph Path Animation */
.graph-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.metric-card-visual.visible .graph-path {
    stroke-dashoffset: 0;
}

/* =========================================
   FOOTER VERTICAL (Case Studies)
   ========================================= */
.footer-vertical {
    background: var(--bunker-negro);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 1.5rem 3rem 1.5rem;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .footer-vertical {
        padding: 6rem 2rem 4rem 2rem;
    }
}

@media (min-width: 1024px) {
    .footer-vertical {
        padding: 8rem 1.5rem 4rem 1.5rem;
    }
}

/* =========================================
   LIGHTBOX
   ========================================= */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: lightboxZoom 0.3s ease-out;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.8;
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

@keyframes lightboxZoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 36px;
        height: 36px;
    }
}