/* Free browser tools (/free-tools/): the workbench (form + live label), the allergen checker and the hub list.
   Loaded after styles.css and editorial.css; uses their tokens only (paper, ink, cobalt, rules, type scale). */

.ft-hero {
  padding-block: var(--s-6) var(--s-7);
}

.ft-hero h1 {
  max-width: 22ch;
  margin-bottom: var(--s-4);
  font-family: var(--font-head);
  font-size: var(--fs-h1);
}

.ft-hero .mast-sub {
  max-width: 60ch;
}

.ft-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-5) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.ft-meta li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.ft-meta li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cobalt);
}

/* ---------- Workbench: inputs left, the label right ---------- */

.ft-bench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
  margin-top: var(--s-6);
}

@media (min-width: 1000px) {
  .ft-bench {
    grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
    gap: var(--s-7);
  }

  .ft-stage {
    position: sticky;
    top: calc(var(--header-h) + var(--s-4));
  }
}

.ft-panel {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--card);
}

.ft-panel > fieldset {
  margin: 0;
  padding: var(--s-5);
  border: 0;
  border-top: 1px solid var(--line);
}

.ft-panel > fieldset:first-child {
  border-top: 0;
}

.ft-panel legend {
  float: left;
  width: 100%;
  margin-bottom: var(--s-3);
  padding: 0;
  font-family: var(--font-head);
  font-size: var(--fs-md);
  font-weight: 600;
}

.ft-panel legend + * {
  clear: left;
}

.ft-hint {
  margin: 0 0 var(--s-3);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.ft-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ft-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem;
  gap: var(--s-3);
  align-items: center;
  padding-block: 6px;
  border-top: 1px solid var(--line);
}

.ft-row:first-child {
  border-top: 0;
}

.ft-row > label {
  font-weight: 600;
}

.ft-row.is-sub > label {
  position: relative;
  padding-left: var(--s-5);
  font-weight: 400;
}

.ft-row.is-sub > label::before {
  content: "";
  position: absolute;
  top: -6px;
  bottom: 50%;
  left: 8px;
  width: 10px;
  border-bottom: 1px solid var(--line-2);
  border-left: 1px solid var(--line-2);
}

.ft-row small {
  display: block;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 400;
}

.ft-num {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.ft-num:focus-within {
  border-color: var(--cobalt);
  outline: 2px solid color-mix(in srgb, var(--cobalt) 30%, transparent);
}

.ft-num input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ft-num input:focus {
  outline: none;
}

.ft-num input[aria-invalid] {
  background: color-mix(in srgb, #c62828 8%, var(--white));
}

.ft-num span {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  padding: 0 8px;
  border-left: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.ft-energy {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  background: var(--tint);
  font-variant-numeric: tabular-nums;
}

.ft-energy strong {
  font-weight: 600;
}

.ft-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--s-4);
}

.ft-field {
  display: grid;
  gap: 6px;
}

.ft-field > span,
.ft-field > label {
  font-weight: 600;
}

.ft-field select,
.ft-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
}

.ft-check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-weight: 400;
}

.ft-check input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.ft-radios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
}

.ft-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--fs-sm);
}

.ft-inline .ft-num {
  width: 9.5rem;
}

.ft-warn {
  margin: 0;
  padding: var(--s-3) var(--s-4) var(--s-3) var(--s-6);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, #c77700 9%, var(--white));
  color: var(--ink);
  font-size: var(--fs-sm);
}

/* The label sits on a paper "bench", like a pack proof. */
.ft-stage {
  display: grid;
  gap: var(--s-4);
  min-width: 0;
}

.ft-stage > *,
.ft-panel {
  min-width: 0;
}

.ft-proof {
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--paper-2), var(--paper-2)) padding-box,
    var(--paper-2);
}

.ft-proof-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  color: var(--ink-2);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.ft-label {
  overflow-x: auto;
  padding: var(--s-4);
  background: var(--white);
  box-shadow: 0 1px 2px rgb(var(--navy-rgb) / 0.08), 0 18px 36px -24px rgb(var(--navy-rgb) / 0.45);
  color: #000;
}

.ft-label table {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.ft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.ft-actions .btn {
  flex: 1 1 auto;
}

.ft-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.ft-aside {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* ---------- Allergen checker ---------- */

.ft-textarea {
  min-height: 12rem;
  padding: var(--s-4);
  line-height: 1.55;
  resize: vertical;
}

.ac-output {
  min-height: 8rem;
  padding: var(--s-4) var(--s-5);
  background: var(--white);
  box-shadow: 0 1px 2px rgb(var(--navy-rgb) / 0.08), 0 18px 36px -24px rgb(var(--navy-rgb) / 0.45);
  color: #000;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ac-output strong {
  font-weight: 800;
}

.ac-empty {
  color: var(--ink-3);
}

.ac-count {
  font-variant-numeric: tabular-nums;
}

.ac-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
  counter-reset: allergen;
}

@media (min-width: 560px) {
  .ac-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s-5);
  }
}

.ac-list li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  padding-block: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--fs-sm);
  counter-increment: allergen;
}

.ac-list li::before {
  content: counter(allergen);
  font-variant-numeric: tabular-nums;
}

.ac-list li.is-found {
  color: var(--ink);
}

.ac-list li.is-found::before {
  content: "✓";
  color: var(--cobalt);
  font-weight: 700;
}

.ac-list .ac-name {
  font-weight: 500;
}

.ac-list .is-found .ac-name {
  font-weight: 700;
}

.ac-words {
  grid-column: 2;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.ac-notes {
  margin: 0;
  padding: var(--s-3) var(--s-4) var(--s-3) var(--s-6);
  border-left: 3px solid var(--cobalt);
  background: var(--tint);
  font-size: var(--fs-sm);
}

.ac-notes li + li {
  margin-top: 4px;
}

.ft-caution {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-3);
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid color-mix(in srgb, #c77700 45%, var(--white));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, #c77700 8%, var(--white));
  font-size: var(--fs-sm);
}

.ft-caution::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #8a5200;
  color: var(--white);
  font-weight: 700;
}

/* ---------- Reference tables in the explanations ---------- */

.ft-ref {
  width: 100%;
  margin-block: var(--s-4) var(--s-5);
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.ft-ref caption {
  margin-bottom: var(--s-2);
  color: var(--ink-2);
  text-align: left;
}

.ft-ref th,
.ft-ref td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.ft-ref thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
}

.ft-ref td.num {
  text-align: right;
  white-space: nowrap;
}

.ft-sum {
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-left: 3px solid var(--cobalt);
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

.ft-cite {
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* ---------- The app hand-off: ink band with a mock product page ---------- */

.ft-handoff {
  display: grid;
  gap: var(--s-6);
  align-items: center;
}

@media (min-width: 900px) {
  .ft-handoff {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: var(--s-8);
  }
}

.ft-handoff h2 {
  margin-bottom: var(--s-4);
  font-family: var(--font-head);
}

.ft-handoff p {
  color: var(--on-dark-2);
}

.ft-handoff ul {
  margin: var(--s-4) 0 var(--s-5);
  padding-left: 1.2em;
  color: var(--on-dark-2);
}

.ft-handoff li + li {
  margin-top: 6px;
}

.ft-mock {
  padding: var(--s-5);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-dark);
  font-size: var(--fs-sm);
}

.ft-mock-title {
  margin: 0 0 2px;
  font-family: var(--font-head);
  font-size: var(--fs-md);
  font-weight: 600;
}

.ft-mock-price {
  margin: 0 0 var(--s-4);
  color: var(--ink-2);
}

.ft-mock details {
  border-top: 1px solid var(--line);
}

.ft-mock summary {
  padding: 10px 0;
  font-weight: 600;
  cursor: default;
  list-style: none;
}

.ft-mock p,
.ft-mock table {
  margin: 0 0 var(--s-3);
  color: var(--ink);
}

.ft-mock table {
  width: 100%;
  border-collapse: collapse;
}

.ft-mock td,
.ft-mock th {
  padding: 4px 0;
  border-top: 1px solid var(--line);
  text-align: left;
  font-weight: 400;
}

.ft-mock td {
  text-align: right;
}

.ft-mock figcaption {
  margin-top: var(--s-3);
  color: var(--ink-3);
  font-size: 0.75rem;
}

/* ---------- Hub: an index of tools, not a card wall ---------- */

.ft-index {
  margin: var(--s-7) 0 0;
  padding: 0;
  border-top: 2px solid var(--ink);
  list-style: none;
}

.ft-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  padding-block: var(--s-6);
  border-bottom: 1px solid var(--line-2);
}

@media (min-width: 900px) {
  .ft-tool {
    grid-template-columns: 3rem minmax(0, 6fr) minmax(0, 5fr);
    gap: var(--s-6);
    align-items: start;
  }
}

.ft-tool-no {
  color: var(--ink-3);
  font-family: var(--font-head);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
}

.ft-tool h2 {
  margin-bottom: var(--s-3);
  font-family: var(--font-head);
  font-size: var(--fs-xl);
}

.ft-tool h2 a {
  color: inherit;
  text-decoration: none;
}

.ft-tool h2 a:hover {
  color: var(--cobalt);
}

.ft-tool p {
  max-width: 56ch;
  color: var(--ink-2);
}

.ft-tool .ft-for {
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.ft-glimpse {
  margin: 0;
  padding: var(--s-4);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}

.ft-glimpse > div {
  padding: var(--s-3) var(--s-4);
  background: var(--white);
  box-shadow: 0 1px 2px rgb(var(--navy-rgb) / 0.08), 0 12px 24px -18px rgb(var(--navy-rgb) / 0.4);
  color: #000;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.ft-glimpse table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ft-glimpse th,
.ft-glimpse td {
  padding: 3px 0;
  border-top: 1px solid #000;
  text-align: left;
}

.ft-glimpse td {
  text-align: right;
}

.ft-glimpse thead th {
  border-top: 0;
  border-bottom: 2px solid #000;
}

.ft-glimpse .sub {
  padding-left: 12px;
  font-weight: 400;
}

.ft-glimpse figcaption {
  margin-top: var(--s-2);
  color: var(--ink-3);
  font-size: 0.75rem;
}

.ft-glimpse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  font-family: var(--font-mono);
}

.ft-glimpse-grid span {
  padding: 3px 6px;
  border-top: 1px solid var(--line);
}

.ft-glimpse-grid span:nth-child(-n + 3) {
  border-top: 0;
  font-weight: 700;
}

/* Explanations: headings inside a section's prose start a new topic, so they get room above. */
.prose h3 {
  margin: var(--s-6) 0 var(--s-2);
  font-family: var(--font-head);
  font-size: var(--fs-lg);
}

.prose h3:first-child {
  margin-top: 0;
}

.prose table + p,
.prose p + table,
.prose .ft-sum + p {
  margin-top: var(--s-4);
}

/* Text buttons inside the tools (sample, clear): the site's .btn-link is white for dark bands. */
.ft-bench .btn-link {
  display: inline;
  min-height: 0;
  padding: 0;
  color: var(--cobalt);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.ft-bench .btn-link:hover {
  color: var(--ink);
}

@media (max-width: 599px) {
  .ft-proof {
    padding: var(--s-3);
  }

  .ft-label {
    padding: var(--s-3) var(--s-2);
  }
}

/* Secondary link under the App Store button on the dark band. */
.on-dark .ft-aside a {
  color: var(--white);
  text-underline-offset: 3px;
}

.on-dark .ft-aside a:hover {
  color: var(--cyan);
}
