:root {
    /* Colori del Brand */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    
    /* Layout */
    --radius: 12px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --container-width: 900px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Inter', system-ui, sans-serif; 
    background-color: var(--bg); 
    color: var(--text);
    line-height: 1.6;
}

.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }

.nav-item { position: relative; }
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.5rem 0;
    min-width: 160px;
    z-index: 1000;
}
.dropdown li a {
    padding: 8px 16px;
    display: block;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}
.dropdown li a:hover { background: #f8fafc; color: var(--primary); }
.nav-item:hover .dropdown { display: block; }

header { background: white; padding: 1rem 0; border-bottom: 1px solid #e2e8f0; }
header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: bold; font-size: 1.2rem; color: var(--primary); height:40px;}

.btn-primary:hover { background: var(--primary-hover); }

footer { margin-top: 4rem; padding: 2rem 0; font-size: 0.9rem; color: #64748b; text-align: center; }

.tool-card { 
    background: var(--card); 
    padding: 2rem; 
    border-radius: var(--radius); 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    margin-top: 3rem;
}

#result-display {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary);
    margin: 1.5rem 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.3s;
}


/* Griglia della Homepage */
.tool-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
    gap:20px;
}

.card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.card-link:hover {
    transform: translateY(-5px);
}

.tool-card-home {
    background: var(--card);
    padding: 0; /* Rimosso padding qui per farlo gestire ai sotto-elementi */
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 250px; /* Aumentato leggermente per dare respiro */
    overflow: hidden; /* Fondamentale: nulla esce dai bordi */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-card-home .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.tool-card-home h3 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.tool-card-home p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.tool-card-home:hover{
    transform:translateY(-4px);
    box-shadow:0 8px 20px rgba(0,0,0,0.08);
}

.card-image{
    height: 55%;
    overflow:hidden;
}

.card-image img{
    width:100%;
    height:100%;
    object-fit:cover;
}

/* metà bassa testo */
.card-content {
    flex-grow: 1;
    /* Riduciamo il padding interno per togliere il bianco superfluo */
    padding: 12px; 
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centra verticalmente il testo nel poco spazio rimasto */
    gap: 4px;
}

.card-content h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    /* Tronca il titolo se troppo lungo su una riga */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
    /* Tronca il testo dopo 3 righe (Clamping) */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}