/* ==========================================================================
   Promptability – Basis & Komponenten · v0.1
   Setzt tokens.css voraus. Wiederverwendbar für Website und Brand Sheet.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--t-body-lh);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
::selection { background: var(--blue-wash); color: var(--ink); }
:focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); }
h1, h2, h3, h4, p, figure, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

/* --- Typografische Rollen ------------------------------------------------ */
.t-display { font-size: var(--t-display); line-height: var(--t-display-lh); letter-spacing: var(--t-display-ls); font-weight: var(--t-display-w); }
.t-h1 { font-size: var(--t-h1); line-height: var(--t-h1-lh); letter-spacing: var(--t-h1-ls); font-weight: var(--t-h1-w); }
.t-h2 { font-size: var(--t-h2); line-height: var(--t-h2-lh); letter-spacing: var(--t-h2-ls); font-weight: var(--t-h2-w); }
.t-h3 { font-size: var(--t-h3); line-height: var(--t-h3-lh); letter-spacing: var(--t-h3-ls); font-weight: var(--t-h3-w); }
.t-lead { font-size: var(--t-lead); line-height: var(--t-lead-lh); letter-spacing: var(--t-lead-ls); color: var(--ink-2); }
.t-body { font-size: var(--t-body); line-height: var(--t-body-lh); }
.t-small { font-size: var(--t-small); line-height: var(--t-small-lh); }
.t-meta {
  font-family: var(--font-mono); font-size: var(--t-meta); line-height: var(--t-meta-lh);
  letter-spacing: var(--t-meta-ls); text-transform: uppercase; color: var(--ink-3);
}
.t-data { font-family: var(--font-mono); font-size: var(--t-data); line-height: var(--t-data-lh); }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 2.4em; }
.prose h3 { margin-top: 1.8em; }

/* --- Links ----------------------------------------------------------------- */
a { color: var(--blue); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; transition: color var(--dur-1) var(--ease); }
a:hover { color: var(--blue-press); text-decoration-thickness: 2px; }
.link-more { display: inline-flex; gap: .5em; align-items: baseline; text-decoration: none; font-weight: 500; }
.link-more:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.link-more .arr { transition: transform var(--dur-1) var(--ease); }
.link-more:hover .arr { transform: translateX(3px); }

/* --- Der Block: Cursor (Logo, Fragen), Kicker, Evidenz ----------------------- */
.cursor {
  display: inline-block; width: .30em; height: .72em; margin-left: .085em;
  background: var(--blue); vertical-align: baseline;
}
.cursor--ink { background: var(--ink); }
.cursor--blink { animation: pa-blink calc(var(--blink) * 2) steps(1, end) 3; }
@keyframes pa-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor--blink { animation: none; } }

.wordmark {
  font-family: var(--font-sans); font-weight: 500; letter-spacing: -.035em;
  line-height: 1; white-space: nowrap; color: var(--ink); text-decoration: none;
}
.wordmark:hover { color: var(--ink); }

.kicker { display: inline-flex; align-items: center; gap: 10px; }
.kicker::before { content: ""; width: 5px; height: 12px; background: var(--ink); flex: none; }

.evidence { display: inline-flex; align-items: center; gap: 10px; }
.evidence__bar { display: inline-flex; gap: 3px; }
.evidence__bar i { display: block; width: 5px; height: 12px; background: var(--rule); }
.evidence__bar i.on { background: var(--ink); }

/* --- Inhaltstyp-Zeile: STUDIE · S-001 --------------------------------------- */
.typeline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.typeline .sep { color: var(--rule); }
.sample {
  display: inline-block; padding: 3px 7px 2px; border: 1px dashed var(--line); border-radius: var(--radius-1);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
  line-height: 1.3; white-space: nowrap;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 46px; padding: 12px 18px; border: 1px solid transparent; border-radius: var(--radius-1);
  font: 500 15px/1.1 var(--font-sans); letter-spacing: -.005em; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.btn .arr { font-weight: 400; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 84%, var(--paper)); color: var(--paper); text-decoration: none; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.btn--small { min-height: 34px; padding: 7px 12px; font-size: 13px; gap: 10px; }
.btn[disabled], .btn[aria-disabled="true"] { background: transparent; color: var(--ink-3); border: 1px dashed var(--line); cursor: not-allowed; }

/* --- Chips / Filter ------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-1); background: transparent;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .03em; color: var(--ink); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .count { color: var(--ink-3); }
.chip[aria-pressed="true"] .count { color: color-mix(in srgb, var(--paper) 70%, var(--ink)); }

/* --- Eingabefelder (funktionale Grenze = --line, nie --rule) --------------- */
.field { display: grid; gap: 8px; max-width: 420px; }
.field label { font-size: 14px; font-weight: 500; }
.field input {
  height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-1);
  background: var(--surface); color: var(--ink); font: 400 16px/1 var(--font-sans);
}
.field input::placeholder { color: var(--ink-3); }
.field input:hover { border-color: var(--ink-2); }
.field input:focus-visible { border-color: var(--blue); outline: var(--focus); outline-offset: 1px; }
.field .hint { font-size: 13px; color: var(--ink-3); }
.field--error input { border-color: var(--down); }
.field--error .hint { color: var(--down); }
.field--error .hint::before { content: "! "; font-family: var(--font-mono); font-weight: 400; }

/* --- Prompt-Zeile: die Frage als Eingabe ---------------------------------- */
.prompt {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: baseline;
  padding: 18px 20px; background: var(--sunk);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.5; color: var(--ink);
}
.prompt__label { font-size: var(--t-meta); letter-spacing: var(--t-meta-ls); text-transform: uppercase; color: var(--ink-3); }
.prompt__text { text-wrap: pretty; }
.prompt .cursor { width: .55em; height: 1.05em; vertical-align: -.2em; margin-left: .15em; }

/* --- Prompt-Beleg: dokumentierte Abfrage + Antwortauszug ------------------- */
.record { border-top: 1px solid var(--ink); }
.record__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 12px 0; }
.record__body { display: grid; gap: 2px; }
.record__row { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 16px 20px; background: var(--sunk); font-family: var(--font-mono); font-size: 14px; line-height: 1.6; }
.record__row .t-meta { padding-top: 3px; }
.record__src { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 20px 0; font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.record__src ol { display: grid; gap: 4px; }

/* --- Belegmarke [1] -------------------------------------------------------- */
.cite { font-family: var(--font-mono); font-size: .8em; text-decoration: none; white-space: nowrap; }
.cite:hover { text-decoration: underline; }

/* --- Metadaten-Raster ------------------------------------------------------ */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--ink); }
.meta-grid > div { padding: 14px 24px 16px 0; border-bottom: 1px solid var(--rule); }
.meta-grid dt { margin-bottom: 6px; }
.meta-grid dd { font-size: 15px; line-height: 1.4; }

/* --- Abbildung & Tabelle --------------------------------------------------- */
.figure { border-top: 1px solid var(--ink); padding-top: 14px; }
.figure__head { display: grid; gap: 6px; margin-bottom: 24px; }
.figure__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.figure__title { font-size: 21px; line-height: 1.25; letter-spacing: -.015em; font-weight: 500; text-wrap: balance; }
.figure__sub { font-size: 14px; color: var(--ink-2); }
.figure__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--rule); }
.figure__actions { display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.data-table th {
  padding: 10px 16px 10px 0; text-align: left; vertical-align: bottom; border-bottom: 1px solid var(--ink);
  font: 400 var(--t-meta)/1.35 var(--font-mono); letter-spacing: var(--t-meta-ls); text-transform: uppercase; color: var(--ink-3);
}
.data-table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table .r { text-align: right; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table tr.is-focus td { background: var(--blue-wash); }
.data-table tr.is-focus td:first-child { box-shadow: inset 3px 0 0 var(--blue); padding-left: 12px; }
.data-table td:first-child { padding-left: 0; }
.data-table .key { display: inline-block; width: 12px; height: 2px; margin-right: 10px; vertical-align: middle; }

.delta { white-space: nowrap; }
.delta--up { color: var(--up); }
.delta--down { color: var(--down); }
.delta--up::after { content: " ↑"; }
.delta--down::after { content: " ↓"; }

/* --- Hinweis (Grenzen, Methodik) ------------------------------------------ */
.note { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 12px 32px; padding: 18px 0 20px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.note p + p, .note ul { margin-top: .6em; }
.note ul li { padding-left: 1.1em; position: relative; }
.note ul li::before { content: "–"; position: absolute; left: 0; color: var(--ink-3); }

/* --- Website-Rahmen -------------------------------------------------------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; border-bottom: 1px solid var(--rule); }
.site-header .wordmark { font-size: 24px; }
.site-nav { display: flex; gap: 28px; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .45em; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .site-nav { display: none; }
  .menu-btn { display: inline-flex; }
}

/* --- Chart-Basis (viz.js) -------------------------------------------------- */
.viz { position: relative; }
.viz-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-1);
  font-size: 13px; line-height: 1.4; box-shadow: 0 6px 18px -10px rgb(0 0 0 / .25);
  opacity: 0; transition: opacity var(--dur-1) var(--ease);
}
.viz-tip.is-on { opacity: 1; }
.viz-tip .t-meta { display: block; margin-bottom: 6px; }
.viz-tip .row { display: flex; align-items: center; gap: 8px; }
.viz-tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.6em; }
.viz-tip .row i { width: 12px; height: 2px; display: inline-block; }
.viz-tip .row span { color: var(--ink-2); }

.bars { display: grid; gap: 2px; }
.bars__row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr; align-items: center; gap: 16px; min-height: 34px; border-radius: 0; cursor: default; }
.bars__row:focus-visible { outline-offset: 2px; }
.bars__label { font-size: 14px; line-height: 1.25; color: var(--ink-2); }
.bars__row.is-focus .bars__label { color: var(--ink); font-weight: 500; }
.bars__track { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; }
.bars__bar { height: 18px; background: var(--viz-context); border-radius: 0 2px 2px 0; transition: filter var(--dur-1) var(--ease); }
.bars__row.is-focus .bars__bar { background: var(--viz-1); }
.bars__row:hover .bars__bar, .bars__row:focus-visible .bars__bar { filter: brightness(1.12); }
.bars__val { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.bars__row.is-focus .bars__val { color: var(--ink); font-weight: 600; }
.bars__axis { display: grid; grid-template-columns: minmax(120px, 210px) 1fr; gap: 16px; margin-top: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 2px; display: inline-block; }

.line-chart svg { overflow: visible; }
.line-chart text { font-family: var(--font-sans); fill: var(--ink-3); font-size: 12px; }
.line-chart .end-label { font-size: 13px; fill: var(--ink); font-weight: 500; }

@media (max-width: 640px) {
  .bars__row, .bars__axis { grid-template-columns: 1fr; gap: 2px; }
  .bars__row { padding: 4px 0; }
  .bars__track { height: 24px; }
  .note { grid-template-columns: 1fr; }
  .record__row, .record__src { grid-template-columns: 1fr; gap: 4px; }
}
