/* ==========================================================================
   Blood-Alcohol-Calculator.com — Styles
   Based on shared portfolio design system
   ========================================================================== */

/* ---------- 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: '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;
}

/* ---------- Global / Body ---------- */

html {
  scroll-behavior: smooth;
}

::selection {
  background: #BFDBFE;
}

.v2-body {
  background: radial-gradient(ellipse at top, #EFF6FF 0%, #F8FAFC 50%);
  min-height: 100vh;
}

body {
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #0F172A;
}

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

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;
}

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

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

.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;
}

/* ---------- Trust Badge Row (Hero) ---------- */

.hero-trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  margin-top: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.hero-trust-badges span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hero-trust-badges svg {
  width: 16px;
  height: 16px;
  color: #34D399;
  flex-shrink: 0;
}

/* ---------- Medical Disclaimer Banner ---------- */

.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: #FFFBEB;
  border: 1.5px solid #F59E0B;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #92400E;
}

.disclaimer-banner svg {
  color: #F59E0B;
  margin-top: 2px;
}

/* ---------- 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;
}

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

/* ---------- 3. Toggle Buttons ---------- */

.toggle-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
}

.toggle-btn {
  flex: 1 1 0%;
  padding: 10px 12px;
  border-radius: 10px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  background: #FFFFFF;
  color: #475569;
  border: 1.5px solid #E2E8F0;
  text-align: center;
  white-space: nowrap;
}

.toggle-btn:hover {
  border-color: #3B82F6;
  color: #1E3A8A;
}

.toggle-btn.active {
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
}

@media (max-width: 480px) {
  .toggle-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .toggle-btn {
    padding: 10px 6px;
    font-size: 13px;
    min-width: 0;
    white-space: normal;
    line-height: 1.2;
  }
}

/* ---------- 4. Input Fields ---------- */

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

.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-select {
  padding-left: 16px;
  cursor: pointer;
  appearance: none;
  background-image: 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'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.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-input.input-error {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
  animation: shake 400ms ease;
}

.v2-input.input-valid {
  border-color: #059669;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card.has-result .result-number,
.result-card.has-result .result-breakdown {
  animation: slideUp 300ms ease-out;
}

@keyframes pulse-copy {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.3); }
  70% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

@media (max-width: 767px) {
  .v2-input {
    height: 52px;
  }
  .toggle-btn,
  .toc-pill {
    min-height: 44px;
  }
}

/* ---------- 5. Result Section ---------- */

.result-card {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-left: 4px solid #059669;
  border-radius: 14px;
  padding: 20px 24px;
  text-align: center;
  transition: all 300ms ease;
}

.result-card.has-result {
  border-left-color: transparent;
  border-image: linear-gradient(to bottom, #059669, #34D399) 1;
  border-left-width: 4px;
  border-left-style: solid;
}

.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;
  color: #059669;
  line-height: 1.2;
}

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

.result-breakdown {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  background: rgba(5, 150, 105, 0.1);
  border-radius: 9999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: #047857;
}

.result-breakdown:empty {
  display: none;
}

/* ---------- 6. 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;
}

/* ---------- 7. 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;
  }
}

/* ---------- 8. Formula Blocks ---------- */

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

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

.formula-block--compact {
  padding: 16px 24px;
  text-align: center;
}

.formula-block--compact code {
  font-size: 16px;
  font-weight: 500;
}

/* ---------- 9. Example Cards ---------- */

.example-card {
  position: relative;
  padding: 20px 20px 20px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.example-card--blue {
  background: #EFF6FF;
  border-left: 4px solid #3B82F6;
}

.example-card--amber {
  background: #FFFBEB;
  border-left: 4px solid #D97706;
}

.example-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E3A8A, #3B82F6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.example-badge--amber {
  background: linear-gradient(135deg, #92400E, #D97706);
}

/* ---------- 10. 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-weight: 600;
  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.6;
}

/* ---------- 11. Step-by-Step List ---------- */

.steps-list {
  position: relative;
  padding-left: 20px;
}

.steps-list::before {
  content: '';
  position: absolute;
  left: 35px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(to bottom, #3B82F6, #93C5FD);
  border-radius: 1px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  position: relative;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E3A8A, #3B82F6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* ---------- 12. Ad Slots ---------- */

.ad-slot {
  text-align: center;
  margin: 24px 0;
  min-height: 90px;
  overflow: hidden;
}

/* ---------- 13. Author / Trust Box ---------- */

.author-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: #F8FAFC;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  margin-top: 32px;
}

.author-box__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E3A8A, #3B82F6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.author-box__info {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

.author-box__name {
  font-weight: 600;
  color: #0F172A;
}

.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748B;
  margin-bottom: 16px;
}

.last-updated svg {
  width: 14px;
  height: 14px;
}

/* ---------- 14. Content Scannability ---------- */

.content-card p {
  line-height: 1.75;
}

.content-card mark {
  background: #FEF3C7;
  padding: 1px 4px;
  border-radius: 3px;
  color: inherit;
}

/* ---------- 15. Footer ---------- */

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

.v2-footer a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  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%;
}

/* ---------- Tables ---------- */

.content-card table {
  border-collapse: collapse;
}

.content-card th {
  font-family: 'Lexend', sans-serif;
}

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

@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, .toggle-row, .disclaimer-banner {
    display: none;
  }
  .content-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
