/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&family=Playfair+Display:wght@400;700&display=fallback');

:root {
    --primary-color: #0a0c1b;
    --secondary-color: #141629;
    --accent-color: #1f264a;
    --highlight-color: #3a75c4;
    --highlight-hover: #4a86e8;
    --background-color: #070819;
    --text-color: #e5e0e0;
    --text-muted: #d1d4dc;
    --card-background: rgba(18, 20, 43, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --button-color: #4b5ca7;
}

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

img {
    max-width: 100%;
    height: auto;
}

html {
    background-color: var(--background-color);
    /* Ensure base color fits theme */
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    line-height: 1.6;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(58, 117, 196, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(75, 92, 167, 0.1) 0%, transparent 20%);
    background-attachment: fixed;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.fade-out {
    opacity: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
    color: #fff;
    margin-bottom: 1rem;
}

/* Text Justification for Content */
p,
li,
td,
dd,
blockquote {
    text-align: justify;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Scroll Animations (JS Triggered) */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* Smart Navbar Styles */
header.scroll-down:not(.active-menu) {
    transform: translateY(-100%);
}

header.scroll-up,
header.active-menu {
    transform: translateY(0);
}

/* Header */
header {
    background: rgba(10, 12, 27, 0.85);
    backdrop-filter: blur(10px);
    padding: 15px 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--glass-border);
    transition: padding 0.3s ease, transform 0.3s ease;
}

@media (max-width: 1200px) {
    header {
        padding: 15px 20px;
    }
}


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

.logo {
    width: 60px;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: rotate(5deg) scale(1.1);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    color: #fff;
    letter-spacing: 1px;
    margin-right: 0;
}

/* Navigation */
.menu-toggle {
    font-size: 1.8rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    z-index: 1100;
}

#navbar {
    display: flex;
    align-items: center;
    /* Ensure vertical alignment */
    justify-content: flex-end;
    /* Prevent spreading */
    width: auto;
    /* Prevent full width stretching */
    gap: 28px !important;
    margin: 0;
    /* Reset generic margins */
    padding: 0;
    /* Reset generic padding */
}

@media (max-width: 1200px) {
    #navbar {
        gap: 10px !important;
    }
}

nav a {
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 0;
    /* Reduced padding to fix spacing jump */
    border-radius: 30px;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

#navbar a {
    margin: 0 !important;
}


nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--highlight-color);
    transition: width 0.3s ease;
}

nav a:hover::before {
    width: 80%;
}

nav a:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(58, 117, 196, 0.5);
}

@media (max-width: 1100px) {
    header {
        padding: 10px 20px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: block;
        z-index: 1200;
        cursor: pointer;
    }

    #navbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(10, 12, 27, 0.98);
        backdrop-filter: blur(15px);
        display: none;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1100;
        opacity: 0;
        transition: opacity 0.4s ease;
    }

    #navbar.active {
        display: flex;
        opacity: 1;
    }

    #navbar ul {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 0;
        width: 100%;
        margin: 0;
    }

    #navbar ul li {
        margin: 0;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #navbar.active ul li {
        opacity: 1;
        transform: translateY(0);
    }

    /* Staggered animation for menu items */
    #navbar.active ul li:nth-child(1) {
        transition-delay: 0.1s;
    }

    #navbar.active ul li:nth-child(2) {
        transition-delay: 0.15s;
    }

    #navbar.active ul li:nth-child(3) {
        transition-delay: 0.2s;
    }

    #navbar.active ul li:nth-child(4) {
        transition-delay: 0.25s;
    }

    #navbar.active ul li:nth-child(5) {
        transition-delay: 0.3s;
    }

    #navbar.active ul li:nth-child(6) {
        transition-delay: 0.35s;
    }

    #navbar.active ul li:nth-child(7) {
        transition-delay: 0.4s;
    }

    #navbar.active ul li:nth-child(8) {
        transition-delay: 0.45s;
    }

    #navbar ul li a {
        font-size: 1.5rem;
        display: block;
        padding: 10px;
        width: 100%;
    }

    body.menu-open {
        overflow: hidden !important;
    }
}


/* Hero Section */
.hero {
    position: relative;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    background: linear-gradient(rgba(7, 8, 25, 0.2), rgba(7, 8, 25, 0.2)), url('../img/bg-hero_preview.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* FIX: Force full width */
    max-width: 100% !important;
    width: 100%;
}

.hero-content {
    z-index: 2;
    max-width: 800px;
    animation: fadeInUp 1s ease-out;
}

.hero-logo {
    width: 180px;
    margin-bottom: 30px;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(58, 117, 196, 0.3);
    animation: bounce 3s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.hero h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 20px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}


.hero p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: var(--text-muted);
}

.cta-button {
    background: linear-gradient(135deg, var(--highlight-color), var(--button-color));
    color: #fff;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(58, 117, 196, 0.4);
    background: linear-gradient(135deg, var(--highlight-hover), var(--highlight-color));
}

/* Button Variants */
.cta-button.sm {
    padding: 8px 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cta-button.sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(58, 117, 196, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 800px) {

    /* Global Container Fixes - Zoomed out feel */
    html {
        font-size: 14px;
        /* Even smaller base font for 'zoomed out' effect */
    }

    body {
        /* Minimal gutters to maximize space for a 'desktop-like' parvenza */
        padding-left: 5px;
        padding-right: 5px;
    }

    section {
        padding: 25px 0;
        margin: 0 auto;
        max-width: 98%;
    }

    .content-wrapper {
        padding: 0;
        margin: 15px auto;
        max-width: 98%;
    }

    /* Header & Nav */
    header {
        padding: 15px 20px;
    }

    .logo {
        width: 40px;
        /* Smaller logo */
    }

    .site-title {
        font-size: 1.2rem;
        /* Smaller title */
    }

    /* Hero Section */
    .hero {
        min-height: auto;
        /* Allow content to dictate height */
        padding: 100px 20px 60px;
        /* More top padding for fixed header */
        background-attachment: scroll;
        /* Fix for mobile bg fixed issues */
    }

    .hero h2 {
        font-size: 2rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-logo {
        width: 120px;
        height: 120px;
    }

    /* Card Grids */
    .card-grid {
        grid-template-columns: 1fr;
        /* Single column */
        gap: 20px;
    }

    /* Activity Rows */
    .activity-row {
        flex-direction: column;
    }

    .activity-preview {
        margin: 0 0 20px 0;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .footer-section {
        width: 100%;
    }

    /* Typography Overrides */
    h1,
    h2,
    h3 {
        word-wrap: break-word;
        /* Prevent overflow */
    }

    .section-title {
        font-size: 2rem;
        width: 100%;
        /* Ensure centering works */
    }

    /* Buttons */
    .cta-button {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }

    .btn-list {
        flex-direction: column;
        width: 100%;
    }
}

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

    .section-title {
        font-size: 1.8rem;
    }
}

/* Section Common Styles */
section {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: -20px auto 40px;
    /* Negative top margin to pull closer to H1 */
    max-width: 800px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--highlight-color);
    margin: 15px auto 0;
    border-radius: 2px;
}

/* Card Grids */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* Specific grid for secondary items */
.alternative-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

@media (max-width: 800px) {

    /* Relaxing constraints for half-desktop feel - allowing 2 columns if space permits */
    .card-grid,
    .alternative-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
        gap: 15px;
        width: 100%;
    }
}

.card {
    background: var(--card-background);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* overflow: hidden; Removed to allow inner shadows/transforms */
    position: relative;
    overflow-wrap: break-word;
    /* Prevent text overflow */
    display: flex;
    flex-direction: column;
}

/* Mini Cards for secondary sections */
.mini-card {
    text-decoration: none !important;
    padding: 2.5rem 1.5rem !important;
    /* Increased padding */
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 15px !important;
    border: var(--glass-border) !important;
    transition: transform 0.3s !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    /* CRITICAL: Center horizontally */
    justify-content: center !important;
    /* CRITICAL: Center vertically */
    text-align: center !important;
    width: 100% !important;
    min-height: 150px !important;
}

.mini-card i {
    color: var(--highlight-color) !important;
    font-size: 2.5rem !important;
    margin: 0 auto 1rem !important;
    display: block !important;
    width: auto !important;
    text-align: center !important;
}

.mini-card h4 {
    margin: 0 auto !important;
    color: var(--text-color) !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 1.1rem !important;
    width: 100% !important;
    text-align: center !important;
    line-height: 1.4 !important;
}

.mini-card:hover {
    transform: translateY(-5px);
    background: rgba(58, 117, 196, 0.1);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--highlight-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    border-top-left-radius: 20px;
    /* Match card radius */
    border-top-right-radius: 20px;
}

.card:hover::before {
    transform: scaleX(1);
}

.card h3 {
    font-size: 1.5rem;
    color: var(--highlight-color);
    margin-bottom: 15px;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    overflow-wrap: break-word;
    flex-grow: 1;
}

.card a {
    margin-top: auto;
}

/* Mini Cards for secondary sections */
.mini-card {
    text-decoration: none;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    text-align: center;
    border-radius: 15px;
    border: var(--glass-border);
    transition: transform 0.3s;
}

.mini-card i {
    color: var(--highlight-color);
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.mini-card h4 {
    margin: 0;
    color: var(--text-color);
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
}

.mini-card:hover {
    transform: translateY(-5px);
    background: rgba(58, 117, 196, 0.1);
}

.alternative-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.card-link {
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.card-link:hover {
    color: var(--highlight-color);
    gap: 10px;
}

/* Attività Preview */
.activity-preview {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 3px solid var(--highlight-color);
}

.activity-preview h4 {
    font-size: 1.1rem;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.5rem;
}

.activity-date {
    font-size: 0.85rem;
    color: var(--highlight-color);
    margin-bottom: 5px;
    display: block;
}

/* Observatories Grid */
.observatory-card {
    text-align: center;
}

.observatory-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.observatory-card:hover .observatory-img {
    transform: scale(1.05);
}

/* Gallery Preview */
.gallery-strip {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--highlight-color) transparent;
}

.gallery-item {
    min-width: 250px;
    height: 180px;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

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

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

/* Footer */
footer {
    background: #050614;
    padding: 60px 20px 20px;
    margin-top: 80px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.visitor-counter {
    background: rgba(255, 255, 255, 0.05);
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
    margin-bottom: 30px;
    font-family: 'Montserrat', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.partner-logo {
    max-width: 250px;
    margin: 30px auto;
    display: block;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
    border-radius: 8px;
}

.partner-logo:hover {
    opacity: 1;
    transform: scale(1.05);
}

.copyright {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

/* Utility for content pages */
.content-wrapper {
    max-width: 1200px;
    margin: 60px auto 60px;
    padding: 0 20px;
}

.content-wrapper h1 {
    font-size: 3rem;
    text-align: center;
    color: var(--highlight-color);
    margin-bottom: 40px;
}

.btn-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    /* Force stack for perfect centering */
    align-items: center;
    justify-content: center;
    /* Centered content */
    gap: 10px;
    text-align: center;
    /* Centered text */
    height: 100%;
    /* Ensure full height in grid */
}

.btn-glass:hover {
    background: rgba(58, 117, 196, 0.2);
    border-color: var(--highlight-color);
    transform: translateY(-2px);
}

.btn-glass img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 5px;
    /* Space between img and text */
    margin-right: 0;
    /* Remove right margin */
}


/* Utility layouts */
.content-flex {
    display: block;
    margin-bottom: 20px;
}

.content-flex img {
    float: left;
    margin-right: 20px;
    margin-bottom: 15px;
}

.content-flex img.float-right {
    float: right;
    margin-right: 0;
    margin-left: 20px;
}

.content-flex p {
    overflow: auto;
}

/* Handle nested divs with flex styles - convert to inline-block for side-by-side layout */
.content-flex > div[style*="flex"] {
    display: inline-block !important;
    width: calc(50% - 15px) !important;
    vertical-align: top;
    margin-right: 30px;
    margin-bottom: 20px;
}

.content-flex > div[style*="flex"]:last-child {
    margin-right: 0;
}

@media (max-width: 768px) {
    .content-flex img {
        float: none;
        display: block;
        margin: 0 auto 20px auto;
        max-width: 100%;
    }

    .content-flex img.float-right {
        margin-left: 0;
    }

    .content-flex p {
        text-align: center;
    }

    .content-flex > div[style*="flex"] {
        display: block !important;
        width: 100% !important;
        margin-right: 0;
    }
}

.shadow-img {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.shadow-img:hover {
    transform: scale(1.02);
}

.clean-list {
    list-style: none;
    padding: 0;
}

.clean-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.clean-list li:last-child {
    border-bottom: none;
}

/* Data List (Key-Value pairs) */
.data-list {
    list-style: none;
    padding: 0;
}

.data-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
}

.data-list li:last-child {
    border-bottom: none;
}

.full-width {
    grid-column: 1 / -1;
}

/* Gallery Specific Styles */
.gallery-section {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
}

.gallery-title {
    color: var(--highlight-color);
    font-size: 2.8rem;
    margin-bottom: 30px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    animation: fadeIn 1.5s ease;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 50px;
}

.category-button {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--highlight-color), var(--button-color));
    color: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.category-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(58, 117, 196, 0.4);
    background: linear-gradient(135deg, var(--highlight-hover), var(--highlight-color));
}

.category-section {
    margin-top: 20px;
    padding: 30px;
    background: var(--card-background);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: var(--glass-border);
    width: 100%;
    margin-bottom: 40px;
    transition: background-color 0.5s, box-shadow 0.5s;
    display: none;
    /* Hide by default, shown by JS */
}

/* Ensure one is shown if no JS, but we will use JS. 
   Actually, the original logic showed them all or filtered them. 
   Let's see: original used anchor links or filter? 
   No, they were all visible div blocks. 
   Wait, the JS in new_gallery.html was 'highlightCategory' which just scrolled to it.
   So they should be visible. */
.category-section {
    display: block;
}

.category-section.highlighted {
    box-shadow: 0 0 30px rgba(58, 117, 196, 0.3);
    border-color: var(--highlight-color);
}

.category-section h2 {
    color: var(--highlight-color);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

/* Photo Grid */
.photo-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
    align-items: flex-start;
}

.photo-item {
    position: relative;
    text-align: center;
    width: calc(33.33% - 20px);
    min-width: 250px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 15px;
    border: var(--glass-border);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.photo-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.photo-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 600;
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.photo-item img:hover {
    transform: scale(1.02);
}

.photo-description {
    display: none;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 10px;
    white-space: pre-wrap;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
}

.toggle-description-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: #ffffff;
    background: linear-gradient(135deg, #3a75c4, #4a86e8);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.toggle-description-btn:hover {
    background: linear-gradient(135deg, #4a86e8, #5a97f0);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    max-width: 95%;
    max-height: 95vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--highlight-color);
}

@media (max-width: 768px) {
    .photo-item {
        width: 100%;
    }

    .category-button {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

/* Legal Text */
.legal-text {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    text-align: left;
}

@media (min-width: 768px) {
    .legal-text {
        text-align: justify;
    }
}

/* Fix for Strumenti List Alignment */
#tecnica .card {
    text-align: center;
    /* Centers text like H3 */
    align-items: center;
    /* Centers flex items like Button */
}

#tecnica ul {
    padding-left: 0;
    margin: auto;
    /* Vertical (if flex-grow) and Horizontal center */
    width: fit-content;
    /* Shrink wrap to center the block */
    flex-grow: 1;
    /* Push to fill vertical space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center items inside if extra space */
}

#tecnica li {
    display: flex;
    align-items: center;
    /* Vertically center icon and text */
    justify-content: flex-start;
    /* Horizontally left align text relative to icon */
    gap: 10px;
    text-align: left;
}

#tecnica .card>div {
    /* Target the GIF container */
    margin: auto !important;
    /* Center vertically/horizontally */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-title {
    font-weight: bold;
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: var(--highlight-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}



.activity-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 950px;
    margin: 0 auto;
}

.activity-row {
    width: 100%;
}

.activity-preview {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    background: var(--card-background) !important;
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-left: 4px solid var(--highlight-color) !important;
    border-radius: 20px;
    padding: 30px 40px !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    margin-bottom: 0 !important;
}

.activity-preview h3,
.activity-preview h4,
.activity-preview span,
.activity-preview .card-link {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: fit-content !important;
    display: block !important;
}

.activity-preview .card-link {
    display: inline-flex !important;
    margin-top: 15px !important;
}

.activity-preview p {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0 auto 20px auto !important;
    max-width: 600px !important;
    text-align: justify !important;
    text-align-last: center !important;
    line-height: 1.6;
}

/* 1. Cookie Banner */
#cookie-banner {
    position: fixed;
    bottom: -100px;
    /* Start hidden */
    left: 0;
    width: 100%;
    background: rgba(10, 12, 27, 0.95);
    color: #fff;
    padding: 15px;
    text-align: center;
    border-top: 1px solid var(--accent-color);
    z-index: 9999;
    transition: bottom 0.5s ease;
    font-size: 0.9rem;
}

#cookie-banner.visible {
    bottom: 0;
}

#cookie-banner button {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 5px 15px;
    margin-left: 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* 2. Sky/Weather Widget */
#moon-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(10, 12, 27, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, background 0.3s ease, bottom 0.3s ease;
    cursor: pointer;
}

#moon-widget:hover {
    transform: scale(1.1);
    background: rgba(58, 117, 196, 0.3);
}

#moon-widget i {
    font-size: 1.5rem;
    color: #ffd700;
}

/* Weather Popup */
#sky-popup {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 260px;
    background: rgba(8, 10, 25, 0.98);
    border: 1px solid var(--highlight-color);
    border-radius: 15px;
    padding: 20px;
    color: white;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    /* Hidden by default */
    backdrop-filter: blur(15px);
    font-size: 0.95rem;
    animation: slideUp 0.3s ease-out;
}

#sky-popup.visible {
    display: block;
}

#sky-popup h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--highlight-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    text-align: center;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-item i {
    width: 20px;
    text-align: center;
    color: var(--highlight-color);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

@media (max-width: 480px) {
    #sky-popup {
        width: calc(100% - 40px);
        left: 20px;
    }
}

/* 3. News & Blog Section */
#news-blog {
    padding-bottom: 0px;
}

#news-blog .section-title {
    font-size: 2rem;
    /* Increased size */
    margin-bottom: 30px;
    text-align: center;
}

/* Software Astronomico */
#software {
    padding-bottom: 20px;
}

.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-align: center;
    /* Center everything in the card */
    align-items: center;
    padding: 25px;
}

.news-date {
    display: inline-block;
    background: var(--highlight-color);
    color: white;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 12px;
    width: fit-content;
}

.news-title {
    font-size: 1.2rem;
    color: var(--highlight-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.news-body {
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.6;
    flex-grow: 1;
    text-align: center;
    /* Center text content */
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 1rem;
}

.loading-state i {
    margin-right: 10px;
    color: var(--highlight-color);
}

@media (max-width: 768px) {
    #news-blog .card-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- Professional Additions --- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--highlight-color);
    z-index: 2000;
    transition: width 0.1s;
}

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--highlight-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: none;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--highlight-hover);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    #back-to-top {
        bottom: 100px; /* Higher to avoid covering footer */
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    #moon-widget {
        bottom: 100px; /* Higher to avoid covering footer */
        left: 20px;
        width: 45px;
        height: 45px;
    }

    #moon-widget i {
        font-size: 1.2rem;
    }
}

#search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 10, 25, 0.98);
    z-index: 3000;
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    backdrop-filter: blur(10px);
}

#search-overlay.visible {
    display: flex;
}

#search-input {
    width: 80%;
    max-width: 600px;
    background: none;
    border: none;
    border-bottom: 2px solid var(--highlight-color);
    color: white;
    font-size: 2rem;
    padding: 10px;
    outline: none;
    text-align: center;
}

#search-results {
    width: 80%;
    max-width: 800px;
    margin-top: 40px;
    overflow-y: auto;
    max-height: 60vh;
    padding: 20px;
}

.search-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-item:hover {
    background: rgba(58, 117, 196, 0.1);
    border-color: var(--highlight-color);
    transform: translateY(-3px);
}

.search-item h3 {
    margin: 0 0 10px 0;
    color: var(--highlight-color);
}

.search-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

#search-close {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

#search-close:hover {
    opacity: 1;
}

/* --- Print Styles --- */
@media print {

    header,
    footer,
    #back-to-top,
    #progress-bar,
    .menu-toggle,
    #search-toggle,
    iframe,
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    a {
        text-decoration: underline;
        color: black;
    }

    .content-wrapper {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        break-inside: avoid;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    h1,
    h2,
    h3 {
        color: black !important;
        page-break-after: avoid;
    }
}