/* SCEP calculator styling. Parallels crve.css — uses pageBase CSS
   variables for structural colours, and a continuous HSL gradient for
   the residual-exposure readout driven by --scep-hue. */

.scep-wrap {
  max-width: 960px;
  margin: 1.25rem auto 2rem;
  padding: 1.25rem;
  background: var(--rollup-bg, #fff);
  color: var(--body-text, #333);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 8px;
  box-shadow: 0 1px 2px var(--shadow-color, rgba(0, 0, 0, 0.08));

  --scep-sat: 65%;
  --scep-lt:  38%;
}

@media (prefers-color-scheme: dark) {
  .scep-wrap {
    --scep-sat: 70%;
    --scep-lt:  58%;
  }
}

/* ---------------------------------------------------- initial exposure */

.scep-exposure {
  padding: 0.75rem 0.25rem 1rem;
  border-bottom: 1px solid var(--border-subtle, silver);
  margin-bottom: 0.75rem;
}
.scep-exposure-head { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.5rem; }
.scep-exposure-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.scep-exposure-controls input[type="range"] {
  flex: 1;
}
.scep-exposure-value {
  min-width: 3.5rem;
  text-align: right;
  font-family: Menlo, monospace;
  font-weight: 600;
  color: var(--body-text, #333);
}

/* ---------------------------------------------------- rows */

.scep-rows { display: flex; flex-direction: column; gap: 0.6rem; }
.scep-rows-header h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.scep-rows-help { margin: 0 0 0.35rem; font-size: 0.83rem; color: var(--gallery-stats, #595959); }

.scep-row {
  padding: 0.65rem 0.75rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.scep-row-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.scep-row-type {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle, silver);
  border-radius: 4px;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  font-family: inherit;
  font-size: 0.95rem;
}
.scep-row-remove {
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border-subtle, silver);
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  border-radius: 4px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.scep-row-remove:hover {
  background: var(--table-shaded-row, #eaeaea);
  border-color: var(--body-text, #333);
}

.scep-row-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--body-text, #333);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.scep-row-key {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.1rem 0.4rem;
  text-align: center;
  font-size: 0.8rem;
  font-family: Menlo, monospace;
  background: var(--link-color, #4B52D8);
  color: #fff;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.scep-row-help { font-size: 0.83rem; color: var(--gallery-stats, #595959); margin: 0; }

.scep-row-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.75rem;
  align-items: center;
}
.scep-slider-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--body-text, #333);
}
.scep-slider-range {
  font-weight: 400;
  color: var(--gallery-stats, #595959);
  font-size: 0.8rem;
}
.scep-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.scep-slider { flex: 1; }
.scep-slider-value {
  min-width: 3.2rem;
  text-align: right;
  font-family: Menlo, monospace;
  font-weight: 600;
  color: var(--body-text, #333);
}

.scep-note-label {
  font-size: 0.85rem;
  color: var(--body-text, #333);
}
.scep-required { color: #b33; font-weight: 600; }
.scep-note {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle, silver);
  border-radius: 4px;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  font-family: inherit;
  font-size: 0.9rem;
}

.scep-add {
  margin-top: 0.35rem;
  padding: 0.5rem 0.85rem;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  border: 1px dashed var(--border-subtle, silver);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 120ms ease, border-color 120ms ease;
}
.scep-add:hover {
  background: var(--table-shaded-row, #eaeaea);
  border-color: var(--body-text, #333);
}

/* ---------------------------------------------------- result panel */

.scep-result {
  border-top: 2px solid var(--border-subtle, silver);
  padding-top: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.scep-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.scep-result-big {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  font-family: Menlo, monospace;
  color: hsl(var(--scep-hue, 120) var(--scep-sat) var(--scep-lt));
  transition: color 180ms ease;
}
.scep-result-unit { font-size: 1.5rem; font-weight: 600; margin-left: 0.15rem; }
.scep-result-sub {
  font-size: 0.85rem;
  color: var(--gallery-stats, #595959);
  text-align: right;
  line-height: 1.3;
}

.scep-result-bar {
  height: 8px;
  background: var(--table-shaded-row, #eaeaea);
  border-radius: 4px;
  overflow: hidden;
}
.scep-result-bar-fill {
  height: 100%;
  transition: width 180ms ease, background 180ms ease;
  border-radius: 4px;
  background: hsl(var(--scep-hue, 120) var(--scep-sat) var(--scep-lt));
}

.scep-result-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  font-size: 0.84rem;
}
.scep-result-breakdown > div {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  background: var(--table-shaded-row, #eaeaea);
  border-radius: 4px;
}
.scep-result-k { color: var(--body-text, #333); }
.scep-result-v {
  font-family: Menlo, monospace;
  font-weight: 600;
  color: var(--body-text, #333);
}

/* ---------------------------------------------------- contribution table */

.scep-contrib-wrap { margin-top: 0.25rem; }
.scep-contrib-wrap h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.scep-contrib-help { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--gallery-stats, #595959); }

.scep-contrib {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.scep-contrib th, .scep-contrib td {
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--border-subtle, silver);
  text-align: left;
}
.scep-contrib th {
  background: var(--table-shaded-row, #eaeaea);
  font-weight: 600;
  color: var(--body-text, #333);
}
.scep-contrib-num { text-align: right; font-family: Menlo, monospace; }

/* ---------------------------------------------------- narrow screens */

@media (max-width: 600px) {
  .scep-row-body { grid-template-columns: 1fr; }
  .scep-slider-wrap { width: 100%; }
  .scep-result-big { font-size: 2.2rem; }
  .scep-contrib th:nth-child(4), .scep-contrib td:nth-child(4) { display: none; }
}
