/* =========================================================
   RQD Calculator - page-specific styles.

   Loaded after css/style.css and deliberately does NOT redeclare the palette:
   --bg, --accent, --ink, --muted, --border, --radius, --ease and the font
   stacks all come from the site stylesheet, so this page cannot drift away
   from the rest of michaelcarnie.com.

   Everything is scoped under .rqd so the form, table and panel rules cannot
   leak into the other pages.
   ========================================================= */

.rqd {
  /* Overlay convention, kept from the DataRocks RQD reference so a geotech
     reading both tools sees the same colours mean the same things. Lifted in
     luminance to survive the dark background. */
  --counted: #6f8dff;
  --rejected: #e58fe5;
  --rubble: #9aa0a8;

  --warn: #f0c674;
  --warnbg: rgba(240, 198, 116, 0.1);

  --font-mono: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;
}

/* ===================== STEPS ===================== */

.rqd-step + .rqd-step { margin-top: clamp(2rem, 4.5vw, 3rem); }

.rqd .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 2.6vw, 1.4rem);
  transition: border-color 0.25s var(--ease);
}
.rqd .panel:hover { border-color: var(--border-strong); }

.rqd .hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.7rem; max-width: 62ch; }

.rqd .formula {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.rqd .privacy {
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--sand);
  max-width: 62ch;
  /* Clears the first step below it; without this the two sat flush together. */
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

/* ===================== CONTROLS ===================== */

.rqd .inputs { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* A file input styled as a .btn. The input covers the label so the whole pill
   is the hit target, which also keeps it keyboard-reachable. */
.rqd .filebtn { position: relative; overflow: hidden; display: inline-flex; cursor: pointer; }
.rqd .filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.rqd .btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-strong);
}
.rqd .btn--ghost:hover { background: transparent; border-color: var(--accent); }

.rqd button.btn { border: 1px solid var(--accent); cursor: pointer; font: inherit; }
.rqd button.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rqd button.btn:disabled:hover { background: var(--accent); }
.rqd button.btn--ghost { border-color: var(--border-strong); }

.rqd .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 0.9rem;
}

.rqd .field {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.rqd input[type="number"],
.rqd select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-transform: none;
  letter-spacing: normal;
}
.rqd input[type="number"]:focus,
.rqd select:focus { outline: none; border-color: var(--accent); }

/* No spinner arrows. They are a fiddly target on a phone and they invite
   nudging a depth by one step when it should be typed. */
.rqd input[type="number"]::-webkit-outer-spin-button,
.rqd input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rqd input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.rqd select option { background: var(--bg); color: var(--ink); }

.rqd .filelist { list-style: none; margin-top: 0.9rem; font-size: 0.88rem; }
.rqd .filelist li {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
}
.rqd .filelist li:first-child { border-top: 0; }
.rqd .filelist li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

.rqd .status { margin-top: 0.9rem; font-size: 0.88rem; color: var(--muted); min-height: 1.4em; }

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

/* Two independent readings of the same photographs. Each column owns its own
   pieces and RQD; only the detector differs between them. */
.rqd .compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.rqd .variant {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rqd .variant__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.rqd .variant__title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }

.rqd .variant__badge {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
}
.rqd .variant__badge.ready { color: var(--accent); border-color: rgba(169, 221, 186, 0.4); }
.rqd .variant__badge.pending { color: var(--warn); border-color: rgba(240, 198, 116, 0.4); }

.rqd .variant__source { padding: 0.6rem 1.1rem 0; font-size: 0.78rem; color: var(--muted); }
.rqd .variant__body { padding: 0.85rem 1.1rem 1.1rem; }

/* Shown instead of a result when a column has no model behind it yet. */
.rqd .variant__empty { padding: 1.6rem 1.1rem; text-align: center; color: var(--muted); font-size: 0.86rem; }
.rqd .variant__empty strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--sand);
  font-family: var(--font-display);
}

.rqd .headline {
  display: flex;
  gap: 1.3rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.8rem;
}
.rqd .headline div { min-width: 5.5rem; }
.rqd .headline .cap {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.rqd .headline .big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.rqd .headline .big.small { font-size: 1.1rem; }

/* ===================== TABLE ===================== */

.rqd table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.rqd th,
.rqd td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); }
.rqd th {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.rqd td { font-variant-numeric: tabular-nums; color: var(--sand); }
.rqd tr:last-child td { border-bottom: 0; }

/* ===================== WARNINGS, LEGEND, OVERLAYS ===================== */

.rqd .warning {
  margin-top: 0.9rem;
  padding: 0.7rem 0.95rem;
  background: var(--warnbg);
  border: 1px solid rgba(240, 198, 116, 0.3);
  border-left: 2px solid var(--warn);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--sand);
}
.rqd .warning strong { color: var(--warn); font-family: var(--font-display); }
.rqd .warning ul { margin: 0.4rem 0 0 1.1rem; }
.rqd .warning li { margin-top: 0.2rem; }

.rqd .legend {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.rqd .chip {
  width: 1.3rem;
  height: 0.65rem;
  border-radius: 2px;
  display: inline-block;
  margin-left: 0.6rem;
}
.rqd .chip:first-child { margin-left: 0; }
.rqd .counted { background: var(--counted); }
.rqd .rejected { background: var(--rejected); }
.rqd .rubble { background: var(--rubble); }

/* Targeted by id, not class. The container is `id="shots"` and carries no
   `shots` class, so a `.shots canvas` rule silently never matched and the
   canvases rendered at their full intrinsic width -- several thousand pixels --
   overflowing the page to the right. */
.rqd #shots { margin-top: 1rem; }
.rqd #shots > div + div { margin-top: 1.5rem; }

.rqd #shots canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0.5rem 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.rqd #shots .caption { font-size: 0.78rem; color: var(--muted); margin-bottom: 0; }
.rqd #shots .variant__title { font-size: 0.92rem; }

.rqd .hidden { display: none; }

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

@media (max-width: 820px) {
  .rqd .compare { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .rqd .headline { gap: 0.9rem; }
  .rqd .headline .big { font-size: 1.5rem; }
  }
