/*
  Embedded calculators on tools.nooroots.com (tools-site/build.py). One card,
  as tall as its content, so the host page's iframe fits it. Colours are the
  theme's palette, copied in from assets/nr-base.css at build time; the dark
  look is ?theme=dark.
*/
:root{--nr-teal: 38, 122, 133;--nr-teal-dark: 31, 104, 113;--nr-teal-light: 124, 195, 203;--nr-ink: 53, 81, 85;--nr-ink-soft: 59, 82, 85;--nr-slate: 78, 96, 99;--nr-muted: 93, 116, 120;--nr-mist: 212, 228, 231;--nr-mist-light: 243, 248, 249;--nr-cream: 254, 243, 226;--nr-deep: 6, 47, 56;--nr-amber: 255, 178, 44;--nr-amber-dark: 242, 161, 31;--nr-star: 255, 173, 0;--nr-star-empty: 217, 217, 217;--nr-strike: 138, 143, 152;--nr-ice: 244, 251, 252;--nr-frost: 228, 238, 240;--nr-paper: 247, 248, 248;--nr-grey: 75, 85, 99;--nr-black: 25, 25, 25;--nr-green: 47, 125, 74;--nr-green-dark: 37, 97, 59;--nr-gold: 216, 154, 0;--nr-gold-dark: 197, 138, 0;--nr-review-star: 245, 166, 35;--nr-red: 212, 0, 0;--nr-grey-mid: 119, 119, 119;--nr-night: 31, 51, 54;--nr-night-mid: 41, 70, 75;--nr-night-deep: 18, 29, 31;--nr-shadow: 6, 12, 13;--nr-deep-dark: 2, 42, 51;--nr-mist-pale: 219, 234, 236;--nr-sea: 95, 142, 150;--nr-pine: 31, 63, 67;--nr-pine-soft: 40, 80, 85;--nr-sage: 79, 104, 108;--nr-sage-light: 111, 138, 143;--nr-stone: 107, 113, 115;--nr-linen: 236, 233, 213;--nr-linen-light: 250, 250, 244;--nr-pool-light: 238, 245, 246;--nr-cobalt: 10, 63, 156;--nr-muted-soft: 102, 123, 127;--nr-muted-light: 109, 130, 134;--nr-charcoal: 79, 79, 79;--nr-grey-light: 188, 196, 203;--nr-cloud: 233, 236, 239;--nr-graphite: 51, 51, 51;--nr-graphite-light: 85, 85, 85;--nr-grey-soft: 112, 112, 112;--nr-grey-pale: 154, 154, 154;--nr-silver: 184, 184, 184;--nr-trustpilot: 0, 182, 122;--nr-trustpilot-dark: 0, 81, 40;--nr-trustpilot-empty: 220, 220, 230;--nr-oat: 246, 240, 231;--nr-butter: 255, 246, 216;--nr-straw: 217, 197, 111;--nr-olive: 182, 161, 75;--nr-mist-soft: 217, 229, 229;--nr-ice-light: 248, 252, 252;--nr-chalk: 247, 247, 245;--nr-chalk-light: 251, 251, 248;--nr-ink-deep: 20, 32, 31;--nr-basalt: 61, 72, 71;--nr-pewter: 102, 112, 111;--nr-pebble: 163, 170, 168;--nr-lagoon: 31, 122, 128;--nr-lagoon-dark: 20, 90, 95;--nr-lagoon-soft: 241, 246, 246;--nr-lagoon-pale: 238, 245, 245;--nr-fog: 220, 223, 221;--nr-fog-dark: 201, 207, 205;--nr-fog-mid: 213, 218, 216;--nr-fog-light: 235, 237, 235;--nr-fog-pale: 238, 241, 240;--nr-error: 180, 35, 24;--nr-error-soft: 254, 243, 242;--nr-error-line: 244, 199, 195;--nr-note: 255, 247, 230;--nr-note-line: 243, 217, 164;--nr-honey: 211, 156, 67;--nr-umber: 61, 56, 51;--nr-umber-text: 81, 76, 71;--nr-umber-muted: 117, 111, 104;--nr-sand: 237, 214, 177;--nr-sand-light: 255, 248, 238;--nr-mustard: 173, 156, 55;--nr-taupe: 110, 107, 100;--nr-leaf: 76, 175, 80;--nr-leaf-dark: 46, 125, 50;--nr-leaf-pale: 246, 251, 248;--nr-sky: 166, 214, 251;--nr-wall: 214, 205, 196;--nr-field: 247, 247, 234;--nr-stem: 179, 209, 212;--nr-root-faint: 156, 195, 201;--nr-honey-dark: 138, 90, 18;--nr-alert: 163, 0, 0;--nr-alert-soft: 253, 236, 236;--nr-teal-40: 168, 202, 206;}

:root {
  --c-card: 255, 255, 255;
  --c-heading: var(--nr-deep);
  --c-text: var(--nr-ink-soft);
  --c-muted: var(--nr-muted);
  --c-accent: var(--nr-teal);
  --c-accent-dark: var(--nr-teal-dark);
  --c-line: var(--nr-mist);
  --c-panel: var(--nr-mist-light);
  --c-warning: var(--nr-alert);
}

:root[data-theme='dark'] {
  --c-card: var(--nr-night);
  --c-heading: 255, 255, 255;
  --c-text: var(--nr-mist);
  --c-muted: var(--nr-teal-40);
  --c-accent: var(--nr-teal-40);
  --c-accent-dark: var(--nr-mist);
  --c-line: var(--nr-night-mid);
  --c-panel: var(--nr-night-deep);
  --c-warning: var(--nr-alert-soft);
}

/* Set on the card, not the page: a dark color-scheme on the page itself
   makes browsers paint the iframe's background solid, square corners and all. */
:root[data-theme='dark'] .nt {
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: transparent;
}

body {
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: rgb(var(--c-text));
  -webkit-text-size-adjust: 100%;
}

.nt {
  padding: 20px;
  background: rgb(var(--c-card));
  border: 1px solid rgb(var(--c-line));
  border-radius: 12px;
}

.nt__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.nt__title {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  color: rgb(var(--c-heading));
}

.nt__info {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid rgb(var(--c-line));
  border-radius: 999px;
  background: transparent;
  color: rgb(var(--c-accent));
  font: italic 700 15px/1 Georgia, serif;
  cursor: pointer;
}

.nt__info[aria-expanded='true'] {
  background: rgb(var(--c-panel));
}

.nt__info-text {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: rgb(var(--c-panel));
  font-size: 14px;
  color: rgb(var(--c-text));
}

.nt__question {
  margin: 4px 0 16px;
  color: rgb(var(--c-muted));
  font-size: 15px;
}

/* Fields */
.nt__field {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgb(var(--c-line));
  border-radius: 8px;
  background: rgb(var(--c-card));
  color: rgb(var(--c-heading));
  font: inherit;
}

.nt__field:focus-visible,
.nt button:focus-visible,
.nt a:focus-visible,
.nt input:focus-visible + span {
  outline: 2px solid rgb(var(--c-accent));
  outline-offset: 2px;
}

.nt__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: rgb(var(--c-heading));
}

.nt__label legend {
  padding: 0;
  margin-bottom: 4px;
}

.nt__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 12px;
}

.nt__wide {
  grid-column: 1 / -1;
}

.nt__wide[hidden] {
  display: none;
}

/* Two choices as pills */
.nt__pills {
  display: flex;
  gap: 8px;
}

.nt__pills label {
  flex: 1;
  position: relative;
}

.nt__pills input {
  position: absolute;
  opacity: 0;
}

.nt__pills span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgb(var(--c-line));
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.nt__pills input:checked + span {
  border-color: rgb(var(--c-heading));
  background: rgb(var(--c-heading));
  color: rgb(var(--c-card));
}

/* Caffeine: one row per drink */
.nt__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.nt__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nt__drink {
  flex: 1;
  min-width: 0;
}

.nt__count {
  display: flex;
  align-items: center;
  flex: none;
}

.nt__number {
  width: 44px;
  padding: 8px 2px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.nt__number::-webkit-inner-spin-button,
.nt__number::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.nt__step,
.nt__remove {
  width: 36px;
  height: 44px;
  border: 0;
  background: transparent;
  color: rgb(var(--c-accent));
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.nt__remove {
  color: rgb(var(--c-muted));
}

.nt__add {
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: rgb(var(--c-accent));
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.nt__add[hidden] {
  display: none;
}

.nt__check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 15px;
}

.nt__check input {
  width: 18px;
  height: 18px;
  accent-color: rgb(var(--c-accent));
}

/* The verdict */
.nt__verdict {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgb(var(--c-panel));
}

.nt__big {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.nt__big-number {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: rgb(var(--c-heading));
}

.nt__big-label {
  font-size: 15px;
  color: rgb(var(--c-muted));
}

.nt__meter {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgb(var(--c-line));
  overflow: hidden;
}

.nt__meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgb(var(--c-accent));
}

.nt__meter--over span {
  background: rgb(var(--c-warning));
}

.nt__notes {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 15px;
}

.nt__notes .is-warning {
  color: rgb(var(--c-warning));
  font-weight: 600;
}

/* Powered by Nooroots: the words muted, the brand name the link. */
.nt__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 0;
  color: rgb(var(--c-muted));
  font-size: 14px;
}

.nt__leaf {
  color: rgb(var(--c-accent));
}

.nt__foot a {
  color: rgb(var(--c-accent));
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nt__foot a:hover {
  color: rgb(var(--c-accent-dark));
}

/* Narrow cards: each drink's name gets the full width, with how many and
   remove under it. */
@media (max-width: 459px) {
  .nt__row {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .nt__drink {
    flex: 1 1 100%;
  }

  .nt__remove {
    margin-left: auto;
  }

  .nt__rows {
    gap: 16px;
  }
}

@media (max-width: 300px) {
  .nt {
    padding: 16px;
  }

  .nt__grid {
    grid-template-columns: 1fr;
  }
}
