/* CSS Variables for Theme System */
:root {
    /* Light mode */
    --bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-tertiary: #a0aec0;
    --accent: #4299e1;
    --overlay: rgba(0, 0, 0, 0.5);
    --nav-height: 64px;
    --radius: 12px;
    /* Shadows */
    --shadow-nav: 0 1px 2px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.08);
}

.dark {
    /* Dark mode */
    --bg: #1a202c;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-tertiary: #cbd5e1;
    --accent: #63b3ed;
    --overlay: rgba(0, 0, 0, 0.7);
    /* Darker, softer shadow for dark theme */
    --shadow-nav: 0 1px 2px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35);
}

/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 100vh;
}

/* Account for fixed navbar */
body { padding-top: var(--nav-height); }

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--text-tertiary);
    color: var(--text-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(180deg);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Top Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    border-bottom: 1px solid color-mix(in oklab, var(--text-tertiary) 30%, transparent);
    z-index: 1000;
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow-nav);
}


/* When mobile menu is open, remove navbar border/background artifacts */
.menu-open .navbar {
    border-bottom-color: transparent;
    background: var(--bg);
}

.nav-left { display: none; }

.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
}

.nav-logo img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
    font-weight: 600;
}

.nav-links a:hover { color: var(--accent); border-bottom-color: color-mix(in oklab, var(--accent) 60%, transparent); }

.nav-links a.active { border-bottom-color: var(--text-primary); }

.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Ensure theme toggle is always at the far right */
.nav-actions .hamburger { order: 1; }
.nav-actions .theme-toggle { order: 2; }

/* Hamburger Button */
.hamburger {
    background: none;
    border: 2px solid var(--text-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none; /* hidden on desktop */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hamburger:hover { border-color: var(--accent); color: var(--accent); }

.hamburger .hamburger-line {
    width: 20px;
    height: 2px;
    background: currentColor;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger.active .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile dropdown panel (re-uses .nav-links) */
@media (max-width: 768px) {
    :root { --nav-height: 56px; }
    .navbar { padding-left: 56px; padding-right: 16px; padding-top: 0; padding-bottom: 0; }
    .hamburger { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
    .nav-links {
        display: none;
    }
    .hamburger { display: inline-flex; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid color-mix(in oklab, var(--text-tertiary) 30%, transparent);
        padding: 8px 10px 12px 10px;
        gap: 6px;
    z-index: 1001; /* above navbar */
        max-height: calc(100dvh - var(--nav-height));
        overflow-y: auto;
        margin: 0;
    }
    /* close button removed; hamburger acts as close */
    .nav-links.open a { padding: 12px 8px; }
}

/* Home Page Styles */
.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.home-page h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-links a:hover {
    transform: translateY(-2px);
}

.social-links .fa-github:hover {
    color: #171515;
}

.social-links .fa-x-twitter:hover {
    color: #000000;
}

.social-links .fa-instagram:hover {
    color: #E1306C;
}

.social-links .fa-linkedin:hover {
    color: #0077B5;
}

.social-links .ai-arxiv:hover {
    color: #b31b1b;
}

/* Dark mode social hover colors */
.dark .social-links .fa-github:hover {
    color: #6e5494;
}

.dark .social-links .fa-x-twitter:hover {
    color: #ffffff;
}

/* Copyright */
.copyright {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Footer Logo */
footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

footer img, .logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.7;
    transition: all 0.2s ease;
    filter: brightness(0) saturate(100%) invert(44%) sepia(7%) saturate(1190%) hue-rotate(169deg) brightness(96%) contrast(88%);
    margin-bottom: 10px;
}

.dark footer img, .dark .logo {
    filter: brightness(0) saturate(100%) invert(82%) sepia(8%) saturate(555%) hue-rotate(177deg) brightness(118%) contrast(119%);
}

footer img:hover, .logo:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Emojis Page Styles */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 120px 20px; /* Added bottom padding to prevent footer overlap */
}

/* old .header removed in favor of .navbar */

/* Remove the spacers - not needed anymore */

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.back-button {
    background: none;
    border: 2px solid var(--text-tertiary);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.description {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.emoji-item {
    background: var(--bg);
    border: 2px solid var(--text-tertiary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    aspect-ratio: 1;
    justify-content: center;
    min-height: 44px; /* Minimum touch target size */
}

.emoji-item:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    background: var(--text-tertiary);
}

.emoji-item:active {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.emoji-item .emoji {
    font-size: 2.5rem;
    line-height: 1;
    user-select: none; /* Prevent text selection */
}

.emoji-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
    user-select: none; /* Prevent text selection */
}

.emoji-item:hover .label {
    color: var(--bg);
}

/* Copy Feedback */
.copy-feedback {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.copy-feedback::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--accent);
}

.copy-feedback.show {
    opacity: 1;
}

/* Emojis Page Footer - Just fix the spacing */
.container footer {
    position: static;
    transform: none;
    text-align: center;
    margin-top: 60px;
    padding: 20px 0;
    border-top: 1px solid var(--text-tertiary);
    width: 100%;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .theme-toggle,
    .hamburger {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .container {
        padding: 20px 15px 40px 15px;
    }

    .container h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .description {
        font-size: 0.95rem;
        line-height: 1.4;
        margin-bottom: 25px; /* Reduced margin */
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 12px;
        margin-bottom: 30px; /* Reduced margin */
    }

    .emoji-item {
        padding: 12px 8px;
        border-radius: 8px;
    }

    .emoji-item .emoji {
        font-size: 2rem;
    }

    .emoji-item .label {
        font-size: 0.65rem;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    :root { --nav-height: 52px; }
    .navbar { padding-left: 52px; }
    .theme-toggle,
    .hamburger {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .home-page h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .social-links a {
        font-size: 1.3rem;
    }

    /* Emojis page specific mobile improvements */
    .container {
        padding: 15px 10px 30px 10px;
    }

    .container h1 {
        font-size: 1.75rem;
        margin-bottom: 15px;
    }

    .description {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
        margin-bottom: 25px;
    }

    /* side menu removed */
}

@media (max-width: 480px) {
    :root { --nav-height: 48px; }
    .navbar { padding-left: 48px; }
    .theme-toggle,
    .hamburger {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .container {
        padding: 10px 8px 25px 8px;
    }

    .container h1 {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .description {
        font-size: 0.85rem;
        margin-bottom: 18px;
        line-height: 1.3;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
        margin-bottom: 20px;
    }

    .emoji-item {
        padding: 8px 4px;
        border-radius: 6px;
    }

    .emoji-item .emoji {
        font-size: 1.6rem;
    }

    .emoji-item .label {
        font-size: 0.6rem;
        line-height: 1.1;
    }

    /* removed conflicting size override */
}

/* End Navbar + responsive menu styles */