/* 
    JOSEFINA DERPICH-BLACK | PORTFOLIO CSS
    Concept: Astronomy meets Technology
    Theme: Deep Space, Glassmorphism, Data-Visualization Aesthetics
*/

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
    --bg-space: #050a14;
    --accent-cyan: #57f0d9;
    --accent-violet: #7b6ff0;
    --accent-gold: #f0c857;
    --text-primary: #eef2ff;
    --text-secondary: #8ba4d4;
    --glass-bg: rgba(87, 240, 217, 0.06);
    --glass-bg-hover: rgba(87, 240, 217, 0.1);
    --glass-border: rgba(87, 240, 217, 0.12);
    --glass-border-hover: rgba(87, 240, 217, 0.35);
    --nav-bg: rgba(5, 10, 20, 0.88);
    --card-shadow: rgba(0, 0, 0, 0.5);
    --glow-cyan: rgba(87, 240, 217, 0.25);
    --glow-violet: rgba(123, 111, 240, 0.25);
    --section-divider: rgba(87, 240, 217, 0.07);
    --footer-bg: rgba(0, 0, 0, 0.35);
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-bg-focus: rgba(87, 240, 217, 0.08);
    --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    --transition-fast: all 0.2s ease;
}

body.light-mode {
    --bg-space: #f0f4ff;
    --accent-cyan: #0ea5aa;
    --accent-violet: #5046e4;
    --accent-gold: #c9870d;
    --text-primary: #0f172a;
    --text-secondary: #3d5a8a;
    --glass-bg: rgba(14, 165, 170, 0.07);
    --glass-bg-hover: rgba(14, 165, 170, 0.12);
    --glass-border: rgba(14, 165, 170, 0.2);
    --glass-border-hover: rgba(14, 165, 170, 0.5);
    --nav-bg: rgba(240, 244, 255, 0.92);
    --card-shadow: rgba(0, 0, 80, 0.12);
    --glow-cyan: rgba(14, 165, 170, 0.15);
    --glow-violet: rgba(80, 70, 228, 0.12);
    --section-divider: rgba(14, 165, 170, 0.1);
    --footer-bg: rgba(14, 165, 170, 0.05);
    --input-bg: rgba(0, 0, 0, 0.04);
    --input-bg-focus: rgba(14, 165, 170, 0.08);
}

body.light-mode #starfield { opacity: 0.08; }
body.light-mode input, body.light-mode textarea, body.light-mode select { color: var(--text-primary); }
body.light-mode select option { background: #f0f4ff; color: #0f172a; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-space);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

h1, h2, h3, h4 { font-family: 'Syne', sans-serif; font-weight: 700; }
a { color: var(--accent-cyan); transition: var(--transition-fast); }
a:hover { opacity: 0.8; }

/* STARFIELD */
#starfield {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
    transition: opacity 0.5s ease;
}

/* NAVIGATION */
header {
    position: fixed; top: 0; width: 100%;
    z-index: 1000; padding: 1.5rem 0;
    transition: var(--transition-smooth);
}
header.scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.8rem 0;
}
#navbar {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between;
    align-items: center; padding: 0 2rem;
}
.nav-logo {
    font-family: 'Syne', sans-serif; font-weight: 800;
    font-size: 1rem; color: var(--accent-cyan);
    text-decoration: none; letter-spacing: -0.5px;
    opacity: 0; transition: var(--transition-smooth);
}
header.scrolled .nav-logo { opacity: 1; }

.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
    text-decoration: none; color: var(--text-secondary);
    font-size: 0.8rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 1.2px;
    transition: var(--transition-smooth);
    position: relative; padding-bottom: 4px;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 1px; background: var(--accent-cyan);
    transition: width 0.3s ease;
}
.nav-links a:hover { color: var(--accent-cyan); opacity: 1; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--accent-cyan); }

/* HAMBURGER */
.hamburger {
    display: none; flex-direction: column; gap: 5px;
    cursor: pointer; padding: 8px; z-index: 1001;
    background: none; border: none;
}
.hamburger span {
    display: block; width: 24px; height: 2px;
    background: var(--accent-cyan); border-radius: 2px;
    transition: var(--transition-smooth);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100vh;
    background: rgba(5, 10, 20, 0.97);
    backdrop-filter: blur(20px); z-index: 999;
    flex-direction: column; justify-content: center;
    align-items: center; gap: 2.5rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
}
body.light-mode .mobile-nav { background: rgba(240, 244, 255, 0.97); }
.mobile-nav.open { display: flex; opacity: 1; pointer-events: all; }
.mobile-nav a {
    text-decoration: none; color: var(--text-primary);
    font-family: 'Syne', sans-serif; font-size: 2rem;
    font-weight: 700; transition: var(--transition-smooth);
}
.mobile-nav a:hover { color: var(--accent-cyan); opacity: 1; }

/* HERO */
#hero {
    height: 100vh; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 0 2rem;
    position: relative; z-index: 1;
}
#hero h1 {
    font-size: clamp(2rem, 5.5vw, 3.8rem);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #a8edff 40%, var(--accent-violet) 100%);
    background-clip: text; -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.2rem; letter-spacing: -2px;
    line-height: 1.05; animation: heroFadeIn 1.2s ease forwards;
}
#hero .hero-subtitle {
    font-size: 0.95rem; color: var(--text-secondary);
    max-width: 600px; letter-spacing: 2px;
    text-transform: uppercase; font-weight: 400;
    animation: heroFadeIn 1.2s 0.3s ease both;
    min-height: 1.4em;
}
.cursor {
    display: inline-block; width: 2px; height: 0.9em;
    background: var(--accent-cyan); margin-left: 2px;
    vertical-align: middle; animation: blink 0.9s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

#hero blockquote {
    margin-top: 2.5rem; font-style: italic;
    color: var(--text-secondary);
    border-left: 2px solid var(--accent-cyan);
    padding-left: 1.2rem; max-width: 400px;
    font-size: 0.95rem; animation: heroFadeIn 1.2s 0.6s ease both;
}
.hero-cta {
    display: flex; gap: 0.8rem; margin-top: 3rem;
    flex-wrap: wrap; justify-content: center;
    animation: heroFadeIn 1.2s 0.9s ease both;
}
.btn-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    color: #050a14 !important; text-decoration: none;
    padding: 0.9rem 2rem; border-radius: 50px;
    font-weight: 700; font-size: 0.85rem; letter-spacing: 1px;
    text-transform: uppercase; transition: var(--transition-smooth);
    -webkit-text-fill-color: initial;
}
.btn-primary:hover { box-shadow: 0 0 30px var(--glow-cyan); transform: translateY(-2px); opacity: 1; }
.btn-secondary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: transparent; color: var(--accent-cyan) !important;
    text-decoration: none; padding: 0.9rem 2rem;
    border-radius: 50px; font-weight: 600; font-size: 0.85rem;
    letter-spacing: 1px; text-transform: uppercase;
    border: 1px solid var(--glass-border-hover);
    transition: var(--transition-smooth); -webkit-text-fill-color: initial;
}
.btn-secondary:hover { background: var(--glass-bg); box-shadow: 0 0 20px var(--glow-cyan); opacity: 1; }
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
.scroll-indicator {
    position: absolute; bottom: 2rem; left: 50%;
    transform: translateX(-50%); display: flex;
    flex-direction: column; align-items: center; gap: 0.5rem;
    color: var(--text-secondary); font-size: 0.7rem;
    letter-spacing: 2px; text-transform: uppercase;
    animation: heroFadeIn 1.2s 1.2s ease both;
}
.scroll-line {
    width: 1px; height: 40px;
    background: linear-gradient(to bottom, var(--accent-cyan), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; } 50% { opacity: 1; }
}

/* LAYOUT */
main { max-width: 1200px; margin: 0 auto; padding: 0 2rem; position: relative; z-index: 1; }
section { padding: 8rem 0; border-bottom: 1px solid var(--section-divider); }
section:last-child { border-bottom: none; }

.section-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin-bottom: 4rem; position: relative;
    display: inline-block; letter-spacing: -1px;
}
.section-title::after {
    content: ''; position: absolute; bottom: -12px; left: 0;
    width: 48px; height: 3px;
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-violet));
    border-radius: 2px; transition: width 0.4s ease;
}
.section-title:hover::after { width: 100%; }

/* GRID & CARDS */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.glass-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    padding: 2.5rem; border-radius: 16px;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
    position: relative; overflow: hidden;
}
.glass-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(87, 240, 217, 0.07) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none; border-radius: inherit;
}
.glass-card:hover::before { opacity: 1; }
.glass-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: 0 20px 50px var(--card-shadow), 0 0 30px var(--glow-cyan);
    transform: translateY(-6px);
}
.glass-card h3 { color: var(--accent-cyan); margin-bottom: 1rem; font-size: 1.1rem; }
.glass-card p, .glass-card li { color: var(--text-secondary); font-size: 0.95rem; }

/* ABOUT */
#about p { color: var(--text-secondary); max-width: 760px; margin-bottom: 1.5rem; font-size: 1.05rem; }

/* SKILLS */
#skills .grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
#skills ul { list-style: none; margin-top: 1rem; }
#skills li {
    padding: 0.45rem 0; color: var(--text-secondary);
    font-size: 0.92rem; display: flex; align-items: flex-start; gap: 0.6rem;
}
#skills li::before { content: '◆'; color: var(--accent-cyan); font-size: 0.55rem; margin-top: 0.45rem; flex-shrink: 0; }

/* EXPERIENCE */
#experience > section { padding: 0; border: none; margin-bottom: 2.5rem; }
#experience h3 { color: var(--accent-cyan); margin-bottom: 0.8rem; font-size: 1.1rem; }
#experience p { color: var(--text-secondary); font-size: 0.95rem; max-width: 760px; }

/* TEACHING */
#teaching ul {
    list-style: none; padding-left: 2rem; margin-top: 1rem;
    border-left: 2px solid;
    border-image: linear-gradient(to bottom, var(--accent-cyan), var(--accent-violet)) 1;
}
#teaching li { padding: 0.7rem 0; color: var(--text-secondary); font-size: 0.95rem; position: relative; }
#teaching li::before {
    content: ''; position: absolute; left: -2.5rem; top: 50%;
    transform: translateY(-50%); width: 8px; height: 8px;
    border-radius: 50%; background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
}

/* TALKS & WORKSHOPS */
#talks ul, #workshops ul {
    list-style: none; margin-top: 1rem;
    display: flex; flex-direction: column; gap: 0.8rem;
}
#talks li, #workshops li {
    color: var(--text-secondary); font-size: 0.95rem;
    padding: 1rem 1rem 1rem 2.5rem;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 10px; transition: var(--transition-fast);
    position: relative;
}
#talks li::before, #workshops li::before {
    content: '◆'; position: absolute; left: 1rem; top: 1.15rem;
    color: var(--accent-cyan); font-size: 0.55rem;
}
#talks li:hover, #workshops li:hover { border-color: var(--glass-border-hover); background: var(--glass-bg-hover); }

/* OUTREACH */
#outreach p { color: var(--text-secondary); max-width: 760px; font-size: 1.05rem; }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 4rem; align-items: start; }
.contact-info p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }
.contact-info ul { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.contact-info li { color: var(--text-secondary); font-size: 0.9rem; }
.contact-info a { color: var(--accent-cyan); text-decoration: none; }

fieldset { border: none; display: flex; flex-direction: column; gap: 1.2rem; }
legend { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--text-primary); margin-bottom: 1.5rem; }
label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: -0.6rem; font-weight: 500; }
input, textarea, select {
    background: var(--input-bg); border: 1px solid var(--glass-border);
    padding: 0.9rem 1.1rem; border-radius: 10px;
    color: var(--text-primary); font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem; transition: var(--transition-smooth); width: 100%;
}
select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2357f0d9' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent-cyan);
    background: var(--input-bg-focus); box-shadow: 0 0 0 3px var(--glow-cyan);
}
input.error, textarea.error { border-color: #f05757; box-shadow: 0 0 0 3px rgba(240, 87, 87, 0.15); }

button[type="submit"] {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    color: #050a14; border: none; padding: 1rem 2.5rem;
    border-radius: 50px; font-weight: 700; font-family: 'Syne', sans-serif;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1.5px;
    font-size: 0.85rem; transition: var(--transition-smooth); align-self: flex-start;
}
button[type="submit"]:hover { box-shadow: 0 0 30px var(--glow-cyan); transform: translateY(-2px); }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.form-success {
    display: none; padding: 1.2rem;
    background: rgba(87, 240, 217, 0.08);
    border: 1px solid var(--accent-cyan); border-radius: 10px;
    color: var(--accent-cyan); font-size: 0.9rem; text-align: center;
}
.form-success.show { display: block; }

/* SCROLL REVEAL */
.reveal-init { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal-init.visible { opacity: 1; transform: translateY(0); }
.grid .reveal-init:nth-child(1) { transition-delay: 0s; }
.grid .reveal-init:nth-child(2) { transition-delay: 0.1s; }
.grid .reveal-init:nth-child(3) { transition-delay: 0.2s; }

/* FOOTER */
footer {
    padding: 3rem 2rem; text-align: center;
    background: var(--footer-bg); border-top: 1px solid var(--glass-border);
    position: relative; z-index: 1;
}
footer p { color: var(--text-secondary); font-size: 0.8rem; letter-spacing: 1px; }

/* THEME TOGGLE */
.theme-toggle {
    position: fixed; bottom: 84px; right: 20px;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    color: var(--accent-cyan); font-size: 1.2rem; cursor: pointer;
    z-index: 998; transition: var(--transition-smooth);
    backdrop-filter: blur(12px); display: flex;
    align-items: center; justify-content: center;
}
.theme-toggle:hover { transform: scale(1.1) rotate(20deg); box-shadow: 0 0 20px var(--glow-cyan); }

/* BACK TO TOP */
#back-to-top {
    position: fixed; bottom: 28px; right: 20px;
    width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    color: #050a14; font-size: 1.1rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 998; opacity: 0; visibility: hidden;
    transition: var(--transition-smooth); border: none;
}
#back-to-top.show { opacity: 1; visibility: visible; }
#back-to-top:hover { transform: translateY(-4px); box-shadow: 0 0 25px var(--glow-cyan); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .nav-logo { opacity: 1 !important; }
}
@media (max-width: 768px) {
    #hero h1 { font-size: 2.8rem; letter-spacing: -1.5px; }
    section { padding: 5rem 0; }
    .section-title { font-size: 2rem; margin-bottom: 3rem; }
    .grid { grid-template-columns: 1fr; }
    main { padding: 0 1.2rem; }
    #navbar { padding: 0 1.2rem; }
    .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
}
@media (max-width: 480px) {
    #hero h1 { font-size: 2.2rem; }
    .hero-cta { flex-direction: column; align-items: center; }
}

/* ── ABOUT PHOTO ────────────────────────────────────────── */
.about-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 4rem;
    align-items: start;
}

.about-photo-wrap {
    position: sticky;
    top: 100px;
}

.about-photo {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    object-position: top;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px var(--card-shadow), 0 0 30px var(--glow-cyan);
    transition: var(--transition-smooth);
}

.about-photo:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 25px 60px var(--card-shadow), 0 0 40px var(--glow-cyan);
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* ── EXPERIENCE PHOTOS ──────────────────────────────────── */
.exp-photo {
    width: 100%;
    max-width: 600px;
    height: 340px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-top: 1.5rem;
    transition: var(--transition-smooth);
}

.exp-photo:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 15px 40px var(--card-shadow), 0 0 20px var(--glow-cyan);
    transform: translateY(-4px);
}

.exp-photo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.exp-photo-half {
    width: 100%;
    height: 260px;
    object-fit: cover;
    object-position: top;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
}

.exp-photo-half:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 15px 40px var(--card-shadow), 0 0 20px var(--glow-cyan);
    transform: translateY(-4px);
}

/* ── PHOTO GALLERY (Outreach) ───────────────────────────── */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-top: 2.5rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
    aspect-ratio: 4/3;
}

.gallery-item:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 15px 40px var(--card-shadow), 0 0 20px var(--glow-cyan);
    transform: translateY(-4px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.8rem 1rem;
    background: linear-gradient(to top, rgba(5,10,20,0.92) 0%, transparent 100%);
    color: var(--text-primary);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(4px);
    transition: var(--transition-smooth);
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ── RESPONSIVE PHOTOS ──────────────────────────────────── */
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .about-photo-wrap { position: static; }
    .about-photo { max-width: 220px; margin: 0 auto; display: block; }
    .exp-photo-row { grid-template-columns: 1fr; }
    .exp-photo, .exp-photo-half { height: 220px; }
    .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
