/*
 * Template „amarodo“ – passend zu https://www.amarodo.com (Vertrag: docs/betrieb/templates.md).
 * Klassisch-elegant: helle Seite (Weiß, #f7f7f7, #ededed), schwarze Leiste #181818, Gold #caa96c als Akzent,
 * Überschriften in Playfair Display, Text in Lato (beide SIL OFL, selbst gehostet unter fonts/), kaum Rundungen.
 * Standard hell; dunkle Variante in Fast-Schwarz (#121212/#181818) mit Gold.
 * Kontraste (WCAG AA) für beide Modi geprüft – Werte in den Kommentaren. Gold #caa96c erreicht auf Weiß nur 2,2:1 und
 * erscheint im hellen Modus deshalb nie als Textfarbe auf Hell, sondern nur als Linie/Fläche; Text in Gold auf Hell
 * nutzt #7a6535 (5,6:1 auf Weiß, 5,2:1 auf #f7f7f7).
 */

/* ---------- Schriften ---------- */
@font-face {
  font-family: 'Lato';
  src: url('fonts/lato-latin-300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lato';
  src: url('fonts/lato-latin-400.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lato';
  src: url('fonts/lato-latin-700.woff2') format('woff2');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/playfair-display-latin-400.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/playfair-display-latin-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/playfair-display-latin-700.woff2') format('woff2');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens (hell, dunkel) ---------- */
:root {
  --font-sans: 'Lato', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;

  /* Hell: Hauptfläche Schwarz wie die Leiste von amarodo.com, Schrift Beige (#ece3cc auf #181818 = 14:1,
     auf #2f2f3f = 11:1). Dunkel: Gold-Fläche mit schwarzer Schrift wie die Knöpfe auf den dunklen Abschnitten
     (#181818 auf #caa96c = 8,0:1, auf #d4b77e = 9,2:1). */
  --color-primary: light-dark(#181818, #caa96c);
  --color-primary-hover: light-dark(#2f2f3f, #d4b77e);
  --color-on-primary: light-dark(#ece3cc, #181818);
  /* Links: hell dunkles Gold #7a6535 (5,6:1 auf Weiß), dunkel helles Gold #d4b77e (9,6:1 auf #1c1c1c) */
  --color-link: light-dark(#7a6535, #d4b77e);
  --color-focus: light-dark(#7a6535, #caa96c);
  --color-page: light-dark(#f7f7f7, #121212);
  --color-header: light-dark(#ffffff, #181818);
  --color-ink: light-dark(#222222, #ece8e1);

  accent-color: light-dark(#7a6535, #caa96c);

  /* Dezente, kaum gerundete Formen wie auf amarodo.com (eckige Knöpfe, keine Pillen) */
  --radius-button: 2px;
  --radius-field: 2px;
  --radius-card: 2px;
  --radius-panel: 3px;
  --radius-hero: 3px;

  /* Eigene Hilfswerte (nur in dieser Datei) */
  --amr-gold: #caa96c;
  --amr-gold-text: light-dark(#7a6535, #caa96c);
  --amr-line: light-dark(rgb(202 169 108 / 0.6), rgb(202 169 108 / 0.35));
}

/*
 * Palette: amarodo.com ist neutralgrau, Tailwinds slate ist bläulich. Deshalb in beiden Modi neutrale Grautöne
 * (je Modus über die Selektoren, damit die Spiegelung des dunklen Modus erhalten bleibt).
 * Hell: slate-400 #72716f auf #f7f7f7 4,6:1 (Tage außerhalb des Monats im Kalender, Platzhalter – Tailwinds slate-400
 * läge bei 2,4:1), slate-500 #62615f auf #ededed 5,3:1, slate-600 #545352 auf #e0dfdc 5,8:1.
 * Dunkel: Karten #1c1c1c, Seite #121212; slate-400 #8a8885 auf #121212 5,4:1, slate-500 #9d9b97 auf #1c1c1c 6,1:1.
 */
@media not print {
  :root[data-theme='light'] {
    --color-slate-50: #f7f7f7;
    --color-slate-100: #ededed;
    --color-slate-200: #e0dfdc;
    --color-slate-300: #cbc9c4;
    --color-slate-400: #72716f;
    --color-slate-500: #62615f;
    --color-slate-600: #545352;
    --color-slate-700: #3f3e3d;
    --color-slate-800: #2a2a2a;
    --color-slate-900: #181818;
    --color-slate-950: #0d0d0d;
  }
  :root[data-theme='dark'] {
    --color-white: #1c1c1c;
    --color-slate-50: #121212;
    --color-slate-100: #262626;
    --color-slate-200: #333333;
    --color-slate-300: #4a4a4a;
    --color-slate-400: #8a8885;
    --color-slate-500: #9d9b97;
    --color-slate-600: #b9b6b0;
    --color-slate-700: #d6d3cd;
    --color-slate-800: #e6e3dd;
    --color-slate-900: #f2efe9;
    --color-slate-950: #ffffff;
    scrollbar-color: #333333 #121212;
  }
  @media (prefers-color-scheme: light) {
    :root[data-theme='system'] {
      --color-slate-50: #f7f7f7;
      --color-slate-100: #ededed;
      --color-slate-200: #e0dfdc;
      --color-slate-300: #cbc9c4;
      --color-slate-400: #72716f;
      --color-slate-500: #62615f;
      --color-slate-600: #545352;
      --color-slate-700: #3f3e3d;
      --color-slate-800: #2a2a2a;
      --color-slate-900: #181818;
      --color-slate-950: #0d0d0d;
    }
  }
  @media (prefers-color-scheme: dark) {
    :root[data-theme='system'] {
      --color-white: #1c1c1c;
      --color-slate-50: #121212;
      --color-slate-100: #262626;
      --color-slate-200: #333333;
      --color-slate-300: #4a4a4a;
      --color-slate-400: #8a8885;
      --color-slate-500: #9d9b97;
      --color-slate-600: #b9b6b0;
      --color-slate-700: #d6d3cd;
      --color-slate-800: #e6e3dd;
      --color-slate-900: #f2efe9;
      --color-slate-950: #ffffff;
      scrollbar-color: #333333 #121212;
    }
  }
}

/* ---------- Gestaltung über die data-ui-Haken (nur Bildschirm; Druck bleibt schlicht und hell) ---------- */
@media screen {
  ::selection {
    background-color: rgb(202 169 108 / 0.35);
  }

  h1,
  h2,
  h3,
  h4 {
    font-weight: 600;
    letter-spacing: 0.005em;
  }

  /* Kopfleiste: schwarzer Streifen oben (wie die Kontaktleiste von amarodo.com), feine Goldlinie unten */
  [data-ui='header'] {
    border-top: 0.375rem solid light-dark(#181818, #050505);
    border-bottom: 1px solid var(--amr-line);
  }

  /* Ornament-Logo größer als die üblichen 2rem, sonst ist das Filigran nur ein grauer Fleck */
  [data-ui='logo'] {
    height: 2.75rem;
  }
  /* Markenname in Playfair mit Sperrung; lange Namen werden gekürzt (…) statt in die Knöpfe rechts zu laufen */
  [data-ui='brand'] {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.25rem;
    letter-spacing: 0.06em;
    gap: 0.75rem;
    flex-shrink: 1;
    min-width: 0;
  }
  [data-ui='brand-name'] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  [data-ui='logo'] {
    flex-shrink: 0;
  }
  [data-ui='header'] [data-ui='button-primary'] {
    letter-spacing: 0.06em;
  }
  @media (max-width: 639px) {
    [data-ui='logo'] {
      height: 2.125rem;
    }
    [data-ui='brand'] {
      font-size: 1.0625rem;
      letter-spacing: 0.02em;
      gap: 0.5rem;
    }
    [data-ui='header'] [data-ui='button-primary'] {
      font-size: 0.75rem;
      letter-spacing: 0.02em;
      padding-inline: 0.75rem;
    }
  }

  /* Navigation sachlich wie auf amarodo.com: grau, fett, aktiver Eintrag in Gold mit Goldlinie statt Fläche */
  [data-ui='nav-link'] {
    font-weight: 700;
    letter-spacing: 0.02em;
  }
  [data-ui='nav-link']:not([aria-current='page']):not([aria-disabled='true']):hover {
    background-color: transparent;
    color: var(--amr-gold-text);
  }
  [data-ui='nav-link'][aria-current='page'] {
    background-color: transparent;
    color: var(--amr-gold-text);
    box-shadow: inset 0 -2px 0 var(--amr-gold);
  }
  /* Ungelesen-Zähler in Gold mit schwarzer Schrift (8,0:1) – auch im dunklen Modus, in dem die Spiegelung
     text-slate-900 sonst fast weiß machte */
  [data-ui='header'] .bg-amber-400 {
    background-color: var(--amr-gold);
    color: #181818;
  }

  /* Hauptknopf: Großbuchstaben mit Sperrung wie die Knöpfe von amarodo.com. Hell Schwarz mit Gold
     (#caa96c auf #181818 = 8,0:1, auf #2f2f3f = 6,1:1), dunkel Gold mit Schwarz. */
  [data-ui='button-primary'] {
    color: light-dark(var(--amr-gold), #181818);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8125rem;
    font-weight: 700;
    transition:
      background-color 0.2s,
      color 0.2s;
  }
  [data-ui='button-secondary'] {
    border-color: light-dark(#cbc9c4, #4a4a4a);
  }
  [data-ui='button-secondary']:hover:not(:disabled) {
    border-color: var(--amr-gold);
  }
  /* Gefüllte Lösch-Knöpfe (UiButton danger = bg-red-600, „Konto löschen“ = bg-red-700): Weiß auf #b91c1c (6,5:1) in
     beiden Modi – die Spiegelung machte daraus dunkle Schrift auf Hellrot */
  [data-ui='button-danger']:is([class*='bg-red-600'], [class*='bg-red-700']) {
    background-color: #b91c1c;
    color: #ffffff;
  }
  [data-ui='button-danger']:is([class*='bg-red-600'], [class*='bg-red-700']):hover:not(:disabled) {
    background-color: #991b1b;
  }

  /* Seitentitel in Playfair Display und Gold (hell #7a6535 = 5,6:1, dunkel #caa96c = 8,4:1).
     Farbige Namen (Rollen-/Plan-Farbe im Profil) behalten ihre Farbe. */
  [data-ui='page-title']:not([class*='-600']):not([class*='-700']) {
    color: var(--amr-gold-text);
  }
  [data-ui='page-title'] {
    font-weight: 400;
    letter-spacing: 0.01em;
  }

  /* Karten: feiner neutraler Rand, ohne Schatten */
  [data-ui='card'] {
    box-shadow: none;
  }
  /* Anmelde-/Statuskarten und Dialoge mit goldener Kante oben */
  [data-ui='auth-card'],
  [data-ui='dialog'] {
    border-top: 3px solid var(--amr-gold);
    box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.35);
  }
  /* Menüs mit goldener Kante oben wie die Untermenüs von amarodo.com */
  [data-ui='menu'] {
    border-top: 3px solid var(--amr-gold);
    box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.3);
  }

  /*
   * Hero-Flächen (Kopf der Landingpage, Begrüßung der Startseite, Hero-Block der Landingpages) als dunkle Insel wie
   * die halbtransparenten Kästen und schwarzen Abschnitte von amarodo.com – in beiden Modi. color-scheme: dark
   * schaltet die light-dark()-Tokens innerhalb der Insel auf die dunklen Werte; die Palette wird lokal gespiegelt.
   * Lange Artikel (öffentlicher Beitrag, Über uns) bleiben hell und bekommen nur die Goldkante.
   */
  [data-ui='hero']:not(article) {
    color-scheme: dark;
    color: #f2efe9;
    background-color: #181818;
    background-image: url('ornament.png');
    background-repeat: no-repeat;
    background-size: 26rem auto;
    background-position: right -6rem center;
    border-top: 3px solid var(--amr-gold);
    --color-white: #232323;
    --color-surface: #232323;
    --color-ink: #f2efe9;
    --color-slate-50: #1c1c1c;
    --color-slate-100: #2a2a2a;
    --color-slate-200: #3a3a3a;
    --color-slate-300: #555555;
    --color-slate-400: #8f8d89;
    --color-slate-500: #a7a49f;
    --color-slate-600: #c2bfb9;
    --color-slate-700: #dcd9d3;
    --color-slate-800: #ebe8e2;
    --color-slate-900: #f2efe9;
    --color-slate-950: #ffffff;
    --color-red-50: oklch(25.8% 0.092 26.042);
    --color-red-200: oklch(44.4% 0.177 26.899);
    --color-red-800: oklch(88.5% 0.062 18.334);
    --color-amber-50: oklch(27.9% 0.077 45.635);
    --color-amber-200: oklch(47.3% 0.137 46.201);
    --color-amber-800: oklch(92.4% 0.12 95.746);
    --color-emerald-50: oklch(26.2% 0.051 172.552);
    --color-emerald-200: oklch(43.2% 0.095 166.913);
    --color-emerald-800: oklch(90.5% 0.093 164.15);
  }
  [data-ui='hero']:not(article) [data-ui='page-title'] {
    color: #ffffff;
  }
  [data-ui='hero']:not(article) [data-ui='button-primary'] {
    background-color: var(--amr-gold);
    color: #181818;
  }
  [data-ui='hero']:not(article) [data-ui='button-primary']:hover {
    background-color: #d4b77e;
  }
  /* Hero-Block der Landingpages (bg-primary): Nebentexte nutzen slate-200/300 als helle Schrift, der Knopf
     bg-surface/text-slate-900 – lokal so belegt, dass Text hell (#dcd9d3 auf #181818 = 13:1) und der Knopf ein
     Gold-Knopf mit schwarzer Schrift (8,0:1) wird. */
  [data-ui='hero'].bg-primary {
    --color-slate-200: #dcd9d3;
    --color-slate-300: #b9b6b0;
    --color-surface: #caa96c;
    --color-slate-900: #181818;
    --color-slate-100: #d4b77e;
  }
  [data-ui='hero']:is(article) {
    border-top: 3px solid var(--amr-gold);
  }
  @media (max-width: 639px) {
    [data-ui='hero']:not(article) {
      background-size: 18rem auto;
      background-position: right -7rem top 1rem;
    }
  }

  [data-ui='footer'] {
    border-top: 1px solid var(--amr-line);
    margin-top: 2rem;
  }

  /* Links im Fließtext unterstrichen in Gold */
  .prose a {
    text-decoration-color: var(--amr-gold);
    text-underline-offset: 0.15em;
  }
  /* Links in eigenen Chat-Blasen (Primärfläche) in Textfarbe */
  .bg-primary .prose a,
  .prose-invert a {
    color: inherit;
  }
}

/* Zähler-Plaketten (bg-amber-400 mit text-slate-900) außerhalb der Kopfleiste: die Spiegelung macht slate-900 im
   dunklen Modus fast weiß – auf Amber nur 1,6:1. Schwarze Schrift auf Amber = 10:1. */
@media not print {
  :root[data-theme='dark'] .bg-amber-400 {
    color: #181818;
  }
  @media (prefers-color-scheme: dark) {
    :root[data-theme='system'] .bg-amber-400 {
      color: #181818;
    }
  }
}
