html, body {
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Font display (Poppins) per i titoli — applicato via CSS invece che via
   MudTheme Typography (API non instanziabile in MudBlazor 9.5). */
.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6 {
    font-family: 'Poppins', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

h1:focus {
    outline: none;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.app-logo {
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
}

.drawer-logo {
    height: 56px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

/* Rimuove padding interno del bottone appbar per ospitare il logo */
.logo-btn .mud-button-root {
    padding: 0 !important;
    min-width: unset !important;
}

/* Drawer laterale: visibile solo su desktop (>=960px).
   Su mobile la navigazione è gestita interamente dalla bottom nav. */
.main-drawer .mud-drawer-content {
    background-color: var(--mud-palette-surface);
}

@media (max-width: 959px) {
    .main-drawer {
        display: none !important;
    }

    /* Il drawer persistente resta "open" nel modello di MudBlazor anche se
       nascosto via display:none, e di conseguenza applica un margin-left
       (e all'appbar anche una width ridotta) all'appbar, al content e a tutti
       i div sibling (footer, bottom nav). Su mobile azzeriamo così header,
       contenuto e footer occupano l'intera larghezza. */
    .mud-appbar,
    .mud-main-content,
    .main-drawer ~ * {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .mud-appbar {
        width: 100% !important;
    }
}

/* Bottom navigation bar (mobile only) */
.bottom-nav-wrapper {
    display: block;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1300;
    background-color: var(--mud-palette-surface);
}

.bottom-nav-item {
    flex: 1;
    min-width: 0 !important;
    padding: 4px 0 !important;
    border-radius: 0 !important;
    text-transform: none !important;
}

.bottom-nav-spacer {
    height: 64px;
    display: block;
}

@media (min-width: 960px) {
    .bottom-nav-wrapper,
    .bottom-nav-spacer {
        display: none !important;
    }
}

/* SEO: make public pages render nicely without JS */
.mud-main-content {
    min-height: 60vh;
}

/* MudBlazor overrides for professional look */
.mud-appbar {
    z-index: 1300;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Page transitions */
.page-enter {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Manual modal overlay (replaces non-functional inline MudDialog @bind-Open) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1400;
    padding: 16px;
}

.modal-card {
    width: 560px;
    max-width: 100%;
    max-height: 92vh;
    overflow: auto;
    background: var(--mud-palette-background);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.modal-card.modal-card-lg {
    width: 760px;
}

/* ===== Card condivise (consolidate da <style> inline di Home/Servizi) ===== */
.servizio-card,
.progetto-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-radius: 16px !important;
    overflow: hidden;
}

.servizio-card:hover,
.progetto-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(21, 101, 192, 0.18) !important;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Badge tonale per l'icona nelle card servizi */
.servizio-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
    color: var(--mud-palette-primary);
    margin-bottom: 12px;
}

/* Freccia "Scopri di più" che trasla a destra sull'hover della card */
.servizio-card .scopri-arrow,
.progetto-card .scopri-arrow {
    transition: transform 0.2s ease;
}

.servizio-card:hover .scopri-arrow,
.progetto-card:hover .scopri-arrow {
    transform: translateX(4px);
}

/* ===== Strip credibilità (numeri) ===== */
.stat-tile {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 16px;
    background: var(--mud-palette-surface);
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    height: 100%;
}

.stat-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(21, 101, 192, 0.15);
}

.stat-number {
    font-family: 'Poppins', 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 2.25rem;
    line-height: 1;
    color: var(--mud-palette-primary);
}

.stat-label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

/* ===== Hero arricchito ===== */
.hero-section {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 22%, rgba(255, 196, 0, 0.28), transparent 38%),
        radial-gradient(circle at 15% 85%, rgba(2, 136, 209, 0.45), transparent 45%),
        linear-gradient(135deg, #0D47A1 0%, #1565C0 45%, #0277BD 100%);
    padding: 6rem 1rem;
    min-height: 56vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pattern geometrico sottile sovrapposto */
.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
    pointer-events: none;
}

/* Shimmer luminoso lento */
.hero-section::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.10) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: heroShimmer 9s linear infinite;
    pointer-events: none;
}

@keyframes heroShimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: heroFadeIn 0.7s ease-out both;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(4px);
}

/* ===== Reveal on-load (CSS only, no JS) ===== */
.section-reveal {
    animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Focus accessibile brand ===== */
:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--mud-palette-secondary) 70%, transparent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== Accessibilità: riduci le animazioni ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero-section::after,
    .section-reveal,
    .hero-content,
    .page-enter {
        animation: none !important;
    }
    .servizio-card,
    .progetto-card,
    .stat-tile {
        transition: none !important;
    }
}