/* ================================================================
   Zörner Consulting – Acoustic Surface Calculator
   Design-System aus der Homepage v51 übernommen.
   Inter ist selbst gehostet (DSGVO-freundlich, kein Google-Fonts-Aufruf).
   ================================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/inter-latin-800-normal.woff2") format("woff2");
}

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #eef1f2;
  --text: #1f2937;
  --muted: #4b5563;
  --line: #e4e7ea;
  --brand: #2f6f73;
  --brand-dark: #244f52;
  --brand-soft: #eef1f2;
  --focus-ring: #0f172a;
  --focus-ring-light: #ffffff;
  --blue: #1f4fa3;
  --blue-soft: #eef4ff;
  --orange: #d97916;
  --orange-dark: #9a4f05;
  --orange-soft: #fff4e6;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.container { width: min(calc(100% - 2rem), var(--max)); margin: 0 auto; }

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 6px;
  box-shadow: 0 0 0 6px var(--focus-ring-light);
}
.footer a:focus-visible { outline-color: #98d3d6; box-shadow: none; }

/* ---------------- Typografie (Homepage-Skala) ---------------- */
h1, h2, h3 { margin: 0; }
h1 {
  font-size: clamp(1.65rem, 2.5vw, 2.3rem); /* Seitentitel-Skala der Apps-Seite */
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: .85rem;
}
h2 {
  font-size: 1.25rem; /* Kartentitel = h3-Skala der Homepage */
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  max-width: 760px;
}
.text-muted { color: var(--muted); }

/* ---------------- Karten & Buttons (Homepage) ---------------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(31, 41, 55, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.button-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.2rem; }
.compact-top-gap { margin-top: .9rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 46px; padding: 0 1.2rem; border-radius: 8px;
  font-weight: 600; border: 1px solid transparent;
  transition: background .16s ease, border-color .16s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: rgba(31, 41, 55, .22); }

/* ---------------- Header (Homepage v51 dimensions) ---------------- */
.header {
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: clamp(58px, 5.4vw, 78px); gap: clamp(.55rem, 1.4vw, 1rem);
}
.header-left {
  display: flex; align-items: center; gap: clamp(.5rem, 1.2vw, .85rem);
  min-width: 0; flex: 1 1 auto;
}
.logo-lockup { flex: 0 1 auto; min-width: 0; }
.logo-lockup img { width: clamp(154px, 20vw, 244px); height: auto; }
.header-app-title {
  display: flex; align-items: center; min-width: 0;
  padding-left: clamp(.45rem, 1vw, .75rem); border-left: 1px solid rgba(31, 41, 55, .14);
}
.app-name {
  color: var(--brand-dark); font-weight: 600; font-size: .9rem; white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: .6rem; justify-content: flex-end; flex: 0 0 auto; }

@media (max-width: 1080px) {
  .header-inner { min-height: clamp(56px, 5.5vw, 70px); }
  .logo-lockup img { width: clamp(150px, 19vw, 212px); }
  .header-app-title { display: none; }
}

/* Ansichts-Umschalter im Pill-Stil des Homepage-Sprachschalters */
.view-switch,
.lang-switch {
  display: inline-flex; align-items: center;
  border: 1px solid rgba(31, 41, 55, .16); border-radius: 999px; overflow: hidden;
  font-weight: 700;
}
.view-switch { font-size: .9rem; }
.lang-switch { font-size: .8rem; }
.view-toggle,
.lang-option {
  border: none; background: transparent; color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.view-toggle { padding: .5rem .95rem; }
.lang-option { padding: .38rem .62rem; font-weight: 700; }
.view-toggle:hover,
.lang-option:hover { background: var(--brand-soft); color: var(--brand-dark); }
.view-toggle.active,
.lang-option.active { background: var(--brand); color: #fff; }

/* ---------------- Seitenlayout ---------------- */
.page-main { display: grid; gap: 1.5rem; padding: 36px 0 60px; }
/* Inhaltsspalte: einspaltige Formulare wirken über volle 1180 px zerlaufen.
   Beide Ansichten nutzen dieselbe Breite, damit beim Umschalten nichts springt. */
.page-intro-card,
.quick-card,
.steps,
.steps-tip,
.boundary-cta-grid {
  width: min(100%, 1060px);
  margin-inline: auto;
}
.page-hero { padding: 16px 0 0; }
.page-intro-card { padding: clamp(1.5rem, 2.2vw, 2.1rem); }
.page-intro-card h1 { margin-bottom: .6rem; }
.page-intro-card .lead { max-width: 100%; }

/* ---------------- Schnellansicht ---------------- */
.quick-card { padding: clamp(1.35rem, 2.4vw, 1.8rem); }
.quick-title { margin-bottom: 1rem; }
.section-label {
  margin: 0 0 .55rem;
  color: var(--text);
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.2;
}

/* Hilfe-Symbol mit Tooltip */
.help-tip { position: relative; display: inline-flex; margin-left: .5rem; vertical-align: 2px; }
.help-btn {
  width: 22px; height: 22px; padding: 0;
  border-radius: 50%; border: 1px solid rgba(31, 41, 55, .16);
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .8rem; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.help-btn:hover,
.help-tip.open .help-btn { background: var(--brand); color: #fff; border-color: var(--brand); }
.help-panel {
  position: absolute; top: calc(100% + .6rem); left: 0; z-index: 30;
  width: min(340px, 80vw);
  padding: .85rem 1rem;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .14);
  color: var(--muted); font-size: .9rem; font-weight: 400;
  letter-spacing: 0; line-height: 1.55;
  opacity: 0; visibility: hidden; transition: opacity .14s ease;
}
.help-tip:hover .help-panel,
.help-tip:focus-within .help-panel,
.help-tip.open .help-panel { opacity: 1; visibility: visible; }
.help-link {
  display: inline-flex; margin-top: .55rem; padding: 0;
  border: none; background: transparent;
  color: var(--brand-dark); font-weight: 600; font-size: .9rem;
  text-decoration: underline; text-underline-offset: 3px;
}
.help-link:hover { color: var(--brand); }
.quick-geo-slot { margin-top: .2rem; }
.quick-converter-block {
  margin-top: 1.35rem; padding-top: 1.35rem;
  border-top: 1px solid var(--line);
}
.quick-converter-grid { margin-top: 0; }
.quick-level-input { position: relative; max-width: 520px; }
.quick-level-label { margin-bottom: .15rem; }
.quick-level-help { margin: 0 0 .55rem; font-size: .86rem; line-height: 1.35; }
.quick-level-input .input-control { padding-right: 4.2rem; }
.quick-unit {
  position: absolute; right: .85rem; bottom: .72rem;
  color: var(--muted); font-size: .9rem; font-weight: 700; pointer-events: none;
}

/* ---------------- Schritte (Homepage-Steps-Komponente) ---------------- */
.steps { counter-reset: steps; display: grid; gap: 1rem; }
.step {
  position: relative;
  padding: 1.35rem 1.5rem 1.5rem 4.4rem;
}
.step::before {
  counter-increment: steps; content: counter(steps);
  position: absolute; inset: 1.3rem auto auto 1.15rem;
  width: 2.3rem; height: 2.3rem; border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 800; color: #fff; background: var(--brand);
  z-index: 1;
}
/* Verbindungslinie von Nummer zu Nummer: läuft durch die Lücke bis zur Kante
   der nächsten Karte, damit die Schritte als ein Ablauf lesbar sind. */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1.15rem + 1.15rem - 1px);
  top: calc(1.3rem + 2.3rem);
  bottom: -1rem;
  width: 2px;
  background: rgba(47, 111, 115, .30);
}
.step-title { margin-bottom: .35rem; }
.step-text { margin: 0 0 1.15rem; }
.step-hint { margin: .9rem 0 0; font-size: .93rem; }
.steps-tip { margin: -.4rem 0 0; font-size: .93rem; }

/* ---------------- Eingabemodus / Richtungs-Umschalter ---------------- */
.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.mode-option {
  position: relative;
  display: flex; align-items: center; justify-content: flex-start;
  min-height: 56px; padding: .8rem 1rem; text-align: left;
  border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-weight: 600;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.mode-option:hover { border-color: rgba(31, 41, 55, .22); }
.mode-option.active {
  background: var(--brand-soft);
  border-color: rgba(47, 111, 115, .35);
  color: var(--brand-dark);
}
.mode-option.active::after {
  content: "";
  position: absolute; top: .75rem; right: .75rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.mode-copy { display: flex; flex-direction: column; gap: .15rem; padding-right: .8rem; }
.mode-copy small { color: var(--muted); font-size: .86rem; font-weight: 500; }

/* Klartext-Erklärung direkt unter dem Richtungsumschalter */
.direction-help {
  margin: -.35rem 0 1.1rem;
  font-size: .88rem;
  line-height: 1.5;
}

/* Ergebnis-Deutung in Klartext (gegen Fehlinterpretation) */
.result-interpret {
  display: block;
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 400;
  line-height: 1.5;
}
.result-interpret:empty { display: none; }

/* ---------------- Geometrie-Block ---------------- */
.geo-block {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .78fr);
  gap: 1.25rem;
  align-items: start;
}
.input-panel { min-width: 0; }
.field-label {
  display: block; margin-bottom: .45rem;
  color: var(--text); font-weight: 700; line-height: 1.25;
}
.field-label--component { color: var(--orange-dark); }
.field-label--distance,
.field-label--direct { color: var(--blue); }

.geometry-input-heading {
  margin: .9rem 0 -.35rem;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.2;
}
.geometry-input-heading--component { color: var(--orange-dark); }

.input-control {
  width: 100%; min-height: 48px; padding: .68rem .85rem;
  border-radius: 8px; border: 1px solid rgba(31, 41, 55, .16);
  background: #fff; color: var(--text);
}
.input-control:focus {
  outline: 3px solid rgba(47, 111, 115, .14);
  border-color: var(--brand);
}
.input-grid,
.converter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1rem;
}
#surface-inputs.input-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  align-items: start;
  gap: .85rem;
}
.input-group { display: flex; flex-direction: column; }
.dimension-input-group {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.dimension-input-group--component { border-color: rgba(217, 121, 22, .35); background: var(--orange-soft); }
.dimension-input-group--distance,
.dimension-input-group--direct { border-color: rgba(31, 79, 163, .30); background: var(--blue-soft); }
.input-with-unit { position: relative; width: 100%; }
.input-control--compact { min-height: 42px; padding: .55rem 2rem .55rem .65rem; }
.input-unit-inside {
  position: absolute; top: 50%; right: .65rem; transform: translateY(-50%);
  color: var(--muted); font-size: .9rem; font-weight: 700; pointer-events: none;
}
.dimension-input-group--component .input-control { border-color: rgba(217, 121, 22, .38); }
.dimension-input-group--distance .input-control,
.dimension-input-group--direct .input-control { border-color: rgba(31, 79, 163, .36); }
.dimension-input-group--component .input-unit-inside { color: var(--orange-dark); }
.dimension-input-group--distance .input-unit-inside,
.dimension-input-group--direct .input-unit-inside { color: var(--blue); }

.soft-panel,
.meta-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.meta-box {
  margin-top: .9rem; padding: .95rem 1rem;
  color: var(--muted); line-height: 1.6; font-size: .95rem;
}
.meta-box p { margin: 0 0 .45rem; }
.meta-box p:last-child { margin-bottom: 0; }

.visual-panel { display: flex; flex-direction: column; align-self: start; }
.sketch-frame {
  min-height: 246px; padding: 1rem;
  border-radius: 8px; background: #fff; border: 1px solid var(--line);
  display: flex; justify-content: center; align-items: center;
}
.sketch-frame img { width: 100%; max-width: 420px; border-radius: 8px; }
.sketch-caption { margin: .8rem 0 0; font-size: .93rem; line-height: 1.55; color: var(--muted); }

/* ---------------- Umrechnung / Ergebnisse ---------------- */
.explain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.05rem;
}
.explain-item { padding: .9rem 1rem; }
.explain-item strong { display: block; margin-bottom: .25rem; }
.explain-item p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.55; }

.context-text {
  display: block; margin: 0 0 1rem; padding: .85rem 1rem;
  color: var(--muted); line-height: 1.55;
}
.converter-grid > div { display: flex; flex-direction: column; }
.converter-grid .field-label { min-height: 3.25em; }

.error-text { min-height: 22px; margin: .7rem 0 0; color: var(--danger); font-weight: 600; }

.conversion-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: 1rem;
  align-items: start;
}
.conversion-input-column { min-width: 0; }
.conversion-result--side { margin-top: 0; align-self: stretch; }
.quick-conversion-workspace { grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); align-items: end; }

.result-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
}
.result-card {
  padding: 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex; flex-direction: column; gap: .35rem;
}
.result-card.emphasis { border-left: 3px solid var(--brand); }
.result-label { font-size: .9rem; color: var(--muted); }
.result-value { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.08; }
.inline-unit { font-size: .78em; font-weight: 700; }
.detail-value { font-size: 1rem; line-height: 1.45; color: var(--text); }
#virtual-dims-card { grid-column: 1 / -1; }

.conversion-result { margin-top: 1.35rem; display: grid; gap: .9rem; }
.conversion-main-card { padding: 1.25rem; }
.conversion-main-value { font-size: clamp(1.65rem, 3.2vw, 2.35rem); line-height: 1.08; }
.subtle-detail { color: var(--muted); font-weight: 600; }

/* ---------------- Einordnung & CTA ---------------- */
.boundary-cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.info-card { padding: 1.5rem; }
.info-card h2 { margin-bottom: .8rem; }
.info-card p { margin: 0; color: var(--muted); }
.info-card--accent { border-left: 3px solid var(--brand); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; color: var(--muted); }
.checklist li { padding-left: 1.6rem; position: relative; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: .55rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
}

/* ---------------- Footer (Homepage-Farbe, schlank) ---------------- */
.footer { background: #15202b; color: rgba(255, 255, 255, .85); padding: 26px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.2rem; flex-wrap: wrap;
}
.footer-logo { height: 34px; width: auto; }
.footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer a { color: rgba(255, 255, 255, .85); }
.footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- Ansichtssteuerung ---------------- */
.hidden { display: none !important; }
.quick-only { display: none !important; }
.page-shell[data-view="quick"] .full-only { display: none !important; }
.page-shell[data-view="quick"] .quick-only { display: block !important; }
.page-shell[data-view="quick"] .page-main { padding-top: 28px; }
.page-shell[data-view="quick"] .geo-block { grid-template-columns: minmax(0, 1.08fr) minmax(240px, .68fr); }
.page-shell[data-view="quick"] .sketch-frame { min-height: 210px; }
.page-shell[data-view="quick"] .sketch-frame img { max-width: 360px; }
.page-shell[data-view="quick"] .mode-option { min-height: 52px; padding: .7rem .9rem; }

/* ---------------- Responsiv ---------------- */
@media (max-width: 900px) {
  .geo-block,
  .page-shell[data-view="quick"] .geo-block,
  .result-grid,
  .boundary-cta-grid,
  .explain-grid,
  .conversion-workspace,
  .quick-conversion-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .logo-lockup img { width: clamp(150px, 38vw, 186px); height: auto; }
  .header-inner { min-height: 56px; }
  .header-app-title { display: none; }
  .view-toggle { padding: .42rem .68rem; }
  .footer-inner { justify-content: center; text-align: center; }
}

@media (max-width: 590px) {
  .header-inner { flex-wrap: wrap; padding: .45rem 0; }
  .header-left { flex: 1 1 100%; justify-content: center; }
  .header-actions { width: 100%; justify-content: center; padding-bottom: .15rem; }
}

@media (max-width: 760px) {
  .page-main { padding: 18px 0 32px; gap: 1rem; }
  .page-shell[data-view="quick"] .page-main { padding-top: 16px; }
  .quick-card,
  .info-card,
  .page-intro-card { padding: 1rem; }
  .step { padding: 1.15rem 1rem 1.25rem 3.6rem; }
  .step::before { inset: 1.1rem auto auto .8rem; width: 2rem; height: 2rem; }
  .step:not(:last-child)::after { left: calc(.8rem + 1rem - 1px); top: calc(1.1rem + 2rem); }
  .mode-switch,
  .converter-grid,
  .explain-grid { grid-template-columns: 1fr; }
  #surface-inputs.input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .converter-grid .field-label { min-height: 0; }
}

@media (max-width: 440px) {
  #surface-inputs.input-grid { grid-template-columns: 1fr; }
  .view-toggle { padding: .45rem .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .header, .footer, .button-row { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
