@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Inter:wght@300;400;500&family=JetBrains+Mono:wght@300;400&family=Syne:wght@400;600;700&family=Comfortaa:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #f8f7f4;
    --text-primary: #111114;
    --text-secondary: #60606a;
    --accent: #d4af37;
    --accent-alt: #e63946;
    --border-color: rgba(96, 96, 106, 0.2);
    --surface: #ffffff;
    --canvas-opacity: 0.6;
}

[data-theme="dark"] {
    --bg-color: #070709;
    --text-primary: #f0eee9;
    --text-secondary: #9999a1;
    --accent: #d4af37;
    --accent-alt: #5e7ce2;
    --border-color: rgba(240, 238, 233, 0.15);
    --surface: #111115;
    --canvas-opacity: 0.3;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

#ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: var(--canvas-opacity);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 2rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

a:hover { color: var(--accent); }

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5vw;
}

header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 5vw 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
    gap: 1.5rem;
}

.theme-toggle {
    position: absolute;
    top: 2.5rem;
    right: 5vw;
}

.header-name-container {
    text-align: center;
}

.header-name {
    font-family: 'Comfortaa', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.2;
}

.header-subtitle {
    font-family: 'Comfortaa', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 0.2rem;
}

header.scrolled { border-bottom: 1px solid var(--border-color); }



.logo-container img { height: 48px; color: var(--text-primary); }
[data-theme="dark"] .logo-container img { filter: invert(1); }

nav ul {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

nav a {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 400;
}

nav a.active {
    color: var(--accent);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.3s;
}
.theme-toggle:hover { background-color: var(--border-color); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }

.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-8 { margin-top: 2rem; }

section { padding: 8rem 0; }

.hero {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero p.lead {
    font-size: 1.5rem;
    max-width: 600px;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-family: 'Syne', sans-serif;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 3rem;
}

/* Premium Card Styles */
.card {
    position: relative;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 3rem;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease, border-color 0.4s ease, background 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

[data-theme="dark"] .card {
    background: rgba(17, 17, 21, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .card::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
    border-color: rgba(212, 175, 55, 0.4);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    border-color: rgba(212, 175, 55, 0.3);
}

.card:hover::before {
    opacity: 1;
}

.card h3 { 
    margin-bottom: 1rem; 
    position: relative; 
    z-index: 1; 
}

.card p { 
    color: var(--text-secondary); 
    font-size: 0.95rem; 
    position: relative; 
    z-index: 1; 
    flex-grow: 1;
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    align-self: flex-start;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

[data-theme="dark"] .tag {
    background: rgba(0,0,0,0.2);
}

.read-more {
    display: inline-block;
    margin-top: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
    position: relative;
    z-index: 1;
    align-self: flex-start;
}

.read-more:hover {
    border-color: currentColor;
}

footer {
    padding: 4rem 5vw;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}


/* Responsive Design */
@media (max-width: 900px) {
    header {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }
    .content-container {
        padding: 0 1rem;
    }
    section {
        padding: 4rem 0;
    }
}
@media (max-width: 600px) {
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
}

/* Monograph Grid */
.monograph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.monograph-tag {
    border: 1px solid var(--tag-color);
    color: var(--tag-color);
    background: transparent;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.3s ease;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.card:hover .monograph-tag {
    background: var(--tag-color);
    color: #ffffff;
}

/* Card Hover Effect for Tags */
.card:hover .monograph-tag {
    background-color: var(--tag-color) !important;
    color: #ffffff !important;
}

/* Responsive Layout for Research */
.color-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
}
.filter-item {
    font-size: 0.85rem; 
    font-family: 'JetBrains Mono', monospace; 
    cursor: pointer; 
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
}
.filter-item:hover {
    opacity: 0.8 !important;
}
.monograph-card {
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 900px) {
    .research-layout {
        flex-direction: column !important;
    }
    .research-sidebar {
        position: relative !important;
        top: 0 !important;
        width: 100%;
        margin-bottom: 2rem;
    }
    #filter-menu {
        flex-direction: row !important;
        flex-wrap: wrap;
    }
}

/* Systems Terminal Pulse */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}
.pulse-dot {
    animation: pulse 2s infinite ease-in-out;
}
@media (max-width: 600px) {
    .systems-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Header overrides */
nav ul {
    justify-content: center;
}
nav a {
    font-family: 'Comfortaa', sans-serif !important;
}
@media (max-width: 800px) {
    header {
        flex-direction: column;
        padding: 2rem 1rem 1.5rem;
        gap: 1.5rem;
    }
    .theme-toggle {
        top: 2rem;
        right: 1.5rem;
    }
}
@media (max-width: 600px) {
    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
}

[data-theme="light"] .pgp-card { background-color: rgba(0,0,0,0.02) !important; border-color: rgba(0,0,0,0.1) !important; }
[data-theme="light"] .code-block { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.08) !important; }
