:root {
    --brand-red: #ff0000;
    --dark-obsidian: #050505;
    --grid-color: rgba(255, 0, 0, 0.08);
    --text-dim: #888;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--dark-obsidian);
    color: white;
    font-family: 'Inter', sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* BACKGROUND GRID */
.grid-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
}

.grid-lines {
    width: 100%; height: 100%;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black 20%, transparent 90%);
    -webkit-mask-image: radial-gradient(circle at center, black 20%, transparent 90%);
}

.radial-overlay {
    position: absolute;
    width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(255, 0, 0, 0.03) 0%, transparent 70%);
}

/* HEADER */
header { 
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 30px 0; 
    display: flex; 
    justify-content: center; 
    z-index: 10;
}
.main-logo { 
    height: clamp(60px, 8vw, 90px); 
    filter: drop-shadow(0 0 10px rgba(255,0,0,0.3)); 
}

/* HERO */
.hero { 
    position: relative;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
    padding: 0 5%;
    min-height: 100vh;
    justify-content: center;
}

.system-status { 
    font-size: 0.65rem; 
    color: var(--brand-red); 
    letter-spacing: 3px; 
    font-weight: 900; 
    margin-bottom: 15px; 
}
.pulse { 
    display: inline-block; 
    width: 6px; height: 6px; 
    background: var(--brand-red); 
    border-radius: 50%; 
    animation: blink 1.2s infinite; 
    vertical-align: middle; 
    margin-right: 5px; 
}

h1 { 
    font-size: clamp(3rem, 13vw, 9.5rem); 
    font-weight: 900; 
    line-height: 0.85; 
    letter-spacing: -4px; 
    margin-bottom: 10px;
}
.outline-text { color: transparent; -webkit-text-stroke: 1px white; font-style: italic; }
.brand-subtext { color: var(--text-dim); margin: 25px 0; max-width: 420px; font-size: clamp(0.85rem, 2vw, 1rem); line-height: 1.5; }

/* BUTTONS */
.button-group { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    width: 100%; 
    max-width: 300px; 
}
.btn-heavy, .btn-ghost { padding: 18px; font-weight: 900; text-decoration: none; text-align: center; font-size: 0.9rem; transition: 0.3s; }
.btn-heavy { background: var(--brand-red); color: white; }
.btn-heavy:hover { background: white; color: black; box-shadow: 0 0 20px white; }
.btn-ghost { border: 1px solid #333; color: white; }

/* SECTIONS */
section { 
    padding: 80px 5%; 
    border-top: 1px solid #111; 
}
.section-title, .spec-grid, .gallery-container {
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
}
.section-title { margin-bottom: 40px; }
.section-title span { color: var(--brand-red); font-weight: 900; font-size: 0.8rem; }
.section-title h2 { font-size: clamp(1.8rem, 4vw, 2.2rem); font-weight: 900; letter-spacing: -1px; }

/* LAYOUT MOBILE FIRST */
.spec-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 20px; 
}
.spec-card { border: 1px solid #1a1a1a; padding: 30px; background: rgba(255, 255, 255, 0.01); transition: 0.3s; }
.spec-card:hover { border-color: var(--brand-red); }
.spec-card h3 { color: var(--brand-red); margin-bottom: 10px; font-size: 1.1rem; }
.spec-card p { color: var(--text-dim); font-size: 0.9rem; line-height: 1.6; }

.gallery-container { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
}

.cap-frame { 
    background: #080808; 
    aspect-ratio: 1/1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: 1px solid #111; 
    transition: 0.3s; 
    position: relative;
    overflow: hidden;
}
.cap-frame:hover { border-color: var(--brand-red); }
.img-placeholder { color: #111; font-weight: 900; font-family: monospace; transition: 0.3s; }
.cap-frame:hover .img-placeholder { color: var(--brand-red); }

.instagram-story {
    padding: 0;
}
.story-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}
.live-tag {
    background: var(--brand-red);
    color: white;
    font-size: 0.60rem;
    font-weight: 900;
    padding: 4px 8px;
    border-radius: 2px;
}
.story-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* SCROLL INDICATOR */
.scroll-indicator {
    position: absolute; 
    bottom: 30px; 
    left: 50%; 
    transform: translateX(-50%);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 12px; 
    z-index: 100;
    transition: opacity 0.4s;
    cursor: pointer;
}

.scroll-indicator span { 
    font-size: 0.65rem; 
    font-weight: 900; 
    letter-spacing: 4px; 
    color: white; 
    opacity: 0.8;
}

.scroll-line {
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, var(--brand-red), transparent);
    position: relative;
    overflow: hidden;
}

.scroll-line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    animation: scrollMove 2s infinite linear;
}

@keyframes scrollMove {
    0% { top: -100%; }
    100% { top: 100%; }
}

.scroll-indicator.hidden { opacity: 0; pointer-events: none; }

/* FOOTER */
footer { padding: 60px 5%; text-align: center; border-top: 1px solid #111; }
.footer-logo { height: clamp(30px, 5vw, 40px); opacity: 0.3; margin-bottom: 20px; }
.footer-links a { color: var(--text-dim); text-decoration: none; margin: 0 10px; font-size: 0.75rem; font-weight: 900; }

/* MEDIA QUERIES - DESKTOP */
@media (min-width: 768px) {
    .button-group { flex-direction: row; max-width: none; justify-content: center; }
    .spec-grid { grid-template-columns: repeat(3, 1fr); }
    .gallery-container { grid-template-columns: repeat(4, 1fr); gap: 15px; }
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.config-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    background: rgba(255, 255, 255, 0.02);
    padding: 40px;
    border: 1px solid #111;
}

@media (min-width: 768px) {
    .config-wrapper { grid-template-columns: 1.5fr 1fr; }
}

/* Anteprima del cappello */
.cap-viewer {
    position: relative;
    aspect-ratio: 1/1;
    background: #080808;
    border: 1px dashed #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cap-layer {
    position: absolute;
    width: 80%;
    height: 80%;
    transition: background-color 0.4s ease;
}

/* Nota: In un caso reale, qui useresti immagini PNG trasparenti 
   con maschere per il colore. Per ora usiamo forme placeholder. */
.cap-layer.base {
    clip-path: polygon(20% 100%, 80% 100%, 100% 50%, 50% 0%, 0% 50%);
    background: var(--dark-obsidian);
    z-index: 1;
}

.cap-layer.visor {
    clip-path: ellipse(50% 20% at 50% 90%);
    background: #111;
    z-index: 2;
}

.logo-placeholder {
    z-index: 3;
    font-weight: 900;
    font-size: 2rem;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Controlli */
.control-group h4 {
    font-size: 0.7rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: var(--text-dim);
}

.swatches {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.swatch {
    width: 35px;
    height: 35px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
}

.swatch.active {
    border-color: var(--brand-red);
    transform: scale(1.1);
}