/* druck.1337.hamburg – Ergänzungen zum 1337 Design-System (Präfix a-).
   Das Design-System kennt Kacheln und Knöpfe, aber keine Formulare.
   Alle Farben und Maße kommen aus ds/tokens.css. */

/* Knöpfe und Kacheln setzen display selbst; ohne diese Regel bliebe ein mit „hidden“ versteckter Knopf sichtbar */
[hidden] { display: none !important; }
.a-sprite { position: absolute; }
/* Dateinamen als Seitentitel: umbrechen statt aus dem Bild laufen */
.x-page-head > div { min-width: 0; }
.x-page-head h1 { overflow-wrap: anywhere; }
.a-stack { display: grid; gap: var(--space-4); }
.a-gap { margin-bottom: var(--space-4); }
/* Viele Filter-Chips: auf dem Handy eine Zeile zum Wischen statt einer Wand */
@media (max-width: 899px) { .a-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .a-scroll .x-pill { flex: none; } }
.a-form { display: grid; gap: var(--space-5); max-width: 620px; }
.a-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.a-label, .a-field > legend { padding: 0; font: 700 var(--text-eyebrow) var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.a-field > legend { margin-bottom: 6px; }
.a-hint { font-size: .8rem; color: var(--muted); }
.a-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 16px/1.4 var(--sans); }
.a-input.mono { font-family: var(--mono); font-size: 15px; }
select.a-input { appearance: auto; max-width: 420px; }
textarea.a-input { min-height: 96px; resize: vertical; }

/* Auswahl aus wenigen Möglichkeiten: Radioknöpfe als Umschalter bzw. Zeilen */
.a-seg { display: flex; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.a-seg label { flex: 1; display: grid; place-items: center; min-height: 44px; padding: 6px 10px; font: 600 .9rem var(--mono); cursor: pointer; text-align: center; }
.a-seg label + label { border-left: 1px solid var(--ink); }
.a-seg label:hover { background: var(--accent-tint); }
.a-seg label:has(input:checked) { background: var(--accent); color: var(--on-accent); }
.a-seg label:has(input:focus-visible), .a-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
/* Nur die Auswahlknöpfe selbst verstecken (das Etikett zeichnet sie nach), nicht etwa Zahlenfelder in der Liste */
.a-seg input, .a-pick input[type="radio"], .a-pick input[type="checkbox"], .a-file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.a-pick { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.a-pick label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; cursor: pointer; }
.a-pick label + label { border-top: 1px solid var(--line); }
.a-pick label:hover { background: var(--accent-tint); }
.a-pick label::before { content: ""; flex: none; width: 18px; height: 18px; border: 1px solid var(--ink); border-radius: 50%; background: var(--paper); }
.a-pick label:has(input:checked)::before { background: var(--accent); box-shadow: inset 0 0 0 4px var(--paper); }
/* Dateinamen sind oft ein einziges langes Wort: umbrechen, statt das Feld daneben aus dem Bild zu schieben */
.a-pick .text { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
/* Mehrfachauswahl mit Stückzahl: Kästchen statt Kreis, das Zahlenfeld steht neben dem Etikett */
.a-pick .a-line { display: flex; align-items: center; gap: 8px; padding-right: 10px; }
.a-pick .a-line + .a-line { border-top: 1px solid var(--line); }
.a-pick .a-line label { flex: 1; min-width: 0; padding-right: 0; }
.a-pick.multi label::before { border-radius: 4px; }
.a-pick.multi label:has(input:checked)::before { box-shadow: inset 0 0 0 3px var(--paper); }
.a-input.a-count { width: 72px; flex: none; text-align: center; font-family: var(--mono); }
.a-pick .text b { font-weight: 600; }
.a-pick small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }

/* Dateiwahl */
.a-file { position: relative; display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 14px; border: 1px dashed var(--ink); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.a-file:hover, .a-file:has(input:focus-visible) { background: var(--accent-tint); }
.a-file .x-sym { width: 26px; height: 26px; color: var(--accent-deep); }
.a-file .text { display: flex; flex-direction: column; min-width: 0; }
.a-file b { font: 700 .95rem var(--mono); overflow-wrap: anywhere; }
.a-file small { color: var(--muted); font-size: .8rem; }

/* Der eine große Knopf einer Seite */
.x-btn.a-big { min-height: 48px; padding: 10px 18px; font-size: .95rem; justify-content: center; }
@media (max-width: 699px) { .x-btn.a-big { width: 100%; } }
.x-btn[disabled], .x-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.a-quiet { background: none; border: 0; padding: 0; min-height: 44px; color: var(--muted); font: inherit; font-size: .85rem; text-decoration: underline; }
.a-quiet:hover { color: var(--danger); }

.a-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.a-row.spread { justify-content: space-between; }
.a-row.a-top, .a-top { margin-top: var(--space-3); }
.a-grow { flex: 1 1 200px; width: auto; }
/* Zahlenfeld mit Einheit dahinter, etwa „50 %“ */
.a-unit { display: inline-flex; align-items: center; gap: 6px; flex: none; font-family: var(--mono); }
.x-btn.a-tall { min-height: 44px; padding: 6px 16px; }
.a-or { display: flex; align-items: center; gap: 12px; margin: 0 0 var(--space-4); max-width: 620px; color: var(--muted); font: .8rem var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.a-or::before, .a-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* Drucker auf der Startseite */
.a-printer { margin-bottom: var(--space-3); }
.a-printer .a-state { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; }
.a-printer .a-state .x-status i { width: 12px; height: 12px; }
.a-printer .a-temps { font-family: var(--mono); font-size: .8rem; }
.a-cam { display: block; width: 100%; max-width: 620px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); }
.a-bar { display: block; width: 100%; max-width: 620px; height: 12px; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper); overflow: hidden; appearance: none; -webkit-appearance: none; }
.a-bar::-webkit-progress-bar { background: var(--paper); }
.a-bar::-webkit-progress-value { background: var(--accent); }
.a-bar::-moz-progress-bar { background: var(--accent); }
.a-check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); cursor: pointer; }
.a-check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent-deep); }
/* Vorschaubild der Druckplatte: durchsichtiger Grund, steht deshalb auf einer Kachelfläche */
.a-preview { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.x-tile .a-thumb { background: var(--surface); }
/* Bilder eines Modells von Printables */
/* Seitenverhältnis fest, damit die Seite beim Nachladen des Bilds nicht springt */
.a-shot { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.a-thumb { flex: none; width: 52px; height: 52px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.a-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; max-width: 70ch; }
.a-steps .a-linkbox { margin-top: 6px; }
.a-notice { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-tint); font-size: .9rem; }
.a-notice .x-sym { color: var(--accent-deep); }
.a-empty { margin: 0; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.a-meta { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .9rem; }
.a-meta dt { color: var(--muted); }
.a-meta dd { margin: 0; overflow-wrap: anywhere; }
.x-tile.static:hover { background: none; }
.x-tile .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
/* Warteschlange: Die Knöpfe stehen unter dem Text, sonst bleibt auf dem Handy kein Platz für den Namen. */
.a-queue .x-tile { flex-wrap: wrap; }
.a-queue .x-tile .actions { flex-basis: 100%; justify-content: flex-start; }
.a-queue .x-tile .text a { overflow-wrap: anywhere; }
.a-queue .x-tag { white-space: nowrap; }
@media (min-width: 700px) { .a-queue .x-tile { flex-wrap: nowrap; } .a-queue .x-tile .actions { flex-basis: auto; justify-content: flex-end; } }
.x-tabbar.n4 { grid-template-columns: repeat(4, 1fr); }
.x-topbar .who { display: none; }
@media (min-width: 900px) { .x-topbar .who { display: inline; } }
.x-topbar .x-btn[aria-current="page"] { background: var(--accent-tint); }
/* Nur für Vorleseprogramme */
.a-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[data-passkey-status] { margin: 10px 0 0; }
[data-passkey-status].bad { color: var(--danger); }

/* Einstellungen eines Filaments */
.a-settings { display: grid; gap: 10px; }
.a-setting { display: grid; grid-template-columns: 1fr; gap: 4px; }
.a-setting .name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .9rem; font-weight: 600; }
.a-setting .name code, .a-setting .name small { font: .72rem var(--mono); color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.a-setting.changed .a-input { border-width: 2px; border-color: var(--accent-deep); }
.a-setting.changed .name::after { content: "angepasst"; font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-deep); }
@media (min-width: 700px) { .a-settings.two { grid-template-columns: repeat(2, 1fr); gap: 12px 16px; } }
.a-more { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.a-more > summary { min-height: 44px; padding: 10px 12px; font: 600 .9rem var(--mono); cursor: pointer; }
.a-more > .a-settings { padding: 4px 12px 14px; }

/* Einrichtungslink */
.a-qr { width: 208px; max-width: 100%; padding: 8px; border: 1px solid var(--ink); border-radius: var(--radius); background: #fff; line-height: 0; }
.a-qr svg { width: 100%; height: auto; }
.a-linkbox { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: .8rem var(--mono); overflow-wrap: anywhere; user-select: all; }

/* Anmeldeseite ohne Navigation */
.a-door { max-width: 460px; margin: 0 auto; padding: 12vh 16px 32px; }
.a-door .x-brand { font-size: 1.5rem; }

/* ---------- Bedienung mit dem Finger ---------- */
/* Das Design-System misst Knöpfe für die Maus (34 px). Finger brauchen 44 px. */
@media (pointer: coarse) {
  .x-btn { min-height: 44px; padding-inline: 14px; }
  .x-btn.icon { width: 44px; }
  .x-back { flex-basis: 44px; height: 44px; }
  .x-topbar .x-btn { min-width: 44px; justify-content: center; }
}
/* Kein grauer Schleier beim Antippen, kein Warten auf einen möglichen Doppeltipp */
.x-btn, .x-back, .x-tile, .x-tabbar a, .a-seg label, .a-pick label, .a-file, .a-check, .a-fold > summary, .a-quiet {
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
/* Dafür eine eigene Rückmeldung: Der Knopf gibt nach, die Zeile färbt sich. */
.x-btn:active, .x-back:active { transform: translateY(1px); }
.x-btn.primary:active { filter: brightness(.94); }
a.x-tile:active, .a-pick label:active, .a-seg label:active, .a-file:active, .x-tabbar a:active { background: var(--accent-tint); }

/* Ein Knopf, der gerade arbeitet (app.js setzt aria-busy beim Abschicken) */
.x-btn[aria-busy="true"] { pointer-events: none; opacity: .8; }
.a-spin { flex: none; display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: a-spin .7s linear infinite; }
@keyframes a-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .a-spin { border-right-color: currentColor; border-style: dotted; } }

/* Lange Formulare am Handy: Der Knopf zum Abschicken bleibt über der unteren Leiste stehen. */
@media (max-width: 699px) {
  .a-submit { position: sticky; bottom: calc(53px + var(--safe-bottom)); z-index: 5; margin: 0 -16px calc(-1 * var(--space-3)); padding: 10px 16px; background: var(--paper); border-top: 1px solid var(--line); }
}

/* Kennzahlen eines Auftrags: am Handy zwei nebeneinander, damit „Drucken“ ohne langes Scrollen kommt */
@media (max-width: 699px) {
  .x-cards.a-facts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .a-facts .x-card { padding: 10px 12px; gap: 2px; }
  .a-facts .x-card .head { letter-spacing: .06em; }
  .a-facts .x-card .value { font-size: 1.3rem; }
  .a-facts .x-card .value .unit { font-size: .8rem; }
  .a-facts .x-card .sub { font-size: .78rem; }
}
.a-facts + .x-callout { margin-top: 12px; }

/* Aufklappbarer Abschnitt */
.a-fold { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.a-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 14px; font: 600 .9rem var(--mono); cursor: pointer; list-style: none; }
.a-fold > summary::-webkit-details-marker { display: none; }
.a-fold > summary .x-sym { color: var(--accent-deep); }
.a-fold > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.a-fold[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.a-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.a-fold > .body { display: grid; gap: var(--space-3); padding: 2px 14px 14px; }
.a-fold .sub { margin: 0; font-size: .85rem; color: var(--muted); }
.a-fold.a-section { margin-top: var(--space-5); }
/* Kamerabild in der Drucker-Karte: ohne eigenen Kasten, die Karte ist schon einer */
.a-camfold { border: 0; background: none; }
.a-camfold > summary { min-height: 44px; padding: 0; color: var(--muted); font-weight: 600; }
.a-camfold > .a-cam { margin-top: 4px; }

.a-warn { color: var(--warn); font-weight: 600; }
.a-right { justify-self: end; }
.a-field > .a-quiet { min-height: 32px; margin-top: -30px; }
.a-sub { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
@media (max-width: 699px) {
  .x-cards.a-facts { align-items: stretch; }
  /* Etwas flacher: Das Bild hat oben und unten Rand, und darunter soll „Drucken“ noch aufs erste Bild passen. */
  .a-preview { aspect-ratio: 3 / 2; object-fit: cover; }
}
/* Drucker-Karte: Die Zeile mit den Knöpfen braucht keinen zusätzlichen Abstand, wenn nur der stille Not-Halt darin steht. */
.a-printer .a-row.a-top { margin-top: 0; }
