/* Kalender-Vorlage. Baut auf ../styles.css und ../ratgeber/ratgeber.css auf. */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.kal-einleitung { padding-bottom: 10px; }

.kal-werkzeug {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 32px; align-items: start; margin: 10px auto 30px;
}
.kal-werkzeug[data-format="quer"] { grid-template-columns: minmax(0, 1fr) minmax(0, 500px); }

/* Statt Kringel-Doodles der Ratgeber: Sticker aus der App */
.kal-seite .article::before, .kal-seite .article::after { display: none; }
.kal-einleitung { position: relative; }
/* Kalender an der Wand oben im Bild, deshalb den oberen Teil zeigen */
.kal-hero img { object-position: 50% 4%; }
.kal-sticker { position: absolute; pointer-events: none; user-select: none; height: auto; filter: drop-shadow(0 6px 8px rgba(74,63,46,.18)); }
.kal-sticker-hero { width: 84px; right: 4px; top: -30px; transform: rotate(12deg); z-index: 2; }
.kal-blatt-halter { position: relative; }
.kal-sticker-stern { width: 52px; right: -10px; top: -18px; transform: rotate(14deg); }

/* Bedienblöcke */
.kal-block {
  border: 1px solid rgba(206,197,182,0.7); border-radius: 18px; background: var(--card);
  box-shadow: var(--shadow-card); padding: 18px 20px 20px; margin: 0 0 18px; min-width: 0;
}
.kal-block h2 {
  font-size: 1.25rem; display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
}
.kal-nr {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--coral-light); color: var(--coral-deep);
  font: 700 .95rem var(--f-body); display: grid; place-items: center;
}
.kal-unter { font-family: var(--f-body); font-weight: 600; font-size: .92rem; margin: 18px 0 8px; }
.kal-block h2 small, .kal-unter small, .kal-block label small { font-family: var(--f-body); font-weight: 400; font-size: .85rem; color: var(--ink-soft); }
.kal-block label { display: block; font-size: .92rem; font-weight: 600; color: var(--ink); margin-top: 10px; }
.kal-block input[type="text"], .kal-block input[type="month"], .kal-block input[type="date"],
.kal-block select, .kal-block textarea {
  display: block; width: 100%; margin-top: 5px; font: 400 1rem var(--f-body); color: var(--ink);
  background: #fff; border: 1.5px solid var(--ink-faint); border-radius: 12px; padding: 10px 12px;
}
.kal-block textarea { resize: vertical; min-height: 52px; font-family: var(--f-hand); font-size: 1.3rem; line-height: 1.15; }
.kal-block :is(input, select, textarea):focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; border-color: transparent; }
.kal-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.kal-tipp { font-size: .9rem; color: var(--ink-soft); margin: 4px 0 14px; }
.kal-klein { padding: 10px 16px; font-size: .92rem; }

/* Formatwahl */
.kal-format { display: flex; gap: 12px; }
.kal-format label {
  flex: 1; display: flex; align-items: center; gap: 12px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--ink-faint); border-radius: 14px; padding: 12px 14px; background: #fff;
}
.kal-format label:has(input:checked) { border-color: var(--coral-deep); background: var(--coral-light); }
.kal-format label:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
.kal-format input { position: absolute; opacity: 0; }
.kal-blatt { display: inline-block; border: 2px solid var(--ink-soft); border-radius: 3px; background: var(--card); }
.kal-blatt.hoch { width: 22px; height: 31px; }
.kal-blatt.quer { width: 31px; height: 22px; }

/* Bildliste */
.kal-block .kal-dateiknopf { display: flex; cursor: pointer; width: 100%; justify-content: center; margin-top: 0; color: #fff; }
.kal-dateiknopf:focus-within { outline: 3px solid var(--teal); outline-offset: 3px; }
.kal-plaetze { list-style: none; margin: 16px 0 0; padding: 0; }
.kal-platz {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px; margin: 0 -12px; border-radius: 14px;
}
.kal-platz + .kal-platz { border-top: 1px dashed var(--ink-faint); }
.kal-platz.aktiv { background: var(--gold-light); }
.kal-bild {
  width: 72px; height: 72px; border-radius: 12px; border: 1.5px dashed var(--ink-faint); background: #fff;
  font-size: 1.8rem; color: var(--ink-soft); cursor: pointer; padding: 0; overflow: hidden;
}
.kal-bild canvas { width: 100%; height: 100%; display: block; }
.kal-bild:hover { border-color: var(--coral-deep); color: var(--coral-deep); }
.kal-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kal-kopf strong { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; }
.kal-aktionen { display: flex; gap: 4px; }
.kal-aktionen button, .kal-weg {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--ink-faint); background: #fff;
  color: var(--ink-soft); cursor: pointer; font-size: .95rem;
}
.kal-aktionen button:hover:not(:disabled), .kal-weg:hover { color: var(--coral-deep); border-color: var(--coral-deep); }
.kal-aktionen button:disabled { opacity: .35; cursor: default; }
.kal-platz label { margin-top: 6px; }
.kal-alter { display: flex !important; align-items: center; gap: 10px; }
.kal-alter span { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.kal-alter input { max-width: 150px; margin-top: 0 !important; padding: 6px 10px !important; }

/* Geburtstage */
.kal-geburtstage { list-style: none; margin: 0 0 12px; padding: 0; }
.kal-geburtstage:empty { margin: 0; }
.kal-geburtstage li { display: grid; grid-template-columns: minmax(0, 1fr) 160px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.kal-geburtstage input { margin-top: 0 !important; }
.kal-haken { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.kal-haken input { margin-top: 5px; accent-color: var(--coral-deep); width: 18px; height: 18px; flex: none; }
.kal-haken:has(input:disabled) { opacity: .5; }

/* Rahmen und Hintergrund */
.kal-rahmen-wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.kal-wahl { cursor: pointer; border: 2px solid var(--ink-faint); background: #fff; border-radius: 14px; padding: 6px; font: 600 .82rem var(--f-body); color: var(--ink); }
.kal-wahl:hover { border-color: var(--sage); }
.kal-wahl[aria-pressed="true"] { border-color: var(--coral-deep); box-shadow: 0 0 0 3px var(--coral-light); }
.kal-wahl:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.kal-rahmen-wahl .kal-wahl { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kal-rahmen-wahl canvas { width: 100%; height: auto; display: block; }
.kal-farben, .kal-hg-bilder { display: flex; flex-wrap: wrap; gap: 10px; }
.kal-schriften { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.kal-schriftwahl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; padding: 8px 6px; }
.kal-schriftprobe { line-height: 1.15; color: var(--ink); white-space: nowrap; }
.kal-schriftwahl small { font-weight: 400; color: var(--ink-soft); font-size: .76rem; }
.kal-farbfeld { width: 42px; height: 42px; border-radius: 50%; padding: 0; background: var(--farbe); }
.kal-farbe-eigen {
  width: 42px; height: 42px; border-radius: 50%; margin: 0 !important; overflow: hidden; position: relative; cursor: pointer;
  border: 2px dashed var(--ink-faint); background: conic-gradient(#F06D5E, #E0A33A, #6B7F5A, #6FA8A8, #B69BD6, #F06D5E);
}
.kal-farbe-eigen input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.kal-bildfeld { width: 58px; height: 58px; padding: 0; background: #fff center / cover; }
.kal-ohne { background: linear-gradient(135deg, transparent 47%, var(--ink-faint) 47% 53%, transparent 53%), #fff; }
.kal-eigen { font-size: 1.6rem; color: var(--ink-soft); font-weight: 400; }
.kal-regler { margin-top: 14px !important; }
.kal-regler input { width: 100%; accent-color: var(--coral-deep); }
.kal-regler small { display: block; font-weight: 400; color: var(--ink-soft); }
.kal-app-hinweis { display: flex; gap: 12px; align-items: center; margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--sage-light); font-size: .9rem; }
.kal-app-hinweis img { width: 40px; height: auto; flex: none; transform: rotate(-8deg); }
.kal-app-hinweis a { color: var(--coral-deep); font-weight: 600; }

/* Vorschau */
.kal-vorschau-box { position: sticky; top: 90px; text-align: center; }
.kal-blaettern { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.kal-blaettern span { font-weight: 600; font-size: .95rem; }
.kal-blaettern button {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ink-faint); background: var(--card);
  font-size: 1.6rem; line-height: 1; color: var(--ink); cursor: pointer;
}
.kal-blaettern button:hover { border-color: var(--coral-deep); color: var(--coral-deep); }
.kal-vorschau {
  display: block; width: 100%; height: auto; border-radius: 4px; background: #FFFDF6;
  box-shadow: 0 18px 36px -18px rgba(74,63,46,0.55), 0 0 0 1px rgba(206,197,182,0.6);
}
.kal-pdf { margin-top: 20px; width: 100%; justify-content: center; }
.kal-pdf:disabled { opacity: .6; cursor: progress; transform: none; }
.kal-status { margin-top: 10px; font-size: .92rem; color: var(--ink-soft); min-height: 1.4em; }
.kal-status.fehler { color: var(--coral-deep); font-weight: 600; }
.kal-danach { position: relative; text-align: left; background: var(--sage-light); border-radius: 16px; padding: 16px 18px; margin-top: 8px; }
.kal-danach p { font-size: .92rem; margin: 6px 0 12px; }

@media (max-width: 900px) {
  .kal-werkzeug, .kal-werkzeug[data-format="quer"] { grid-template-columns: minmax(0, 1fr); }
  .kal-vorschau-box { position: static; max-width: 460px; margin: 0 auto; width: 100%; }
}
@media (max-width: 520px) {
  .kal-sticker-hero { width: 60px; top: -22px; right: 6px; }
  .kal-werkzeug { padding: 0 16px; }
  .kal-reihe { grid-template-columns: 1fr; }
  .kal-block { padding: 14px 14px 16px; }
  .kal-format { flex-direction: column; }
  .kal-geburtstage li { grid-template-columns: minmax(0, 1fr) 34px; }
  .kal-geburtstage li input[type="date"] { grid-column: 1; grid-row: 2; }
}

/* Einbinden-Kasten auf der Hauptseite */
.kal-einbetten { display: grid; gap: 10px; justify-items: start; margin: 6px 0 12px; }
.kal-einbetten textarea {
  width: 100%; font: .82rem/1.45 ui-monospace, Consolas, monospace; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--ink-faint); border-radius: 12px; padding: 12px; resize: vertical;
}
.kal-tipp code, .kal-text code { font-size: .88em; background: var(--gold-light); padding: 1px 5px; border-radius: 5px; }

/* Eingebettete Fassung (kalender-vorlage/einbetten): ohne Kopfzeile, Vorschau zuerst */
.kal-einbettung { padding: 10px 0 20px; }
.kal-einbettung::before, .kal-einbettung::after { display: none; }
.kal-quelle { margin: 0 auto 8px; padding: 0 16px; max-width: var(--wrap); font-size: .85rem; color: var(--ink-soft); text-align: center; }
.kal-quelle a { color: var(--coral-deep); font-weight: 600; }
.kal-einbettung .kal-werkzeug { margin-top: 0; }
.kal-einbettung .kal-vorschau-box { top: 12px; }
.kal-pdf-link { color: var(--coral-deep); font-weight: 600; }

/* Übernahme aus einem Kritzelschatz-Backup */
.kal-backup { margin: 16px 0 4px; border-radius: 14px; background: var(--sage-light); }
.kal-backup summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none;
  font-size: .95rem; line-height: 1.35;
}
.kal-backup summary::-webkit-details-marker { display: none; }
.kal-backup summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; color: var(--ink-soft); line-height: 1; }
.kal-backup[open] summary::after { content: "−"; }
.kal-backup summary:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 14px; }
.kal-backup summary img { width: 32px; height: auto; flex: none; transform: rotate(-8deg); }
.kal-backup-inhalt { padding: 0 14px 14px 56px; }
.kal-schritte { margin: 0 0 8px; padding-left: 1.2em; font-size: .92rem; }
.kal-schritte li { margin-bottom: 4px; }
.kal-backup .kal-tipp { margin: 4px 0 10px; }
.kal-block .kal-dateiknopf-backup { display: inline-flex; cursor: pointer; margin-top: 0; }
.kal-dateiknopf-backup:focus-within { outline: 3px solid var(--teal); outline-offset: 3px; }
.kal-backup-wahl { margin-top: 12px; }
.kal-backup-wahl label { margin: 0 0 10px; }
.kal-backup-galerie {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px;
  max-height: 380px; overflow-y: auto; padding: 4px; margin: 0 -4px;
}
.kal-backup-bild {
  display: flex; flex-direction: column; gap: 4px; padding: 4px; cursor: pointer; text-align: left;
  border: 2px solid transparent; border-radius: 12px; background: #fff; font: inherit; color: var(--ink);
}
.kal-backup-bild:hover { border-color: var(--sage); }
.kal-backup-bild:focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; }
.kal-backup-bild:disabled { opacity: .6; cursor: progress; }
.kal-backup-bild.benutzt { border-color: var(--coral-deep); }
.kal-backup-mini { display: block; aspect-ratio: 3 / 4; border-radius: 8px; background: var(--page) center / cover no-repeat; }
.kal-backup-bild small { font-size: .72rem; line-height: 1.25; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) { .kal-backup-inhalt { padding-left: 14px; } }

/* Fortschrittsbalken beim Lesen des Backups */
.kal-fortschritt { display: grid; gap: 6px; margin: 12px 0 4px; font-size: .88rem; color: var(--ink-soft); }
.kal-fortschritt progress { width: 100%; height: 10px; accent-color: var(--coral-deep); }
