/* grade-select.css */

:root {
  --bg: #fafaf8;
  --ink: #111111;
  --mid: #555555;
  --faint: #ddddd8;
  --accent: #2a5c3f;
}

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

body {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
}

/* ===== NAV ===== */

nav {
  padding: 20px 32px;
  border-bottom: 1px solid var(--faint);
  max-width: 1000px;
  margin: 0 auto;
}

.back-link {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--ink);
}

/* ===== PAGE WRAPPER ===== */

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 32px;
}

.page-title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0;
}

/* ===== SECTIONS ===== */

section {
  padding: 48px 0;
  border-bottom: 1px solid var(--faint);
}

section:last-of-type {
  border-bottom: none;
}

.section-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
}

/* ===== SAVINGS COMPARISON ===== */

.savings-comparison {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--faint);
}

.savings-strategy {
  padding: 24px;
  text-align: center;
  border-right: 1px solid var(--faint);
}

.savings-strategy:last-child {
  border-right: none;
}

.savings-strategy.optimal {
  background: white;
}

.savings-strategy-name {
  font-size: 17px;
  color: var(--mid);
  margin-bottom: 12px;
}

.cost-per-million {
  font-family: 'Source Code Pro', monospace;
  font-size: 28px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 4px;
}

.cost-per-plant {
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  color: var(--mid);
}

/* ===== PARAMETERS GRID ===== */

.calc-parameters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

/* ===== INPUT GROUPS ===== */

.calc-input-group {
  margin-bottom: 24px;
}

.calc-input-group:last-child {
  margin-bottom: 0;
}

.calc-input-group label {
  display: block;
  font-size: 17px;
  color: var(--mid);
  margin-bottom: 4px;
}

.calc-slider {
  width: 100%;
  height: 2px;
  background: var(--faint);
  border: none;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  margin: 10px 0 4px;
  display: block;
}

.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.calc-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.calc-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--faint);
  padding: 6px 0;
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  color: var(--ink);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.calc-input:focus {
  border-color: var(--accent);
}

/* ===== STRATEGY RESULTS ===== */

/* The JS generates its own h3/p header inside .calc-optimization-benefits —
   suppress it since we already have a section-label above */
.calc-benefits-header {
  display: none;
}

.strategy-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--faint);
}

.strategy-card {
  padding: 24px;
  border-right: 1px solid var(--faint);
}

.strategy-card:last-child {
  border-right: none;
}

.strategy-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--faint);
}

.strategy-header h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.optimal-badge {
  display: none;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  margin-bottom: 20px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-label {
  font-size: 14px;
  color: var(--mid);
  line-height: 1.3;
}

.metric-value {
  font-family: 'Source Code Pro', monospace;
  font-size: 24px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
}

/* ===== CYCLE FLOW ===== */

.cycle-flow-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--faint);
}

.cycle-flow-header {
  font-size: 17px;
  font-weight: 600;
  color: var(--mid);
  margin-bottom: 8px;
}

.cycle-table {
  width: 100%;
  border-collapse: collapse;
}

.cycle-table th,
.cycle-table td {
  padding: 5px 12px 5px 0;
  text-align: left;
  border-bottom: 1px solid var(--faint);
  font-size: 17px;
}

.cycle-table th:first-child,
.cycle-table td:first-child {
  padding-right: 20px;
}

.cycle-table th:last-child,
.cycle-table td:last-child {
  padding-right: 0;
}

.cycle-table th {
  font-weight: 600;
  color: var(--mid);
}

.cycle-table td {
  color: var(--ink);
  font-family: 'Source Code Pro', monospace;
}

/* ===== LOADING / ERROR ===== */

.calc-loading,
.calc-error {
  padding: 24px;
  color: var(--mid);
  font-size: 14px;
}

/* ===== ASSUMPTIONS ===== */

.assumptions {
  font-size: 17px;
  color: var(--ink);
  line-height: 1.75;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 800px) {
  nav {
    padding: 16px 20px;
  }

  .page {
    padding: 32px 20px;
  }

  .calc-parameters-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .calc-parameters-row .calc-parameter-group {
    padding-top: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--faint);
  }

  .calc-parameters-row .calc-parameter-group:last-child {
    border-bottom: none;
  }

  .savings-comparison,
  .strategy-cards {
    grid-template-columns: 1fr;
  }

  .savings-strategy,
  .strategy-card {
    border-right: none;
    border-bottom: 1px solid var(--faint);
  }

  .savings-strategy:last-child,
  .strategy-card:last-child {
    border-bottom: none;
  }

  .strategy-metrics {
    grid-template-columns: 1fr 1fr;
  }
}
