/* Shared styles used by index.html and projects/*.html */

/* Reset e Variabili CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* --- Surfaces --- */
    --bg: #0a0e16;
    --bg-darker: #070a11;
    --bg-elev: rgba(255, 255, 255, 0.035);
    --bg-elev-2: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(56, 189, 248, 0.45);

    /* --- Text --- */
    --text: #eef2f7;
    --text-muted: #9aa7b8;
    --text-faint: #6b7787;

    /* --- Brand --- */
    --brand: #38bdf8;
    --brand-2: #5b8def;
    --accent: #fb7185;
    --gradient: linear-gradient(135deg, var(--brand), var(--brand-2));
    --gradient-text: linear-gradient(120deg, #7dd3fc, #38bdf8 55%, #818cf8);

    /* --- Typography --- */
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    --fs-h1: clamp(2.6rem, 6vw, 4.5rem);
    --fs-section: clamp(2rem, 4vw, 2.75rem);
    --fs-card-title: clamp(1.1rem, 2vw, 1.3rem);
    --fs-body: clamp(1rem, 1.5vw, 1.08rem);

    /* --- System --- */
    --radius: 14px;
    --radius-lg: 22px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 18px 45px rgba(56, 189, 248, 0.18);
    --maxw: 1200px;
    --space-section: clamp(4rem, 8vw, 7rem);
    /* Footer height — also the bottom padding that keeps content clear of
       the fixed footer on desktop. Keep the two in sync. */
    --footer-h: 3.25rem;

    /* Back-compat aliases (legacy var names still referenced in places) */
    --primary-color: var(--brand);
    --secondary-color: var(--brand-2);
    --accent-color: var(--accent);
    --bg-dark: var(--bg);
    --text-light: var(--text);
    --text-gray: var(--text-muted);
    --card-bg: var(--bg-elev);
    --gradient2: var(--gradient-text);
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* Sticky footer: body always fills at least the viewport, so the
       `position: sticky` footer below can be pushed down to its bottom. */
    min-height: 100vh;
    min-height: 100dvh;
}

::selection {
    background: rgba(56, 189, 248, 0.25);
    color: #fff;
}

/* Animated background — soft aurora glow + subtle grain */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 80% 50% at 15% 0%, rgba(56, 189, 248, 0.13), transparent 60%),
        radial-gradient(ellipse 70% 50% at 85% 20%, rgba(91, 141, 239, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 45% at 50% 100%, rgba(129, 140, 248, 0.1), transparent 60%);
    animation: aurora 22s ease-in-out infinite alternate;
}

.bg-animation::after {
    /* fine grain overlay */
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

@keyframes aurora {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    100% {
        transform: translate3d(0, -2%, 0) scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-animation {
        animation: none;
    }
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 22, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 1000;
    padding: 1rem 0;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

nav.scrolled {
    background: rgba(10, 14, 22, 0.85);
    border-bottom-color: var(--border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.nav-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2.5rem;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

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

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    white-space: nowrap;
}

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

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--gradient);
    transition: width 0.3s ease;
}

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

/* Hamburger (mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    flex-direction: column;
    gap: 5px;
    z-index: 1100;
}

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

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

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

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

/* The 7-item nav (added by the Curriculum link) needs tighter spacing to
   fit on one line between the hamburger breakpoint and where the default
   2rem gap has room again. */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .nav-links {
        gap: 0.7rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: min(75vw, 300px);
        flex-direction: column;
        justify-content: center;
        gap: 1.8rem;
        padding: 2rem;
        background: rgba(10, 14, 22, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-left: 1px solid var(--border);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

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

    .nav-links a {
        font-size: 1.15rem;
    }
}

/* New button style for projects/hobbies */
.card-button {
    display: inline-block;
    padding: 0.6rem 1.3rem;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
    margin-top: 1rem;
    margin-right: 0.5rem;
    align-self: flex-start;
}

.card-button:hover {
    background: var(--gradient);
    color: #06121c;
    border-color: transparent;
    transform: translateY(-2px);
}

.tech-tag {
    background: rgba(56, 189, 248, 0.1);
    color: var(--brand);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Footer */
footer {
    /* Mobile: anchored to the bottom of the viewport on short pages
       (body is >= 100vh tall), in normal flow on long ones. */
    position: sticky;
    top: 100vh;
    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    text-align: center;
    padding: 0.5rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.9rem;
}

/* Desktop: always visible, pinned to the viewport bottom. `body`'s
   bottom padding reserves the strip so nothing hides underneath. */
@media (min-width: 769px) {
    body {
        padding-bottom: var(--footer-h);
    }

    footer {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 900;
        height: var(--footer-h);
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

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