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

:root {
  --bg-900: #0c1222;
  --bg-800: #131b2e;
  --bg-700: #1a2540;
  --accent: #34d399;
  --accent-glow: rgba(52,211,153,0.2);
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #60a5fa;
  --text: #f1f5f9;
  --text-body: #cbd5e1;
  --text-dim: #94a3b8;
  --border: rgba(255,255,255,0.07);
  --card: #162032;
  --radius: 14px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-900); color: var(--text); line-height: 1.65;
  overflow-x: hidden;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #6ee7b7; }

/* Navbar */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(12,18,34,0.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--accent) !important; }
.nav-links { list-style: none; display: flex; gap: 24px; }
.nav-links a { color: var(--text-dim); font-weight: 500; font-size: .9rem; }
.nav-links a:hover { color: var(--accent); }

/* Hero */
#hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 80px;
  background: radial-gradient(ellipse 60% 40% at 50% 35%, rgba(52,211,153,0.06), transparent 70%), var(--bg-900);
}
.hero-content {
  width: 100%; max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
}
.hero-badge {
  display: inline-block; background: rgba(52,211,153,0.12); color: var(--accent);
  padding: 8px 20px; border-radius: 20px; font-size: .82rem; font-weight: 600; margin-bottom: 20px;
  max-width: min(100%, 36rem); text-align: center; line-height: 1.45; box-sizing: border-box;
}
#hero h1 {
  font-size: clamp(2.4rem,5.5vw,3.6rem); font-weight: 800; line-height: 1.12; margin-bottom: 18px;
  width: 100%; text-align: center;
}
#hero h1 .hero-title-line1 {
  display: inline-block;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
#hero h1 .hero-title-line2 {
  display: inline-block;
  background: linear-gradient(135deg, #34d399 0%, #6ee7b7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-sub {
  color: var(--text-body); font-size: 1.05rem; max-width: 640px; width: 100%;
  margin: 0 0 28px; line-height: 1.7; text-align: center;
}
.hero-sub .hero-lead { color: var(--text); display: block; margin-bottom: 10px; font-size: 1.12rem; font-weight: 700; }
.hero-buttons {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center;
  margin-bottom: 40px; width: 100%;
}
.btn {
  display: inline-block; padding: 11px 24px; border-radius: 8px;
  font-weight: 600; font-size: .92rem; transition: transform .15s, box-shadow .2s; cursor: pointer; border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--bg-900); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:hover { color: var(--bg-900); }
.btn-outline { border: 1.5px solid var(--text-dim); color: var(--text-dim); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 12px; width: 100%; max-width: 520px; margin: 0 auto;
  align-items: start; justify-items: center;
}
.hero-stat {
  text-align: center; min-width: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.hero-stat-num { font-size: clamp(1.5rem, 4vw, 1.85rem); font-weight: 800; color: var(--accent); line-height: 1.1; }
.hero-stat-label {
  font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .55px;
  max-width: 7rem; line-height: 1.3;
}

/* Sections */
section { padding: 80px 0; }
section:nth-child(even) { background: var(--bg-800); }
.section-title {
  text-align: center; font-size: 2rem; font-weight: 800; margin: 0 auto 8px;
  padding: 0 8px; max-width: 900px;
}
.section-subtitle {
  text-align: center; color: var(--text-dim); font-size: 1.05rem; margin: 0 auto 48px;
  padding: 0 16px; max-width: 640px;
}
.section-subtitle-bright { color: var(--text-body); }
.sub-heading {
  font-size: 1.15rem; font-weight: 700; margin: 40px auto 20px; color: var(--text);
  text-align: center; max-width: 900px; padding: 0 8px;
}

/* Case overview narrative */
.narrative-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px;
  margin-bottom: 36px; align-items: stretch;
}
.narrative-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px; border-left: 4px solid var(--accent);
  display: flex; flex-direction: column; height: 100%;
}
.narrative-card.narrative-problem { border-left-color: #f87171; }
.narrative-card.narrative-approach { border-left-color: var(--blue); }
.narrative-card.narrative-results { border-left-color: var(--orange); }
.narrative-card.narrative-impact { border-left-color: var(--accent); }
.narrative-label {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: 14px;
}
.narrative-problem .narrative-label { color: #fca5a5; }
.narrative-approach .narrative-label { color: var(--blue); }
.narrative-results .narrative-label { color: var(--orange); }
.narrative-impact .narrative-label { color: #6ee7b7; }
.narrative-text {
  color: var(--text-body); font-size: .98rem; line-height: 1.72; margin-bottom: 12px;
}
.narrative-text strong, .narrative-list strong { color: var(--text); font-weight: 700; }
.narrative-muted {
  color: var(--text-dim); font-size: .9rem; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px; margin-bottom: 0;
}
.narrative-list {
  list-style: none; padding: 0; margin: 0;
}
.narrative-list li {
  position: relative; padding-left: 18px; margin-bottom: 12px;
  color: var(--text-body); font-size: .96rem; line-height: 1.68;
}
.narrative-list li::before {
  content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
.narrative-approach .narrative-list li::before { background: var(--blue); }
.narrative-results .narrative-list li::before { background: var(--orange); }
.narrative-impact .narrative-list li::before { background: #6ee7b7; }

.key-insight {
  margin: 0 auto; padding: 28px 32px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(52,211,153,0.12), rgba(96,165,250,0.08));
  border: 1px solid rgba(52,211,153,0.35);
  max-width: 800px; width: 100%; box-sizing: border-box;
}
.key-insight-label { text-align: center; }
.key-insight-text { text-align: left; margin: 0; }
.key-insight-label {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent); margin-bottom: 12px;
}
.key-insight-text {
  color: var(--text); font-size: 1.05rem; font-weight: 500; line-height: 1.75; margin: 0;
}
.key-insight-text strong { color: #fff; font-weight: 700; }

/* Problem Grid */
.problem-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 24px; align-items: stretch; }
.problem-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: transform .2s;
}
.problem-card:hover { transform: translateY(-4px); }
.problem-icon { color: var(--accent); margin-bottom: 14px; }
.problem-card h3 { font-size: 1.08rem; margin-bottom: 10px; color: var(--text); font-weight: 700; }
.problem-card p { color: var(--text-body); font-size: .95rem; line-height: 1.7; }
.problem-card p strong { color: var(--text); }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; justify-content: center; }
.tab {
  padding: 8px 20px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: all .2s;
}
.tab.active { background: var(--accent); color: var(--bg-900); border-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Tables */
.table-wrap { overflow-x: auto; margin-bottom: 24px; }
table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
}
th { background: var(--bg-700); color: var(--accent); font-weight: 600; text-align: left; padding: 12px 16px; white-space: nowrap; }
td { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-body); }
tr:hover td { background: rgba(52,211,153,0.04); }
.highlight-row td { background: rgba(239,68,68,0.06); }

/* Box Tags */
.box-tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; color: var(--bg-900);
}
.box-tag.s16765 { background: #34d399; }
.box-tag.b8 { background: #ef4444; }
.box-tag.s4659 { background: #60a5fa; }
.box-tag.s4478 { background: #f59e0b; }
.box-tag.s4866 { background: #a78bfa; }
.box-tag.b6 { background: #fb923c; }
.box-tag.s16766 { background: #f472b6; }

/* Formulation */
.formulation-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 20px; }
.formula-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
}
.formula-card h3 { color: var(--accent); font-size: .95rem; margin-bottom: 12px; }
.formula p { color: var(--text-body); font-size: .92rem; margin-bottom: 6px; line-height: 1.65; }
.formula p strong { color: var(--text); }
.formula-note { font-style: italic; font-size: .82rem !important; opacity: .7; }

.solver-stats { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 40px; }
.solver-stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 28px; text-align: center;
}
.solver-num { display: block; font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.solver-label { font-size: .8rem; color: var(--text-dim); }

/* Box Cards */
.box-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 14px; margin-bottom: 32px; }
.box-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center; transition: transform .2s;
}
.box-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.box-card h4 { color: var(--accent); font-size: .95rem; margin-bottom: 6px; }
.box-dims { font-size: .85rem; color: var(--text); font-weight: 600; }
.box-dw { font-size: .8rem; color: var(--text-dim); margin-bottom: 6px; }
.box-count {
  display: inline-block; background: rgba(52,211,153,0.12); color: var(--accent);
  padding: 2px 10px; border-radius: 10px; font-size: .75rem; font-weight: 600;
}

/* Analysis */
.analysis-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 20px; margin-bottom: 48px; }
.analysis-card {
  border-radius: var(--radius); padding: 28px; text-align: center;
  border: 1px solid var(--border); background: var(--card);
}
.analysis-num { display: block; font-size: 2rem; font-weight: 800; }
.analysis-label { display: block; font-size: .9rem; color: var(--text); margin-top: 4px; }
.analysis-sub { display: block; font-size: .8rem; color: var(--text-dim); margin-top: 4px; }
.analysis-card.green .analysis-num { color: var(--accent); }
.analysis-card.orange .analysis-num { color: var(--orange); }
.analysis-card.blue .analysis-num { color: var(--blue); }

/* Charts */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-section { margin-bottom: 32px; }
.chart-section h3 {
  font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text);
  text-align: center; max-width: 900px; margin-left: auto; margin-right: auto;
}
.chart-container {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative;
}
.chart-container.wide { height: 380px; }
.chart-container.medium { height: 320px; }

/* Takeaway */
.takeaway {
  background: var(--card); border: 1px solid rgba(52,211,153,0.2); border-radius: var(--radius);
  padding: 32px; margin-top: 40px;
}
.takeaway h3 { color: var(--accent); margin-bottom: 16px; font-size: 1.05rem; }
.takeaway li { color: var(--text-body); font-size: .96rem; margin-bottom: 12px; margin-left: 20px; line-height: 1.65; }
.takeaway strong { color: var(--text); font-weight: 700; }

/* Footer */
footer {
  background: var(--bg-800); padding: 28px 0; text-align: center;
  border-top: 1px solid var(--border);
}
.footer-inner p { color: var(--text-dim); font-size: .85rem; }

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .chart-row { grid-template-columns: 1fr; }
  .formulation-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 320px; }
}
