/* ═══════════════════════════════════════════════════════════
   Missale Digitale — Kalender Stylesheet
   Based on alte-messe-heute.de design system
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #2C2C2C;
  --color-text-muted: #6B6B6B;
  --color-border: #E5E5E0;
  --color-accent: #5B2C6F;
  --color-accent-light: #7D3C98;
  --color-gold: #D4A017;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --max-width: 960px;
  --nav-height: 56px;
}

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;
}

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;
  justify-content: space-between;
  height: 100%;
}

.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;
}

.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: #F0EDE8;
  color: var(--color-text);
  text-decoration: none;
}

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

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════
   Year Overview Mini-Timeline
   ══════════════════════════════════════════════════════════ */
.year-overview {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 6px 20px;
  user-select: none;
}

.year-overview__track {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 2px;
  position: relative;
  overflow: hidden;
}

.yo-month {
  flex: 1;
  padding: 4px 2px;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text-muted);
  background: #F5F3EF;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yo-month:hover {
  background: #E8E4DD;
  color: var(--color-text);
}

.yo-month--current {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.yo-month--current:hover {
  background: var(--color-accent-light);
}

.yo-viewport {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: var(--color-gold);
  border-radius: 2px;
  transition: left 0.2s, width 0.2s;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   Day Strip — continuous horizontal calendar
   ══════════════════════════════════════════════════════════ */
.day-strip {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 4px 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
  user-select: none;
}

.ds-arrow {
  flex-shrink: 0;
  width: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 1.2rem;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.ds-arrow:hover {
  background: #F0EDE8;
  color: var(--color-accent);
}

.ds-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ds-scroll::-webkit-scrollbar {
  display: none;
}

.ds-days {
  display: flex;
  gap: 1px;
  padding: 4px 0;
}

/* ── Month separator ── */
.ds-month-sep {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.ds-month-sep__label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-accent);
  white-space: nowrap;
}

/* ── Day cell ── */
.ds-day {
  flex-shrink: 0;
  width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 3px 1px;
  border-radius: 4px;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  outline: none;
  min-height: 50px;
}

.ds-day:hover {
  background: #F0EDE8;
}

.ds-day--today {
  border-color: var(--color-accent);
  background: rgba(91, 44, 111, 0.06);
}

.ds-day--active {
  background: rgba(91, 44, 111, 0.12);
  border-color: var(--color-accent);
}

.ds-day--empty {
  opacity: 0.5;
}

.ds-day--sun .ds-day__wd {
  color: var(--color-accent);
}

/* Weekday label */
.ds-day__wd {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1;
}

.ds-day__wd--sun {
  color: var(--color-accent);
}

/* Cross */
.ds-day__cross {
  display: block;
  line-height: 1;
  min-height: 1em;
  font-size: 0.7rem;
}

.ds-day__cross--I  { font-size: 1.3rem; }
.ds-day__cross--II { font-size: 1.05rem; }
.ds-day__cross--III { font-size: 0.8rem; }
.ds-day__cross--IV { font-size: 0.6rem; }

/* Date number */
.ds-day__num {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1;
}

.ds-day--filtered {
  opacity: 0.15;
  pointer-events: none;
}

/* ── Rank Filter ── */
.rank-filter {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px;
  align-items: center;
  justify-content: center;
}

.rank-btn {
  width: 24px;
  height: 24px;
  font-size: 0.55rem;
  font-weight: 700;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: #F5F3EF;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1;
}

.rank-btn:hover {
  background: #E8E4DD;
}

.rank-btn--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.rank-btn--active:hover {
  background: var(--color-accent-light);
}

.loading {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px;
}

/* ── Day Detail ── */
.day-detail {
  padding: 16px 0 48px;
}

/* Toolbar: back + settings on one line */
.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.detail-toolbar__back {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.detail-toolbar__back:hover { text-decoration: underline; }

/* Settings trigger + dropdown */
.settings-wrap {
  position: relative;
}

.settings-trigger {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-accent);
  line-height: 1;
}

.settings-trigger:hover {
  background: #F8F7F4;
}

.settings-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 12px 14px;
  z-index: 200;
  min-width: 320px;
}

.settings-dropdown--open {
  display: block;
}

.settings-dropdown__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-dropdown__options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.day-detail__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-latin {
  font-size: 1rem;
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.detail-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-meta__item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
}

.detail-desc {
  margin-top: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── Mass Texts ── */
.day-detail__texts {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.text-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.text-section__header {
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
  background: #F8F7F4;
  color: var(--color-text-muted);
}

.text-section__body {
  padding: 16px;
}

.text-bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.text-col--left {
  font-style: italic;
  color: var(--color-text-muted);
}

.text-col--right {
  color: var(--color-text);
}

.text-col p {
  margin-bottom: 10px;
  white-space: pre-line;
  line-height: 1.7;
  font-size: 0.92rem;
}

/* ── Column Headers ── */
.text-col-headers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 8px 16px;
  margin-bottom: 8px;
}

.text-col-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-accent);
}

/* ── Mass Section Dividers ── */
.mass-section-divider {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 0 6px;
  margin-top: 8px;
  border-bottom: 1px solid var(--color-border);
}

/* ── Ordinarium distinction ── */
.text-section--ord {
  border-color: rgba(212, 160, 23, 0.3);
  background: #FDFCF7;
}

.text-section--ord .text-section__header {
  background: #F6F1E0;
  color: var(--color-gold);
  border-bottom-color: rgba(212, 160, 23, 0.3);
}

/* Settings panel — kept for shared sub-styles */

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-muted);
}

.settings-select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  background: var(--color-surface);
  color: var(--color-text);
}

/* (moved to .settings-dropdown__options above) */

.settings-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
}

.settings-check input { cursor: pointer; }

.no-texts {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px;
  font-style: italic;
}

/* ── 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; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav__toggle { display: flex; }

  .nav__links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 8px 20px;
  }

  .nav__links--open { display: flex; }

  .page-header--compact__inner {
    flex-direction: column;
    gap: 4px;
  }

  .text-bilingual {
    grid-template-columns: 1fr;
  }

  .text-col--left {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
  }

  .text-col-headers {
    grid-template-columns: 1fr;
  }

  .text-col-header:last-child { display: none; }

  .settings-panel__columns {
    grid-template-columns: 1fr;
  }

  /* Year overview: smaller cells on mobile */
  .yo-month {
    font-size: 0.6rem;
    padding: 4px 2px;
  }

  /* Day strip mobile */
  .ds-day {
    width: 32px;
    min-height: 44px;
  }

  .ds-arrow {
    width: 24px;
    font-size: 1rem;
  }

  .ds-month-sep__label {
    font-size: 0.55rem;
  }

  .rank-btn {
    width: 20px;
    height: 20px;
    font-size: 0.5rem;
  }

  .nav__title { display: none; }
}
