/* =====================================================================
   werkzeuge/writer/eigen/basis.css
   ------------------------------------------------------------------
   Grundgeruest fuer den Betrieb ohne die lab-Plattform: Reset,
   Typografie, Huelle, Buttons, Formulare, Fokus, Sprunglink,
   lab-Marke und Dunkelmodus-Schalter.

   Im laufenden lab kommt das aus css/layout.css; dieser Auszug ist
   die Entsprechung fuer den mitgelieferten Werkzeugordner und
   traegt dieselben Klassen (.lab_*), damit index.php und app.css
   unveraendert bleiben. Nur, was LabWriter wirklich benutzt, steht
   hier - Karten, Kopfzeile, Fusszeile und Dashboard gehoeren nicht
   dazu (die grosse App verzichtet auf sie, AGENTS.md 5.7).

   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; }

/* ---------------------------------------------------------------
   Huelle der 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;
}

/* ---------------------------------------------------------------
   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;
}

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

/* ---------------------------------------------------------------
   lab-Marke fuer Werkzeuge ohne Plattform-Kopfzeile (AGENTS.md 5.7).
   Die Werkzeuge binden sie in ihre eigene Leiste ein.
   --------------------------------------------------------------- */
.lab_marke {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem 0.2rem 0.3rem;
  border-radius: 7px;
  color: var(--blk-color);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}
.lab_marke img { display: block; }
.lab_marke:hover { background: var(--alt-div-hover-color); }
.lab_marke:hover .lab_marke_text { color: var(--link-color); }
/* Ohne Ziel (eigenstaendiger Betrieb, kein lab davor): die Marke ist
   dann ein Wortzeichen, kein Link - kein Hover, kein Unterstrich. */
.lab_marke_ist_text:hover { background: none; }
.lab_marke_ist_text:hover .lab_marke_text { color: var(--blk-color); }

/* 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_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).
   --------------------------------------------------------------- */
@media print {
  .lab_skip, .lab_tv_ribbon { 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.
   Elemente mit eigener display-Regel (Buttons, Karten) wuerden
   es sonst ignorieren.
   --------------------------------------------------------------- */
[hidden] { display: none !important; }