/*
 * client/styles.css -- pot-strains.com
 *
 * DESIGN BRIEF, since the visual decisions here are arguments and not taste.
 *
 * Every strain site looks the same: green gradients, leaf iconography, a photo
 * of a bud at the top of a thousand words. This one is a DECISION INSTRUMENT.
 * It should read like a spreadsheet that respects you -- dense, monospaced
 * numerals, restrained colour, no stock photography. The brand green appears
 * in the wordmark and nowhere near a data value.
 *
 * COLOUR ENCODES MAGNITUDE ONLY, NEVER CATEGORY.
 *
 * Sought effects and adverse effects are NOT distinguished by red and green.
 * Red/green is the one pairing a colour-blind reader cannot separate, and this
 * is a site where mistaking "6% anxiety" for "6% euphoria" is the whole ball
 * game. Category is carried by column grouping, an explicit heading, and a
 * '+'/'-' sign on every weight. Colour is a single-hue ramp that means "bigger
 * number", and it means that in both groups.
 *
 * Numbers are tabular-figure monospace everywhere, so digits line up in a
 * column and a reader can compare down the page without reading each one.
 */

:root {
  color-scheme: light dark;

  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f3f4f1;
  --border: #dcded8;
  --border-strong: #b9bdb3;

  --text: #16180f;
  --text-dim: #5c6154;
  --text-faint: #858a7c;

  /* Brand. Wordmark and focus rings only -- never a data value. */
  --brand: #2f7d4f;
  --brand-ink: #ffffff;

  /* The magnitude ramp. One hue, five steps, used for every rate bar in both
     the sought and adverse groups. */
  --mag-0: #eaeef3;
  --mag-1: #c6d5e6;
  --mag-2: #94b3d4;
  --mag-3: #5c8cbc;
  --mag-4: #2f6499;

  /* Confidence is a separate axis from magnitude and gets its own treatment:
     opacity and a hatch, not a hue, so it cannot be confused with the value. */
  --warn: #8a5a00;
  --warn-bg: #fdf4e3;

  --radius: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow: 0 1px 2px rgba(16, 18, 15, 0.06), 0 4px 12px rgba(16, 18, 15, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101210;
    --surface: #181b18;
    --surface-2: #1f231f;
    --border: #2c312c;
    --border-strong: #454c45;

    --text: #eef1ea;
    --text-dim: #a3aa9e;
    --text-faint: #7b8377;

    --brand: #56b37c;
    --brand-ink: #0c140f;

    --mag-0: #232a31;
    --mag-1: #2f4152;
    --mag-2: #3d5e7d;
    --mag-3: #5182ab;
    --mag-4: #74a8d2;

    --warn: #e0b060;
    --warn-bg: #2a2317;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #101210;
  --surface: #181b18;
  --surface-2: #1f231f;
  --border: #2c312c;
  --border-strong: #454c45;
  --text: #eef1ea;
  --text-dim: #a3aa9e;
  --text-faint: #7b8377;
  --brand: #56b37c;
  --brand-ink: #0c140f;
  --mag-0: #232a31;
  --mag-1: #2f4152;
  --mag-2: #3d5e7d;
  --mag-3: #5182ab;
  --mag-4: #74a8d2;
  --warn: #e0b060;
  --warn-bg: #2a2317;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }

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

.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 17px;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  white-space: nowrap;
}
.wordmark .dot { color: var(--brand); }
.nav { display: flex; gap: 16px; font-size: 14px; color: var(--text-dim); margin-left: auto; }
.nav a { text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* ------------------------------- hero ------------------------------------ */

.hero { padding: 56px 0 28px; }
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  max-width: 17ch;
}
.hero .lede { font-size: 18px; color: var(--text-dim); margin: 0 0 28px; max-width: 58ch; }

/* ----------------------------- the input box ----------------------------- */

.paste {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.paste textarea {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 16px;
  resize: vertical;
  min-height: 150px;
}
.paste textarea:focus { outline: none; }
.paste-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.paste-status { font-size: 13px; color: var(--text-dim); margin-right: auto; font-variant-numeric: tabular-nums; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.06); background: var(--brand); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 13px; font-weight: 500; }

/* --------------------------- resolution chips ---------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.chip .mark { font-family: var(--mono); font-weight: 700; color: var(--text-faint); }
.chip-ok .mark { color: var(--brand); }
.chip-ask { border-color: var(--warn); background: var(--warn-bg); }
.chip-ask .mark { color: var(--warn); }
.chip-no { border-style: dashed; color: var(--text-dim); }
.chip-was { color: var(--text-faint); font-size: 12px; }

/* ------------------------------ the table -------------------------------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table.compare { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.compare th, table.compare td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
table.compare thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-strong);
}
/* The strain name stays visible while the user scrolls sideways through
   twenty effect columns. Without this the table is unreadable past column 6. */
table.compare th.sticky-name, table.compare td.sticky-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  border-right: 1px solid var(--border);
  white-space: normal;
  min-width: 190px;
}
table.compare thead th.sticky-name { z-index: 4; background: var(--surface-2); }
table.compare tbody tr:hover td { background: var(--surface-2); }
table.compare tbody tr:hover td.sticky-name { background: var(--surface-2); }
table.compare td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.rank { font-family: var(--mono); color: var(--text-faint); font-size: 13px; }
.strain-name { font-weight: 600; }
.strain-sub { font-size: 12px; color: var(--text-dim); font-weight: 400; }

/* Group headers over the effect columns. This is how sought and adverse are
   distinguished -- structurally -- rather than by colour. */
table.compare thead tr.groups th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  background: var(--surface-2);
}
th.group-start { border-left: 1px solid var(--border-strong); }
td.group-start { border-left: 1px solid var(--border); }

/* ------------------------------- rate cell ------------------------------- */

.rate { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.rate-bar {
  width: 46px;
  height: 7px;
  border-radius: 2px;
  background: var(--mag-0);
  overflow: hidden;
  flex: none;
}
.rate-bar i { display: block; height: 100%; background: var(--mag-3); }
.rate-val { font-family: var(--mono); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.rate-n { font-size: 11px; color: var(--text-faint); font-family: var(--mono); min-width: 46px; text-align: right; }

/* Thin evidence is shown by DESATURATING the bar and hatching it, never by
   hiding the row. A hidden row is indistinguishable from a strain that does
   not exist. */
.rate.thin .rate-bar i {
  background: repeating-linear-gradient(135deg, var(--mag-2) 0 3px, var(--mag-0) 3px 6px);
}
.rate.thin .rate-val { color: var(--text-dim); }
.rate.none .rate-val { color: var(--text-faint); font-style: italic; }

/* ------------------------------ preferences ------------------------------ */

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h2 { font-size: 14px; margin: 0 0 4px; letter-spacing: -0.01em; }
.panel .hint { font-size: 12.5px; color: var(--text-dim); margin: 0 0 14px; }

.pref-group { margin-bottom: 18px; }
.pref-group > h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 8px;
  font-weight: 600;
}
.pref {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.pref label { font-size: 13.5px; }
.pref-weight { display: flex; gap: 2px; }
.pref-weight button {
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px;
}
.pref-weight button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}
.pref-weight button:hover { border-color: var(--border-strong); }

/* ----------------------------- explanation ------------------------------- */

.why { margin-top: 20px; }
.why table { width: 100%; border-collapse: collapse; font-size: 13px; }
.why td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.why td.math { font-family: var(--mono); font-size: 12px; color: var(--text-dim); text-align: right; white-space: nowrap; }
.why tr.total td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--border-strong); }

details.why-details > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 0;
  list-style: revert;
}
details.why-details > summary:hover { color: var(--text); }

/* ------------------------------- notices --------------------------------- */

.notice {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  margin: 20px 0;
}
.notice h2 { font-size: 15px; margin: 0 0 6px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.notice code { font-family: var(--mono); font-size: 12.5px; background: var(--surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-dim); }
.empty-state h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }

/* -------------------------------- prose ---------------------------------- */

.prose { font-size: 16.5px; line-height: 1.68; }
.prose h2 { font-size: 22px; letter-spacing: -0.02em; margin: 40px 0 10px; }
.prose h3 { font-size: 17px; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose li { margin-bottom: 6px; }
.prose code {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.prose .formula {
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  overflow-x: auto;
  margin: 18px 0;
}
.prose blockquote {
  margin: 18px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--brand);
  color: var(--text-dim);
}

/* -------------------------------- footer --------------------------------- */

.site-foot {
  margin-top: 64px;
  border-top: 1px solid var(--border);
  padding: 28px 0 48px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.site-foot .cols { display: flex; gap: 40px; flex-wrap: wrap; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
.site-foot .disclaimer { margin-top: 22px; max-width: 70ch; font-size: 12.5px; color: var(--text-faint); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media print {
  .masthead, .nav, .panel, .site-foot, .paste-foot { display: none; }
  .layout { grid-template-columns: 1fr; }
  table.compare { font-size: 10px; }
  .table-scroll { overflow: visible; border: 0; }
}

/* ---------------------------- chemistry cell ----------------------------- */

/*
 * The range bar. Each cell plots one strain against the corpus: the track
 * spans roughly +/- 2.5 between-strain standard deviations around a typical
 * strain, the solid span is that strain's middle 80% of lab results, and the
 * tick is its median.
 *
 * This is the site's whole argument rendered as 46 pixels. Every other strain
 * page prints "THC 19%" as a property of the plant; the span shows that the
 * same name ran 14% to 22% across real results. Colour carries magnitude only
 * -- position and width carry the meaning, so the cell survives being read in
 * greyscale or by someone who cannot separate the hues.
 */
.chem-bar {
  position: relative;
  width: 54px;
  height: 9px;
  border-radius: 2px;
  background: var(--mag-0);
  flex: none;
  overflow: hidden;
}
.chem-bar .chem-span {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--mag-2);
  border-radius: 1px;
}
.chem-bar .chem-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--mag-4);
}

/* Thin evidence is hatched, never hidden: a hidden row is indistinguishable
   from a strain that does not exist. */
.chem-bar.thin .chem-span {
  background: repeating-linear-gradient(135deg, var(--mag-2) 0 3px, var(--mag-0) 3px 6px);
}
.chem-bar.thin .chem-tick { background: var(--mag-3); }

/* A slug whose lab rows pool more than one cultivar. */
.strain-flag {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  cursor: help;
}

/* The more/less direction toggle. Chemistry always needs one: "low THC" is as
   common a request as "high THC". */
.pref-weight button.dir {
  width: auto;
  padding: 0 7px;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-left: 3px;
}

/* --------------------------- rendered pages ------------------------------ */

.crumbs { font-size: 13px; color: var(--text-dim); margin: 22px 0 10px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.strain-title {
  font-size: clamp(26px, 4.5vw, 36px);
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}

.muted { color: var(--text-faint); }

table.chem-table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
table.chem-table th, table.chem-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.chem-table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.chem-table td.num, table.chem-table th.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.chem-table tbody tr:hover { background: var(--surface-2); }

/*
 * Lineage confidence. Rendered as a WORD, never as a colour alone -- most of
 * this data is "disputed" and a reader who cannot separate the hues would
 * otherwise read marketing folklore as established fact.
 */
.conf {
  display: inline-block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.conf-corroborated { border-color: var(--brand); color: var(--brand); }
.conf-disputed { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

ul.sources { list-style: none; padding: 0; font-size: 14px; }
ul.sources li { padding: 7px 0; border-bottom: 1px solid var(--border); }

/* ------------------------------ the logo --------------------------------- */

/*
 * Rendered at 28px tall from a 4x source, so it stays sharp on a retina
 * screen. width/height attributes are on the <img> to reserve the space before
 * it loads -- without them the nav jumps sideways on every first paint.
 *
 * The dark-mode swap is a <picture> source rather than a CSS filter: the
 * magnifier ring is #03622d and would vanish on the dark background, but a
 * brightness filter strong enough to rescue it would blow out the pale green
 * bars. pipeline/make_brand.py lifts only the already-dark pixels instead.
 */
.wordmark img.logo {
  display: block;
  height: 28px;
  width: auto;
}
.wordmark { gap: 0; }

/* --------------------------- the report form ----------------------------- */

.report {
  margin-top: 48px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.report h2 { margin-top: 0; }
.report fieldset { border: 0; padding: 0; margin: 0 0 20px; }
.report legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0;
  margin-bottom: 8px;
}
.ticks { display: flex; flex-wrap: wrap; gap: 7px; }
.tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  user-select: none;
}
.tick:hover { border-color: var(--border-strong); }
.tick input { margin: 0; accent-color: var(--brand); }
/* Checked state carries a border and a background, not colour alone. */
.tick:has(input:checked) {
  border-color: var(--brand);
  background: var(--surface);
  font-weight: 600;
}

.report select {
  font: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

/*
 * The honeypot. Hidden from people, left in the DOM for naive bots to fill.
 *
 * Positioned off-canvas rather than display:none -- some bots skip fields that
 * are display:none precisely because it is the obvious tell. aria-hidden and a
 * negative tabindex keep it away from screen readers and the keyboard, so a
 * person using either is never asked to fill in a trap.
 */
.report .hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.report-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.report-msg { font-size: 13.5px; color: var(--text-dim); }
.report-privacy { margin-top: 16px; max-width: 62ch; }

/* ------------------------- scope switcher -------------------------------- */

.scope-picker { border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.mode-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
/* The selected mode carries a fill AND aria-pressed, never colour alone. */
.mode-row .btn.on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

.scope {
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--surface);
}
.scope p { margin: 0 0 6px; font-size: 14.5px; }
.scope p:last-child { margin-bottom: 0; }
.scope .strain-sub { font-size: 13px; }

.more-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.or-all { margin-top: 18px; font-size: 14.5px; color: var(--text-dim); }
.or-all a { color: var(--text); }
