/* 
   Project: ELECTRO-GRABADO — Proyecto PAPIME E101
   Theme: Digital Alchemy
   Concept: Raw Copper + High-Voltage Digital Overlay
   ENES Morelia, UNAM
*/

:root {
    /* Core Palette */
    --void-bg: #050505;
    --void-card: rgba(20, 20, 20, 0.6);

    /* Alchemy Tones */
    --copper-neon: #ff9d5c;
    --copper-rust: #8a4b20;
    --cyan-electric: #00f3ff;
    --acid-green: #bfff00;

    /* UI */
    --font-display: 'Outfit', sans-serif;
    --font-tech: 'Space Mono', monospace;
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-bg);
    color: #fff;
    font-family: var(--font-display);
    overflow-x: hidden;
    width: 100vw;
    cursor: none;
}

::selection {
    background: var(--copper-neon);
    color: #000;
}

/* ===========================
   LOADER
   =========================== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-text {
    font-family: var(--font-tech);
    font-size: 2rem;
    color: var(--cyan-electric);
    letter-spacing: 8px;
    margin-bottom: 2rem;
    animation: loaderPulse 1.5s ease infinite;
}

.loader-bar {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loader-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-electric), var(--copper-neon));
    animation: loaderFill 1.5s ease forwards;
}

@keyframes loaderPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes loaderFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ===========================
   CUSTOM CURSOR
   =========================== */
.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--cyan-electric);
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.15s ease;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid var(--copper-neon);
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    transition: width 0.3s var(--ease-smooth), height 0.3s var(--ease-smooth), background-color 0.3s var(--ease-smooth), border-color 0.3s var(--ease-smooth);
}

.cursor-hover {
    width: 60px;
    height: 60px;
    background: rgba(255, 157, 92, 0.08);
    border-color: var(--cyan-electric);
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
}

/* ===========================
   TYPOGRAPHY & GLITCH
   =========================== */
.glitch-wrapper {
    position: relative;
    display: inline-block;
}

.glitch {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    color: #fff;
    letter-spacing: -5px;
    line-height: 0.9;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--cyan-electric);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--copper-neon);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0%   { clip: rect(12px, 9999px, 56px, 0); }
    20%  { clip: rect(89px, 9999px, 12px, 0); }
    40%  { clip: rect(34px, 9999px, 87px, 0); }
    60%  { clip: rect(67px, 9999px, 23px, 0); }
    80%  { clip: rect(2px, 9999px, 98px, 0); }
    100% { clip: rect(45px, 9999px, 34px, 0); }
}

@keyframes glitch-anim-2 {
    0%   { clip: rect(65px, 9999px, 100px, 0); }
    20%  { clip: rect(12px, 9999px, 3px, 0); }
    40%  { clip: rect(87px, 9999px, 45px, 0); }
    60%  { clip: rect(3px, 9999px, 78px, 0); }
    80%  { clip: rect(45px, 9999px, 12px, 0); }
    100% { clip: rect(98px, 9999px, 65px, 0); }
}

/* ===========================
   LAYOUT
   =========================== */
section {
    min-height: 100vh;
    padding: 6rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===========================
   HERO
   =========================== */
.hero {
    align-items: flex-start;
    padding-left: 10vw;
    position: relative;
}

.hero-subtitle {
    font-family: var(--font-tech);
    color: var(--cyan-electric);
    font-size: clamp(0.7rem, 1.2vw, 1.2rem);
    margin-bottom: 1.5rem;
    display: block;
    letter-spacing: 4px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1.8s forwards;
}

.hero-desc {
    max-width: 600px;
    font-size: 1.2rem;
    color: #aaa;
    margin-top: 2rem;
    border-left: 2px solid var(--copper-neon);
    padding-left: 2rem;
    line-height: 1.7;
    opacity: 0;
    animation: fadeInUp 0.8s ease 2s forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: 4rem;
    right: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-tech);
    font-size: 0.7rem;
    color: #666;
    letter-spacing: 3px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 2.4s forwards;
}

.scroll-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--copper-neon), transparent);
    animation: scrollPulse 2s ease infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.3; transform: scaleY(0.6); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   BUTTONS
   =========================== */
.btn-magnetic {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 3rem;
    background: transparent;
    border: 1px solid var(--copper-neon);
    color: var(--copper-neon);
    font-family: var(--font-tech);
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 3rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--ease-smooth);
    z-index: 1;
    text-decoration: none;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 2.2s forwards;
}

.btn-magnetic--large {
    padding: 2rem 4rem;
    font-size: 1rem;
    opacity: 1;
    animation: none;
}

.btn-magnetic::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--copper-neon);
    transition: transform 0.4s var(--ease-elastic);
    z-index: -1;
}

.btn-magnetic:hover {
    color: #000;
    box-shadow: 0 0 40px rgba(255, 157, 92, 0.3);
}

.btn-magnetic:hover::before {
    transform: translateX(100%);
}

.btn-arrow {
    transition: transform 0.3s ease;
}

.btn-magnetic:hover .btn-arrow {
    transform: translateX(4px);
}

/* ===========================
   GLASS PANELS
   =========================== */
.glass-panel {
    background: var(--void-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 3rem;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.glass-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan-electric), transparent);
    animation: scanline 3s infinite linear;
}

@keyframes scanline {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.panel-heading {
    color: var(--copper-neon);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    letter-spacing: 1px;
}

.panel-heading--green {
    color: var(--acid-green);
}

.panel-text {
    margin-bottom: 1.5rem;
    color: #ccc;
    line-height: 1.7;
}

/* ===========================
   GRID LAYOUTS
   =========================== */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

/* ===========================
   TECH LISTS
   =========================== */
.tech-list {
    list-style: none;
    font-family: var(--font-tech);
    color: #aaa;
}

.tech-list li {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: color 0.3s ease;
}

.tech-list li:hover {
    color: var(--cyan-electric);
}

.list-marker {
    color: var(--cyan-electric);
    margin-right: 0.5rem;
}

/* ===========================
   QUOTES & STATS
   =========================== */
.highlight-quote {
    font-size: 1.5rem;
    line-height: 1.5;
    border-left: 4px solid var(--cyan-electric);
    padding-left: 2rem;
    color: #ddd;
    font-style: italic;
    margin-bottom: 3rem;
}

.quote-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.mini-stat {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(0, 243, 255, 0.03);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mini-stat:hover {
    border-color: var(--cyan-electric);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 243, 255, 0.1);
}

.mini-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--cyan-electric);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.mini-stat-label {
    display: block;
    font-family: var(--font-tech);
    font-size: 0.7rem;
    color: #666;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===========================
   STAT ROWS
   =========================== */
.stat-grid {
    margin-top: 2rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.2rem 0;
    font-family: var(--font-tech);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.stat-row:hover {
    border-bottom-color: var(--copper-neon);
    padding-left: 0.5rem;
}

.stat-val {
    color: var(--acid-green);
    text-shadow: 0 0 10px rgba(191, 255, 0, 0.5);
    font-weight: 700;
}

/* Text utility classes */
.text-copper { color: var(--copper-rust); }
.text-cyan { color: var(--cyan-electric); }

/* ===========================
   3D VIEWER
   =========================== */
.model-container {
    height: 600px;
    width: 100%;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    border: 1px solid #222;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.model-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-family: var(--font-tech);
    font-size: 0.8rem;
    color: var(--cyan-electric);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-overlay-dot {
    width: 6px;
    height: 6px;
    background: var(--acid-green);
    border-radius: 50%;
    animation: blink 2s ease infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ===========================
   METHODOLOGY TIMELINE
   =========================== */
.methodology-subtitle {
    text-align: center;
    font-family: var(--font-tech);
    color: #666;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 2rem;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 4rem auto;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--copper-neon), var(--cyan-electric), transparent);
    transform: translateX(-50%);
}

.timeline-node {
    position: relative;
    margin-bottom: 4rem;
    width: 50%;
    padding: 0 2rem;
}

.timeline-node:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-node:nth-child(even) {
    left: 50%;
    text-align: left;
}

.node-dot {
    position: absolute;
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--void-bg);
    border: 2px solid var(--cyan-electric);
    border-radius: 50%;
    z-index: 2;
    transition: all 0.4s var(--ease-elastic);
}

.timeline-node:nth-child(odd) .node-dot {
    right: -10px;
}

.timeline-node:nth-child(even) .node-dot {
    left: -10px;
}

.timeline-node:hover .node-dot {
    background: var(--cyan-electric);
    box-shadow: 0 0 25px var(--cyan-electric);
    transform: scale(1.3);
}

.node-content {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2rem;
    border-radius: 8px;
    transition: all 0.4s var(--ease-smooth);
}

.node-content h3 {
    margin: 0.5rem 0;
}

.node-content p {
    color: #999;
    line-height: 1.6;
    font-size: 0.95rem;
}

.timeline-node:hover .node-content {
    transform: scale(1.03);
    border-color: var(--copper-neon);
    box-shadow: 0 8px 32px rgba(255, 157, 92, 0.08);
}

.node-date {
    font-family: var(--font-tech);
    color: var(--copper-neon);
    font-size: 0.8rem;
    display: block;
}

.node-number {
    font-family: var(--font-tech);
    font-size: 2.5rem;
    font-weight: 900;
    color: rgba(0, 243, 255, 0.08);
    position: absolute;
    top: -0.5rem;
}

.timeline-node:nth-child(odd) .node-number {
    left: 2rem;
}

.timeline-node:nth-child(even) .node-number {
    right: 2rem;
}

/* ===========================
   RESULTS
   =========================== */
.results-list {
    list-style: none;
    margin-bottom: 2rem;
}

.results-list li {
    margin-bottom: 1.2rem;
    line-height: 1.6;
    color: #bbb;
}

.result-label {
    color: #fff;
    display: block;
    margin-bottom: 0.2rem;
}

.system-status {
    font-family: var(--font-tech);
    font-size: 0.8rem;
    color: #555;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.8;
}

.status-nominal {
    color: var(--acid-green);
}

.status-value {
    color: var(--cyan-electric);
}

/* ===========================
   CHART
   =========================== */
.chart-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 2rem;
    border: 1px solid #222;
    border-radius: 8px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-family: var(--font-tech);
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 2px;
}

.chart-badge {
    font-family: var(--font-tech);
    font-size: 0.65rem;
    color: var(--acid-green);
    border: 1px solid rgba(191, 255, 0, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    letter-spacing: 1px;
    animation: blink 3s ease infinite;
}

/* ===========================
   DOWNLOAD
   =========================== */
#download {
    min-height: 60vh;
}

.download-section {
    padding: 4rem 2rem;
}

.download-tag {
    font-family: var(--font-tech);
    font-size: 0.75rem;
    color: var(--cyan-electric);
    letter-spacing: 4px;
    display: block;
    margin-bottom: 1.5rem;
}

.download-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #fff;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.download-desc {
    color: #888;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 4rem 2rem 2rem;
    font-family: var(--font-tech);
    color: #555;
    position: relative;
    z-index: 2;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand {
    font-size: 2rem;
    font-weight: 900;
    font-family: var(--font-display);
    color: #fff;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-tagline {
    color: #666;
    font-size: 0.85rem;
}

.footer-label {
    font-size: 0.7rem;
    color: var(--copper-neon);
    letter-spacing: 2px;
    display: block;
    margin-bottom: 0.75rem;
}

.footer-col p {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: #888;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: #444;
}

/* ===========================
   NAVIGATION
   =========================== */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.2rem 2rem;
    z-index: 1000;
    font-family: var(--font-tech);
    font-size: 0.85rem;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.4s var(--ease-smooth);
}

.main-nav.scrolled {
    padding: 0.8rem 2rem;
    background: rgba(5, 5, 5, 0.95);
    border-bottom-color: rgba(255, 157, 92, 0.2);
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.3rem;
    color: #fff;
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #999;
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
    letter-spacing: 1px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--copper-neon);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: #fff;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link--accent {
    color: var(--cyan-electric);
}

.nav-link--accent:hover {
    color: var(--cyan-electric);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.nav-link--accent::after {
    background: var(--cyan-electric);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===========================
   REVEAL ANIMATIONS
   =========================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-smooth), transform 0.8s var(--ease-smooth);
}

.reveal--left {
    transform: translateX(-40px);
}

.reveal--right {
    transform: translateX(40px);
}

.reveal.visible {
    opacity: 1;
    transform: translate(0);
}

/* ===========================
   SECTION TITLE
   =========================== */
.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 3rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -2px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
    .split-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .glitch {
        font-size: 3.5rem;
        letter-spacing: -2px;
    }

    .hero {
        padding-left: 2rem;
    }

    .quote-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .mini-stat-value {
        font-size: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .scroll-indicator {
        display: none;
    }

    #data .split-layout > div {
        order: unset !important;
    }
}

@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }

    .timeline-node {
        width: 100%;
        left: 0 !important;
        padding-left: 50px;
        text-align: left !important;
    }

    .timeline-node:nth-child(odd) .node-dot,
    .timeline-node:nth-child(even) .node-dot {
        left: 10px;
    }

    .timeline-node:nth-child(odd) .node-number,
    .timeline-node:nth-child(even) .node-number {
        right: 1rem;
        left: auto;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transition: right 0.4s var(--ease-smooth);
    }

    .nav-links.open {
        right: 0;
    }

    .nav-toggle {
        display: flex;
        z-index: 1001;
    }

    section {
        padding: 4rem 1.5rem;
    }

    .glass-panel {
        padding: 2rem;
    }

    .model-container {
        height: 400px;
    }

    .highlight-quote {
        font-size: 1.2rem;
    }
}

/* Touch devices: show normal cursor */
@media (hover: none) {
    * { cursor: auto !important; }
    .cursor-dot, .cursor-outline { display: none; }
}
