/* Wochenübersicht: Header, Pillenleiste, Karten (NOO-112/113/114) */

#app {
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  color: var(--fg);
  transition: color .25s;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

/* Bei geöffnetem Sheet tritt der Hintergrund zurück und wird zur Karte. Der
   Wert kommt aus derselben Feder wie das Sheet (sheet.js), folgt also der
   Ziehgeste 1:1 — daher hier bewusst keine transition. */
body.sheet-open #app {
  transform: scale(calc(1 - .055 * var(--sheet-progress, 0)));
  transform-origin: 50% 0;
  border-radius: calc(16px * var(--sheet-progress, 0));
  overflow: hidden;
}

/* ── Chrome-Schicht (Header + Pillenleiste + Tagestitel) ─────────────────────
   Durchsichtiges Material statt undurchsichtiger Leiste: der Inhalt bleibt beim
   Scrollen sichtbar, die Schicht schwebt darüber. Die negativen Ränder heben
   das Innenpolster von #app auf, damit die Fläche bis an die Kante läuft. */
.app-chrome {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px;
  padding: 0 16px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
}
/* Scroll-Kante statt 1px-Trennlinie: das Material läuft aus, wo Inhalt beginnt. */
.app-chrome::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%; height: 12px;
  background: linear-gradient(var(--chrome-bg), transparent);
  pointer-events: none;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px 0 14px;
}
.kw-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--acc);
  letter-spacing: .02em;
}
#month-label {
  margin: 2px 0 0;
  /* Ab 375px die 30px des Prototyps; darunter skaliert der Titel mit, statt
     umzubrechen — das längste Label ("24. Dez – 30. Dezember") braucht sonst
     mehr Breite, als ein 320px-Gerät hergibt. Über 375px ändert sich nichts. */
  font-size: clamp(23px, 8vw, 30px);
  font-weight: 700;
  /* Große Schrift braucht negative Laufweite und enges Zeilenmaß, sonst stehen
     die Buchstaben zu weit auseinander. */
  letter-spacing: -.022em;
  line-height: 1.05;
}
.hdr-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--fill);
  border: none;
  color: var(--sec);
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 16px; height: 16px; }
.pill-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--fill);
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.hdr-spacer { width: 6px; }

/* ── 7-Tage-Pillenleiste ────────────────────────────────────────────────────── */
.pill-bar {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 2px 0 14px;
}
.day-pill {
  flex: 1 0 74px; min-width: 74px;
  border-radius: 14px;
  padding: 10px 4px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent;
  border: none;
}
/* Breite Fläche — dezenter zusammenziehen als ein runder Knopf. */
.day-pill:active { transform: scale(.96); }
.day-pill.selected-mobile-only { background: var(--card); }
.day-pill .wd {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--sec);
}
.day-pill.is-today .wd { color: var(--acc); }
.day-pill .date-circle {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600;
  color: var(--fg);
}
.day-pill.is-today .date-circle { background: var(--acc); color: #fff; }
.day-pill .weather-row {
  height: 16px; font-size: 11px; color: var(--sec);
  display: flex; align-items: center; gap: 3px;
}
.day-pill .weather-row svg { width: 14px; height: 14px; }
.day-pill .dot-row { height: 5px; display: flex; gap: 3px; }
.day-pill .dot-row span { width: 5px; height: 5px; border-radius: 50%; }

/* ── Mobile Tagestitel ("Heute · Freitag, 11. Juli" + Wetter) ───────────────── */
.mobile-day-title {
  display: none;
  align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 6px 2px 12px;
  font-size: 19px; font-weight: 700; letter-spacing: -.01em;
}
.mobile-day-title .weather { font-size: 13px; font-weight: 400; color: var(--sec); display: flex; align-items: center; gap: 4px; }
.mobile-day-title .weather svg { width: 15px; height: 15px; }

/* ── Wochenraster ────────────────────────────────────────────────────────────
   7 Tagesspalten werden immer gerendert; auf Mobile blendet CSS alle bis auf
   die ausgewählte aus (statt in JS zwei Layout-Varianten zu pflegen). */
#week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: start;
}
.day-col {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 46vh;
  background: transparent;
  border-radius: 14px;
  padding: 8px;
}
.day-col.is-today { background: var(--fill); }

/* Karten: Desktop = kompakte Karte mit border-left (Prototyp 1832), Mobile =
   Flex-Zeile mit eigenem 4px-Farbbalken (Prototyp 1797). Gemeinsames Markup:
   <article><div class="bar"></div><div class="main">…</div>(chip|check-btn)</article> */
.event-card {
  background: var(--card);
  border-radius: 12px;
  padding: 10px 11px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--mod-color, var(--sec));
  cursor: default;
}
.event-card.clickable { cursor: pointer; }
.event-card .bar { display: none; }
.event-card .main { min-width: 0; }
.event-card .row-top {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.event-card .badge { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--mod-color, var(--sec)); }
.event-card .time { font-size: 11px; color: var(--sec); }
.event-card .title {
  font-size: 13px; font-weight: 600; line-height: 1.3; margin-top: 3px;
}
.event-card .sub {
  font-size: 11px; color: var(--sec); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-card .chip {
  display: inline-block; margin-top: 6px;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 12px;
  background: var(--chip-bg); color: var(--chip-fg);
  white-space: nowrap;
}
.event-card .check-btn {
  margin-top: 6px; height: 26px; border-radius: 13px;
  border: 1.5px solid var(--ck-border, var(--sep));
  background: var(--ck-bg, transparent);
  color: var(--ck-fg, var(--sec));
  font-size: 11px; font-weight: 600;
  padding: 0 10px;
}
.event-card .check-btn .ck-icon { display: none; }

.empty-week {
  grid-column: 1 / -1;
  text-align: center; color: var(--sec);
  padding: 48px 20px;
}
.empty-week[hidden] { display: none; }
.empty-week-title { font-size: 15px; font-weight: 600; }
.empty-week-sub { font-size: 13px; margin-top: 4px; }

/* Wisch-Hinweis (Prototyp 1822) — nur mobil sichtbar */
.swipe-hint {
  display: none;
  text-align: center; padding: 22px 0 4px;
  color: var(--sec); font-size: 12px;
}

/* ── Breakpoint 900px ───────────────────────────────────────────────────────── */
@media (max-width: 899.98px) {
  .mobile-day-title { display: flex; }
  .swipe-hint { display: block; }

  /* Vertikales Scrollen bleibt nativ, das horizontale Ziehen übernimmt week.js. */
  #week-grid { touch-action: pan-y; }
  .day-col.selected-mobile-day { will-change: transform; }

  /* Kopfzeile zweireihig: neben sechs Bedienelementen bleiben auf 390px rund
     70px für den Titel — "Juli 2026" müsste auf ~16px schrumpfen und wäre als
     Seitentitel nicht mehr erkennbar. Also bekommt der Titel eine eigene Zeile
     in voller Breite; die Bedienelemente rücken darunter nach rechts und
     behalten ihre Reihenfolge und Gruppierung wie auf dem Desktop.
     (Der Prototyp kennt für diese Breite keine Variante.) */
  #header {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 10px;
    padding: 16px 0 12px;
  }
  .hdr-left { flex: 1 0 100%; }
  .hdr-actions { margin-left: auto; }
  /* Flex-gap der Tagesspalte kompensieren: Abstand letzte Karte → Hinweis = 22px wie im Prototyp */
  .event-card + .swipe-hint { margin-top: -10px; }
  .day-pill:not(.selected-mobile-only) .date-circle { background: transparent; }
  .day-pill.is-today .date-circle { background: var(--acc); }
  .day-pill.selected-mobile-only { background: var(--card); }

  #week-grid { display: block; }
  .day-col { display: none; min-height: 0; padding: 0; }
  /* Prototyp 1790: mobiler Tages-Wrapper ohne Panel-Hintergrund, auch heute */
  .day-col, .day-col.is-today { background: none; }
  .day-col.selected-mobile-day { display: flex; gap: 10px; min-height: 52vh; }

  /* Mobile Karte (Prototyp 1797-1812): Flex-Zeile mit 4px-Farbbalken links */
  .event-card {
    border-left: none; padding: 13px 15px; border-radius: 16px;
    display: flex; gap: 12px; align-items: center;
  }
  .event-card .bar {
    display: block; flex: none;
    width: 4px; align-self: stretch; border-radius: 2px;
    background: var(--mod-color, var(--sec));
  }
  .event-card .main { flex: 1; }
  .event-card .row-top { justify-content: flex-start; gap: 8px; }
  .event-card .badge { font-size: 11px; letter-spacing: .06em; }
  .event-card .time { font-size: 12px; }
  .event-card .title { font-size: 15px; margin-top: 2px; }
  .event-card .sub { font-size: 13px; margin-top: 1px; }
  .event-card .chip { margin-top: 0; flex: none; font-size: 11px; padding: 4px 9px; border-radius: 20px; }
  .event-card .check-btn {
    margin-top: 0; flex: none;
    width: 28px; height: 28px; border-radius: 50%; padding: 0;
    border-width: 2px;
    display: grid; place-items: center;
  }
  .event-card .check-btn .ck-label { display: none; }
  .event-card .check-btn .ck-icon { display: block; }
}

@media (min-width: 900px) {
  .day-pill.selected-mobile-only { background: transparent; }
  .event-card .sub { display: none; }
}
