/* ============================================================
   EAN-Suche.net — Stylesheet
   Gestaltungsidee: die Welt des Barcodes selbst.
   Etikettenpapier, Strichcode-Schwarz, Scanner-Laser-Rot.
   Ein responsiver Template-Satz für alle Geräte.
   ============================================================ */

/* ---------- Schriften (selbst gehostet, DSGVO-konform) ---------- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/archivo-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/archivo-latin-800-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
}

/* ---------- Design-Token ---------- */
:root {
  --paper: #f2f4f1;        /* Etikettenpapier */
  --surface: #ffffff;
  --ink: #15181c;          /* Strichcode-Schwarz */
  --muted: #5a626c;
  --line: #d7dbd4;
  --laser: #e0261f;        /* Scanner-Laser */
  --laser-soft: #fdecea;
  --ok: #1e7f43;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(21, 24, 28, .06), 0 8px 24px rgba(21, 24, 28, .07);
  --wrap: 1080px;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  /* Sticky Footer: Seite füllt mindestens den Bildschirm,
     main dehnt sich, Footer klebt am unteren Rand */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); margin-top: 1.6em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--laser); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--laser); }

code, .code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .08em .35em;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--laser); outline-offset: 2px; }

/* Eyebrow: kleine Mono-Überzeile, kodiert den Seitentyp */
.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: .6rem;
}

/* ---------- Markenzeichen: CSS-Barcode ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.brand-bars i { display: block; background: var(--ink); height: 100%; }
.brand-bars i:nth-child(1) { width: 3px; }
.brand-bars i:nth-child(2) { width: 1.5px; }
.brand-bars i:nth-child(3) { width: 4px; }
.brand-bars i:nth-child(4) { width: 1.5px; background: var(--laser); }
.brand-bars i:nth-child(5) { width: 2.5px; }
.brand-bars i:nth-child(6) { width: 5px; }
.brand-bars i:nth-child(7) { width: 2px; }
.brand-bars.small { height: 14px; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.01em; }
.brand-tld { color: var(--muted); font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px; flex-wrap: wrap; padding-top: .5rem; padding-bottom: .5rem;
}
.site-nav { display: flex; gap: 1.35rem; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--muted);
  padding: .25rem 0; border-bottom: 2px solid transparent;
}
.site-nav .nav-short { display: none; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--laser); }

/* ---------- Hero mit Scan-Feld (Signatur-Element) ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); text-align: center; }
.hero h1 { margin-bottom: .35em; }
.hero .sub { color: var(--muted); max-width: 720px; margin: 0 auto 2rem; font-size: 1.06rem; }

.scanfield { max-width: 720px; margin: 0 auto; position: relative; }
.scanfield form { display: flex; gap: 0; }
.scanfield input[type="search"] {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 1.05rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--ink);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.scanfield input[type="search"]::placeholder { color: #9aa1a9; }
.scanfield input[type="search"]:focus { outline: none; }
.scanfield button {
  font-family: var(--sans); font-weight: 800; font-size: 1rem;
  padding: 0 1.6rem; cursor: pointer;
  border: 2px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--ink); color: #fff;
}
.scanfield button:hover { background: var(--laser); border-color: var(--laser); }

/* Der Laserstrahl: rote Linie, die beim Fokus über das Feld fährt */
.scanfield .laser {
  position: absolute; left: 2px; right: 2px; top: 2px;
  height: 2px; background: var(--laser);
  opacity: 0; pointer-events: none;
  box-shadow: 0 0 6px rgba(224, 38, 31, .7);
}
.scanfield:focus-within .laser {
  opacity: 1;
  animation: laser-sweep 1.6s ease-in-out infinite alternate;
}
@keyframes laser-sweep {
  from { transform: translateY(0); }
  to   { transform: translateY(52px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scanfield:focus-within .laser { animation: none; top: 50%; }
}
.scanfield .hint {
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
  margin-top: .7rem;
}

/* ---------- Karten & Abschnitte ---------- */
.section { padding: 1.2rem 0 2.2rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* Kartenreihe (Startseite: drei Werkzeuge) */
.tools {
  max-width: 1000px;   /* gleiche Kante wie alle Inhaltskarten (prose-wide) */
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 1.5rem 0 0;
}
.tool {
  display: block; text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  transition: border-color .15s ease, transform .15s ease;
}
.tool:hover { border-top-color: var(--laser); transform: translateY(-2px); color: inherit; }
.tool h3 { margin-bottom: .3rem; }
.tool p { color: var(--muted); font-size: .95rem; margin: 0; }
.tool .go { font-family: var(--mono); font-size: .78rem; color: var(--laser); font-weight: 600; }

/* ---------- Tabellen ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  border-bottom: 2px solid var(--ink);
}
tbody tr:hover { background: #fafbf9; }
td.num, th.num { font-family: var(--mono); white-space: nowrap; }

/* ---------- Formulare ---------- */
label { font-weight: 600; font-size: .95rem; display: block; margin-bottom: .3rem; }
input[type="text"], select {
  font-family: var(--mono); font-size: 1rem;
  padding: .65rem .8rem; width: 100%;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
input[type="text"]:focus, select:focus { outline: 2px solid var(--laser); outline-offset: 1px; }
.btn {
  display: inline-block; cursor: pointer;
  font-family: var(--sans); font-weight: 800; font-size: 1rem;
  padding: .7rem 1.6rem;
  background: var(--ink); color: #fff;
  border: 2px solid var(--ink); border-radius: var(--radius);
  text-decoration: none;
}
.btn:hover { background: var(--laser); border-color: var(--laser); color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { color: var(--laser); background: transparent; }

.form-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end; margin-bottom: 1rem;
}
.form-row-submit { grid-template-columns: 1fr auto; }
@media (max-width: 560px) {
  .form-row-submit { grid-template-columns: 1fr; }
  .form-row-submit .btn { width: 100%; }
}
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--laser); }

/* ---------- Meldungen ---------- */
.alert {
  border-radius: var(--radius); padding: .8rem 1rem; margin: 1rem 0;
  font-weight: 600; border: 1px solid;
}
.alert.error { background: var(--laser-soft); border-color: var(--laser); color: #9b1a15; }
.alert.info  { background: #eef3f8; border-color: #b9cfe3; color: #23486b; }
.alert.ok    { background: #eaf6ee; border-color: #bfe0c9; color: var(--ok); }

/* ---------- Produktseite ---------- */
.breadcrumbs { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin: 1.4rem 0 .8rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--laser); }

.product-card { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: start; }
.product-card:has(.product-photo) { grid-template-columns: auto 1fr auto; }
.product-photo img { max-width: 120px; max-height: 150px; width: auto; height: auto;
                     border: 1px solid var(--line); border-radius: 6px; background: #fff;
                     padding: 4px; object-fit: contain; }
.product-card .barcode-img img { max-width: 170px; height: auto; display: block; opacity: .92; }
.product-card .qr { text-align: center; }
.product-card .qr img { width: 130px; height: 130px; display: block; margin: 0 auto; }
.product-card .qr p { font-size: .78rem; color: var(--muted); max-width: 160px; margin: .4rem auto 0; }
.ean-line { font-family: var(--mono); font-size: 1rem; margin: .2rem 0 1rem; }
.ean-line .lbl { color: var(--muted); }

.badge {
  display: inline-block; font-family: var(--mono); font-size: .72rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem;
  color: var(--muted); background: var(--surface); margin-right: .4rem;
}
.badge.ok { color: var(--ok); border-color: #bfe0c9; }

/* EAN-Struktur-Zerlegung */
.ean-parts { display: flex; flex-wrap: wrap; gap: .25rem; font-family: var(--mono); font-size: .95rem; margin: .6rem 0 .3rem; }
.ean-parts span { padding: .15rem .4rem; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); }
.ean-parts .p-prefix { border-bottom: 2px solid #2a6fbb; }
.ean-parts .p-body   { border-bottom: 2px solid var(--ok); }
.ean-parts .p-check  { border-bottom: 2px solid var(--laser); }
.ean-legend { font-size: .82rem; color: var(--muted); }
.ean-legend b { font-weight: 600; }
.dot { display: inline-block; width: .65em; height: .65em; border-radius: 2px; margin-right: .3em; vertical-align: baseline; }
.dot.blue { background: #2a6fbb; } .dot.green { background: var(--ok); } .dot.red { background: var(--laser); }

/* ---------- Suchergebnisse ---------- */
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li + li { border-top: 1px solid var(--line); }
.result-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .95rem .75rem .95rem .9rem;
  margin: 0 -.75rem;                 /* Hover-Fläche bis an den Kartenrand */
  text-decoration: none; color: inherit;
  border-left: 3px solid transparent;
  border-radius: 4px;
  transition: background-color .12s ease, border-color .12s ease;
}
.result-item:hover,
.result-item:focus-visible {
  background: var(--surface);
  border-left-color: var(--laser);
}
.result-item:focus-visible { outline: 2px solid var(--laser); outline-offset: -2px; }
.result-item .result-body { display: block; min-width: 0; }
.result-item .name {
  display: block; font-weight: 600; font-size: 1.05rem;
  color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--line); text-underline-offset: 3px;
  transition: color .12s ease, text-decoration-color .12s ease;
}
.result-item:hover .name { color: var(--laser); text-decoration-color: var(--laser); }
.result-item .meta { display: block; font-family: var(--mono); font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.result-cta {
  flex-shrink: 0; font-family: var(--mono); font-size: .78rem;
  color: var(--muted); white-space: nowrap;
}
.result-item:hover .result-cta { color: var(--laser); }
.result-cta .arrow { display: inline-block; transition: transform .12s ease; }
.result-item:hover .result-cta .arrow { transform: translateX(3px); }
.result-variants { margin: -.35rem 0 .6rem .95rem; }
.result-variants summary {
  cursor: pointer; font-family: var(--mono); font-size: .78rem;
  color: var(--muted); list-style: none; display: inline-block;
  padding: .1rem 0; border-bottom: 1px dashed var(--line);
}
.result-variants summary::-webkit-details-marker { display: none; }
.result-variants summary:hover { color: var(--laser); border-bottom-color: var(--laser); }
.result-variants ul {
  list-style: none; margin: .4rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .35rem .6rem;
}
.result-variants ul a {
  font-family: var(--mono); font-size: .78rem; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: .15rem .45rem; display: inline-block;
}
.result-variants ul a:hover { border-color: var(--laser); color: var(--laser); }
@media (max-width: 480px) {
  .result-cta { display: none; }     /* mobil reicht die klickbare Karte */
}
@media (prefers-reduced-motion: reduce) {
  .result-item, .result-item .name, .result-cta .arrow { transition: none; }
}

/* ---------- Generator-Ergebnis ---------- */
.generator-result { text-align: center; padding: 1.5rem; background: var(--surface); border: 1px dashed var(--ink); border-radius: var(--radius); }
.generator-result img { max-width: min(340px, 100%); height: auto; }
.generator-result .preview-note { font-size: .78rem; color: var(--muted); margin-top: .5rem; }

/* ---------- Fußzeile ---------- */
main { flex: 1 0 auto; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 3rem; flex-shrink: 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: 1.4rem; padding-bottom: 1.6rem;
  font-size: .9rem;
}
.footer-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; }
.footer-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--laser); }

.affiliate-note { font-size: .82rem; color: var(--muted); margin-top: 1.2rem; }

/* ---------- Wissen / Fließtext ---------- */
.prose { max-width: 860px; }
.prose-wide { max-width: 1000px; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
dl.faq dt { font-weight: 800; margin-top: 1.1rem; }
dl.faq dd { margin: .3rem 0 0; color: var(--muted); }

/* ---------- Responsiv ---------- */
@media (max-width: 720px) {
  .product-card { grid-template-columns: 1fr !important; }
  .product-photo { text-align: center; }
  .product-photo img { max-width: 150px; }
  .scanfield form { flex-direction: column; gap: .6rem; }
  .scanfield input[type="search"] { border-right: 2px solid var(--ink); border-radius: var(--radius); }
  .scanfield button { padding: .85rem 1.6rem; border-radius: var(--radius); }
  .header-inner { justify-content: center; }

  /* Navigation einzeilig: Kurzform "Generator" statt "Barcode-Generator",
     dadurch passen alle vier Punkte ohne Umbruch und ohne Wischen */
  .site-nav {
    flex-wrap: nowrap;
    width: 100%;
    justify-content: center;
    gap: clamp(.7rem, 3.5vw, 1.3rem);
  }
  .site-nav a { font-size: .88rem; white-space: nowrap; flex-shrink: 0; }
  .site-nav .nav-long { display: none; }
  .site-nav .nav-short { display: inline; }

  /* QR-Code ist am Handy überflüssig (man IST ja schon am Handy) */
  .product-card .qr { display: none; }

  /* Angebots-Tabelle: Produktname ausblenden, damit Preis/Anbieter-Link
     ohne Scrollen sichtbar bleiben. Der Produktname steht ohnehin oben
     auf der Seite. */
  .offers-table th:first-child,
  .offers-table td:first-child { display: none; }
}

@media print {
  .site-header, .site-footer, .scanfield, .tools { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; padding: 0; }
}


/* ---------- Zuletzt gefunden (Startseite) ---------- */
.recent-list { list-style:none; margin:0; padding:0;
               display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:.4rem 1.2rem; }
.recent-list li { border-bottom:1px solid var(--line); padding:.35rem 0; }
.recent-list a { text-decoration:none; font-weight:600; }
.recent-list a:hover { color:var(--laser); }
.recent-list .meta { display:block; font-family:var(--mono); font-size:.75rem; color:var(--muted); }

/* ---------- Fehler-melden-Box (Produktseite) ---------- */
.report-box { margin:1.2rem 0; }
.report-box summary { cursor:pointer; font-size:.85rem; color:var(--muted);
                      display:inline-block; border-bottom:1px dashed var(--line); }
.report-box summary:hover { color:var(--laser); border-bottom-color:var(--laser); }

textarea { border:2px solid var(--ink); border-radius:var(--radius);
           padding:.6rem .8rem; font-size:.95rem; background:#fff; }
textarea:focus { outline:2px solid var(--laser); outline-offset:1px; }


/* Codeblöcke: horizontal scrollen statt aus dem Layout laufen */
.prose pre {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .8rem 1rem;
  overflow-x: auto; max-width: 100%;
}
/* Inline-Code-Optik (Kästchen/Rahmen) innerhalb von Codeblöcken abschalten */
.prose pre code {
  background: none; border: none; box-shadow: none;
  padding: 0; margin: 0; display: block;
  font-size: .85rem; line-height: 1.55; white-space: pre;
}
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; padding: 0;
  cursor: pointer; border-radius: 5px;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line);
  opacity: 0; transition: opacity .15s ease, color .15s ease;
}
.prose pre:hover .copy-btn,
.copy-btn:focus-visible, .copy-btn.ok { opacity: 1; }
.copy-btn:hover { color: var(--ink); }
.copy-btn.ok { color: #1a7f37; border-color: #1a7f37; }
@media (hover: none) { .copy-btn { opacity: .75; } }


/* ---------- Preisverlauf (Produktseite) ---------- */
.price-chart { width: 100%; max-width: 620px; height: auto; display: block;
               background: var(--surface); border: 1px solid var(--line);
               border-radius: 6px; margin: .2rem 0 1rem; }


/* ---------- Anker-Sprünge (#widget u. a.): Kopfleiste einkalkulieren,
   sonst verschwindet die angesprungene Überschrift unter der Leiste.
   Großzügig bemessen – am Handy ist die Leiste höher (zweizeilig). ---------- */
html { scroll-padding-top: 110px; }
@media (max-width: 700px) { html { scroll-padding-top: 150px; } }

/* ---------- Client-Typ-Badges in der Rate-Limits-Übersicht ---------- */
.lg-type { display: inline-flex; align-items: center; gap: .2rem;
           font-size: .72rem; font-weight: 600; padding: .1rem .5rem;
           border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.lg-type-bot  { background: #e7f0ff; color: #1b4fa0; }
.lg-type-warn { background: #fdecec; color: #a5251f; }
.lg-type-user { background: var(--surface); color: var(--muted); }
.lg-ip { margin-right: .1rem; }
