/* =========================================================
   Solutions4Energy — Design Tokens
   Warm-paper-Flächen · Leaf-Grün als einziger Akzent · Manrope.
   Verbindlicher Stand: eine Schrift-Garnitur, ein Akzent.
   ========================================================= */

:root {
  /* ---- Surfaces — warm paper -------------------------------- */
  --paper: #faf9f5;
  --paper-2: #f4f2ec;
  --paper-3: #ecebe4;
  --surface: #ffffff;
  --surface-2: #f7f5ef;

  /* ---- Lines ----------------------------------------------- */
  --border: #e6e2d7;
  --border-2: #d2cdbf;
  --border-soft: #edeae0;

  /* ---- Ink ------------------------------------------------- */
  --ink: #1a1d1c;
  --ink-2: #3a403e;
  --ink-3: #6b716e;
  --ink-4: #9aa09c;
  --ink-on: #ffffff;

  /* ---- Brand accent (default = Leaf #5FA37C) --------------- */
  --brand: #5fa37c;
  --brand-hover: #4d8b67;
  --brand-ink: #2f5d44;
  --brand-soft: #ebf5ef;
  --brand-soft-2: #f4faf6;
  --brand-line: #c9e2d3;

  /* ---- Status --------------------------------------------- */
  --ok: var(--brand);
  --ok-soft: var(--brand-soft);
  --warn: #b07a16;
  --warn-soft: #f6ecd3;
  --warn-ink: #7a5410; /* Text auf --warn-soft */
  --danger: #b4321e;
  --danger-soft: #f8e6e2;
  --danger-ink: #7a2414; /* Text auf --danger-soft */

  /* ---- Data viz (harmonic, used in dashboard preview) ----- */
  --viz-1: oklch(0.5 0.1 160); /* deep sage */
  --viz-2: oklch(0.7 0.1 145); /* mid green */
  --viz-3: oklch(0.55 0.07 220); /* dusty blue */
  --viz-4: oklch(0.72 0.1 80); /* warm yellow-green */
  --viz-5: oklch(0.6 0.1 30); /* terracotta */

  /* ---- Type — Manrope (Sans + Display), Geist Mono (Mono) -- */
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;

  /* ---- Type scale (feste Größen — Seite skaliert per Page-Zoom) -- */
  --t-display: 64px; /* hero — einmal pro Seite */
  --t-h1: 44px; /* Seitentitel */
  --t-h2: 38px; /* Section-Headline */
  --t-h3: 22px; /* Block-Titel */
  --t-h4: 18px; /* Karten-Titel */
  --t-body: 15px; /* Fließtext */
  --t-body-sm: 14px; /* kompakter Fließtext */
  --t-caption: 13px; /* sekundärer Text, Hinweise */
  --t-eyebrow: 11px; /* Eyebrow / Chip / Mono-Label */

  /* ---- Radii ---------------------------------------------- */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-4: 16px;
  --r-5: 20px;
  --r-pill: 999px;

  /* ---- Shadows -------------------------------------------- */
  --sh-1: 0 1px 0 rgba(20, 25, 22, 0.03);
  --sh-2: 0 1px 2px rgba(20, 25, 22, 0.05), 0 4px 14px rgba(20, 25, 22, 0.04);
  --sh-3: 0 8px 28px rgba(20, 25, 22, 0.1), 0 2px 6px rgba(20, 25, 22, 0.05);
  --sh-card: 0 1px 0 rgba(20, 25, 22, 0.02), 0 1px 3px rgba(20, 25, 22, 0.04);

  /* ---- Spacing scale (used selectively) ------------------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* ---- Density toggles ------------------------------------ */
  --pad-section: 96px; /* vertical section padding */
  --pad-card: 28px; /* card inner padding */
  --gap-cards: 20px;
  --maxw: 1200px;
}

/* Density */
[data-density="compact"] {
  --pad-section: 64px;
  --pad-card: 20px;
  --gap-cards: 14px;
}
[data-density="cozy"] {
  --pad-section: 96px;
  --pad-card: 28px;
  --gap-cards: 20px;
}

/* =========================================================
   Base reset / page chrome
   ========================================================= */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}
body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
h1 {
  font-size: var(--t-h1);
  letter-spacing: -0.025em;
}
h2 {
  font-size: var(--t-h2);
  letter-spacing: -0.025em;
}
h3 {
  font-size: var(--t-h3);
}
h4 {
  font-size: var(--t-h4);
}
p {
  margin: 0;
}

/* =========================================================
   Reusable atoms
   ========================================================= */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.tnum {
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--ink-4);
}
.eyebrow.no-rule::before {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-2);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.12s;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover {
  background: var(--paper-2);
  border-color: var(--ink-4);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--sh-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Section helpers */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 32px);
}
.section {
  padding: var(--pad-section) 0;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
}

/* Responsive grid utility ---------------------------------------------
   Inline styles can't be overridden by media queries, so grid columns
   live in custom properties (--cols / --cols-md / --cols-sm) while the
   grid-template-columns property itself lives here and CAN be
   overridden per breakpoint. Each grid sets --cols (and optionally
   --cols-md for tablet); mobile collapses to --cols-sm (default 1fr). */
.s4e-grid {
  display: grid;
  /* reset so a nested .s4e-grid never inherits the parent's columns */
  --cols: initial;
  --cols-md: initial;
  --cols-sm: initial;
  grid-template-columns: var(--cols, 1fr);
}
@media (max-width: 980px) {
  /* tablet: --cols-md if given, otherwise keep the desktop layout */
  .s4e-grid {
    grid-template-columns: var(--cols-md, var(--cols, 1fr));
  }
}
@media (max-width: 600px) {
  /* mobile: --cols-sm if given, otherwise a single column */
  .s4e-grid {
    grid-template-columns: var(--cols-sm, 1fr);
  }
  /* form fields with grid-column: span 2 would otherwise spawn an
     implicit second column — force every field to the full width */
  .s4e-form > * {
    grid-column: 1 / -1 !important;
  }
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 720px;
}
.section-head p {
  color: var(--ink-3);
  font-size: var(--t-body);
  max-width: 380px;
  text-align: right;
}

/* Hide scrollbars in mock UI */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  scrollbar-width: none;
}

::selection {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

/* Mega-menu entry animation — shared by both mega menus (Lösungen + Branchen) */
@keyframes megaIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Top-nav links — hover handled purely in CSS so header re-renders
   (scroll, mega-menu open/close) can't reset the hover background. */
.s4e-navlink {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
  background: transparent;
  border-radius: var(--r-2);
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.s4e-navlink:hover {
  background: var(--paper-2);
}
.s4e-navlink[data-active="true"] {
  color: var(--ink);
  font-weight: 500;
  background: var(--paper-2);
}

/* =========================================================
   Responsive layer
   Breakpoints: tablet ≤980px · mobile ≤600px
   ========================================================= */

/* Section header: stop forcing headline left / text right once
   there isn't room for two columns. */
@media (max-width: 820px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 28px;
  }
  .section-head p {
    text-align: left;
    max-width: 100%;
  }
}

/* Tighter vertical rhythm on small screens. */
@media (max-width: 600px) {
  :root {
    --pad-section: 56px;
    --pad-card: 20px;
  }
  body {
    font-size: 14.5px;
  }
}

/* Buttons in a row become full-width and stack on mobile so they
   stay comfortably tappable. */
@media (max-width: 480px) {
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-row .btn {
    width: 100%;
  }
}
