:root {
    --bg-light: #fffcf9;
    --bg-white: #ffffff;
    --primary: #ff007f; /* Vibrant Pink */
    --primary-light: #ff66b2;
    --secondary: #00f5d4; /* Turquoise */
    --accent: #ff9f1c; /* Orange */
    --text-main: #2d3436;
    --text-muted: #636e72;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 40px rgba(255, 0, 127, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    background-image: url('musimate_light_pattern_1776074873320.png');
    background-size: 800px;
    background-repeat: repeat;
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
}

/* Background Decorations */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.15;
    pointer-events: none;
    z-index: 999;
}

.blob-container {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: 40%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 100px) scale(1.1); }
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.palmieri-logo {
    height: 65px; /* Ingrandito per dare spazio al morphing */
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 0, 127, 0.2));
    transition: transform 0.3s ease;
}

.palmieri-logo:hover {
    transform: scale(1.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.lab-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white !important;
    padding: 0.8rem 1.6rem;
    border-radius: 100px;
    box-shadow: 0 10px 20px rgba(255, 0, 127, 0.2);
}

.nav-link.lab-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px rgba(255, 0, 127, 0.3);
}

/* Sections */
section {
    padding: 100px 2rem;
    position: relative;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Hero Section */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 120px;
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-light), #ec4899, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
}

.btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 10px 25px rgba(255, 0, 127, 0.3);
}

.btn-primary:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 0, 127, 0.4);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.08);
}

/* Hero Visual: Sine Waves */
.hero-visual {
    position: relative;
    height: 550px; /* Increased */
    display: flex;
    justify-content: center;
    align-items: center;
}

.sine-waves {
    width: 100%;
    height: 200px; /* Increased */
    position: relative;
}

.wave {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.3;
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path d="M0 50 Q 125 0 250 50 T 500 50 T 750 50 T 1000 50" fill="none" stroke="black" stroke-width="4"/></svg>'); /* Thicker stroke */
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path d="M0 50 Q 125 0 250 50 T 500 50 T 750 50 T 1000 50" fill="none" stroke="black" stroke-width="4"/></svg>');
    mask-repeat: repeat-x;
    animation: wave-move 3s linear infinite;
}

.wave-2 { animation-duration: 4s; opacity: 0.2; transform: translateY(20px) scaleY(1.5); }
.wave-3 { animation-duration: 5s; opacity: 0.1; transform: translateY(-20px) scaleY(0.8); }

@keyframes wave-move {
    from { background-position: 1000px 0; }
    to { background-position: 0 0; }
}

.floating-notes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.floating-notes i {
    position: absolute;
    font-size: 4rem; /* Doubled size */
    color: var(--primary);
    filter: drop-shadow(0 0 15px rgba(255, 0, 127, 0.3));
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

.note-1 { top: 0%; left: 10%; animation-delay: 0s; font-size: 5rem !important; }
.note-2 { bottom: 10%; right: 5%; animation-delay: 2s; font-size: 7rem !important; }
.note-3 { top: 30%; right: 25%; animation-delay: 4s; font-size: 6rem !important; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-30px) rotate(10deg); }
}

/* Feature Cards */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.divider {
    width: 80px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto 1.5rem;
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-color: var(--primary-light);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.card-more {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* History Section */
.dark-section {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
}

.history-flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.section-tag {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    display: block;
}

.history-points {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.point {
    display: flex;
    gap: 1.5rem;
}

.point-number {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: rgba(0,0,0,0.05);
    line-height: 1;
}

.point h4 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--primary);
}

.history-visual-box {
    background: radial-gradient(circle at center, rgba(79, 70, 229, 0.05), transparent 70%);
    aspect-ratio: 1;
    border-radius: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border: 1px solid var(--glass-border);
}

.golden-ratio-demo {
    position: relative;
}

.phi-spiral {
    width: 300px;
    height: 185px;
    border: 2px solid var(--accent);
    border-radius: 0 100% 0 0; /* Simulating a phi spiral segment */
    position: relative;
    opacity: 0.3;
}

.phi-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Outfit';
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

/* Lab Section */
.lab-card {
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.05);
}

.lab-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    margin-top: 3rem;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-light);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 12px;
    font-family: inherit;
}

.btn-lab {
    width: 100%;
    justify-content: center;
    background: var(--primary);
    color: white;
}

.lab-visualizer {
    background: #f8fafc;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    height: 300px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

canvas {
    width: 100%;
    height: 100%;
}

.ratio-display {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Outfit';
    font-weight: 700;
    color: var(--accent);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--bg-white);
    margin: 5% auto;
    padding: 3rem;
    width: 80%;
    max-width: 800px;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 40px 100px rgba(0,0,0,0.1);
}

.close-modal {
    position: absolute;
    right: 2rem;
    top: 1.5rem;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Footer */
footer {
    padding: 4rem 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-credits {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 968px) {
    .hero-container, .history-flex, .lab-grid {
        grid-template-columns: 1fr;
    }
    h1 { font-size: 3rem; }
    .hero-visual { height: 200px; }
}

/* Mini Case Studies Style */
.mini-example-card {
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 18px;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.mini-example-card:hover {
    transform: translateX(10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(255, 0, 127, 0.1);
}

.mini-icon {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
}

.mini-example-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: var(--primary);
    font-weight: 800;
}

.mini-example-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.mini-hint {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-example-card:hover .mini-hint {
    color: var(--primary);
}
