/* DS Heizberatung – gemeinsame Styles */

:root {
  /* Marke */
  --brand: #de4601;
  --brand-hover: #fe6601;
  --header-bg: #3c4c6c;
  --header-ink: #aaaaaa;
  --footer-bg: #2a3a5a;
  --footer-ink: #cccccc;

  /* Hell */
  --bg: #eef1f5;
  --bg-elevated: #f7f8fb;
  --ink: #243044;
  --ink-muted: #5a6578;
  --brand-signal: #3c4c6c;
  --accent-soft: rgba(222, 70, 1, 0.12);
  --line: rgba(60, 76, 108, 0.16);
  --hero-deep: #2a3a5a;
  --form-bg: rgba(247, 248, 251, 0.94);
  --shadow-soft: 0 18px 40px rgba(42, 58, 90, 0.12);
  --focus: #3c4c6c;

  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;

  --logo-offset: 2.5rem;
  --header-height: 5.5rem;
  --header-scale: 1;
  --header-hide: 0;
  --content-max: 68rem;
  --pad-inline: clamp(1.25rem, 4vw, 3rem);
  --prose: 40rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);

  color-scheme: light;
}

/* Dunkel – einmalig; data-theme wird in site.js gesetzt */
:root[data-theme="dark"] {
  --bg: #1a2233;
  --bg-elevated: #243044;
  --ink: #e8ecf2;
  --ink-muted: #a8b0c0;
  --brand-signal: #fe6601;
  --accent-soft: rgba(222, 70, 1, 0.18);
  --line: rgba(170, 170, 170, 0.18);
  --hero-deep: #151c28;
  --form-bg: rgba(36, 48, 68, 0.94);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.4);
  --focus: #fe6601;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 10% -10%, var(--accent-soft), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(60, 76, 108, 0.14), transparent 50%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

main {
  flex: 1 0 auto;
}

/* Platzhalter bis Partials geladen sind (weniger Layout-Sprung) */
#header-slot {
  min-height: var(--header-height);
  background: var(--header-bg);
}

#footer-slot {
  min-height: 4.5rem;
  background: var(--footer-bg);
}

/* Header ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: calc(var(--header-height) * var(--header-scale));
  min-height: calc(var(--header-height) / 3);
  padding-inline: var(--logo-offset) var(--pad-inline);
  background: var(--header-bg);
  border-bottom: 1px solid rgba(170, 170, 170, 0.18);
  color: var(--header-ink);
  transition: height 0.05s linear, box-shadow 0.3s ease;
}

.site-header.is-compact {
  box-shadow: 0 10px 28px rgba(42, 58, 90, 0.35);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--header-ink);
  text-decoration: none;
  transform: scale(var(--header-scale));
  transform-origin: left center;
  transition: transform 0.05s linear, color 0.2s ease;
}

.logo:hover {
  color: #fff;
}

.logo img {
  width: 7.5rem;
  height: auto;
  flex-shrink: 0;
}

.logo-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.35rem;
  background: linear-gradient(145deg, var(--brand-hover) 0%, var(--brand) 45%, var(--header-bg) 100%);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  font-size: calc(0.95rem * (0.85 + 0.15 * var(--header-scale)));
}

.site-nav a {
  color: var(--header-ink);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--brand-hover);
}

.theme-toggle {
  appearance: none;
  border: 1px solid rgba(170, 170, 170, 0.35);
  background: rgba(42, 58, 90, 0.45);
  color: var(--header-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  color: #fff;
  border-color: var(--brand-hover);
  background: rgba(222, 70, 1, 0.25);
}

/* Hero ------------------------------------------------------------------ */

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: calc(100vh - var(--header-height));
  padding: clamp(2.5rem, 5vh, 4rem) var(--pad-inline) clamp(2.5rem, 6vh, 4rem);
  overflow: hidden;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(45deg, var(--hero-deep), var(--header-bg) 30%, var(--brand) 120%);
  animation: hero-shift 18s ease-in-out infinite alternate;
}

/* Optional: hero.jpg ablegen und opacity auf 1 setzen */
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("hero.jpg") center / cover;
  opacity: 0;
  pointer-events: none;
}

@keyframes hero-shift {
  from { transform: scale(1); }
  to { transform: scale(1.06) translate3d(-1.5%, 1%, 0); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 36rem;
  animation: rise-in 0.9s ease-out both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-signal {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--brand-signal);
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.hero .lead {
  margin: 0 0 1.75rem;
  max-width: 32rem;
}

.contact-form {
  display: grid;
  gap: 0.85rem;
  max-width: 26rem;
  padding: 1.25rem 1.35rem 1.35rem;
  background: var(--form-bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  animation: rise-in 1.05s 0.15s ease-out both;
}

.contact-form-heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.contact-form .h-captcha {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--bg-elevated);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: color-mix(in srgb, var(--ink-muted) 70%, transparent);
}

.contact-form button {
  appearance: none;
  border: 0;
  margin-top: 0.25rem;
  padding: 0.8rem 1.1rem;
  border-radius: 0.35rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.contact-form button:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.contact-form .note {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-muted);
}

.contact-form .note strong {
  font-weight: 600;
  color: var(--ink);
}

.contact-form .form-status {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.contact-form .form-status--success {
  color: var(--brand);
}

.contact-form .form-status--error {
  color: #b42318;
}

.contact-form button:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

/* Abschnitte ------------------------------------------------------------ */

.section,
.page-header {
  width: min(100% - 2 * var(--pad-inline), var(--content-max));
  margin-inline: auto;
}

.section {
  padding-block: clamp(3rem, 8vh, 5rem);
  border-top: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.lead {
  margin: 0 0 1.5rem;
  max-width: var(--prose);
  color: var(--ink-muted);
  font-size: 1.1rem;
}

.section p,
.plain-list,
.steps {
  max-width: var(--prose);
}

.section p + p,
.section ul + p,
.section ol + p {
  margin-top: 1.5rem;
}

.section > p:last-child a {
  font-weight: 600;
}

.plain-list,
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
}

.plain-list li {
  position: relative;
  padding-left: 1.25rem;
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--brand);
}

.steps {
  gap: 1.25rem;
  counter-reset: step;
}

.steps li {
  padding-left: 2.75rem;
  position: relative;
  counter-increment: step;
  color: var(--ink-muted);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 0.35rem;
  background: var(--accent-soft);
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.steps strong {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

/* Auth / Intern --------------------------------------------------------- */

.auth-form {
  margin-top: 0.5rem;
}

.text-action {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.text-action:hover {
  color: var(--brand-hover);
}

/* Unterseiten ----------------------------------------------------------- */

.page-header {
  padding: clamp(2.5rem, 6vh, 4rem) 0 clamp(1.5rem, 3vh, 2rem);
}

.page-header > p:first-child {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}

.page-header h1 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--brand-signal);
}

.page-header .lead {
  margin-bottom: 0;
}

/* Footer ---------------------------------------------------------------- */

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid rgba(204, 204, 204, 0.15);
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: 2rem var(--pad-inline);
}

.footer-inner {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 2rem;
}

.footer-brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}

.footer-meta {
  margin: 0;
  font-size: 0.95rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-left: auto;
}

.footer-nav a {
  color: var(--footer-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--brand-hover);
}

.footer-nav a[aria-current="page"] {
  color: #fff;
}

/* =======================================================================
   Responsive
   Desktop bleibt unverändert. Zwei Breakpoints:
   – Tablets:  ≤ 900px  (Layout anpassen, Header bleibt sichtbar)
   – Handys:   ≤ 600px  (Header fährt mit Scroll komplett aus)
   ======================================================================= */

/* ---------- Tablets (≤ 900px) ------------------------------------------ */

@media (max-width: 900px) {
  :root {
    --logo-offset: 1.25rem;
    --header-height: 4.25rem;
    --pad-inline: clamp(1.25rem, 3.5vw, 1.75rem);
  }

  .site-header {
    flex-wrap: wrap;
    height: auto;
    min-height: calc(var(--header-height) * var(--header-scale));
    padding-block: 0.75rem;
    padding-top: calc(0.75rem + var(--safe-top));
    gap: 0.65rem 1rem;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
  }

  .logo img {
    width: 2.15rem;
  }

  .logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  .theme-toggle {
    margin-left: auto;
    min-height: 2.5rem;
    padding-inline: 0.85rem;
  }

  .hero {
    min-height: auto;
    padding-block: clamp(2rem, 5vh, 3rem);
  }

  .hero-visual {
    opacity: 0.9;
  }

  .hero-content,
  .hero .lead,
  .contact-form {
    max-width: none;
  }

  .contact-form {
    width: 100%;
    max-width: 36rem;
  }

  .section {
    padding-block: clamp(2.5rem, 6vh, 3.5rem);
  }

  .page-header {
    padding-top: 2.25rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .footer-nav {
    margin-left: 0;
  }

  .site-footer {
    padding-bottom: calc(2rem + var(--safe-bottom));
  }
}

/* ---------- Handys (≤ 600px) ------------------------------------------- */

@media (max-width: 600px) {
  :root {
    --logo-offset: 1rem;
    --header-height: 5.5rem;
    --pad-inline: 1rem;
  }

  body {
    font-size: 1rem;
    padding-inline: var(--safe-inline);
  }

  /*
   * Header: Logo/Titel oben, Nav-Links klein darunter.
   * Fährt proportional zum Scroll aus (--header-hide aus site.js).
   */
  .site-header {
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: 0;
    padding-block: 0.55rem 0.6rem;
    padding-top: calc(0.55rem + var(--safe-top));
    gap: 0.35rem 0.75rem;
    transform: translate3d(0, calc(-110% * var(--header-hide)), 0);
    transition:
      transform 0.05s linear,
      box-shadow 0.25s ease;
    will-change: transform;
  }

  .site-header.is-hidden {
    box-shadow: none;
    pointer-events: none;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
    transform: none;
    gap: 0.45rem;
  }

  .logo img {
    width: 2rem;
    height: auto;
    flex-shrink: 0;
  }

  .logo-mark {
    width: 1.85rem;
    height: 1.85rem;
  }

  .logo-text {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-nav {
    width: 100%;
    flex: 0 0 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
    font-size: 0.78rem;
    overflow: visible;
  }

  .site-nav a {
    white-space: nowrap;
    padding-block: 0.15rem;
  }

  .theme-toggle {
    margin-left: auto;
    flex-shrink: 0;
    min-height: 2rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
  }

  .hero {
    min-height: calc(100svh - var(--header-height));
    padding-block: 1.5rem 2rem;
  }

  .brand-signal {
    font-size: clamp(1.55rem, 8vw, 2.1rem);
    margin-bottom: 0.5rem;
  }

  .hero h1 {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    line-height: 1.35;
    margin-bottom: 0.75rem;
  }

  .hero .lead {
    margin-bottom: 1.25rem;
    font-size: 1rem;
  }

  .contact-form {
    max-width: none;
    width: 100%;
    margin-top: 0.15rem;
    padding: 1rem;
    gap: 0.7rem;
  }

  /* ≥16px: kein Auto-Zoom in iOS Safari */
  .contact-form input,
  .contact-form textarea,
  .contact-form button,
  .auth-form input {
    font-size: 1rem;
  }

  .contact-form button {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.85rem 1rem;
  }

  .contact-form .h-captcha,
  .contact-form .h-captcha iframe {
    max-width: 100%;
  }

  .section {
    padding-block: 2.25rem;
  }

  .section h2 {
    font-size: clamp(1.4rem, 6vw, 1.7rem);
  }

  .lead {
    font-size: 1rem;
  }

  .plain-list,
  .steps {
    gap: 0.75rem;
  }

  .steps li {
    padding-left: 2.4rem;
  }

  .steps li::before {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.85rem;
  }

  .page-header {
    padding-top: 1.75rem;
  }

  .page-header h1 {
    font-size: clamp(1.5rem, 7vw, 1.95rem);
  }

  .site-footer {
    padding-block: 1.35rem;
    padding-bottom: calc(1.35rem + var(--safe-bottom));
  }

  .footer-nav {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .footer-nav a {
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
  }
}

/* Sehr schmale Handys */
@media (max-width: 380px) {
  .logo-text {
    font-size: 0.92rem;
  }

  .site-nav {
    gap: 0.15rem 0.6rem;
    font-size: 0.72rem;
  }

  .theme-toggle {
    padding-inline: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-visual,
  .hero-content,
  .contact-form,
  .contact-form button,
  .logo,
  .site-header {
    animation: none !important;
    transition: none !important;
  }
}
