/* =====================================================================
   lab - css/layout.css
   Grundgeruest: Reset, Typografie, Kopfzeile, Fuss, Buttons, Formulare.
   Dashboard-spezifisches steht in css/dashboard.css.
   Werkzeug-spezifisches gehoert in die jeweilige Werkzeug-Datei.

   Konventionen (AGENTS.md §5):
     - Alle Klassen mit Prefix .lab_
     - Keine harten Farben, nur Variablen aus css/colors.css
     - Kommentare auf Deutsch, lesbar vor clever
   ===================================================================== */

/* ---------------------------------------------------------------
   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 (z. B. LabVectorDraw).
   Nur diese Seiten bekommen mehr Breite UND mehr Randabstand;
   das Dashboard bleibt bei .lab_shell (78rem). */
.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;
}
/* ---------------------------------------------------------------
   Kopfzeile
   --------------------------------------------------------------- */
.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:hover { color: var(--blk-color); }

.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_nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.lab_nav_link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--blk-color);
  text-decoration: none;
  white-space: nowrap;
}
.lab_nav_link:hover { background: var(--alt-div-hover-color); color: var(--blk-color); }
.lab_nav_link.is_aktiv { background: var(--green50-color); color: var(--link-color); font-weight: 600; }

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

/* Sprach-Wahl: schlichtes Dropdown in der Kopfzeile */
.lab_sprachen { display: inline-flex; align-items: center; }
.lab_sprachen select {
  font: inherit;
  font-size: 0.85rem;
  max-width: 9.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--lab-border);
  border-radius: 0.6rem;
  background: var(--ct-color);
  color: var(--blk-color);
}

/* ---------------------------------------------------------------
   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"],
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,
select:focus,
textarea:focus {
  border-color: var(--bt-color);
  outline: 2px solid var(--lab-ring);
  outline-offset: 0;
}
/* ---------------------------------------------------------------
   Fusszeile
   --------------------------------------------------------------- */
.lab_footer {
  border-top: var(--lab-border);
  background: var(--ct-color);
  padding: 1.5rem 0;
  margin-top: auto;
}

.lab_footer_inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: flex-start;
  justify-content: space-between;
}

.lab_footer_spalte { min-width: 15rem; }

.lab_footer_titel {
  font-family: var(--lab-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey600-color);
  margin-bottom: 0.35rem;
}

.lab_footer_links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
}

.lab_footer_p { font-size: 0.9rem; margin: 0 0 0.35rem; }

.lab_footer_meta {
  font-size: 0.8rem;
  color: var(--grey600-color);
  margin-top: 0.6rem;
}

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

/* ---------------------------------------------------------------
   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 (max-width: 34rem) {
  .lab_nav_link span.lab_nav_text { display: none; }
  .lab_sprachen select { max-width: 6.5rem; }
}

@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
   --------------------------------------------------------------- */
@media print {
  .lab_header, .lab_footer, .lab_skip, .lab_toolbar { display: none !important; }
  body.lab_body { background: #FFFFFF; color: #000000; }
  .lab_main { padding: 0; }
  .lab_shell { max-width: none; padding: 0; }
}
/* ---------------------------------------------------------------
   Textseiten (z. B. impressum.php)
   Ruhige, gut lesbare Flaeche mit 48rem Zeilenbreite.
   --------------------------------------------------------------- */
.lab_textblock {
  max-width: 48rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: var(--lab-shadow-1);
}

.lab_textblock h2 {
  margin: 1.5rem 0 0.5rem;
  padding-top: 1.1rem;
  border-top: var(--lab-border);
  font-size: 1.15rem;
}
.lab_textblock h2:first-of-type { margin-top: 0.3rem; padding-top: 0; border-top: 0; }

.lab_textblock ul { padding-left: 1.2rem; }
.lab_textblock li { margin-bottom: 0.35rem; }
.lab_textblock a { font-weight: 500; }

@media (max-width: 40rem) {
  .lab_textblock { padding: 1rem 1rem 1.1rem; }
}
/* ---------------------------------------------------------------
   WICHTIG: das hidden-Attribut muss immer gewinnen.
   Elemente wie .lab_card (display:flex) oder .lab_chip (display:inline-flex)
   haben eine eigene display-Regel - ohne diese Zeile wuerde hidden ignoriert
   und die Karten liessen sich nicht filtern (Fehler vom September 2026).
   --------------------------------------------------------------- */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------
   Einheitliche Einfuehrung der Werkzeuge (AGENTS.md 5.6): Die Seite
   beginnt mit dem Werkzeug; Erklaerungstexte stehen in diesem
   aufklappbaren Panel am Ende der Seite - in allen Werkzeugen mit
   gleichem Aussehen und gleichem Aufklapptext.
   --------------------------------------------------------------- */
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;
}
/* ---------------------------------------------------------------
   lab-Marke für Werkzeuge ohne Plattform-Kopfzeile ($lab_ohne_kopf):
   Kolben + Schriftzug als Verweis zurück zur Werkzeug-Übersicht.
   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); }

/* Dunkelmodus-Schalter: Sonne im hellen, Mond im dunklen Modus
   (derselbe Knopf, theme.js verdrahtet ihn über 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; }
