/*
 * shop.css — Seiten fuer Kaeufer: Kasse, Bestellung, Widerruf, Rechtstexte
 *
 * Mobile zuerst: die Grundwerte gelten fuer 390 px, groessere Fenster bekommen
 * nur mehr Luft (min-width). Keine fixierten oder klebenden Leisten am unteren
 * Rand: Safari malt sonst einen Balken unter seine Leiste
 * (~/.claude/rules/safari-leiste-iphone.md).
 *
 * Farben: Schrift auf Weiss ueber 4,5:1, Linien ueber 3:1. Die Markenfarbe des
 * Betriebs kommt als --akzent (Zierlinien), --akzent-text (Links, Auswahl,
 * Fokus, auf Weiss ueber 4,6:1) und --knopf mit --knopf-text (Hauptknopf; eine
 * helle Marke bleibt Flaeche mit dunkler Schrift). Gerechnet in seiteFarben().
 *
 * Hell und dunkel (includes/thema.php): Jede Farbe ist eine Variable, im Code
 * steht keine feste Farbe. Die dunklen Werte stehen zweimal, fuer Geraete ohne
 * Skript in der Medienabfrage und fuer data-theme. tools/test-farben.php prueft,
 * dass beide gleich sind und jede Schrift in beiden Themen lesbar ist. Beide
 * gelten nur am Bildschirm: gedruckt wird immer hell.
 */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/inter-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/sarabun-400-thai.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/sarabun-600-thai.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }

:root {
  --grund: #f5f6f8;
  --karte: #ffffff;
  --feld: #ffffff;
  --text: #111827;
  --text-2: #4b5563;      /* 7,6:1 auf Weiss */
  --text-3: #5f6672;      /* 5,9:1 auf Weiss, 5,4:1 auf --grund */
  --linie: #858b94;       /* Feldrahmen: 3,4:1 auf Weiss, 3,2:1 auf --grund (vorher 2,97, test-farben.php) */
  --trenner: #e5e7eb;
  --fehler: #b42318;      /* 6,5:1 auf Weiss */
  --fehler-grund: #fef3f2;
  --ok-grund: #ecfdf3;
  --ok-text: #05603a;
  --demo-grund: #eff4ff;
  --demo-text: #1d3f8f;
  --aus-grund: #c9ccd1;   /* gesperrter Knopf */
  --aus-text: #3d434c;
  --knopf-rand: transparent;
  /* Formen. Im Fenster einer Website gibt seiteFarben() deren Ecke vor (?ecken=,
     includes/seite.php), sonst gelten diese. */
  --radius: 12px;
  --radius-knopf: 12px;
  --radius-feld: 10px;
  --radius-pille: 999px;
  color-scheme: light;
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --grund: #0f1115;
    --karte: #181b20;
    --feld: #11141a;
    --text: #f2f3f5;
    --text-2: #c3c8cf;
    --text-3: #a2a9b3;
    --linie: #6f7782;
    --trenner: #2a2f36;
    --fehler: #ff8a80;
    --fehler-grund: #3b1714;
    --ok-grund: #10291c;
    --ok-text: #74e0a5;
    --demo-grund: #16203a;
    --demo-text: #b9c8f5;
    --aus-grund: #2b3038;
    --aus-text: #a8afb8;
    --knopf-rand: rgb(255 255 255 / 0.14);
  }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --grund: #0f1115;
    --karte: #181b20;
    --feld: #11141a;
    --text: #f2f3f5;
    --text-2: #c3c8cf;
    --text-3: #a2a9b3;
    --linie: #6f7782;
    --trenner: #2a2f36;
    --fehler: #ff8a80;
    --fehler-grund: #3b1714;
    --ok-grund: #10291c;
    --ok-text: #74e0a5;
    --demo-grund: #16203a;
    --demo-text: #b9c8f5;
    --aus-grund: #2b3038;
    --aus-text: #a8afb8;
    --knopf-rand: rgb(255 255 255 / 0.14);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 400 16px/1.55 'Inter', 'Sarabun', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
html[lang="th"] body { line-height: 1.7; }
:where(p, li, dd, label, .position-name) { overflow-wrap: break-word; }

a { color: var(--akzent-text); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--akzent-text); outline-offset: 2px;
}

.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Rahmen ─────────────────────────────────────────────────────────── */
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--karte); border-bottom: 3px solid var(--akzent); padding: 10px 16px;
}
.marke { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); min-height: 44px; min-width: 0; }
.marke-logo { height: 36px; width: auto; display: block; }
.marke-name { font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem; }
/* Logo je Thema (seiteAusgeben): ohne logoUrlDark steht im Dunkeln der Name,
   ein dunkles Logo waere dort nicht zu sehen. */
.nur-dunkel { display: none; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nur-hell { display: none; }
  :root:not([data-theme="light"]) .nur-dunkel { display: block; }
}
@media screen {
  :root[data-theme="dark"] .nur-hell { display: none; }
  :root[data-theme="dark"] .nur-dunkel { display: block; }
}

/* Schalter Hell/Dunkel: zwei Knoepfe in einer Pille, der gewaehlte hebt sich ab */
.thema-wahl { display: inline-flex; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--trenner); border-radius: 999px; background: var(--grund); }
.thema-wahl button {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-3); cursor: pointer;
}
.thema-wahl button:hover { color: var(--text); }
.thema-wahl button[aria-pressed="true"] { background: var(--karte); color: var(--text); box-shadow: 0 0 0 1px var(--trenner); }
.thema-wahl svg { width: 18px; height: 18px; }

.inhalt { max-width: 40rem; margin: 0 auto; padding: 20px 16px 40px; }
body.eingebettet { background: var(--karte); }
body.eingebettet .inhalt { padding-top: 8px; }

.seiten-titel { font-size: 1.5rem; line-height: 1.25; margin: 4px 0 12px; font-weight: 650; }
.einleitung { color: var(--text-2); margin: 0 0 16px; }

.fuss { max-width: 40rem; margin: 0 auto; padding: 0 16px 32px; }
.fuss nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.875rem; }
.fuss a { color: var(--text-3); display: inline-block; padding: 8px 0; }
/* "Vertrag widerrufen": hervorgehoben und von den uebrigen Links abgesetzt
   (§ 356a BGB), als Knopf in der Markenfarbe, gross genug zum Tippen. */
.widerruf-knopf { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 2px solid var(--akzent-text);
  border-radius: var(--radius-pille); color: var(--akzent-text); font-weight: 650; text-decoration: none; }
.fuss a.widerruf-knopf { color: var(--akzent-text); padding: 6px 14px; margin-right: 4px; }
.widerruf-knopf:hover { background: color-mix(in srgb, var(--akzent) 10%, transparent); }
/* Thailand: das Ruecktrittsrecht deutlicher als der uebrige Text (Direktmarketing-Gesetz, Sec. 30). */
.rechtstext.betont { color: var(--text); font-weight: 600; border: 2px solid var(--text); border-radius: var(--radius); padding: 4px 16px; }
.kasse-verkaeufer { color: var(--text-2); font-size: 0.875rem; margin: 0 0 8px; }

/* ── Bloecke und Felder ─────────────────────────────────────────────── */
.block { background: var(--karte); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
body.eingebettet .block { padding: 12px 0; border-bottom: 1px solid var(--trenner); border-radius: 0; }
.block h2 { font-size: 1.0625rem; margin: 0 0 12px; font-weight: 650; }

.feld { margin: 0 0 14px; }
.feld label { display: block; font-size: 0.9375rem; font-weight: 550; margin: 0 0 6px; }
.feld input, .feld select, .feld textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--feld);
  border: 1px solid var(--linie); border-radius: var(--radius-feld); padding: 12px; min-height: 48px;
}
.feld textarea { min-height: 96px; resize: vertical; }
.feld input:hover, .feld select:hover, .feld textarea:hover { border-color: var(--text-3); }
.feld[hidden] { display: none; }
.pflicht { color: var(--fehler); margin-left: 2px; }
.block-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pflicht-hinweis { margin: 0 0 12px; font-size: 0.8125rem; color: var(--text-3); }
.aufklapp-reihe { display: flex; flex-wrap: wrap; gap: 0 18px; margin: -4px 0 6px; }
.aufklappen {
  background: none; border: 0; padding: 8px 0; min-height: 44px; cursor: pointer;
  font: inherit; font-size: 0.9375rem; color: var(--akzent-text); text-decoration: underline; text-underline-offset: 3px;
}
.aufklappen[hidden] { display: none; }
/* Aufgeklapptes Feld: Beschriftung links, "Entfernen" rechts in derselben Zeile. */
.feld-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.feld-kopf label { flex: 1; min-width: 0; }
.feld-weg {
  flex: none; background: none; border: 0; padding: 0 0 0 8px; min-height: 32px; cursor: pointer;
  font: inherit; font-size: 0.8125rem; color: var(--text-3); text-decoration: underline; text-underline-offset: 3px;
}
.feld-weg:hover { color: var(--text); }
#rabatt-meldung { margin-top: -4px; }
#rabatt-meldung .link-knopf { min-height: 32px; padding: 0; }
.feld.falsch input, .feld.falsch select { border-color: var(--fehler); border-width: 2px; }
.feld.falsch label { color: var(--fehler); }
.feld-reihe { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.hilfe { font-size: 0.875rem; color: var(--text-3); margin: 6px 0 0; }
.zentriert { text-align: center; }

.hinweis { background: var(--ok-grund); color: var(--ok-text); border-radius: var(--radius-feld); padding: 12px 14px; margin: 0 0 12px; }
.hinweis.fehler, .fehlerliste { background: var(--fehler-grund); color: var(--fehler); }
.hinweis.demo { background: var(--demo-grund); color: var(--demo-text); }
.testmodus-band { margin: 0; padding: 10px 16px; text-align: center; font-weight: 650; background: var(--fehler-grund); color: var(--fehler); }
.fehlerliste { border-radius: var(--radius-feld); padding: 10px 14px; margin: 12px 0; }
.fehlerliste p { margin: 4px 0; }

/* ── Positionen ─────────────────────────────────────────────────────── */
.positionen { list-style: none; margin: 0; padding: 0; }
.position {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
  grid-template-areas: "bild text summe" "bild menge weg";
  padding: 14px 0; border-bottom: 1px solid var(--trenner);
}
.position:last-child { border-bottom: 0; }
.position-bild { grid-area: bild; align-self: start; width: 56px; height: 56px; border-radius: var(--radius-feld); object-fit: cover; background: var(--grund); display: block; }
.position-text { grid-area: text; display: flex; flex-direction: column; min-width: 0; align-self: start; }
.position-name { font-weight: 600; }
.position-optionen, .position-einzel { font-size: 0.875rem; color: var(--text-3); }
.position-fehler { font-size: 0.875rem; color: var(--fehler); font-weight: 550; }
.position.mit-fehler .position-summe { color: var(--text-3); text-decoration: line-through; }
.position-menge { grid-area: menge; display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--linie); border-radius: var(--radius-pille); justify-self: start; }
.menge { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.menge-knopf {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  font-size: 1.15rem; line-height: 1; color: var(--text); cursor: pointer;
}
.menge-knopf:hover { background: var(--grund); }
.position-summe { grid-area: summe; justify-self: end; align-self: start; font-variant-numeric: tabular-nums; font-weight: 600; }
.link-knopf {
  grid-area: weg; justify-self: end; background: none; border: 0; padding: 8px 0; min-height: 44px;
  color: var(--akzent-text); text-decoration: underline; font: inherit; font-size: 0.875rem; cursor: pointer;
}
.leer { color: var(--text-2); }

/* ── Versandarten ───────────────────────────────────────────────────── */
.versandarten { border: 0; padding: 0; margin: 0 0 14px; }
.versandarten legend { font-size: 0.9375rem; font-weight: 550; margin: 0 0 8px; padding: 0; }
.versandart { position: relative; margin: 0 0 8px; }
.versandart input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.versandart label {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  border: 1px solid var(--linie); border-radius: var(--radius-feld); padding: 12px 14px 12px 44px; cursor: pointer; position: relative;
}
.versandart label::before {
  content: ''; position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--linie); background: var(--feld);
}
.versandart label:hover { border-color: var(--text-3); }
.versandart input:checked + label { border: 2px solid var(--akzent-text); padding: 11px 13px 11px 43px; background: color-mix(in srgb, var(--akzent) 7%, var(--karte)); }
.versandart input:checked + label::before { border: 6px solid var(--akzent-text); left: 13px; top: 14px; }
.versandart input:focus-visible + label { outline: 3px solid var(--akzent-text); outline-offset: 2px; }
.versand-name { font-weight: 600; }
.versand-preis { font-variant-numeric: tabular-nums; font-weight: 600; }
.versand-zeit, .versand-info { grid-column: 1 / -1; font-size: 0.875rem; color: var(--text-3); white-space: pre-line; }

/* ── Uebersicht und Knopf ───────────────────────────────────────────── */
.summen { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; margin: 0; }
.summen dt { color: var(--text-2); }
.summen dd { margin: 0; padding-left: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.summen .gesamt { color: var(--text); font-weight: 700; font-size: 1.125rem; padding-top: 8px; border-top: 1px solid var(--trenner); }
.recht { font-size: 0.875rem; color: var(--text-2); margin: 14px 0 0; }
.summen-klein { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--trenner); font-size: 0.9375rem; }
.summen-klein .gesamt { font-size: 1rem; }
.sicher { display: flex; align-items: center; justify-content: center; gap: 6px; }
.sicher svg { width: 16px; height: 16px; flex: none; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--knopf); color: var(--knopf-text); border: 0; border-radius: var(--radius-knopf);
  font: inherit; font-weight: 650; padding: 14px 20px; min-height: 52px; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--knopf-rand); /* im Dunkeln: eine dunkle Marke verschwindet sonst im Grund */
}
.knopf:hover { filter: brightness(1.05); }
.knopf-gross { width: 100%; font-size: 1.0625rem; margin-top: 14px; min-height: 56px; }
.knopf[disabled] { background: var(--aus-grund); color: var(--aus-text); cursor: not-allowed; filter: none; }
.knopf[aria-busy="true"] { opacity: 0.85; }
.btn { /* Formulare des geteilten Widerrufs-Kerns */
  display: inline-flex; align-items: center; justify-content: center; background: var(--knopf); color: var(--knopf-text); border: 0;
  border-radius: var(--radius-knopf); font: inherit; font-weight: 650; padding: 14px 20px; min-height: 52px; margin-top: 16px; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--knopf-rand);
}
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--linie); margin-left: 8px; }

/* ── Widerruf (geteilter Kern) und Rechtstexte ──────────────────────── */
.formular-text label { display: block; font-size: 0.9375rem; font-weight: 550; margin: 14px 0 6px; }
.formular-text input, .formular-text textarea {
  width: 100%; font: inherit; color: var(--text); border: 1px solid var(--linie); border-radius: var(--radius-feld); padding: 12px; min-height: 48px; background: var(--feld);
}
.formular-text textarea { min-height: 110px; }
.formular-text .hint { font-size: 0.875rem; color: var(--text-3); margin: 6px 0 0; }
.formular-text .err { background: var(--fehler-grund); color: var(--fehler); border-radius: var(--radius-feld); padding: 10px 14px; margin: 0 0 12px; }
.formular-text .summary { background: var(--karte); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.formular-text .summary div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--trenner); }
.formular-text .summary span:first-child { color: var(--text-3); font-size: 0.875rem; }
.rechtstext { background: var(--karte); border-radius: var(--radius); padding: 16px; }
/* Link zur Rechnung unter den Summen der Bestellseite. */
.beleg-link { margin: 10px 0 0; font-weight: 600; }
/* Rabattcode: Feld und Knopf in einer Reihe, die Rabattzeile in den Summen. */
.code-reihe { display: flex; gap: 8px; }
.code-reihe input { flex: 1; min-width: 0; text-transform: uppercase; }
/* Wohin geliefert wird, womit man bezahlt: zu Beginn der Kasse (§ 312j Abs. 1 BGB). */
.kasse-eckdaten { margin: 0 0 12px; font-size: .9rem; color: var(--text-2); }
.kasse-eckdaten span + span::before { content: '·'; margin: 0 .5em 0 .1em; }
/* EU-Gewaehrleistungs-Label: das Bild der Kommission, unveraendert, nur skaliert. */
.eu-label { display: block; width: 100%; max-width: 620px; height: auto; border-radius: 6px; }
.rechtstext h3 { font-size: 1rem; margin: 18px 0 6px; }
.rechtstext p { color: var(--text-2); }

@media (min-width: 480px) {
  .feld-reihe { grid-template-columns: 9rem 1fr; }
}
/* Zwei Spalten, sobald die Kasse breit genug ist (auch im Fenster der Website,
   das ab 1024 px Bildschirmbreite 68rem misst): links Formular und Uebersicht mit
   Knopf, rechts der Warenkorb, der beim Scrollen stehen bleibt. Klebt nur eine
   Spalte, nie eine Leiste ueber die volle Breite: kein Safari-Balken. */
@media (min-width: 860px) {
  .inhalt:has(.kasse) { max-width: 64rem; }
  .kasse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: 0 40px; align-items: start; }
  .kasse > .block { grid-column: 1; }
  .kasse > .korb { grid-column: 2; grid-row: 1 / span 20; position: sticky; top: 16px; }
  body.eingebettet .kasse > .korb { background: var(--grund); border: 0; border-radius: var(--radius); padding: 16px 20px; }
}
@media (min-width: 768px) {
  .inhalt { padding: 32px 24px 56px; }
  .block { padding: 20px 24px; }
  .seiten-titel { font-size: 1.75rem; }
  .formular-text .summary div { grid-template-columns: 11rem 1fr; }
}
@media print {
  body { background: #fff; }
  .kopf, .fuss, .knopf, .btn, .thema-wahl { display: none; }
  .block, .rechtstext { padding: 0; }
}
