/* =====================================================================
   VORLAGE -> eigen/basis.css in jedem Blatt-Werkzeug-Ordner
   ------------------------------------------------------------------
   Grundgeruest fuer den eigenstaendigen Betrieb (AGENTS.md 5.9):
   Reset, Typografie, Huelle, eigene Kopfzeile, Buttons, Formulare,
   Fokus, Sprunglink und Druckregeln.

   Im laufenden lab kommt das aus css/layout.css; diese Datei ist die
   Entsprechung fuer den mitgelieferten Werkzeugordner und traegt
   dieselben Klassen (.lab_*), damit index.php und app.css unveraendert
   bleiben. Nur, was die Blatt-Werkzeuge wirklich benutzen, steht hier -
   Dashboard, Fusszeile und Textseiten gehoeren nicht dazu.

   Diese Datei wird erzeugt von:
     php scripts/blattwerkzeug-paket.php
   Aenderungen immer in der Vorlage unter
   scripts/vorlagen/blattwerkzeug/ machen, dann das Skript laufen
   lassen - sonst passen die 15 Ordner nicht mehr zusammen.

   Konventionen wie in der Plattform:
     - Klassen mit Prefix .lab_ (AGENTS.md 2.5)
     - Keine harten Farben, nur Variablen aus eigen/colors.css
     - Kommentare auf Deutsch
   ===================================================================== */

/* ---------------------------------------------------------------
   Reset / Grundlagen
   --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.lab_body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bd-color);
  color: var(--blk-color);
  font-family: var(--lab-font);
  font-size: 1rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
h2 { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.85rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--link-color); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-h-color); }

ul, ol { margin: 0 0 0.85rem; padding-left: 1.2rem; }

code, kbd, samp, pre, .lab_mono {
  font-family: var(--lab-mono);
  font-size: 0.92em;
}

hr {
  border: 0;
  border-top: var(--lab-border);
  margin: 1.4rem 0;
}

img, svg { max-width: 100%; }

/* Sichtbarer Fokus fuer Tastaturbedienung (Maus-Fokus bleibt ruhig) */
:focus-visible {
  outline: 2px solid var(--bt-color);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--green100-color); color: var(--blk-color); }

/* ---------------------------------------------------------------
   Hilfsklassen
   --------------------------------------------------------------- */
.lab_sr_only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lab_sprite { display: none; }

.lab_icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex: none;
}

.lab_skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--bt-color);
  color: var(--bt-f-color);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.lab_skip:focus { left: 0; color: var(--bt-f-color); }

.lab_hinweis { color: var(--grey600-color); font-size: 0.9rem; }

/* ---------------------------------------------------------------
   Huelleder Seite
   --------------------------------------------------------------- */
.lab_shell {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Breitere Huelle fuer Werkzeuge, die Platz brauchen (AGENTS.md 5.2) */
.lab_shell.lab_shell_breit {
  max-width: 108rem;
  padding-left: clamp(1.25rem, 3vw, 3rem);
  padding-right: clamp(1.25rem, 3vw, 3rem);
}

.lab_main {
  flex: 1 1 auto;
  padding: 1.5rem 0 3rem;
}

/* ---------------------------------------------------------------
   Eigene Kopfzeile des Werkzeugordners.
   Sie traegt bewusst die Klassen der Plattform-Kopfzeile
   (.lab_header, .lab_brand ...), damit die Druckregeln der
   Werkzeuge in app.css - dort steht ".lab_header { display:none }" -
   auch im eigenstaendigen Betrieb greifen.
   --------------------------------------------------------------- */
.lab_header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--lab-toolbar-bg);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: var(--lab-border);
}

.lab_header_inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.6rem;
}

.lab_brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--blk-color);
  min-width: 0;
}

.lab_brand_mark {
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 8px;
  display: block;
}

.lab_brand_text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.lab_brand_name { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.lab_brand_sub {
  font-family: var(--lab-mono);
  font-size: 0.72rem;
  color: var(--grey600-color);
  white-space: nowrap;
}

.lab_header_actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

/* ---------------------------------------------------------------
   Buttons - eine Basis, drei Varianten
   --------------------------------------------------------------- */
.lab_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: var(--lab-border);
  background: var(--ct-color);
  color: var(--blk-color);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lab_btn:hover { background: var(--alt-div-hover-color); color: var(--blk-color); }

.lab_btn_primary {
  background: var(--bt-color);
  border-color: var(--bt-color);
  color: var(--bt-f-color);
}
.lab_btn_primary:hover {
  background: var(--bt-h-color);
  border-color: var(--bt-h-color);
  color: var(--bt-f-color);
}

.lab_btn_icon { padding: 0.5rem; width: 2.3rem; height: 2.3rem; }

.lab_btn[disabled],
.lab_btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.lab_btn_text { white-space: nowrap; }

/* ---------------------------------------------------------------
   Formulare
   --------------------------------------------------------------- */
input[type="search"],
input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
  font: inherit;
  color: var(--blk-color);
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  width: 100%;
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--bt-color);
  outline: 2px solid var(--lab-ring);
  outline-offset: 0;
}

/* ---------------------------------------------------------------
   Aufklappbares Hinweispanel am Fuss der Werkzeuge (AGENTS.md 5.6)
   --------------------------------------------------------------- */
details.lab_ueber {
  margin-top: 1.2rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
}
details.lab_ueber summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--grey600-color);
}
details.lab_ueber[open] summary { margin-bottom: 0.4rem; }
details.lab_ueber p { margin: 0.4rem 0; font-size: 0.92rem; }
details.lab_ueber p:last-child { margin-bottom: 0.1rem; }

/* ---------------------------------------------------------------
   Installieren-Knopf: bleibt versteckt, bis der Browser ein
   Installationsangebot meldet (eigen/geraet.js setzt hidden=false)
   --------------------------------------------------------------- */
.lab_install[hidden] { display: none !important; }

/* Dunkelmodus-Schalter: Sonne im hellen, Mond im dunklen Modus
   (derselbe Knopf, geraet.js verdrahtet ihn ueber die Id lab_theme) */
.lab_theme_icon_sonne,
.lab_theme_icon_mond { display: inline-flex; }
.lab_theme_icon_mond { display: none; }
html[data-theme="dark"] .lab_theme_icon_sonne { display: none; }
html[data-theme="dark"] .lab_theme_icon_mond { display: inline-flex; }

/* ---------------------------------------------------------------
   Kleine Schirme
   --------------------------------------------------------------- */
@media (max-width: 40rem) {
  .lab_brand_sub { display: none; }
  .lab_header_inner { gap: 0.5rem; min-height: 3.2rem; }
  .lab_btn_text { display: none; }
  .lab_btn_icon { width: 2.3rem; height: 2.3rem; padding: 0.5rem; }
  .lab_main { padding-top: 1rem; }
}

@media (min-width: 60rem) {
  .lab_shell { padding: 0 1.5rem; }
}

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

/* ---------------------------------------------------------------
   Drucken: nur Inhalt, keine Bedienelemente. Die genaue Druck-
   Fassung des Blattes steht in app.css (@media print) - dort werden
   Leiste und Hintergruende ausgeblendet und das Druckblatt gezeigt.
   --------------------------------------------------------------- */
@media print {
  .lab_header, .lab_footer, .lab_skip { display: none !important; }
  body.lab_body { background: #FFFFFF; color: #000000; }
  .lab_main { padding: 0; }
  .lab_shell { max-width: none; padding: 0; }
}

/* ---------------------------------------------------------------
   WICHTIG: das hidden-Attribut muss immer gewinnen. Karten und
   Buttons haben eigene display-Regeln und wuerden es sonst ignorieren.
   --------------------------------------------------------------- */
[hidden] { display: none !important; }