/* Cobalt Recipe Check. Styles are scoped under .co except the body background
   and the colour tokens on :root. */

:root {
  --co-bg: #f4f6fa;
  --co-surface: #ffffff;
  --co-surface-2: #eef1f7;
  --co-ink: #141a2b;
  --co-ink-soft: #4a5370;
  --co-ink-faint: #7d86a3;
  --co-rule: #d8dded;
  --co-accent: #1f47c9;          /* cobalt blue */
  --co-accent-ink: #ffffff;
  --co-accent-soft: #e3e9fb;
  --co-focus: #f2a516;
  --co-band-none: #1f8a70;
  --co-band-low: #5b8f1e;
  --co-band-mid: #c27c0e;
  --co-band-high: #c0392b;
  --co-band-none-soft: #dcf1ea;
  --co-band-low-soft: #e7f1d6;
  --co-band-mid-soft: #f8ebd2;
  --co-band-high-soft: #f8dcd8;
  --co-warn-bg: #fff4d6;
  --co-warn-ink: #6b4a00;
  --co-shadow: 0 1px 2px rgba(20, 26, 43, .06), 0 6px 20px rgba(20, 26, 43, .06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --co-bg: #0e1220;
    --co-surface: #161b2d;
    --co-surface-2: #1d2338;
    --co-ink: #e6e9f5;
    --co-ink-soft: #aab1cc;
    --co-ink-faint: #7a82a0;
    --co-rule: #2b3350;
    --co-accent: #7d9bff;
    --co-accent-ink: #0b1020;
    --co-accent-soft: #232d52;
    --co-band-none: #4cc9a4;
    --co-band-low: #9bcc5a;
    --co-band-mid: #f0b44c;
    --co-band-high: #ff7b6b;
    --co-band-none-soft: #15362e;
    --co-band-low-soft: #263419;
    --co-band-mid-soft: #3a2c12;
    --co-band-high-soft: #3e1d1a;
    --co-warn-bg: #3a2f10;
    --co-warn-ink: #f5d98a;
    --co-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  --co-bg: #0e1220; --co-surface: #161b2d; --co-surface-2: #1d2338; --co-ink: #e6e9f5; --co-ink-soft: #aab1cc;
  --co-ink-faint: #7a82a0; --co-rule: #2b3350; --co-accent: #7d9bff; --co-accent-ink: #0b1020; --co-accent-soft: #232d52;
  --co-band-none: #4cc9a4; --co-band-low: #9bcc5a; --co-band-mid: #f0b44c; --co-band-high: #ff7b6b;
  --co-band-none-soft: #15362e; --co-band-low-soft: #263419; --co-band-mid-soft: #3a2c12; --co-band-high-soft: #3e1d1a;
  --co-warn-bg: #3a2f10; --co-warn-ink: #f5d98a;
}

body {
  margin: 0;
  background: var(--co-bg);
  color: var(--co-ink);
}

.co, .co * { box-sizing: border-box; }
.co {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--co-ink);
}
.co a { color: var(--co-accent); }
.co code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .9em; }
.co :focus-visible { outline: 3px solid var(--co-focus); outline-offset: 2px; }

/* ---- masthead */
.co-masthead { display: flex; gap: 24px; align-items: center; margin-bottom: 28px; }
.co h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -.02em; font-weight: 700; }
.co-lede { margin: 0; color: var(--co-ink-soft); max-width: 60ch; }
.co-element {
  flex: none;
  width: 92px; height: 92px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: 7px 9px;
  background: var(--co-accent);
  color: var(--co-accent-ink);
  border-radius: 6px;
  font-family: "IBM Plex Mono", monospace;
  box-shadow: var(--co-shadow);
}
.co-element-num { font-size: 12px; line-height: 1; }
.co-element-sym { font-size: 34px; font-weight: 600; line-height: 1; align-self: center; font-family: "IBM Plex Sans", sans-serif; }
.co-element-name { font-size: 10px; line-height: 1.2; }
.co-element-mass { font-size: 9px; line-height: 1.2; opacity: .8; }

/* ---- input panel */
.co-panel {
  background: var(--co-surface);
  border: 1px solid var(--co-rule);
  border-radius: 10px;
  box-shadow: var(--co-shadow);
  overflow: hidden;
}
.co-tabs { display: flex; border-bottom: 1px solid var(--co-rule); background: var(--co-surface-2); overflow-x: auto; }
.co-tabs button {
  flex: none;
  font: inherit; font-weight: 500; font-size: 15px;
  padding: 12px 18px;
  border: 0; background: none; color: var(--co-ink-soft);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.co-tabs button[aria-selected="true"] { color: var(--co-ink); border-bottom-color: var(--co-accent); background: var(--co-surface); }
.co-pane { padding: 20px; }
.co-pane > p:first-child { margin-top: 0; }
.co-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.co-grow { flex: 1 1 260px; min-width: 0; }
.co-narrow { flex: 0 0 110px; }
.co label { display: block; }
.co-label { display: block; font-size: 13px; font-weight: 600; color: var(--co-ink-soft); margin-bottom: 5px; letter-spacing: .01em; }
.co input[type="url"], .co input[type="text"], .co input[type="number"], .co textarea, .co select {
  width: 100%;
  font: inherit;
  color: var(--co-ink);
  background: var(--co-bg);
  border: 1px solid var(--co-rule);
  border-radius: 6px;
  padding: 10px 12px;
}
.co textarea { resize: vertical; font-family: "IBM Plex Mono", monospace; font-size: 14px; line-height: 1.5; }
.co #pane-paste textarea { margin-bottom: 12px; }
.co-hint { font-size: 14px; color: var(--co-ink-faint); margin: 12px 0 0; }
.co-button {
  font: inherit; font-weight: 600;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--co-accent);
  background: var(--co-accent);
  color: var(--co-accent-ink);
  cursor: pointer;
  white-space: nowrap;
}
.co-button:hover { filter: brightness(1.08); }
.co-button[disabled] { opacity: .6; cursor: progress; }
.co-button-quiet { background: transparent; color: var(--co-accent); }
.co-mark-wrap { text-align: center; margin: 22px 0; }
.co-bookmarklet {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px dashed var(--co-accent);
  background: var(--co-accent-soft);
  font-weight: 600;
  text-decoration: none;
  cursor: grab;
}
.co-details { margin-top: 12px; font-size: 14px; }
.co-details summary { cursor: pointer; color: var(--co-ink-soft); }
.co-details textarea { margin-top: 8px; font-size: 12px; }

.co-status { min-height: 1.5em; margin: 16px 2px; color: var(--co-ink-soft); }
.co-status.is-error { color: var(--co-band-high); font-weight: 500; }

/* ---- results */
.co-results { margin-top: 8px; }
.co-recipe-head { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.co-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--co-ink-faint); }
.co h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; margin: 2px 0 2px; overflow-wrap: anywhere; }
.co-source { margin: 0; font-size: 14px; color: var(--co-ink-faint); overflow-wrap: anywhere; }
.co-servings { flex: none; }
.co-stepper { display: inline-flex; border: 1px solid var(--co-rule); border-radius: 6px; overflow: hidden; background: var(--co-surface); }
.co-stepper button { font: inherit; font-size: 18px; width: 38px; border: 0; background: var(--co-surface-2); color: var(--co-ink); cursor: pointer; }
.co-stepper input[type="number"] { width: 64px; border: 0; border-radius: 0; text-align: center; background: var(--co-surface); -moz-appearance: textfield; appearance: textfield; }
.co-stepper input::-webkit-outer-spin-button, .co-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.co-warn { background: var(--co-warn-bg); color: var(--co-warn-ink); padding: 8px 12px; border-radius: 6px; font-size: 14px; margin: 0 0 14px; }
.co-servings input.is-guess { background: var(--co-warn-bg); }

.co-scorecard {
  --band: var(--co-band-none);
  --band-soft: var(--co-band-none-soft);
  display: flex; gap: 24px; align-items: center;
  background: var(--co-surface);
  border: 1px solid var(--co-rule);
  border-left: 6px solid var(--band);
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: var(--co-shadow);
}
.co-scorecard[data-band="low"] { --band: var(--co-band-low); --band-soft: var(--co-band-low-soft); }
.co-scorecard[data-band="mid"] { --band: var(--co-band-mid); --band-soft: var(--co-band-mid-soft); }
.co-scorecard[data-band="high"] { --band: var(--co-band-high); --band-soft: var(--co-band-high-soft); }
.co-dial {
  flex: none;
  width: 116px; height: 116px;
  border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: var(--band-soft);
  border: 6px solid var(--band);
  color: var(--band);
}
.co-dial-num { font-family: "IBM Plex Mono", monospace; font-size: 44px; font-weight: 600; line-height: 1; }
.co-dial-unit { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; margin-top: 4px; }
.co-score-text { flex: 1; min-width: 0; }
.co-band { margin: 0; font-size: 24px; font-weight: 700; color: var(--band); }
.co-amount { margin: 2px 0; font-size: 17px; }
.co-amount span { font-family: "IBM Plex Mono", monospace; font-weight: 600; }
.co-range { margin: 0 0 12px; font-size: 14px; color: var(--co-ink-soft); }
.co-scale { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr 1.6fr; gap: 3px; max-width: 420px; padding-top: 10px; }
.co-scale span { font-size: 11px; font-weight: 600; text-align: center; padding: 3px 0; border-radius: 3px; color: #fff; }
.co-scale span[data-band="none"], .co-legend b[data-band="none"] { background: var(--co-band-none); }
.co-scale span[data-band="low"], .co-legend b[data-band="low"] { background: var(--co-band-low); }
.co-scale span[data-band="mid"], .co-legend b[data-band="mid"] { background: var(--co-band-mid); }
.co-scale span[data-band="high"], .co-legend b[data-band="high"] { background: var(--co-band-high); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .co-scale span, :root:not([data-theme="light"]) .co-legend b { color: #0b1020; } }
:root[data-theme="dark"] .co-scale span, :root[data-theme="dark"] .co-legend b { color: #0b1020; }
.co-scale i {
  position: absolute; top: 0; left: 0;
  width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--co-ink);
  transform: translateX(-6px);
  transition: left .3s ease;
}

.co-coverage { font-size: 14px; color: var(--co-ink-soft); margin: 16px 2px 10px; }
.co-coverage b { color: var(--co-ink); }

/* ---- ingredient table */
.co-table { background: var(--co-surface); border: 1px solid var(--co-rule); border-radius: 10px; overflow: hidden; }
.co-tr {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr) 128px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--co-rule);
}
.co-th { border-top: 0; background: var(--co-surface-2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--co-ink-faint); padding-top: 9px; padding-bottom: 9px; }
.co-tr.is-heading { display: block; background: var(--co-surface-2); font-weight: 600; font-size: 14px; color: var(--co-ink-soft); padding: 8px 16px; }
.co-tr.is-attention { background: linear-gradient(90deg, var(--co-warn-bg), transparent 60%); }
.co-tr.is-top .co-ng { font-weight: 700; }
.co-line { margin: 0; overflow-wrap: anywhere; }
.co-how { margin: 2px 0 0; font-size: 12.5px; color: var(--co-ink-faint); font-family: "IBM Plex Mono", monospace; overflow-wrap: anywhere; }
.co-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.co-tag { font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--co-surface-2); color: var(--co-ink-soft); border: 1px solid var(--co-rule); }
.co-tag.is-warn { background: var(--co-warn-bg); color: var(--co-warn-ink); border-color: transparent; }
.co-tr select { padding: 7px 8px; font-size: 14px; }
.co-food-meta { margin: 3px 0 0; font-size: 12.5px; color: var(--co-ink-faint); }
.co .co-grams { display: flex; align-items: center; gap: 6px; }
.co-grams input[type="number"] { padding: 7px 8px; font-size: 14px; font-family: "IBM Plex Mono", monospace; text-align: right; }
.co-grams span { font-size: 13px; color: var(--co-ink-faint); }
.co-ng { font-family: "IBM Plex Mono", monospace; font-size: 14px; margin: 0 0 4px; white-space: nowrap; }
.co-bar { height: 6px; background: var(--co-surface-2); border-radius: 3px; overflow: hidden; }
.co-bar i { display: block; height: 100%; background: var(--co-accent); border-radius: 3px; min-width: 0; transition: width .25s ease; }

.co-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- about */
.co-about { margin-top: 40px; border-top: 1px solid var(--co-rule); padding-top: 12px; }
.co-about > details { border-bottom: 1px solid var(--co-rule); padding: 10px 2px; }
.co-about summary { cursor: pointer; font-weight: 600; font-size: 17px; }
.co-about p, .co-about li { color: var(--co-ink-soft); max-width: 72ch; }
.co-legend { list-style: none; padding: 0; }
.co-legend li { margin: 6px 0; }
.co-legend b { display: inline-block; min-width: 34px; text-align: center; border-radius: 4px; color: #fff; font-family: "IBM Plex Mono", monospace; font-size: 13px; padding: 1px 6px; margin-right: 8px; }
.co-sources { font-size: 13px; padding-left: 22px; max-height: 360px; overflow: auto; }
.co-sources li { margin: 4px 0; overflow-wrap: anywhere; }
.co-footer { margin-top: 32px; font-size: 15px; }

/* ---- narrow screens */
@media (max-width: 760px) {
  .co { padding: 24px 16px 48px; }
  .co-masthead { gap: 16px; align-items: flex-start; }
  .co-element { width: 68px; height: 68px; padding: 5px 7px; }
  .co-element-sym { font-size: 24px; }
  .co-element-name, .co-element-mass { display: none; }
  .co-pane { padding: 16px; }
  .co-row .co-button { width: 100%; }
  .co-narrow { flex: 1 1 110px; }
  .co-scorecard { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px; }
  .co-dial { width: 96px; height: 96px; }
  .co-dial-num { font-size: 36px; }
  .co-th { display: none; }
  .co-tr { grid-template-columns: 1fr 120px; gap: 8px 12px; }
  .co-tr > .co-c-line { grid-column: 1 / -1; }
  .co-tr > .co-c-food { grid-column: 1 / -1; }
  .co-tr > .co-c-grams { grid-column: 2; grid-row: 3; }
  .co-tr > .co-c-ng { grid-column: 1; grid-row: 3; }
}
