/* ============================================
   StromSimulator — Apple-inspired Stylesheet
   ============================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter.woff2') format('woff2-variations'),
       url('/assets/fonts/inter.woff2') format('woff2');
}

:root {
  --bg: #F5F5F7;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-elev: #FFFFFF;
  --accent: #0071E3;
  --accent-hover: #0077ED;
  --text: #1D1D1F;
  --text-muted: #6E6E73;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --max-w: 1180px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #1C1C1E;
  --bg-card: rgba(44, 44, 46, 0.85);
  --bg-elev: #2C2C2E;
  --accent: #0A84FF;
  --accent-hover: #409CFF;
  --text: #F5F5F7;
  --text-muted: #8E8E93;
  --border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .nav {
  background: rgba(28, 28, 30, 0.85);
}
[data-theme="dark"] .nav-links {
  background: rgba(28, 28, 30, 0.97);
}
[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, #F5F5F7 0%, #0A84FF 100%);
  -webkit-background-clip: text; background-clip: text;
}
[data-theme="dark"] .kpi {
  background: rgba(44, 44, 46, 0.8);
}
[data-theme="dark"] #chart-wrap {
  background: rgba(44, 44, 46, 0.6);
}
[data-theme="dark"] .autarkie-bar {
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] input[type="range"] {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .segmented {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .segmented button.active {
  background: rgba(255, 255, 255, 0.14);
}
[data-theme="dark"] .footer {
  background: #111113;
}
[data-theme="dark"] .feature {
  background: var(--bg-elev);
}
[data-theme="dark"] .article blockquote {
  background: rgba(10, 132, 255, 0.08);
}
[data-theme="dark"] .article table,
[data-theme="dark"] .steps li {
  background: var(--bg-elev);
}
[data-theme="dark"] .article th {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .callout {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.1), rgba(255, 184, 0, 0.06));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }

/* ===== Header / Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 247, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex; align-items: center;
  color: var(--text); text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}
.brand .logo { height: 30px; width: auto; min-width: 0; display: block; color: var(--text); }
.brand:hover { opacity: 0.85; }
@media (max-width: 480px) {
  .brand .logo { height: 24px; width: calc(24px * 1700 / 290); }
}
.nav-links {
  display: flex; gap: 28px; list-style: none;
  font-size: 14px;
}
.nav-links a { color: var(--text); font-weight: 500; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: var(--transition); }

/* Dark mode toggle button */
.theme-toggle {
  background: none; border: 0; cursor: pointer;
  padding: 6px; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; flex-shrink: 0;
  margin-left: auto;
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: rgba(128, 128, 128, 0.12); }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

@media (max-width: 760px) {
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(245, 245, 247, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column; gap: 0;
    border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden;
    transition: max-height var(--transition);
  }
  .nav-links.open { max-height: 400px; }
  .nav-links li { padding: 16px 24px; border-top: 1px solid var(--border); }
  .nav-toggle { display: block; }
}

/* ===== Hero ===== */
.hero {
  padding: 100px 24px 60px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(255, 184, 0, 0.18), transparent 60%),
    radial-gradient(800px 400px at 80% 10%, rgba(0, 113, 227, 0.16), transparent 60%);
}
.hero h1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.05;
  background: linear-gradient(135deg, #1D1D1F 0%, #0071E3 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}
.hero .subtitle {
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--text-muted);
  max-width: 680px; margin: 0 auto 36px;
  font-weight: 400;
}
.hero .cta {
  display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: 980px;
  font-size: 16px; font-weight: 500;
  border: 0; cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); opacity: 1; }
.btn-secondary { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-secondary:hover { background: var(--accent); color: #fff; opacity: 1; }

/* ===== Cards / Sections ===== */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 24px;
}
.section-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700; letter-spacing: -0.025em;
  margin-bottom: 12px; text-align: center;
}
.section-lead {
  text-align: center; color: var(--text-muted);
  max-width: 620px; margin: 0 auto 48px;
  font-size: 18px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
}

/* ===== Simulator ===== */
.simulator {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .simulator { grid-template-columns: 1fr; }
}

.sim-inputs h2, .sim-results h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.slider-group { margin-bottom: 26px; }
.slider-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.slider-label .label { font-weight: 500; font-size: 15px; color: var(--text); }
.slider-label .value {
  font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--accent); font-size: 17px;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px; outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  cursor: grab; transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  cursor: grab;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px; padding: 4px; gap: 4px;
}
.segmented button {
  background: transparent; border: 0; cursor: pointer;
  padding: 10px 8px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}
.segmented button.active { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); color: var(--accent); }


/* Results */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 24px;
}
.kpi {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.kpi .lbl { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi .val {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700; letter-spacing: -0.02em;
  margin-top: 6px; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi.accent .val { color: var(--accent); }
.kpi.success .val { color: #19A974; }

.autarkie-bar {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px; height: 14px; overflow: hidden;
  margin: 14px 0 6px;
}
.autarkie-fill {
  height: 100%;
  background: linear-gradient(90deg, #19A974, #0071E3);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.autarkie-meta {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-muted);
}

#chart-wrap {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
#chart-wrap h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-muted); }
#chart { width: 100%; height: 160px; display: block; }

/* ===== Feature grid ===== */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 22px; margin-top: 12px;
}
@media (max-width: 800px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 28px; border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.12), rgba(0, 113, 227, 0.04));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 22px;
}
.feature h3 { font-size: 19px; font-weight: 600; margin-bottom: 8px; }
.feature p { color: var(--text-muted); font-size: 15px; }

/* ===== Article pages ===== */
.article {
  max-width: 760px; margin: 0 auto;
  padding: 60px 24px 80px;
}
.article header { margin-bottom: 32px; }
.article .eyebrow {
  text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin-bottom: 12px;
}
.article h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 16px;
}
.article .meta { color: var(--text-muted); font-size: 14px; }
.article h2 {
  font-size: clamp(24px, 3vw, 32px);
  margin: 44px 0 16px; letter-spacing: -0.02em;
}
.article h3 { font-size: 20px; margin: 28px 0 10px; }
.article p { margin-bottom: 16px; }
.article ul, .article ol { margin: 0 0 16px 24px; }
.article li { margin-bottom: 8px; }
.article blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px; margin: 24px 0;
  background: rgba(0, 113, 227, 0.04);
  border-radius: 0 12px 12px 0;
  font-style: italic; color: var(--text);
}
.article table {
  width: 100%; border-collapse: collapse;
  margin: 20px 0; font-size: 15px;
  background: var(--bg-elev);
  border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.article th, .article td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.article th { background: rgba(0, 0, 0, 0.03); font-weight: 600; }
.article tr:last-child td { border-bottom: 0; }

.callout {
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.06), rgba(255, 184, 0, 0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; margin: 28px 0;
}
.callout strong { color: var(--accent); }

.steps { counter-reset: step; list-style: none; margin-left: 0 !important; }
.steps li {
  counter-increment: step; position: relative;
  padding: 16px 16px 16px 60px; margin-bottom: 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.steps li::before {
  content: counter(step); position: absolute;
  left: 16px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
}

/* Ad slot — vorerst ausgeblendet, bis Google AdSense aktiv ist */
.ad-slot,
.sticky-ad {
  display: none !important;
}

.ad-slot {
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  padding: 14px; text-align: center;
  color: var(--text-muted); font-size: 12px;
  margin: 28px 0;
}

/* Sticky bottom banner */
.sticky-ad {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 16px; text-align: center;
  font-size: 12px; color: var(--text-muted);
  z-index: 90;
  transform: translateY(100%);
  transition: transform 0.4s var(--transition);
}
.sticky-ad.visible { transform: translateY(0); }
.sticky-ad .close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
  background: #fafafa;
  border-top: 1px solid var(--border);
  padding: 50px 24px 30px;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; gap: 28px; } }
.footer h4 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 8px; font-size: 14px; }
.footer a { color: var(--text-muted); }
.footer .legal {
  max-width: var(--max-w); margin: 30px auto 0;
  padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* Fade-in */
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.6s, transform 0.6s; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ===== Szenario-Vergleich ===== */
.scenarios-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
.scenarios-grid.has-b {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 1100px) {
  .scenarios-grid.has-b { grid-template-columns: 1fr; }
}

.scenario-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.scenario-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.badge-a { background: var(--accent); }
.badge-b { background: #BF5AF2; }
.scenario-label { font-weight: 600; font-size: 17px; }
.scenario-close {
  margin-left: auto;
  background: none; border: 0; cursor: pointer;
  color: var(--text-muted); font-size: 18px;
  padding: 4px 8px; border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.scenario-close:hover { background: rgba(255, 59, 48, 0.1); color: #FF3B30; }

.compare-cta { text-align: center; margin-top: 20px; }

#chart-wrap-b {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
#chart-wrap-b h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-muted); }
#chart-b { width: 100%; height: 160px; display: block; }
[data-theme="dark"] #chart-wrap-b { background: rgba(44, 44, 46, 0.6); }

.comparison-banner { margin-top: 28px; }
.comparison-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; letter-spacing: -0.01em; }
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 760px) { .comparison-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .comparison-grid { grid-template-columns: 1fr; } }

.comparison-kpi {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
[data-theme="dark"] .comparison-kpi { background: rgba(44, 44, 46, 0.8); }
.comparison-kpi .lbl {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.comparison-row { display: flex; flex-direction: column; gap: 6px; }
.comparison-val {
  font-size: 14px; font-weight: 500; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.badge-a-inline, .badge-b-inline {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.badge-a-inline { background: var(--accent); }
.badge-b-inline { background: #BF5AF2; }
.val-delta { font-size: 15px; font-weight: 700; padding: 2px 0; color: var(--text-muted); }
.delta-pos { color: #19A974; }
.delta-neg { color: #FF3B30; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
