/* Shared tokens, typography, navigation and footer. Component styles live separately. */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial'), local('Helvetica'), local('Liberation Sans');
  size-adjust: 107.12%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
}

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

:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #2C2C2C;
  --color-text-muted: #595959;
  --color-border: #E5E5E0;
  --color-accent: #5B2C6F;
  --color-accent-light: #7D3C98;
  --color-gold: #8B6914;  /* darkened for WCAG AA contrast (4.6:1 on white) */
  --color-surface-alt: #F8F7F4;
  --color-surface-hover: #F0EDE8;
  --color-shadow: rgba(0,0,0,0.1);
  --font-body: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: 'EB Garamond', Georgia, "Times New Roman", serif;
  --max-width: 1200px;
  --nav-height: 56px;

  /* Liturgical colors — single source of truth */
  --lit-white: #C8A24E;        /* gold for visibility on light bg */
  --lit-white-icon: #987323;   /* small symbols need contrast against the page */
  --lit-red: #C62828;
  --lit-green: #2E7D32;
  --lit-violet: #5B2C6F;
  --lit-black: #212121;
  --lit-rose: #D81B60;
  --lit-white-text: #3D2B00;   /* dark text on gold banner (7:1 contrast) */
  --lit-black-text: #9E968E;   /* text on black-feast banner (dark) */
}

/* ── Sakraler Dark Mode ──
   Warm, dignified palette inspired by candlelit parchment.
   Not pitch-black — rather a deep warm tone evocative of old missals. */
[data-theme="dark"] {
  --color-bg: #1E1A17;
  --color-surface: #272320;
  --color-text: #E4DDD4;
  --color-text-muted: #B0A797;
  --color-border: #3A342E;
  --color-accent: #B58DCD;
  --color-accent-light: #BF9AD4;
  --color-gold: #C8A84E;
  --color-surface-alt: #2D2824;
  --color-surface-hover: #352F2A;
  --color-shadow: rgba(0,0,0,0.45);

  /* Liturgical colors — dark mode */
  --lit-white: #F0E8D0;
  --lit-white-icon: #F0E8D0;
  --lit-red: #EF5350;
  --lit-green: #66BB6A;
  --lit-violet: #B388D9;
  --lit-black: #9E968E;
  --lit-rose: #FF39E0;
  --lit-white-text: #1E1A17;   /* dark text on white banner */
  --lit-black-text: #9E968E;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > .footer {
  margin-top: auto;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Navigation ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}

/* Burger ganz links, Titel rechts ausgerichtet */
.nav__inner .menu-btn { order: -1; }
.nav .nav__title { margin-left: auto; }

.nav__logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav__logo:hover { text-decoration: none; }

.nav__title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline-Bereichslinks: erst auf breiten Screens sichtbar, Rest bleibt im ☰-Menü */
.nav__links-inline { display: none; }
@media (min-width: 900px) {
  .nav__links-inline {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
  }
}

.nav__links {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav__link {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav__link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}

.nav__link--active {
  color: var(--color-accent);
  font-weight: 600;
}

/* ── Footer ── */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer__text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.footer__text--small { font-size: 0.78rem; }

.footer__link {
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer__link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Theme toggle button in nav */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.theme-toggle:hover,
.theme-toggle:active {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
}

/* ══════════════════════════════════════════════════════════
   Menu button + slide-out menu
   ══════════════════════════════════════════════════════════ */
.menu-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.menu-btn:hover,
.menu-btn:active {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
}

.menu-backdrop {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.menu-backdrop--open { opacity: 1; pointer-events: auto; }
.menu-backdrop[hidden] { display: none; }

.menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding-bottom: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.menu-panel--open { transform: translateX(0); }

.menu-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
}
.menu-panel__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}
.menu-panel__close {
  background: none;
  border: none;
  font-size: 1.15rem;
  color: var(--color-text-muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}
.menu-panel__close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* ── Menü-Suche ── */
.menu-search {
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--color-border);
}
.menu-search__input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.menu-search__input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.menu-search__results {
  margin-top: 6px;
  max-height: 45vh;
  overflow-y: auto;
}
.menu-search__result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
}
.menu-search__sub {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}
.menu-search__typ {
  flex-shrink: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 5px;
}
.menu-search__empty {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  padding: 8px 4px;
  margin: 0;
}

.menu-section {
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}
.menu-section__title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  padding: 4px 20px 6px;
  margin: 0;
}
.menu-section__hint {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-text-muted);
  padding: 0 20px 6px;
  margin: 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.menu-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}
.menu-item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}
.menu-item__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.menu-item__label { flex: 1; }
.menu-item--toggle {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* Unter-Direktlinks (z. B. Proprium → Tempore/Sancti/Commune) */
.menu-subitem {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 56px;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}
.menu-subitem:hover { color: var(--color-text); }

body.menu-open { overflow: hidden; }

/* ── Screen-reader only (a11y) ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══ P2: Accessibility ═══ */

/* Skip link — visually hidden until focused */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 6px 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}


:where(a,button,input,select,summary):focus-visible { outline:2px solid var(--color-accent); outline-offset:2px; }
@media (max-width:768px) { .nav__title { display:none; } }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } }
@media print {
  .nav,.footer,.menu-panel,.menu-backdrop,.skip-link { display:none; }
  html,body { background:#fff; color:#000; }
}
