/* ==========================================================================
   IT-Sicherheits-Checklisten-Generator – Stylesheet
   Heller Apple-Stil, keine externen Ressourcen. Enthält am Ende ein
   eigenes A4-Druck-Layout für "Als PDF speichern".
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --line: #d2d2d7;
  --green: #1a7f37;

  --radius-card: 22px;
  --radius-item: 14px;
  --radius-pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 64px 16px 56px;
}

.intro {
  text-align: center;
  margin-bottom: 40px;
}

/* Nach der Startansicht: Kopf kompakter, ohne Einleitungstext */
body:not([data-view="start"]) .intro {
  margin-bottom: 28px;
}

body:not([data-view="start"]) .intro .lead {
  display: none;
}

body:not([data-view="start"]) .intro h1 {
  font-size: clamp(24px, 4.6vw, 32px);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(30px, 6.4vw, 48px);
}

h2 {
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.15;
}

h3 {
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2:focus {
  outline: none;
}

.lead {
  margin: 16px auto 0;
  max-width: 620px;
  font-size: clamp(17px, 2.6vw, 21px);
  color: var(--text-2);
}

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 40px;
}

.card + .card {
  margin-top: 16px;
}

.section-title {
  margin-bottom: 6px;
}

.section-sub {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--text-2);
}

/* Übergang zwischen den Ansichten */
.stage-enter {
  animation: stageIn 0.4s var(--ease) both;
}

.stage-leave {
  animation: stageOut 0.18s var(--ease) both;
}

@keyframes stageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@keyframes stageOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Startansicht ---------- */

.start .section-title {
  text-align: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 32px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: var(--bg);
  border-radius: var(--radius-item);
}

.steps strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.steps span:not(.step-num) {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.step-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.start-cta {
  text-align: center;
}

.start-hint {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- Schrittanzeige ---------- */

.progress {
  margin-bottom: 16px;
}

.progress.is-hidden {
  display: none;
}

.progress-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-label {
  font-weight: 600;
}

.progress-area,
.progress-pct {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

/* ---------- Auswahlschritte ---------- */

.step-label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.step-title {
  font-size: clamp(21px, 4.2vw, 28px);
  line-height: 1.2;
}

.step-sub {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--text-2);
}

.choice-list {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.choice-list--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-list--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-item);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.choice:hover {
  border-color: var(--text-3);
}

/* Native Eingabefelder visuell ersetzen, aber zugänglich lassen */
.choice input,
.item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choice-mark {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  transition: border-color 0.2s var(--ease), border-width 0.2s var(--ease), background-color 0.2s var(--ease);
}

.choice--checkbox .choice-mark {
  border-radius: 6px;
}

.choice-text {
  min-width: 0;
}

.choice-title {
  display: block;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.choice-desc {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.choice.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.choice--radio.is-selected .choice-mark {
  border-color: var(--accent);
  border-width: 6px;
}

.choice--checkbox.is-selected .choice-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.choice--checkbox.is-selected .choice-mark::after,
.item.is-done .box::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.choice input:focus-visible ~ .choice-mark,
.item input:focus-visible ~ .box {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

/* Unternehmensgröße: kompakte, zentrierte Felder */
.choice-list--4 .choice {
  justify-content: center;
  padding: 14px 10px;
}

.choice-list--4 .choice-mark {
  display: none;
}

.choice-list--4 .choice input:focus-visible ~ .choice-text {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

/* "Zurück" / "Auswahl ändern" als ruhiger Textlink */
.btn-link {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-left: 4px;
  padding-right: 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.actions > .btn-primary {
  margin-left: auto;
}

.btn-large {
  min-height: 50px;
  padding: 14px 32px;
}

.actions-result {
  justify-content: flex-start;
  margin-top: 20px;
}

.actions-result > .btn-primary {
  margin-left: 0;
}

/* ---------- Checkliste: Kopf ---------- */

.list-meta {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.list-title {
  font-size: clamp(22px, 4.4vw, 30px);
  line-height: 1.2;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.list-sub {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--text-2);
}

.progress-box {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--bg);
  border-radius: var(--radius-item);
}

.progress-box .progress-label {
  font-size: 16px;
}

.progress-box .progress-track {
  height: 8px;
  background: #e8e8ed;
}

.progress-box .progress-bar {
  background: var(--green);
  transition: width 0.3s var(--ease);
}

.head-tools {
  margin-top: 24px;
}

.company-field {
  display: block;
}

.company-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-2);
}

.company-field input {
  width: 100%;
  max-width: 420px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font: inherit;
  color: var(--text);
}

.company-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

/* ---------- Checkliste: Kategorien und Punkte ---------- */

.category {
  padding: 32px 40px;
}

.category-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.category-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.category-num {
  flex: none;
  position: relative;
  top: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 26px;
  text-align: center;
}

.category-count {
  flex: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.category-intro {
  margin: 6px 0 16px 36px;
  font-size: 14px;
  color: var(--text-2);
}

.items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.items li + li {
  margin-top: 8px;
}

.item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-item);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}

.item:hover {
  background: #fbfbfd;
}

/* Eigene Checkbox – im Druck zuverlässig sichtbar */
.box {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--text-3);
  border-radius: 6px;
  background: var(--bg);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.item.is-done .box {
  border-color: var(--green);
  background: var(--green);
}

.item.is-done .box::after {
  left: 6.5px;
  top: 2.5px;
}

.item-body {
  min-width: 0;
}

.item-task {
  display: block;
  font-weight: 600;
  line-height: 1.35;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}

.item-why {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}

.item-ref {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
}

/* Erledigt: Text zurückgenommen, bleibt aber gut lesbar */
.item.is-done .item-task {
  color: var(--text-2);
}

/* ---------- Abschluss ---------- */

.disclaimer {
  margin: 16px 0 0;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-item);
  font-size: 14px;
  color: var(--text-2);
}

.disclaimer strong {
  color: var(--text);
}

.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  margin: 32px auto 0;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

.trust-icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: var(--green);
}

/* Druckelemente auf dem Bildschirm ausblenden */
.print-header,
.print-closing {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .stage-enter,
  .stage-leave {
    animation: none;
  }
  .progress-bar {
    transition: none;
  }
}

/* ---------- Kleine Bildschirme ---------- */

@media screen and (max-width: 680px) {
  .page {
    padding-top: 40px;
  }

  .intro {
    margin-bottom: 28px;
  }

  .card,
  .category {
    padding: 28px 20px;
  }

  .steps,
  .choice-list--2 {
    grid-template-columns: 1fr;
  }

  .choice-list--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice {
    padding: 14px;
    gap: 12px;
  }

  .category-intro {
    margin-left: 0;
  }

  .item {
    gap: 12px;
    padding: 14px;
  }

  .item-task {
    font-size: 16px;
  }
}

@media screen and (max-width: 420px) {
  /* Auswahl: "Weiter" oben, "Zurück" darunter */
  .actions:not(.actions-result) {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .actions > .btn-primary {
    margin-left: 0;
  }

  .actions-result .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Druck-Layout ("Als PDF speichern")
   A4-Checkliste mit Kopf (Titel, Name, Datum) und Fußzeile in den
   Seitenrändern. Abgehakte Punkte: gefülltes Kästchen mit Haken;
   offene Punkte: leeres Kästchen zum Abhaken mit Stift.
   ========================================================================== */

/* Fußzeile in den Seitenrändern: wiederholt sich auf jeder Seite, ohne
   Inhalte zu überdecken (Chrome, Edge, Brave; andere Browser zeigen
   stattdessen die Abschlusszeile .print-closing). */
@page {
  size: A4;
  margin: 16mm 15mm 18mm;

  @bottom-left {
    content: "Erstellt mit boecker-advisory.de";
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 8pt;
    color: #86868b;
  }

  @bottom-right {
    content: "Seite " counter(page) " von " counter(pages);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 8pt;
    color: #86868b;
  }
}

@media print {
  :root {
    --surface: #ffffff;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-size: 10pt;
    line-height: 1.38;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  /* Bedienelemente und Bildschirm-Kopf ausblenden */
  .intro,
  .progress,
  .no-print,
  .actions,
  .trust,
  .list-head {
    display: none !important;
  }

  .stage-enter,
  .stage-leave {
    animation: none !important;
  }

  /* Kopf */
  .print-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1.5pt solid var(--text);
  }

  .print-title {
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
  }

  .print-context {
    margin-top: 3px;
    font-size: 9pt;
    color: var(--text-2);
  }

  .print-meta {
    flex: none;
    text-align: right;
  }

  .print-name {
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .print-date {
    font-size: 9pt;
    color: var(--text-2);
  }

  .print-closing {
    display: block;
    margin: 8px 0 0;
    font-size: 8pt;
    color: var(--text-3);
    text-align: right;
  }

  /* Kategorien: nicht zerteilen, feine Linie statt grauer Fläche */
  .card,
  .category {
    padding: 10px 14px;
    border: 0.75pt solid var(--line);
    border-radius: 10px;
  }

  .category {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .card + .card {
    margin-top: 8px;
  }

  .category-title {
    font-size: 12pt;
  }

  .category-num {
    top: 0;
    width: 18px;
    height: 18px;
    font-size: 8.5pt;
    line-height: 17px;
    background: #ffffff;
    border: 0.75pt solid var(--accent);
  }

  .category-count {
    font-size: 9pt;
  }

  .category-intro {
    margin: 2px 0 6px 28px;
    font-size: 8.5pt;
  }

  .items li + li {
    margin-top: 0;
  }

  .item {
    gap: 10px;
    padding: 5px 0 5px 2px;
    border-top: 0.5pt solid var(--line);
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .box {
    width: 4.2mm;
    height: 4.2mm;
    margin-top: 0.5px;
    border: 1pt solid var(--text);
    border-radius: 3px;
  }

  /* Abgehakt: schwarz gefüllt mit weißem Haken – auch in Graustufen eindeutig */
  .item.is-done .box {
    border-color: var(--text);
    background: var(--text);
  }

  .item.is-done .box::after {
    left: 4.2px;
    top: 1px;
    width: 4px;
    height: 8px;
  }

  .item-task {
    font-size: 10pt;
  }

  /* Erklärung und Referenz in einer Zeile – spart Platz je Punkt */
  .item-why {
    display: inline;
    font-size: 8.5pt;
    line-height: 1.35;
  }

  .item-ref {
    display: inline;
    margin: 0 0 0 6px;
    font-size: 7.5pt;
    white-space: nowrap;
  }

  .disclaimer {
    margin-top: 10px;
    padding: 8px 12px;
    border: 0.75pt solid var(--line);
    font-size: 8.5pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
