/* app.css — all styles of the app. Values come only from tokens.css (design.md B1):
 * no colour value, no size outside the scale. Structure first, colour second, effects last. */

/* --- Base ------------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text-100);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p, ul, ol, dl, figure, blockquote { margin: 0; }
svg { display: block; max-width: 100%; }

a {
  color: var(--text-100);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  left: var(--space-md);
  top: calc(-1 * var(--space-2xl));
  z-index: 10;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-0);
  border-radius: var(--r-sm);
  font-weight: 700;
}
.skip-link:focus { top: var(--space-sm); }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-md);
}
@media (min-width: 768px) {
  .container { padding: 0 var(--space-lg); }
}

/* --- Frame ------------------------------------------------------------------------------ */

.site-header { border-bottom: 1px solid var(--border-soft); }
.site-header .container { display: flex; align-items: center; min-height: var(--space-2xl); }

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
}
.brand:hover { text-decoration: underline; }

.site-main { padding-top: var(--space-xl); padding-bottom: var(--space-2xl); }
.site-main:focus { outline: none; }

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: var(--space-lg) 0;
  color: var(--text-200);
  font-size: var(--fs-sm);
}
.site-footer p { max-width: var(--reading); }

/* --- Buttons: primary, secondary, tertiary — each with hover, active, focus, disabled ------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }

.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }

.btn-large { min-height: 52px; padding: var(--space-sm) var(--space-xl); font-size: var(--fs-lg); }

.btn-secondary { background: transparent; color: var(--text-100); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-3); }

.btn-tertiary {
  background: transparent;
  color: var(--text-100);
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-tertiary:hover { text-decoration: underline; text-decoration-thickness: 2px; }

/* --- Surfaces --------------------------------------------------------------------------- */

.card { background: var(--bg-1); border-radius: var(--r-lg); padding: var(--space-lg); }
@media (min-width: 768px) {
  .card { padding: var(--space-xl); }
}

.section-title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--space-md); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--r-pill);
  background: var(--bg-3);
  color: var(--text-100);
  font-size: var(--fs-xs);
  font-weight: 400;
  line-height: 1.2;
}
.badge--lever { background: var(--bg-4); }

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-200);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.status__dot { width: 10px; height: 10px; border-radius: var(--r-pill); flex: none; }
.status--gruen .status__dot { background: var(--ok); }
.status--gelb .status__dot { background: var(--warn); }
.status--rot .status__dot { background: var(--error); }

.notice {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-md);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--text-100);
}
.notice__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  color: var(--bg-0);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.notice--warn .notice__icon { background: var(--warn); }
.notice--error { border-color: var(--error); }
.notice--error .notice__icon { background: var(--error); }
.notice--info { flex-direction: column; }
.notice--info ul { padding-left: var(--space-lg); }
.notice__title { font-size: var(--fs-md); font-weight: 700; }

/* --- Panels (native disclosure): the whole head is the target, the chevron only shows state */

.panel { border-top: 1px solid var(--border-soft); }
.panel__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 44px;
  padding: var(--space-md) 0;
  list-style: none;
  cursor: pointer;
}
.panel__summary::-webkit-details-marker { display: none; }
.panel__summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: var(--space-xs);
  border-right: 2px solid var(--text-100);
  border-bottom: 2px solid var(--text-100);
  transform: rotate(45deg);
  transition: transform var(--t) var(--ease);
}
.panel[open] > .panel__summary::after { transform: rotate(-135deg); }
.panel__summary:hover .panel__title { text-decoration: underline; }
.panel__title { font-size: var(--fs-lg); font-weight: 700; }
.panel__content { padding-bottom: var(--space-md); }

/* --- Start ------------------------------------------------------------------------------ */

.hero { max-width: var(--reading); margin-bottom: var(--space-xl); }
.hero__title { font-size: var(--fs-2xl); font-weight: 700; margin-bottom: var(--space-md); }
.hero__lead { font-size: var(--fs-lg); line-height: 1.45; color: var(--text-200); margin-bottom: var(--space-md); }

.byline { display: flex; align-items: center; gap: var(--space-sm); color: var(--text-200); font-size: var(--fs-sm); }
.byline__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--bg-3);
  color: var(--text-100);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.scan-form { max-width: 760px; display: flex; flex-direction: column; gap: var(--space-lg); }

.field { display: flex; flex-direction: column; gap: var(--space-sm); }
.field__label { padding: 0; font-weight: 700; color: var(--text-100); }
.field__input {
  width: 100%;
  min-height: 52px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--text-100);
  font: inherit;
  font-size: var(--fs-lg);
  transition: border-color var(--t-fast) var(--ease);
}
.field__input::placeholder { color: var(--text-400); }
.field__input:hover { border-color: var(--text-300); }
.field__input:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }
.field__input--invalid { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-100);
  box-shadow: 0 0 0 1000px var(--bg-2) inset;
}
.field__error { color: var(--error); font-size: var(--fs-sm); font-weight: 700; }
.field__hint { color: var(--text-200); font-size: var(--fs-sm); }

.variants { margin: 0; padding: 0; border: 0; }
.variants__grid { display: grid; grid-template-columns: 1fr; gap: var(--space-md); margin-top: var(--space-sm); }
@media (min-width: 640px) {
  .variants__grid { grid-template-columns: 1fr 1fr; }
}
.variant { position: relative; display: block; cursor: pointer; }
.variant__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.variant__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  height: 100%;
  padding: var(--space-md) var(--space-md) var(--space-md) var(--space-2xl);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-2);
  transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.variant__body::before {
  content: "";
  position: absolute;
  left: var(--space-md);
  top: var(--space-md);
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-300);
  border-radius: var(--r-pill);
  background: var(--bg-2);
}
.variant:hover .variant__body { background: var(--bg-3); }
.variant__input:checked + .variant__body { background: var(--bg-3); box-shadow: inset 0 0 0 2px var(--text-100); }
.variant__input:checked + .variant__body::before {
  border-color: var(--text-100);
  background: radial-gradient(circle, var(--text-100) 0 5px, var(--bg-2) 6px);
}
.variant__input:focus-visible + .variant__body { outline: 3px solid var(--border-focus); outline-offset: 2px; }
.variant__input:disabled + .variant__body { opacity: 0.5; cursor: not-allowed; }
.variant__title { font-weight: 700; }
.variant__text { color: var(--text-200); font-size: var(--fs-sm); }
.variant__meta { color: var(--text-300); font-size: var(--fs-sm); }

.scan-form__actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
.trust { color: var(--text-200); font-size: var(--fs-sm); }

.examples { max-width: 760px; margin-top: var(--space-xl); }
.examples__list { display: flex; flex-wrap: wrap; gap: var(--space-sm); padding: 0; list-style: none; }
.examples__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
}
.examples__link:hover { background: var(--bg-3); }

.howto { max-width: 760px; margin-top: var(--space-xl); }
.howto__steps { display: grid; gap: var(--space-sm); max-width: var(--reading); padding-left: var(--space-lg); }
.howto__subtitle { margin: var(--space-lg) 0 var(--space-sm); font-size: var(--fs-md); }
.howto__categories { display: grid; gap: var(--space-sm); max-width: var(--reading); }
.howto__categories dt { font-weight: 700; }
.howto__categories dd { margin: 0; color: var(--text-200); }

/* --- Progress, failure, empty ----------------------------------------------------------- */

.progress, .failed, .empty { max-width: 760px; }
.progress__title, .failed__title, .empty__title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--space-sm); }
.progress__meta { margin-bottom: var(--space-lg); color: var(--text-200); overflow-wrap: anywhere; }
.progress__hint { color: var(--text-200); font-size: var(--fs-sm); }
.progress__cancel { margin-top: var(--space-lg); }

.stages { display: grid; gap: var(--space-sm); margin-bottom: var(--space-lg); padding: 0; list-style: none; }
.stage {
  display: grid;
  grid-template-columns: var(--space-lg) 1fr;
  column-gap: var(--space-sm);
  align-items: center;
  min-height: 36px;
  color: var(--text-300);
}
.stage__marker {
  position: relative;
  justify-self: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-pill);
}
.stage__detail { grid-column: 2; color: var(--text-200); font-size: var(--fs-sm); font-weight: 400; }
.stage__detail:empty { display: none; }
.stage--done { color: var(--text-100); }
.stage--done .stage__marker { background: var(--ok); border-color: var(--ok); }
.stage--done .stage__marker::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border-right: 2px solid var(--bg-0);
  border-bottom: 2px solid var(--bg-0);
  transform: rotate(45deg);
}
.stage--active { color: var(--text-100); font-weight: 700; }
.stage--active .stage__marker {
  border-color: var(--border-focus);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.failed .notice { margin-top: var(--space-md); }
.failed__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); margin-top: var(--space-lg); }
.empty p + p { margin-top: var(--space-md); }

/* --- Result ----------------------------------------------------------------------------- */

.result-head { display: flex; flex-direction: column; gap: var(--space-md); margin-bottom: var(--space-lg); }
@media (min-width: 900px) {
  .result-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}
.result-head__title { font-size: var(--fs-xl); font-weight: 700; overflow-wrap: anywhere; }
.result-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  color: var(--text-200);
}
.result-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

.result-top { display: grid; gap: var(--space-lg); margin-bottom: var(--space-xl); }
@media (min-width: 1024px) {
  .result-top { grid-template-columns: 1fr 1fr; align-items: start; }
}

.score { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: var(--space-lg); }
.score-ring { position: relative; flex: none; width: 128px; height: 128px; }
.score-ring__svg { width: 100%; height: 100%; }
.score-ring__track { fill: none; stroke: var(--bg-4); stroke-width: 10; }
.score-ring__value { fill: none; stroke: var(--action); stroke-width: 10; stroke-linecap: round; }
.score-ring__value-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score__level { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; }

.overview { margin-bottom: var(--space-lg); }
.prose { max-width: var(--reading); }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: var(--space-sm); }
.prose ul { display: grid; gap: var(--space-xs); margin-top: var(--space-sm); padding-left: var(--space-lg); }

.lever { padding-top: var(--space-md); border-top: 1px solid var(--border-soft); }
.lever__title { margin-bottom: var(--space-xs); font-size: var(--fs-md); font-weight: 700; }
.lever__text { color: var(--text-200); }
.lever__label { color: var(--text-100); font-weight: 700; }

/* The card's own width decides which radar fits (container query), not the window. */
.radar-card { container-type: inline-size; }
.radar { width: 100%; height: auto; margin: 0 auto var(--space-sm); }
.radar a { text-decoration: none; }
.radar--wide { display: none; }
@container (min-width: 560px) {
  .radar--compact { display: none; }
  .radar--wide { display: block; }
}
.radar__ring { fill: none; stroke: var(--border-soft); stroke-width: 1; }
.radar__ring--outer { stroke: var(--border-strong); }
.radar__axis { stroke: var(--border-soft); stroke-width: 1; }
.radar__target { fill: none; stroke: var(--text-100); stroke-width: 2; stroke-dasharray: 6 5; }
.radar__value { fill: var(--action); fill-opacity: 0.18; stroke: var(--action); stroke-width: 3; stroke-linejoin: round; }
.radar__dot { stroke: var(--bg-0); stroke-width: 2; }
.radar__dot--gruen { fill: var(--ok); }
.radar__dot--gelb { fill: var(--warn); }
.radar__dot--rot { fill: var(--error); }
.radar__label { fill: var(--text-100); font-family: var(--font); }
.radar--compact .radar__label { font-size: 22px; }
.radar--wide .radar__label { font-size: 18px; }
.radar__num { font-weight: 700; }
.radar__score { fill: var(--text-200); }

.radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  color: var(--text-200);
  font-size: var(--fs-sm);
}
.radar-legend__item { display: inline-flex; align-items: center; gap: var(--space-xs); }
.radar-legend__line { width: var(--space-lg); height: 0; border-top: 3px solid var(--action); }
.radar-legend__line--target { border-top: 2px dashed var(--text-100); }

.levers { margin-bottom: var(--space-md); padding: 0; list-style: none; border-top: 1px solid var(--border-soft); }
.levers__item { border-bottom: 1px solid var(--border-soft); }
.levers__link {
  display: grid;
  grid-template-columns: var(--space-lg) 1fr auto;
  grid-template-areas: "num name score" ". status status";
  align-items: center;
  column-gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-xs);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
}
.levers__link:hover { background: var(--bg-3); }
.levers__link:hover .levers__name { text-decoration: underline; }
.levers__num { grid-area: num; color: var(--text-200); font-weight: 700; text-align: center; }
.levers__name { grid-area: name; }
.levers__link .status { grid-area: status; }
.levers__score { grid-area: score; min-width: 3ch; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
@container (min-width: 480px) {
  .levers__link { grid-template-columns: var(--space-lg) 1fr auto 3.5em; grid-template-areas: "num name status score"; }
}
.radar-card__note { color: var(--text-200); font-size: var(--fs-sm); }

.summary { margin-bottom: var(--space-xl); }
.summary__key {
  margin-bottom: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-left: 4px solid var(--text-100);
  border-radius: var(--r-md);
  background: var(--bg-1);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: 1.4;
}
.summary__key-label { display: block; margin-bottom: var(--space-xs); color: var(--text-200); font-size: var(--fs-sm); font-weight: 400; }
.summary__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-md); }
.summary__tile { padding: var(--space-md); border-radius: var(--r-md); background: var(--bg-1); }
.summary__tile-title { margin-bottom: var(--space-xs); font-size: var(--fs-md); font-weight: 700; }
.summary__tile p { color: var(--text-200); }

.details__head { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
.details__head .section-title { margin-bottom: 0; }
.details__quotes { color: var(--text-200); font-size: var(--fs-sm); }

.category-grid { display: grid; gap: var(--space-lg); }
@media (min-width: 1024px) {
  .category-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.category {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  scroll-margin-top: var(--space-lg);
  animation: appear var(--t) var(--ease) both;
}
.category:nth-child(2) { animation-delay: 30ms; }
.category:nth-child(3) { animation-delay: 60ms; }
.category:nth-child(4) { animation-delay: 90ms; }
.category:nth-child(5) { animation-delay: 120ms; }
.category:nth-child(6) { animation-delay: 150ms; }
.category:nth-child(7) { animation-delay: 180ms; }
.category:nth-child(8) { animation-delay: 210ms; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.category--lever { box-shadow: inset 0 0 0 2px var(--text-100); }
.category:target { box-shadow: inset 0 0 0 3px var(--border-focus); }

.category__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); }
.category__title { font-size: var(--fs-lg); font-weight: 700; }
.category__score { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.category__badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.category__question { color: var(--text-300); font-size: var(--fs-sm); }

.bar { width: 100%; height: 8px; }
.bar__track { fill: var(--bg-4); }
.bar__fill--gruen { fill: var(--ok); }
.bar__fill--gelb { fill: var(--warn); }
.bar__fill--rot { fill: var(--error); }

.quote {
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--bg-2);
}
.quote--small { padding: var(--space-xs) var(--space-sm); font-size: var(--fs-sm); }
.quote__text { font-style: italic; overflow-wrap: anywhere; }
.quote__caption { margin-top: var(--space-xs); color: var(--text-300); font-size: var(--fs-xs); }

.quickwin { padding: var(--space-sm) var(--space-md); border-radius: var(--r-md); background: var(--bg-3); }
.quickwin__label { font-size: var(--fs-sm); font-weight: 700; }

.criteria { margin-top: var(--space-xs); }
.criteria .panel__title { font-size: var(--fs-md); }
.criteria__list { display: grid; gap: var(--space-md); padding-left: 0; list-style: none; }
.criterion { display: grid; gap: var(--space-xs); }
.criterion__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); }
.criterion__text { font-size: var(--fs-sm); font-weight: 700; }
.criterion__score { font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.criterion__reason { color: var(--text-200); font-size: var(--fs-sm); }
.criterion__missing { color: var(--text-300); font-size: var(--fs-sm); }

.result-foot { display: grid; gap: var(--space-md); margin-top: var(--space-xl); }
.pages__title { margin-bottom: var(--space-xs); font-size: var(--fs-sm); font-weight: 700; }
.pages__list { display: grid; gap: var(--space-xs); padding: 0; list-style: none; color: var(--text-200); font-size: var(--fs-sm); }
.pages__list a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.pages__role { color: var(--text-100); font-weight: 700; }
.result-foot__disclaimer { max-width: var(--reading); color: var(--text-200); font-size: var(--fs-sm); }
