/*
 * Design direction: instrument panel, not web app.
 *
 * This tool's whole output is numbers with units — temperatures, flow ratios, mm/s. So
 * the type system is monospace-forward: tabular figures line up in columns, and a value
 * reads as a measurement rather than as prose. The accent is drawn from a hotend at
 * temperature (a molten orange), used ONLY for the primary action and for error state,
 * so it always means "heat" or "attention" and never decoration.
 *
 * No webfonts, on purpose. A stealth-mode app should not make requests to a font CDN —
 * that leaks the hostname to a third party on every page load. System stacks only.
 */

:root {
  --paper: #f4f1ec; /* warm off-white; pure white reads clinical under shop lighting */
  --paper-sunk: #ebe6df;
  --ink: #1c1a18;
  --ink-soft: #625c55;
  --rule: #d6cfc5;
  --molten: #c8451d; /* hotend at temperature */
  --molten-soft: #f6e4dd;
  --amber: #9a6b12; /* warnings: advice, not failure */
  --amber-soft: #f8efd9;
  --good: #2f6b46;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 3px; /* nearly square: machined, not rounded */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161512;
    --paper-sunk: #1f1d19;
    --ink: #eae5dd;
    --ink-soft: #9b938a;
    --rule: #33302a;
    --molten: #f0693c;
    --molten-soft: #35190f;
    --amber: #d9a13a;
    --amber-soft: #2c2311;
    --good: #6bbd8b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* --- masthead --------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.wordmark h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* A nozzle at temperature: the app's only ornament, and it carries the accent. */
.wordmark__nozzle {
  width: 10px;
  height: 14px;
  background: var(--molten);
  clip-path: polygon(0 0, 100% 0, 100% 58%, 50% 100%, 0 58%);
}

/* --- layout ----------------------------------------------------------------- */

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.panel {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--paper);
}

.panel h2 {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.panel--gate,
.panel--warn {
  max-width: 30rem;
  margin: 3rem auto;
  text-align: center;
}

.panel--warn {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.muted {
  color: var(--ink-soft);
  margin: 0.35rem 0 1rem;
}

/* --- form ------------------------------------------------------------------- */

.field {
  display: block;
  border: 0;
  padding: 0;
  margin: 0 0 1.1rem;
}

.field__label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.field__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.input,
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.input:focus,
select:focus,
.btn:focus-visible {
  outline: 2px solid var(--molten);
  outline-offset: 1px;
}

.input--area {
  resize: vertical;
  line-height: 1.5;
}

/* Segmented control: three input modes, one visibly active. */
.segmented {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.segmented__item {
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  cursor: pointer;
}

.segmented__item:last-child {
  border-right: 0;
}

.segmented__item.is-active {
  color: var(--paper);
  background: var(--ink);
}

/* --- buttons ---------------------------------------------------------------- */

.btn {
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink-soft);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  color: #fff;
  background: var(--molten);
  border-color: var(--molten);
}

.btn--quiet {
  background: transparent;
}

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

.result__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.result__head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.tag {
  flex: none;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
}

/* An inferred profile is a starting point, not a datasheet. Say so visually. */
.tag--inferred {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-soft);
}

.tag--datasheet {
  color: var(--good);
  border-color: var(--good);
}

/* Values as a datasheet table: label left, figure right, aligned on the digits. */
.values {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  margin: 0 0 1.2rem;
  font-variant-numeric: tabular-nums;
}

.values dt,
.values dd {
  margin: 0;
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--rule);
}

.values dt {
  color: var(--ink-soft);
}

.values dd {
  text-align: right;
  font-weight: 600;
}

.issues {
  margin: 0 0 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.issue {
  padding: 0.6rem 0.75rem;
  border-left: 3px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
}

.issue--error {
  border-color: var(--molten);
  background: var(--molten-soft);
}

.issue--warning {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.issue__field {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status {
  min-height: 1.4em;
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.status--error {
  color: var(--molten);
}

/* --- saved list ------------------------------------------------------------- */

.saved {
  display: grid;
  gap: 0.5rem;
}

.saved__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dotted var(--rule);
}

.saved__meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
