/* --- VARIABILI COLORI E STILI BASE --- */
:root {
    --bg-main: #FDFCFB;
    --azzurro: #4A90E2; 
    --crema: #F4EEDC;
    --corallo: #E85D4E; 
    --bianco: #FFFFFF;
    --nero: #1A1A1A;
    --border-thick: 4px;
    --effetto-carta: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.12'/%3E%3C/svg%3E");
}

html { scroll-behavior: smooth; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Lexend', sans-serif; }

body { background-color: var(--bg-main); background-image: var(--effetto-carta); color: var(--nero); line-height: 1.4; overflow-x: hidden; }
body.configurator-body { background-color: var(--crema); }

.bg-azzurro { background-color: var(--azzurro); background-image: var(--effetto-carta); }
.bg-crema { background-color: var(--crema); background-image: var(--effetto-carta); }
.bg-corallo { background-color: var(--corallo); background-image: var(--effetto-carta); }
.bg-bianco { background-color: var(--bianco); background-image: var(--effetto-carta); }

/* --- NAVBAR FISSA E Z-INDEX --- */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; height: 70px; background-color: var(--bianco); background-image: var(--effetto-carta); border-bottom: var(--border-thick) solid var(--nero); position: sticky; top: 0; z-index: 10000; }
.logo { font-size: 1.1rem; font-weight: 900; text-transform: uppercase; position: relative; z-index: 10005; }
.logo a { color: inherit; text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 15px; margin-left: auto; position: relative; z-index: 10005; }
.nav-cart-icon { position: relative; text-decoration: none; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.cart-badge { position: absolute; top: -4px; right: -6px; background: var(--corallo); color: var(--bianco); font-size: 0.55rem; font-weight: 900; border-radius: 50%; padding: 1px 4px; border: 1.5px solid var(--bianco); }

.nav-links { list-style: none; display: flex; gap: 3rem; align-items: center; margin-left: 4rem; }
.nav-links a { text-decoration: none; color: var(--nero); font-weight: 700; text-transform: uppercase; font-size: 0.8rem; transition: 0.2s; }
.nav-links a:hover { color: var(--azzurro); }
.hamburger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; height: 70px; width: 30px; cursor: pointer; }
.bar { display: block; width: 100%; height: 4px; background-color: var(--nero); transition: transform 0.3s ease-in-out, opacity 0.3s; border-radius: 2px; margin: 0; transform-origin: center; }

/* --- CONTENUTI HERO, HOME, CARDS --- */
.block-section { position: relative; padding: 5rem 1.5rem; border-bottom: var(--border-thick) solid var(--nero); border-radius: 0 0 30px 30px; margin-bottom: -20px; }
#home { z-index: 10; } #categorie { z-index: 9; } 
#contatti { z-index: 8; margin-bottom: 0; border-radius: 0; border-bottom: none; } 

.hero-content { max-width: 800px; margin: 0 auto; text-align: center; position: relative; z-index: 10; }
.tag { display: inline-block; padding: 0.3rem 1rem; background: var(--nero); color: var(--bianco); border-radius: 50px; font-size: 0.7rem; text-transform: uppercase; font-weight: 900; margin-bottom: 1.5rem; }
.hero-content h1 { font-size: 3rem; line-height: 1.1; margin-bottom: 1.5rem; text-transform: uppercase; }
.hero-content p { font-size: 1.1rem; margin-bottom: 2rem; font-weight: 700; }
.cta-button { display: inline-flex; justify-content: center; align-items: center; padding: 1rem 2rem; background-color: var(--bianco); background-image: var(--effetto-carta); color: var(--nero); text-decoration: none; font-weight: 900; border: var(--border-thick) solid var(--nero); border-radius: 50px; box-shadow: 4px 4px 0px var(--nero); transition: 0.15s ease-out; text-transform: uppercase; cursor: pointer; box-sizing: border-box; max-width: 100%; }
.cta-button:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--nero); }
button:disabled { background: #e0e0e0 !important; color: #999 !important; border-color: #999 !important; box-shadow: none !important; cursor: not-allowed !important; transform: none !important; }
.grid-container { display: grid; grid-template-columns: 1fr; gap: 1.2rem; max-width: 1000px; margin: 0 auto; position: relative; z-index: 10; }

/* FIX ALLINEAMENTO CARD (FLEXBOX) */
.card-link { text-decoration: none; color: inherit; display: block; }
.card { border: var(--border-thick) solid var(--nero); border-radius: 20px; box-shadow: 6px 6px 0px var(--nero); background: var(--bianco); transition: transform 0.15s ease-out, box-shadow 0.15s ease-out; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.card-content { padding: 1.5rem; text-align: center; display: flex; flex-direction: column; flex-grow: 1; }
.card-bottom { margin-top: auto; width: 100%; }

.card-link:active .card { transform: translate(6px, 6px); box-shadow: 0px 0px 0px var(--nero) !important; }
.size-select { margin-bottom: 1rem; width: 100%; }
.classici-price { font-size: 1.8rem; font-weight: 900; color: var(--corallo); margin-bottom: 1rem; }
.floating-icon { position: absolute; z-index: 1; filter: drop-shadow(4px 4px 0px var(--nero)); }
.icon-right { bottom: 10%; right: 20px; transform: rotate(15deg); }
.icon-left { top: 10%; left: 20px; transform: rotate(-10deg); }

.footer-legal { background: var(--nero); color: var(--bianco); padding: 3rem 1.5rem; text-align: center; border-top: none; }
.footer-legal h4 { font-size: 1.5rem; margin-bottom: 1rem; color: var(--bianco); text-transform: uppercase; font-weight: 900; }
.footer-legal p { font-size: 0.8rem; opacity: 0.8; max-width: 600px; margin: 0 auto 1.5rem auto; line-height: 1.5; }
.legal-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.legal-links a { color: var(--bianco); text-decoration: underline; font-size: 0.75rem; font-weight: 700; opacity: 0.7; transition: 0.2s; }
.legal-links a:hover { opacity: 1; color: var(--corallo); }

/* --- STEP CONFIGURATORE --- */
.fixed-counter { position: absolute; top: 85px; left: 1.5rem; z-index: 100; background: transparent; border: none; padding: 0; }
.step-counter { font-weight: 900; font-size: 0.8rem; background: var(--nero); color: var(--bianco); padding: 0.3rem 0.8rem; border-radius: 20px; display: inline-block; }
.step-slider { position: relative; overflow: hidden; min-height: 80vh; padding-bottom: 80px; padding-top: 3rem; }
.step-page { display: none; padding: 0 1.5rem 2rem 1.5rem; animation: slideIn 0.4s cubic-bezier(0.25, 1, 0.5, 1); }
.step-page.active { display: block; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.step-inner { max-width: 600px; margin: 0 auto; }
.step-inner h2 { font-size: 1.8rem; margin-bottom: 0.5rem; text-transform: uppercase; }
.section-label { display: block; font-weight: 900; text-transform: uppercase; font-size: 0.9rem; margin: 1rem 0 0.5rem 0; color: var(--nero); }
.crumb-badge { display: flex; align-items: center; background: var(--bianco); border: 2px solid var(--nero); padding: 0.4rem 0.8rem; border-radius: 50px; font-weight: 900; font-size: 0.8rem; gap: 8px; box-shadow: 2px 2px 0px var(--nero); }
.crumb-badge button { background: transparent; color: var(--nero); border: none; border-radius: 0; width: auto; height: auto; font-size: 1rem; cursor: pointer; padding: 0; margin-left: 5px; }
.visual-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.visual-opt { padding: 1rem; border: var(--border-thick) solid var(--nero); border-radius: 12px; text-align: center; font-weight: 700; cursor: pointer; background: var(--bianco); transition: all 0.2s; font-size: 0.9rem; box-sizing: border-box; }
.selected-box { background: var(--nero) !important; color: var(--bianco) !important; transform: translate(3px, 3px); box-shadow: none; }
.premium-tag { display: inline-block; background: var(--corallo); color: var(--bianco); font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; margin-top: 5px; font-weight: 900; }
.old-price { text-decoration: line-through; opacity: 0.5; margin-right: 5px; }
.free-text { color: var(--corallo); font-weight: 900; }
.letter-layout-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.letter-layout-grid .visual-opt { flex: 1 1 40%; min-width: 120px; }
.letter-full-width { flex: 1 1 100% !important; }
.expandable-section { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out; }
.expandable-section.expanded { max-height: 800px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 15px; padding-bottom: 10px; }
.color-opt { width: 50px; height: 50px; border-radius: 50%; cursor: pointer; box-shadow: 3px 3px 0px var(--nero); border: 3px solid transparent; transition: transform 0.2s, box-shadow 0.2s; }
.color-opt:active { transform: translate(3px, 3px); box-shadow: 0px 0px 0px transparent; }
.selected-color-active { border: 4px solid var(--nero) !important; box-shadow: 0px 0px 0px transparent !important; transform: translate(3px, 3px); }
.input-brutal { width: 100%; padding: 1rem; border: var(--border-thick) solid var(--nero); border-radius: 12px; font-family: 'Lexend', sans-serif; font-weight: 700; background: var(--bianco); font-size: 1rem; box-sizing: border-box; transition: 0.2s; }
.flower-tag { display: inline-flex; align-items: center; padding: 0.3rem 0.8rem; background: var(--bianco); border: 2px solid var(--nero); margin: 0.3rem 0.3rem 0 0; font-weight: 900; border-radius: 50px; font-size: 0.8rem; }
.remove-tag { color: var(--corallo); cursor: pointer; margin-left: 10px; font-size: 1.1rem; }
.btn-small { padding: 0.8rem 1rem; font-size: 0.8rem; background: var(--crema); }
.btn-row { display: flex; gap: 10px; margin-top: 2rem; justify-content: center; width: 100%; box-sizing: border-box; }
.btn-row button { box-sizing: border-box; }

.title-capolavoro { font-size: 2.8rem !important; font-weight: 900 !important; letter-spacing: -2px; transform: rotate(-2deg); margin-bottom: 2rem !important; color: var(--azzurro); text-shadow: 2px 2px 0px var(--nero); }
.final-actions-area { margin-top: 2rem; display: flex; flex-direction: column; gap: 15px; align-items: center; }
.action-row-main { display: flex; gap: 10px; width: 100%; justify-content: center; align-items: center; }
.btn-buy { flex-grow: 1; background: var(--azzurro); color: var(--bianco); font-size: 1.2rem; font-weight: 900; text-shadow: none; padding: 1.2rem; }
.circle-btn { width: 68px; height: 68px; border-radius: 50%; border: var(--border-thick) solid var(--nero); display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 4px 4px 0px var(--nero); transition: 0.2s; flex-shrink: 0; aspect-ratio: 1/1; box-sizing: border-box; background: var(--crema); }
.circle-btn:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--nero); }
.cart-emoji { font-size: 1.1rem; }
.cart-plus { font-size: 1rem; font-weight: 900; margin-left: 2px; }
.btn-trash { background: var(--corallo); color: white; font-size: 1.5rem; }
.action-row-sub { display: flex; gap: 10px; width: 100%; justify-content: center; align-items: center; margin-top: 0.5rem; }
.btn-edit { flex-grow: 1; background: var(--bianco); font-size: 0.9rem; }
.price-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--nero); color: var(--bianco); padding: 1rem; text-align: center; z-index: 4000; border-top: var(--border-thick) solid var(--bianco); }
.price-bar p { font-weight: 700; }
.price-bar span { font-size: 1.5rem; color: var(--corallo); font-weight: 900; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 20000; padding: 1rem; box-sizing: border-box; }
.modal-content { background: var(--bianco); background-image: var(--effetto-carta); padding: 2.5rem 2rem; border-radius: 25px; border: var(--border-thick) solid var(--nero); width: 100%; max-width: 400px; position: relative; box-sizing: border-box; text-align: center; }
.close-modal { position: absolute; top: 5px; right: 5px; font-size: 2.5rem; font-weight: 900; cursor: pointer; color: var(--corallo); width: 50px; height: 50px; display: flex; justify-content: center; align-items: center; z-index: 100; background: transparent; border: none; padding: 0; margin: 0; }
.close-modal::before { content: '×'; display: block; line-height: 1; }
.letter-paper { background: #FFF9E6; border: 2px dashed #D3A76C; padding: 2rem; min-height: 200px; border-radius: 5px; box-shadow: inset 0 0 10px rgba(0,0,0,0.05); white-space: pre-wrap; text-align: left; }
.font-classico { font-family: 'Times New Roman', serif; font-size: 1.2rem; }
.font-manoscritto { font-family: 'Brush Script MT', 'Lucida Handwriting', cursive; font-size: 1.5rem; }
.font-macchina { font-family: 'Courier New', Courier, monospace; font-size: 1.1rem; }

.cart-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.cart-item { background: var(--bianco); border: 2px solid var(--nero); border-radius: 15px; padding: 1.2rem; display: flex; justify-content: space-between; align-items: center; box-shadow: 3px 3px 0px var(--nero); transition: opacity 0.3s; }
.cart-item-details h4 { font-size: 1.1rem; text-transform: uppercase; margin-bottom: 0.3rem; text-align: left; }
.cart-item-details p { font-size: 0.8rem; font-weight: 700; color: #555; line-height: 1.4; text-align: left; white-space: pre-wrap; }
.cart-item-price { font-weight: 900; font-size: 1.2rem; color: var(--corallo); }
.cart-item-remove { background: none; border: none; font-size: 1.5rem; color: var(--corallo); font-weight: 900; cursor: pointer; padding: 5px; margin-left: 10px; }
.cart-total-box { background: var(--nero); color: var(--bianco); border-radius: 15px; padding: 1.5rem; margin-top: 2rem; text-align: center; }
.cart-total-box h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.cart-total-box span { color: var(--corallo); font-size: 2rem; font-weight: 900; }
.checkout-form { display: flex; flex-direction: column; gap: 10px; margin-top: 2rem; text-align: left; }
.checkout-form label { font-weight: 900; font-size: 0.8rem; text-transform: uppercase; margin-top: 10px;}

.input-error { border-color: var(--corallo) !important; background-color: #FFEEEE !important; }
.checkout-row { display: flex; gap: 10px; width: 100%; }
.checkout-row .col-70 { flex: 7; }
.checkout-row .col-50 { flex: 5; }
.checkout-row .col-30 { flex: 3; }

.cart-item-header { display: flex; align-items: center; gap: 15px; }
.item-checkbox { width: 22px; height: 22px; accent-color: var(--azzurro); cursor: pointer; }
.cart-item.unselected { opacity: 0.5; background: #f9f9f9; box-shadow: none; }

#char-counter { transition: color 0.3s ease; }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.active { display: flex; position: fixed; left: 0; top: 0; flex-direction: column; background-color: var(--bianco); background-image: var(--effetto-carta); width: 100%; padding: 90px 0 2rem 0; transform: translateY(0); z-index: 10001; border-bottom: var(--border-thick) solid var(--nero); box-shadow: 0 15px 30px rgba(0,0,0,0.1); margin-left: 0; }
    .nav-links.active li { margin: 0.8rem 0; }
    .hamburger { display: flex; }
    .hamburger.active .bar:nth-child(2) { transform: scaleX(0); opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
    .hero-content h1 { font-size: 2.2rem; }
    .step-inner h2 { font-size: 1.5rem; }
    .btn-row { flex-direction: column; width: 100%; }
    .btn-row button { width: 100%; box-sizing: border-box; margin: 0; }
    .cart-item { flex-direction: column; align-items: flex-start; gap: 10px; position: relative; }
    .cart-item-price { margin-top: 0.5rem; }
    .cart-item-remove { position: absolute; top: 10px; right: 10px; }
    .checkout-row { flex-direction: column; gap: 0; }
}
@media (min-width: 769px) { 
    .grid-container { grid-template-columns: repeat(3, 1fr); } 
    .block-section { padding: 8rem 2rem; } 
}