/* ═══════════════════════════════════════════════════════════════════════
   Jarušica — Bausteine
   Setzt jarusica-tokens.css voraus. Diese Datei enthält KEINEN Hex-Wert.

   Alles hier ist aus Tomes Entwurf gemessen, mit zwei Ergänzungen, die er
   nicht vorgesehen hat und die ein Shop im Betrieb braucht:
     · Zustände (laden, leer, Fehler, teilweise, nicht lieferbar)
     · Mobil — sein Entwurf hat NULL Medienabfragen und steht fest auf
       1440 px; auf dem Telefon würde er seitlich scrollen.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Grundlage ──────────────────────────────────────────────────────── */
.jr { font-family: var(--jr-font-body); font-size: var(--jr-size-body);
      line-height: var(--jr-lh-body); color: var(--jr-ink); }

.jr-h1 { font-family: var(--jr-font-display); font-size: var(--jr-size-hero);
         line-height: var(--jr-lh-hero); font-weight: 700; color: var(--jr-navy); }
.jr-h2 { font-family: var(--jr-font-display); font-size: var(--jr-size-sect);
         line-height: var(--jr-lh-sect); font-weight: 700; color: var(--jr-navy); }
.jr-h3 { font-family: var(--jr-font-display); font-size: var(--jr-size-bar);
         line-height: var(--jr-lh-bar); font-weight: 700; color: var(--jr-navy-deep); }
.jr-h4 { font-family: var(--jr-font-display); font-size: var(--jr-size-card);
         line-height: var(--jr-lh-card); font-weight: 700; color: var(--jr-navy); }

.jr-eyebrow { font-size: var(--jr-size-label); line-height: var(--jr-lh-label);
              font-weight: 700; letter-spacing: var(--jr-ls-label);
              text-transform: uppercase; color: var(--jr-sky); }
.jr-price   { font-family: var(--jr-font-display); font-size: var(--jr-size-price);
              line-height: var(--jr-lh-price); font-weight: 700; color: var(--jr-navy); }
.jr-small   { font-size: var(--jr-size-small); line-height: var(--jr-lh-small); }
.jr-micro   { font-size: var(--jr-size-micro); line-height: var(--jr-lh-micro);
              color: var(--jr-muted-3); }

/* ── Schaltflächen ──────────────────────────────────────────────────── */
.jr-btn { display: inline-flex; align-items: center; gap: 8px; border: 0;
          cursor: pointer; font-family: var(--jr-font-body); font-size: 14px;
          font-weight: 700; line-height: 20px; padding: 12px 20px;
          border-radius: var(--jr-r-lg); text-decoration: none; }
.jr-btn--primary { background: var(--jr-sky); color: #fff; }
.jr-btn--outline { background: transparent; color: var(--jr-navy);
                   border: 1.6px solid var(--jr-navy); }
.jr-btn--navy    { background: var(--jr-navy); color: #fff; font-size: 16px;
                   font-weight: 600; padding: 10px 16px; border-radius: var(--jr-r-md); }
.jr-btn--ghost   { background: transparent; color: var(--jr-navy-deep);
                   border: 1.6px solid var(--jr-navy-deep);
                   font-family: var(--jr-font-display); padding: 8px 20px; }
.jr-btn[disabled], .jr-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Primär ist Sky, nicht Navy. Navy trägt den Warenkorb, Sky die Handlung —
   so steht es in Tomes Entwurf, und es ist eine sinnvolle Trennung. */

.jr-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
           border-radius: var(--jr-r-pill); font-size: var(--jr-size-small);
           font-weight: 400; color: var(--jr-navy); background: transparent;
           border: .8px solid var(--jr-pill-line); cursor: pointer; }
.jr-pill[aria-pressed="true"], .jr-pill--active {
           background: var(--jr-sky); color: #fff; font-weight: 600;
           border-color: transparent; }

/* Gefüllte Marken-Chips sind die Exklusivvertretungen, umrandete die
   übrigen. Das ist eine Aussage über das Geschäft, keine Dekoration. */
.jr-brand { display: inline-block; padding: 3px 8px; border-radius: var(--jr-r-sm);
            font-size: 10.5px; font-weight: 700; letter-spacing: .42px;
            background: var(--jr-navy); color: #fff; }
.jr-brand--soft { background: transparent; color: var(--jr-muted-2);
                  border: .8px solid var(--jr-line); font-weight: 400; letter-spacing: 0; }

/* Fokus. Ohne sichtbaren Fokus ist die Seite per Tastatur unbedienbar. */
.jr-btn:focus-visible, .jr-pill:focus-visible,
.jr-field:focus-visible, a:focus-visible {
  outline: 3px solid var(--jr-focus); outline-offset: 2px; }

/* ── Abschnittsbalken — Tomes wiederkehrendes Gliederungselement ─────── */
.jr-bar { display: flex; align-items: center; justify-content: space-between;
          gap: 16px; flex-wrap: wrap; background: var(--jr-panel);
          border-left: 4px solid var(--jr-sky); padding: 14px 20px; }

/* ── Formularfelder ─────────────────────────────────────────────────── */
.jr-field { display: block; width: 100%; padding: 10px 12px; font: inherit;
            color: var(--jr-ink); background: #fff;
            border: 1.5px solid var(--jr-line-strong); border-radius: var(--jr-r-md); }
.jr-field:focus-visible { outline: 3px solid var(--jr-focus); outline-offset: 1px;
                          border-color: var(--jr-sky); }
.jr-field[aria-invalid="true"] { border-color: var(--jr-error);
                                 background: var(--jr-error-bg); }
.jr-field-help  { font-size: var(--jr-size-small); line-height: var(--jr-lh-small);
                  color: var(--jr-muted-3); margin: 6px 0 0; }
.jr-field-error { font-size: var(--jr-size-small); line-height: var(--jr-lh-small);
                  color: var(--jr-error); margin: 6px 0 0;
                  display: flex; gap: 6px; align-items: flex-start; }

/* Der Fehler gehört per aria-describedby an das Feld gebunden und muss
   sagen, WIE es richtig geht — nicht nur, dass es falsch ist. */

/* ── Zustände ───────────────────────────────────────────────────────── */

/* Laden: Skelett mit den Maßen des geladenen Inhalts, damit beim
   Eintreffen nichts springt. Ein Layoutsprung ist messbar (CLS) und
   ärgert mehr als die Wartezeit. Container braucht aria-busy="true"
   plus ein role="status" daneben — ohne das ist ein Skelett für blinde
   Nutzer eine leere Tabelle. */
.jr-skel { background: linear-gradient(90deg, #EDF2F8 25%, #F7FAFD 37%, #EDF2F8 63%);
           background-size: 400% 100%; animation: jr-shimmer 1.4s ease-in-out infinite;
           border-radius: var(--jr-r-sm); }
.jr-skel-line { height: 12px; margin: 6px 0; }
@keyframes jr-shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }
@media (prefers-reduced-motion: reduce) {
  .jr-skel { animation: none; background: #EDF2F8; }
}

.jr-state { display: flex; gap: 14px; align-items: flex-start; padding: 20px;
            border: 1px solid var(--jr-line); border-radius: var(--jr-r-lg); background: #fff; }
.jr-state__icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--jr-r-md);
                  display: grid; place-items: center;
                  background: var(--jr-mist); color: var(--jr-sky); }
.jr-state h4 { font-size: 14px; line-height: 19px; margin: 0 0 4px; }
.jr-state p  { margin: 0 0 12px; font-size: 13px; line-height: 19px;
               color: var(--jr-muted-2); max-width: 56ch; }
.jr-state--error { border-color: #EAC7C4; }
.jr-state--error .jr-state__icon { background: var(--jr-error-bg); color: var(--jr-error); }
.jr-state--error h4 { color: var(--jr-error); }
.jr-state--warn  { border-color: #E8D3AE; }
.jr-state--warn .jr-state__icon { background: var(--jr-warn-bg); color: var(--jr-warn); }
.jr-state--warn h4 { color: var(--jr-warn); }

/* Nur die Fehlerfläche bekommt role="alert" — die anderen sind kein
   Notfall und würden einen Screenreader grundlos unterbrechen. */

.jr-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px;
             border-radius: var(--jr-r-md); font-size: 13px; line-height: 19px; }
.jr-banner--info  { background: var(--jr-info-bg);  color: #0B4C77;      border: 1px solid #C7DAF2; }
.jr-banner--warn  { background: var(--jr-warn-bg);  color: var(--jr-warn);  border: 1px solid #E8D3AE; }
.jr-banner--error { background: var(--jr-error-bg); color: var(--jr-error); border: 1px solid #EAC7C4; }

/* Lagerzustände. WCAG 1.4.1 verbietet, Information NUR über Farbe zu
   vermitteln — wer Rot und Grün nicht unterscheidet, sähe gleiche Punkte.
   Deshalb steht der Zustand immer auch als Text daneben, und „auf Anfrage"
   bekommt zusätzlich einen offenen statt gefüllten Punkt: Form als
   zweites Signal. */
.jr-stat { display: inline-flex; align-items: center; gap: 6px;
           font-size: var(--jr-size-small); white-space: nowrap; }
.jr-stat::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
                   background: currentColor; flex: 0 0 auto; }
.jr-stat--in     { color: var(--jr-stock); }
.jr-stat--low    { color: var(--jr-warn); }
.jr-stat--out    { color: var(--jr-error); }
.jr-stat--onreq  { color: var(--jr-neutral); }
.jr-stat--onreq::before { background: transparent; border: 1.5px solid currentColor;
                          width: 6px; height: 6px; }

/* ── Katalogtabelle ─────────────────────────────────────────────────── */
.jr-catalog { width: 100%; border-collapse: collapse; }
.jr-catalog th, .jr-catalog td { text-align: left; padding: 10px 12px; vertical-align: top; }
.jr-catalog thead th { font-size: var(--jr-size-label); font-weight: 700;
                       letter-spacing: var(--jr-ls-thead); text-transform: uppercase;
                       color: var(--jr-muted); border-bottom: 1px solid var(--jr-line); }
.jr-catalog td { border-bottom: 1px solid var(--jr-line-soft); }
.jr-catalog tbody tr:nth-child(odd) { background: #F7FAFD; }
.jr-catalog .jr-sku  { color: var(--jr-muted-3); font-size: var(--jr-size-small); }
.jr-catalog .jr-name { font-weight: 600; color: var(--jr-sky); }
.jr-catalog .jr-right { text-align: right; }
.jr-thumb { width: 48px; height: 48px; border-radius: var(--jr-r-sm);
            background: var(--jr-mist); border: 1px solid var(--jr-line);
            object-fit: cover; }

/* ── Mobil ──────────────────────────────────────────────────────────── */

/* Tippziele. Gemessen an unserer eigenen Vorlage: elf Knöpfe lagen bei
   36–40 px. WCAG 2.5.8 verlangt 24 px, Apple und Material empfehlen 44/48.
   Nur für grobe Zeiger — mit Maus wären 44 px unnötig fett. */
@media (pointer: coarse) {
  .jr-btn, .jr-pill, .jr-field { min-height: 44px; }
  .jr-btn  { padding-top: 12px; padding-bottom: 12px; }
  .jr-pill { padding-top: 11px; padding-bottom: 11px; }
}

/* Die Katalogtabelle wird zur Karte. Das ist der Baustein, an dem der
   Webshop hängt: sechs Spalten auf 390 px sind nicht zu retten, und
   waagerechtes Scrollen in einer Produktliste kostet Abschlüsse.
   Semantisch bleibt es eine Tabelle — der <thead> wird nur visuell
   ausgeblendet, ein Screenreader liest weiter Spalte für Spalte.
   Die Spaltenköpfe wandern per data-label vor den Wert. */
@media (max-width: 720px) {
  .jr-catalog, .jr-catalog tbody, .jr-catalog tr, .jr-catalog td { display: block; width: 100%; }
  .jr-catalog thead { position: absolute; width: 1px; height: 1px;
                      overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .jr-catalog tr { border: 1px solid var(--jr-line); border-radius: var(--jr-r-lg);
                   padding: 14px 16px 12px 76px; margin-bottom: 10px;
                   position: relative; min-height: 76px; }
  .jr-catalog tbody tr:nth-child(odd) { background: #fff; }
  .jr-catalog td { border: 0; padding: 2px 0; }
  .jr-catalog td:first-child { position: absolute; left: 16px; top: 14px;
                               width: 48px; padding: 0; }
  .jr-catalog td[data-label]::before {
    content: attr(data-label) " "; font-size: 10px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase; color: var(--jr-muted-3);
    display: block; margin-bottom: 1px; }
  .jr-catalog td.jr-name { font-family: var(--jr-font-display); font-size: 15px;
                           line-height: 20px; font-weight: 700; color: var(--jr-navy);
                           padding-bottom: 6px; }
  .jr-catalog td.jr-name::before { display: none; }
  .jr-catalog .jr-right { text-align: left; }
  .jr-catalog .jr-price { font-size: 18px; }
  /* Preis und Lagerstand nebeneinander — die zwei Werte, wegen derer
     jemand die Liste überhaupt liest. */
  .jr-catalog td.jr-pair { display: inline-block; width: auto; margin-right: 22px; }
}

/* Kategoriepillen schieben statt umbrechen: eine umbrechende Pillenreihe
   frisst auf dem Telefon den halben Bildschirm, bevor der erste Artikel
   sichtbar ist. */
@media (max-width: 720px) {
  .jr-pillbar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
                scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .jr-pillbar::-webkit-scrollbar { height: 0; }
  .jr-pillbar .jr-pill { flex: 0 0 auto; scroll-snap-align: start; }
  .jr-state { flex-direction: column; gap: 10px; }
  .jr-state__icon { width: 34px; height: 34px; }
  .jr-h1 { font-size: 27px; line-height: 31px; }
  .jr-h2 { font-size: 20px; line-height: 26px; }
  .jr-bar { padding: 12px 14px; }
}
