/* Shared public theme. Component rules follow the order of the page. */
:root {
  color-scheme: light;
  --bg: #fff;
  --ink: #24211c;
  --muted: #625d54;
  --line: #e3ded4;
  --gold: #b58a2b;
  --accent-ink: #795914;
  --hover-bg: #f8f6f1;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --body: "EB Garamond", Georgia, "Times New Roman", serif;
  --maxw: 1180px;
  --prose: 760px;
  --pad: clamp(1rem, 4vw, 2.5rem);
  --radius: .35rem;
  --shadow: 0 1rem 3rem rgb(36 33 28 / 14%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.15rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.nav-open,
html:has(dialog[open]) {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-ink);
}

:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 4px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

p,
figcaption {
  overflow-wrap: anywhere;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  inset: .75rem auto auto .75rem;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  transform: translateY(calc(-100% - 1rem));
}

.skip-link:focus {
  transform: none;
  color: var(--bg);
}

/* Header and navigation */
.site-header {
  position: relative;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-block: 1rem;
}

.logo {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}

.logo img {
  width: auto;
  height: 54px;
}

.main-nav {
  flex: 1;
  min-width: 0;
}

.main-nav ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.75rem, 2.2vw, 2rem);
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.12rem;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
  white-space: nowrap;
  transition: text-decoration-color .2s, color .2s;
}

.main-nav a:hover,
.main-nav a.active {
  text-decoration-color: var(--gold);
}

.main-nav a[target="_blank"]::after {
  content: "↗";
  margin-left: .25em;
  color: var(--muted);
  font-size: .7em;
}

.social {
  display: inline-flex;
  flex: none;
}

.social a,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.social svg {
  width: 25px;
  height: 25px;
}

.nav-toggle {
  display: none;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  transition: transform .2s, background .2s;
}

.nav-toggle span {
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  position: absolute;
  inset: 0;
  content: "";
}

.nav-toggle span::before { transform: translateY(-6px); }
.nav-toggle span::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: rotate(-45deg); }

.nav-scrim {
  display: none;
}

/* Page foundations */
main {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
}

main:focus {
  outline: none;
}

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem);
  text-align: center;
}

.hero h1 {
  max-width: 26ch;
  margin: 0 auto .75rem;
  font-size: clamp(1.85rem, 4.4vw, 3rem);
}

.hero .subtitle {
  margin-bottom: clamp(2rem, 5vw, 3.2rem);
  color: var(--muted);
  font-size: clamp(1.15rem, 2.6vw, 1.65rem);
  font-weight: 500;
  text-wrap: balance;
}

.hero .crest {
  width: min(520px, 100%);
  margin-inline: auto;
}

.page {
  padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.25rem, 6vw, 4rem);
}

.lead {
  color: var(--muted);
  font-size: 1.2rem;
}

.prose {
  max-width: var(--prose);
  margin-inline: auto;
}

.prose h2 { margin: 2.2rem 0 .8rem; font-size: 1.7rem; }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.8rem 0 .6rem; font-size: 1.35rem; }
.prose p { margin-bottom: 1.1rem; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 600; }
.prose a { color: var(--accent-ink); }

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--hover-bg);
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.btn-line,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .6rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 1.05rem;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition: background .2s, color .2s;
}

.btn-line {
  background: var(--bg);
  color: var(--ink);
}

.btn-primary,
.btn-line:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary { padding-inline: 2rem; }
.btn-primary:hover { background: var(--accent-ink); color: var(--bg); }

/* Calendar: retain the month/list choices at every screen size. */
.cal,
.calendar-status,
.cal-downloads {
  max-width: 980px;
  margin-inline: auto;
}

.calendar-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--hover-bg);
}

.calendar-status[data-state="error"] {
  border-left: 3px solid var(--accent-ink);
}

.fc {
  font-family: var(--body);
  --fc-border-color: var(--line);
  --fc-page-bg-color: var(--bg);
  --fc-neutral-bg-color: var(--hover-bg);
  --fc-today-bg-color: rgb(181 138 43 / 12%);
  --fc-event-bg-color: var(--accent-ink);
  --fc-event-border-color: var(--accent-ink);
  --fc-event-text-color: #fff;
  --fc-button-bg-color: var(--ink);
  --fc-button-border-color: var(--ink);
  --fc-button-hover-bg-color: var(--accent-ink);
  --fc-button-hover-border-color: var(--accent-ink);
  --fc-button-active-bg-color: var(--accent-ink);
  --fc-button-active-border-color: var(--accent-ink);
  --fc-list-event-hover-bg-color: var(--hover-bg);
}

.fc .fc-toolbar {
  flex-wrap: wrap;
  gap: .75rem;
}

.fc .fc-toolbar-title {
  color: var(--accent-ink);
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
}

.fc .fc-col-header-cell-cushion {
  color: var(--accent-ink);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
}

.fc .fc-daygrid-day-number {
  color: var(--ink);
  text-decoration: none;
}

.fc-day-today .fc-daygrid-day-number {
  color: var(--accent-ink);
  font-weight: 700;
}

.fc .fc-button {
  min-height: 44px;
  padding: .4rem .75rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
}

.fc .fc-button:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 3px;
  box-shadow: none;
}

.fc .fc-list-event-title a { color: var(--ink); text-decoration: none; }
.fc .fc-list-event-time {
  color: var(--muted);
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}
.fc .fc-list-day-text,
.fc .fc-list-day-side-text { color: var(--accent-ink); }
.fc .fc-list-event:hover td { background: var(--hover-bg); }
.fc .fc-event { cursor: pointer; }
.fc .fc-list-event-title,
.fc .fc-daygrid-event .fc-event-title {
  white-space: normal;
  overflow-wrap: anywhere;
}

.fc .fc-daygrid-block-event .fc-event-main-frame { display: block; }
.fc .fc-daygrid-event .fc-event-time { white-space: nowrap; }
.fc .fc-daygrid-event .fc-event-title { hyphens: auto; }

.cal-downloads {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.cal-downloads h2 { margin-bottom: 1rem; font-size: 1.4rem; }
.cal-downloads .links { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Native dialogs supply focus containment and an inert background. */
dialog::backdrop {
  background: rgb(24 22 18 / 65%);
}

.event-modal {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.event-modal-card {
  position: relative;
  padding: clamp(1.25rem, 5vw, 2.4rem);
}

.event-modal-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
}

.event-modal-close:hover { background: var(--hover-bg); color: var(--ink); }
.event-modal-title { margin-bottom: 1rem; padding-right: 2rem; font-size: 1.6rem; }
.event-modal-when { margin-bottom: .75rem; color: var(--muted); font-size: 1.05rem; }
.event-modal-location { margin-bottom: .75rem; }
.event-modal-location::before { content: "Ort: "; font-weight: 600; }
.event-modal-desc { color: var(--muted); white-space: pre-line; }

/* Galleries */
.gallery-section {
  margin: 0 auto clamp(2.5rem, 6vw, 4rem);
}

.gallery-section > h2 {
  margin-bottom: .75rem;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  text-align: center;
}

.gallery-section > .desc {
  max-width: var(--prose);
  margin: 0 auto 1.6rem;
  color: var(--muted);
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
}

.gallery-grid figure {
  min-width: 0;
  cursor: pointer;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--hover-bg);
  object-fit: contain;
}

.gallery-grid figcaption {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .98rem;
  font-style: italic;
  text-align: center;
}

.semester-cover { min-width: 0; }
.cover-pdf-link { position: relative; display: block; }
.cover-pdf-link::after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 50%);
  color: #fff;
  content: "PDF öffnen";
  opacity: 0;
  transition: opacity .2s;
}
.cover-pdf-link:hover::after,
.cover-pdf-link:focus-visible::after { opacity: 1; }

/* Two visible columns of two photos; the slider advances one column. */
.chronik-section {
  display: grid;
  grid-template-columns: minmax(240px, 1.15fr) minmax(0, 2fr);
  align-items: start;
  column-gap: clamp(1.25rem, 3vw, 2.25rem);
}

.chronik-section > h2 { grid-column: 1 / -1; margin-bottom: 1.4rem; }
.chronik-section .semester-cover { grid-column: 1; }
.chronik-section .semester-cover img { width: 100%; border: 1px solid var(--line); }
.chronik-section .semester-cover .placeholder { aspect-ratio: 1 / 1.4; }
.chronik-section .semester-photos { grid-column: 2; min-width: 0; }

.chronik-section .gallery-grid {
  position: relative;
  grid-template-columns: none;
  grid-template-rows: minmax(0, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 1rem) / 2);
  height: clamp(22rem, 45vw, 34rem);
  padding-block: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.chronik-section .gallery-grid::-webkit-scrollbar { display: none; }
.chronik-section .gallery-grid.slider-controlled { scroll-snap-type: none; }

.chronik-section .gallery-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  min-width: 0;
  min-height: 0;
  scroll-snap-align: start;
}

.chronik-section .gallery-grid figure {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chronik-section .gallery-grid figure:focus-visible { outline-offset: -3px; }
.chronik-section .gallery-grid img { flex: 1; min-height: 0; height: 0; }
.chronik-section .gallery-grid figcaption {
  flex: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gallery-navigation { display: flex; align-items: center; }
.gallery-navigation :disabled { opacity: .4; cursor: default; }
.gallery-position {
  --slider-thumb: #948c7e;
  flex: 1;
  min-width: 0;
  /* Keep a comfortable touch target around the understated rail. */
  height: 44px;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}
.gallery-position:hover,
.gallery-position:focus-visible { --slider-thumb: var(--accent-ink); }
.gallery-position:focus-visible { outline: none; }
.gallery-position::-webkit-slider-runnable-track { height: 2px; border-radius: 1px; background: var(--line); }
.gallery-position::-moz-range-track { height: 2px; border-radius: 1px; background: var(--line); }
.gallery-position::-webkit-slider-thumb {
  width: var(--gallery-thumb-width, 100%);
  height: 4px;
  margin-top: -1px;
  appearance: none;
  border: 0;
  border-radius: 2px;
  background: var(--slider-thumb);
}
.gallery-position::-moz-range-thumb {
  width: var(--gallery-thumb-width, 100%);
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--slider-thumb);
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: 4rem 3.5rem 1rem;
  border: 0;
  background: rgb(24 22 18 / 96%);
  color: #fff;
  overscroll-behavior: contain;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox figure { width: min(100%, 1100px); max-height: 100%; overflow: auto; text-align: center; }
.lightbox img { width: auto; max-height: calc(100dvh - 10rem); margin-inline: auto; object-fit: contain; }
.lightbox figcaption { margin-top: 1rem; color: #eee8dd; font-size: 1.1rem; }
.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}
.lightbox button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.lightbox button:hover { background: rgb(255 255 255 / 12%); }
.lightbox :focus-visible { outline-color: #fff; }
.lightbox .close { top: .75rem; right: .75rem; }
.lightbox .previous,
.lightbox .next { top: 50%; transform: translateY(-50%); }
.lightbox .previous { left: .25rem; }
.lightbox .next { right: .25rem; }
.lightbox-status { position: absolute; top: 1rem; left: 1rem; color: #eee8dd; }

/* About: keep the existing sections and reading order. */
.about-hero { border-bottom: 1px solid var(--line); }
.about-hero .hero-img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; }

.about-section,
.value-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--pad);
  border-bottom: 1px solid var(--line);
}
.about-section { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
.about-section h1,
.about-section h2 { margin-bottom: 1rem; font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
.about-section p { max-width: 54ch; margin-bottom: .85rem; color: var(--muted); }
.about-section p:last-child { margin-bottom: 0; }
.about-section p em { color: var(--ink); }
.about-section a { color: var(--accent-ink); }
.about-section .section-img { aspect-ratio: 4 / 3; }

.about-dark {
  padding: clamp(3.5rem, 9vw, 6rem) var(--pad);
  background: var(--ink);
  color: #eee8dd;
  text-align: center;
}
.about-dark .motto {
  margin-bottom: 1.1rem;
  color: #d9b760;
  font-family: var(--display);
  font-size: clamp(1.8rem, 5.5vw, 3.8rem);
  font-weight: 700;
  text-wrap: balance;
}
.about-dark .motto-desc { max-width: 50ch; margin-inline: auto; color: #d3cdc2; }
.value-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.value-card { text-align: center; }
.value-icon { display: block; margin-bottom: .9rem; color: var(--accent-ink); font-size: 1.5rem; line-height: 1; }
.value-card h2 { margin-bottom: .6rem; font-size: 1.2rem; }
.value-card p { max-width: 28ch; margin-inline: auto; color: var(--muted); font-size: 1.05rem; }
.about-cta { padding: clamp(3.5rem, 9vw, 6rem) var(--pad); background: var(--hover-bg); text-align: center; }
.about-cta h2 { margin-bottom: .8rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.about-cta p { max-width: 46ch; margin: 0 auto 2rem; color: var(--muted); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem 1rem;
  margin-top: 3rem;
  padding: 1.5rem var(--pad);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.05rem;
  text-align: center;
}
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer .sep { color: var(--line); }

/* Match the navigation breakpoint in js/main.js. */
@media (max-width: 60rem) {
  .site-header .bar { flex-wrap: wrap; gap: .75rem; }
  .social { margin-left: auto; }
  .main-nav { flex-basis: 100%; order: 3; }
  .main-nav ul { flex-wrap: wrap; gap: .25rem 1.25rem; }
  .nav-ready .nav-toggle { display: inline-flex; }
  .nav-ready .main-nav {
    position: absolute;
    top: 100%;
    right: var(--pad);
    width: min(22rem, calc(100% - 2 * var(--pad)));
    max-height: calc(100dvh - 6.5rem);
    padding: .75rem 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow);
  }
  .nav-ready .main-nav ul { display: block; }
  .nav-ready .main-nav a { display: flex; padding-block: .65rem; white-space: normal; }
  .nav-scrim.open { position: fixed; inset: 0; z-index: 20; display: block; background: rgb(24 22 18 / 45%); }
}

@media (max-width: 50rem) {
  .chronik-section { grid-template-columns: minmax(0, 1fr); row-gap: 1.4rem; }
  .chronik-section > h2 { grid-column: 1; margin-bottom: 0; }
  .chronik-section .semester-cover { width: min(100%, 420px); margin-inline: auto; }
  .chronik-section .semester-photos { grid-column: 1; }
  .chronik-section .gallery-grid { height: clamp(20rem, 80vw, 34rem); }
}

@media (max-width: 42.5rem) {
  .about-section,
  .value-grid { grid-template-columns: minmax(0, 1fr); }
  .value-card p { max-width: 42ch; }
  .about-hero .hero-img { aspect-ratio: 4 / 3; }
  .fc .fc-toolbar { justify-content: center; }
  .fc .fc-toolbar-chunk:nth-child(2) { flex-basis: 100%; order: -1; text-align: center; }
  .fc .fc-button {
    min-height: 36px;
    padding: .25rem .45rem;
    font-size: .9rem;
    line-height: 1.25;
  }
  .fc .fc-button .fc-icon { font-size: 1.1rem; }
  .fc .fc-button-group > .fc-button { min-width: 36px; }
  .fc .fc-daygrid-event { font-size: .8rem; }
  .fc .fc-list-event td { padding: .6rem .35rem; }
  .fc .fc-list-event-time { font-size: .95rem; }
  .fc .fc-list-day-cushion { display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
  .fc .fc-list-day-side-text { margin-left: auto; }
}

@media (max-width: 25rem) {
  .site-footer { flex-direction: column; gap: 0; }
  .site-footer .sep { display: none; }
  .cal-downloads .links > a { width: 100%; }
  .lightbox { padding-inline: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
