:root {
    --ink: #132534;
    --muted: #587080;
    --surface: #ffffff;
    --surface-alt: #f3f7f8;
    --line: #d8e1e5;
    --brand: #124d72;
    --brand-strong: #0a3653;
    --accent: #d59b35;
    --on-brand: #ffffff;
    --shadow: 0 18px 40px rgba(19, 37, 52, .12);
}

body[data-theme="archivio"] {
    --ink: #1d4743;
    --muted: #5c7973;
    --surface-alt: #f8f4eb;
    --line: #d4ddd5;
    --brand: #2e8179;
    --brand-strong: #23675f;
    --accent: #e2aa67;
    --shadow: 0 18px 40px rgba(29, 71, 67, .11);
}

body[data-theme="aurora"] {
    --ink: #4a2b13;
    --muted: #76593b;
    --surface-alt: #fff5e8;
    --line: #edcfac;
    --brand: #a94d16;
    --brand-strong: #7f3510;
    --accent: #edb34d;
    --shadow: 0 18px 40px rgba(74, 43, 19, .11);
}

html { scroll-behavior: smooth; }
body {
    background: var(--surface);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}
a { color: var(--brand); }
a:hover, a:focus { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip-link { background: var(--brand-strong); color: var(--on-brand); left: 1rem; padding: .7rem 1rem; position: fixed; top: -5rem; z-index: 100; }
.skip-link:focus { color: var(--on-brand); top: 1rem; }

.site-header { background: var(--surface); border-top: 5px solid var(--brand); box-shadow: 0 2px 12px rgba(19, 37, 52, .06); position: relative; z-index: 10; }
.site-header__top { align-items: center; display: flex; gap: 1.5rem; justify-content: space-between; min-height: 98px; padding-left: 0; padding-right: 0; }
.site-header__top::before, .site-header__top::after { content: none; display: none; }
.site-brand { display: inline-flex; max-width: 410px; }
.site-brand img { height: auto; max-width: 100%; }
.site-actions { align-items: center; display: flex; gap: 1rem; }
.site-search .navbar-form { margin: 0; padding: 0; }
.site-search .form-control { border: 1px solid var(--line); border-radius: 0; box-shadow: none; font-size: .9rem; height: 38px; }
.site-search .btn { background: var(--brand); border: 1px solid var(--brand); border-radius: 0; color: var(--on-brand); height: 38px; }
.menu-toggle { background: transparent; border: 1px solid var(--brand); color: var(--brand); display: none; font-weight: bold; min-height: 44px; padding: .55rem .75rem; }
.site-nav { background: var(--brand); border-top: 0; }
.site-nav .navbar-collapse { display: block; padding: 0; }
.site-nav .navbar-nav { display: flex; float: none; justify-content: space-between; margin: 0; }
.site-nav .navbar-nav > li { flex: 0 0 auto; padding: 0; position: relative; text-align: center; }
.site-nav .navbar-nav > li > a { color: var(--on-brand); display: block; font-size: 1rem; font-weight: bold; letter-spacing: .045em; line-height: 1.3; margin: 0; padding: 1.2rem .65rem; text-transform: uppercase; white-space: nowrap; }
.site-nav .navbar-nav > li > a:hover, .site-nav .navbar-nav > li.active > a { background: var(--brand-strong); box-shadow: inset 0 -4px 0 var(--accent); color: var(--on-brand); text-decoration: none; }
.site-nav .dropdown-menu { background: var(--surface); border: 1px solid var(--line); border-radius: 0; box-shadow: var(--shadow); min-width: 220px; padding: .5rem 0; }
.site-nav .dropdown-menu a { color: var(--ink); padding: .65rem 1rem; text-align: left; text-transform: none; }
.site-nav .dropdown-menu a:hover { background: var(--surface-alt); color: var(--brand-strong); }

.theme-switcher { align-items: center; display: flex; gap: .25rem; }
.theme-switcher__label { color: var(--muted); font-size: .72rem; font-weight: bold; letter-spacing: .05em; margin-right: .25rem; text-transform: uppercase; }
.theme-switcher button { background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: .74rem; min-height: 32px; padding: .25rem .45rem; }
.theme-switcher button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.site-main { min-height: 50vh; }
.site-page__breadcrumb { background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.site-page__title { background: var(--surface); border-bottom: 1px solid var(--line); padding: 1.5rem 0; }
.site-page__title h1, .site-page__title h2 { color: var(--brand-strong); font-size: clamp(1.65rem, 3vw, 2.35rem); margin: 0; }
.site-page__content { padding: 3rem 0 4rem; }
.site-page__content .row { margin-bottom: 0; }
.site-page__sidebar { margin-bottom: 2rem; }
.site-page__sidebar .tree { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 0; border-top: 4px solid var(--accent); box-shadow: none; padding: .45rem 1rem; }
.site-page__sidebar .nav-list > li > a { border-bottom: 1px solid var(--line); color: var(--ink); font-size: .78rem; padding: .5rem .2rem; }
.site-page__sidebar .nav-list > li.active > a { color: var(--brand); font-weight: bold; }
.secondary-menu-panel { background: var(--surface-alt); border: 1px solid var(--line); border-top: 4px solid var(--accent); list-style: none; margin: 0; padding: .45rem 1rem; }
.secondary-menu-panel li { margin: 0; }
.secondary-menu-panel li a { border-bottom: 1px solid var(--line); color: var(--ink); display: block; font-size: 1.30rem; padding: .6rem .2rem; }
.secondary-menu-panel li:last-child a { border-bottom: 0; }
.secondary-menu-panel li.active a, #secondary-menu.secondary-menu-panel li.active a { background: var(--brand); color: var(--on-brand); margin: 0 -.65rem; padding-left: .85rem; padding-right: .85rem; }
.secondary-menu-panel .divider-vertical { display: none; }
.richtext-content { font-size: 1.4rem; line-height: 1.78; max-width: 760px; }
.richtext-content h2, .richtext-content h3, .richtext-content h4 { color: var(--brand-strong); line-height: 1.2; margin-top: 2.2rem; }
.richtext-content h2 { font-size: 1.8rem; }
.richtext-content h3 { font-size: 1.35rem; }
.richtext-content p, .richtext-content li { max-width: 70ch; }
.richtext-content a { font-weight: bold; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.richtext-content table { border-collapse: collapse; display: block; margin: 1.5rem 0; max-width: 100%; overflow-x: auto; }
.richtext-content td, .richtext-content th { border: 1px solid var(--line); padding: .65rem; vertical-align: top; }
.richtext-content th { background: var(--surface-alt); color: var(--brand-strong); }
.contact-map { aspect-ratio: 16 / 8; margin-bottom: 2rem; width: 100%; }
.contact-map iframe { border: 0; height: 100%; width: 100%; }
.institute-finder { background: var(--surface-alt); border: 1px solid var(--line); margin: 0 0 2rem; padding: 1.25rem; }
.institute-finder h2 { color: var(--brand-strong); font-size: 1.25rem; margin: 0 0 .5rem; }
.institute-finder__map { display: block; height: auto; margin: 1.25rem auto; max-width: 184px; }
.institute-finder__regions { columns: 2; list-style: none; margin: 0; padding: 0; }
.institute-finder__regions li { break-inside: avoid; margin-bottom: .35rem; }

.homepage-hero { background: linear-gradient(90deg, var(--brand-strong) 0%, var(--brand) 50%, #fff 100%); color: var(--on-brand); overflow: hidden; position: relative; }
.homepage-hero::after { background: radial-gradient(circle, rgba(255,255,255,.17) 0, rgba(255,255,255,0) 66%); content: ""; height: 620px; position: absolute; right: -220px; top: -290px; width: 620px; z-index: 0; }
.homepage-hero__illustration { height: auto; opacity: .01; pointer-events: none; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: min(30.537vw, 563.32px); z-index: 1; }
.homepage-hero__inner { padding: clamp(4rem, 9vw, 7.5rem) 0; position: relative; z-index: 2; }
.homepage-hero__anniversary { height: auto; position: absolute; right: calc(100% + clamp(2rem, 5vw, 6rem)); top: 50%; transform: translateY(-50%); width: 260px; }
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: bold; letter-spacing: .13em; margin: 0 0 1rem; text-transform: uppercase; }
.homepage-hero .eyebrow { font-size: .95rem; }
.homepage-hero h1 { color: var(--on-brand); font-size: clamp(2.3rem, 5vw, 4.4rem); letter-spacing: -.04em; line-height: 1.02; margin: 0; max-width: 900px; }
.homepage-hero__lead { font-size: clamp(1.1rem, 2vw, 1.35rem); line-height: 1.55; margin: 1.5rem 0 2rem; max-width: 700px; }
.action-group { display: flex; flex-wrap: wrap; gap: .75rem; }
.button-primary, .button-secondary { align-items: center; display: inline-flex; font-size: 1.05rem; font-weight: bold; justify-content: center; min-height: 46px; padding: .65rem 1rem; text-decoration: none; }
.button-primary { background: var(--accent); color: #1a1a1a; }
.button-primary:hover, .button-primary:focus { background: #efbb5b; color: #1a1a1a; }
.button-secondary { background: var(--accent); border: 1px solid var(--accent); color: #1a1a1a; }
.button-secondary:hover, .button-secondary:focus { background: #efbb5b; color: #1a1a1a; }

.homepage-section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.homepage-section--soft { background: var(--surface-alt); }
.section-heading { display: grid; gap: .75rem; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); margin-bottom: 2rem; }
.section-heading h2 { color: var(--brand-strong); font-size: clamp(1.8rem, 3vw, 2.7rem); letter-spacing: -.025em; margin: 0; }
.section-heading p { color: var(--muted); margin: .4rem 0 0; }
.audience-grid, .service-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.audience-card, .service-card { background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 250px; padding: clamp(1.5rem, 3vw, 2.4rem); position: relative; transition: box-shadow .2s ease, transform .2s ease; }
.audience-card:hover, .audience-card:focus-within, .service-card:hover, .service-card:focus-within { box-shadow: var(--shadow); transform: translateY(-3px); }
.audience-card__number { color: var(--accent); font-size: .8rem; font-weight: bold; letter-spacing: .1em; text-transform: uppercase; }
.audience-card__image { height: 240px; margin-top: 1rem; object-fit: cover; width: 100%; }
.audience-card h3, .service-card h3 { color: var(--brand-strong); font-size: 1.45rem; line-height: 1.18; margin: 1rem 0 .75rem; }
.audience-card p, .service-card p { color: var(--muted); margin: 0 0 1.5rem; }
.card-link { font-weight: bold; margin-top: auto; text-decoration: none; }
.card-link::after { content: " ->"; }
.resource-card-list { display: grid; gap: .75rem; margin-top: auto; padding-top: .5rem; }
.resource-card { align-items: center; background: var(--surface-alt); border: 1px solid var(--line); color: var(--brand-strong); display: flex; font-weight: bold; gap: .9rem; min-height: 64px; padding: .8rem 1rem; text-decoration: none; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.resource-card:hover, .resource-card:focus { background: var(--surface); border-color: var(--brand); color: var(--brand-strong); transform: translateX(3px); }
.resource-card img { height: 32px; max-width: 100px; object-fit: contain; width: auto; }
.resource-card span::after { content: " ->"; }
.service-card { min-height: 210px; }
.service-card__tag { color: var(--brand); font-size: .75rem; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; }
.directory-panel { align-items: center; background: var(--brand-strong); color: var(--on-brand); display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr; padding: clamp(2rem, 5vw, 4rem); }
.directory-panel h2 { color: var(--on-brand); font-size: clamp(1.7rem, 3vw, 2.5rem); margin: 0 0 .75rem; }
.directory-panel p { color: rgba(255,255,255,.82); margin: 0; }
.directory-panel__action { justify-self: end; }
.home-notice { border-left: 4px solid var(--accent); color: var(--muted); margin: 1.5rem 0 0; padding-left: 1rem; }

.site-footer { background: var(--ink); color: rgba(255,255,255,.78); padding: 3.5rem 0 1.25rem; }
.site-footer a { color: var(--on-brand); }
.site-footer h2 { color: var(--on-brand); font-size: 1.15rem; margin: 0 0 .8rem; }
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: 1.2fr 1fr 1fr; }
.site-footer__grid p { margin: 0; }
.site-footer .nav-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer .nav-footer li { margin-bottom: .3rem; }
.site-footer__bottom { border-top: 1px solid rgba(255,255,255,.2); font-size: .85rem; margin-top: 2.5rem; padding-top: 1.25rem; }

@media (max-width: 767px) {
    .site-header__top { min-height: 76px; padding-left: 20px; padding-right: 20px; }
    .homepage-hero__inner { padding-left: 1px; padding-right: 1px; }
    .homepage-hero__anniversary { right: calc(100% + 1.5rem); width: 180px; }
    .homepage-hero__illustration { opacity: .18; right: 0; width: 447.525px; }
    .site-brand { max-width: 205px; }
    .site-search { display: none; }
    .menu-toggle { display: inline-flex; }
    .site-nav { display: none; }
    .site-nav.is-open { display: block; }
    .site-nav .navbar-nav { display: block; }
    .site-nav .navbar-nav > li { text-align: left; }
    .site-nav .navbar-nav > li > a { border-top: 1px solid rgba(255,255,255,.2); padding: .95rem 0; }
    .site-nav .dropdown-menu { box-shadow: none; display: block; float: none; position: static; width: 100%; }
    .theme-switcher__label { display: none; }
    .theme-switcher button { font-size: .68rem; padding: .2rem .3rem; }
    .section-heading, .directory-panel, .site-footer__grid { grid-template-columns: 1fr; }
    .directory-panel__action { justify-self: start; }
}

@media (max-width: 560px) {
    .audience-grid, .service-grid { grid-template-columns: 1fr; }
    .homepage-hero__inner { padding-left: 1.25rem; padding-right: 1.25rem; }
    .homepage-hero__anniversary { display: none; }
    .homepage-hero__illustration { right: 0; width: 400.14px; }
    .institute-finder__regions { columns: 1; }
}
