/* Welcome-Canvas (Gründ-Ding): Kacheln mit Füllstand und Flip auf die Leitfragen.
   Grundlage: Entwurf bammel-canvas.css (Desktop/bammel-canvas.zip), Tokens auf die Gründ-Ding-Farben (--bm-*) gemappt.
   Ergänzt: Vorschlagsschicht (--bc-vor): was Gründling vorschlägt, steht transparent grün, bis die Person es übernimmt. */
/* ==========================================================================
   Bammel – Canvas-Kacheln mit Füllstand und Flip auf Leitfragen
   --------------------------------------------------------------------------
   Struktur je Kachel:
   <article class="bc-tile" data-field="partner" style="--bc-fill: 0.4" tabindex="0">
     <div class="bc-tile__inner">
       <div class="bc-tile__face bc-tile__front"> … </div>
       <div class="bc-tile__face bc-tile__back">  … </div>
     </div>
   </article>
   --bc-fill: 0 … 1  (Anteil beantworteter Leitfragen)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design-Tokens
   Alle Werte zuerst auf bestehende Tokens der Seite mappen (siehe Prompt).
   Die Fallbacks entsprechen dem Referenzbild.
   -------------------------------------------------------------------------- */
.bc-canvas {
  --bc-font:            var(--bm-font);
  --bc-text:            var(--bm-text);
  --bc-text-muted:      var(--bm-text2);
  --bc-tile-bg:         #ececea;
  --bc-tile-border:     rgba(255, 255, 255, 0.9);
  --bc-tile-back-bg:    #ffffff;
  --bc-icon-bg:         #f6f6f5;
  --bc-fill-top:        #9fd3b0;
  --bc-fill-bottom:     var(--bm-gruen);
  --bc-vor:             rgba(30, 127, 69, .16);
  --bc-accent:          var(--bm-gruen);
  --bc-radius:          var(--bm-r);
  --bc-shadow:          0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.06);
  --bc-shadow-hover:    0 2px 4px rgba(0,0,0,.05), 0 14px 32px rgba(0,0,0,.10);
  --bc-focus:           var(--bm-blau);
  --bc-gap:             14px;
  --bc-tile-min:        140px;
  --bc-flip-duration:   600ms;
  --bc-fill-duration:   900ms;
  --bc-hover-delay:     150ms;
  font-family: var(--bc-font);
  color: var(--bc-text);
}

/* --------------------------------------------------------------------------
   2. Raster (Desktop): BMC-Lage + Zusatzfelder
   Feld-Keys über data-field; Bereiche über grid-template-areas.
   -------------------------------------------------------------------------- */
.bc-canvas {
  display: grid;
  gap: var(--bc-gap);
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-auto-rows: minmax(var(--bc-tile-min), auto);
  grid-template-areas:
    "pa pa ak ak wa wa kb kb ks ks"
    "pa pa rs rs wa wa ka ka pr pr"
    "pa pa rs rs wa wa gr gr pr pr"
    "ko ko ko ko ko ei ei ei ei ei"
    "er er er er er au au au au au";
}

.bc-tile[data-field="partner"]      { grid-area: pa; }
.bc-tile[data-field="aktivitaeten"] { grid-area: ak; }
.bc-tile[data-field="ressourcen"]   { grid-area: rs; }
.bc-tile[data-field="wertangebot"]  { grid-area: wa; }
.bc-tile[data-field="beziehungen"]  { grid-area: kb; }
.bc-tile[data-field="kanaele"]      { grid-area: ka; }
.bc-tile[data-field="wachstum"]     { grid-area: gr; }
.bc-tile[data-field="segmente"]     { grid-area: ks; }
.bc-tile[data-field="problem"]      { grid-area: pr; }
.bc-tile[data-field="kosten"]       { grid-area: ko; }
.bc-tile[data-field="einnahmen"]    { grid-area: ei; }
.bc-tile[data-field="erfolg"]       { grid-area: er; }
.bc-tile[data-field="wirkung"]      { grid-area: au; }

/* --------------------------------------------------------------------------
   3. Kachel und 3D-Flip
   -------------------------------------------------------------------------- */
.bc-tile {
  position: relative;
  min-height: var(--bc-tile-min);
  perspective: 1400px;
  border-radius: var(--bc-radius);
  outline: none;
  cursor: pointer;
}

.bc-tile__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transform-style: preserve-3d;
  transition: transform var(--bc-flip-duration) cubic-bezier(.2, .7, .2, 1);
  transition-delay: 0ms;
}

.bc-tile__face {
  position: absolute;
  inset: 0;
  border-radius: var(--bc-radius);
  border: 1px solid var(--bc-tile-border);
  box-shadow: var(--bc-shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* Flip-Auslöser: Hover nur auf echten Zeigegeräten, sonst Fokus/Tap */
@media (hover: hover) and (pointer: fine) {
  .bc-tile:hover .bc-tile__inner {
    transform: rotateY(180deg);
    transition-delay: var(--bc-hover-delay);
  }
  .bc-tile:hover .bc-tile__face { box-shadow: var(--bc-shadow-hover); }
}
.bc-tile:focus-visible .bc-tile__inner,
.bc-tile.is-flipped .bc-tile__inner {
  transform: rotateY(180deg);
}
.bc-tile:focus-visible .bc-tile__face {
  box-shadow: 0 0 0 3px var(--bc-focus), var(--bc-shadow-hover);
}

/* --------------------------------------------------------------------------
   4. Vorderseite: Icon, Titel, Füllstand
   -------------------------------------------------------------------------- */
.bc-tile__front {
  background: var(--bc-tile-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(16px, 2.2vw, 28px) 16px 16px;
  text-align: center;
}

.bc-tile__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(clamp(0, var(--bc-fill, 0), 1) * 100%);
  background: linear-gradient(180deg, var(--bc-fill-top), var(--bc-fill-bottom));
  transition: height var(--bc-fill-duration) cubic-bezier(.2, .7, .2, 1);
  z-index: 0;
}

/* dezente Kante auf der Füllhöhe, damit der Stand auch bei 5–10 % lesbar ist */
.bc-tile__fill::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: rgba(255, 255, 255, .55);
}

.bc-tile__head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bc-tile__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bc-icon-bg);
  color: var(--bc-text);
}
.bc-tile__icon svg { width: 30px; height: 30px; stroke-width: 1.6; }

.bc-tile__title {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--bc-text);
  hyphens: auto;
}

.bc-tile__pct {
  position: absolute;
  z-index: 1;
  right: 12px;
  bottom: 10px;
  font-size: .8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--bc-text);
  opacity: .75;
}

/* Breite, niedrige Kacheln (Kosten, Einnahmen, Erfolg, Wirkung): Icon + Titel nebeneinander */
.bc-tile[data-field="kosten"] .bc-tile__head,
.bc-tile[data-field="einnahmen"] .bc-tile__head,
.bc-tile[data-field="erfolg"] .bc-tile__head,
.bc-tile[data-field="wirkung"] .bc-tile__head {
  flex-direction: row;
  gap: 16px;
}
.bc-tile[data-field="kosten"] .bc-tile__front,
.bc-tile[data-field="einnahmen"] .bc-tile__front,
.bc-tile[data-field="erfolg"] .bc-tile__front,
.bc-tile[data-field="wirkung"] .bc-tile__front {
  justify-content: center;
  padding-top: 16px;
}

/* --------------------------------------------------------------------------
   5. Rückseite: Leitfragen
   -------------------------------------------------------------------------- */
.bc-tile__back {
  transform: rotateY(180deg);
  background: var(--bc-tile-back-bg);
  display: flex;
  flex-direction: column;
  padding: 16px 16px 12px;
  text-align: left;
}

.bc-tile__back-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bc-tile__back-title {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
}
.bc-tile__back-count {
  font-size: .78rem;
  color: var(--bc-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bc-questions {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
}
.bc-questions li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  font-size: .85rem;
  line-height: 1.35;
  border-top: 1px solid rgba(0, 0, 0, .07);
}
.bc-questions li:first-child { border-top: 0; }

/* Status-Marker: offen = Kreis, beantwortet = Haken, Test = Kolben */
.bc-questions li::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid var(--bc-text-muted);
  box-sizing: border-box;
}
.bc-questions li.is-done { color: var(--bc-text-muted); }
.bc-questions li.is-done::before {
  border-color: var(--bc-accent);
  background:
    var(--bc-accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}
.bc-questions li.is-test {
  font-weight: 600;
  color: var(--bc-text);
}
.bc-questions li.is-test::before {
  border-radius: 4px;
  border-style: dashed;
  border-color: var(--bc-accent);
}

.bc-tile__cta {
  margin-top: 10px;
  align-self: flex-start;
  font-size: .85rem;
  font-weight: 600;
  color: var(--bc-accent);
  text-decoration: none;
}
.bc-tile__cta:hover,
.bc-tile__cta:focus-visible { text-decoration: underline; }

/* --------------------------------------------------------------------------
   6. Responsiv
   -------------------------------------------------------------------------- */

/* Tablet: zweispaltig, Reihenfolge = Bearbeitungsreihenfolge (order via data-order) */
@media (max-width: 1100px) {
  .bc-canvas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: none;
    grid-auto-rows: minmax(200px, auto);
  }
  .bc-tile { grid-area: auto !important; order: var(--bc-order, 0); }
}

/* Mobil: Liste ohne 3D. Tap klappt die Leitfragen unter der Kachel auf. */
@media (max-width: 640px) {
  .bc-canvas {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 10px;
  }
  .bc-tile { perspective: none; min-height: 0; }
  .bc-tile__inner,
  .bc-tile:hover .bc-tile__inner,
  .bc-tile.is-flipped .bc-tile__inner,
  .bc-tile:focus-visible .bc-tile__inner { transform: none; transition: none; }

  .bc-tile__face { position: relative; inset: auto; backface-visibility: visible; }
  .bc-canvas .bc-tile[data-field] .bc-tile__front {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 56px 12px 12px;
    min-height: 72px;
  }
  .bc-canvas .bc-tile[data-field] .bc-tile__head { flex-direction: row; gap: 12px; }
  .bc-tile__icon { width: 44px; height: 44px; }
  .bc-tile__icon svg { width: 22px; height: 22px; }
  .bc-tile__title { font-size: 1rem; text-align: left; }
  .bc-tile__pct { top: 50%; bottom: auto; transform: translateY(-50%); }

  /* Füllstand mobil horizontal: liest sich in einer Liste besser */
  .bc-tile__fill {
    top: 0;
    height: 100%;
    width: calc(clamp(0, var(--bc-fill, 0), 1) * 100%);
    background: linear-gradient(90deg, var(--bc-fill-top), var(--bc-fill-bottom));
    transition: width var(--bc-fill-duration) cubic-bezier(.2, .7, .2, 1);
  }
  .bc-tile__fill::before { inset: 0 0 0 auto; width: 1px; height: auto; }

  .bc-tile__back {
    transform: none;
    display: none;
    margin-top: 6px;
    max-height: none;
  }
  .bc-tile.is-flipped .bc-tile__back { display: flex; }
}

/* --------------------------------------------------------------------------
   7. Reduzierte Bewegung: Überblenden statt Drehen
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) and (min-width: 641px) {
  .bc-tile__inner,
  .bc-tile:hover .bc-tile__inner,
  .bc-tile.is-flipped .bc-tile__inner,
  .bc-tile:focus-visible .bc-tile__inner { transform: none; transition: none; }
  .bc-tile__back { transform: none; opacity: 0; transition: opacity 150ms linear; }
  .bc-tile__front { transition: opacity 150ms linear; }
  .bc-tile.is-flipped .bc-tile__back,
  .bc-tile:focus-visible .bc-tile__back { opacity: 1; }
  .bc-tile.is-flipped .bc-tile__front,
  .bc-tile:focus-visible .bc-tile__front { opacity: 0; }
  @media (hover: hover) and (pointer: fine) {
    .bc-tile:hover .bc-tile__back { opacity: 1; }
    .bc-tile:hover .bc-tile__front { opacity: 0; }
  }
  .bc-tile__fill { transition: none; }
}

/* --------------------------------------------------------------------------
   8. Welcome-Ergänzungen: Vorschlagsschicht, Leitfragen mit Vorschlag, Detailbereich
   -------------------------------------------------------------------------- */
.bc-tile__vorschlag {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 0;
  height: calc(clamp(0, var(--bc-vor-h, 0), 1) * 100%);
  background: repeating-linear-gradient(135deg, var(--bc-vor) 0 8px, rgba(30,127,69,.10) 8px 16px);
  border-top: 1px dashed rgba(30,127,69,.45);
  transition: height var(--bc-fill-duration) cubic-bezier(.2, .7, .2, 1);
}
.bc-tile__fill { z-index: 0; }
.bc-tile__neu { position: absolute; z-index: 1; left: 12px; bottom: 10px; font: 600 11px var(--bc-font); color: var(--bm-gruen); background: rgba(255,255,255,.85); border-radius: 999px; padding: 2px 8px; }
.bc-questions li.is-vor { color: var(--bc-text); }
.bc-questions li.is-vor::before { border-style: dashed; border-color: var(--bc-accent); background: var(--bc-vor); }
.bc-tile__cta { border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; }
@media (max-width: 640px) {
  .bc-tile__vorschlag { top: 0; height: 100%; width: calc(clamp(0, var(--bc-vor-h, 0), 1) * 100%); border-top: 0; border-right: 1px dashed rgba(30,127,69,.45); }
  .bc-tile__neu { left: auto; right: 56px; bottom: auto; top: 50%; transform: translateY(-50%); }
}
/* Füllhöhe direkt in Prozent: calc(clamp(…) * 100%) rechnet Chrome beim Neuberechnen der Größe falsch */
.bc-tile__fill { height: var(--bc-fill-p, 0%); }
.bc-tile__vorschlag { height: var(--bc-vor-p, 0%); }
@media (max-width: 640px) {
  .bc-tile__fill { height: 100%; width: var(--bc-fill-p, 0%); }
  .bc-tile__vorschlag { height: 100%; width: var(--bc-vor-p, 0%); }
}
.bc-tile__vorschlag { border-top: 0; }
@media (max-width: 640px) { .bc-tile__vorschlag { border-right: 0; } }
/* Klicks: die unsichtbare Vorderseite darf der gedrehten Rückseite keine Klicks wegnehmen */
.bc-tile__back { pointer-events: none; }
.bc-tile.is-flipped .bc-tile__back, .bc-tile:focus-visible .bc-tile__back { pointer-events: auto; }
.bc-tile.is-flipped .bc-tile__front, .bc-tile:focus-visible .bc-tile__front { pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .bc-tile:hover .bc-tile__back { pointer-events: auto; }
  .bc-tile:hover .bc-tile__front { pointer-events: none; }
}
@media (max-width: 640px) { .bc-tile__back, .bc-tile__front { pointer-events: auto; } }
.bc-questions li[data-cvfrage] { cursor: pointer; border-radius: 6px; }
.bc-questions li[data-cvfrage]:hover { background: rgba(30,127,69,.06); }
/* Feld gerade vollständig geworden: Füllung läuft hoch, Kachel leuchtet kurz */
.bc-tile.wl-voll .bc-tile__fill { transition: height 1.4s cubic-bezier(.2, .7, .2, 1); }
.bc-tile.wl-voll .bc-tile__face { animation: wlVoll 1.6s ease-out 1; }
@keyframes wlVoll { 0% { box-shadow: 0 0 0 0 rgba(30,127,69,.0); } 30% { box-shadow: 0 0 0 6px rgba(30,127,69,.35); } 100% { box-shadow: 0 0 0 0 rgba(30,127,69,0); } }
.wl-voll-marke { position: absolute; z-index: 2; top: 10px; right: 10px; font: 700 12px var(--bc-font); color: #fff; background: var(--bm-gruen); border-radius: 999px; padding: 3px 10px; animation: wlMarke .5s ease-out 1.1s both; }
@keyframes wlMarke { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bc-tile.wl-voll .bc-tile__face, .wl-voll-marke { animation: none; } }
/* Vollständige Felder drehen nicht, sie zeigen beim Darüberfahren ihre Antworten als Karte */
.bc-tile.ist-voll .bc-tile__inner, .bc-tile.ist-voll:hover .bc-tile__inner, .bc-tile.ist-voll.is-flipped .bc-tile__inner { transform: none; }
.bc-tile.ist-voll .bc-tile__back { display: none; }
.bc-tile.ist-voll .bc-tile__front { pointer-events: auto !important; }
.wl-cv-pop { position: fixed; z-index: 120; width: min(420px, calc(100vw - 16px)); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid #cfe6d6; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.18); padding: 14px 16px; font-family: var(--bm-font); color: var(--bm-text); pointer-events: none; animation: wlPop .15s ease-out; }
@keyframes wlPop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.wl-cv-pop-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.wl-cv-pop-kopf b { font: 700 16px var(--bm-font); }
.wl-cv-pop-kopf span { font: 700 11.5px var(--bm-font); color: #fff; background: var(--bm-gruen); border-radius: 999px; padding: 3px 10px; }
.wl-cv-pop dl { margin: 0; display: grid; gap: 2px; }
.wl-cv-pop dt { font: 600 12px var(--bm-font); color: var(--bm-text2); margin-top: 8px; }
.wl-cv-pop dt:first-child { margin-top: 0; }
.wl-cv-pop dd { margin: 0; font: 400 14.5px/1.45 var(--bm-font); padding-left: 10px; border-left: 3px solid var(--bm-gruen-hell); }
.wl-cv-pop small { display: block; margin-top: 10px; color: var(--bm-text2); font-size: 12px; }

/* Kacheln ohne Überlagerung: Fußzeile im Fluss (Vorschläge links, Prozent rechts); bei wenig Höhe Symbol und Titel nebeneinander */
.bc-tile__front { container-type: size; }
.bc-tile__fuss { position: relative; z-index: 1; margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; }
.bc-tile__fuss .bc-tile__pct, .bc-tile__fuss .bc-tile__neu { position: static; transform: none; }
@container (max-height: 250px) {
  .bc-tile__head { flex-direction: row; gap: 12px; align-items: center; }
  .bc-tile__icon { width: 44px; height: 44px; flex: none; }
  .bc-tile__icon svg { width: 22px; height: 22px; }
  .bc-tile__title { font-size: clamp(.95rem, 1.15vw, 1.15rem); text-align: left; }
}
@container (max-height: 150px) {
  .bc-tile__icon { width: 36px; height: 36px; }
  .bc-tile__fuss { padding-top: 4px; }
}
@media (max-width: 640px) {
  .bc-tile__fuss { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: auto; margin: 0; padding: 0; }
}
/* Vollständig, aber Gründling zweifelt, dass es trägt: Grün abgeschwächt, rötlicher Rand, kein Alarmrot */
.bc-tile.traegt-nicht .bc-tile__front { box-shadow: inset 0 0 0 2px #e3a9a0; }
.bc-tile.traegt-nicht .bc-tile__fill { opacity: .45; }
.bc-tile.traegt-nicht .bc-tile__pct { color: #a2483b; font-weight: 700; }
/* Relevanz für das Vorhaben: wichtig mit Stern, „kann warten“ zurückgenommen */
.bc-tile__rel { margin-left: auto; color: #1f7a44; font-weight: 800; }
.bc-tile__rel.leise { font-size: 11px; font-weight: 700; color: #8a968f; text-transform: uppercase; letter-spacing: .04em; }
.bc-tile.rel-spaeter .bc-tile__front { opacity: .55; }
.bc-tile.rel-wichtig .bc-tile__front { box-shadow: inset 0 0 0 2px #9fd3b4; }
/* Relevanz deutlicher: Wichtiges leuchtet, der Rest tritt zurück */
.bc-canvas.hat-relevanz .bc-tile { transition: opacity .25s, filter .25s; }
.bc-canvas.hat-relevanz .bc-tile:not(.rel-wichtig) .bc-tile__front { opacity: .62; filter: saturate(.6); }
.bc-canvas.hat-relevanz .bc-tile.rel-spaeter .bc-tile__front { opacity: .38; filter: grayscale(1); }
.bc-canvas.hat-relevanz .bc-tile:not(.rel-wichtig):hover .bc-tile__front { opacity: 1; filter: none; }
.bc-tile.rel-wichtig { z-index: 1; }
.bc-tile.rel-wichtig .bc-tile__front { opacity: 1; background-color: #fff; box-shadow: 0 0 0 3px #2e9e5b, 0 0 0 7px rgba(46,158,91,.16), 0 14px 32px -10px rgba(31,122,68,.45); }
.bc-tile.rel-wichtig .bc-tile__rel { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: #2e9e5b; color: #fff; font: 800 11.5px var(--bc-font, inherit); letter-spacing: .03em; white-space: nowrap; }
@keyframes bcGlow { 0%,100% { box-shadow: 0 0 0 3px #2e9e5b, 0 0 0 7px rgba(46,158,91,.16), 0 14px 32px -10px rgba(31,122,68,.45); } 50% { box-shadow: 0 0 0 3px #2e9e5b, 0 0 0 10px rgba(46,158,91,.08), 0 18px 40px -10px rgba(31,122,68,.55); } }
.bc-tile.rel-wichtig .bc-tile__front { animation: bcGlow 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .bc-tile.rel-wichtig .bc-tile__front { animation: none; } }
