/* Frecce Gialle Malcantone - site.css */
:root {
    --blue-900: #062a57;
    --blue-800: #0a3a75;
    --blue-700: #0d4f9c;
    --blue-600: #1466c2;
    --blue-100: #e6effa;
    --yellow: #ffd200;
    --yellow-dark: #e0b600;
    --ink: #1d2733;
    --muted: #5b6878;
    --line: #dbe3ec;
    --bg: #f4f6f9;
    --white: #fff;
    --radius: 10px;
    --shadow: 0 6px 24px rgba(6, 42, 87, .12);
    --wrap: 1180px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--blue-700); }
a:hover { color: var(--blue-600); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 100;
    background: var(--yellow); color: var(--blue-900); padding: 8px 14px; border-radius: 6px; font-weight: 700;
}
.skip-link:focus { top: 8px; }

/* ---------- Topbar ---------- */
.topbar { background: var(--blue-900); font-size: .8125rem; }
.topbar__inner { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 16px; }
.topbar a { color: #c9d8ec; text-decoration: none; }
.topbar a:hover { color: var(--white); }
.topbar__links { list-style: none; display: flex; gap: 18px; margin: 0; padding: 0; }

/* ---------- Header ---------- */
.header {
    position: relative;
    background:
        radial-gradient(ellipse at 70% -20%, rgba(255,255,255,.22), transparent 60%),
        linear-gradient(180deg, var(--blue-600) 0%, var(--blue-700) 45%, var(--blue-800) 100%);
    color: var(--white);
    box-shadow: 0 2px 0 var(--yellow);
}
.header__inner { display: flex; align-items: center; gap: 24px; min-height: 120px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; padding: 10px 0; }
.brand__logo { width: 120px; height: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.brand__name {
    font-size: 1.9rem; font-weight: 800; line-height: 1.05; letter-spacing: -.01em;
    color: var(--yellow); text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.brand__name span { display: block; }

.mainnav { margin-left: auto; }
.mainnav__list { list-style: none; display: flex; margin: 0; padding: 0; }
.mainnav__item { position: relative; }
.mainnav__link {
    display: block; padding: 14px 16px; color: var(--white); text-decoration: none;
    font-weight: 700; font-size: .9rem; text-transform: uppercase; letter-spacing: .06em;
    border-radius: 6px;
}
.mainnav__link:hover, .mainnav__item.is-active > .mainnav__link { color: var(--yellow); }
.mainnav__item.is-active > .mainnav__link { box-shadow: inset 0 -3px 0 var(--yellow); border-radius: 0; }
.mainnav__sub {
    list-style: none; margin: 0; padding: 8px 0; position: absolute; left: 0; top: 100%; min-width: 260px; z-index: 50;
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(6px); transition: .18s ease;
}
.mainnav__sub a { display: block; padding: 8px 18px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.mainnav__sub a:hover, .mainnav__sub a[aria-current] { background: var(--blue-100); color: var(--blue-700); }
.mainnav__item:hover > .mainnav__sub,
.mainnav__item:focus-within > .mainnav__sub { opacity: 1; visibility: visible; transform: none; }
.mainnav__item:nth-last-child(-n+2) > .mainnav__sub { left: auto; right: 0; }
.mainnav__subtoggle { display: none; }

.nav-toggle {
    display: none; margin-left: auto; background: transparent; border: 2px solid rgba(255,255,255,.5);
    border-radius: 8px; width: 48px; height: 44px; padding: 10px; cursor: pointer;
}
.nav-toggle__bar { display: block; height: 3px; background: var(--white); border-radius: 2px; margin: 4px 0; transition: .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Page head ---------- */
.main { min-height: 50vh; }
.pagehead { padding: 28px 0 0; }
.pagehead__inner {
    background: linear-gradient(90deg, var(--blue-800), var(--blue-600));
    color: var(--white); border-radius: var(--radius); padding: 22px 28px; box-shadow: var(--shadow);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
    max-width: calc(var(--wrap) - 32px);
}
.pagehead__title { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.2; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; font-size: .85rem; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px; opacity: .7; }
.breadcrumb a { color: #d7e5f6; }
.breadcrumb [aria-current] { color: var(--yellow); }

/* ---------- Layout ---------- */
.layout { display: grid; gap: 32px; padding-top: 28px; padding-bottom: 56px; }
.layout--aside { grid-template-columns: minmax(0, 1fr) 280px; }
.layout__main {
    background: var(--white); border-radius: var(--radius); padding: 28px 32px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.layout__main:empty { display: none; }
.submenu ul { list-style: none; margin: 0; padding: 0; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.submenu li + li { border-top: 1px solid var(--line); }
.submenu a { display: block; padding: 11px 18px; text-decoration: none; color: var(--ink); font-size: .95rem; border-left: 4px solid transparent; }
.submenu a:hover { background: var(--blue-100); }
.submenu a.is-active { background: linear-gradient(90deg, var(--blue-700), var(--blue-600)); color: var(--white); border-left-color: var(--yellow); font-weight: 600; }
.layout__aside > * + * { margin-top: 24px; }

/* ---------- Content (fluid_styled_content) ---------- */
.content h1, .content h2, .content h3, .content h4 { color: var(--blue-800); line-height: 1.25; margin: 1.4em 0 .5em; }
.content > :first-child, .frame > :first-child, .ce-bodytext > :first-child { margin-top: 0; }
.content h2 { font-size: 1.45rem; }
.content h3 { font-size: 1.2rem; }
.content h4 { font-size: 1.05rem; }
.content p { margin: 0 0 1em; }
.content table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--blue-100); }
.content .contenttable { display: block; overflow-x: auto; }
.frame { margin-bottom: 2em; }
.frame:last-child { margin-bottom: 0; }
.ce-gallery img { border-radius: 6px; }
.ce-gallery figcaption, .news-detail figcaption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.ce-uploads { list-style: none; margin: 0; padding: 0; }
.ce-uploads li {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; margin: 0 0 6px;
    background: var(--bg); border: 1px solid var(--line);
}
.ce-uploads li:hover { border-color: var(--blue-600); }
.ce-uploads img { width: 28px; height: auto; flex: none; }
.ce-uploads-fileName { font-weight: 600; }
.ce-uploads span, .ce-uploads-description { display: block; }
.ce-uploads-filesize { font-size: .8rem; color: var(--muted); }
.ce-uploads a { text-decoration: none; word-break: break-word; }

.btn {
    display: inline-block; padding: 10px 18px; border-radius: 999px; font-weight: 700; text-decoration: none;
    background: var(--blue-700); color: var(--white); border: 0; cursor: pointer; font-size: .95rem;
}
.btn:hover { background: var(--blue-600); color: var(--white); }
.btn--yellow { background: var(--yellow); color: var(--blue-900); }
.btn--yellow:hover { background: var(--yellow-dark); color: var(--blue-900); }

/* ---------- Home: slider ---------- */
.home-hero { padding: 32px 0 8px; }
.slider { position: relative; }
.slide {
    display: grid; grid-template-columns: 1fr 1.15fr; gap: 0; overflow: hidden;
    background: linear-gradient(135deg, var(--blue-800), var(--blue-600)); color: var(--white);
    border-radius: 14px; box-shadow: var(--shadow); min-height: 360px;
}
.slide[hidden] { display: none; }
.slide__text { padding: 36px 40px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.slide__title { margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.85rem); line-height: 1.2; }
.slide__title a { color: var(--white); text-decoration: none; }
.slide__title a:hover { color: var(--yellow); }
.slide__teaser { margin: 0; color: #dce8f7; }
.slide__text .btn { align-self: flex-start; }
.slide__media { position: relative; background: var(--blue-900); }
.slide__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slide__placeholder { display: grid; place-items: center; height: 100%; }
.slide__placeholder img { width: 50%; height: auto; object-fit: contain; opacity: .5; }
.slider__controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }
.slider__dots { display: flex; gap: 8px; }
.slider__dot { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; background: #b8c6d8; cursor: pointer; }
.slider__dot[aria-current="true"] { background: var(--blue-700); transform: scale(1.25); }
.slider__btn {
    width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1;
    background: var(--white); color: var(--blue-700); box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.slider__btn:hover { background: var(--yellow); color: var(--blue-900); }

/* ---------- Home: teaser ---------- */
.home-teasers { padding: 24px 0 56px; }
.teasers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
.teaser__link { display: block; text-decoration: none; color: inherit; height: 100%; }
.teaser__media {
    aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--blue-100);
    box-shadow: 0 3px 10px rgba(0,0,0,.12); border: 4px solid var(--white);
}
.teaser__media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.teaser__link:hover .teaser__media img { transform: scale(1.06); }
.teaser__title {
    margin: 12px 0 2px; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-800);
}
.teaser__link:hover .teaser__title { color: var(--blue-600); }
.teaser__text { margin: 0; font-size: .9rem; color: var(--muted); }
.home-below { padding-bottom: 56px; }

/* ---------- News list / detail ---------- */
.news-item { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.news-item:first-child { padding-top: 0; }
.news-item__media img { border-radius: 8px; display: block; }
.news-item__date, .news-detail__meta { font-size: .85rem; color: var(--muted); }
.news-item__title { margin: 2px 0 6px !important; font-size: 1.15rem !important; }
.news-item__title a { text-decoration: none; }
.news-item p { margin: 0; }
.news-compact { list-style: none; margin: 0; padding: 0; }
.news-compact li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.news-compact time { display: block; font-size: .8rem; color: var(--muted); }
.news-detail__head { margin-bottom: 18px; }
.news-detail__title { margin: 0 0 4px !important; font-size: clamp(1.4rem, 3vw, 1.9rem) !important; }
.news-detail__image { float: right; margin: 0 0 16px 24px; max-width: 45%; }
.news-detail__image img { border-radius: 8px; display: block; }
.news-detail__text::after { content: ""; display: table; clear: both; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 24px 0; clear: both; }
.gallery__item { margin: 0; }
.gallery__item img { border-radius: 6px; display: block; }
.filelist ul { list-style: none; padding: 0; }
.filelist li { padding: 6px 0; }
.filelist__size { color: var(--muted); font-size: .85rem; margin-left: 8px; }
.news-detail__back { clear: both; margin-top: 32px; }
.no-news-found { color: var(--muted); font-style: italic; }
.news-list .page-navigation ul, .page-navigation ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 24px 0 0; }
.page-navigation a, .page-navigation li.current { display: inline-block; min-width: 36px; padding: 6px 10px; text-align: center; border-radius: 6px; background: var(--bg); text-decoration: none; }
.page-navigation li.current { background: var(--blue-700); color: var(--white); }

/* ---------- Forms (EXT:form) ---------- */
.content form { max-width: 640px; }
.form-group, .form-element { margin-bottom: 16px; }
.content label, .form-label { display: block; font-weight: 600; margin-bottom: 4px; }
.form-control, .content input[type="text"], .content input[type="email"], .content input[type="tel"], .content textarea, .content select {
    width: 100%; padding: 10px 12px; border: 1px solid #b9c6d6; border-radius: 8px; font: inherit; background: var(--white);
}
.form-control:focus { border-color: var(--blue-600); outline: 2px solid rgba(20,102,194,.25); }
.content .required { color: #c0392b; }
.content .help-block, .content .error, .invalid-feedback { color: #c0392b; font-size: .875rem; }
.content button[type="submit"], .content .btn-primary {
    padding: 11px 22px; border-radius: 999px; border: 0; background: var(--blue-700); color: var(--white); font-weight: 700; font: inherit; cursor: pointer;
}
.content button[type="submit"]:hover { background: var(--blue-600); }

/* ---------- Footer ---------- */
.footer { background: linear-gradient(180deg, var(--blue-800), var(--blue-900)); color: #c9d8ec; padding: 40px 0 24px; border-top: 4px solid var(--yellow); }
.footer__title { color: var(--white); font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 16px; }
.sponsors__list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 0 0 32px; padding: 0; }
.sponsors__link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%;
    background: var(--white); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); text-align: center;
    transition: transform .2s ease;
}
a.sponsors__link:hover { transform: translateY(-3px); color: var(--blue-700); }
.sponsors__logo { max-height: 70px; width: auto; }
.sponsors__name { font-size: .8rem; line-height: 1.3; color: var(--ink); }
a.sponsors__link:hover .sponsors__name { color: var(--blue-700); }
.footer__bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid rgba(255,255,255,.15); padding-top: 20px; font-size: .9rem; }
.footer a { color: var(--white); }
.footer__links { list-style: none; display: flex; gap: 18px; margin: 0; padding: 0; }
.to-top { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--yellow); color: var(--blue-900) !important; text-decoration: none; font-weight: 700; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(4, 18, 38, .92); display: grid; place-items: center; padding: 24px; }
.lb[hidden] { display: none; }
.lb img { max-width: 100%; max-height: 85vh; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb button { position: absolute; background: rgba(255,255,255,.12); color: var(--white); border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 1.6rem; cursor: pointer; }
.lb button:hover { background: var(--yellow); color: var(--blue-900); }
.lb__close { top: 16px; right: 16px; }
.lb__prev { left: 16px; top: 50%; }
.lb__next { right: 16px; top: 50%; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .teasers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mainnav__link { padding: 12px 10px; font-size: .82rem; }
}
@media (max-width: 960px) {
    .header__inner { min-height: 84px; }
    .brand__logo { width: 76px; }
    .brand__name { font-size: 1.35rem; }
    .nav-toggle { display: block; }
    .mainnav { flex-basis: 100%; display: none; padding-bottom: 12px; }
    .mainnav.is-open { display: block; }
    .mainnav__list { flex-direction: column; background: rgba(0,0,0,.15); border-radius: var(--radius); padding: 6px; }
    .mainnav__item { display: flex; flex-wrap: wrap; align-items: center; }
    .mainnav__link { flex: 1; font-size: .95rem; padding: 12px 14px; }
    .mainnav__item.is-active > .mainnav__link { box-shadow: none; }
    .mainnav__subtoggle {
        display: block; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; position: relative;
    }
    .mainnav__subtoggle::before {
        content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -7px 0 0 -5px;
        border-right: 2px solid var(--white); border-bottom: 2px solid var(--white); transform: rotate(45deg); transition: .2s;
    }
    .mainnav__subtoggle[aria-expanded="true"]::before { transform: rotate(-135deg); margin-top: -2px; }
    .mainnav__sub {
        position: static; flex-basis: 100%; opacity: 1; visibility: visible; transform: none; display: none;
        box-shadow: none; background: rgba(255,255,255,.08); margin: 0 6px 6px; min-width: 0;
    }
    .mainnav__sub.is-open { display: block; }
    .mainnav__sub a { color: #e6eef8; }
    .mainnav__sub a:hover, .mainnav__sub a[aria-current] { background: rgba(255,255,255,.12); color: var(--yellow); }
    .mainnav__item:hover > .mainnav__sub { display: none; }
    .mainnav__item > .mainnav__sub.is-open { display: block; }
    .layout--aside { grid-template-columns: 1fr; }
    .layout__aside { order: -1; }
    .submenu ul { display: flex; overflow-x: auto; scrollbar-width: thin; }
    .submenu li + li { border-top: 0; border-left: 1px solid var(--line); }
    .submenu a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
    .submenu a.is-active { border-bottom-color: var(--yellow); }
    .slide { grid-template-columns: 1fr; min-height: 0; }
    .slide__media { order: -1; aspect-ratio: 16 / 10; }
    .slide__text { padding: 24px; }
}
@media (max-width: 640px) {
    body { font-size: 1rem; }
    .topbar__home { display: none; }
    .topbar__inner { justify-content: flex-end; }
    .layout__main { padding: 20px 16px; }
    .pagehead__inner { padding: 18px 20px; }
    .teasers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .news-item { grid-template-columns: 1fr; }
    .news-detail__image { float: none; margin: 0 0 16px; max-width: 100%; }
    .footer__bottom { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
