/* CUBE CSS (https://cube.fyi): global → composition → utility → block → exception */

/* ---------- Global ---------- */

/* Nutri's face, served from here: the Latin subset of Hanken Grotesk (SIL Open Font
   License), one variable file for every weight. The other pages keep the system's. */
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/hanken-grotesk.c501f578bf3f.woff2") format("woff2");
}

/* The landing's lettering, on the pages that wear its look (the one-screen checkout). */
.tutus-page {
  --font-body: "Hanken Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* `.tutus`, `.tutus.dark` and `.nutri` set their own color-scheme; Corpus's themes don't. */

.light {
  color-scheme: light;
}

.dark {
  color-scheme: dark;
}

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

* {
  margin: 0;
}

body {
  min-block-size: 100dvh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  color: var(--color-text-normal);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2 {
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

h1 {
  font-size: var(--step-3);
  font-weight: var(--weight-semibold);
}

h2 {
  font-size: var(--step-1);
  font-weight: var(--weight-semibold);
}

/* Nutri reads light: its headings drop the weight the other houses carry. */
.nutri h1 {
  font-weight: var(--weight-light);
}

.nutri h2 {
  font-weight: var(--weight-normal);
}

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-link-hover);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* A text box keeps its size: longer text scrolls inside it. */
textarea {
  resize: none;
}

ol,
ul {
  padding-inline-start: 1.25em;
}

/* Compositions set display, which would otherwise win over the attribute. */
[hidden] {
  display: none !important;
}

/* Logos come in two copies, one per theme. */
.light [data-theme="dark"],
.dark [data-theme="light"] {
  display: none;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ---------- Composition ---------- */

.cover {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  min-block-size: 100dvh;
  padding-block-end: var(--space-l);
}

.cover > main {
  margin-block: auto;
}

.center {
  inline-size: 100%;
  max-inline-size: var(--measure, var(--measure-prose));
  margin-inline: auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.with-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.with-sidebar > :first-child {
  flex-basis: var(--sidebar-width, auto);
  flex-grow: 1;
}

.with-sidebar > :last-child {
  flex-basis: 0;
  flex-grow: 999;
  min-inline-size: var(--sidebar-content-min, 50%);
}

/* ---------- Utility ---------- */

.gutter {
  padding-inline: var(--space-m-l);
}

.padding-block-l {
  padding-block: var(--space-l);
}

.measure-narrow {
  --measure: 30rem;
}

.measure-wide {
  --measure: var(--measure-wide);
}

.measure-form {
  --measure: var(--measure-form);
}

.measure-prose {
  --measure: var(--measure-prose);
}

.flex-nowrap {
  flex-wrap: nowrap;
}

.text-nowrap {
  white-space: nowrap;
}

.align-baseline {
  align-items: baseline;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-3xs {
  gap: var(--space-3xs);
}

.gap-2xs {
  gap: var(--space-2xs);
}

.gap-xs {
  gap: var(--space-xs);
}

.gap-s {
  gap: var(--space-s);
}

.gap-l {
  gap: var(--space-l);
}

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

.text-color-subtle {
  color: var(--color-text-subtle);
}

.text-color-alert {
  color: var(--color-risk-critical);
}

/* The dark --color-risk-critical is 4.26:1 on the dark page; the palette has no red step. */
.dark .text-color-alert {
  color: color-mix(in oklab, var(--color-risk-critical), var(--color-gray-50) 15%);
}

.text-color-accent {
  color: var(--color-accent-text);
}

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

/* Positioned, so what is hidden to the eye inside it scrolls with it instead of
   widening the page. */
.scroll-x {
  position: relative;
  overflow-x: auto;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Figures that change or stack: every digit as wide as the next. */
.num {
  font-variant-numeric: tabular-nums;
}

.text-step--1 {
  font-size: var(--step--1);
}

.text-step-1 {
  font-size: var(--step-1);
}

.text-step-2 {
  font-size: var(--step-2);
}

.text-step-3 {
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
}

.text-light {
  font-weight: var(--weight-light);
}

.text-balance {
  text-wrap: balance;
}

.text-color-primary {
  color: var(--color-primary-fill-vivid);
}

.text-kicker {
  font-size: var(--step--2);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-subtle);
}

.text-semibold {
  font-weight: var(--weight-semibold);
}

.text-bold {
  font-weight: var(--weight-bold);
}

.text-mono {
  font-family: var(--font-mono);
}

.text-mono-label {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ---------- Block ---------- */

/* WhatsApp's own mark and colours, so people recognise it. */
.whatsapp-pill {
  display: inline-flex;
  gap: var(--space-2xs);
  align-items: center;
  min-block-size: 2.75rem;
  padding-inline: var(--space-3xs) var(--space-s);
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  color: var(--color-whatsapp);
  text-decoration: none;
  white-space: nowrap;
  background: var(--color-surface);
  border: 1.5px solid color-mix(in oklab, var(--color-whatsapp-brand) 55%, var(--color-border-muted));
  border-radius: var(--radius-full);
}

.whatsapp-pill:hover {
  border-color: var(--color-whatsapp-brand);
}

.whatsapp-logo {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: 2rem;
  block-size: 2rem;
  color: #fff;
  background: var(--color-whatsapp-brand);
  border-radius: var(--radius-full);
}

.whatsapp-logo svg {
  inline-size: 1.125rem;
  block-size: 1.125rem;
}

.headline em {
  font-weight: inherit;
  color: var(--color-primary-fill-vivid);
}

/* The landing's /tutus header (TutusHeader.astro), without its links. 4rem is the height
   it renders at: its site-header.css overrides the 3.5rem --header-height of tokens.css. */
.site-header {
  display: grid;
  align-items: center;
  block-size: 4rem;
  background: var(--color-background);
  border-block-end: var(--border-thin) solid var(--color-border-muted);
}

.site-header .button {
  padding-inline: var(--space-xs);
}

.mark {
  display: flex;
  flex: none;
  gap: var(--space-2xs);
  align-items: center;
  min-block-size: 2.75rem;
  color: var(--color-text-normal);
}

/* The landing's PNG of the mark leaves this margin around it. */
.mark svg {
  inline-size: 1.5rem;
  block-size: 1.5rem;
  padding: 0.3125rem;
}

/* The landing's logotype, as tall as the mark's glyph. */
.wordmark {
  display: block;
  block-size: 1.1rem;
  inline-size: auto;
}

.mark span,
.brand[data-layout="lockup"] span {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.divider {
  flex: none;
  inline-size: var(--border-thin);
  block-size: 1.5rem;
  background: var(--color-border-accent);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
  line-height: 1.1;
  color: var(--color-text-normal);
}

.brand strong {
  font-size: var(--step-1);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

.brand svg {
  align-self: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

.logo {
  display: block;
  block-size: 2rem;
  inline-size: auto;
}

.theme-switch {
  display: inline-grid;
  flex: none;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-md);
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.theme-switch:hover,
.theme-switch:focus-visible {
  color: var(--color-text-normal);
  border-color: var(--color-primary-border-accent);
}

.theme-switch svg {
  display: none;
  inline-size: 1.125rem;
  block-size: 1.125rem;
}

.dark .theme-switch [data-icon="sun"],
.light .theme-switch [data-icon="moon"] {
  display: block;
}

.card {
  padding: var(--space-l);
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.button {
  display: inline-flex;
  gap: var(--space-2xs);
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  min-block-size: 3.25rem;
  padding: var(--space-2xs) var(--space-l);
  font-size: var(--step-0);
  font-weight: var(--weight-medium);
  color: var(--color-primary-on-vivid);
  text-decoration: none;
  background: linear-gradient(
    90deg,
    var(--color-primary-fill-vivid),
    color-mix(in oklab, var(--color-primary-fill-vivid) 78%, var(--color-primary-border-accent))
  );
  border: var(--border-thin) solid transparent;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 18px color-mix(in oklab, var(--color-primary-fill-vivid) 22%, transparent);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.button:hover {
  color: var(--color-primary-on-vivid);
  background: var(--color-primary-border-accent);
}

.button svg {
  inline-size: 1.5em;
  block-size: 1.5em;
}

.input {
  inline-size: 100%;
  min-block-size: 3.25rem;
  padding: var(--space-2xs) var(--space-s);
  font-size: var(--step-1);
  color: var(--color-text-normal);
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-text-faint);
  border-radius: var(--radius-sm);
}

.checkbox {
  inline-size: 1.25em;
  block-size: 1.25em;
  margin-block-start: 0.125em;
  accent-color: var(--color-primary-fill-vivid);
}

.checklist {
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: var(--space-2xs);
  align-items: baseline;
}

.checklist li::before {
  content: "✓" / "";
  font-weight: var(--weight-bold);
  color: var(--color-accent-text);
}

.totals {
  padding-block: var(--space-xs);
  border-block: var(--border-thin) solid var(--color-border-muted);
}

.notice {
  padding: var(--space-xs) var(--space-s);
  font-size: var(--step--1);
  color: var(--color-primary-on-muted);
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-md);
}

/* A notice that is a link: the whole strip leads there, and its last words say so. */
a.notice {
  text-decoration: none;
}

a.notice > :last-child {
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.table {
  inline-size: 100%;
  font-size: var(--step--1);
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-3xs) var(--space-2xs);
  text-align: start;
  vertical-align: top;
  border-block-end: var(--border-thin) solid var(--color-border-muted);
}

.table thead th {
  font-size: var(--step--2);
  font-weight: var(--weight-semibold);
  color: var(--color-text-subtle);
}

.table .num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A list of rows, each a link with a figure at its end. */
.rows {
  padding: 0;
  list-style: none;
}

.rows > li {
  display: flex;
  gap: var(--space-xs);
  align-items: baseline;
  justify-content: space-between;
  padding-block: var(--space-2xs);
  border-block-end: var(--border-thin) solid var(--color-border-muted);
}

.rows a {
  color: inherit;
  text-decoration: none;
}

.rows a:hover {
  color: var(--color-primary-on-muted);
}

/* A row that is a link, with an action of its own at its end. */
.rows > li > a:first-child {
  flex: 1;
  min-inline-size: 0;
}

.rows > li > .icon-button {
  align-self: center;
}

.tag {
  display: inline-block;
  padding: 0 var(--space-2xs);
  font-size: var(--step--2);
  font-weight: var(--weight-medium);
  color: var(--color-primary-on-muted);
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-full);
}

/* A filter the list can be narrowed by; the one in use is current. */
.chip {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.25rem;
  padding: 0 var(--space-s);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  color: var(--color-text-normal);
  text-decoration: none;
  background: none;
  border: var(--border-thin) solid var(--color-border-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--color-primary-border-accent);
}

.chip[aria-current],
.chip[aria-pressed="true"],
.chip:has(input:checked) {
  color: var(--color-primary-on-vivid);
  background: var(--color-primary-fill-vivid);
  border-color: transparent;
}

/* A chip that is one choice among several: its radio is the chip itself. */
.chip:has(input) {
  position: relative;
}

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

.chip:has(input:focus-visible) {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.nutrients {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: var(--space-2xs);
  padding: 0;
  list-style: none;
}

.nutrients > li {
  display: flex;
  flex-direction: column;
  padding: var(--space-2xs);
  background: var(--color-neutral-fill-accent);
  border-radius: var(--radius-sm);
}

.nutrients b {
  font-size: var(--step-0);
  font-variant-numeric: tabular-nums;
}

.nutrients span {
  font-size: var(--step--2);
  color: var(--color-text-subtle);
}

/* A label over its input, or a legend over its choices: a fieldset loses its frame. */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  min-inline-size: 0;
  padding: 0;
  border: 0;
}

.field > label,
.field > legend {
  padding: 0;
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
}

.field .input {
  min-block-size: 2.75rem;
  font-size: var(--step-0);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-s);
}

.choices label {
  display: inline-flex;
  gap: var(--space-3xs);
  align-items: center;
}

/* The week's seven days, side by side even on a phone. */
.daystrip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-3xs);
}

.day {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-block-size: 3.25rem;
  padding-block: var(--space-3xs);
  font-size: var(--step--2);
  color: var(--color-text-subtle);
  text-decoration: none;
  border-radius: var(--radius-md);
}

.day b {
  font-size: var(--step-0);
  font-weight: var(--weight-medium);
  color: var(--color-text-normal);
}

.day[aria-current] {
  color: var(--color-primary-on-vivid);
  background: var(--color-primary-fill-vivid);
}

.day[aria-current] b {
  color: var(--color-primary-on-vivid);
}

.day[data-today] b {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Whether the day holds something, in the day's own color: a dot, hollow while it
   holds nothing. */
.day i {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  margin-block-start: 2px;
  border: var(--border-thin) solid currentcolor;
  border-radius: var(--radius-full);
}

.day i[data-planned] {
  background: currentcolor;
}

/* A planned recipe: its name over its folded portions, and its kcal at the end when
   its moment holds several. */
.plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs);
  align-items: start;
}

/* Once the day has come, the check leads the row. */
.plan-item:has(> form[data-check]) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.plan-item > div {
  line-height: 1.3;
}

/* The photo an entry was read from, small: the way to it whole. */
.plate-thumb {
  display: block;
  flex: none;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  overflow: hidden;
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-sm);
}

/* Larger where the photos are the page: a shared week. */
.plate-thumb[data-size="lg"] {
  inline-size: 5.5rem;
  block-size: 5.5rem;
  border-radius: var(--radius-md);
}

.plate-thumb img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* The photos a moment was read from, wide over what was added from them. Two
   plates of one moment share the line. */
.plate-covers {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--space-2xs);
  margin-block-end: var(--space-3xs);
}

.plate-cover {
  display: block;
  aspect-ratio: 16 / 9;
  max-block-size: 14rem;
  overflow: hidden;
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-md);
}

.plate-cover img,
.plate-week img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* A week in plates: under the days' initials, a row of seven cells per moment. */
.plate-week,
.plate-week > div {
  display: grid;
  gap: var(--space-3xs);
}

.plate-week > div {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.plate-week > div > * {
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.plate-week > div:not(:first-child) > * {
  aspect-ratio: 1;
  background: var(--color-primary-fill-muted);
}

/* A meal without a photo is there, and a moment with nothing is a gap. */
.plate-week [data-cell="held"] {
  display: grid;
  place-items: center;
}

.plate-week [data-cell="held"]::before {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  content: "";
  background: var(--color-text-subtle);
  border-radius: 50%;
}

.plate-week > div > [data-cell="none"] {
  background: none;
  border: var(--border-thin) dashed var(--color-border-muted);
}

/* The photo of a plate, whole. */
.plate-photo {
  display: block;
  inline-size: 100%;
  max-block-size: 60vh;
  object-fit: cover;
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-md);
}

.plan-item[data-done] strong {
  font-weight: var(--weight-normal);
  color: var(--color-text-subtle);
}

/* The portions fold as a pill: small to the eye, a thumb's size to the touch. */
.plan-item .more > summary {
  position: relative;
  display: inline-flex;
  gap: var(--space-3xs);
  align-items: center;
  min-block-size: 1.75rem;
  padding-inline: var(--space-2xs);
  margin-block-start: var(--space-3xs);
  color: var(--color-text-normal);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-full);
}

.plan-item .more > summary::-webkit-details-marker {
  display: none;
}

.plan-item .more > summary::before {
  position: absolute;
  inset: calc(-1 * var(--space-2xs)) 0;
  content: "";
}

.plan-item .more > summary::after {
  color: var(--color-text-subtle);
  content: "▾" / "";
}

.plan-item .more[open] > summary::after {
  content: "▴" / "";
}

.plan-item a {
  color: inherit;
  text-decoration: none;
}

/* A button, or a link, that is one sign: as wide and tall as a thumb needs. */
.icon-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  padding: 0;
  font-size: var(--step-1);
  font-weight: var(--weight-medium);
  line-height: 1;
  color: var(--color-text-normal);
  text-decoration: none;
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-full);
}

.icon-button:hover {
  border-color: var(--color-primary-border-accent);
  color: var(--color-primary-on-muted);
}

.icon-link {
  display: inline-grid;
  place-items: center;
  min-inline-size: 2.75rem;
  min-block-size: 2.75rem;
  font-size: var(--step-2);
  line-height: 1;
  color: var(--color-text-muted);
  text-decoration: none;
}

/* The way to add a recipe to a moment, at the end of the moment's own line. */
.add {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-block-size: 2.75rem;
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.add:hover {
  text-decoration: underline;
}

/* The way to something that is not there yet: what is missing, and the action in ink. */
.empty-slot {
  display: flex;
  gap: var(--space-2xs);
  align-items: center;
  justify-content: space-between;
  min-block-size: 2.75rem;
  font-size: var(--step--1);
  color: var(--color-text-subtle);
  text-decoration: none;
}

.empty-slot > :last-child {
  font-weight: var(--weight-semibold);
  color: var(--color-text-normal);
}

.empty-slot:hover > :last-child {
  text-decoration: underline;
}

/* A shopping line, in one row: the check, then what it is and how much to buy. The
   row unfolds what it is for and the way into the pantry. */
/* Over `.rows > li`, whose flex row would centre the name between its neighbours. */
.rows > .check-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-xs);
  align-items: start;
}

/* The box sits on the name's line, which is as tall as a thumb needs. */
.check-line > form {
  display: grid;
  align-items: center;
  min-block-size: 1.75rem;
}

.check-line .more > summary {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  justify-content: space-between;
  min-block-size: 1.75rem;
  font-size: inherit;
  color: inherit;
}

.check-line .more > summary::-webkit-details-marker {
  display: none;
}

/* An inline block, so a line in the cart strikes its name and not this sign. */
.check-line .name::after {
  display: inline-block;
  margin-inline-start: var(--space-3xs);
  font-size: var(--step--2);
  color: var(--color-text-faint);
  content: "▾" / "";
}

.check-line .more[open] .name::after {
  content: "▴" / "";
}

.check-line summary b {
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.check-line[data-done] .name {
  color: var(--color-text-subtle);
  text-decoration: line-through;
}

.check-box {
  position: relative;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  padding: 0;
  font-size: var(--step--1);
  line-height: 1;
  color: var(--color-primary-on-vivid);
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-sm);
}

/* The box stays small; the thumb gets the room around it. */
.check-box::after {
  position: absolute;
  inset: calc(-1 * var(--space-xs));
  content: "";
}

.check-box[aria-checked="true"] {
  background: var(--color-primary-fill-vivid);
  border-color: var(--color-primary-fill-vivid);
}

/* A recipe line: the ingredient takes the room, the grams stay narrow. */
.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6rem;
  gap: var(--space-2xs);
  align-items: center;
}

/* Once recipe_lines.js fills a line, its name is text with what it comes to, over
   its amount, the unit the amount is in and a way out. */
.line[data-filled] {
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
}

.line[data-filled] .name {
  grid-column: 1 / -1;
}

.line[data-filled] .input {
  min-block-size: 2.75rem;
}

.line[data-filled] input.input {
  text-align: end;
}

/* The day opens on its two targets, side by side: each a figure, what it counts,
   its bar and the sum behind it. */
.targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-s);
  font-size: var(--step--1);
  color: var(--color-text-subtle);
}

/* Both targets share their rows, so the bars line up when one caption wraps. */
.targets > div {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4;
  row-gap: var(--space-3xs);
  align-content: start;
}

/* Without a target there is no bar: the way to set one sits where the sum would. */
.targets > div > :nth-child(3):last-child {
  grid-row: 4;
}

/* On the day that is being eaten the targets step back: a line each over its bar. */
.targets[data-size="compact"] > div {
  grid-row: span 2;
}

.targets[data-size="compact"] b {
  font-size: var(--step-0);
  color: var(--color-text-normal);
}

/* Sized so five characters ("+1250") still fit half a phone's width. */
.figure {
  font-size: clamp(2.75rem, 1.6rem + 6.5vw, 4.5rem);
  font-weight: var(--weight-light);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--color-text-normal);
}

/* How much of a target the day holds, or of a list the cart. Ink by default: an
   unfinished day says nothing yet. A kcal target colours it once reached or passed. */
.meter {
  block-size: 0.375rem;
  overflow: hidden;
  background: var(--color-neutral-fill-accent);
  border-radius: var(--radius-full);
}

.meter i {
  display: block;
  block-size: 100%;
  background: var(--color-primary-fill-vivid);
  border-radius: var(--radius-full);
}

.meter[data-tone="ok"] i {
  background: var(--color-risk-low);
}

.meter[data-tone="over"] i {
  background: var(--color-risk-high);
}

/* The day's five moments: the name of each over what it holds, which takes the
   row's whole width. */
.moments {
  padding: 0;
  list-style: none;
}

.moments > li {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding-block: var(--space-3xs) var(--space-xs);
  border-block-start: var(--border-thin) solid var(--color-border-muted);
}

.moments h2 {
  letter-spacing: 0;
}

.moments h2 span {
  font-weight: var(--weight-normal);
}

.macro-bar .bar i,
.macro-bar .legend i {
  display: block;
  block-size: 100%;
}

/* The three macros keep one color each, on the day and on every recipe. */
[data-macro="protein"] {
  background: var(--color-macro-protein);
}

[data-macro="fat"] {
  background: var(--color-macro-fat);
}

[data-macro="carbs"] {
  background: var(--color-macro-carbs);
}

/* A portion's kcal split in one bar, with the grams of each macro under it. */
.macro-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.macro-bar .bar {
  display: flex;
  block-size: 0.625rem;
  overflow: hidden;
  background: var(--color-neutral-fill-accent);
  border-radius: var(--radius-full);
}

.macro-bar[data-partial] .bar {
  outline: var(--border-thin) dashed var(--color-border-accent);
  outline-offset: 1px;
}

.macro-bar .legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-xs);
  padding: 0;
  font-size: var(--step--2);
  color: var(--color-text-subtle);
  list-style: none;
}

.macro-bar .legend li {
  display: inline-flex;
  gap: var(--space-3xs);
  align-items: center;
}

.macro-bar .legend i {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 2px;
}

.macro-bar .legend b {
  color: var(--color-text-normal);
}

/* Carbohydrate portions, a circle for each 15 g, in the carbohydrates' grey. */
.portions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  vertical-align: middle;
}

.portions i {
  inline-size: 0.875rem;
  block-size: 0.875rem;
  background: var(--color-macro-carbs);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-full);
}

.portions [data-fill="half"] {
  background: linear-gradient(90deg, var(--color-macro-carbs) 50%, transparent 50%);
}

/* A portion that may be added: how far a range reaches. */
.portions [data-fill="open"] {
  background: none;
  border-style: dashed;
}

/* The guide's plate. Its parts are told apart by the names written in them; the
   carbohydrates' quarter takes their grey, the one the macro bar gives them. */
.plate {
  display: block;
  inline-size: 100%;
  max-inline-size: 22rem;
  margin-inline: auto;
}

.plate [data-part] {
  fill: none;
  stroke: var(--color-border-accent);
  stroke-width: 1.5;
}

.plate [data-part="rim"],
.plate [data-part="protein"] {
  fill: var(--color-surface);
}

.plate [data-part="vegetables"] {
  fill: var(--color-neutral-fill-accent);
}

.plate [data-part="carbs"] {
  fill: var(--color-macro-carbs);
}

.plate [data-part="water"] {
  fill: var(--color-neutral-fill-accent);
  stroke: none;
}

.plate text {
  font-size: 10px;
  fill: var(--color-text-normal);
  text-anchor: middle;
}

.plate [data-role="share"] {
  font-size: 22px;
  font-weight: var(--weight-light);
}

.plate [data-role="name"] {
  font-weight: var(--weight-semibold);
}

.plate [data-role="note"] {
  fill: var(--color-text-subtle);
}

/* The meal that comes next on today's plan: what it is, and one button for all of it. */
.next {
  padding: var(--space-s);
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-muted);
  border-radius: var(--radius-md);
}

.next a {
  color: inherit;
  text-decoration: none;
}

/* A mark per planned recipe, filled once it is eaten. */
.marks {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
}

.marks i {
  inline-size: 0.625rem;
  block-size: 0.625rem;
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-full);
}

.marks i[data-done] {
  background: var(--color-primary-fill-vivid);
  border-color: var(--color-primary-fill-vivid);
}

/* A question's answers, each a whole row: what it is, and under it what comes of it. */
.options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.option {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  inline-size: 100%;
  padding: var(--space-xs) var(--space-s);
  color: var(--color-text-normal);
  text-align: start;
  text-decoration: none;
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-md);
}

.option:hover {
  color: var(--color-text-normal);
  border-color: var(--color-primary-border-accent);
}

.option span {
  font-size: var(--step--1);
  color: var(--color-text-subtle);
}

/* A sample day as a card: a line per moment, and a button of its own. */
.sample {
  padding: var(--space-xs) var(--space-s);
  background: var(--color-surface);
  border: var(--border-thin) solid var(--color-border-muted);
  border-radius: var(--radius-md);
}

.sample .button {
  align-self: start;
}

.day-lines {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3xs) var(--space-xs);
  font-size: var(--step--1);
}

.day-lines dt {
  color: var(--color-text-subtle);
}

/* A preparation's steps, with room between them to find the place again. */
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.more > summary {
  font-size: var(--step--1);
  color: var(--color-link);
  cursor: pointer;
}

.more[open] > summary {
  margin-block-end: var(--space-2xs);
}

/* A whole row as one button, or one link: the recipes of the add sheet, the days to
   copy from, the guides. */
.row-button {
  display: flex;
  gap: var(--space-xs);
  align-items: baseline;
  justify-content: space-between;
  inline-size: 100%;
  padding: var(--space-2xs) 0;
  color: inherit;
  text-align: start;
  text-decoration: none;
  background: none;
  border: 0;
  border-block-end: var(--border-thin) solid var(--color-border-muted);
  border-radius: 0;
}

.row-button:hover {
  color: var(--color-primary-on-muted);
}

.row-button > :last-child {
  white-space: nowrap;
}

/* The add sheet's basics, side by side: each a tile with its name over what one of
   it gives, and its count between the two buttons that move it. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-2xs);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding: var(--space-2xs) var(--space-xs);
  line-height: 1.25;
  background: var(--color-background);
  border: var(--border-thin) solid var(--color-border-muted);
  border-radius: var(--radius-md);
}

.tile > div {
  margin-block-start: auto;
}

/* Inicio's doors fill their rows whatever the width: by twos on a phone, by threes
   where there is room, never a fourth column that would leave two of six alone. */
.tiles[data-doors] {
  grid-template-columns: repeat(auto-fill, minmax(max(9rem, 30%), 1fr));
}

/* A tile that is a way in, one of Inicio's doors: its sign over its name and what
   it has to say today. As tall as two lines under the name, so a row keeps its
   height when one of them wraps. */
a.tile {
  min-block-size: 6.5rem;
  padding: var(--space-xs);
  color: inherit;
  text-decoration: none;
  background: var(--color-surface);
}

a.tile:hover {
  border-color: var(--color-primary-border-accent);
}

a.tile svg {
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

a.tile span {
  font-size: var(--step--1);
  color: var(--color-text-subtle);
}

/* Alone, the button that adds stays at the tile's end. */
.tile > div > :last-child {
  margin-inline-start: auto;
}

.tile[data-counted] {
  border-color: var(--color-primary-fill-vivid);
  box-shadow: inset 0 0 0 var(--border-thin) var(--color-primary-fill-vivid);
}

/* The button that adds what the tiles count stays in reach while they scroll. */
.tiles + .button {
  position: sticky;
  inset-block-end: var(--space-xs);
}

/* The add sheet: a dialog that rises from the bottom over the day. */
.sheet {
  position: fixed;
  inset: auto 0 0;
  inline-size: 100%;
  max-inline-size: none;
  max-block-size: 85dvh;
  padding: var(--space-xs) var(--space-m-l) var(--space-m);
  margin: 0;
  overflow-y: auto;
  color: var(--color-text-normal);
  background: var(--color-surface);
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.sheet::backdrop {
  background: hsl(220 30% 5% / 0.5);
}

.sheet > form {
  max-inline-size: var(--measure-form);
  margin-inline: auto;
}

/* Nutri's sections at the bottom. However short the page, the bar sits on the
   screen's lower edge: the auto margin pushes it down, the negative one takes
   back the cover's padding, and its own padding clears a phone's home indicator. */
.tabbar {
  position: sticky;
  inset-block-end: 0;
  z-index: 1;
  margin-block: auto calc(-1 * var(--space-l));
  padding-block-end: env(safe-area-inset-bottom, 0);
  background: var(--color-background);
  border-block-start: var(--border-thin) solid var(--color-border-muted);
}

.tabbar > div {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.tabbar a {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  align-items: center;
  padding: var(--space-2xs) var(--space-3xs);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  color: var(--color-text-subtle);
  text-align: center;
  text-decoration: none;
}

.tabbar a:hover {
  color: var(--color-text-normal);
}

.tabbar svg {
  inline-size: 1.375rem;
  block-size: 1.375rem;
}

.tabbar [aria-current="page"] {
  font-weight: var(--weight-semibold);
  color: var(--color-text-normal);
}

/* ---------- Exception ---------- */

/* The answer that does something for the person, in ink: one among the others. */
.option[data-variant="vivid"],
.option[data-variant="vivid"]:hover {
  color: var(--color-primary-on-vivid);
  background: var(--color-primary-fill-vivid);
  border-color: transparent;
}

.option[data-variant="vivid"] span {
  color: color-mix(in oklab, var(--color-primary-on-vivid) 78%, transparent);
}

.option[data-variant="vivid"]:hover {
  background: var(--color-primary-border-accent);
}

/* What was written for the person and they have not touched yet. */
.input[data-proposed] {
  border-color: var(--color-text-normal);
  border-style: dashed;
}

.button[data-variant="ghost"] {
  color: var(--color-text-normal);
  background: var(--color-surface);
  border-color: var(--color-border-accent);
  box-shadow: none;
}

.button[data-variant="ghost"]:hover {
  background: var(--color-neutral-fill-accent);
  border-color: var(--color-text-muted);
}

.button[data-size="md"] {
  inline-size: auto;
  min-block-size: 2.75rem;
  font-size: var(--step--1);
  white-space: nowrap;
}

.brand[data-layout="lockup"] {
  align-items: center;
  min-block-size: 2.75rem;
}

@media (min-width: 30em) {
  .brand[data-layout="lockup"] {
    align-items: baseline;
  }

  .mark span,
  .brand[data-layout="lockup"] span {
    position: static;
    inline-size: auto;
    block-size: auto;
    overflow: visible;
    clip-path: none;
  }
}

@media (min-width: 60em) {
  .site-header .button {
    padding-inline: var(--space-m);
  }
}

/* Nutri's pages read from the top, however short; the checkout's float mid-screen. */
.cover[data-align="start"] > main {
  margin-block: 0;
}

.input[aria-invalid="true"] {
  border-color: var(--color-risk-critical);
}

@media (prefers-reduced-motion: reduce) {
  a,
  .button,
  .theme-switch {
    transition: none;
  }
}

/* A button that reads as a link: a way out of a form that is not the form's own
   action. As tall as a thumb needs. */
.link {
  min-block-size: 2.75rem;
  padding: 0;
  font: inherit;
  font-weight: var(--weight-semibold);
  color: var(--color-link);
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
  background: none;
  border: 0;
}

.link:hover {
  color: var(--color-link-hover);
}

/* A long form's one action, with what it comes to. Where its script measures the
   sections' bar it stays in sight over it; without it, it is the form's end. */
.savebar {
  padding-block: var(--space-xs);
  background: var(--color-background);
  border-block-start: var(--border-thin) solid var(--color-border-muted);
}

.savebar[data-float] {
  position: sticky;
  inset-block-end: var(--savebar-offset, 0);
  z-index: 1;
}

/* An amount typed between its two steps: a plan entry's, and a food's on the page
   of a plate. */
.plan-item .more .input,
.rows [data-amount] {
  inline-size: 4.5rem;
  min-block-size: 2.75rem;
  text-align: center;
}

/* A food's grams run to four digits: the field's own padding would hide them. */
.rows [data-amount] {
  padding-inline: var(--space-3xs);
}

/* The lock that says a page is the way in to something kept safe. */
.seal {
  display: grid;
  place-items: center;
  inline-size: 3rem;
  block-size: 3rem;
  color: var(--color-primary-on-muted);
  background: var(--color-primary-fill-muted);
  border-radius: var(--radius-full);
}

.seal svg {
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

.lock {
  inline-size: 1em;
  block-size: 1em;
}

/* Where files are chosen or dropped; its script marks it while a file is over it. */
.dropzone {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  align-items: center;
  padding: var(--space-xl) var(--space-m);
  text-align: center;
  cursor: pointer;
  background: color-mix(in oklab, var(--color-primary-fill-muted) 45%, transparent);
  border: var(--border-thick) dashed var(--color-primary-border-muted);
  border-radius: var(--radius-lg);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

.dropzone:hover,
.dropzone[data-over],
.dropzone:has(input:focus-visible) {
  background: var(--color-primary-fill-muted);
  border-color: var(--color-primary-border-accent);
}

.dropzone:has(input:focus-visible) {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.dropzone svg {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  margin-block-end: var(--space-2xs);
  color: var(--color-primary-border-accent);
}

/* Each file on its way, with how far it got. */
.uploads {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: 0;
  list-style: none;
}

.uploads [data-name] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploads progress {
  inline-size: 100%;
  block-size: 0.375rem;
  accent-color: var(--color-primary-fill-vivid);
}

.uploads [data-state="done"] [data-status] {
  color: var(--color-accent-text);
}

.uploads [data-state="done"] progress {
  accent-color: var(--color-accent-fill-vivid);
}

.uploads [data-state="failed"] [data-status] {
  color: var(--color-risk-critical);
}
