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

/* ── Base ── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
               'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  min-height: 100vh;
  color: #1d1d1f;
  line-height: 1.6;
}

/* ── Sticky Navbar ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #0071e3;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  width: 120px;
}

.nav-back:hover { opacity: 0.7; }

.nav-center {
  flex: 1;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1d1d1f;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.nav-spacer { width: 120px; }

/* ── Layout container ── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding-top: 0 !important;
}

.inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── Header ── */
header {
  text-align: center;
  padding: 56px 40px 40px;
  background: transparent;
}

header .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #0071e3;
  margin-bottom: 8px;
}

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.subtitle {
  color: #6e6e73;
  font-size: 1rem;
  font-weight: 400;
}

/* ── Metrics Grid ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  transition: box-shadow 0.2s;
}

.metric-card.highlight {
  border-color: #0071e3;
  box-shadow: 0 4px 16px rgba(0,113,227,0.12);
}

.metric-card.warning {
  border-color: #ff3b30;
  background: #fff9f9;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #6e6e73;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1d1d1f;
  line-height: 1.1;
  letter-spacing: -1px;
}

.metric-unit {
  font-size: 0.78rem;
  color: #6e6e73;
  margin-top: 4px;
}

/* ── Cards & Sections ── */
.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 400px;
}

/* ── Dark Controls Panel ── */
.controls-card {
  background: #1d1d1f;
  color: #fff;
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
}

.control-group {
  margin-bottom: 24px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.control-title {
  font-size: 1rem;
  font-weight: 700;
}

.control-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0071e3;
}

/* ── Formula Display ── */
.formula-display {
  background: #f0f6ff;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
  border: 1px solid #d0e3ff;
}

.formula-main {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.formula-params {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.formula-param-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  border: 1.5px solid #e5e5e5;
  font-weight: 700;
  color: #1d1d1f;
  font-size: 1.1rem;
}

.formula-param-item span {
  color: #6e6e73;
  font-size: 0.85em;
  font-weight: 500;
  flex: 1;
  text-align: right;
}

/* ── Range sliders ── */
input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #444;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0071e3;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ── KaTeX scaling ── */
.katex { font-size: 1.15em !important; }

/* ── Author footer ── */
.author-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 40px 32px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

.author-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1d1d1f;
}

.author-links { display: flex; gap: 10px; }

.yt-link, .li-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
  border: 1.5px solid #d2d2d7;
}

.yt-link { color: #ff0000; border-color: #ff0000; }
.li-link { color: #0a66c2; border-color: #0a66c2; }
.yt-link svg, .li-link svg { width: 14px; height: 14px; }

/* ── Exam Pills ── */
.exam-box {
  background: #fff9e6;
  border: 1.5px solid #ffcc00;
  border-radius: 16px;
  padding: 20px;
  margin-top: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.exam-icon {
  font-size: 1.5rem;
  background: #ffcc00;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exam-content h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #b38f00;
  margin-bottom: 6px;
}

.exam-content p {
  font-size: 0.95rem;
  color: #5c4d00;
  line-height: 1.5;
}

.exam-content strong { color: #000; }

/* ── Tool cards (index page) ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 0 40px;
}

.tool-card {
  display: block;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 18px;
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.tool-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.tool-card h2 { font-size: 1.2rem; margin-bottom: 10px; }
.tool-card p { font-size: 0.9rem; color: #6e6e73; margin-bottom: 16px; }
.status { font-size: 0.75rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; background: #e3f2fd; color: #0071e3; }
