/* ============================================
   Samuel Patrone - Personal Website
   Dark cosmos theme with physics-inspired design
   ============================================ */

/* --- Variables --- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0e0e24;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-body: #c8c8e0;
    --accent: #4fc3f7;
    --accent-dim: rgba(79, 195, 247, 0.15);
    --accent-glow: rgba(79, 195, 247, 0.3);
    --accent-secondary: #7c4dff;
    --border: rgba(79, 195, 247, 0.12);
    --border-hover: rgba(79, 195, 247, 0.35);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --container-width: 1060px;
    --section-padding: 120px 0;
    --transition: 0.3s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-body);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(79, 195, 247, 0.3);
    color: #fff;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #81d4fa;
}

img {
    max-width: 100%;
    display: block;
}

strong {
    color: var(--text-primary);
    font-weight: 600;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Particles Background --- */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* --- Navigation --- */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

#navbar.scrolled {
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    position: relative;
    padding: 4px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Hero Section --- */
#hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px 40px;
    pointer-events: none;
}

#hero a,
#hero button,
.hero-social a {
    pointer-events: auto;
}

.hero-content > * {
    opacity: 0;
    animation: fadeInUp 0.9s ease forwards;
}

.hero-photo {
    animation-delay: 0.2s;
}

.hero-name {
    animation-delay: 0.5s;
}

.hero-subtitle {
    animation-delay: 0.7s;
}

.hero-titles {
    animation-delay: 0.9s;
}

.hero-social {
    animation-delay: 1.1s;
}

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

.hero-photo img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-dim);
    box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(79, 195, 247, 0.1);
    margin: 0 auto 32px;
    animation: glow 4s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 30px rgba(79, 195, 247, 0.2), 0 0 60px rgba(79, 195, 247, 0.05);
    }
    to {
        box-shadow: 0 0 50px rgba(79, 195, 247, 0.4), 0 0 100px rgba(79, 195, 247, 0.1);
    }
}

.hero-name {
    font-size: 3.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 1.35rem;
    font-weight: 300;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero-titles {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 32px;
}

.separator {
    margin: 0 12px;
    color: var(--accent);
}

.hero-social {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.hero-social a {
    color: var(--text-secondary);
    font-size: 1.3rem;
    transition: color var(--transition), transform var(--transition);
}

.hero-social a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeIn 1s ease 1.8s forwards;
}

@keyframes fadeIn {
    to { opacity: 0.6; }
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

/* --- Sections (shared) --- */
section:not(#hero) {
    position: relative;
    z-index: 1;
    padding: var(--section-padding);
    scroll-margin-top: -120px;
}

section:not(#hero)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    opacity: 0.92;
    z-index: -1;
}

/* Alternate section tint */
section#research::before,
section#teaching::before,
section#contact::before {
    background: var(--bg-secondary);
}

/* Let particles show through visual sections */
section#research::before {
    opacity: 0.55;
}

section#beyond::before {
    opacity: 0.58;
}

section#contact::before {
    opacity: 0.50;
}

.section-title {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 56px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    margin: 16px auto 0;
    border-radius: 2px;
}

/* --- Scroll Reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.research-grid .reveal:nth-child(2),
.beyond-grid .reveal:nth-child(2) {
    transition-delay: 0.12s;
}

.research-grid .reveal:nth-child(3) {
    transition-delay: 0.24s;
}

.research-grid .reveal:nth-child(4) {
    transition-delay: 0.36s;
}

/* --- About Section --- */
.about-content p {
    font-size: 1.1rem;
    margin: 0 0 20px;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* About Row (text + photo side by side) */
.about-row {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 48px;
}

.about-photo {
    display: flex;
    flex-direction: column;
}

.about-photo-img {
    flex: 1;
    background: url('assets/diploma.jpg') top / cover no-repeat;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.about-photo-caption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.7;
    margin-top: 12px;
}

/* Education Timeline */
.timeline {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 64px auto 48px;
    max-width: 900px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 12%;
    right: 12%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-dim));
}

.timeline-item {
    flex: 1;
    text-align: center;
    position: relative;
    padding-top: 32px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-dot.active {
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-content h4 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.timeline-year {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.timeline-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Honors */
.honors {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 48px;
}

.honor-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: border-color var(--transition), color var(--transition);
}

.honor-tag:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.honor-tag i {
    color: var(--accent);
    font-size: 0.8rem;
}

/* --- Research Section --- */
.research-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.research-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    transition: transform var(--transition), background var(--transition),
                border-color var(--transition), box-shadow var(--transition);
}

.research-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: 0 12px 40px rgba(79, 195, 247, 0.08);
}

.card-icon {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.research-card h3,
.beyond-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.research-card p,
.beyond-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* Philosophy blockquote */
.philosophy {
    max-width: 780px;
    margin: 0 auto;
    padding: 32px 40px;
    border-left: 3px solid var(--accent);
    background: var(--bg-card);
    border-radius: 0 12px 12px 0;
}

.philosophy p {
    font-size: 1.08rem;
    font-style: italic;
    color: var(--text-body);
    line-height: 1.8;
}

/* --- Publications Section --- */
.featured-pub {
    max-width: 700px;
    margin: 0 auto 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 36px 28px;
    position: relative;
    transition: border-color var(--transition);
}

.featured-pub:hover {
    border-color: var(--border-hover);
}

.pub-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 4px 14px;
    border-radius: 100px;
    margin-bottom: 16px;
}

.featured-pub h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.pub-authors {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.pub-journal {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.pub-description {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.pub-links {
    display: flex;
    gap: 16px;
}

.pub-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--accent);
    transition: background var(--transition), border-color var(--transition);
}

.pub-links a:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.pub-note {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.pub-explore {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(79, 195, 247, 0.25);
}

.btn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(79, 195, 247, 0.35);
}

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

.btn-outline:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #fff;
}

/* --- Teaching Section --- */
.teaching-content {
    max-width: 800px;
    margin: 0 auto 48px;
}

.teaching-text p {
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 16px;
}

.teaching-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin: 48px 0;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

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

.teaching-courses h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.course-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.course-tag {
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* --- Beyond Physics --- */
.beyond-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.beyond-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    transition: transform var(--transition), border-color var(--transition);
}

.beyond-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
}

/* --- Contact Section --- */
#contact {
    text-align: center;
}

.contact-text {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
}

#contact .btn-primary {
    margin-bottom: 32px;
}

.contact-social {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.contact-social a {
    color: var(--text-secondary);
    font-size: 1.4rem;
    transition: color var(--transition), transform var(--transition);
}

.contact-social a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

/* --- Footer --- */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --section-padding: 80px 0;
    }

    section:not(#hero) {
        scroll-margin-top: -80px;
    }

    /* Nav mobile */
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(10, 10, 26, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 24px 0;
        gap: 0;
        transform: translateY(-120%);
        transition: transform 0.4s ease;
    }

    .nav-links.open {
        transform: translateY(0);
    }

    .nav-links li {
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .nav-links a::after {
        display: none;
    }

    /* Hero mobile */
    .hero-name {
        font-size: 2.6rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        letter-spacing: 2px;
    }

    .hero-titles {
        font-size: 0.92rem;
    }

    .hero-photo img {
        width: 160px;
        height: 160px;
    }

    .separator {
        display: block;
        font-size: 0;
        margin: 4px 0;
    }

    /* Section titles */
    .section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }

    /* About */
    .about-row {
        grid-template-columns: 1fr;
    }

    .about-photo {
        max-width: 280px;
        margin: 0 auto;
    }

    .about-photo-img {
        min-height: 360px;
    }

    .about-content p {
        font-size: 1rem;
    }

    /* Timeline vertical */
    .timeline {
        flex-direction: column;
        gap: 0;
        padding-left: 24px;
        margin: 48px auto 40px;
    }

    .timeline::before {
        top: 0;
        bottom: 0;
        left: 29px;
        right: auto;
        width: 2px;
        height: 100%;
    }

    .timeline-item {
        padding-top: 0;
        padding-left: 32px;
        padding-bottom: 32px;
        text-align: left;
    }

    .timeline-item:last-child {
        padding-bottom: 0;
    }

    .timeline-dot {
        top: 4px;
        left: 0;
        transform: none;
    }

    /* Research grid */
    .research-grid {
        grid-template-columns: 1fr;
    }

    /* Philosophy */
    .philosophy {
        padding: 24px 28px;
    }

    /* Teaching stats */
    .teaching-stats {
        gap: 24px;
    }

    .stat-number {
        font-size: 2.2rem;
    }

    /* Beyond grid */
    .beyond-grid {
        grid-template-columns: 1fr;
    }

    /* Pub links */
    .pub-explore {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 2.1rem;
    }

    .teaching-stats {
        flex-direction: column;
        gap: 20px;
    }

    .honors {
        gap: 8px;
    }

    .honor-tag {
        font-size: 0.78rem;
        padding: 6px 14px;
    }
}
