/*
  Design cornerstones: Japandi, with a spark.
  - Surfaces: sand and creme, always (no dark theme). Warm, never pure white or black.
  - Ink: earthy umber and taupe for text and the primary action. Calm, not colourful.
  - Electric: one cobalt accent, used sparingly for focus, selection, progress and live data.
  - Earth: clay and moss for status, never as decoration.
  - Type: quiet system sans for reading; small uppercase mono for labels and numbers (the tech layer).
  - Shape: hairline borders, small radii, no heavy shadows, generous space.
*/
:root {
  /* surfaces */
  --bg: #ece2d0;          /* sand */
  --card: #f7f0e3;        /* creme */
  --sunken: #e3d6c0;      /* dune */
  --border: #d8c9b0;      /* hairline */
  /* earth ink */
  --text: #3d2e22;        /* umber */
  --muted: #6f5a47;       /* taupe */
  --ink: #3d2e22;
  --ink-text: #f7f0e3;
  /* electric */
  --accent: #2f4bf0;      /* cobalt spark */
  --accent-text: #ffffff;
  --accent-soft: rgba(47, 75, 240, 0.12);
  /* earth, for status */
  --error-bg: #f3dfd5;
  --error-text: #8a3a1e;  /* clay */
  --warn-bg: #efe6cf;
  --warn-text: #6a5420;   /* ochre */
  --ok-text: #4f6b3c;     /* moss */

  /* type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* space: 4 8 12 16 24 32 48 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-pop: 0 10px 30px rgba(61, 46, 34, 0.14);

  color-scheme: light;  /* always sand and creme, whatever the system theme */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  padding: 0 var(--s4) var(--s7);
  -webkit-font-smoothing: antialiased;
}

header.top, main {
  max-width: 1200px;
  margin: 0 auto;
}

header.top { padding: var(--s6) 0 var(--s3); }
h1 { font-size: 1.6rem; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 var(--s3); }

a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* The tech layer: small uppercase mono labels. */
.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  margin: var(--s4) 0;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 1px dashed var(--muted);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  background: var(--sunken);
}
.dropzone.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s4);
}

.slider { display: flex; flex-direction: column; gap: var(--s1); min-width: 240px; flex: 1; }
.slider input { width: 100%; accent-color: var(--accent); }

/* Primary action is ink, not colour; the accent marks focus. */
button {
  background: var(--ink);
  color: var(--ink-text);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 20px;
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}
button:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--accent-soft); }
button:disabled { opacity: 0.4; cursor: default; }

.alert {
  border-radius: var(--radius);
  padding: var(--s3) var(--s4);
  margin: var(--s4) 0;
  white-space: pre-line;
}
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }

.images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s4);
}
figure { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s2); }
figure img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
figcaption { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s4);
}

.scroll { max-height: 360px; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--card);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--font-mono); font-size: 0.88rem; }

.chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: var(--s2);
  vertical-align: 0;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
  header.top { padding-top: var(--s5); }
  .card { padding: var(--s4); }
  .slider { min-width: 0; width: 100%; }
  #run { width: 100%; }   /* dev upload page */
}
