/* Belegungskalender – gemeinsam für Website und Verwaltung */

.kal-monat {
  --kal-frei: #5aa462;
  --kal-belegt: #d14a3d;
  --kal-text: #fff;
  --kal-luecke: 3px;
  min-width: 0;
}

.kal-monat-kopf {
  font-family: var(--serif, Georgia, serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: .01em;
  margin: 0 0 .6rem;
}

.kal-raster {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--kal-luecke);
}

.kal-wt {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  opacity: .55;
  padding-bottom: .2rem;
}

.kal-tag {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--kal-text);
  background: var(--kal-frei);
  border-radius: 3px;
  isolation: isolate;
}

button.kal-tag { cursor: pointer; }

.kal-h {
  position: absolute;
  inset: 0;
  background: var(--kal-belegt);
  z-index: 0;
}

/* Trennlinie von oben rechts nach unten links */
.kal-vm { clip-path: polygon(0 0, 100% 0, 0 100%); }
.kal-nm { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* Wechseltag: beide Hälften rot, feine helle Diagonale */
.kal-wechsel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom right, transparent calc(50% - .8px), rgba(255,255,255,.9) calc(50% - .8px), rgba(255,255,255,.9) calc(50% + .8px), transparent calc(50% + .8px));
  pointer-events: none;
}

.kal-z {
  position: relative;
  z-index: 2;
  font-size: .82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
  pointer-events: none;
}

.kal-vergangen { filter: saturate(.25) brightness(1.08); opacity: .45; }

.kal-heute { box-shadow: inset 0 0 0 2px rgba(255,255,255,.95), 0 0 0 2px #1c211e; }

.kal-auswahl { box-shadow: inset 0 0 0 2px #fff; }
.kal-auswahl::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(20, 40, 30, .28);
  pointer-events: none;
}
.kal-auswahl-start, .kal-auswahl-ende { box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px #1c211e; }

button.kal-tag:focus-visible { outline: 3px solid #1c211e; outline-offset: 2px; z-index: 3; }

@media (hover: hover) {
  button.kal-tag:not(.kal-vergangen):hover { transform: scale(1.08); z-index: 3; box-shadow: 0 6px 16px rgba(0,0,0,.22); }
  button.kal-tag { transition: transform .18s ease, box-shadow .18s ease; }
}

/* Legende */
.kal-legende {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.6rem;
  align-items: center;
  font-size: .9rem;
}
.kal-legende span { display: inline-flex; align-items: center; gap: .55rem; }
.kal-legende i {
  position: relative;
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 3px;
  background: #5aa462;
  overflow: hidden;
}
.kal-legende i.belegt { background: #d14a3d; }
.kal-legende i.anreise { background: linear-gradient(to bottom right, #5aa462 50%, #d14a3d 50%); }
.kal-legende i.abreise { background: linear-gradient(to bottom right, #d14a3d 50%, #5aa462 50%); }
.kal-legende i.wechsel { background: linear-gradient(to bottom right, #d14a3d calc(50% - 1px), #fff calc(50% - 1px), #fff calc(50% + 1px), #d14a3d calc(50% + 1px)); }
