/* Two shared areas: name, area switch and a flat menu; compact rows on small screens. */
.aef-two-areas #page-container { padding-top: 0 !important; overflow: visible; }
.aef-two-areas #main-header.aef-area-header { position: sticky !important; top: 0 !important; width: 100%; border-bottom: 1px solid var(--aef-linie); background: var(--aef-kalkputz-hell); box-shadow: none; z-index: 999; }
.admin-bar.aef-two-areas #main-header.aef-area-header { top: 32px !important; }

/* Two rows: name and area switch, then the menu of the current area. One row would
   not fit the longer history menu next to the switch. */
.aef-header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand switch" "nav nav";
  gap: .1rem 1.5rem;
  align-items: center;
  padding-top: .8rem;
}

.aef-site-brand { grid-area: brand; display: flex; align-items: center; gap: .8rem; color: var(--aef-tintenholz); text-decoration: none; }
.aef-site-brand img { width: 43px; height: 58px; object-fit: contain; }
.aef-site-brand:hover .aef-brand-name { text-decoration: underline; text-underline-offset: .2em; }
.aef-brand-title { display: flex; flex-direction: column; line-height: 1.15; }
.aef-brand-name { font-family: var(--aef-serif); font-size: 1.05rem; font-weight: 700; }
.aef-brand-name > span { display: block; }
.aef-brand-place { margin-top: .15rem; color: var(--aef-salbeigrau-text); font-family: var(--aef-sans); font-size: .82rem; }

#aef-area-navigation { grid-area: nav; justify-self: start; }
.aef-area-menu { display: flex; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.aef-area-menu a { display: flex; align-items: center; min-height: 48px; color: var(--aef-tintenholz); font-size: .95rem; font-weight: 700; line-height: 1.4; text-decoration: none; white-space: nowrap; }
.aef-area-menu a:hover { text-decoration: underline; text-decoration-thickness: .12em; text-underline-offset: .4em; }
/* Sub menu: opens on hover and keyboard focus, so it works without script; Escape closes it (areas.js). */
.aef-area-menu > li { position: relative; }
.aef-area-menu .sub-menu { display: none; position: absolute; top: 100%; left: -1rem; z-index: 1000; min-width: 17rem; margin: 0; padding: .35rem 0; list-style: none; border: 1px solid var(--aef-linie); background: var(--aef-kalkputz-hell); box-shadow: var(--aef-schatten); }
.aef-area-menu li:is(:hover, :focus-within):not(.aef-submenu-closed) > .sub-menu { display: block; }
.aef-area-menu .sub-menu a { min-height: 44px; padding-inline: 1rem; font-weight: 400; }
.aef-area-menu .sub-menu .current-menu-item > a { font-weight: 700; }
.aef-area-menu .current-menu-item > a,
.aef-area-menu .current-menu-ancestor > a { color: var(--aef-ziegelrot); text-decoration: underline; text-decoration-thickness: .16em; text-underline-offset: .4em; }

.aef-area-switch { grid-area: switch; display: flex; border: 1px solid var(--aef-linie); }
.aef-area-switch a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem .75rem; color: var(--aef-tintenholz); font-size: .85rem; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; white-space: nowrap; }
.aef-area-switch a + a { border-left: 1px solid var(--aef-linie); }
.aef-area-switch a:hover { text-decoration: underline; text-underline-offset: .25em; }
.aef-area-switch a[aria-current] { background: var(--aef-ziegelrot); color: #fff; }

.aef-menu-toggle { grid-area: toggle; display: none; min-width: 44px; min-height: 44px; padding: .5rem .9rem; border: 1px solid var(--aef-linie); background: transparent; color: var(--aef-ziegelrot); cursor: pointer; font: inherit; font-weight: 700; }
.aef-menu-toggle::after { content: ""; display: inline-block; width: .9rem; height: .6rem; margin-left: .55rem; border-block: 2px solid currentColor; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; vertical-align: -.05rem; }
.aef-menu-toggle[aria-expanded="true"]::after { height: 0; border-bottom: 0; background: none; }
.aef-area-header [hidden] { display: none !important; }

.aef-breadcrumb { padding-block: .75rem 0; }
.aef-breadcrumb ol { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; font-size: .875rem; line-height: 1.5; }
.aef-breadcrumb li + li::before { content: "/"; margin-right: .5rem; color: var(--aef-salbeigrau-text); }
.aef-two-areas :where(a, button, input, select, textarea, [tabindex]) { scroll-margin-top: 10rem; }

/* History area: the book page opens on the historical map. */
.aef-ofb-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(20rem, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
#main-content .aef-ofb-hero h1 { max-width: 16ch; font-size: clamp(2.2rem, 3.6vw, 3.2rem); }
.aef-ofb-hero__cover { margin: 0; }
.aef-ofb-hero__cover img { display: block; width: 100%; height: auto; box-shadow: 0 1rem 2.5rem rgb(32 36 33 / 22%); }
.aef-ofb-hero__cover figcaption { margin-top: .6rem; color: var(--aef-salbeigrau-text); font-size: .85rem; line-height: 1.5; }
.aef-history-hero-section { background: linear-gradient(rgb(243 240 231 / 35%), rgb(243 240 231 / 35%)), url("../images/karte-band.webp") center / cover no-repeat, var(--aef-kalkputz) !important; }
.aef-history-hero-section .aef-ofb-hero__copy { padding: clamp(1.25rem, 3vw, 2rem); background: var(--aef-kalkputz-hell); }

.aef-empty-state { padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px dashed var(--aef-salbeigrau-text); background: var(--aef-kalkputz-hell); }
.aef-empty-state h2 { margin-top: 0; }

@media (max-width: 81.25rem) {
  .aef-two-areas #main-header.aef-area-header { position: relative !important; top: 0 !important; }
  .admin-bar.aef-two-areas #main-header.aef-area-header { top: 0 !important; }
  .aef-two-areas :where(a, button, input, select, textarea, [tabindex]) { scroll-margin-top: 1rem; }
  .aef-ofb-hero { grid-template-columns: 1fr; }
}

/* Small screens: name and menu button, the area switch as two tabs, a collapsible menu. */
@media (max-width: 48rem) {
  .aef-header-bar {
    grid-template-areas: "brand toggle" "nav nav" "switch switch";
    gap: 0 1rem;
    padding-block: .6rem;
  }
  /* Margins instead of row gaps, so the collapsed menu row takes no space. */
  #aef-area-navigation, .aef-area-switch { margin-top: .6rem; }
  .aef-enhanced .aef-menu-toggle { display: inline-flex; align-items: center; }
  #aef-area-navigation { justify-self: stretch; }
  .aef-area-menu { display: block; border-top: 1px solid var(--aef-linie); }
  .aef-area-menu li { border-bottom: 1px solid var(--aef-linie); }
  .aef-area-menu a { padding-inline: .25rem; }
  /* In the opened phone menu the sub items stay visible, indented under their main item. */
  .aef-area-menu .sub-menu { display: block; position: static; min-width: 0; padding: 0 0 0 1rem; border: 0; background: none; box-shadow: none; }
  .aef-area-menu .sub-menu li:last-child { border-bottom: 0; }
  .aef-area-switch a { flex: 1 1 50%; }
}

@media (max-width: 34rem) {
  .aef-site-brand img { width: 32px; height: 43px; }
  /* Visually shorten the name; screen readers still hear the full name. */
  .aef-brand-prefix, .aef-brand-place { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .aef-brand-name { font-size: 1rem; }
  .aef-area-switch a { padding-inline: .4rem; font-size: .8rem; white-space: normal; }
}
