/* Self-hosted variable fonts (latin subset). One file per family/style covers all weights. */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/Cinzel-normal-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/CormorantGaramond-normal-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/CormorantGaramond-italic-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/EBGaramond-normal-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/EBGaramond-italic-400-latin.woff2) format('woff2');
}

:root {
  --paper: #fefdfc;       /* warmes Weiß, wie heller Kalkstein-Putz (halbe Wärme) */
  --paper-deep: #f5f3ee;
  --card: #ffffff;
  --ink: #2a2521;
  --ink-soft: #433b34;
  --ink-faint: #6e6458;
  --roof: #9a4630;        /* Dachziegel */
  --patina: #3d6e5f;      /* Kupferpatina */
  --gold: #a88a55;        /* Haarlinien, Goldleiste */
  --gold-text: #8a6b35;   /* Gold, dunkel genug für Schrift */
  --rule: #e6dece;
  --serif-display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --serif-text: "EB Garamond", Garamond, "Times New Roman", serif;
  --caps: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; touch-action: manipulation; } /* kein Doppeltipp-Zoom, Pinch-Zoom bleibt */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: clamp(17px, 1.05rem + 0.2vw, 20px);
  line-height: 1.65;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--roof); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--patina); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.nw { white-space: nowrap; }
.rev { unicode-bidi: bidi-override; direction: rtl; } /* shows the reversed e-mail fallback the right way round */
.center { text-align: center; }
.mt { margin-top: 14px; }
.mt-l { margin-top: 28px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- Header: one bar that morphs from "full" (top) to "compact" (scrolled) ---------- */
.header-slot { height: 77px; position: relative; z-index: 40; } /* keeps the full height reserved, so nothing below jumps */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: rgba(254, 253, 252, 0.96);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.35s ease, background-color 0.35s ease;
}
.site-header.compact {
  background: rgba(254, 253, 252, 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(10px); backdrop-filter: saturate(1.2) blur(10px);
  box-shadow: 0 8px 24px -18px rgba(60, 40, 20, 0.45);
}
.bar-inner {
  display: flex; align-items: center; gap: 16px 24px; min-height: 76px;
  transition: min-height 0.35s ease;
}
.compact .bar-inner { min-height: 62px; }
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.brand img { width: 34px; height: 34px; flex: none; transition: width 0.35s ease, height 0.35s ease; }
.compact .brand img { width: 30px; height: 30px; }
.brand > span { min-width: 0; }
.brand span { font-family: var(--caps); font-weight: 600; letter-spacing: 0.16em; font-size: 0.86rem; text-transform: uppercase; line-height: 1.3; }
.brand small {
  display: block; font-family: var(--serif-display); font-style: italic; letter-spacing: 0; text-transform: none;
  font-size: 0.95rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 1.6em; transition: max-height 0.35s ease, opacity 0.25s ease;
}
.nav { display: flex; gap: clamp(14px, 2.4vw, 32px); align-items: center; max-width: 640px; overflow: hidden;
  transition: max-width 0.4s ease, opacity 0.25s ease, visibility 0s linear 0s; }
.nav a {
  font-family: var(--caps); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; white-space: nowrap;
}
.nav a:hover { border-bottom-color: var(--gold); }
.compact .nav { max-width: 0; opacity: 0; visibility: hidden; transition: max-width 0.4s ease, opacity 0.2s ease, visibility 0s linear 0.4s; }
.head-actions { display: flex; align-items: center; flex: none; }
.head-actions .lang {
  font-family: var(--caps); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--roof); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent;
}
.head-actions .lang:hover { border-bottom-color: var(--gold); }
.head-actions .burger { max-width: 0; opacity: 0; visibility: hidden; margin-left: 0; border-width: 0;
  transition: max-width 0.4s ease, opacity 0.3s ease 0.1s, margin 0.4s ease, visibility 0s linear 0.4s; }
.compact .head-actions .burger { max-width: 44px; opacity: 1; visibility: visible; margin-left: clamp(10px, 2vw, 18px); border-width: 1px;
  transition: max-width 0.4s ease, opacity 0.3s ease 0.1s, margin 0.4s ease, visibility 0s; }

/* Burger */
.burger {
  width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0; cursor: pointer;
  background: transparent; border: 1px solid var(--rule); color: var(--ink); border-radius: 0;
  transition: border-color 0.2s, background 0.2s;
}
.burger:hover { border-color: var(--gold); }
.burger-lines { position: relative; width: 20px; height: 12px; display: block; }
.burger-lines i {
  position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease;
}
.burger-lines i:nth-child(1) { top: 0; }
.burger-lines i:nth-child(2) { top: 5.25px; }
.burger-lines i:nth-child(3) { top: 10.5px; }
.burger[aria-expanded="true"] .burger-lines i:nth-child(1) { top: 5.25px; transform: rotate(45deg); }
.burger[aria-expanded="true"] .burger-lines i:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] .burger-lines i:nth-child(3) { top: 5.25px; transform: rotate(-45deg); }

/* Menu panel */
.menu {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--paper); border-bottom: 1px solid var(--gold);
  box-shadow: 0 24px 40px -28px rgba(60, 40, 20, 0.4);
  visibility: hidden; opacity: 0; transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
.site-header.open .menu { visibility: visible; opacity: 1; transform: none; transition: opacity 0.25s ease, transform 0.25s ease; }
.menu ul { list-style: none; margin: 0; padding: 18px 0 26px; display: flex; flex-direction: column; align-items: flex-end; }
.menu li + li { border-top: 1px solid var(--rule); }
.menu li { width: min(340px, 100%); }
.menu a {
  display: block; padding: 14px 4px; text-align: right; text-decoration: none; color: var(--ink);
  font-family: var(--serif-display); font-size: 1.6rem; line-height: 1.2;
}
.menu a:hover { color: var(--roof); }
@media (prefers-reduced-motion: reduce) {
  .menu, .site-header.open .menu, .burger-lines i, .site-header, .bar-inner, .brand img, .brand small, .nav, .head-actions .burger { transition: none !important; }
}

/* ---------- Ornaments ---------- */
.kicker {
  font-family: var(--caps); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-text); margin: 0 0 18px;
}
.ornament {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--gold); margin: 0 auto; max-width: 320px;
}
.ornament::before, .ornament::after { content: ""; flex: 1; height: 0; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); padding-top: 2px; opacity: 0.75; }
.ornament svg { width: 14px; height: 14px; flex: none; }

h1, h2, h3 { font-family: var(--serif-display); font-weight: 400; line-height: 1.08; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2.6rem, 1.6rem + 4.2vw, 5.2rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.4rem); }
h3 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); }
h1 em, h2 em { font-style: italic; color: var(--roof); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(48px, 8vw, 104px) 0 clamp(32px, 5vw, 56px); }
.hero .lede {
  max-width: 680px; margin: 26px auto 0; font-size: 1.12em; color: var(--ink-soft);
}
.hero .ornament { margin-top: 34px; }

/* ---------- The map, framed ---------- */
.map-stage { padding-bottom: clamp(48px, 7vw, 96px); }
.frame {
  margin: 0;
  background: var(--card);
  padding: clamp(10px, 2.2vw, 28px);
  border: 1px solid var(--rule);
  box-shadow:
    0 0 0 6px var(--paper),
    0 0 0 7px var(--gold),
    0 30px 60px -30px rgba(60, 40, 20, 0.35);
}
.map-button {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative;
}
.map-button img { width: 100%; }
.map-button .hint {
  position: absolute; right: 14px; bottom: 14px;
  background: rgba(42, 37, 33, 0.82); color: var(--paper);
  font-family: var(--caps); font-weight: 600; font-size: 0.76rem; letter-spacing: 0.15em; text-transform: uppercase;
  padding: 10px 16px; display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.2s;
}
.map-button:hover .hint { background: var(--roof); }
.map-button .hint svg { width: 14px; height: 14px; }
.cap-2 { white-space: nowrap; }
@media (max-width: 490px) {
  .hero-kicker .cap-sep { display: none; }
  .hero-kicker .cap-2 { display: block; }
}
@media (max-width: 560px) {
  .frame .cap-sep { display: none; }
  .frame .cap-2 { display: block; }
}
.frame figcaption {
  text-align: center; padding-top: 16px; font-style: italic; color: var(--ink-soft); font-size: 0.95em;
}

/* ---------- Sections ---------- */
section, [id] { scroll-margin-top: 84px; }
.section { padding: clamp(56px, 8vw, 112px) 0; border-top: 1px solid var(--rule); }
.section-head { text-align: center; max-width: 760px; margin: 0 auto clamp(36px, 5vw, 64px); }
.section-head p { color: var(--ink-soft); margin: 20px auto 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); }
.prose h3 { margin-bottom: 12px; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }

.facts {
  list-style: none; margin: clamp(40px, 6vw, 72px) 0 0; padding: 28px 0;
  border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center;
}
.facts strong {
  display: block; font-family: var(--serif-display); font-weight: 500;
  font-size: clamp(1.7rem, 1.2rem + 1.4vw, 2.5rem); line-height: 1.1; color: var(--roof);
  font-variant-numeric: lining-nums;
}
.facts span { font-family: var(--caps); font-weight: 600; font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- Details gallery ---------- */
.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2vw, 24px); list-style: none; margin: 0; padding: 0; }
.details button {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; color: inherit; font: inherit;
}
.details .pic, .details picture { display: block; }
.details .pic { overflow: hidden; border: 1px solid var(--rule); background: var(--card); aspect-ratio: 4 / 3; }
.details img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.details button:hover img { transform: scale(1.045); }
.details .name {
  display: block; padding-top: 10px; font-family: var(--caps); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink);
}
.details button:hover .name { color: var(--roof); }

/* ---------- History ---------- */
.authors { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(36px, 6vw, 88px); }
.author header { display: flex; gap: 22px; align-items: flex-end; margin-bottom: 24px; }
.author .portrait {
  width: 118px; flex: none; background: var(--card); padding: 6px; border: 1px solid var(--rule);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--gold);
}
.author .role { font-family: var(--caps); font-weight: 600; font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 6px; }
.author .dates { margin: 8px 0 0; font-style: italic; color: var(--ink-soft); font-size: 0.95em; }
.author p { margin: 0 0 1em; }
.author header + p::first-letter {
  font-family: var(--serif-display); float: left; font-size: 3.6em; line-height: 0.82; padding: 6px 10px 0 0; color: var(--roof);
}

.wall { margin: clamp(56px, 8vw, 104px) 0 0; }
.wall img { width: 100%; border: 1px solid var(--rule); }
.wall figcaption { text-align: center; font-style: italic; color: var(--ink-soft); padding-top: 14px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: clamp(56px, 7vw, 80px) 0 clamp(56px, 7vw, 72px); text-align: center; color: var(--ink-soft); font-size: 0.92em; }
.site-footer .ornament { margin-bottom: 36px; }
.site-footer .copy { letter-spacing: 0.02em; }
.site-footer nav { display: flex; justify-content: center; gap: 12px 40px; flex-wrap: wrap; margin-top: 28px; }
.site-footer nav a { font-family: var(--caps); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-soft); text-decoration: none; padding: 8px 2px; border-bottom: 1px solid transparent; }
.site-footer nav a:hover { border-bottom-color: var(--gold); }
.site-footer nav a:hover { color: var(--roof); }

/* ---------- Impressum ---------- */
.legal { max-width: 720px; margin: 0 auto; padding: clamp(48px, 8vw, 96px) 0; }
.legal h1 { font-size: clamp(2.4rem, 1.8rem + 2.4vw, 3.6rem); text-align: center; }
.legal .ornament { margin-top: 24px; }
.legal h2 { font-size: 1.6rem; margin: 2.2em 0 0.5em; }
.legal p { margin: 0 0 1em; }
.legal .card { background: var(--card); border: 1px solid var(--rule); padding: 26px 30px; margin-top: 36px; }
.legal .card p { margin: 0; }

/* ---------- 404 ---------- */
.lost {
  display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: clamp(36px, 6vw, 88px); align-items: center;
  max-width: 1040px; margin: 0 auto; padding: clamp(56px, 9vw, 120px) 0;
}
.lost-art { margin: 0; background: var(--card); padding: clamp(10px, 1.6vw, 18px); border: 1px solid var(--rule);
  box-shadow: 0 0 0 6px var(--paper), 0 0 0 7px var(--gold), 0 30px 60px -30px rgba(60, 40, 20, 0.35);
  transform: rotate(-1.2deg); }
.lost-art img { width: 100%; }
.lost-text h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 4.2rem); }
.lost-de { font-family: var(--serif-display); font-style: italic; font-size: 1.35em; color: var(--ink-soft); margin: 14px 0 26px; }
.lost-text .ornament { margin: 0 0 26px; max-width: 220px; }
.lost-text p { margin: 0 0 0.8em; }
.lost-soft { color: var(--ink-soft); }
.lost-links { list-style: none; padding: 0; margin: 28px 0 0; display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; flex-direction: column; gap: 2px; padding: 14px 22px; min-width: 190px;
  border: 1px solid var(--gold); color: var(--ink); text-decoration: none; background: var(--card);
  font-family: var(--serif-display); font-size: 1.35rem; line-height: 1.15; transition: background 0.2s, color 0.2s;
}
.btn span { font-family: var(--caps); font-weight: 600; font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--gold-text); }
.btn:hover { background: var(--roof); border-color: var(--roof); color: #fff; }
.btn:hover span { color: rgba(255, 255, 255, 0.85); }
@media (max-width: 720px) {
  .lost { grid-template-columns: 1fr; text-align: center; padding-top: 40px; }
  .lost-art { max-width: 240px; margin: 0 auto; }
  .lost-text .ornament { margin: 0 auto 26px; }
  .lost-links { justify-content: center; }
}

/* ---------- Viewers (map + details) ---------- */
dialog.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #1d1a17; color: #f6f1e7; overflow: hidden;
}
dialog.viewer::backdrop { background: rgba(20, 17, 14, 0.9); }
.viewer .stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.viewer .stage.dragging { cursor: grabbing; }
.viewer .stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.viewer .bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(20, 17, 14, 0.85));
  pointer-events: none;
}
.viewer .bar > * { pointer-events: auto; }
.viewer .caption { font-family: var(--caps); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; padding: 0 12px; text-align: center; }
.vbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(246, 241, 231, 0.35);
  background: rgba(29, 26, 23, 0.7); color: #f6f1e7; display: inline-grid; place-items: center; cursor: pointer;
}
.vbtn:hover { background: var(--roof); border-color: var(--roof); }
.vbtn svg { width: 18px; height: 18px; }
.viewer .close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 2; }
.lightbox .bar { align-items: flex-end; }
.lightbox .caption { flex: 0 0 min(440px, calc(100vw - 150px)); line-height: 1.5; min-height: 3em; display: flex; align-items: center; justify-content: center; }
.lightbox .stage { cursor: default; display: grid; place-items: center; padding: 56px 16px 88px; }
.lightbox .stage img { position: static; max-width: min(1200px, 100%); max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); width: auto; height: auto; object-fit: contain; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .facts { grid-template-columns: repeat(2, 1fr); row-gap: 28px; }
  .details { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .two-col, .authors { grid-template-columns: 1fr; }
  .menu ul { align-items: stretch; }
  .menu li { width: 100%; }
  .menu a { text-align: left; font-size: 1.5rem; }
  .map-button .hint { right: 8px; bottom: 8px; padding: 7px 10px; }
}
@media (max-width: 560px) {
  /* Top state: brand + language on the first row, the links centred on a second row */
  .header-slot { height: 125px; }
  .bar-inner { flex-wrap: wrap; row-gap: 0; padding-top: 10px; padding-bottom: 6px; }
  .brand > span { letter-spacing: 0.13em; white-space: nowrap; }
  .nav { order: 3; flex-basis: 100%; justify-content: center; max-width: none; max-height: 48px; padding-top: 6px;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.25s ease, visibility 0s; }
  .compact .nav { flex-basis: 0; max-width: 0; max-height: 0; padding-top: 0; }
  .compact .bar-inner { min-height: 58px; padding-top: 0; padding-bottom: 0; flex-wrap: nowrap; }
  .compact .brand small { max-height: 0; opacity: 0; }
  section, [id] { scroll-margin-top: 72px; }
}
@media (max-width: 365px) {
  .brand { gap: 8px; }
  .brand > span { font-size: 0.78rem; letter-spacing: 0.1em; }
  .compact .head-actions .burger { margin-left: 10px; }
  .head-actions .lang { font-size: 0.72rem; letter-spacing: 0.1em; }
  .bar-inner { column-gap: 12px; }
  .brand small { display: none; }
}
@media (max-width: 420px) {
  .details { grid-template-columns: 1fr; }
  .author header { flex-direction: column; align-items: flex-start; }
}

@media print {
  .site-header { position: static; }
  .header-slot { height: auto; }
  .head-actions, .menu, .nav, .map-button .hint, dialog { display: none !important; }
  body { background: #fff; }
}
