/* CRVE calculator styling.
   Multi-finding: each finding is a card with six 1..5 axis rows and a
   per-finding result strip. A composite panel sits below the list.
   Uses pageBase CSS variables for structural colors; the GYR severity
   gradient is supplied per element via the inline --crve-hue variable
   (JS computes it continuously: green=120 .. red=0).
*/

.crve-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));

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

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

/* ---------------------------------------------------- intro */

.crve-intro h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.crve-intro-help {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--gallery-stats, #595959);
}

/* ---------------------------------------------------- findings list */

.crve-findings {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.crve-finding {
  border: 1px solid var(--border-subtle, silver);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: var(--surface, #fff);
}

.crve-finding-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.crve-finding-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.4rem 0.55rem;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 5px;
}

.crve-finding-remove {
  width: 2rem;
  height: 2rem;
  border-radius: 5px;
  border: 1px solid var(--border-subtle, silver);
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.crve-finding-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.crve-finding-remove:hover:not(:disabled) {
  background: var(--table-shaded-row, #eaeaea);
}

/* ---------------------------------------------------- per-finding form */

.crve-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crve-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding: 0.6rem 0.1rem;
  border-top: 1px solid var(--border-subtle, silver);
}
.crve-row:first-child { border-top: none; padding-top: 0.1rem; }

.crve-row-head { display: flex; flex-direction: column; gap: 0.2rem; }

.crve-row-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--body-text, #333);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.crve-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;
}

.crve-row-help {
  font-size: 0.83rem;
  color: var(--gallery-stats, #595959);
  margin: 0;
}

.crve-row-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.crve-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.35rem;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  font-family: inherit;
  text-align: center;
  min-height: 3.1rem;
}
.crve-level:hover {
  background: var(--table-shaded-row, #eaeaea);
  border-color: var(--body-text, #333);
}
.crve-level.is-active {
  background: var(--link-color, #4B52D8);
  color: #fff;
  border-color: var(--link-color, #4B52D8);
}
.crve-level.is-active .crve-level-label { color: #fff; opacity: 0.92; }

.crve-level-n {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}
.crve-level-label {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--gallery-stats, #595959);
}

/* ---------------------------------------------------- per-row result strip */

.crve-row-result {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-subtle, silver);
  min-height: 2.4rem;
}

.crve-row-result-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.crve-row-result-num {
  grid-row: 1 / span 2;
  font-size: 1.7rem;
  font-weight: 700;
  font-family: Menlo, monospace;
  color: hsl(var(--crve-hue, 120) var(--crve-sat) var(--crve-lt));
  transition: color 180ms ease;
  line-height: 1;
}
.crve-row-result-unit {
  font-size: 0.95rem;
  font-weight: 600;
  margin-left: 0.1rem;
}

.crve-row-result-bar {
  grid-row: 1;
  height: 6px;
  background: var(--table-shaded-row, #eaeaea);
  border-radius: 3px;
  overflow: hidden;
}
.crve-row-result-bar > div {
  height: 100%;
  transition: width 180ms ease, background 180ms ease;
  background: hsl(var(--crve-hue, 120) var(--crve-sat) var(--crve-lt));
}

.crve-row-result-meta {
  grid-row: 2;
  display: flex;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--gallery-stats, #595959);
  flex-wrap: wrap;
}
.crve-row-result-meta strong {
  color: var(--body-text, #333);
  margin-right: 0.2rem;
}

.crve-row-status {
  font-size: 0.85rem;
  color: var(--gallery-stats, #595959);
  font-style: italic;
}
.crve-row-error {
  color: hsl(0 70% 45%);
  font-style: normal;
}

/* ---------------------------------------------------- add button */

.crve-add {
  margin: 0.85rem 0 1.25rem;
  padding: 0.55rem 1rem;
  background: var(--surface, #fff);
  color: var(--link-color, #4B52D8);
  border: 1px dashed var(--link-color, #4B52D8);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 120ms ease;
}
.crve-add:hover {
  background: var(--table-shaded-row, #eaeaea);
}

/* ---------------------------------------------------- composite */

.crve-composite {
  border-top: 2px solid var(--border-subtle, silver);
  padding-top: 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.crve-composite h3 {
  margin: 0;
  font-size: 1.05rem;
}

.crve-composite-empty,
.crve-composite-status {
  font-size: 0.9rem;
  color: var(--gallery-stats, #595959);
  font-style: italic;
}
.crve-composite-error {
  color: hsl(0 70% 45%);
  font-style: normal;
}

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

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

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

@media (max-width: 600px) {
  .crve-row-buttons { grid-template-columns: repeat(5, 1fr); gap: 0.2rem; }
  .crve-level { padding: 0.4rem 0.2rem; min-height: 2.8rem; }
  .crve-level-label { font-size: 0.65rem; }
  .crve-composite-big { font-size: 2.2rem; }
  .crve-row-result-num { font-size: 1.4rem; }
  .crve-row-result-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .crve-row-result-num { grid-row: 1; grid-column: 1; }
  .crve-row-result-bar { grid-row: 2; grid-column: 1; }
  .crve-row-result-meta { grid-row: 3; grid-column: 1; }
}
