/* ==================================================================
   BOX-PAL-CALC  ·  Stylesheet
   Gestaltung angelehnt an logicost.de:
   Beige Fläche, Anthrazit, Limettengrün-Akzent,
   Archivo Black für Headlines, Poppins für Fließtext
   ================================================================== */

:root {
  --bg: #e1dfd9;
  --bg-alt: #d7d5cd;
  --ink: #40443f;
  --ink-soft: #6a6f68;
  --card: #ffffff;
  --line: #c7c5bd;
  --lime: #c9e265;
  --lime-dark: #b2ce46;
  --green: #0c6407;
  --danger: #a3341f;
  --radius: 4px;
  --shadow: 0 2px 0 rgba(64, 68, 63, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .btn, .tab, legend, .kpi-value, .logo-text {
  font-family: 'Archivo Black', 'Poppins', Arial Black, sans-serif;
  font-weight: 400;
  letter-spacing: .01em;
}

.wrap { width: min(1280px, 100% - 48px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; }

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.logo-mark { width: 46px; height: 36px; display: block; border: 2px solid var(--ink); padding: 3px 5px; }
.logo-mark svg { width: 100%; height: 100%; fill: var(--ink); }
.logo-mark svg path { fill: var(--lime); stroke: var(--ink); stroke-width: 1.4; }
.logo-text { font-size: 22px; letter-spacing: .02em; }
.logo-text.small { font-size: 16px; }
.logo-dot { color: var(--green); }

.site-nav { display: flex; align-items: center; gap: 26px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; }
.site-nav a:hover { color: var(--green); }

/* ---------- Sprachumschalter ---------- */
.lang-switch { display: flex; gap: 6px; align-items: center; }
.flag {
  width: 34px; height: 22px; padding: 0; cursor: pointer;
  border: 2px solid var(--line); border-radius: 3px; background: none;
  overflow: hidden; line-height: 0; opacity: .55; transition: .15s ease;
}
.flag svg { width: 100%; height: 100%; display: block; }
.flag:hover { opacity: .85; }
.flag.is-active { opacity: 1; border-color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 2px solid var(--ink); cursor: pointer;
  padding: 13px 24px; border-radius: 999px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em; transition: .15s ease;
}
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: transparent; color: var(--ink); }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: var(--ink); color: var(--lime); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }

/* ---------- Laufband ---------- */
.ticker { overflow: hidden; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 0; }
.ticker-track {
  display: flex; gap: 46px; white-space: nowrap; width: max-content;
  animation: slide 32s linear infinite;
  font-family: 'Archivo Black', Arial Black, sans-serif; font-size: 17px;
}
.ticker-track span:nth-child(odd) { color: var(--green); }
.ticker-track span:nth-child(even) { color: var(--ink); }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 34px; max-width: 900px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 58px); line-height: 1.08; margin: 0 0 18px; }
.hero h1 em { font-style: normal; color: var(--green); }
.lead { font-size: 18px; max-width: 760px; margin: 0; color: var(--ink); }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 380px minmax(0, 1fr);
  gap: 26px; align-items: start; padding-bottom: 30px;
}
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.form-panel { position: sticky; top: 84px; }
@media (max-width: 1080px) { .form-panel { position: static; } }

.panel-title { font-size: 19px; margin: 0 0 18px; text-transform: uppercase; letter-spacing: .04em; }

fieldset { border: 0; border-top: 1px solid var(--line); margin: 0 0 18px; padding: 16px 0 0; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--green); padding: 0 6px 0 0; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field > span small { font-weight: 400; color: var(--ink-soft); }

/* Pflichtfelder: Sternchen am Label + dauerhaft dezent getönter Rahmen/Grund,
   damit sie sich auch mit vorausgefülltem Wert von den optionalen Feldern
   abheben. Ist ein Pflichtfeld tatsächlich leer, wird die Markierung
   deutlicher (gelb) – das unterscheidet "Pflichtfeld" von "fehlt noch". */
.req-note { font-size: 12px; color: var(--ink-soft); margin: -10px 0 16px; }
.req-note b { color: var(--green); font-weight: 700; }
.field.is-required > span::after { content: " *"; color: var(--green); font-weight: 700; }
.field.is-required input {
  background: #f4f8ec;
  border-color: #7fa04a;
}
.field.is-required input.is-empty {
  background: #fbfbdf;
  border-color: #9a9a2a;
}
.field.is-required input.is-empty:focus { outline-color: var(--lime); }

/* Felder ohne strenge Pflicht (Palettentyp, Toleranzen: 0 ist ein gültiger
   Wert), die aber zur besseren Auffindbarkeit dieselbe dezente Einfärbung
   bekommen – bewusst ohne Sternchen, das wäre hier irreführend. */
.field.is-highlight input,
.field.is-highlight select {
  background: #f4f8ec;
  border-color: #7fa04a;
}
input[type="number"], select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
}
input[type="number"]:focus, select:focus { outline: 3px solid var(--lime); outline-offset: 0; }
.hint { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); margin-top: 2px; flex: none; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.calc-note { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; min-height: 18px; }

/* ---------- Ergebnis ---------- */
.results { display: flex; flex-direction: column; gap: 22px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }
.kpi {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi.is-primary { background: var(--lime); }
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-bottom: 6px; }
.kpi.is-primary .kpi-label { color: #3c4a1d; }
.kpi-value { font-size: 30px; line-height: 1.1; }
.kpi-value span { font-size: 14px; }
.kpi-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.kpi.is-primary .kpi-sub { color: #3c4a1d; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 2px solid var(--ink); margin: -4px 0 20px; padding-bottom: 12px; }
.tab {
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.tab:hover { background: var(--bg-alt); }
.tab.is-active { background: var(--ink); color: #fff; }

.layer-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.layer-btn {
  border: 1.5px solid var(--ink); background: #fff; color: var(--ink);
  padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.layer-btn.is-active { background: var(--green); border-color: var(--green); color: #fff; }

.svg-holder { border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; overflow: auto; }
.svg-holder svg { display: block; width: 100%; height: auto; }
.iso-svg { max-height: 78vh; }

.iso-controls { margin-bottom: 14px; }
.field.inline { display: flex; align-items: center; gap: 12px; margin: 0; }
.field.inline > span { margin: 0; white-space: nowrap; }
.field.inline input[type="range"] { flex: 1; max-width: 320px; accent-color: var(--green); }
.field.inline output { font-weight: 700; font-size: 14px; }

/* ---------- Packanweisung ---------- */
.instructions h3 { font-size: 16px; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.instructions h3:first-child { margin-top: 0; }
.instructions ol, .instructions ul { margin: 0; padding-left: 20px; }
.instructions li { margin-bottom: 7px; }
.instructions table, .variants table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.instructions th, .instructions td, .variants th, .variants td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
}
.instructions th, .variants th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.variants tr.is-best { background: #f2f7e2; font-weight: 600; }
.badge {
  display: inline-block; background: var(--lime); border: 1px solid var(--ink);
  border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 700; margin-left: 6px;
}

/* ---------- Fehler / Notizen ---------- */
.error-box {
  background: #fdece8; border: 2px solid var(--danger); color: var(--danger);
  border-radius: var(--radius); padding: 14px 18px; font-size: 14.5px; font-weight: 600;
}
.error-box ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.error-box.is-warning { background: #fbf6e2; border-color: #9a7d1c; color: #6f5a10; }

.table-note { margin-top: 12px; font-size: 14px; color: var(--ink-soft); }

.notes { margin: 8px 0 46px; }
.notes ul { margin: 0; padding-left: 20px; }
.notes li { margin-bottom: 9px; font-size: 14.5px; }

/* ---------- Kopf-/Fußleiste "Kostenloser Service von LOGICOST" ---------- */
.topbar {
  background: var(--ink); color: #fff; text-align: center;
  font-size: 25px; padding: 12px 0;
}
.topbar a { color: var(--lime); font-weight: 700; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.footer-service {
  border-top: 1px solid var(--line); text-align: center;
  font-size: 12.5px; color: var(--ink-soft); padding: 12px 0;
}
.footer-service a { color: var(--green); font-weight: 700; text-decoration: none; }
.footer-service a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid transparent; }
.footer-links a:hover { color: var(--ink); border-bottom-color: var(--green); }

.disclaimer {
  margin-top: 18px; padding: 14px 16px; font-size: 13px; line-height: 1.6;
  color: var(--ink-soft); background: var(--bg-alt);
  border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius);
}
.disclaimer strong { color: var(--ink); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 22px 0; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap;
}

/* ---------- Rechtliche Hinweise ---------- */
.legal .panel { margin-bottom: 22px; max-width: 900px; }
.legal h3 { font-size: 15px; margin: 22px 0 6px; }
.legal p { margin: 0 0 10px; font-size: 15px; }
.legal small { color: var(--ink-soft); }
.legal code { background: var(--bg-alt); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.legal a { color: var(--green); }
.legal-date { color: var(--ink-soft); font-size: 13px; margin-top: 20px; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 720px) {
  .wrap { width: min(1280px, 100% - 28px); }
  .site-nav a { display: none; }
  .site-nav .btn { padding: 10px 16px; font-size: 11px; }
  .logo-text { font-size: 18px; }
  .logo-mark { width: 38px; height: 30px; }
  .hero { padding: 32px 0 24px; }
  .lead { font-size: 16px; }
  .panel { padding: 18px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .kpi-value { font-size: 24px; }
  .instructions table, .variants table { font-size: 12.5px; }
  .instructions th, .instructions td, .variants th, .variants td { padding: 7px 6px; }
}

/* ---------- Druck ----------
   Ziel: jedes Segment (Kennzahlen, Lagenplan, 3D-Ansicht, Packanweisung,
   Varianten) bleibt auf einer Seite. Die Zeichnungen werden dafür in der
   Höhe gedeckelt und skalieren sich über preserveAspectRatio herunter. */
@page { size: A4 portrait; margin: 12mm; }

@media print {
  .topbar, .site-header, .ticker, .site-footer, .form-panel, .tabs, .actions,
  .iso-controls, .layer-switch, .notes, .footer-links { display: none !important; }

  body { background: #fff; font-size: 10.5px; line-height: 1.45; }
  .wrap { width: 100%; }
  .layout { display: block; }
  .results { gap: 10px; }

  .hero { padding: 0 0 8px; }
  .hero h1 { font-size: 18px; margin-bottom: 4px; }
  .lead, .calc-note { display: none; }

  /* --- Segmente zusammenhalten --- */
  .kpi, .tab-body, .variants {
    break-inside: avoid; page-break-inside: avoid;
  }
  /* Der Rahmen umschließt alle Reiter und liefe über mehrere Seiten –
     im Druck bleiben nur die Kennzahlen-Karten eingerahmt. */
  .panel { border: 0; box-shadow: none; padding: 0; }
  .tab-body[hidden] { display: block !important; }
  .tab-body { margin-bottom: 10px; }
  .tab-body:last-child { margin-bottom: 0; }

  /* --- Kennzahlen kompakter --- */
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .kpi { padding: 7px 9px; }
  .kpi-value { font-size: 17px; }
  .kpi-value span { font-size: 9px; }
  .kpi-label { font-size: 8px; margin-bottom: 2px; letter-spacing: .06em; }
  .kpi-sub { font-size: 8.5px; margin-top: 2px; }

  /* --- Zeichnungen auf Seitenhöhe begrenzen --- */
  .svg-holder { border: 0; overflow: visible; }
  .plan-svg { max-height: 92mm; }
  .iso-svg { max-height: 105mm; }

  /* Die Packanweisung beginnt auf einer eigenen Seite. Ohne den erzwungenen
     Wechsel landet sie am Seitenende und wird trotz break-inside: avoid
     geteilt – zusammen mit den Varianten passt sie bequem auf ein Blatt. */
  [data-panel="instr"] { break-before: page; page-break-before: always; }

  /* --- Packanweisung bleibt als Ganzes zusammen (siehe .tab-body oben).
         Die Regeln für thead/tr greifen nur im Ausnahmefall, wenn die
         Tabelle bei sehr vielen Blöcken länger als eine Seite wird –
         dann bricht der Browser trotz break-inside: avoid um. --- */
  .instructions h3 { font-size: 11px; margin: 10px 0 4px; break-after: avoid; page-break-after: avoid; }
  .instructions li { margin-bottom: 2px; }
  .instructions ol, .instructions ul, .instructions p { break-inside: avoid; }
  .instructions table, .variants table { font-size: 9.5px; margin-top: 3px; }
  .instructions th, .instructions td,
  .variants th, .variants td { padding: 3px 5px; }
  .instructions thead, .variants thead { display: table-header-group; }
  .instructions tr, .variants tr { break-inside: avoid; page-break-inside: avoid; }
  .table-note { font-size: 9px; margin-top: 5px; }

  .disclaimer {
    border: 1px solid #000; background: none; color: #000;
    font-size: 9px; padding: 6px 8px; margin-top: 8px;
    break-inside: avoid; page-break-inside: avoid;
  }
  .error-box { break-inside: avoid; }

  a { color: #000; text-decoration: none; }
}
