/* Solargenerator im Unterricht: im Stil des Stromzählers.
   Hintergrund in der Farbe des Logos, cremefarbene Karten, runde Knöpfe, Archivo und JetBrains Mono. */
:root {
  --bg: #d5efdf;
  --card: #fff8ec;
  --fg: #2b211e;
  --muted: #3d5a4b;
  --line: #e6d9c3;
  --focus: #e2742f;
  --focus-soft: #fde8da;
  --green: #2f7d5b;
  --blue: #3e62a0;
  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
html, body.sgx { background: var(--bg); color: var(--fg); margin: 0; }
body.sgx { font-family: var(--font-ui); font-size: 16px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } body.sgx * { transition: none !important; animation: none !important; } }

.sgx-wrap {
  max-width: 1040px; margin: 0 auto; padding-block: 16px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 18px;
}
.sgx-back { margin: 0; font-size: .92rem; }
.sgx-back a { color: var(--muted); font-weight: 600; text-decoration: none; }
.sgx-back a:hover { color: var(--fg); }

/* Kopf wie beim Stromzähler: großes Logo, ein Satz */
.sgx-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.sgx-hero img { width: min(240px, 62vw); height: auto; animation: sgx-pop .5s ease-out; }
.sgx-hero p { margin: 0; max-width: 34em; font-weight: 600; text-wrap: balance; }
@keyframes sgx-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Abschnitte als runde Knöpfe, bleibt beim Scrollen oben */
.sgx-nav {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  margin: 0 -16px; padding: 10px 16px; background: rgba(213, 239, 221, .94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); scrollbar-width: none;
}
.sgx-nav::-webkit-scrollbar { display: none; }
.sgx-nav a {
  flex: 0 0 auto; text-decoration: none; font: 600 .9rem var(--font-ui); color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; white-space: nowrap;
}
.sgx-nav a:hover { color: var(--fg); }
.sgx-nav a.is-on { background: var(--green); border-color: var(--green); color: #fff; }
.sgx-nav a.sgx-pdf { margin-left: auto; background: var(--focus); border-color: var(--focus); color: #fff; }
.sgx a:focus-visible, .sgx button:focus-visible, .sgx input:focus-visible, .sgx summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Inhalt aus dem Handbuch-Plugin */
body.sgx .sgh {
  --sgh-ink: var(--fg); --sgh-muted: var(--muted); --sgh-navy: var(--green); --sgh-navy-soft: #e3f3e8;
  --sgh-sun: var(--focus); --sgh-sun-soft: var(--focus-soft); --sgh-line: var(--line); --sgh-bg: transparent; --sgh-panel: #fff;
  max-width: none; margin: 0; padding: 0; background: transparent; color: var(--fg);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
  display: flex; flex-direction: column; gap: 18px;
}
body.sgx .sgh h1, body.sgx .sgh h2, body.sgx .sgh h3, body.sgx .sgh h4 { font-family: var(--font-ui); color: var(--fg); letter-spacing: 0; }
body.sgx .sgh h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 800; line-height: 1.1; margin: 0 0 .4em; }
body.sgx .sgh h2 { font-size: clamp(22px, 3vw, 27px); font-weight: 800; line-height: 1.2; margin: 0 0 .5em; }
body.sgx .sgh h3 { font-size: 18px; font-weight: 700; }
body.sgx .sgh h4 { font-size: 16px; font-weight: 700; }
body.sgx .sgh a { color: var(--blue); }
body.sgx .sgh strong { font-weight: 700; }

/* Karten */
body.sgx .sgh-hero, body.sgx .sgh-section, body.sgx .sgh-download, body.sgx .sgx-sofu {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: clamp(16px, 3vw, 24px); margin: 0; min-width: 0;
}
body.sgx .sgh-section { border-top: 1px solid var(--line); }
body.sgx .sgh-section > h2 { counter-increment: sgx; }
body.sgx .sgh { counter-reset: sgx; }
body.sgx .sgh-section > h2::before {
  content: "Kapitel " counter(sgx); display: block; margin-bottom: 6px;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700;
}
body.sgx .sgh-hero { grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
body.sgx .sgh-eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
body.sgx .sgh-lead { font-size: 17px; color: var(--fg); }
body.sgx .sgh-intro { color: var(--muted); }
body.sgx .sgh-note { font-size: .9rem; color: var(--muted); margin-top: 12px; }
body.sgx .sgh-hero-fig, body.sgx .sgh-split figure, body.sgx .sgh-figcard {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0;
}
body.sgx .sgh-hero-fig img, body.sgx .sgh-split figure img, body.sgx .sgh-figcard img { border-radius: 8px; }
body.sgx .sgh-split figcaption, body.sgx .sgh-figcard figcaption { font-size: .85rem; color: var(--muted); text-align: left; margin-top: 8px; }
body.sgx .sgh-split { gap: 24px; margin: 22px 0; }

/* Knöpfe rund wie beim Stromzähler */
body.sgx .sgh-actions { gap: 8px; margin-top: 14px; }
body.sgx .sgh-btn {
  font: 600 1rem var(--font-ui); border-radius: 999px; padding: 11px 22px; text-decoration: none !important;
  border: 1px solid var(--line); background: var(--card); color: var(--fg) !important; transition: filter .15s;
}
body.sgx .sgh-btn:hover { filter: brightness(.97); background: var(--card); }
body.sgx .sgh-btn-primary { background: var(--focus); border-color: var(--focus); color: #fff !important; }
body.sgx .sgh-btn-primary:hover { background: var(--focus); filter: brightness(.95); }

/* Kennzahlen */
body.sgx .sgh-facts { margin: 0; gap: 8px; }
body.sgx .sgh-facts li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
body.sgx .sgh-facts strong { font-size: 1.02rem; font-weight: 700; }
body.sgx .sgh-facts span { display: block; font-size: .78rem; color: var(--muted); }

/* Teilkarten */
body.sgx .sgh-cards { gap: 10px; margin-top: 14px; }
body.sgx .sgh-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
body.sgx .sgh-tag { background: #e3f3e8; color: var(--green); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; border-radius: 999px; padding: 3px 10px; }
body.sgx .sgh-list { padding-left: 0; list-style: none; }
body.sgx .sgh-list li { position: relative; padding-left: 22px; margin-bottom: .45em; }
body.sgx .sgh-list li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 9px; height: 9px; border-radius: 50%; background: var(--focus); }

/* Rechner wie die Formel-Box des Stromzählers */
body.sgx .sgh-tool { background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
body.sgx .sgh-tool-wide { max-width: 560px; margin-top: 18px; }
body.sgx .sgh-tool label { font-weight: 700; color: var(--fg); }
body.sgx .sgh-tool output, body.sgx .sgh-result strong { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
body.sgx .sgh-tool input[type=range] { accent-color: var(--focus); }
body.sgx .sgh-tool input[type=number] { font: 500 1rem var(--font-num); background: #fff; color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: 6em; }
body.sgx .sgh-bar { height: 12px; background: var(--card); border: 1px solid var(--line); }
body.sgx .sgh-bar span { background: var(--focus); }

/* Laborübungen wie die Gerätekarten */
body.sgx .sgh-cards-5 { gap: 8px; }
body.sgx .sgh-step { display: flex; flex-direction: column; background: #fff; padding: 12px 14px; color: inherit; text-decoration: none; }
body.sgx .sgh-num { width: auto; height: auto; padding: 3px 10px; border-radius: 999px; background: var(--green); color: #fff; font: 700 .85rem var(--font-num); margin-bottom: 8px; align-self: flex-start; }
body.sgx .sgh-step p { font-size: .9rem; color: var(--muted); }
body.sgx a.sgh-step, body.sgx .sgh-step.sgh-lablink { cursor: pointer; transition: border-color .15s, background .15s; }
body.sgx a.sgh-step:hover, body.sgx .sgh-lablink:hover { border-color: var(--focus); background: var(--focus-soft); }
body.sgx a.sgh-step::after, body.sgx .sgh-step.sgh-lablink::after { content: "Übung öffnen \2192"; margin-top: auto; padding-top: 8px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: #9a4613; }

/* Tabellen wie die Stromrechnung */
body.sgx .sgh-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; margin-top: 12px; }
body.sgx .sgh-table { font-size: .95rem; }
body.sgx .sgh-table th, body.sgx .sgh-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); }
body.sgx .sgh-table thead th { background: #fff; font-weight: 700; color: var(--muted); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
body.sgx .sgh-table tbody tr:last-child td { border-bottom: 0; }
body.sgx .sgh-num-col { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
body.sgx .sgh-sum td { background: var(--focus-soft) !important; font-weight: 700; }
body.sgx .sgh-narrow { max-width: 620px; }

/* Herunterladen */
body.sgx .sgh-download { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
body.sgx .sgh-download h2 { font-size: clamp(20px, 2.6vw, 24px); margin-bottom: .3em; }
body.sgx .sgh-download p { margin: 0; color: var(--muted); }

/* Fuß */
body.sgx .sgh-foot { margin: 0; font-size: .85rem; color: var(--muted); text-align: center; }
body.sgx .sgh-foot p { margin: 0 auto .6em; max-width: 52em; }
.sgx-end { text-align: center; font-size: .85rem; color: var(--muted); }
.sgx-end a { color: var(--fg); font-weight: 600; }

/* So funktioniert's */
body.sgx .sgx-sofu { padding: 0; overflow: hidden; }
body.sgx .sgx-sofu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px clamp(16px, 3vw, 24px); font-size: 1.1rem; font-weight: 800; }
body.sgx .sgx-sofu > summary::-webkit-details-marker { display: none; }
body.sgx .sgx-sofu > summary::before { content: "?"; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--focus); color: #fff; display: grid; place-items: center; font-size: 16px; }
body.sgx .sgx-sofu > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
body.sgx .sgx-sofu[open] > summary::after { transform: rotate(-135deg); }
body.sgx .sgx-sofu-in { padding: 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px); }
body.sgx .sgx-sofu-wozu { margin: 0 0 12px; max-width: 46em; }
body.sgx .sgx-sofu ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; counter-reset: s; }
body.sgx .sgx-sofu li { counter-increment: s; position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 48px; font-size: .93rem; margin: 0; }
body.sgx .sgx-sofu li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font: 700 .85rem var(--font-num); }
body.sgx .sgx-sofu li b { display: block; font-size: 1rem; margin-bottom: 2px; }
body.sgx .sgx-sofu-tipp { margin: 12px 0 0; background: var(--focus-soft); border-left: 4px solid var(--focus); border-radius: 10px; padding: 10px 12px; font-size: .93rem; }

@media (max-width: 860px) {
  body.sgx .sgh-hero, body.sgx .sgh-split { grid-template-columns: 1fr; gap: 16px; }
  body.sgx .sgh-split-rev > div { order: 0; }
  body.sgx .sgh-cards-2 { grid-template-columns: 1fr; }
  body.sgx .sgh-cards-5 { grid-template-columns: 1fr 1fr; }
  body.sgx .sgh-download { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  body.sgx .sgh-facts { grid-template-columns: 1fr 1fr; }
  body.sgx .sgh-cards-5 { grid-template-columns: 1fr; }
  body.sgx .sgh-actions { flex-direction: column; align-items: stretch; }
  body.sgx .sgh-btn { text-align: center; }
  body.sgx .sgh-table { min-width: 0; }
}
@media print {
  .sgx-nav, .sgx-back, .sgx-sofu { display: none !important; }
  html, body.sgx { background: #fff; }
}
