/* ============================================================
   historygrapher.net - Cyberpunk Historical Visualization Gallery
   Color Palette:
     Midnight deep:    #0A1428
     Midnight mid:     #14203A
     Midnight light:   #1A2848
     Neon blue:        #4080FF
     Neon cyan:        #40D0E0
     Paper aged:       #C0A880
     Text light:       #B0C0D8
     Geometric muted:  #304060
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0A1428;
    color: #B0C0D8;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================================
   Typography
   ============================================================ */

.logotype {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: clamp(16px, 2.5vw, 32px);
    letter-spacing: 0.04em;
    color: #B0C0D8;
    text-shadow: 0 0 20px rgba(64, 128, 255, 0.8), 0 0 40px rgba(64, 128, 255, 0.4), 0 0 80px rgba(64, 128, 255, 0.2);
    min-height: 1.2em;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 40px);
    color: #B0C0D8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-subtitle {
    font-family: 'Inter', sans-serif;
    color: #B0C0D8;
    opacity: 0.6;
    margin-top: 8px;
    font-size: clamp(13px, 1vw, 15px);
}

/* ============================================================
   Geometric Background Shapes
   ============================================================ */

.geo-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.geo-shape {
    position: absolute;
    opacity: 0;
    transition: opacity 2s ease;
}

.geo-shape.visible {
    opacity: 1;
}

.geo-shape svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   Paper Texture Overlay
   ============================================================ */

.paper-texture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(192, 168, 128, 0.02) 0px,
        transparent 1px,
        transparent 4px
    );
}

.paper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(192, 168, 128, 0.1) 0px,
        transparent 1px,
        transparent 3px
    );
    z-index: 2;
}

/* ============================================================
   Hero Section
   ============================================================ */

#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #0A1428;
    overflow: hidden;
    padding: 40px 20px;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 60px;
}

.hero-tagline {
    font-family: 'Inter', sans-serif;
    font-size: clamp(13px, 1.2vw, 18px);
    color: #B0C0D8;
    opacity: 0;
    margin-top: 20px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity 1s ease;
}

.hero-tagline.visible {
    opacity: 0.7;
}

/* Hero Visualization */
.hero-viz {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 900px;
}

.hero-timeline {
    width: 100%;
    height: auto;
}

.hero-timeline .timeline-node {
    fill: #4080FF;
    filter: url(#neonGlow);
}

.hero-timeline .timeline-connection {
    stroke: #4080FF;
    stroke-opacity: 0.4;
    stroke-width: 1.5;
    fill: none;
}

.hero-timeline .timeline-label {
    fill: #B0C0D8;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    opacity: 0.7;
}

/* ============================================================
   Portfolio Grid Section
   ============================================================ */

#portfolio {
    position: relative;
    padding: 100px 40px;
    background-color: #0A1428;
}

.section-header {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 60px;
}

.portfolio-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Portfolio Cards */
.portfolio-card {
    background-color: #14203A;
    border: 1px solid rgba(64, 128, 255, 0.2);
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 250ms ease-out, border-color 250ms ease-out, box-shadow 250ms ease-out, opacity 400ms ease-out;
}

.portfolio-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-card:hover {
    transform: scale(1.03) translateY(-4px);
    border-color: rgba(64, 128, 255, 0.6);
    box-shadow: 0 0 8px rgba(64, 128, 255, 0.2);
    z-index: 3;
}

.portfolio-card.dimmed {
    opacity: 0.85;
}

.card-thumbnail {
    position: relative;
    overflow: hidden;
}

.card-viz {
    width: 100%;
    height: auto;
    display: block;
}

.card-info {
    padding: 16px;
}

.card-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(12px, 1.2vw, 16px);
    color: #B0C0D8;
    margin-bottom: 4px;
}

.card-creator {
    font-family: 'Inter', sans-serif;
    font-size: clamp(11px, 0.9vw, 13px);
    color: #40D0E0;
    display: block;
    margin-bottom: 8px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
    font-size: clamp(10px, 0.8vw, 12px);
    color: #B0C0D8;
    opacity: 0.6;
}

.card-period {
    color: #C0A880;
}

/* Masonry-like varying heights via nth-child */
.portfolio-card:nth-child(2) .card-viz { min-height: 140px; }
.portfolio-card:nth-child(4) .card-viz { min-height: 130px; }
.portfolio-card:nth-child(5) .card-viz { min-height: 110px; }
.portfolio-card:nth-child(8) .card-viz { min-height: 140px; }

/* ============================================================
   Featured Creator Spotlight
   ============================================================ */

#spotlight {
    position: relative;
    padding: 100px 40px;
    background-color: #0A1428;
    border-top: 1px solid rgba(64, 128, 255, 0.1);
    border-bottom: 1px solid rgba(64, 128, 255, 0.1);
}

.spotlight-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
}

.spotlight-profile {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    margin-bottom: 60px;
}

.spotlight-avatar {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 1px solid rgba(64, 128, 255, 0.3);
    overflow: hidden;
}

.avatar-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.spotlight-info {
    flex: 1;
}

.spotlight-name {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(18px, 2vw, 28px);
    color: #B0C0D8;
    margin-bottom: 12px;
}

.spotlight-bio {
    font-family: 'Inter', sans-serif;
    color: #B0C0D8;
    opacity: 0.7;
    line-height: 1.75;
    margin-bottom: 20px;
    max-width: 600px;
}

.spotlight-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    font-family: 'Inter', sans-serif;
    font-size: clamp(12px, 1vw, 14px);
    color: #B0C0D8;
    opacity: 0.7;
}

.stat-value {
    color: #40D0E0;
    font-weight: 600;
    margin-right: 4px;
}

.spotlight-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.spotlight-card {
    background-color: #14203A;
    border: 1px solid rgba(64, 128, 255, 0.15);
    overflow: hidden;
    transition: border-color 250ms ease-out, box-shadow 250ms ease-out, transform 250ms ease-out;
    cursor: pointer;
}

.spotlight-card:hover {
    border-color: rgba(64, 128, 255, 0.5);
    box-shadow: 0 0 8px rgba(64, 128, 255, 0.15);
    transform: translateY(-3px);
}

.spotlight-card-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(11px, 1vw, 14px);
    color: #B0C0D8;
    padding: 12px 16px 4px;
}

.spotlight-card-period {
    font-family: 'Inter', sans-serif;
    font-size: clamp(10px, 0.8vw, 12px);
    color: #C0A880;
    padding: 0 16px 12px;
    display: block;
}

/* ============================================================
   Network Map Section
   ============================================================ */

#network-map {
    position: relative;
    padding: 100px 40px;
    background-color: #0A1428;
}

.network-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    height: 500px;
    margin: 0 auto;
    border: 1px solid rgba(64, 128, 255, 0.15);
    background-color: #14203A;
    overflow: hidden;
}

#network-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================================
   Footer
   ============================================================ */

#footer {
    position: relative;
    padding: 60px 40px;
    background-color: #0A1428;
    border-top: 1px solid rgba(64, 128, 255, 0.1);
}

.footer-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: clamp(10px, 1.5vw, 16px);
    color: #B0C0D8;
    text-shadow: 0 0 10px rgba(64, 128, 255, 0.5);
    letter-spacing: 0.04em;
    margin-bottom: 24px;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.footer-link {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(8px, 0.8vw, 11px);
    color: #40D0E0;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 250ms ease, text-shadow 250ms ease;
}

.footer-link:hover {
    color: #4080FF;
    text-shadow: 0 0 8px rgba(64, 128, 255, 0.5);
}

.footer-copy {
    font-family: 'Inter', sans-serif;
    font-size: clamp(11px, 0.8vw, 13px);
    color: #B0C0D8;
    opacity: 0.4;
}

/* ============================================================
   Card Detail Overlay
   ============================================================ */

.card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease;
}

.card-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

.overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 20, 40, 0.92);
}

.overlay-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    width: 90%;
    background-color: #14203A;
    border: 1px solid rgba(64, 128, 255, 0.3);
    padding: 40px;
    transform: scale(0.95);
    transition: transform 800ms ease;
}

.card-overlay.active .overlay-content {
    transform: scale(1);
}

.overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: 1px solid rgba(64, 128, 255, 0.3);
    color: #B0C0D8;
    font-size: 24px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 250ms ease, color 250ms ease;
}

.overlay-close:hover {
    border-color: rgba(64, 128, 255, 0.6);
    color: #40D0E0;
}

.overlay-viz {
    width: 100%;
    height: 200px;
    background-color: #0A1428;
    border: 1px solid rgba(64, 128, 255, 0.15);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.overlay-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 28px);
    color: #B0C0D8;
    margin-bottom: 8px;
}

.overlay-creator {
    font-family: 'Inter', sans-serif;
    color: #40D0E0;
    font-size: clamp(13px, 1vw, 16px);
    margin-bottom: 4px;
}

.overlay-period {
    font-family: 'Inter', sans-serif;
    color: #C0A880;
    font-size: clamp(12px, 0.9vw, 14px);
    margin-bottom: 16px;
}

.overlay-description {
    font-family: 'Inter', sans-serif;
    color: #B0C0D8;
    opacity: 0.7;
    line-height: 1.75;
}

/* ============================================================
   Viz Node Glow
   ============================================================ */

.viz-node {
    filter: drop-shadow(0 0 3px rgba(64, 128, 255, 0.6));
}

/* ============================================================
   Scrollbar Styling
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0A1428;
}

::-webkit-scrollbar-thumb {
    background: #304060;
}

::-webkit-scrollbar-thumb:hover {
    background: #4080FF;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .spotlight-works {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .spotlight-profile {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .spotlight-stats {
        justify-content: center;
    }

    .network-container {
        height: 400px;
    }
}

@media (max-width: 600px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .spotlight-works {
        grid-template-columns: 1fr;
    }

    #portfolio {
        padding: 60px 20px;
    }

    #spotlight {
        padding: 60px 20px;
    }

    #network-map {
        padding: 60px 20px;
    }

    .network-container {
        height: 300px;
    }

    .footer-nav {
        gap: 16px;
    }

    .overlay-content {
        padding: 24px;
    }
}

/* ============================================================
   Stroke dash animation for connections
   ============================================================ */

@keyframes flowDash {
    from {
        stroke-dashoffset: 20;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.flowing-connection {
    stroke-dasharray: 5, 5;
    animation: flowDash 4s linear infinite;
}

/* ============================================================
   Geometric shape drift animation
   ============================================================ */

@keyframes driftA {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10px, -10px); }
}

@keyframes driftB {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10px, 10px); }
}

@keyframes driftC {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(8px, 8px); }
}

.geo-shape.drift-a { animation: driftA 35s ease-in-out infinite; }
.geo-shape.drift-b { animation: driftB 42s ease-in-out infinite; }
.geo-shape.drift-c { animation: driftC 50s ease-in-out infinite; }
