/* ============================================
   polytical.club - Vaporwave Scholarly Archive
   Colors: #ff6b35, #c77dff, #ff6bff, #39ff14, #1a1a2e, #7b2fff, #00d4ff, #ffffff
   Fonts: Space Mono, EB Garamond, VT323
   ============================================ */

/* --- Keyframes --- */
@keyframes hueRotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

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

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

@keyframes gridScroll {
    0% { transform: perspective(400px) rotateX(45deg) translateY(0); }
    100% { transform: perspective(400px) rotateX(45deg) translateY(50px); }
}

@keyframes glitch {
    0% { text-shadow: 2px 0 #ff6bff, -2px 0 #00d4ff; }
    25% { text-shadow: -2px 0 #ff6bff, 2px 0 #00d4ff; }
    50% { text-shadow: 2px 2px #ff6bff, -2px -2px #00d4ff; }
    75% { text-shadow: -2px 2px #ff6bff, 2px -2px #00d4ff; }
    100% { text-shadow: 2px 0 #ff6bff, -2px 0 #00d4ff; }
}

/* --- Reset and Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'EB Garamond', Georgia, serif;
    background-color: #1a1a2e;
    color: #ffffff;
    overflow-x: hidden;
    line-height: 1.7;
}

/* Grain overlay on body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.vt323-text {
    font-family: 'VT323', monospace;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
}

#hero-grid {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(123, 47, 255, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 47, 255, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridScroll 4s linear infinite;
    transform-origin: center center;
}

.hero-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    z-index: 2;
}

#hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 1.2s ease-out;
}

.hero-tagline {
    font-size: 1.2rem;
    color: #39ff14;
    letter-spacing: 6px;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.hero-title {
    font-family: 'Space Mono', monospace;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 700;
    color: #ffffff;
    text-transform: lowercase;
    letter-spacing: -2px;
    line-height: 1.1;
    animation: glitch 3s ease-in-out infinite;
}

.hero-title .dot {
    color: #ff6bff;
}

.hero-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-style: italic;
    color: #c77dff;
    margin-top: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-ornament {
    font-size: 1.5rem;
    color: #ff6b35;
    margin: 2rem 0;
    letter-spacing: 12px;
}

.hero-cta {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: #1a1a2e;
    background: linear-gradient(135deg, #ff6bff, #00d4ff);
    padding: 14px 40px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 3px;
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 107, 255, 0.4);
}

/* --- Chapter Divider --- */
.chapter-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 3rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.chapter-number {
    font-size: 1.4rem;
    color: #39ff14;
    letter-spacing: 4px;
    white-space: nowrap;
}

.chapter-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #7b2fff, #ff6bff, #00d4ff);
}

.chapter-label {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: #c77dff;
    white-space: nowrap;
}

/* --- Topics Grid (Portfolio Grid) --- */
#topics {
    padding: 0 5% 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* --- Topic Card --- */
.topic-card {
    position: relative;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.topic-card:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(123, 47, 255, 0.3);
}

/* Animated gradient border */
.card-border-animate {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 6px;
    background: linear-gradient(270deg, #ff6bff, #00d4ff, #39ff14, #ff6b35, #7b2fff, #c77dff);
    background-size: 600% 600%;
    animation: borderGlow 6s ease infinite;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.topic-card:hover .card-border-animate {
    opacity: 1;
}

.card-inner {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98), rgba(13, 13, 26, 0.98));
    border-radius: 4px;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(123, 47, 255, 0.2);
    transition: border-color 0.3s ease;
}

.topic-card:hover .card-inner {
    border-color: transparent;
}

.card-number {
    font-size: 2.5rem;
    color: rgba(255, 107, 255, 0.15);
    position: absolute;
    top: 12px;
    right: 16px;
}

.card-ornament {
    font-size: 1.2rem;
    color: #ff6b35;
    margin-bottom: 0.8rem;
}

.card-title {
    font-family: 'Space Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.card-excerpt {
    font-family: 'EB Garamond', serif;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    flex: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(123, 47, 255, 0.15);
}

.card-tag {
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    color: #00d4ff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.card-arrow {
    font-size: 1.2rem;
    color: #ff6bff;
    transition: transform 0.3s ease;
}

.topic-card:hover .card-arrow {
    transform: translateX(5px);
}

/* --- About Section --- */
#about {
    padding: 4rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.about-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.about-heading {
    font-family: 'Space Mono', monospace;
    font-size: 1.8rem;
    color: #ffffff;
    margin-bottom: 2rem;
    letter-spacing: -0.5px;
}

.about-text {
    font-family: 'EB Garamond', serif;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.about-text em {
    color: #ff6bff;
    font-style: italic;
}

.about-marginal {
    padding-left: 2rem;
    border-left: 2px solid rgba(123, 47, 255, 0.3);
}

.marginal-note {
    margin-bottom: 2rem;
}

.marginal-marker {
    font-size: 0.9rem;
    color: #39ff14;
    letter-spacing: 3px;
    display: block;
    margin-bottom: 0.5rem;
}

.marginal-note p {
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    font-style: italic;
}

/* --- Footer --- */
#footer {
    position: relative;
    padding: 4rem 5%;
    text-align: center;
    overflow: hidden;
    margin-top: 4rem;
    border-top: 1px solid rgba(123, 47, 255, 0.2);
}

.footer-grid-bg {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.footer-content {
    position: relative;
    z-index: 1;
}

.footer-ornament {
    font-size: 1.2rem;
    color: #ff6b35;
    letter-spacing: 12px;
    margin-bottom: 1.5rem;
}

.footer-title {
    font-size: 1.3rem;
    color: #c77dff;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
}

.footer-subtitle {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-links a {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #00d4ff;
    text-decoration: none;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #ff6bff;
}

.footer-copy {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 26, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

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

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #0d0d1a);
    border: 1px solid rgba(123, 47, 255, 0.4);
    border-radius: 4px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 3rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-family: 'VT323', monospace;
    font-size: 2rem;
    color: #ff6bff;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #39ff14;
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-number {
    font-size: 1rem;
    color: #39ff14;
    letter-spacing: 3px;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    color: #ffffff;
}

.modal-body {
    font-family: 'EB Garamond', serif;
}

.modal-text {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

/* --- Card Reveal Animation --- */
.topic-card {
    opacity: 0;
    transform: translateY(30px);
}

.topic-card.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .about-container {
        grid-template-columns: 1fr;
    }

    .about-marginal {
        padding-left: 1.5rem;
    }

    .topics-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        letter-spacing: -1px;
    }

    .chapter-divider {
        padding: 2rem 5%;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}
