/* zwaig — UX/visual polish pass v2
 * Reduced but warm. Whitespace and typography do the work.
 * All visual values are tunable via the custom properties below.
 */

:root {
  /* Backgrounds — warm but desaturated, near-paper */
  --color-bg-page: #faf7f2;
  --color-bg-panel: #ffffff;
  --color-bg-elevated: #ffffff;

  /* Text */
  --color-text-primary: #2b2722;
  --color-text-secondary: #6b6055;
  --color-text-tertiary: #a39a8d;

  /* Accent — warm mustard */
  --color-accent: #eae178;
  --color-accent-hover: #b4901f;
  --color-accent-soft: #f0e2a8;

  /* Recording state — warm muted red, never bright */
  --color-recording: #b85450;
  --color-recording-soft: #e8c8c4;

  /* Functional */
  --color-rule: #ece5d8;
  --color-error: #a04848;

  /* Type families */

  @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
/*
body {
  font-family: "Roboto", sans-serif;
  font-size: 22px;
}
  */    

  --font-reading: 'Lora', 'EB Garamond', Georgia, serif;
  --font-functional: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-geo: 'Roboto', sans-serif;

  /* Type scale */
  --text-xs: 0.65rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;

  /* Line heights */
  --leading-reading: 1.65;
  --leading-functional: 1.45;
  --leading-tight: 1.2;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Layout */
  --max-content-width: 1440px;
  --toolbar-height: 56px;

  /* Behavior — JS reads these via getComputedStyle */
  --typewriter-speed-ms: 12;
  --history-limit: 10;

  /* WS-2.11 Story 1: smiley assets are CSS variables so the founder can
   * hot-swap PNG → GIF → autoplay-video without touching code. The
   * default paths point at files the founder will drop in later;
   * before then the .wahl-smiley__face falls back to its background
   * color so the layout still makes sense. */
  --smiley-a-asset: url('/static/smiley-a.png');
  --smiley-b-asset: url('/static/smiley-b.png');
  --smiley-a-bg: #ffd86b;
  --smiley-b-bg: #9cd2e9;

  /* Chat-avatar asset is overridden inline once the user clicks a
   * smiley — see the body[data-companion-avatar=…] rules below. */
  --companion-avatar-asset: url('/static/avatar.jpg');
}

/* Dark variant — placeholder for manual `data-theme="dark"` toggling.
 * Disabled by default; uncomment to test.
 */
/*
:root[data-theme="dark"] {
  --color-bg-page: #1f1a13;
  --color-bg-panel: #25201a;
  --color-bg-elevated: #2c2620;
  --color-text-primary: #f0e8d8;
  --color-text-secondary: #b9ad9a;
  --color-text-tertiary: #7a7165;
  --color-accent: #d6b048;
  --color-accent-hover: #e4be58;
  --color-accent-soft: #4a3f1e;
  --color-recording: #cc6e69;
  --color-recording-soft: #4a2826;
  --color-rule: #3a3128;
  --color-error: #c97373;
}
*/

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-family: var(--font-functional);
  font-size: 16px;
  line-height: var(--leading-functional);
  min-height: 100vh;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
button {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

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

/* --- Top toolbar (sticky, full viewport width) -------------------------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg-panel);
  border-bottom: 1px solid var(--color-rule);
}

.toolbar__inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  height: var(--toolbar-height);
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .toolbar__inner {
    padding: 0 var(--space-xl);
  }
}

.toolbar__wordmark {
  font-family: var(--font-functional);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
  text-transform: lowercase;
}

.toolbar__icons {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.toolbar__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  font-family: var(--font-functional);
  font-size: var(--text-md);
}

.toolbar__icon:disabled {
  opacity: 0.7;
}

/* --- Page layout -------------------------------------------------------- */

.page {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 768px) {
  .page {
    padding: var(--space-2xl) var(--space-xl);
    gap: var(--space-2xl);
  }
}

@media (min-width: 1024px) {
  .page {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-xl);
    padding: var(--space-2xl) var(--space-xl);
    align-items: start;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
  background: var(--color-bg-panel);
  border-radius: 6px;
  padding: var(--space-lg);
}

@media (min-width: 768px) {
  .panel {
    padding: var(--space-xl);
  }
}

/* Chat column is transparent — no card, no fond. The timeline keeps its panel. */
.panel--conversation {
  background: transparent;
  padding: 0;
}

/* Phase B Story 1 AC1-1: halved outer padding to enlarge the effective
   Karte / Detail-Box / Tapete-Strip content footprint. Detail-Box
   *inner* padding remains untouched (see .geo-detail). */
.panel--timeline {
  padding: var(--space-sm);
}

@media (min-width: 768px) {
  .panel--timeline {
    padding: var(--space-md);
  }
}

.panel__heading {
  margin: 0;
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* --- Toolbar session group (user/person inputs inline in header) ------- */

.toolbar__session {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
  flex-wrap: nowrap;
}

.session-field {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
}

.session-field__label {
  font-family: var(--font-functional);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.session-field input {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  padding: 2px 0;
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 120ms ease;
  width: 8rem;
  min-width: 0;
}

.session-field input:focus {
  border-bottom-color: var(--color-accent);
}

@media (max-width: 767px) {
  .toolbar__session {
    gap: var(--space-sm);
  }
  .session-field input {
    width: 5rem;
  }
  .session-field__label {
    /* Hide label text on narrow viewports; <label for=…> still
     * provides the accessible name via the wrapping element. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* --- Avatar column (left-most on desktop, stacked on mobile) ----------- */

.avatar-column {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

@media (max-width: 1023px) {
  .avatar-column {
    justify-content: flex-start;
  }
}

.avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--color-accent-soft);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Tunable filter — used when a real photo asset is loaded via
   * background-image. Has no effect on the SVG fallback. */
  --avatar-filter: sepia(0.4) saturate(1.2) hue-rotate(-15deg);
}

.avatar-placeholder--photo {
  background-image: url('/static/avatar.jpg');
  filter: var(--avatar-filter);
}

.avatar-placeholder__svg {
  width: 64px;
  height: 64px;
  display: block;
}

.avatar-placeholder__bg { fill: var(--color-accent-soft); }
.avatar-placeholder__eye { fill: var(--color-accent); }
.avatar-placeholder__mouth {
  stroke: var(--color-accent);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
}

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

.text-button {
  background: transparent;
  border: 0;
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-accent);
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 120ms ease;
}

.text-button:hover { color: var(--color-accent-hover); }
.text-button:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Status lines ------------------------------------------------------ */

.status-line {
  font-family: var(--font-functional);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
  min-height: 1em;
}

.status-line--error { color: var(--color-error); }

/* --- Messages (chat) --------------------------------------------------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1;
  min-height: 16rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-sm) 20px var(--space-sm) 0;
}

.message {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-width: 88%;
  padding: var(--space-sm) var(--space-md);
  border-radius: 6px;
  font-family: var(--font-reading);
  font-size: var(--text-base);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
  white-space: pre-wrap;
}

.message-user {
  align-self: flex-end;
  background: var(--color-bg-panel);
}

.message-assistant {
  align-self: flex-start;
  background: transparent;
  padding-left: 0;
}

.message__text { margin: 0; }

.message__timestamp {
  font-family: var(--font-functional);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
}

/* WS-2.12 Hotfix Fix-1: inline footer wrapping timestamp + bin so the
 * bin sits to the right of the timestamp on the same line. Single
 * inline-flex row; bin's own height is 14px (matches the SVG), so the
 * row stays as compact as the timestamp text. */
.message__footer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

/* WS-2.12 Item 4: per-bubble delete affordance. Hover-only so it
 * doesn't clutter normal reading. opacity-driven so focus-visible
 * keyboard nav still surfaces it. */
.message__delete {
  background: transparent;
  border: 0;
  padding: 0;
  line-height: 0;
  color: var(--color-text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}

.message:hover .message__delete,
.message__delete:focus-visible {
  opacity: 0.7;
  outline: none;
}

.message__delete:hover {
  opacity: 1;
  color: var(--color-error);
}

.message--thinking { padding: var(--space-md); }

.thinking-dots {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  opacity: 0.3;
  animation: thinking-pulse 1.2s infinite ease-in-out both;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Typewriter caret — a simple steady-blink mark while streaming */
.typewriter-caret {
  display: inline-block;
  width: 0.5ch;
  margin-left: 0.05ch;
  color: var(--color-text-tertiary);
  animation: caret-blink 0.9s steps(1, end) infinite;
}

@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* --- Composer (text + voice) ------------------------------------------ */

.composer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
}

.composer__input {
  flex: 1;
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-sm) 0;
  font-family: var(--font-reading);
  font-size: var(--text-md);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 120ms ease;
}

.composer__input::placeholder {
  font-style: italic;
  color: var(--color-text-tertiary);
}

.composer__input:focus {
  border-bottom-color: var(--color-accent);
}

.composer__send { flex-shrink: 0; }

/* WS-2.3 Phase B.1 Story 3 AC3-4: STT button redesign — a centered mic
   icon in a soft yellow radial glow at rest; the glow turns red while
   recording. The previous solid-fill + scale-pulse ("grauenvoll" per
   founder) is replaced by glow-driven state. Existing recording start/
   stop JS logic is untouched — the button only swaps its visual class. */

:root {
  /* Tunable in one place. Glow size, glow color, mic icon proportion. */
  --record-icon-size: 1.25rem;
  --record-glow-radius: 14px;
  --record-glow-spread: 4px;
  --record-glow-color-rest: var(--color-accent);
  --record-glow-color-recording: var(--color-recording);
}

.record-button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 0;
  /* Transparent fill — the colour comes from the glow shadow. */
  background: transparent;
  color: var(--color-text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  /* Soft radial glow via box-shadow. Two layers: a small bright core
     + a wider soft falloff. */
  box-shadow:
    0 0 var(--record-glow-radius) var(--record-glow-spread) var(--record-glow-color-rest),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  transition: box-shadow 200ms ease, color 200ms ease;
}

.record-button:hover {
  /* Slight intensification on hover — keeps the yellow palette. */
  box-shadow:
    0 0 calc(var(--record-glow-radius) + 4px)
      calc(var(--record-glow-spread) + 2px)
      var(--record-glow-color-rest),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.record-button:focus-visible {
  outline: 1px solid var(--color-accent-hover);
  outline-offset: 4px;
}

.record-button__mic {
  width: var(--record-icon-size);
  height: var(--record-icon-size);
  display: block;
}

.record-button.is-recording {
  color: var(--color-bg-page);
  box-shadow:
    0 0 var(--record-glow-radius) var(--record-glow-spread) var(--record-glow-color-recording),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  animation: record-glow-pulse 1.5s infinite ease-in-out;
}

@keyframes record-glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 var(--record-glow-radius) var(--record-glow-spread) var(--record-glow-color-recording),
      inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow:
      0 0 calc(var(--record-glow-radius) + 6px)
        calc(var(--record-glow-spread) + 2px)
        var(--record-glow-color-recording),
      inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  }
}

/* --- Auth pages (landing, login, invite_setup) ------------------------- */

.toolbar__logout {
  margin: 0;
}

.toolbar__logout .text-button {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.toolbar__wordmark[href] {
  text-decoration: none;
  color: inherit;
}

.page--landing,
.page--auth {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
}

.landing {
  max-width: 32rem;
  text-align: left;
}

.landing__title {
  font-family: var(--font-reading);
  font-size: var(--text-2xl);
  font-weight: 500;
  margin: 0 0 var(--space-md);
}

.landing__lede {
  font-family: var(--font-reading);
  font-size: var(--text-md);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-lg);
}

.landing__cta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

.landing__cta a {
  color: var(--color-text-primary);
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--color-bg-panel);
  padding: var(--space-xl);
  border: 1px solid var(--color-rule);
  border-radius: 4px;
}

.auth-card__title {
  font-family: var(--font-reading);
  font-size: var(--text-xl);
  font-weight: 500;
  margin: 0 0 var(--space-md);
}

.auth-card__lede,
.auth-card__meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-md);
}

.auth-card__error {
  font-size: var(--text-sm);
  color: var(--color-error);
  margin: 0 0 var(--space-md);
}

.auth-card__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-field__label {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.auth-field input {
  border: 1px solid var(--color-rule);
  border-radius: 3px;
  padding: var(--space-sm);
  font-size: var(--text-base);
  background: var(--color-bg-page);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--color-accent-hover);
}

.auth-card__submit {
  align-self: flex-start;
  margin-top: var(--space-sm);
}

/* --- Disclaimer page --------------------------------------------------- */

.disclaimer-card {
  max-width: 38rem;
}

.disclaimer-box {
  border: 2px solid var(--color-rule);
  border-radius: 4px;
  background: var(--color-bg-page);
  padding: var(--space-md);
  margin: 0 0 var(--space-md);
  max-height: 24rem;
  overflow-y: auto;
}

.disclaimer-text {
  margin: 0;
  font-family: var(--font-reading);
  font-size: var(--text-base);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.auth-field--inline {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.auth-field--inline input[type="checkbox"] {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

/* --- Toolbar actions row (counter + help + logout icons) --------------- */

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-text-secondary);
}

.toolbar__counter {
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.toolbar__counter--exhausted {
  color: var(--color-error);
}

.toolbar__icon-link,
.toolbar__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 3px;
  transition: color 120ms ease, background-color 120ms ease;
}

.toolbar__icon-link:hover,
.toolbar__icon-link:focus-visible,
.toolbar__icon-button:hover,
.toolbar__icon-button:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-rule);
  outline: none;
}

.toolbar__logout-form {
  margin: 0;
  padding: 0;
}

/* --- Budget-exhausted card -------------------------------------------- */

.budget-card {
  margin: var(--space-md) 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-accent-soft);
  border: 1px solid var(--color-rule);
  border-radius: 4px;
  font-family: var(--font-reading);
  font-size: var(--text-base);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
}

.budget-card__title {
  font-weight: 500;
  margin: 0 0 var(--space-sm);
}

.budget-card__body {
  margin: 0;
}

.budget-card a {
  color: var(--color-text-primary);
}

/* --- Help page --------------------------------------------------------- */

.help-card {
  max-width: 38rem;
}

.help-card__lede {
  font-size: var(--text-base);
  line-height: var(--leading-reading);
  margin: 0 0 var(--space-lg);
  color: var(--color-text-primary);
}

.help-card__section {
  font-family: var(--font-functional);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: var(--space-lg) 0 var(--space-sm);
}

.help-card__list {
  margin: 0 0 var(--space-md);
  padding-left: var(--space-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
}

.help-card__list li {
  margin-bottom: var(--space-sm);
}

.help-card__contact {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

/* --- Load-older chat-history button (WS-2.9) ------------------------- */

.load-older-button {
  display: block;
  margin: var(--space-sm) auto var(--space-md);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-reading);
  font-size: var(--text-sm);
  cursor: pointer;
}

.load-older-button:hover:not(:disabled),
.load-older-button:focus:not(:disabled) {
  color: var(--color-text-primary);
  border-color: var(--color-text-secondary);
}

.load-older-button:disabled {
  cursor: progress;
  opacity: 0.6;
}

/* --- Crisis card (risk=high block) ----------------------------------- */

.crisis-card {
  position: relative;
  margin: var(--space-md) 0;
  padding: var(--space-lg) var(--space-xl);
  background: #fff8e1;
  border: 1px solid #e6c200;
  border-radius: 6px;
  font-family: var(--font-reading);
  line-height: var(--leading-reading);
  color: var(--color-text-primary);
}

.crisis-card__dismiss {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.crisis-card__dismiss:hover,
.crisis-card__dismiss:focus {
  color: var(--color-text-primary);
}

.crisis-card__title {
  margin: 0 0 var(--space-sm);
  padding-right: var(--space-lg);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.crisis-card__body {
  margin: 0 0 var(--space-md);
  font-size: var(--text-base);
}

.crisis-card__hotline-label {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-base);
  font-weight: 500;
}

.crisis-card__hotline-note {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 400;
  margin-left: var(--space-xs);
}

.crisis-card__hotlines {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
}

.crisis-card__hotlines li {
  margin: 0;
  padding: var(--space-xs) 0;
  font-size: var(--text-base);
}

.crisis-card__hotlines a {
  color: var(--color-text-primary);
  white-space: nowrap;
  font-weight: 500;
}

.crisis-card__hotline-tag {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-left: var(--space-sm);
}

.crisis-card__emergency {
  margin: 0;
  font-size: var(--text-base);
}

.crisis-card__emergency a {
  color: var(--color-text-primary);
  font-weight: 500;
  white-space: nowrap;
}

/* --- Geo-Timeline (WS-2.3 Phase A) ------------------------------------- */

:root {
  /* Event-type → color mapping. Founder-tunable: change values here, both
     markers and tapete bars pick up the new palette. */
  --event-color-school: #F4D03F;
  --event-color-work-start: #F4D03F;
  --event-color-job: #F4D03F;
  --event-color-move: #F4B6C2;
  --event-color-relationship: #A8D8E8;
  --event-color-marriage: #A8D8E8;
  --event-color-family: #A8D8E8;
  /* WS-2.3 Phase B Story 3: tokens for the remaining schema event_types so
     every Sprechblase has a distinct (or intentionally-default) color. */
  --event-color-birth: #FFE5B4;
  --event-color-loss: #C2B6A8;
  --event-color-other: #B0B0B0;
  --event-color-default: #B0B0B0;

  /* WS-2.3 Phase B.1 Story 3 AC3-1: right column gets a defined height
     (viewport minus toolbar minus page padding) so the percentage-based
     flex-basis values on the three sub-containers actually resolve.
     Same intuition as Phase B's viewport-relative chrome math, just
     finally wired through. */
  --right-column-height: calc(
    100vh - var(--toolbar-height) - (2 * var(--space-2xl))
  );

  /* Three vertically-stacked sub-containers in the right column.
     Distribution (founder-tunable):
       - map ~50%, strip ~28%, detail-box absorbs the remainder (~17%)
         via `flex: 1 1 0` with `overflow: auto`. */
  --geo-map-height: 50%;
  --geo-strip-height: 10%;

  /* AC3-1: defensive min-height floor for the detail-box. The box's
     ACTUAL height comes from the flex remainder after map + strip take
     their percentage shares (see .geo-detail rule). The floor only
     kicks in on short viewports where the remainder would be near-zero.
     Brief target ~15–20% of right-column height ≈ 6–8rem at 900px tall;
     7rem is a centered choice — founder can tune. */
  --geo-detail-min-height: 7rem;
}

.panel--timeline {
  display: flex;
  flex-direction: column;
  /* Phase B Story 1 AC1-1: halved inter-element gap between Karte /
     Detail-Box / Tapete-Strip. */
  gap: var(--space-sm);
  min-height: 0;
}

/* AC3-1: at desktop, the timeline panel takes a defined height so its
   children's percentage flex-basis values resolve. Below 1024px the
   layout is single-column stacked and the panel stays content-driven. */
@media (min-width: 1024px) {
  .panel--timeline {
    height: var(--right-column-height);
  }
}

.geo-map {
  flex: 0 0 var(--geo-map-height);
  min-height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-2, #eee);
}

.geo-detail {
  /* AC3-1 + Story 4 refactor: outer container — positioning context for
     the absolutely-positioned pagination buttons + holder of the bg /
     border-radius / flex sizing. The scrolling content lives in the
     inner .geo-detail__content so the buttons stay glued to the visible
     bottom corners when summary text overflows. `min-height: var(...)`
     is a defensive floor (Story 3). */
  flex: 1 1 0;
  min-height: var(--geo-detail-min-height);
  border-radius: var(--radius-md);
  background: var(--color-surface-2, #f6f4ef);
  position: relative;
}

.geo-detail__content {
  /* Fills the .geo-detail content-box; this is where overflowing
     summary text scrolls (Story 2 hotfix pattern, moved here). */
  height: 100%;
  padding: var(--space-md);
  overflow: auto;
  font-family: var(--font-reading);
  color: var(--color-text-secondary);
  font-style: italic;
  /* Reserve room at the bottom for the absolutely-positioned nav
     buttons so long summaries don't render UNDER them. */
  padding-bottom: calc(var(--space-md) + 2.25rem);
}

/* WS-2.3 Phase B.1 Story 2 (Tsunami): the strip is now an HTML flex
   container of <div> bars. Hovered/selected bars get
   .geo-strip__bar--expanded which switches flex-basis to a tunable
   target width; siblings absorb the growth via flex-shrink:1. The Phase
   B Story 4 SVG `<rect>` rendering, ranges/points z-layering, and
   same-type truncation are all gone — single-layer flex (see PR for
   the deviation from the brief's suggested two-flex-container path). */

:root {
  /* Tsunami tuning — single tunable constants per brief yak-cap. Keep in
     sync with STRIP_BAR_REST_WIDTH / STRIP_BAR_EXPANDED_WIDTH /
     STRIP_TRANSITION_MS / STRIP_BAR_MIN_WIDTH in timeline.js. */
  --tsunami-bar-rest-width: 30px;
  --tsunami-bar-expanded-width: 100px;
  --tsunami-bar-min-width: 4px;
  --tsunami-transition-ms: 150ms;
  --tsunami-igel-width: 3px;
  /* Per-bar border so same-event_type neighbours stay visually distinct
     in dense regions. Founder-tunable: change once here. */
  --tsunami-bar-border-color: #fff;
}

.geo-strip {
  flex: 0 0 var(--geo-strip-height);
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.geo-strip__year-labels {
  flex: 0 0 16px;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-family: var(--font-geo);
  font-size: 16px;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.geo-strip__bars {
  flex: 1 1 auto;
  display: flex;
  gap: 0;
  overflow: hidden;
  min-height: 0;
  /* max-height:60px; */
}

.geo-strip__bar {
  flex-basis: var(--tsunami-bar-rest-width);
  flex-shrink: 1;
  flex-grow: 0;
  min-width: var(--tsunami-bar-min-width);
  /* background is set per-bar inline from the event_type palette. */
  cursor: pointer;
  position: relative;
  /* Hotfix 2026-05-16: 1px white border per bar so same-colored events
     (e.g. consecutive school bars) are visually distinguishable in the
     tsunami. Tunable via --tsunami-bar-border-color below. With global
     box-sizing:border-box the border eats into the flex-basis, so the
     min-width:4px guard already accounts for it. */
  border: 1px solid var(--tsunami-bar-border-color, #fff);
  transition: flex-basis var(--tsunami-transition-ms) ease;
}

/* AC2-1: hovered / selected bars take the tsunami target width. flex-
   shrink:0 keeps them at that width while siblings absorb the growth. */
.geo-strip__bar--expanded {
  flex-basis: var(--tsunami-bar-expanded-width);
  flex-shrink: 0;
}

/* Phase B.1 Story 1 AC1-6: selection class kept as a hook (carries no
   dedicated visual today — the Igel-Strich does the work). */
.geo-strip__bar--selected {
  /* intentionally empty — see .geo-strip__bar--igel-selection below */
}

/* WS-2.3 Phase B.1 Story 1 AC1-5/AC1-6 + Story 2 RI #5 follow-up: Igel-
   Strich is now a ::before pseudo-element on the bar itself, so it tracks
   the bar's left edge automatically as flex-basis changes during the
   tsunami (no JS x-recompute needed). Two can coexist (selection +
   hover) because they live on different bars. pointer-events:none keeps
   mouseenter/leave on the bar from flickering when the cursor crosses
   the Igel-Strich's hit-area. */
.geo-strip__bar--igel-hover::before,
.geo-strip__bar--igel-selection::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--tsunami-igel-width);
  background: var(--color-text-primary);
  pointer-events: none;
  z-index: 1;
}

/* --- Detail-Box content ------------------------------------------------- */

/* Story 4 refactor: the empty / filled modifier classes live on the
   outer .geo-detail (so external rules can react to detail state) but
   the actual layout switches happen INSIDE the .geo-detail__content
   container — keeps the pagination buttons out of the flex flow. */
.geo-detail--empty .geo-detail__content {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.geo-detail--filled .geo-detail__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-style: normal;
}

.geo-detail__empty {
  color: var(--color-text-tertiary, #888);
  font-style: italic;
}

.geo-detail__date {
  font-family: var(--font-reading);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

.geo-detail__headline {
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.geo-detail__summary {
  font-family: var(--font-reading);
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--color-text-primary);
  font-style: normal;
}

/* --- Detail-Box pagination (WS-2.3 Phase B.1 Story 4) -------------------
   Two chevron buttons anchored to the bottom corners of the detail-box.
   Subtle white per founder ("low contrast against detail-box background —
   present but not loud"). Tunable via the variables below.
   Hidden by default; revealed when JS adds .geo-detail--has-pagination
   based on timelineEvents.length >= 2. */

:root {
  --detail-nav-size: 2rem;
  --detail-nav-icon-size: 1.125rem;
  --detail-nav-inset: var(--space-sm);
  --detail-nav-color-rest: rgb(127, 119, 67);
  --detail-nav-color-hover: rgba(255, 255, 255, 1);
  --detail-nav-hover-bg: rgba(0, 0, 0, 0.09);
}

.geo-detail__nav {
  display: none;
  position: absolute;
  bottom: var(--detail-nav-inset);
  width: var(--detail-nav-size);
  height: var(--detail-nav-size);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--detail-nav-color-rest);
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: color 150ms ease, background-color 150ms ease;
}

.geo-detail--has-pagination .geo-detail__nav {
  display: inline-flex;
}

.geo-detail__nav:hover {
  color: var(--detail-nav-color-hover);
  background: var(--detail-nav-hover-bg);
}

.geo-detail__nav:focus-visible {
  outline: 1px solid var(--color-accent-hover);
  outline-offset: 2px;
}

.geo-detail__nav svg {
  width: var(--detail-nav-icon-size);
  height: var(--detail-nav-icon-size);
  display: block;
}

.geo-detail__nav--prev { left: var(--detail-nav-inset); }
.geo-detail__nav--next { right: var(--detail-nav-inset); }

/* --- Map marker (WS-2.3 Phase B.1 Story 1 — Sprechblase) --------------- */

/* MapLibre positions the marker wrapper via inline `transform: translate(...)`,
   so we MUST NOT set `transform` on the wrapper itself. Story 3's SVG-
   shape approach is gone — the bubble is now a content-driven CSS shape
   so it grows naturally when the headline becomes visible. */

.geo-marker {
  --marker-bg: var(--event-color-default);
  /* Founder 2026-05-15: tail attaches ~20% inset from the bubble's left
     edge, not at the corner. JS pairs this with a matching MapLibre
     offset so the tail-tip lands exactly on the geocoded coord. KEEP
     IN SYNC: MARKER_TAIL_INSET_PX in timeline.js must match. */
  --marker-tail-inset: 18px;
  --marker-tail-height: 14px;
  --marker-tail-width: 8px;
  display: inline-block;
  /* CRITICAL (2026-05-16 founder-reported bug): must be `absolute` to
     match MapLibre's `.maplibregl-marker { position: absolute }`.
     Setting `position: relative` overrides MapLibre's positioning, the
     markers fall into document flow inside the map container, and end
     up at grid-like flow positions instead of their geocoded coords.
     `position: absolute` ALSO establishes the positioning context the
     tail's `position: absolute` needs — no functional regression. */
  position: absolute;
  /* Reserve vertical room beneath the bubble for the absolutely-positioned
     tail so the wrapper's bottom edge = tail-tip y-coord. */
  padding-bottom: var(--marker-tail-height);
  /* AC1-3: dropshadow replaces the Phase B Story 3 white SVG stroke. */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  cursor: pointer;
  transition: filter 150ms ease;
  /* WS-2.12 Item 2: GPU-layer promotion stops MapLibre's float-pixel
     transform from softening the marker text. Browsers snap GPU-layer
     contents to integer pixels, which makes the date/headline crisp at
     every zoom level. backface-visibility:hidden creates the layer
     reliably across engines that ignore will-change alone. */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

.geo-marker__bubble {
  background: var(--marker-bg);
  border-radius: 6px;
  padding: 5px 9px;
  /* Refinement (b): min/max widths cap excessively-long dates/headlines
     while keeping short content from collapsing the bubble. Pair with
     ellipsis (compact) / soft-wrap (expanded) on the text below. */
  min-width: 84px;
  max-width: 200px;
  /* Refinement (b): reserve vertical space for TWO text lines even when
     only the date is shown (compact state). The bubble's height stays
     the same compact-vs-expanded — no vertical layout jump on hover.
     Computed: 2 × line-height × font-size + padding. */
  min-height: calc((2 * 1.35 * 11px) + (2 * 5px));
  font-family: var(--font-geo);
  font-size: 13px;
  line-height: 1.35;
  color: var(--color-text-primary);
  /* Compact: single line, ellipsis on overflow. The expanded selector
     below switches to soft-wrap so the date + headline flow inline. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Refinement (c) / founder image 2026-05-15: tail is a tall, narrow
   downward-pointing right-triangle. Tip sits at the element's bottom-
   LEFT corner (border-top draws the colored top; border-right is the
   transparent sloped hypotenuse — no border-left, no border-bottom).
   Absolutely positioned so the tip sits at --marker-tail-inset to the
   right of the wrapper's left edge (founder: "ca. 20% der Breite"). JS
   compensates with a matching offset on the MapLibre Marker so the tip
   still lands exactly on the geocoded coord regardless of bubble width. */
.geo-marker__tail {
  position: absolute;
  bottom: 0;
  left: var(--marker-tail-inset);
  width: 0;
  height: 0;
  border-top: var(--marker-tail-height) solid var(--marker-bg);
  border-right: var(--marker-tail-width) solid transparent;
}

/* Date is prominent (founder image: heavier weight, primary text color).
   Headline flows inline after the date in expanded state — lighter
   weight + secondary color, just like the screenshot's "Mai 1993 Abitur"
   pattern. The space separating the two is a literal text node inserted
   by buildMarkerElement. */
.geo-marker__date {
  font-weight: 400;
  color: var(--color-text-primary);
}

/* AC1-1: headline is hidden in compact; revealed inline in expanded.
   The bubble's min-height reserves the second-line slot whether the
   headline is rendered or not (refinement (b)). */
.geo-marker__headline {
  display: none;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.geo-marker--expanded .geo-marker__headline {
  display: inline;
}

/* Expanded: allow soft-wrapping so the date + headline flow over 2-3
   lines within the bubble's max-width (matches founder image). The
   ellipsis on the compact rule above is no longer needed. */
.geo-marker--expanded .geo-marker__bubble {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.geo-marker--expanded .geo-marker__headline {
  display: block;
}

.geo-marker--expanded {
  /* Slightly stronger shadow when expanded — visual lift over neighbors. */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
}

/* AC1-6: selection emphasis on the marker side rides on .geo-marker--
   expanded (selected markers are always expanded — setMarkerEmphasis sets
   both classes together). The dedicated selected class stays as a hook
   for future styling without adding a second visual layer today. */
.geo-marker--selected {
  /* intentionally empty — see comment above */
}

/* Per-event_type background via CSS-variable indirection so the tail
   triangle (which uses border-top-color) and the bubble bg both pick
   up the same color from a single declaration. */
.geo-marker--birth { --marker-bg: var(--event-color-birth, var(--event-color-default)); }
.geo-marker--school { --marker-bg: var(--event-color-school, var(--event-color-default)); }
.geo-marker--job { --marker-bg: var(--event-color-job, var(--event-color-default)); }
.geo-marker--work-start { --marker-bg: var(--event-color-work-start, var(--event-color-default)); }
.geo-marker--move { --marker-bg: var(--event-color-move, var(--event-color-default)); }
.geo-marker--relationship { --marker-bg: var(--event-color-relationship, var(--event-color-default)); }
.geo-marker--marriage { --marker-bg: var(--event-color-marriage, var(--event-color-default)); }
.geo-marker--family { --marker-bg: var(--event-color-family, var(--event-color-default)); }
.geo-marker--loss { --marker-bg: var(--event-color-loss, var(--event-color-default)); }
.geo-marker--other { --marker-bg: var(--event-color-other, var(--event-color-default)); }

/* --- WS-2.11 Story 1: Smiley-Wahl-UI ---------------------------------- */

/* Default: Wahl-UI hidden, regular chat shown. When the body carries
 * data-onboarding-needs-du-sie="true" (set server-side for users with
 * du_sie_preference IS NULL), we flip: Wahl-UI shown, chat hidden. */
.wahl-panel {
  display: none;
}
body[data-onboarding-needs-du-sie="true"] .wahl-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3xl) var(--space-md) var(--space-xl);
  gap: var(--space-2xl);
}
body[data-onboarding-needs-du-sie="true"] .page {
  display: none;
}

.wahl-panel__smileys {
  display: flex;
  gap: var(--space-3xl);
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
}

@media (max-width: 720px) {
  .wahl-panel__smileys {
    flex-direction: column;
    align-items: center;
    gap: var(--space-2xl);
  }
}

.wahl-smiley {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  transition: transform 120ms ease-out;
}

.wahl-smiley:hover,
.wahl-smiley:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.wahl-smiley:disabled {
  cursor: progress;
  opacity: 0.6;
}

.wahl-smiley__face {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background-color: var(--smiley-a-bg);
  background-image: var(--smiley-a-asset);
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.wahl-smiley--sie .wahl-smiley__face {
  background-color: var(--smiley-b-bg);
  background-image: var(--smiley-b-asset);
}

.wahl-smiley__bubble {
  position: relative;
  padding: var(--space-sm) var(--space-lg);
  border-radius: 18px;
  background: var(--color-bg-panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: var(--font-reading);
  font-size: var(--text-lg);
  color: var(--color-text-primary);
  min-width: 6ch;
  text-align: center;
}

.wahl-smiley__bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--color-bg-panel);
}

/* Loop: alternate greeting ↔ question every ~2s. The two spans are
 * stacked in the same bubble; CSS animation fades one in while the
 * other is out. Loops on each smiley run independently (no shared
 * animation name dependency). */
.wahl-smiley__bubble-greeting,
.wahl-smiley__bubble-question {
  display: block;
  animation-duration: 4s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.wahl-smiley__bubble-greeting {
  animation-name: wahl-bubble-greeting;
}
.wahl-smiley__bubble-question {
  animation-name: wahl-bubble-question;
  margin-top: -1.4em;
}

@keyframes wahl-bubble-greeting {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes wahl-bubble-question {
  0%, 45% { opacity: 0; }
  50%, 95% { opacity: 1; }
  100% { opacity: 0; }
}

.wahl-smiley--sie .wahl-smiley__bubble-greeting {
  animation-delay: -1s; /* offset so the two smileys aren't synced */
}
.wahl-smiley--sie .wahl-smiley__bubble-question {
  animation-delay: -1s;
}

.wahl-panel__crisis-row {
  margin-top: var(--space-lg);
}

.wahl-panel__crisis-link {
  background: transparent;
  border: 0;
  color: var(--color-text-tertiary);
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wahl-panel__crisis-link:hover,
.wahl-panel__crisis-link:focus-visible {
  color: var(--color-text-secondary);
  outline: none;
}

.wahl-panel__crisis-mount {
  max-width: 480px;
  width: 100%;
}

.wahl-panel__crisis-mount:empty {
  display: none;
}

/* --- WS-2.11 Story 4: Rotating tagline in header --------------------- */

/* The wordmark and tagline form a single visual cluster, separated by an
 * em-dash. Baseline alignment so the italic tagline sits on the same
 * line as the wordmark glyphs (which differ in optical weight). */
.toolbar__brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  min-width: 0; /* allow the tagline ellipsis to actually kick in */
}

.toolbar__tagline {
  font-family: var(--font-functional);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 32ch;
}

/* Em-dash separator. Only renders once the JS has populated the slot
 * — :not(:empty) keeps the header clean on initial paint and on the
 * silent fallback when /static/data/taglines.json fails to load. */
.toolbar__tagline:not(:empty)::before {
  content: "— ";
  color: var(--color-text-tertiary);
  margin-right: var(--space-xs);
}

@media (max-width: 720px) {
  .toolbar__tagline {
    display: none;
  }
}

/* --- WS-2.11 AC1-5: chat avatar swaps to chosen smiley --------------- */

body[data-companion-avatar="du"] .avatar-placeholder--photo {
  background-image: var(--smiley-a-asset);
  background-color: var(--smiley-a-bg);
  filter: none;
}

body[data-companion-avatar="sie"] .avatar-placeholder--photo {
  background-image: var(--smiley-b-asset);
  background-color: var(--smiley-b-bg);
  filter: none;
}
