/* ==========================================================================
   V2 Visual Quality Upgrade – bmi-rechner.info
   Design-System Alignment with dreisatz-rechner.net V2
   ========================================================================== */

/* ---------- Self-hosted Fonts (GDPR compliant) ---------- */

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('/fonts/lexend-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('/fonts/lexend-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Reset & Global ---------- */

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

html {
  scroll-behavior: smooth;
}

::selection {
  background: #BFDBFE;
}

body {
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #0F172A;
  background: radial-gradient(ellipse at top, #EFF6FF 0%, #F8FAFC 50%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Lexend', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.3;
}

code, pre, .font-mono {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

a {
  color: #2563EB;
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: #1E3A8A;
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Layout ---------- */

.container {
  max-width: 896px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 1. Hero Section ---------- */

.hero-section {
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #3B82F6 100%);
  position: relative;
  overflow: hidden;
  padding: 32px 0 96px;
}

.hero-section--small {
  padding: 24px 0 48px;
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    radial-gradient(circle at 20% 50%, white 1px, transparent 1px),
    radial-gradient(circle at 80% 20%, white 1px, transparent 1px),
    radial-gradient(circle at 50% 80%, white 1px, transparent 1px);
  background-size: 60px 60px, 80px 80px, 40px 40px;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  color: #FFFFFF;
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hero-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  font-weight: 400;
}

.hero-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-nav a {
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  transition: all 150ms ease;
  text-decoration: none;
}

.hero-nav a:hover,
.hero-nav a.active {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  text-decoration: none;
}

/* ---------- 2. Calculator Card ---------- */

.calc-card {
  background: #FFFFFF;
  border-radius: 20px;
  border-top: 4px solid #3B82F6;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.08);
  padding: 28px 24px;
  position: relative;
  margin-top: -48px;
  z-index: 2;
}

@media (min-width: 640px) {
  .calc-card {
    padding: 36px 32px;
    border-radius: 24px;
  }
}

.calc-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.calc-heading h2 {
  font-size: 20px;
  font-weight: 600;
  color: #0F172A;
}

.calc-heading svg {
  width: 24px;
  height: 24px;
  color: #3B82F6;
}

/* ---------- 3. Input Fields ---------- */

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: #0F172A;
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94A3B8;
  pointer-events: none;
}

.v2-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 42px;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  color: #0F172A;
  background: #FFFFFF;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.v2-input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.v2-input::placeholder {
  color: #94A3B8;
}

.v2-select {
  width: 100%;
  height: 48px;
  padding: 0 36px 0 42px;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  color: #0F172A;
  background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.v2-select:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------- 4. CTA Button ---------- */

.cta-btn {
  display: block;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
  color: #FFFFFF;
  font-family: 'Lexend', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  margin-top: 8px;
}

.cta-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

/* ---------- 5. Result Display ---------- */

.result-card {
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  margin-top: 24px;
  transition: all 300ms ease;
}

.result-card--placeholder {
  background: #F8FAFC;
  border: 2px dashed #E2E8F0;
  color: #94A3B8;
  font-size: 15px;
}

/* Color variants by WHO category */
.result-card--underweight {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border-left: 4px solid #2563EB;
}

.result-card--normal {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-left: 4px solid #059669;
}

.result-card--overweight {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border-left: 4px solid #D97706;
}

.result-card--obese1 {
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border-left: 4px solid #DC2626;
}

.result-card--obese2 {
  background: linear-gradient(135deg, #FEF2F2 0%, #FECACA 100%);
  border-left: 4px solid #B91C1C;
}

.result-label {
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.result-number {
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .result-number {
    font-size: 2.5rem;
  }
}

.result-number--underweight { color: #2563EB; }
.result-number--normal { color: #059669; }
.result-number--overweight { color: #D97706; }
.result-number--obese1 { color: #DC2626; }
.result-number--obese2 { color: #B91C1C; }

.result-category {
  font-family: 'Lexend', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.result-description {
  margin-top: 12px;
  font-size: 15px;
  color: #475569;
}

.result-breakdown {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 14px;
  border-radius: 9999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
}

.result-breakdown--underweight { background: rgba(37, 99, 235, 0.1); color: #1D4ED8; }
.result-breakdown--normal { background: rgba(5, 150, 105, 0.1); color: #047857; }
.result-breakdown--overweight { background: rgba(217, 119, 6, 0.1); color: #92400E; }
.result-breakdown--obese1 { background: rgba(220, 38, 38, 0.1); color: #991B1B; }
.result-breakdown--obese2 { background: rgba(185, 28, 28, 0.1); color: #7F1D1D; }

/* ---------- 6. WHO Bar Visualization ---------- */

.who-bar {
  margin-top: 20px;
}

.who-bar-segments {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
}

.who-bar-seg {
  transition: opacity 150ms ease;
}

.who-bar-seg--underweight { background: #3B82F6; flex: 2.5; }
.who-bar-seg--normal { background: #10B981; flex: 6.5; }
.who-bar-seg--overweight { background: #F59E0B; flex: 5; }
.who-bar-seg--obese1 { background: #EF4444; flex: 5; }
.who-bar-seg--obese2 { background: #B91C1C; flex: 5; }

.who-bar-marker {
  position: relative;
  height: 20px;
}

.who-bar-marker .marker {
  position: absolute;
  transform: translateX(-50%);
  font-size: 16px;
  line-height: 1;
  top: 2px;
}

.who-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94A3B8;
  padding: 0 2px;
  margin-top: 2px;
}

/* ---------- 7. Table of Contents Pills ---------- */

.toc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.toc-pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms ease;
}

.toc-pill:hover {
  border-color: #3B82F6;
  color: #1E3A8A;
  background: #EFF6FF;
  text-decoration: none;
}

[id] {
  scroll-margin-top: 24px;
}

/* ---------- 8. Content Section Cards ---------- */

.content-card {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  padding: 28px 24px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .content-card {
    padding: 36px 32px;
  }
}

.content-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 20px;
}

.content-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: #0F172A;
  margin-top: 28px;
  margin-bottom: 12px;
}

.content-card p {
  margin-bottom: 16px;
  color: #475569;
  line-height: 1.7;
}

.content-card ul,
.content-card ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: #475569;
  line-height: 1.7;
}

.content-card li {
  margin-bottom: 8px;
}

.content-card strong {
  color: #0F172A;
}

/* ---------- 9. Formula Blocks ---------- */

.formula-block {
  background: #1E3A8A;
  color: #FFFFFF;
  border-radius: 12px;
  padding: 20px 24px;
  overflow-x: auto;
  margin-bottom: 16px;
  border-left: 4px solid #3B82F6;
}

.formula-block code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  white-space: pre;
  color: #FFFFFF;
}

/* ---------- 10. WHO Table Redesign ---------- */

.who-table-wrap {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.who-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.who-table thead tr {
  background: #1E3A8A;
}

.who-table thead th {
  padding: 12px 16px;
  text-align: left;
  color: #FFFFFF;
  font-family: 'Lexend', sans-serif;
  font-weight: 600;
  font-size: 13px;
}

.who-table tbody tr {
  border-bottom: 1px solid #F1F5F9;
}

.who-table tbody tr:nth-child(even) {
  background: #F8FAFC;
}

.who-table tbody td {
  padding: 12px 16px;
  color: #475569;
}

.who-table tbody tr.row--underweight td:first-child { border-left: 3px solid #3B82F6; }
.who-table tbody tr.row--normal td:first-child { border-left: 3px solid #10B981; }
.who-table tbody tr.row--overweight td:first-child { border-left: 3px solid #F59E0B; }
.who-table tbody tr.row--obese td:first-child { border-left: 3px solid #EF4444; }
.who-table tbody tr.row--normal { background: #F0FDF4; }

/* Gender-specific table headers */
.who-table thead.thead--male tr { background: #1E3A8A; }
.who-table thead.thead--female tr { background: #9333EA; }

/* ---------- 11. FAQ Accordion ---------- */

.faq-list {
  border-top: 1px solid #E2E8F0;
}

.faq-item {
  border-bottom: 1px solid #E2E8F0;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-family: 'Lexend', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  color: #0F172A;
  gap: 12px;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #94A3B8;
  transition: transform 200ms ease;
}

details[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 0 16px 0;
  color: #475569;
  line-height: 1.7;
}

.faq-answer a {
  color: #2563EB;
}

/* ---------- 12. Footer ---------- */

.v2-footer {
  background: linear-gradient(135deg, #1E3A8A, #0F172A);
  margin-top: 48px;
  padding: 32px 16px;
  text-align: center;
}

.v2-footer .footer-brand {
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #FFFFFF;
  margin-bottom: 12px;
}

.v2-footer .footer-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 500;
}

.v2-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.v2-footer a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  position: relative;
}

.v2-footer a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
  transition: width 200ms ease;
}

.v2-footer a:hover {
  color: #FFFFFF;
  text-decoration: none;
}

.v2-footer a:hover::after {
  width: 100%;
}

.v2-footer .footer-copy {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

/* ---------- 13. AdSense Slot ---------- */

.adsense-slot {
  text-align: center;
  color: #CBD5E1;
  font-size: 12px;
  padding: 16px 0;
}

/* ---------- 14. Main Content Area ---------- */

.main-content {
  max-width: 896px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Intro section on homepage */
.intro-text {
  text-align: center;
  font-size: 17px;
  line-height: 1.7;
  color: #475569;
  margin-bottom: 24px;
}

.intro-text strong {
  color: #0F172A;
}

/* ---------- Touch Target Fixes (min 48px) ---------- */

.toc-pill {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.hero-nav a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.cta-btn {
  min-height: 48px;
}

.faq-question {
  min-height: 48px;
}

.v2-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
}

.v2-footer nav {
  align-items: center;
}

/* ---------- Accessibility ---------- */

:focus-visible {
  outline: 2px solid #3B82F6;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */

@media print {
  .hero-section, .v2-footer, .who-bar, .toc-pills {
    display: none;
  }
  .content-card, .calc-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
  body {
    background: white;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .hero-title {
    font-size: 24px;
  }
  .hero-subtitle {
    font-size: 16px;
  }
  .calc-card {
    padding: 20px 16px;
  }
  .content-card {
    padding: 20px 16px;
  }
  .input-row {
    grid-template-columns: 1fr;
  }
  .footer-badges {
    flex-direction: column;
    align-items: center;
  }
}
