/* ── Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* ── Zentrale Design-Tokens ─────────────────────────────────────────────
   Single Source: @xware/design-system (ADO-Feed), via postinstall nach
   src/css/lib/design-system/ vendored. Liefert Brand-/Text-/Flaechen-/Border-/
   Layout-Tokens UND das Dark-Theme (prefers-color-scheme + data-theme).
   Werte sind 1:1 die frueher hier lokal definierten. CSS verlangt @import vor
   allen Regeln, darum hier oben direkt nach dem Font-Import. */
@import url('lib/design-system/tokens.css');
/* Generische DS-Komponenten OHNE base-Reset (components.css aus @xware/design-system
   0.2.0). Portal-Markup nutzt .ds-alert/.ds-pill/.btn .btn-* statt eigener
   Duplikate; app-spezifische Klassen (.task-card, .recipe-card, ...) bleiben lokal. */
@import url('lib/design-system/components.css');

/* ── Portal-spezifische Tokens ──────────────────────────────────────────
   Die Brand-/Text-/Flaechen-/Border-/Layout-Tokens kommen jetzt zentral aus
   @xware/design-system (Import oben). Hier bleiben nur app-spezifische Tokens,
   die NICHT ins generische Design-System gehoeren: die Farb-Badges der
   HTTP-Methoden (Swagger-/Endpoint-Ansicht). */
:root {
  --method-post-bg: #DCFCE7;
  --method-post-text: #166534;
  --method-get-bg:  #DBEAFE;
  --method-get-text: #1E40AF;
}

/* ── Reset ──────────────────────────────────────────────────────────── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

/* Buttons, Header-Links, Footer-Links und andere Container heben Underline
 * gezielt wieder auf. Das ist die Konvention: alle Inline-Body-Links sind
 * unterstrichen (axe link-in-text-block), Navigation/Buttons nicht. */
a.btn,
header nav a,
.footer-tech a,
.endpoint-list li > a,
.breadcrumb a {
  text-decoration: none;
}
a.btn:hover,
header nav a:hover,
.footer-tech a:hover,
.endpoint-list li > a:hover,
.breadcrumb a:hover {
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Header (always dark navy, regardless of light/dark mode) ──────── */

header {
  background: var(--primary);
  color: var(--text-on-dark);
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

header .brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-on-dark);
  text-decoration: none;
}

header .brand:hover {
  text-decoration: none;
}

header .brand img {
  height: 28px;
  width: auto;
  display: block;
}

header .brand-suffix {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-on-dark-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}

/* Legacy fallback if a page still uses the old <h1><span>xander</span> ... </h1> pattern */
header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-on-dark);
}

header h1 span {
  font-weight: 400;
  opacity: 0.7;
}

/* ── Navigation ─────────────────────────────────────────────────────── */

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  color: var(--text-on-dark-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
  letter-spacing: 0.01em;
}

nav a:hover {
  color: var(--text-on-dark);
  text-decoration: none;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-on-dark-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
  letter-spacing: 0.01em;
}

.nav-dropdown-toggle::after {
  content: " \25BE";
  font-size: 0.7rem;
  opacity: 0.7;
  margin-left: 0.15rem;
}

.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle {
  color: var(--text-on-dark);
}

.nav-dropdown-menu {
  /*
    Visibility/opacity (instead of display:none) so we can give the user a small
    grace period when the mouse leaves the dropdown — important because otherwise
    a tiny diagonal mouse movement closes the menu before it can be reached.
  */
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  min-width: 220px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 200;
  padding: 0.35rem 0;
  transform: translateY(-2px);
  /* Hide after a 0.25s grace period; fade opacity over 0.15s */
  transition: visibility 0s linear 0.25s, opacity 0.15s ease, transform 0.15s ease;
}

/*
  Invisible hover bridge above the menu, covering the visible 0.5rem gap between
  the toggle button and the menu. Without this the user crosses a dead zone where
  neither the toggle nor the menu is :hover'd, and the menu collapses mid-traverse.
*/
.nav-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -0.6rem;
  left: 0;
  right: 0;
  height: 0.6rem;
  /* Transparent — visually invisible, but part of the menu's hover area */
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  /* Override the close-delay so the menu opens instantly on hover */
  transition: visibility 0s linear, opacity 0.15s ease, transform 0.15s ease;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  color: var(--text-on-dark-muted);
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  background: rgba(151, 191, 13, 0.12);
  color: var(--accent-bright);
}

/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero h2 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 500;
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

/* Button-Styles (.btn, .btn-primary, .btn-secondary, .btn-sm, .btn-danger inkl.
   Hover/Disabled/Focus) kommen jetzt zentral aus @xware/design-system
   (components.css). Das Markup nutzt den DS-Kontrakt `.btn <variant>`.
   App-spezifische Buttons (.add-btn, .process-btn, .btn-regen, .audio-mic-btn,
   .hit-add-btn) und das `.fixture-table .btn-sm`-Spacing bleiben lokal. */

/* ── Features grid (landing page) ──────────────────────────────────── */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto 5rem;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .features {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem 1.5rem;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--primary);
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.65;
}

/* ── Endpoints list (landing page) ─────────────────────────────────── */

.endpoints {
  max-width: var(--max-width);
  margin: 0 auto 5rem;
  padding: 0 2rem;
}

.endpoints h2 {
  /* Sekundäre Heading-Grösse — der Tech-Endpoints-Block ist auf der Landing
   * bewusst de-emphasiert. Ist heute nur auf der Landing in Verwendung. */
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--primary);
}

/* Vertikales Spacing zwischen Landing-Sektionen ohne Inline-Styles. Die
 * primäre .hero hat bereits 6rem padding-top; Folge-Sektionen rücken
 * enger heran. */
section.hero + section.hero {
  margin-top: 2.5rem;
}
section + section.endpoints {
  margin-top: 3rem;
}

.endpoints-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.1rem;
}

.endpoint-list {
  list-style: none;
}

.endpoint-list li {
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.endpoint-list li:hover {
  background: var(--bg-light);
  border-color: var(--accent);
  transform: translateX(2px);
}

.endpoint-list li > a,
.endpoint-list li {
  font-size: 0.9rem;
}

.endpoint-list li > a {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  text-decoration: none;
  color: inherit;
  width: 100%;
}

.endpoint-list li > a:hover {
  text-decoration: none;
  color: inherit;
}

.method {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 3px;
  min-width: 46px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.method.post {
  background: var(--method-post-bg);
  color: var(--method-post-text);
}

.method.get {
  background: var(--method-get-bg);
  color: var(--method-get-text);
}

.path {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.84rem;
  color: var(--text);
}

.desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Footer ─────────────────────────────────────────────────────────── */

footer {
  background: var(--primary);
  color: var(--text-on-dark-muted);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 4rem;
  letter-spacing: 0.01em;
}

footer .footer-tech {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.7;
}
footer .footer-trust {
  margin-bottom: 0.6rem;
  /* opacity entfernt — axe-core color-contrast schlug an, weil 0.75 den Text
   * effektiv unter 4.5:1 drückte. Visuelle De-Emphase nun via font-size
   * (siehe footer.tech-stack), nicht via Transparenz. */
}
@media (max-width: 600px) {
  footer .footer-tech a { display: inline-block; margin: 0.15rem 0.3rem; }
}

footer a {
  /* Heller Kontrast gegen var(--primary) — axe-core (WCAG 2.1 AA) verlangt
   * mindestens 4.5:1. text-on-dark-muted fällt darunter, daher auf
   * text-on-dark wechseln. */
  color: var(--text-on-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer a:hover {
  color: var(--accent-bright);
}

/* ── Dark mode (system preference) ─────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  /* Dark-Token-Overrides kommen zentral aus @xware/design-system/tokens.css.
     Hier bleiben nur portal-spezifische Dark-Anpassungen. */

  /* Hero heading in dark mode reads better in light text */
  .hero h2,
  .endpoints h2,
  .feature-card h3 {
    color: var(--text);
  }

  /* .btn-secondary-Dark kommt jetzt aus den DS-Tokens (components.css),
     kein portal-eigener Dark-Override mehr noetig. */

  footer {
    border-top: 1px solid var(--border);
  }
}

/* ── Content pages (Onboarding, Cookbook, Operations) ────────────── */

.content {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.content .breadcrumb {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  letter-spacing: 0.01em;
}

.content .breadcrumb a {
  color: var(--text-muted);
}

.content .breadcrumb a:hover {
  color: var(--accent);
}

.content h1 {
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.content > .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-weight: 500;
  line-height: 1.7;
}

.content h2 {
  font-size: 1.45rem;
  font-weight: 600;
  margin-top: 2.75rem;
  margin-bottom: 0.85rem;
  color: var(--primary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.005em;
}

.content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.85rem;
  margin-bottom: 0.55rem;
  color: var(--primary);
}

.content p {
  margin-bottom: 1rem;
  line-height: 1.7;
  font-weight: 500;
}

.content ul,
.content ol {
  margin: 0 0 1rem 1.5rem;
  line-height: 1.7;
  font-weight: 500;
}

.content li {
  margin-bottom: 0.45rem;
}

.content code {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.12rem 0.45rem;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.85em;
  color: var(--secondary);
}

.content pre {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-size: 0.82rem;
  line-height: 1.55;
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

.content th,
.content td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-weight: 500;
}

.content th {
  background: var(--bg-light);
  font-weight: 600;
  color: var(--primary);
}

.content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem 0.85rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--bg-light);
  border-radius: 0 4px 4px 0;
}

.content blockquote p {
  margin: 0;
}

/* Alert-Grundstil + Farb-Varianten kommen zentral aus @xware/design-system
   (.ds-alert / .ds-alert-success / .ds-alert-warning). Hier bleiben nur der
   Block-Titel (strong) und der letzte-Absatz-Abstand, die das Portal-Markup
   frueher ueber .callout strong / .callout p:last-child hatte. */
.ds-alert strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--primary);
}

.ds-alert p:last-child {
  margin-bottom: 0;
}

/* Cookbook recipe cards on the overview */
.recipe-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

@media (max-width: 720px) {
  .recipe-card-grid {
    grid-template-columns: 1fr;
  }
}

.recipe-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.3rem;
  background: var(--bg-light);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.recipe-card h3 {
  margin: 0 0 0.4rem 0;
  font-size: 1rem;
  color: var(--primary);
}

.recipe-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (prefers-color-scheme: dark) {
  .content h1,
  .content h2,
  .content h3,
  .recipe-card h3,
  .ds-alert strong,
  .content th {
    color: var(--text);
  }
  .content code {
    color: var(--accent-bright);
    background: var(--bg-neutral);
    border-color: var(--border);
  }
  .content pre code {
    color: var(--text);
  }
}
