/* --------------------------------------------------------------------------
   Fondamenta e variabili comuni
   -------------------------------------------------------------------------- */
:root {
    --ink: #17252b;
    --muted: #62727a;
    --line: #dce7e9;
    --surface: #ffffff;
    --page: #f5f8f8;
    --shadow: 0 14px 38px rgba(17, 41, 45, .08);
}

.portal-theme--ecm {
    --brand: #127580;
    --brand-dark: #0e5c64;
    --brand-soft: rgba(18, 117, 128, .11);
}

.portal-theme--fad {
    --brand: #e15844;
    --brand-dark: #af3f2e;
    --brand-soft: rgba(225, 88, 68, .11);
}

.portal-theme--congressi {
    --brand: #21579c;
    --brand-dark: #183f72;
    --brand-soft: rgba(33, 87, 156, .11);
}

.portal-theme--ecmgratis {
    --brand: #4d9642;
    --brand-dark: #37772f;
    --brand-soft: rgba(77, 150, 66, .11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* --------------------------------------------------------------------------
   Header e navigazione
   -------------------------------------------------------------------------- */
.site-header { position: relative; z-index: 2; background: #fff; border-bottom: 1px solid var(--line); }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1200px; margin: 0 auto; padding: 14px 24px; }
.site-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--brand-dark); }
.site-brand__icon { flex: 0 0 auto; width: 36px; height: 36px; object-fit: contain; }
.site-brand__name { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.site-brand__sub { display: block; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-nav a { padding: 9px 12px; border-radius: 8px; color: #3c5157; font-size: 14px; font-weight: 700; }
.site-nav a:hover, .site-nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.site-nav__cta { background: var(--brand); color: #fff !important; }
.site-nav__cta:hover { background: var(--brand-dark) !important; color: #fff !important; }

/* --------------------------------------------------------------------------
   Layout, titoli e hero
   -------------------------------------------------------------------------- */
.page-shell { max-width: 1200px; margin: 0 auto; padding: 38px 24px 64px; }
.page-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .45fr); align-items: center; gap: 34px; margin-bottom: 36px; padding: 42px; border-radius: 24px; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; box-shadow: var(--shadow); }
.page-hero--compact { margin-bottom: 28px; padding: 28px 34px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 13px; color: inherit; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .86; }
.eyebrow::before { width: 28px; height: 2px; background: currentColor; content: ''; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(32px, 4vw, 50px); line-height: 1.08; letter-spacing: -.045em; }
h2 { font-size: clamp(24px, 3vw, 32px); line-height: 1.16; letter-spacing: -.03em; }
h3 { font-size: 18px; line-height: 1.28; letter-spacing: -.02em; }
.page-hero p { max-width: 650px; margin-bottom: 0; color: rgba(255, 255, 255, .86); font-size: 17px; }
.page-hero__art { display: flex; align-items: center; justify-content: center; }
.page-hero__art img { width: min(240px, 100%); filter: brightness(0) invert(1); opacity: .92; }
.content-section { margin-top: 46px; }
.content-section__heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.content-section__heading h2 { margin-bottom: 5px; }
.content-section__heading p { margin-bottom: 0; color: var(--muted); }
.text-link { color: var(--brand-dark); font-size: 14px; font-weight: 800; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Tassonomia pubblica: breadcrumb, hub, categorie e A-Z
   -------------------------------------------------------------------------- */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { color: var(--brand-dark); font-weight: 700; }
.breadcrumbs a:hover { text-decoration: underline; }
.taxonomy-hero__subtitle { max-width: 720px; margin: 0; color: rgba(255, 255, 255, .9); font-size: clamp(20px, 2.6vw, 28px); line-height: 1.3; letter-spacing: -.02em; }
.taxonomy-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.taxonomy-category-card { padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 16px; background: #fff; }
.taxonomy-category-card h3 { margin-bottom: 8px; }
.taxonomy-category-card h3 a:hover { color: var(--brand-dark); }
.taxonomy-category-card p { margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.taxonomy-category-card ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.taxonomy-category-card li a { color: var(--brand-dark); font-size: 14px; font-weight: 700; }
.taxonomy-category-card li a:hover { text-decoration: underline; }
.taxonomy-term-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin: 0; padding: 0; list-style: none; }
.taxonomy-term-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.taxonomy-term-list a { color: #2c454d; font-size: 15px; font-weight: 800; }
.taxonomy-term-list a:hover { color: var(--brand-dark); text-decoration: underline; }
.taxonomy-term-list span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.vocabulary-introduction { max-width: 850px; }
.vocabulary-introduction p { color: var(--muted); font-size: 17px; }
.vocabulary-related { display: grid; gap: 20px; }
.vocabulary-related > h2 { margin-bottom: 0; }
.vocabulary-related__group h3 { margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   Card evento e tassonomie
   -------------------------------------------------------------------------- */
.events-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.event-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 20px rgba(17, 41, 45, .04); }
.event-card__body { display: flex; flex: 1; flex-direction: column; padding: 23px; }
.event-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 13px; font-weight: 700; }
.event-card__type { display: inline-flex; align-items: center; gap: 7px; color: var(--brand-dark); }
.event-card__type::before { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); content: ''; }
.event-card h3 { margin-bottom: 12px; font-size: 21px; }
.event-card h3 a:hover { color: var(--brand-dark); }
.event-card__excerpt { color: var(--muted); font-size: 14px; }
.event-card__facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 18px; }
.fact-chip, .taxonomy-chip { display: inline-flex; align-items: center; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1.2; }
.fact-chip { padding: 7px 10px; background: #f1f5f5; color: #41565c; }
.taxonomy-chip { padding: 7px 11px; background: var(--brand-soft); color: var(--brand-dark); }
.event-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 23px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.event-card__footer a { color: var(--brand-dark); font-weight: 800; }
.event-card__footer a:hover { text-decoration: underline; }
.taxonomy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.taxonomy-panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.taxonomy-panel__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 17px; font-weight: 800; }
.taxonomy-panel__count { color: var(--brand-dark); font-size: 12px; font-weight: 800; }
.taxonomy-panel ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.taxonomy-panel li { color: var(--muted); font-size: 14px; }
.taxonomy-panel li a:hover { color: var(--brand-dark); text-decoration: underline; }
.taxonomy-panel li small { display: block; color: #91a0a5; font-size: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud a { padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #3b5056; font-size: 14px; font-weight: 700; }
.tag-cloud a:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.tag-cloud span { color: #8da0a5; font-size: 12px; }

/* --------------------------------------------------------------------------
   Listing e filtri
   -------------------------------------------------------------------------- */
.listing-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 26px; }
.filter-panel { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.filter-panel h2 { margin-bottom: 6px; font-size: 21px; }
.filter-panel p { color: var(--muted); font-size: 14px; }
.filter-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.filter-group h3 { margin-bottom: 10px; font-size: 14px; letter-spacing: .07em; text-transform: uppercase; }
.filter-group a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; color: #4e6268; font-size: 14px; }
.filter-group a:hover { color: var(--brand-dark); }
.listing-results { display: grid; gap: 16px; }
.listing-results__top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.listing-results__top p { margin: 0; color: var(--muted); }
.listing-card { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 22px; padding: 23px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.listing-card h2 { margin: 8px 0 10px; font-size: 23px; }
.listing-card h2 a:hover { color: var(--brand-dark); }
.listing-card p { margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.listing-card__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.listing-card__side { padding-left: 22px; border-left: 1px solid var(--line); }
.listing-card__side dl { display: grid; gap: 12px; margin: 0; }
.listing-card__side dt { margin: 0 0 2px; color: #829298; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.listing-card__side dd { margin: 0; color: #33494f; font-size: 14px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Dettaglio evento e sidebar metadati
   -------------------------------------------------------------------------- */
.event-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 26px; }
.event-content, .event-sidebar__panel { border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.event-content { padding: 34px; }
.event-content__title { margin-bottom: 18px; font-size: clamp(31px, 4vw, 46px); }
.event-intro { margin-bottom: 22px; color: #55676d; font-size: 18px; line-height: 1.65; }
.event-content__body { color: #3f5258; line-height: 1.75; }
.event-section { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--line); }
.event-section h2 { margin-bottom: 15px; font-size: 23px; }
.event-sidebar { display: grid; gap: 16px; }
.event-sidebar__panel { padding: 22px; }
.event-sidebar__panel h2 { margin-bottom: 15px; font-size: 20px; }
.details-list { display: grid; gap: 12px; margin: 0; }
.details-list div { padding-bottom: 12px; border-bottom: 1px solid #edf1f2; }
.details-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.details-list dt { margin-bottom: 3px; color: #829298; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.details-list dd { margin: 0; color: #33494f; font-size: 15px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { margin-top: 54px; background: var(--brand-dark); color: #d8e5e6; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; max-width: 1200px; margin: 0 auto; padding: 30px 24px; font-size: 13px; }
.site-footer strong { color: #fff; }
.site-footer a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .site-header__bar { padding: 12px 16px; }
    .site-nav { gap: 2px; }
    .site-nav a { padding: 8px 9px; font-size: 13px; }
    .page-shell { padding: 24px 16px 42px; }
    .page-hero, .event-layout, .listing-layout { grid-template-columns: 1fr; }
    .page-hero { gap: 18px; padding: 30px 24px; }
    .page-hero__art { display: none; }
    .events-grid, .taxonomy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .taxonomy-category-grid, .taxonomy-term-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-panel { display: none; }
    .listing-card { grid-template-columns: 1fr; }
    .listing-card__side { padding: 16px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 620px) {
    .site-header__bar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .events-grid, .taxonomy-grid { grid-template-columns: 1fr; }
    .taxonomy-category-grid, .taxonomy-term-list { grid-template-columns: 1fr; }
    .content-section { margin-top: 34px; }
    .content-section__heading { flex-direction: column; align-items: flex-start; gap: 8px; }
    .event-content { padding: 24px 20px; }
    .listing-card { padding: 20px; }
    .listing-card h2 { font-size: 21px; }
}
