/* ============================================================
   DZIP – Mehrtägiges Alltagsprofil (Erklärbaustein)
   Übernommen aus „DZIP_Mehrtagesprofil_Webbaustein" und an die
   DZIP-Gestaltung angepasst (Schriften, Farben, Kanten). Gilt nur
   innerhalb von .cs-profile. Ohne JavaScript erscheint die statische
   Übersicht-plus-Detail-Grafik (uploads/dzip-alltagsprofil-schema.webp).
   ============================================================ */

.cs-profile {
  --pf-navy: #0f2236;
  --pf-navy-2: #263e54;
  --pf-teal: #4f8582;
  --pf-paper: #fbfaf7;
  margin: clamp(3.5rem, 7vw, 5.5rem) 0 0;
}

.cs-profile__intro {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: clamp(1.8rem, 4.5vw, 3.6rem);
  background: linear-gradient(135deg, var(--pf-navy), #18354e);
  color: var(--on-dark);
}
.cs-profile__eyebrow { margin: 0 0 0.9rem; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.cs-profile__title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; color: #fff; }
.cs-profile__lead { margin: 1.2rem 0 0; max-width: 60ch; font-size: calc(1.1rem * var(--type-scale)); line-height: 1.65; color: rgba(236, 232, 223, 0.86); }
.cs-profile__note {
  align-self: end;
  margin: 0;
  padding: 1.2rem 0 0.2rem 1.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(236, 232, 223, 0.78);
}
.cs-profile__note strong { display: block; margin-bottom: 0.5rem; font-weight: 600; color: #fff; }

.cs-profile__workspace {
  padding: clamp(1.4rem, 3.5vw, 2.8rem);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--hairline-soft);
  border-top: 0;
  box-shadow: 0 34px 70px -56px rgba(15, 34, 54, 0.6);
}
.cs-profile__fallback { display: block; width: 100%; height: auto; border: 1px solid var(--hairline-soft); }
.cs-profile.is-enhanced .cs-profile__fallback { display: none; }
.cs-profile__app[hidden] { display: none; }

.cs-profile__toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.6rem; }
.cs-profile__subtitle { margin: 0 0 0.35rem; font-family: var(--serif); font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.15; color: var(--pf-navy); }
.cs-profile__help { margin: 0; font-size: 1rem; color: var(--ink-muted); }
.cs-profile__days { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.cs-profile__day {
  min-width: 76px;
  padding: 0.65em 1em;
  font: 600 0.95rem var(--sans);
  color: var(--pf-navy);
  background: #fff;
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.cs-profile__day:hover { border-color: var(--gold); }
.cs-profile__day[aria-pressed="true"] { background: var(--pf-navy); border-color: var(--pf-navy); color: #fff; }
.cs-profile__day:focus-visible,
.cs-heatmap__row:focus-visible,
.cs-mday summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Übersicht (Heatmap) */
.cs-heatmap { padding: clamp(1rem, 2.4vw, 1.8rem); background: var(--pf-paper); border: 1px solid var(--hairline); }
.cs-heatmap__legend { display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; margin-bottom: 1.2rem; font-size: 0.9rem; color: var(--ink-muted); }
.cs-heatmap__legend span { display: inline-flex; align-items: center; gap: 0.55rem; }
.cs-heatmap__scale { display: inline-block; width: 34px; height: 8px; background: linear-gradient(90deg, #dce6ec, #7eaaa5, #b08d4f, #263e54); }
.cs-heatmap__event { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--pf-navy); border-radius: 50%; background: #fff; }
.cs-heatmap__axis,
.cs-heatmap__row { display: grid; grid-template-columns: 70px repeat(24, minmax(10px, 1fr)); gap: 3px; }
.cs-heatmap__axis { align-items: end; margin-bottom: 0.4rem; padding: 0 3px; font-size: 0.8rem; color: var(--ink-faint); }
.cs-heatmap__axis span { grid-column: span 3; }
.cs-heatmap__axis .cs-heatmap__spacer { grid-column: span 1; }
.cs-heatmap__row {
  width: 100%;
  margin: 5px 0;
  padding: 3px;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cs-heatmap__row:hover,
.cs-heatmap__row[aria-current="true"] { background: rgba(176, 141, 79, 0.15); }
.cs-heatmap__label { display: flex; align-items: center; padding-left: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--pf-navy); }
.cs-heatmap__cell { position: relative; height: 30px; background: var(--cell-color); }
.cs-heatmap__cell[data-event]::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px;
  border: 2px solid var(--pf-navy);
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

/* Detailansicht */
.cs-detail { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.55fr); gap: 1.4rem; margin-top: 1.4rem; }
.cs-detail__chart { padding: clamp(1rem, 2.4vw, 1.8rem); background: #fff; border: 1px solid var(--hairline); }
.cs-detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.cs-detail__title { margin: 0 0 0.25rem; font-family: var(--serif); font-size: clamp(1.35rem, 2.2vw, 1.8rem); line-height: 1.15; color: var(--pf-navy); }
.cs-detail__subtitle { margin: 0; font-size: 0.95rem; color: var(--ink-muted); }
.cs-detail__badge { flex: none; padding: 0.45em 0.8em; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--pf-navy); background: var(--cream-offset); }
.cs-detail__svg { display: block; width: 100%; height: auto; overflow: visible; }
.cs-detail__svg .pf-grid { stroke: #e6e3db; stroke-width: 1; }
.cs-detail__svg .pf-event { stroke: #9c978b; stroke-width: 1; stroke-dasharray: 4 5; }
.cs-detail__svg .pf-act,
.cs-detail__svg .pf-rec { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.cs-detail__svg .pf-act { stroke: var(--gold); }
.cs-detail__svg .pf-rec { stroke: var(--pf-teal); }
.cs-detail__svg text { font: 500 14px var(--sans); fill: var(--ink-faint); }
.cs-detail__svg .pf-event-label { font-size: 13px; font-weight: 600; fill: var(--pf-navy); }
.cs-detail__legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin-top: 0.6rem; font-size: 0.9rem; color: var(--ink-muted); }
.cs-detail__legend span { display: inline-flex; align-items: center; gap: 0.55rem; }
.cs-detail__key { display: inline-block; width: 28px; height: 4px; border-radius: 2px; }
.cs-detail__key--act { background: var(--gold); }
.cs-detail__key--rec { background: var(--pf-teal); }
.cs-detail__context { padding: 1.6rem; background: var(--pf-navy); color: var(--on-dark); }
.cs-detail__context-title { margin: 0 0 1rem; font-family: var(--serif); font-size: 1.45rem; color: #fff; }
.cs-detail__summary { margin: 0 0 1.4rem; font-size: 1.02rem; line-height: 1.6; color: rgba(236, 232, 223, 0.84); }
.cs-detail__events { list-style: none; margin: 0; padding: 0; }
.cs-detail__events li { display: grid; grid-template-columns: 54px 1fr; gap: 0.6rem; padding: 0.7rem 0; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.cs-detail__events time { font-weight: 600; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.cs-detail__events strong { display: block; margin-bottom: 0.15rem; font-weight: 600; color: #fff; }
.cs-detail__events span { font-size: 0.92rem; line-height: 1.4; color: rgba(236, 232, 223, 0.74); }

/* Mobil: eine aufklappbare Karte je Messtag */
.cs-profile__mobile { display: none; }
.cs-mday { margin: 0.7rem 0; background: #fff; border: 1px solid var(--hairline); }
.cs-mday summary { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem; font-weight: 600; color: var(--pf-navy); cursor: pointer; list-style: none; }
.cs-mday summary::-webkit-details-marker { display: none; }
.cs-mday summary::after { content: "+"; font-size: 1.35rem; line-height: 1; color: var(--gold); }
.cs-mday[open] summary::after { content: "–"; }
.cs-mday__body { padding: 0 1.1rem 1.1rem; }
.cs-mday__strip { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; margin: 0.1rem 0 0.7rem; }
.cs-mday__strip span { height: 18px; background: var(--cell-color); }
.cs-mday__times { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-faint); }
.cs-mday__summary { margin: 0.9rem 0 0; font-size: 0.98rem; line-height: 1.55; color: var(--ink-muted); }
.cs-mday__events { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.cs-mday__events li { padding: 0.6rem 0; border-top: 1px solid var(--hairline); font-size: 1rem; line-height: 1.45; }
.cs-mday__events time { display: inline-block; min-width: 54px; font-weight: 600; color: var(--gold); }

.cs-profile__disclaimer { margin: 1.4rem 0 0; max-width: 90ch; font-size: 0.95rem; line-height: 1.6; color: var(--ink-muted); }

@media (max-width: 940px) {
  .cs-profile__intro,
  .cs-detail { grid-template-columns: minmax(0, 1fr); }
  .cs-profile__note { padding: 1rem 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.25); }
  .cs-profile__toolbar { flex-direction: column; align-items: flex-start; }
  .cs-profile__days { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .cs-profile__intro { padding: 1.6rem 1.2rem; }
  .cs-profile__workspace { padding: 1.2rem 1rem; }
  .cs-profile__desktop,
  .cs-profile__days,
  .cs-profile__help { display: none; }
  .cs-profile__mobile { display: block; }
  .cs-profile__toolbar { margin-bottom: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-profile *, .cs-profile *::before, .cs-profile *::after { transition: none !important; }
}
