:root {
    --bg-primary: #f6f8fa;
    --bg-secondary: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.8);
    
    --text-primary: #1e2433;
    --text-secondary: #4a5568;
    --text-muted: #8aa0bb;
    
    --accent-1: #1a5c8a; /* Deep elegant blue */
    --accent-2: #804020; /* Deep elegant terracotta/gold */
    --accent-glow: rgba(26, 92, 138, 0.15);
    
    --border-light: rgba(26, 92, 138, 0.15);
    --border-strong: rgba(128, 64, 32, 0.3);
    
    --nav-glass: rgba(246, 248, 250, 0.85);
    --panel-glass: rgba(255, 255, 255, 0.65);
    
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body.light-mode {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Canvas */
#lattice-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Typography Gradient */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Typography & Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.container.wide {
    max-width: 1000px;
}

/* Navigation */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background: var(--nav-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 1000;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo span {
    color: var(--accent-1);
    font-weight: 300;
    margin-left: 2px;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-1);
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 0 5%;
}

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-1);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2rem;
    background: rgba(26, 92, 138, 0.05);
}

.hero h1 {
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1.5rem;
}

.hero .subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.cta-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--text-primary); /* Dark button on light bg looks elegant */
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    background: var(--accent-1);
    box-shadow: 0 6px 20px rgba(26, 92, 138, 0.25);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid #d1d5db; /* softer gray */
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--text-secondary);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.6;
}

.scroll-indicator .mouse {
    width: 24px;
    height: 36px;
    border: 2px solid var(--text-secondary);
    border-radius: 12px;
    position: relative;
}

.scroll-indicator .mouse::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-1);
    border-radius: 50%;
    animation: scrollAnimation 2s infinite;
}

@keyframes scrollAnimation {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 15px); opacity: 0; }
}

/* Sections */
.section {
    padding: 8rem 0;
    position: relative;
}

.alt-bg {
    background-color: var(--bg-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.section-header {
    text-align: center;
    margin-bottom: 5rem;
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.section-header h2 span {
    color: var(--accent-1);
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--panel-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8); /* white glint */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 2.5rem;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
}

.glass-panel:hover {
    box-shadow: 0 12px 40px rgba(26, 92, 138, 0.08);
    transform: translateY(-3px);
}

/* Text & Math */
h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

p {
    margin-bottom: 1.2rem;
}

.mono-label {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-1);
    letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

.math-box {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(26, 92, 138, 0.03);
    border-left: 3px solid var(--accent-1);
    font-size: 1.1rem;
    border-radius: 0 6px 6px 0;
}

.math-display {
    font-size: clamp(0.85rem, 2.5vw, 1.15rem);
    padding: 1.5rem 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

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

/* Visual Assets (Canvas wrappers) */
.visual-card .canvas-wrapper {
    width: 100%;
    aspect-ratio: 1;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e5e7eb;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
}

.light-canvas {
    background: radial-gradient(circle at center, #ffffff 0%, #f3f4f6 100%);
}

.visual-card .canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.caption {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 1rem;
}

/* Details IA / Collapsible */
.ia-details {
    background: transparent;
    border: none;
    border-radius: 6px;
}

.ia-summary {
    list-style: none;
    cursor: pointer;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    transition: background 0.3s, box-shadow 0.3s;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.ia-summary::-webkit-details-marker {
    display: none;
}

.ia-summary:hover {
    background: #fdfdfe;
    box-shadow: 0 4px 12px rgba(26, 92, 138, 0.05);
}

.ia-summary .mono-label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ia-content {
    padding: 2rem 1.5rem;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: var(--bg-primary);
}

.ia-content h4 {
    color: var(--accent-1);
    font-family: var(--font-mono);
    font-size: 1rem;
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.ia-content h4:first-child {
    margin-top: 1rem;
}

.ia-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.ia-content li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Register Transition */
.register-transition {
    padding: 6rem 5%;
    text-align: center;
}

.separator-line {
    height: 1px;
    width: 80px;
    background: linear-gradient(90deg, transparent, var(--accent-1), transparent);
    margin: 0 auto 2rem;
}

.register-transition p {
    font-style: italic;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Footer / Reconnaissance */
.badge-reconnaissance { border-color: var(--accent-1); color: var(--accent-1); }
.reconnaissance-panel h3 { margin-bottom: 1.5rem; font-weight: 600; color: var(--text-primary); }
.reconnaissance-panel p { color: var(--text-secondary); }

footer {
    border-top: 1px solid #e5e7eb;
    padding: 4rem 0 2rem;
    background: #ffffff;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3rem;
    margin-bottom: 3rem;
}

.brand .logo {
    margin-bottom: 0.5rem;
}

.brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links-container {
    max-width: 600px;
}

.footer-title {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    line-height: 1.8;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 2px;
    transition: color 0.3s, border-color 0.3s;
}

.footer-link:hover,
.footer-link.active {
    color: var(--accent-1);
    border-color: var(--accent-1);
}

.copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

/* Reveal Animations */
.reveal-text, .fade-in, .reveal-up {
    opacity: 0;
}

.reveal-text.visible, .fade-in.visible {
    animation: fadeIn 1s ease forwards;
}

.reveal-up.visible {
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsiveness */
@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .reverse-mobile {
        display: flex;
        flex-direction: column-reverse;
    }
    
    .nav-links {
        display: none; 
    }
    
    .menu-btn {
        display: block;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
}

/* -------------------------------------------
   RESPONSIVE TEXT & OVERFLOW FIXES (Mobile)
   ------------------------------------------- */
body {
    word-break: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
}
.math-display, .math-box, .ia-content, pre, code {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}
@media (max-width: 768px) {
    .glass-panel {
        padding: 1.5rem !important;
    }
    .ia-details {
        padding: 1rem 1.2rem !important;
    }
    .hero h1 {
        font-size: 2.2rem !important;
    }
    .section {
        padding: 4rem 0 !important;
    }
    .container {
        padding: 0 1rem !important;
    }
}
