/* Talos Energy USV / SCSSV barrier test.
   Laid out to match the Wolfram Cloud page this replaces. */

:root {
  --sheet-bg: #e4e4e4;
  --panel-bg: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #555555;
  --rule: #1a1a1a;
  --field-border: #b9b9b9;
  --header-fill: #ededed;
  --button-face: #b8b8b8;
  --button-face-hover: #a9a9a9;
  --pass: #0b7a29;
  --fail: #b3261e;
  --pass-fill: #d8f0dd;
  --fail-fill: #fadcd9;
  --na-ink: #7a7a7a;
  --focus: #2f6fdb;
}

* { box-sizing: border-box; }

html { background: var(--sheet-bg); }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--sheet-bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sheet {
  max-width: 1150px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- header */

.sheet-header {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(200px, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 28px;
}

.sheet-header h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.operator {
  margin: 0 0 10px;
  font-size: 15px;
}

.header-middle {
  padding-top: 26px;
  text-align: center;
}

.header-middle h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.brand {
  display: block;
  width: 250px;
  height: auto;
  /* The supplied logo is a white-background JPEG; multiply drops the white
     into the sheet so it does not read as a pasted-on rectangle. */
  mix-blend-mode: multiply;
}

.print-button {
  min-width: 130px;
  padding: 6px 14px;
  border: 1px solid #8f8f8f;
  border-radius: 7px;
  background: #fdfdfd;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.print-button:hover { background: #f0f0f0; }

.asset-row label { width: auto; margin-right: 12px; }
.asset-row select { width: 150px; }

/* --------------------------------------------------------------- columns */

.columns {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 420px);
  gap: 32px;
  align-items: start;
}

.inputs h3 {
  margin: 22px 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.inputs h3:first-child { margin-top: 0; }

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.field-row label {
  flex: 0 0 250px;
  font-size: 15px;
}

.field-row input,
.field-row select {
  flex: 0 0 240px;
  padding: 7px 10px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--ink);
  font: inherit;
}

.field-row input[type="number"] { flex-basis: 170px; }
.field-row input[type="datetime-local"] { flex-basis: 250px; }

.field-row input[readonly] {
  background: var(--panel-bg);
  color: var(--ink-soft);
}

.field-row input:focus,
.field-row select:focus,
textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}

.field-row .unit {
  font-size: 15px;
  color: var(--ink);
}

.error {
  margin: 14px 0 0;
  padding: 8px 12px;
  border-left: 4px solid var(--fail);
  background: #fdecea;
  color: #7c1d17;
  font-size: 14px;
}

/* ------------------------------------------------------------- schematic */

.schematic-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.schematic {
  width: 100%;
  margin: 0;
  padding: 6px;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  background: var(--panel-bg);
}

.schematic img {
  display: block;
  width: 100%;
  height: auto;
}

.run-button {
  min-width: 150px;
  padding: 16px 26px;
  border: 1px solid #8f8f8f;
  border-radius: 8px;
  background: var(--button-face);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.run-button:hover { background: var(--button-face-hover); }
.run-button[disabled] { opacity: 0.6; cursor: progress; }

/* --------------------------------------------------------------- results */

.results, .additional, .remarks { margin-top: 34px; }

.results h2, .additional h2, .remarks h2 {
  margin: 0 0 14px;
  font-size: 25px;
  font-weight: 700;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--rule);
  background: var(--sheet-bg);
  font-size: 15px;
}

.results-table th,
.results-table td {
  padding: 10px 14px;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: middle;
}

.results-table thead th {
  background: var(--header-fill);
  font-weight: 700;
}

.results-table tbody td:nth-child(1) { width: 25%; }
.results-table tbody td:nth-child(2) { width: 25%; }
.results-table tbody td:nth-child(3) { width: 25%; }

/* Each leak-rate row is filled light green when the rate is applicable and
   inside its BSEE limit, light red when applicable and over it.  A rate the
   fluid's phase rules out gets no fill at all -- just grey text reading "NA".
   The Overall Outcome cell sits in the first row of the table body, so these
   row rules never touch it. */
.results-table tbody tr.rate-pass td {
  background: var(--pass-fill);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.results-table tbody tr.rate-fail td {
  background: var(--fail-fill);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.results-table tbody tr.rate-fail td.rate-value {
  font-weight: 700;
}

.results-table tbody tr.rate-na td {
  color: var(--na-ink);
}

.results-table tbody tr.rate-na td.rate-value {
  font-style: italic;
}

.outcome {
  width: 25%;
  text-align: center;
  font-weight: 700;
}

.outcome.pass { color: var(--pass); }
.outcome.fail { color: var(--fail); }
.outcome .verdict { display: block; font-size: 26px; letter-spacing: 1px; }
.outcome .verdict-note { display: block; margin-top: 6px; font-weight: 400; color: var(--ink); }

/* ------------------------------------------------------------ additional */

.additional-body {
  display: grid;
  grid-template-columns: minmax(340px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}

.additional dl {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 10px 16px;
  margin: 0;
}

.additional dt { margin: 0; }
.additional dd { margin: 0; }

.note {
  margin: 66px 0 0;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 14px;
}

/* --------------------------------------------------------------- remarks */

textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

/* -------------------------------------------------------------- narrower */

@media screen and (max-width: 900px) {
  .sheet-header { grid-template-columns: 1fr; }
  .header-middle { padding-top: 0; text-align: left; }
  .header-right { align-items: flex-start; }
  .columns { grid-template-columns: 1fr; }
  .field-row { flex-wrap: wrap; }
  .field-row label { flex-basis: 100%; }
  .additional-body { grid-template-columns: 1fr; }
  .additional dl { grid-template-columns: 1fr; gap: 2px 0; }
  .additional dd { margin-bottom: 8px; font-weight: 600; }
  .note { margin-top: 8px; }
}

/* ----------------------------------------------------------------- print */

@page { size: letter portrait; margin: 12mm; }

@media print {
  :root { --sheet-bg: #ffffff; }

  body { padding: 0; background: #fff; font-size: 9.5pt; }
  .sheet { max-width: none; }
  .print-button, .run-button { display: none; }

  /* Keep the on-screen two-column arrangement; a letter page is narrow, so
     everything is scaled down rather than stacked. */
  .sheet-header {
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    margin-bottom: 12px;
  }
  .sheet-header h1 { font-size: 17pt; }
  .operator { margin-bottom: 4px; }
  .header-middle { grid-row: 2; grid-column: 1; padding-top: 0; text-align: left; }
  .header-middle h2 { font-size: 13pt; }
  .header-right { grid-row: 1 / span 2; grid-column: 2; justify-content: flex-start; }
  .brand { width: 160px; }
  .asset-row select { width: 110px; }

  .columns { grid-template-columns: 1fr 250px; gap: 14px; }

  .inputs h3 { margin: 10px 0 6px; font-size: 10pt; }
  .field-row { margin-bottom: 4px; gap: 6px; }
  .field-row label { flex-basis: 185px; }
  .field-row input,
  .field-row select { flex-basis: 125px; padding: 3px 6px; }
  .field-row input[type="number"] { flex-basis: 80px; }
  .field-row input[type="datetime-local"] { flex-basis: 140px; }

  .schematic { padding: 2px; border-color: #666; }

  .results, .additional, .remarks { margin-top: 14px; break-inside: avoid; }
  .results h2, .additional h2, .remarks h2 { font-size: 13pt; margin-bottom: 6px; }
  .results-table { background: #fff; font-size: 9pt; }
  .results-table th, .results-table td { padding: 4px 7px; }
  .results-table thead th {
    background: #ededed;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .outcome .verdict { font-size: 15pt; }

  .additional-body { grid-template-columns: 1fr 1fr; gap: 14px; }
  .additional dl { grid-template-columns: 190px 1fr; gap: 4px 10px; }
  .note { margin-top: 30px; }

  /* Form controls have to print their value, not their chrome. */
  select, input, textarea {
    border-color: #999;
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    color: #000;
  }
  input[readonly] { color: #000; }
  textarea { min-height: 70px; }
  .error[hidden] { display: none; }
}
