/* Calculators
   Inputs on the left, a results panel that stays put on the right, which is
   the shape incident.io and Intercom both landed on:
   mobbin.com/sites/sections/a89d203c-0a40-48a4-a442-e632fb3784e7
   mobbin.com/sites/sections/10e56c1c-f3d8-4e7f-92d1-9701e01035ee
   The panel is the one dark surface on the page, so the number you came for
   is the only thing on screen with that weight. */

/* Tool page head: copy left, Pip tucked into the right edge of the block.
   mobbin.com/sites/sections/b991afb7-c0f8-4742-a332-ca7008f3fc46  Charma
   mobbin.com/sites/sections/663a253d-2170-4615-9cc8-3aace83ec6f5  Headspace
   Charma parks its characters at the end of the heading rather than giving
   them a panel, which is the restrained version of a mascot: it reads as
   part of the sentence instead of as decoration bolted on beside it.

   Pip is not ornament here. The pose is driven by the result, so the pages
   with a band or a threshold have a character that reacts to your number.
   See `setPip` in calc.js. */
.calc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(16px, 3vw, 44px);
  align-items: center;
  margin-bottom: clamp(28px, 3.4vw, 40px);
}
.calc-intro {
  max-width: var(--read);
}
.calc-pip {
  width: clamp(96px, 11vw, 138px);
  height: auto;
  justify-self: end;
  filter: drop-shadow(0 10px 18px var(--shadow-art));
}
.js .calc-pip {
  animation: breathe 4.4s var(--ease) infinite;
}
/* A pose change is a small pop rather than a swap, so it is noticed once
   and never becomes a distraction while you are typing numbers. */
.calc-pip.pop {
  animation: pip-pop var(--d-celebrate, 520ms) var(--ease-emphasized);
}
@keyframes pip-pop {
  0% {
    transform: scale(0.86) rotate(-5deg);
  }
  55% {
    transform: scale(1.07) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
@media (max-width: 560px) {
  .calc-head {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .calc-pip {
    justify-self: start;
    width: 92px;
  }
}
.calc-intro p {
  color: var(--ink-soft);
  font-size: var(--t-base);
  line-height: 1.6;
  margin-top: 12px;
}

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: clamp(20px, 2.6vw, 36px);
  align-items: start;
}
/* Grid items default to `min-width: auto`, which means they refuse to
   shrink below their content's minimum. The recipe table declares
   `min-width: 440px`, so on a 390px phone it pushed the whole track to
   482px and the page scrolled sideways, even though the table sits in its
   own `overflow-x: auto` scroller. The items just have to be allowed to
   shrink; the scroller then does its job. */
.calc-form,
.calc-out {
  min-width: 0;
}
.calc-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(20px, 2.4vw, 30px);
  box-shadow: var(--e-raised);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.calc-row {
  display: grid;
  gap: 7px;
}
.calc-row[hidden] {
  display: none;
}
.calc-row.wide {
  grid-column: 1 / -1;
}
.calc-row > label,
.calc-legend {
  font-family: var(--ui);
  font-size: var(--t-2xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
/* The recipe table's inputs join these selectors rather than restating
   them. Left out, they fell through to the native control, which under
   `color-scheme: light dark` renders dark on a cream page. */
.calc-row input[type="number"],
.calc-row select,
.calc-row input[type="time"],
.recipe-table input,
.calc-row input[type="text"],
.calc-row input[type="email"],
.calc-row textarea {
  font-family: var(--ui);
  font-size: var(--t-base);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  width: 100%;
  -moz-appearance: textfield;
  appearance: none;
}
.calc-row select {
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    right 16px center,
    right 11px center;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.calc-row input:focus-visible,
.calc-row select:focus-visible,
.calc-row textarea:focus-visible,
.recipe-table input:focus-visible,
.seg input:focus-visible + span {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

/* Autofill. A browser paints its own slate blue fill over an autofilled field
   and ignores `background-color` outright, so the two fields a person lets
   Chrome complete came out grey with near white text while the untouched ones
   stayed cream. An inset box shadow is the only thing that covers that fill,
   and `-webkit-text-fill-color` is what actually sets the text, because
   `color` is ignored here too. The tokens do the theming, so dark mode
   follows without a second rule.

   The absurd transition delay is deliberate and is the usual trick: the fill
   is applied with a transition, so pushing it beyond any real session stops
   the grey flashing in before the shadow covers it.

   Kept in two blocks rather than one comma separated list. A browser that
   does not know one of these selectors throws away the whole rule it sits in,
   which would take the other selector down with it. */
.calc-row input:-webkit-autofill,
.calc-row input:-webkit-autofill:hover,
.calc-row input:-webkit-autofill:focus,
.calc-row select:-webkit-autofill,
.calc-row textarea:-webkit-autofill,
.recipe-table input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset;
  box-shadow: 0 0 0 100px var(--bg) inset;
  transition:
    background-color 600000s 0s,
    color 600000s 0s;
}
.calc-row input:autofill,
.calc-row select:autofill,
.calc-row textarea:autofill,
.recipe-table input:autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 100px var(--bg) inset;
  transition:
    background-color 600000s 0s,
    color 600000s 0s;
}
.calc-row input::-webkit-outer-spin-button,
.calc-row input::-webkit-inner-spin-button,
.recipe-table input::-webkit-outer-spin-button,
.recipe-table input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.calc-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Segmented control, used for sex, goal and units. */
.seg {
  display: flex;
  gap: 4px;
  background: var(--peach);
  border-radius: var(--r-sm);
  padding: 4px;
}
.seg label {
  flex: 1;
}
.seg input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.seg span {
  display: block;
  text-align: center;
  cursor: pointer;
  font-family: var(--ui);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--ink-soft);
  padding: 8px 6px;
  border-radius: 7px;
  transition:
    background var(--d-state) var(--ease),
    color var(--d-state) var(--ease);
}
.seg input:checked + span {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--e-raised);
}

.calc-units {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}
.calc-units .seg {
  padding: 3px;
}
.calc-units .seg span {
  font-size: var(--t-md);
  padding: 6px 14px;
  white-space: nowrap;
}
.seg span {
  white-space: nowrap;
}

/* Results */
.calc-out {
  position: sticky;
  top: calc(var(--nav-h) + 18px);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-lg);
  padding: clamp(22px, 2.4vw, 30px);
  box-shadow: var(--e-floating);
}
.calc-out .calc-legend {
  color: color-mix(in srgb, var(--bg) 62%, transparent);
}
.calc-kcal {
  font-family: var(--disp);
  font-variation-settings:
    "opsz" 110,
    "wght" 500;
  font-size: clamp(var(--t-5xl), 3.6vw, 46px);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 8px 0 2px;
}
.calc-kcal small {
  font-family: var(--ui);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: 0;
}
.calc-sub {
  font-size: var(--t-md);
  color: color-mix(in srgb, var(--bg) 66%, transparent);
  line-height: 1.5;
}
.calc-macros {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent);
}
.calc-macro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
}
.calc-macro b {
  font-family: var(--ui);
  font-size: var(--t-lg);
  font-weight: 700;
}
.calc-macro i {
  font-style: normal;
  font-size: var(--t-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.calc-macro .bar {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  overflow: hidden;
}
.calc-macro .bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width var(--d-entrance) var(--ease-emphasized);
}
.calc-macro.p .bar > span {
  background: var(--bar-protein);
}
.calc-macro.c .bar > span {
  background: var(--bar-carbs);
}
.calc-macro.f .bar > span {
  background: var(--bar-fat);
}
.calc-note {
  margin-top: 20px;
  font-size: var(--t-md);
  line-height: 1.55;
  color: color-mix(in srgb, var(--bg) 60%, transparent);
}
.calc-out .btn {
  width: 100%;
  margin-top: 18px;
  justify-content: center;
}

@media (max-width: 900px) {
  .calc {
    grid-template-columns: 1fr;
  }
  .calc-out {
    position: static;
  }
}
@media (max-width: 520px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

/* Recipe table
   Line items with a remove control per row, an add below and the totals in
   the panel beside it, which is the invoice builder shape:
   mobbin.com/sites/sections/5828da7e-840d-4d84-bd79-dde786188018  Wise
   mobbin.com/sites/sections/526e7783-27b7-439b-86c8-ee4e350da022  Sequence
   Wise puts the remove at the end of the row and the add directly under the
   last line, so the table reads as a list you are still writing rather than
   as data that arrived from somewhere. */

/* Visually hidden, and genuinely out of the layout.
   `position: absolute` resolves against the nearest positioned ancestor,
   and there was not one, so this span landed against the page at the
   x of a cell inside a horizontally scrolled table and stretched the
   document to 451px on a 390px phone. `clip-path` does the hiding and the
   cell below is positioned so the span can never escape it again. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.table-scroll {
  overflow-x: auto;
  margin-inline: -4px;
  padding-inline: 4px;
}

.recipe-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 440px;
}
.recipe-table th {
  text-align: left;
  padding: 0 8px 8px 0;
  font-family: var(--ui);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.recipe-table th:last-child {
  width: 34px;
  position: relative;
}
.recipe-table td {
  padding: 0 8px 8px 0;
  vertical-align: middle;
}
.recipe-table td:last-child {
  padding-right: 0;
}
.recipe-table input {
  width: 100%;
  padding: 9px 11px;
}
/* The macro columns hold three digits; the name takes what is left. */
.recipe-table td:nth-child(n + 2) input {
  min-width: 56px;
}

.r-del {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--d-state) var(--ease),
    color var(--d-state) var(--ease);
}
.r-del:hover {
  background: var(--peach);
  color: var(--accent-deep);
}

.recipe-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.recipe-actions .calc-row {
  min-width: 120px;
}

/* The fasting window is a time range, not a figure, so it cannot ride the
   display size the other panels use without wrapping. */
.calc-kcal-sm {
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.15;
}

/* Mobbin audit, 24 Sep 2026: 44px-tall segmented toggles and AA field labels. */
.seg span {
  padding-block: 12px;
}
.calc-row > label {
  color: #6b5d56;
}
