/* Reading preferences enhance a layout that also works without JavaScript. */
html { font-size: 100%; }
html[data-text-size="125"] { font-size: 125%; }
html[data-text-size="150"] { font-size: 150%; }
html[data-text-size="200"] { font-size: 200%; }
body { overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.15; }
button, .button, .chip { max-width: 100%; height: auto; padding-block: .65em; white-space: normal; text-align: center; }
.text-link { white-space: normal; }
.icon { flex-shrink: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
:is(input:not([type="checkbox"]), select, textarea) { border-color: var(--ink-2); }
/* Two contrasting rings stay visible on both light and dark surfaces. */
body :focus-visible { outline: 3px solid #111; outline-offset: 3px; box-shadow: 0 0 0 3px #fff; }
:is(a, button, input, select, summary, [tabindex]) { scroll-margin-block: 24px; }
.skip { position: fixed; top: 0; transform: translateY(-150%); max-width: calc(100% - 24px); }
.skip:focus { top: 12px; transform: none; color: #111; }

.topline .wrap { flex-wrap: wrap; gap: 4px 20px; padding-block: 4px; font-size: .875rem; }
.topline span:last-of-type { opacity: 1; }
.accessibility-trigger { min-height: 44px; padding: 6px 12px; border: 1px solid currentColor; background: transparent; color: inherit; font-size: .875rem; letter-spacing: normal; text-transform: none; }
.accessibility-trigger:hover { background: var(--avorio); color: var(--oliva); }
.accessibility-trigger span { font-size: 1.1em; font-weight: 700; }
.header .wrap, .header nav { flex-wrap: wrap; }
.header nav > a:not(.button) { min-height: 44px; display: inline-flex; align-items: center; padding-block: 8px; }
.header .brand { flex-shrink: 0; }
.footer-bottom :is(a, button) { min-height: 44px; display: inline-flex; align-items: center; }
.footer-grid h2, .footer-grid address, .credits, .join .eyebrow { opacity: 1; }
main p a:not(.button), dialog p a { text-decoration: underline; text-underline-offset: .18em; }
.member-contacts dd a { text-decoration-color: currentColor; }
.chip[aria-current="true"], .directory-switch button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: .2em; }

/* In-flow consent never covers content or keyboard focus, even at high zoom. */
.cookie-banner { position: static; margin: 16px auto; width: calc(100% - 40px); max-width: 1184px; box-shadow: none; flex-wrap: wrap; }
.cookie-banner > div { min-width: 0; }
.cookie-actions { flex-wrap: wrap; flex-shrink: 1; }
dialog { width: min(42rem, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); overflow-y: auto; padding: clamp(16px, 4vw, 32px); }
dialog h2 { font-size: 1.75rem; line-height: 1.2; }
dialog .check { align-items: flex-start; }
.check input { flex: 0 0 1.25rem; width: 1.25rem; height: 1.25rem; margin-top: .2em; }
.accessibility-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.accessibility-heading h2 { flex: 1 1 12rem; margin: 0; }
.accessibility-heading button { flex: 0 0 auto; }
.reading-size-label { display: block; font-weight: 600; margin-bottom: 8px; }
#reading-size { display: block; width: 100%; min-height: 48px; padding: .65em; margin-bottom: 16px; border: 2px solid var(--ink-2); border-radius: 4px; background: var(--carta); color: var(--ink); font-size: 1rem; }
#reading-status:empty { display: none; }
#accessibility .small-print { font-size: .875rem; }

.directory-page .dir-search { flex-wrap: wrap; }
.dir-search-label { flex-basis: 100%; font-size: 1rem; font-weight: 600; }
.directory-page .dir-search input[type="search"] { height: auto; min-height: 54px; padding-block: .65em; border-color: var(--ink-2); }
.directory-page .dir-chips, .directory-page .dir-letters { flex-wrap: wrap; overflow: visible; gap: 8px; }
.directory-page .dir-chips .chip { flex: 0 1 auto; min-height: 44px; border-color: var(--ink-2); }
.directory-page .dir-letters a { min-width: 44px; min-height: 44px; }
.directory-page .dir-letters .off { opacity: 1; color: var(--ink-2); text-decoration: line-through; }
.directory-page .spotlight-intro { flex-wrap: wrap; }
.directory-page .map-aside .arch-panel { overflow: visible; }
.directory-page .map-heading .map-list-return { position: static; margin-bottom: 8px; }
.directory-page[data-directory-view="map"] .map-heading h2 { padding-right: 0; }
.range { flex-wrap: wrap; }
.event-row .where { display: block; }
.category-card p { display: block; }
.directory-page .leaflet-control-zoom a { min-width: 44px; min-height: 44px; line-height: 44px; }
.directory-page .leaflet-container a.leaflet-popup-close-button { width: 44px; height: 44px; font-size: 1.5rem; line-height: 44px; color: #111; }
.directory-page .leaflet-popup-content { margin-top: 44px; }
.directory-page .leaflet-control-attribution { font-size: .875rem; color: #111; background: #fff; }
.directory-page .leaflet-control-attribution a { color: #174659; text-decoration: underline; }

/* High contrast retains recognisable brand accents with stronger text/borders. */
html[data-contrast="high"] { --avorio: #fff; --carta: #fff; --pietra: #f0f0f0; --ink: #111; --ink-2: #333; --rosso: #9c1015; --oliva: #161e16; --linea: #666; --linea-2: #666; }
@media (prefers-contrast: more) {
  html:not([data-contrast="standard"]) { --avorio: #fff; --carta: #fff; --pietra: #f0f0f0; --ink: #111; --ink-2: #333; --rosso: #9c1015; --oliva: #161e16; --linea: #666; --linea-2: #666; }
}
html[data-links="underlined"] a:not(.brand), html[data-links="underlined"] a :is(strong, h3) { text-decoration: underline; text-underline-offset: .18em; }

/* Extra reading space when a visitor chooses large type on a wide screen. */
html:is([data-text-size="150"], [data-text-size="200"]) :is(.hero, .grid-2, .grid-3, .grid-4, .project-intro, .events-intro, .partners-intro, .partner-entry, .collaborate-panel, .detail-grid, .transparency-beneficiary, .dir-layout, .spotlight, .spotlight-grid, .join .inner, .footer-grid, .home-news.is-empty) { grid-template-columns: minmax(0, 1fr); }
html:is([data-text-size="150"], [data-text-size="200"]) .member-profile { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'intro' 'contacts' 'art'; }
html:is([data-text-size="150"], [data-text-size="200"]) :is(.map-aside, .info-card) { position: static; }
html:is([data-text-size="150"], [data-text-size="200"]) .member-contacts dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
html:is([data-text-size="150"], [data-text-size="200"]) .dir-head { flex-wrap: wrap; }
html:is([data-text-size="150"], [data-text-size="200"]) .dir-total { width: auto; }
html:is([data-text-size="150"], [data-text-size="200"]) .header nav { gap: 12px 24px; }

@media (max-width: 1100px) {
  .event-row .where { grid-column: 2; }
}
@media (max-width: 900px) {
  .topline .wrap { justify-content: space-between; }
  .topline span:nth-child(2) { display: none; }
  .topline .wrap > span:first-child { flex: 1 1 10rem; }
  .menu-toggle { display: none; }
  .js .menu-toggle { display: inline-flex; }
  .header nav { display: flex; }
  .js .header nav { display: none; }
  .js .header nav.open { display: flex; }
}
@media (max-width: 540px) {
  .home-page .grid-4, .member-grid { grid-template-columns: minmax(0, 1fr); }
  .member-contacts dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .home-page .hero h1 { font-size: clamp(2.5rem, 11vw, 3.875rem); }
  .event-row { grid-template-columns: minmax(0, 1fr); }
  .event-row .where { grid-column: 1; }
  .date { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .directory-switch { flex-wrap: wrap; border-radius: 12px; }
  .directory-switch button { flex-basis: 5rem; }
  .dir-search button { flex-grow: 1; }
  .directory-page #map-consent { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  body :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
  .chip, button, .button, .member-pin > span, .carpi-cluster { border: 2px solid ButtonText; }
  .chip[aria-current="true"], .directory-switch button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: 2px; }
}
