/* Greedy Snacks - eine Datei, Variablen, Hell und Dunkel. Farben: needful apps. */
:root {
  --petrol: #009493;
  --akzent: #00ddd3;
  --dunkel: #2d3f3c;
  --dunkel-2: #22302e;
  --flaeche: #f4f7f7;
  --karte: #ffffff;
  --text: #1d2a28;
  --text-2: #5b6b69;
  --rand: #d9e2e1;
  --rand-2: #eaf0ef;
  --ok: #1f9d55;
  --warn: #c98200;
  --fehler: #c0392b;
  --add-bg: #e6f6ec;
  --add-zeichen: #14683a;
  --del-bg: #fdecea;
  --del-zeichen: #97281c;
  --hunk-bg: #eef3f7;
  --radius: 8px;
  --code: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

/* Dunkle Farben: entweder nach Systemeinstellung (Auto) oder fest gewaehlt. */
@media (prefers-color-scheme: dark) {
  html:not([data-thema="hell"]) {
    --flaeche: #151d1c;
    --karte: #1c2725;
    --text: #e4ecea;
    --text-2: #9fb3b0;
    --rand: #2f403d;
    --rand-2: #263432;
    --add-bg: #12301f;
    --add-zeichen: #6fdc9b;
    --del-bg: #351a17;
    --del-zeichen: #ff9c8f;
    --hunk-bg: #1f2c2b;
    --petrol: #17b3b1;
    color-scheme: dark;
  }
}
html[data-thema="dunkel"] {
  --flaeche: #151d1c;
  --karte: #1c2725;
  --text: #e4ecea;
  --text-2: #9fb3b0;
  --rand: #2f403d;
  --rand-2: #263432;
  --add-bg: #12301f;
  --add-zeichen: #6fdc9b;
  --del-bg: #351a17;
  --del-zeichen: #ff9c8f;
  --hunk-bg: #1f2c2b;
  --petrol: #17b3b1;
  color-scheme: dark;
}
html[data-thema="hell"] { color-scheme: light; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--flaeche);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--petrol); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
code, pre, .mono { font-family: var(--code); font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.leise { color: var(--text-2); }
.klein { font-size: .875rem; }
.rechts { text-align: right; }
.platz { flex: 1; }
.kuerzen { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kopfzeile */
.kopf {
  display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 16px;
  background: var(--dunkel); color: #fff;
}
.kopf a { color: #fff; opacity: .85; }
.kopf a:hover { opacity: 1; }
.kopf .marke { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: .01em; opacity: 1; }
.kopf .marke img { height: 26px; width: 26px; display: block; }
.kopf nav { display: flex; align-items: center; gap: 14px; font-size: .92rem; }

.inhalt { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
.schmal { max-width: 640px; }

/* Knoepfe und Formulare */
.knopf {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--petrol); background: var(--petrol); color: #fff; cursor: pointer; font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.knopf:hover { filter: brightness(1.08); text-decoration: none; }
.knopf.zweit { background: var(--karte); color: var(--petrol); }
.knopf.klein { padding: 3px 10px; font-size: .85rem; }
.knopf.gefahr { background: var(--karte); color: var(--fehler); border-color: var(--fehler); }
.knopf:disabled { opacity: .5; cursor: default; }

.feld { display: grid; gap: 4px; margin-bottom: 14px; }
.feld label { font-size: .85rem; color: var(--text-2); }
.feld .hinweis { font-size: .8rem; color: var(--text-2); }
input[type=text], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--rand); border-radius: 6px; background: var(--karte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: var(--petrol); }
textarea { min-height: 160px; font-family: var(--code); font-size: 13px; }
fieldset { border: 1px solid var(--rand); border-radius: var(--radius); margin: 0 0 14px; padding: 12px 14px; }
legend { font-size: .85rem; color: var(--text-2); padding: 0 6px; }
label.zeile { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .95rem; }
.formreihe { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.formreihe .feld { margin-bottom: 0; flex: 1 1 170px; min-width: 150px; }
.formreihe .knopf { margin-bottom: 1px; }

/* Meldungen */
.meldung { padding: 9px 12px; border-radius: 6px; margin-bottom: 16px; border: 1px solid transparent; }
.meldung.fehler { background: var(--del-bg); color: var(--del-zeichen); border-color: var(--fehler); }
.meldung.ok { background: var(--add-bg); color: var(--add-zeichen); border-color: var(--ok); }
.meldung.info { background: var(--karte); border-color: var(--rand); }
.meldung code { word-break: break-all; }

/* Karten und Tabellen */
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); }
.karte + .karte { margin-top: 16px; }
.karte .kopfzeile { padding: 10px 14px; border-bottom: 1px solid var(--rand); display: flex; align-items: center; gap: 10px; }
.karte .koerper { padding: 14px; }

table { width: 100%; border-collapse: collapse; background: var(--karte); }
table.rahmen { border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--rand-2); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; background: var(--rand-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--petrol) 5%, transparent); }
td.schmal-spalte { width: 1%; white-space: nowrap; }

.leer { padding: 28px 16px; text-align: center; color: var(--text-2); }
.leer img { width: 132px; height: 132px; border-radius: 50%; margin-bottom: 10px; }

/* Repo-Kopf */
.repokopf { margin-bottom: 14px; }
.repokopf .titel { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.repokopf .titel h1 { font-size: 1.3rem; font-weight: 500; }
.repokopf .titel h1 strong { font-weight: 700; }
.repokopf .sicht { font-size: .78rem; color: var(--text-2); border: 1px solid var(--rand); border-radius: 20px; padding: 1px 9px; }
.repokopf .beschreibung { color: var(--text-2); margin-top: 2px; }
.zeile-werkzeuge { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }

.klon { display: flex; align-items: stretch; border: 1px solid var(--rand); border-radius: 6px; overflow: hidden; background: var(--karte); }
.klon button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--rand); }
.klon button.aktiv { background: var(--petrol); color: #fff; }
.klon input { border: 0; border-radius: 0; width: min(46vw, 420px); font-family: var(--code); font-size: 12.5px; padding: 6px 10px; }
.klon .kopieren { border-right: 0; border-left: 1px solid var(--rand); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rand); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.aktiv { color: var(--text); border-bottom-color: var(--petrol); }

/* Dateien */
.brotkrumen { font-family: var(--code); font-size: 13.5px; margin-bottom: 8px; word-break: break-all; }
.dateiliste td { padding: 6px 12px; }
.dateiliste .symbol { color: var(--text-2); width: 1%; padding-right: 0; }
.dateiliste a { color: var(--text); }
.dateiliste .ordner a { font-weight: 500; }

.datei .kopfzeile { font-size: .85rem; color: var(--text-2); }
.datei .inhalt-code { overflow-x: auto; }
.chroma { background: transparent !important; font-family: var(--code); font-size: 13px; }
.chroma .lntable { border-spacing: 0; width: 100%; }
.chroma .lntable td { padding: 0; border: 0; vertical-align: top; }
.chroma .lntd:first-child { width: 1%; }
.chroma pre { margin: 0; padding: 10px 12px; }
.chroma .lnt, .chroma .ln { color: var(--text-2); opacity: .75; }
.chroma .line:target, .chroma .lnt:target { background: color-mix(in srgb, var(--akzent) 22%, transparent); }
pre.klartext { margin: 0; padding: 12px; overflow-x: auto; }

/* Markdown */
.md { padding: 16px 18px; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2 { border-bottom: 1px solid var(--rand); padding-bottom: 6px; }
.md pre { background: var(--rand-2); padding: 12px; border-radius: 6px; overflow-x: auto; }
.md code { background: var(--rand-2); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md table { border: 1px solid var(--rand); margin: 12px 0; width: auto; }
.md blockquote { margin: 12px 0; padding: 2px 14px; border-left: 3px solid var(--rand); color: var(--text-2); }
.md img { max-width: 100%; }
.md hr { border: 0; border-top: 1px solid var(--rand); }

/* Commits */
.commitzeile .betreff { font-weight: 500; color: var(--text); }
.commitzeile .meta { color: var(--text-2); font-size: .85rem; }
.sha { font-family: var(--code); font-size: 12.5px; }

.diffdatei { margin-top: 14px; }
.diffdatei .kopfzeile { font-family: var(--code); font-size: 12.5px; justify-content: space-between; }
.diffdatei .zahlen { color: var(--text-2); white-space: nowrap; }
.diffdatei .zahlen .plus { color: var(--add-zeichen); }
.diffdatei .zahlen .minus { color: var(--del-zeichen); }
table.diff { font-family: var(--code); font-size: 12.5px; width: 100%; }
table.diff td { border: 0; padding: 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
table.diff td.nr { width: 1%; text-align: right; color: var(--text-2); user-select: none; padding: 0 8px; opacity: .8; }
table.diff tr.add td { background: var(--add-bg); }
table.diff tr.del td { background: var(--del-bg); }
table.diff tr.hunk td { background: var(--hunk-bg); color: var(--text-2); }
table.diff tr:hover { background: none; }
table.diff td.zeichen { width: 1%; padding: 0 0 0 6px; color: var(--text-2); }

/* Releases */
.release + .release { margin-top: 16px; }
.release .titelzeile { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.release .tag { font-family: var(--code); font-size: 13px; }
.vorab { color: var(--warn); font-size: .8rem; border: 1px solid var(--warn); border-radius: 20px; padding: 0 8px; }
.assets td { font-size: .9rem; }
.assets .hash { font-family: var(--code); font-size: 11.5px; color: var(--text-2); word-break: break-all; }

/* Anmeldung */
.anmeldung {
  min-height: 100vh; display: grid; align-items: center; justify-items: start;
  padding: 0 0 0 max(7vw, 24px);
  background: var(--dunkel-2) url(/static/img/login.jpg) right center / cover no-repeat;
}
.anmeldung .maske { width: min(380px, 92vw); background: var(--karte); border-radius: 12px; padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.anmeldung .marke { display: flex; align-items: center; gap: 12px; background: var(--dunkel); color: #fff; margin: -26px -26px 20px; padding: 16px 26px; border-radius: 12px 12px 0 0; }
.anmeldung .marke img { height: 34px; width: 34px; }
.anmeldung .marke .name { font-weight: 600; font-size: 1.05rem; }
.anmeldung p { color: var(--text-2); }
@media (max-width: 860px) {
  .anmeldung { justify-items: center; padding: 24px; background-image: url(/static/img/login-960.jpg); background-position: 72% center; }
}

/* KI-Hinweise */
.ki { border-left: 3px solid var(--akzent); }
.ki pre { background: var(--rand-2); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0 0; }

.htmx-request .laedt { display: inline; }
.laedt { display: none; color: var(--text-2); }

/* --- Hilfsklassen statt Inline-Styles (die CSP erlaubt keine style-Attribute) --- */
.abstand-oben { margin-top: 16px; }
.abstand-oben-gross { margin-top: 28px; }
.abstand-unten { margin-bottom: 14px; }
.oben-ran { margin-top: 0; }
.unten-ran { margin-bottom: 0; }
.klein-titel { font-size: 1.1rem; }
.filterfeld { max-width: 360px; }
.hohes-feld { min-height: 90px; }
.mono { font-family: var(--code); }
.leiser { opacity: .75; }
.block { display: block; }
.breit { width: 100%; justify-content: center; }
.abgesetzt { border-top: 1px solid var(--rand); }
.nachricht { padding: 8px 0; }
.befehle { background: var(--rand-2); border-radius: 6px; }
th.normal { font-size: 1rem; text-transform: none; letter-spacing: 0; font-weight: 400; background: none; color: inherit; }

/* Nur fuer Screenreader sichtbar */
.nur-lesegeraet {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Sprunglink (WCAG 2.4.1) */
.sprung {
  position: absolute; left: 8px; top: -60px; z-index: 20; padding: 10px 16px;
  background: var(--karte); color: var(--text); border-radius: 0 0 6px 6px; border: 2px solid var(--petrol);
  transition: top .15s;
}
.sprung:focus { top: 0; }

/* Sichtbarer Fokus ueberall (WCAG 2.4.11/2.4.13) */
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; border-radius: 3px; }
.kopf :focus-visible { outline-color: #fff; }

/* Mindestgroesse von Bedienelementen (WCAG 2.5.8) */
.knopf, .klon button, .sprachen a, .sprachen span, .tabs a { min-height: 24px; min-width: 24px; }

/* Sprachumschalter */
.sprachen { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.sprachen a, .sprachen span { display: inline-block; padding: 4px 7px; border-radius: 4px; }
.kopf .sprachen span[aria-current] { background: rgba(255, 255, 255, .16); font-weight: 600; opacity: 1; }
.anmeldung .sprachen { margin-top: 10px; justify-content: center; }
.anmeldung .sprachen span[aria-current] { background: var(--rand-2); font-weight: 600; }

/* Branch-/Tag-Auswahl */
.refwahl { position: relative; background: var(--karte); border: 1px solid var(--rand); border-radius: 6px; }
.refwahl > summary { cursor: pointer; padding: 6px 12px; list-style: none; }
.refwahl > summary::-webkit-details-marker { display: none; }
.refliste {
  position: absolute; z-index: 5; top: calc(100% + 2px); left: 0; min-width: 240px;
  max-height: 320px; overflow: auto; padding: 6px 0;
}
.refliste a { display: block; padding: 5px 12px; }
.refliste a:hover { background: var(--rand-2); text-decoration: none; }

/* Fussbereich */
.fuss { border-top: 1px solid var(--rand); background: var(--karte); padding: 14px 16px; font-size: .85rem; color: var(--text-2); }
.fussinhalt { max-width: 1120px; margin: 0 auto; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.fuss nav { display: flex; gap: 14px; flex-wrap: wrap; }

/* Startseite */
.held { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin: 10px 0 26px; }
.held-bild { border-radius: 50%; flex: none; }
.held h1 { font-size: 1.9rem; margin: 0; }
.held .claim { font-size: 1.15rem; margin: 6px 0 4px; }
.held .lead { color: var(--text-2); max-width: 62ch; margin: 0 0 14px; }
.held-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kacheln .kachel h2 { margin: 0 0 6px; font-size: 1rem; }
.kacheln .kachel p { margin: 0; color: var(--text-2); }

/* Rechtstexte */
.schmal-text { max-width: 78ch; }
.schmal-text h1 { margin-bottom: 14px; }

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Darstellungswahl im Fussbereich */
.thema { display: flex; gap: 2px; align-items: center; }
.thema a, .thema span { display: inline-block; padding: 4px 8px; border-radius: 4px; min-height: 24px; }
.thema span[aria-current] { background: var(--rand-2); font-weight: 600; color: var(--text); }
.offen { color: var(--ok); font-size: .8rem; border: 1px solid var(--ok); border-radius: 20px; padding: 0 8px; }
