/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Source+Code+Pro:wght@300;400;600&display=swap');

/* CSS Variables for theme customization */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-primary: #00ff41;
    --text-secondary: #a8b2d1;
    --accent-cyan: #00ffff;
    --accent-orange: #ffa500;
    --accent-pink: #e91e63;
    --accent-red: #ff1744;
    --font-mono: 'Source Code Pro', monospace;
    --font-display: 'Orbitron', monospace;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Matrix background effect */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    opacity: 0.1;
    pointer-events: none;
}

.matrix-column {
    position: absolute;
    top: -100px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    animation: fall linear infinite;
}

@keyframes fall {
    0% { top: -100px; opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100vh; opacity: 0; }
}

/* Scanlines overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* Header */
.site-header {
    padding: 2rem 0;
    border-bottom: 1px solid #21262d;
    position: relative;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.logo-link {
    text-decoration: none;
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-current {
    color: var(--accent-cyan);
    text-shadow: 0 0 5px var(--accent-cyan);
}

/* Troll trigger */
.troll-trigger {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    transition: all 0.3s ease;
}

.troll-trigger:hover {
    box-shadow: 0 0 10px var(--accent-pink);
}

.troll-emoji {
    font-size: 1.5rem;
    filter: hue-rotate(180deg);
}

.click-counter {
    font-size: 0.8rem;
    color: var(--accent-pink);
    font-weight: bold;
}

/* Containment status */
.containment-status {
    font-size: 0.8rem;
    text-transform: uppercase;
}

.status-label {
    color: var(--text-secondary);
}

.status-value {
    font-weight: bold;
    margin-left: 0.5rem;
}

.status-GREEN { color: #00ff41; }
.status-YELLOW { color: #ffa500; }
.status-ORANGE { color: #ff8c00; }
.status-RED { color: #ff1744; }

/* Alert banner */
.alert-banner {
    background: linear-gradient(45deg, var(--accent-red), #d50000);
    color: white;
    padding: 1rem 0;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: alertPulse 2s infinite;
}

@keyframes alertPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Main content */
.site-main {
    padding: 3rem 0;
    min-height: 60vh;
}

/* Page header */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Post grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Post cards */
.post-card {
    background: rgba(22, 27, 34, 0.9);
    border: 1px solid #21262d;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-primary);
}

.post-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.post-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card-content {
    padding: 1.5rem;
}

.post-card-featured {
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 1rem;
    display: inline-block;
}

.post-card-title {
    margin-bottom: 1rem;
}

.post-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.2rem;
    line-height: 1.3;
}

.post-card-title a:hover {
    color: var(--accent-cyan);
}

.post-card-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Single post */
.post-full {
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    text-align: center;
    margin-bottom: 3rem;
}

.post-featured {
    background: var(--accent-red);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 1rem;
    display: inline-block;
}

.post-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.post-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.post-meta > * {
    margin-right: 1rem;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 3rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--accent-cyan);
    font-family: var(--font-display);
    margin: 2rem 0 1rem 0;
    text-transform: uppercase;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content strong {
    color: var(--accent-orange);
}

/* Troll Portal */
.troll-portal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.troll-portal-content {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-pink);
    padding: 2rem;
    text-align: center;
    max-width: 500px;
    animation: glitchIn 0.5s ease-out;
}

.troll-large {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: hue-rotate(180deg);
}

.portal-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.portal-button {
    padding: 0.8rem 1.5rem;
    border: none;
    font-family: var(--font-display);
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portal-enter {
    background: var(--accent-red);
    color: white;
}

.portal-cancel {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.portal-button:hover {
    box-shadow: 0 0 10px currentColor;
}

/* Glitch animations */
.glitch-text {
    animation: glitch 0.3s;
}

@keyframes glitch {
    0% { transform: translate(0); filter: hue-rotate(0deg); }
    20% { transform: translate(-2px, 2px); filter: hue-rotate(90deg); }
    40% { transform: translate(-2px, -2px); filter: hue-rotate(180deg); }
    60% { transform: translate(2px, 2px); filter: hue-rotate(270deg); }
    80% { transform: translate(2px, -2px); filter: hue-rotate(360deg); }
    100% { transform: translate(0); filter: hue-rotate(0deg); }
}

@keyframes glitchIn {
    0% { opacity: 0; transform: scale(0.8) rotateX(90deg); }
    50% { opacity: 0.5; transform: scale(1.1) rotateX(45deg); }
    100% { opacity: 1; transform: scale(1) rotateX(0deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .site-title {
        font-size: 1.5rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .post-grid {
        grid-template-columns: 1fr;
    }
    
    .site-nav {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Theme-specific body classes */
.institute-GREEN .status-indicator { color: #00ff41; }
.institute-YELLOW .status-indicator { color: #ffa500; }
.institute-ORANGE .status-indicator { color: #ff8c00; }
.institute-RED .status-indicator { color: #ff1744; }

.glitch-Low .glitch-element { animation-duration: 5s; }
.glitch-Medium .glitch-element { animation-duration: 3s; }
.glitch-High .glitch-element { animation-duration: 1s; }



/* ===== GHOST CONTENT CARDS - REQUIRED STYLES ===== */

/* Gallery Cards */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    max-width: 1040px;
    margin: 1.5em auto;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-image:not(:first-of-type) {
    margin: 0 0 0 0.75em;
}

.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
    border: 1px solid var(--accent-cyan);
    border-radius: 3px;
    filter: brightness(0.9) contrast(1.1);
}

/* Bookmark Cards */
.kg-bookmark-card {
    background: rgba(22, 27, 34, 0.9);
    border: 1px solid #21262d;
    border-radius: 3px;
    overflow: hidden;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    margin: 1.5em 0;
    transition: all 0.3s ease;
    position: relative;
}

.kg-bookmark-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-cyan);
}

.kg-bookmark-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.kg-bookmark-container {
    display: flex;
    flex-wrap: wrap;
    color: var(--text-secondary);
    text-decoration: none;
    width: 100%;
}

.kg-bookmark-content {
    flex-basis: 0;
    flex-grow: 999;
    padding: 20px;
    order: 1;
}

.kg-bookmark-title {
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.3em;
    font-weight: 600;
    margin-bottom: 0.5em;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kg-bookmark-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5em;
    margin-bottom: 1em;
    opacity: 0.8;
}

.kg-bookmark-metadata {
    align-items: center;
    color: var(--accent-orange);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    flex-wrap: wrap;
    text-transform: uppercase;
}

.kg-bookmark-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 0.5em;
    filter: brightness(1.2);
}

.kg-bookmark-author {
    color: var(--accent-orange);
    text-decoration: none;
}

.kg-bookmark-author:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 5px var(--accent-cyan);
}

.kg-bookmark-publisher {
    color: var(--text-secondary);
    opacity: 0.7;
}

.kg-bookmark-publisher:before {
    content: " • ";
}

.kg-bookmark-thumbnail {
    flex-basis: 24rem;
    flex-grow: 1;
    order: 2;
    min-height: 140px;
    background-size: cover;
    background-position: center;
    border-left: 1px solid #21262d;
    position: relative;
}

.kg-bookmark-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 255, 65, 0.05);
    mix-blend-mode: overlay;
}

/* Content Width Classes */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: auto calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Responsive Content Cards */
@media (max-width: 640px) {
    .kg-gallery-container {
        margin: 1.5em auto;
    }
    
    .kg-gallery-row {
        flex-direction: column;
    }
    
    .kg-gallery-image:not(:first-of-type) {
        margin: 0.75em 0 0 0;
    }
    
    .kg-bookmark-container {
        flex-direction: column;
    }
    
    .kg-bookmark-thumbnail {
        order: 1;
        flex-basis: 160px;
        border-left: none;
        border-bottom: 1px solid #21262d;
    }
    
    .kg-width-wide,
    .kg-width-full {
        position: relative;
        width: 100vw;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        transform: none;
    }
}

/* Page portal note styling */
.page-portal-note {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    border-radius: 3px;
    text-align: center;
    font-size: 0.9rem;
}

.page-portal-note em {
    color: var(--accent-pink);
}