/* Mobile-friendly styles with UNC Chapel Hill inspiration and enhanced academic styling */
:root {
    /* Main colors */
    --main-bg: #13294B;         /* UNC Navy */
    --text-color: #ffffff;
    --accent: #4B9CD3;          /* Carolina Blue */
    --accent-secondary: #97D4E9; /* Lighter Carolina Blue */
    --card-bg: rgba(19, 41, 75, 0.8);
    
    /* Additional UNC colors */
    --unc-navy: #13294B;
    --carolina-blue: #4B9CD3;
    --light-blue: #97D4E9;
    --unc-gray: #767676;
    --unc-tan: #C4BFB6;
    
    /* Academic styling */
    --citation-bg: rgba(19, 41, 75, 0.5);
    --equation-bg: rgba(19, 41, 75, 0.5);
    --theory-border: rgba(75, 156, 211, 0.4);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--main-bg);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Simple, clean navigation */
.glass-nav {
    background: rgba(0, 31, 66, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-nav.scrolled {
    background: rgba(6, 30, 54, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.nav {
    background-color: rgba(19, 41, 75, 0.95);
    position: fixed;
    width: 100%;
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--text-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.nav-link.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-link:after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s;
}

.nav-link:hover:after {
    width: 100%;
}

.nav-link:focus-visible {
    outline: 2px solid #BB133E;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Dropdown submenu for desktop nav */
.nav-item {
    position: relative;
    display: inline-block;
}

/* Add a small caret on dropdown parents */
/* caret removed for cleaner label */

/* Dropdown panel (hidden by default, revealed on hover/focus) */
.nav-item .dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background-color: rgba(6, 30, 54, 0.98); /* slightly darker navy */
    padding: 0.25rem 0;
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    z-index: 60;
    opacity: 0;
    transform: translateY(6px);
    visibility: hidden;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.nav-item .dropdown a {
    display: block;
    padding: 0.5rem 0.9rem;
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
}

.nav-item .dropdown a:hover,
.nav-item .dropdown a:focus {
    background-color: rgba(255,255,255,0.02);
}

/* Reveal on hover (for pointer devices) and on keyboard focus */
@media (hover: hover) {
  .nav-item:hover .dropdown { opacity: 1; transform: translateY(0); visibility: visible; }
}
.nav-item:focus-within .dropdown { opacity: 1; transform: translateY(0); visibility: visible; }

/* Prevent dropdown from overflowing the viewport on small screens */
.nav-item .dropdown { max-width: 360px; }

/* Mobile submenu indentation (simple visual grouping) */
.mobile-submenu { margin-top: 0.125rem; }
.mobile-submenu a { padding-left: 1.5rem; font-size: 0.95rem; display: block; }

/* Card style used across pages */
.system-card {
    background: rgba(0, 31, 66, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Accessible skip link */
.skip-link {
    position: absolute;
    left: 8px;
    top: 8px;
    transform: translateY(-200%);
    background: #ffffff;
    color: #111827;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    z-index: 9999;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid #BB133E;
}

/* Mobile menu button */
.menu-button {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Content sections - ADJUSTED SPACING */
.section {
    padding: 1.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero, .theory-header {
    padding-top: 6rem;
    padding-bottom: 2rem; /* Reduced from 3rem */
    text-align: center;
}

.hero h1, .theory-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.hero h2 {
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: 1rem; /* Reduced from 1.5rem */
    color: rgba(255, 255, 255, 0.8);
}

.hero p, .theory-header p {
    max-width: 600px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.7);
}

/* Profile */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem; /* Reduced from 2rem */
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem; /* Reduced from 1.5rem */
    border: 3px solid var(--accent);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.25rem; /* Reduced from 1.5rem */
    margin-bottom: 1rem; /* Reduced from 1.5rem */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card h3 {
    margin-bottom: 0.5rem; /* Reduced from 0.75rem */
    font-size: 1.25rem;
    color: var(--accent);
}

/* Grid for cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem; /* Reduced from 1.5rem */
}

/* Tags/badges */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0; /* Reduced from 1rem */
}

.tag {
    background-color: rgba(75, 156, 211, 0.2); /* Carolina Blue with transparency */
    color: var(--text-color);
    border-radius: 1rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Skills section - ADJUSTED SPACING */
.skills-section {
    margin: 1.5rem 0; /* Reduced from 2rem */
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem; /* Reduced from 1.5rem */
    margin-top: 1rem; /* Reduced from 1.5rem */
}

.skill-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.skill-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem; /* Reduced from 0.75rem */
    font-size: 1.1rem;
    color: var(--accent);
}

.skill-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.skill-icon {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
}

/* Project details */
.project-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem; /* Reduced from 1rem */
    font-size: 0.9rem;
}

.project-details span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Quote section with UNC Chapel Hill theme - ADJUSTED SPACING */
.quote-section {
    background-color: rgba(19, 41, 75, 0.7);
    border-radius: 8px;
    padding: 1.5rem; /* Reduced from 2rem */
    margin: 1.5rem auto; /* Reduced from 2rem */
    text-align: center;
    max-width: 800px;
}

.quote-section p {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    font-size: 1.1rem;
}

.quote-section p:last-child {
    margin-top: 1rem; /* Reduced from 1.5rem */
    font-size: 1.5rem;
}

/* UNC themed quote section */
.unc-themed {
    background: linear-gradient(to right, rgba(19, 41, 75, 0.8), rgba(75, 156, 211, 0.5), rgba(19, 41, 75, 0.8));
    border-left: 4px solid var(--carolina-blue);
    border-right: 4px solid var(--carolina-blue);
}

/* Section headings - ADJUSTED SPACING */
.section-heading {
    margin-bottom: 1rem; /* Reduced from 1.5rem */
    font-size: 1.75rem;
    position: relative;
    display: inline-block;
    color: var(--text-color);
}

.section-heading::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--accent);
}

/* Social links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem; /* Reduced from 1.5rem */
}

.social-link {
    color: var(--text-color);
    font-size: 1.5rem;
    transition: color 0.3s;
}

.social-link:hover {
    color: var(--accent);
}

/* Twitter buttons */
.twitter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1rem 0; /* Reduced from 1.5rem */
}

.twitter-follow-button, .twitter-dm-button {
    display: inline-block;
    background-color: #1DA1F2;
    color: white;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s;
}

.twitter-follow-button:hover, .twitter-dm-button:hover {
    background-color: #1a91da;
}

/* Button */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #3A7CAA; /* Darker Carolina Blue */
}

.button.secondary {
    background-color: transparent;
    border: 1px solid var(--accent);
}

.button.secondary:hover {
    background-color: rgba(75, 156, 211, 0.1);
}

/* Footer */
footer {
    background-color: rgba(19, 41, 75, 0.9);
    padding: 1.5rem 1rem; /* Reduced from 2rem */
    text-align: center;
    margin-top: 1.5rem; /* Reduced from 2rem */
    border-top: 3px solid var(--accent);
}

footer p {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

/* Education section - ADJUSTED SPACING */
.education-section {
    margin: 2rem 0; /* Reduced from 3rem */
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem; /* Reduced from 2rem */
    margin-top: 1rem; /* Reduced from 1.5rem */
}

.education-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.25rem; /* Reduced from 1.5rem */
    display: flex;
    align-items: center;
    gap: 1.25rem; /* Reduced from 1.5rem */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.education-logo {
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.education-logo.unc {
    background-image: url('https://brand.unc.edu/files/2019/01/UNC_logo_webblue-300x72.png');
}

.education-logo.cmu {
    background-image: url('https://www.cmu.edu/brand/brand-guidelines/images/wordmarks-600x600-min.jpg');
}

.education-details h3 {
    font-size: 1.2rem;
    margin-bottom: 0.35rem; /* Reduced from 0.5rem */
    color: var(--accent);
}

.education-details p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Theory page styling - ADJUSTED SPACING FOR THEORY PREVIEW */
.theory-preview {
    margin: 1.5rem 0; /* Reduced from 3rem */
    text-align: center;
}

.theory-header {
    background: linear-gradient(to bottom, var(--unc-navy), rgba(19, 41, 75, 0.9));
    text-align: center;
    padding-top: 7rem;
    padding-bottom: 2.5rem; /* Reduced from 3rem */
}

.theory-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.toc-section {
    background-color: rgba(19, 41, 75, 0.5);
    border-radius: 8px;
    padding: 1.25rem; /* Reduced from 1.5rem */
    margin-bottom: 1.5rem; /* Reduced from 2rem */
}

.toc-list {
    list-style-type: none;
    padding-left: 1rem;
}

.toc-list li {
    margin-bottom: 0.5rem; /* Reduced from 0.75rem */
}

.toc-list a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.toc-list a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.theory-section {
    margin-bottom: 3rem; /* Reduced from 4rem */
    scroll-margin-top: 5rem;
}

.theory-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.75rem; /* Reduced from 2rem */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theory-card.full {
    padding: 2rem; /* Reduced from 2.5rem */
}

.theory-abstract {
    background-color: rgba(19, 41, 75, 0.7);
    border-left: 3px solid var(--accent);
    padding: 1.25rem; /* Reduced from 1.5rem */
    margin-bottom: 1.5rem; /* Reduced from 2rem */
    border-radius: 0 8px 8px 0;
}

.theory-abstract h3 {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    color: var(--accent);
}

.theory-section-content h3 {
    margin: 1.25rem 0 0.75rem 0; /* Reduced from 1.5rem 0 1rem 0 */
    color: var(--accent);
    font-size: 1.4rem;
}

.theory-section-content h4 {
    margin: 1rem 0 0.5rem 0; /* Reduced from 1.25rem 0 0.75rem 0 */
    color: var(--accent-secondary);
    font-size: 1.2rem;
}

.theory-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem; /* Reduced from 1.5rem */
}

.theory-list li {
    margin-bottom: 0.35rem; /* Reduced from 0.5rem */
}

.theory-equation {
    background-color: var(--equation-bg);
    padding: 1.25rem; /* Reduced from 1.5rem */
    margin: 0.75rem 0; /* Reduced from 1rem */
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Georgia', serif;
    text-align: center;
    font-size: 1.2rem;
}

.theory-principle {
    margin-bottom: 1.5rem; /* Reduced from 2rem */
}

.theory-theorem {
    background-color: rgba(75, 156, 211, 0.1);
    border-left: 3px solid var(--accent);
    padding: 0.75rem; /* Reduced from 1rem */
    margin: 1.25rem 0; /* Reduced from 1.5rem */
    font-style: italic;
}

.case-study {
    background-color: rgba(19, 41, 75, 0.5);
    border-radius: 8px;
    padding: 1.25rem; /* Reduced from 1.5rem */
    margin: 1.25rem 0; /* Reduced from 1.5rem */
}

.case-study h4 {
    color: var(--accent);
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.theory-references {
    margin-top: 2.5rem; /* Reduced from 3rem */
    padding-top: 1.5rem; /* Reduced from 2rem */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.theory-references h3 {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.theory-references ol {
    padding-left: 1.5rem;
    line-height: 1.7;
}

.theory-caption {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: -0.35rem; /* Reduced from -0.5rem */
    margin-bottom: 1rem; /* Reduced from 1.5rem */
}

/* Publications section */
.publications-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Reduced from 1.5rem */
}

.publication-item {
    background-color: var(--citation-bg);
    border-radius: 8px;
    padding: 1.25rem; /* Reduced from 1.5rem */
    border-left: 3px solid var(--accent);
}

.publication-item h3 {
    margin-bottom: 0.35rem; /* Reduced from 0.5rem */
    color: var(--accent);
    font-size: 1.2rem;
}

.publication-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    font-style: italic;
}

.publication-abstract {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.publication-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.publication-link:hover {
    text-decoration: underline;
}

/* Simple fade-in animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation for grid items */
.grid .card:nth-child(1) { transition-delay: 0.1s; }
.grid .card:nth-child(2) { transition-delay: 0.2s; }
.grid .card:nth-child(3) { transition-delay: 0.3s; }
.grid .card:nth-child(4) { transition-delay: 0.4s; }

.skills-grid .skill-card:nth-child(1) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(2) { transition-delay: 0.2s; }
.skills-grid .skill-card:nth-child(3) { transition-delay: 0.3s; }
.skills-grid .skill-card:nth-child(4) { transition-delay: 0.4s; }

/* Page scroll indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent);
    width: 0%;
    z-index: 9999;
    transition: width 0.2s ease;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fade-in, .card, .skill-card, .profile-img {
        transition: none;
    }
    
    .card:hover, .skill-card:hover {
        transform: none;
    }
}

/* Responsive styling */
@media (max-width: 768px) {
    .hero h1, .theory-header h1 {
        font-size: 2rem;
    }
    
    .hero h2 {
        font-size: 1.25rem;
    }
    
    .grid, .skills-grid, .education-grid {
        grid-template-columns: 1fr;
    }
    
    .quote-section {
        padding: 1.25rem; /* Reduced from 1.5rem */
    }
    
    .section-heading {
        font-size: 1.5rem;
    }
    
    /* Show mobile menu button */
    .menu-button {
        display: block;
    }
    
    /* Hide navigation links by default on mobile */
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--card-bg);
        padding: 1rem;
    }
    
    /* Show when mobile menu is active */
    .nav-links.active {
        display: flex;
    }
    
    .theory-card.full {
        padding: 1.25rem; /* Reduced from 1.5rem */
    }
    
    .theory-equation {
        font-size: 1rem;
        padding: 0.75rem; /* Reduced from 1rem */
    }
}

@media (max-width: 480px) {
    .hero h1, .theory-header h1 {
        font-size: 1.75rem;
    }
    
    .profile-img {
        width: 120px;
        height: 120px;
    }
    
    .card, .skill-card, .publication-item {
        padding: 1rem; /* Reduced from 1.25rem */
    }
    
    .section {
        padding: 1.25rem 0.75rem; /* Reduced from 1.5rem 1rem */
    }
    
    .quote-section {
        padding: 1rem; /* Reduced from 1.25rem */
    }
    
    .quote-section p {
        font-size: 1rem;
    }
    
    .quote-section p:last-child {
        font-size: 1.25rem;
    }
    
    .education-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem; /* Reduced from 1rem */
    }
}
