/* ============================================================
   FFConnect — Base & Primitives
   Reset · Layout · Typografie · Buttons · Tags · Asset · States
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
:focus-visible {
  outline: 3px solid #1F6FB2;
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-nar); }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.section--dark { background: var(--c-black); color: var(--c-on-dark); }
.section--muted { background: var(--c-surface-2); }
.section--line-top { border-top: 1px solid var(--c-line); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }

/* ---------- Section-Header (Eyebrow + Titel + Lead) ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--c-red);
}
.eyebrow::before {
  content: "";
  width: 24px; height: 3px;
  background: var(--c-red);
  display: inline-block;
}
.section--dark .eyebrow { color: var(--c-yellow); }
.section--dark .eyebrow::before { background: var(--c-yellow); }

.sec-head { max-width: 56ch; margin-bottom: var(--sp-7); }
.sec-head__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-heavy);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin-top: var(--sp-3);
  text-wrap: balance;
}
.sec-head__lead {
  font-size: var(--fs-lg);
  color: var(--c-muted);
  margin-top: var(--sp-4);
  text-wrap: pretty;
}
.section--dark .sec-head__lead { color: var(--c-on-dark-mut); }
.sec-head--center { margin-inline: auto; text-align: center; }
.sec-head--center .eyebrow { justify-content: center; }

/* ---------- Typografie-Helfer ---------- */
h1,h2,h3,h4 { line-height: var(--lh-snug); letter-spacing: var(--ls-tight); }
.t-display { font-size: var(--fs-display); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: var(--ls-tighter); }
.t-h1 { font-size: var(--fs-h1); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.t-h2 { font-size: var(--fs-h2); font-weight: var(--fw-heavy); }
.t-h3 { font-size: var(--fs-h3); font-weight: var(--fw-black); }
.t-h4 { font-size: var(--fs-h4); font-weight: var(--fw-bold); }
.t-lead { font-size: var(--fs-lg); color: var(--c-muted); }
.t-mono { font-family: var(--font-mono); }
.t-muted { color: var(--c-muted); }
.t-sm { font-size: var(--fs-sm); }
.t-upper { text-transform: uppercase; letter-spacing: var(--ls-eyebrow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  border-radius: var(--r-md);
  border: 2px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
  text-align: center;
  line-height: 1.1;
}
.btn:active { transform: translateY(1px); }

/* Icon-Default: verhindert aufgeblaehte SVGs, wenn kein Kontext eine Groesse setzt.
   Kontext-Selektoren (.btn .ic, .filter-list a .ic, ...) ueberschreiben das. */
.ic { width: 1.1em; height: 1.1em; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.btn .ic { width: 1.15em; height: 1.15em; }

.btn--primary { background: var(--c-red); color: #fff; }
.btn--primary:hover { background: var(--c-red-dark); }
.btn--primary:active { background: var(--c-red-darker); }

.btn--secondary {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line-2);
}
.btn--secondary:hover { border-color: var(--c-ink); background: var(--c-surface-2); }

.btn--on-dark {
  background: transparent; color: #fff; border-color: rgba(255,255,255,0.4);
}
.btn--on-dark:hover { border-color: #fff; background: rgba(255,255,255,0.08); }

.btn--tertiary {
  min-height: auto; padding: 0.25rem 0;
  border: none; color: var(--c-red);
  border-radius: 0;
}
.btn--tertiary .ic { transition: transform var(--t-fast); }
.btn--tertiary:hover .ic { transform: translateX(3px); }
.section--dark .btn--tertiary { color: var(--c-yellow); }

.btn--lg { min-height: 56px; padding: 0.9rem 1.8rem; font-size: var(--fs-lg); }
.btn--block { width: 100%; }

/* Notruf-Button: distinct, aber nicht aufdringlich (kein Pulsieren) */
.btn--emergency {
  background: var(--c-black);
  color: #fff;
  border-color: var(--c-black);
  padding-inline: 1.1rem;
  position: relative;
  overflow: hidden;
}
.btn--emergency .num {
  font-family: var(--font-mono);
  font-weight: var(--fw-heavy);
  font-size: 1.05em;
  letter-spacing: 0.02em;
}
.btn--emergency .lbl {
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  opacity: 0.7;
  font-weight: var(--fw-bold);
}
.btn--emergency::after {  /* dezente Gefahrenstreifen-Kante */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--stripe-red);
}
.btn--emergency:hover { background: var(--c-red); border-color: var(--c-red); }
.btn--emergency:hover::after { background: var(--stripe-yellow); }

/* ---------- Tags / Chips ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.28em 0.7em;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  border-radius: var(--r-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tag .dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.tag--brand  { color: var(--c-brand);  background: var(--c-brand-bg); }
.tag--tech   { color: var(--c-tech);   background: var(--c-tech-bg); }
.tag--hazmat { color: var(--c-hazmat); background: var(--c-hazmat-bg); }
.tag--drill  { color: var(--c-drill);  background: var(--c-drill-bg); }
.tag--misc   { color: var(--c-misc);   background: var(--c-misc-bg); }
.tag--ok     { color: var(--c-ok);     background: var(--c-ok-bg); }
.tag--warn   { color: var(--c-warn);   background: var(--c-warn-bg); }
.tag--defect { color: var(--c-defect); background: var(--c-defect-bg); }
.tag--info   { color: var(--c-info);   background: var(--c-info-bg); }
.tag--quiet  { color: var(--c-quiet);  background: var(--c-quiet-bg); }
.tag--solid  { color: #fff; background: var(--c-ink); }
.tag--ghost  { background: transparent; border: 1px solid var(--c-line-2); color: var(--c-muted); font-weight: var(--fw-semi); }

/* Status-Tag mit führendem Punkt */
.status { display: inline-flex; align-items: center; gap: 0.45em; font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.status .dot { width: 0.6em; height: 0.6em; border-radius: 50%; }
.status--ok .dot { background: var(--c-ok); }
.status--warn .dot { background: var(--c-warn); }
.status--defect .dot { background: var(--c-defect); }
/* Status als Tag-Badge (Fahrzeug-Detail): faerbt den Tag selbst, nicht nur den Dot. */
.tag.status--ok     { color: var(--c-ok);     background: var(--c-ok-bg); }
.tag.status--warn   { color: var(--c-warn);   background: var(--c-warn-bg); }
.tag.status--defect { color: var(--c-defect); background: var(--c-defect-bg); }

/* ---------- Asset-Platzhalter (Bild-Briefing für Entwickler) ---------- */
.asset {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(-45deg, rgba(14,15,18,0.025) 0 14px, transparent 14px 28px),
    var(--c-surface-3);
  color: var(--c-muted);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 180px;
}
.asset__inner {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  text-align: center; padding: var(--sp-5); max-width: 90%;
}
.asset__icon {
  width: 30px; height: 30px; opacity: 0.55;
}
.asset__brief {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--c-muted);
}
.asset__brief b { color: var(--c-ink-2); font-weight: var(--fw-bold); }
.asset--dark {
  background:
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.03) 0 14px, transparent 14px 28px),
    #1a1b20;
  color: var(--c-on-dark-mut);
}
.asset--dark .asset__brief { color: var(--c-on-dark-mut); }
.asset--dark .asset__brief b { color: var(--c-on-dark); }
.asset--ratio-wide { aspect-ratio: 16/7; }
.asset--ratio-4x3 { aspect-ratio: 4/3; }
.asset--ratio-square { aspect-ratio: 1/1; }
.asset--ratio-portrait { aspect-ratio: 3/4; }

/* ---------- Forms / Filter-Controls ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.input, .select {
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--c-line-2);
  border-radius: var(--r-md);
  background: var(--c-surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--c-tech);
  box-shadow: var(--sh-focus);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E7079' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}
.search {
  position: relative; display: flex; align-items: center;
}
.search .ic { position: absolute; left: 0.85rem; width: 18px; height: 18px; color: var(--c-muted); pointer-events: none; }
.search .input { padding-left: 2.6rem; }

/* Segmented control (Toggle) */
.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--c-surface-3);
  border-radius: var(--r-md);
  gap: 2px;
}
.segmented button {
  min-height: 40px;
  padding: 0 0.95rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--c-muted);
  display: inline-flex; align-items: center; gap: 0.4em;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button[aria-pressed="true"],
.segmented button.is-active {
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: var(--sh-rest);
}

/* Filter-Pills (Multi-Toggle) */
.pillbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pill {
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--c-line-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--c-ink-2);
  display: inline-flex; align-items: center; gap: 0.45em;
  transition: all var(--t-fast);
  background: var(--c-surface);
}
.pill:hover { border-color: var(--c-ink); }
.pill[aria-pressed="true"], .pill.is-active {
  background: var(--c-ink); color: #fff; border-color: var(--c-ink);
}
.pill .dot { width: 0.55em; height: 0.55em; border-radius: 50%; }

/* ---------- Empty / Error / Loading States ---------- */
.state {
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  border: 1.5px dashed var(--c-line-2);
  border-radius: var(--r-lg);
  background: var(--c-surface-2);
}
.state__icon { width: 44px; height: 44px; margin: 0 auto var(--sp-4); color: var(--c-muted-2); }
.state__title { font-size: var(--fs-h4); font-weight: var(--fw-bold); }
.state__text { color: var(--c-muted); margin-top: var(--sp-2); max-width: 44ch; margin-inline: auto; }

/* Skeleton-Loading */
.skel {
  background: linear-gradient(100deg, var(--c-surface-3) 30%, #f6f7f9 50%, var(--c-surface-3) 70%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skel 1.3s ease-in-out infinite;
}
.skel--line { height: 0.8rem; }
.skel--title { height: 1.4rem; width: 60%; }
.skel--block { height: 180px; border-radius: var(--r-md); }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- Diverse Utilities ---------- */
.divider { height: 1px; background: var(--c-line); border: 0; }
.center { text-align: center; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.cluster--between { justify-content: space-between; }
.hide-m { }
.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;
}
.stripe-edge { position: relative; }
.stripe-edge::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: var(--stripe-yellow);
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 680px) {
  .hide-m { display: none !important; }
}
