.hb-calendar {
    --hb-free: #eaf4ea;
    --hb-busy: #b98378;
    --hb-border: color-mix(in srgb, currentColor 18%, transparent);
    --hb-muted: color-mix(in srgb, currentColor 62%, transparent);
    --hb-radius: 12px;
    width: 100%;
}

.hb-calendar__legend {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    align-items: center;
    margin: 0 0 1rem;
    font-size: .92em;
}

.hb-calendar__legend > span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.hb-calendar__legend-note {
    color: var(--hb-muted);
}

.hb-legend-swatch {
    width: .9rem;
    height: .9rem;
    border: 1px solid var(--hb-border);
    border-radius: 3px;
}

.hb-legend-swatch--free { background: var(--hb-free); }
.hb-legend-swatch--busy { background: var(--hb-busy); }

.hb-calendar__months {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.hb-month {
    min-width: 0;
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius);
    padding: .9rem;
    background: Canvas;
    color: CanvasText;
}

.hb-month__title {
    margin: 0 0 .7rem;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.25;
}

.hb-month__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.hb-month__weekdays {
    margin-bottom: .35rem;
    color: var(--hb-muted);
    font-size: .72rem;
    font-weight: 600;
    text-align: center;
}

.hb-month__days {
    gap: 3px;
}

.hb-day {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--hb-border);
    border-radius: 5px;
    background: var(--hb-free);
}

.hb-day--empty {
    border-color: transparent;
    background: transparent;
}

.hb-day__half {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

/*
 * Jeder Tag wird diagonal geteilt:
 * links oben = Vormittag, rechts unten = Nachmittag.
 * Beide Flächen decken zusammen exakt das ganze Tagesfeld ab.
 */
.hb-day__half--am {
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.hb-day__half--pm {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.hb-day__half.is-free { background: var(--hb-free); }
.hb-day__half.is-busy { background: var(--hb-busy); }

.hb-day__number {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 2;
    font-size: clamp(.65rem, .9vw, .82rem);
    line-height: 1;
    color: #111;
    text-shadow: 0 1px 2px rgba(255,255,255,.85), 0 0 4px rgba(255,255,255,.75);
}

.hb-day--today {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.hb-day--past {
    opacity: .55;
}

@media (max-width: 980px) {
    .hb-calendar__months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .hb-calendar__months { grid-template-columns: 1fr; }
    .hb-month { padding: .75rem; }
    .hb-day__number { font-size: .82rem; }
}
