/* ============================================================
   EngiCalc – Engineering- & Lernplattform
   Dunkelblaues Design-System (Dark Navy)
   ============================================================ */

:root {
  --bg: #0a1628;
  --bg-2: #0f2038;
  --bg-3: #16294a;
  --surface: #132440;
  --surface-2: #1a3055;
  --border: #24406b;
  --border-light: #2f5288;
  --text: #e6eefb;
  --text-dim: #9db3d4;
  --text-faint: #6b83a8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --success: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'Cascadia Code', 'Consolas', monospace;
  --math: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', Cambria, Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(14, 165, 233, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(56, 189, 248, 0.06), transparent);
  background-attachment: fixed;
}

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.logo .logo-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  box-shadow: 0 0 18px var(--accent-glow);
}

.logo span.sub { color: var(--accent); }

.main-nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }

.main-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.18s;
}

.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.active { color: var(--accent); background: var(--accent-glow); }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }

.hero {
  text-align: center;
  padding: 64px 24px 48px;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(120deg, #e6eefb 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.hero p {
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: 1.05rem;
}

.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-glow);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.btn {
  display: inline-block;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  color: #fff;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(14, 165, 233, 0.5); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

a.card { text-decoration: none; color: var(--text); display: block; }

a.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 24px var(--accent-glow);
}

.card .icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.card p { color: var(--text-dim); font-size: 0.92rem; }
.card .count {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- Sections ---------- */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 48px 0 8px;
}
.section-sub { color: var(--text-dim); margin-bottom: 24px; font-size: 0.95rem; }

/* ---------- Page header ---------- */
.page-head { padding: 40px 0 8px; }
.page-head .crumb { font-size: 0.85rem; color: var(--text-faint); margin-bottom: 10px; }
.page-head .crumb a { color: var(--text-dim); text-decoration: none; }
.page-head .crumb a:hover { color: var(--accent); }
.page-head h1 { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.page-head p { color: var(--text-dim); max-width: 760px; }

/* ---------- Calculator ---------- */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
}

.calc-head {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.calc-head .icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 1.2rem;
}

.calc-head h2 { font-size: 1.15rem; font-weight: 700; }
.calc-head .hint { font-size: 0.83rem; color: var(--text-faint); font-weight: 400; }
.calc-head .chev { margin-left: auto; color: var(--text-faint); transition: transform 0.25s; }
.calc.open .calc-head .chev { transform: rotate(180deg); }

.calc-body { display: none; padding: 26px; }
.calc.open .calc-body { display: block; }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 820px) { .calc-grid { grid-template-columns: 1fr; } }

/* Theory / Lern-Teil */
.theory {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-dim);
}
.theory h4 {
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.theory ul { margin: 8px 0 0 18px; }
.theory li { margin: 4px 0; }

/* ---------- Formeldarstellung ---------- */
.formula {
  font-family: var(--math);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 14px 0;
  color: #f2f7ff;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  text-align: center;
  overflow-x: auto;
}
.formula sub, .formula sup {
  font-size: 0.68em;
  line-height: 1;
}
.formula sub { vertical-align: -0.25em; }
.formula sup { vertical-align: 0.55em; }

/* Bruch: <span class="frac"><span>Zähler</span><span>Nenner</span></span> */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 5px;
  line-height: 1.25;
  font-size: 0.92em;
}
.frac > span:first-child {
  border-bottom: 1.5px solid var(--text-dim);
  padding: 0 7px 2px;
}
.frac > span:last-child { padding: 2px 7px 0; }

/* Wurzel: √<span class="sqrt"><span>Radikand</span></span> */
.sqrt { display: inline-flex; align-items: stretch; margin: 0 2px; }
.sqrt::before {
  content: "√";
  font-size: 1.25em;
  line-height: 1;
  align-self: flex-end;
}
.sqrt > span {
  border-top: 1.5px solid var(--text-dim);
  padding: 3px 5px 0 3px;
  display: inline-flex;
  align-items: center;
}

/* kleine Nebenformel im Fließtext */
.fml-inline {
  font-family: var(--math);
  color: var(--text);
  white-space: nowrap;
}

/* Inputs */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 5px;
  font-weight: 600;
}
.field .unit { color: var(--text-faint); font-weight: 400; }

.field input, .field select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.98rem;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Results */
.results {
  margin-top: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 18px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .rlabel { color: var(--text-dim); }
.result-row .rvalue {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.result-row.big .rvalue { font-size: 1.25rem; }
.result-row .rvalue.ok { color: var(--success); }
.result-row .rvalue.warn { color: var(--warn); }
.result-row .rvalue.bad { color: var(--danger); }

.note {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-faint);
  border-left: 3px solid var(--border-light);
  padding-left: 12px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.site-footer a { color: var(--text-dim); }

/* ---------- Chatbot ---------- */
#chat-fab {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(14, 165, 233, 0.5);
  z-index: 200;
  transition: transform 0.2s;
  display: grid; place-items: center;
}
#chat-fab:hover { transform: scale(1.08); }

#chat-panel {
  position: fixed;
  right: 24px; bottom: 96px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow), 0 0 40px rgba(14, 165, 233, 0.15);
  z-index: 201;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#chat-panel.open { display: flex; }

.chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--bg-3), var(--surface-2));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-header .bot-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  display: grid; place-items: center;
  font-size: 1.15rem;
}
.chat-header h3 { font-size: 1rem; }
.chat-header .status { font-size: 0.75rem; color: var(--success); }
.chat-header .chat-close {
  margin-left: auto;
  background: none; border: none;
  color: var(--text-faint);
  font-size: 1.3rem;
  cursor: pointer;
}
.chat-header .chat-close:hover { color: var(--text); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; }
.msg.bot {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.user {
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg.bot a { color: var(--accent); }
.msg.bot .formula {
  font-family: var(--math);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0;
  display: flex;
  justify-content: center;
  font-size: 1rem;
  color: #f2f7ff;
  overflow-x: auto;
}
.msg.bot ul { margin: 6px 0 0 16px; }

.chat-suggestions {
  padding: 0 18px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-suggestions button {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-suggestions button:hover { color: var(--accent); border-color: var(--accent); }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.chat-input-row input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.9rem;
}
.chat-input-row input:focus { outline: none; border-color: var(--accent); }
.chat-input-row button {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}

/* ---------- Misc ---------- */
.disclaimer {
  margin-top: 40px;
  padding: 16px 20px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-dim);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 12px 0;
}
table.data th, table.data td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th { color: var(--accent); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.data td { color: var(--text-dim); }

@media (max-width: 720px) {
  .nav-wrap { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .main-nav { width: 100%; overflow-x: auto; padding-bottom: 6px; }
  .hero { padding: 40px 16px 32px; }
}

/* --- tkai Markenrichtlinie --- */
@font-face{font-family:"Space Grotesk";font-weight:400;font-display:swap;src:url("fonts/space-grotesk-latin-400-normal.woff2") format("woff2")}
@font-face{font-family:"Space Grotesk";font-weight:500;font-display:swap;src:url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2")}
@font-face{font-family:"Space Grotesk";font-weight:700;font-display:swap;src:url("fonts/space-grotesk-latin-700-normal.woff2") format("woff2")}
h1,h2,h3,.logo{font-family:"Space Grotesk",system-ui,sans-serif;letter-spacing:-0.01em}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
svg.lucide{width:1em;height:1em;vertical-align:-0.125em}
.card .icon,.calc-head .icon{color:var(--accent)}
.logo .logo-icon{color:#fff}
.site-footer .tkai-endorsement{margin-top:10px}
.tkai-endorsement{font-size:.85rem;color:#93a1b0}
.tkai-endorsement a{color:#e6edf3;text-decoration:none;font-family:"Space Grotesk",sans-serif;font-weight:700}
.tkai-endorsement a span{color:#4fd1c5}
.tkai-endorsement a:hover span{text-decoration:underline}
