/* The Tinker Cook: the app. Tokens come from /s/tokens.css. No inline styles anywhere (CSP).
   The card here and the card on the landing page share one design: ruled ingredient lines under a tomato rule,
   saffron rings in the margin where a cook has a choice. */

:root {
  --bar-h: 4rem;
  --gutter: clamp(1rem, 3.5vw, 2.5rem);
}

/* ---------- basics ---------- */

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--basil-deep);
  text-underline-offset: 0.18em;
}

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip:focus {
  top: var(--space-3);
}

.view:focus {
  outline: none;
}

/* ---------- buttons and fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font: 600 var(--step--1) / 1.2 var(--font-text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 120ms var(--ease);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible {
  border-radius: var(--pill);
}

.btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.btn-primary {
  background: var(--basil);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--basil-deep);
}

.btn-quiet {
  background: transparent;
  border-color: var(--chip-border);
  color: var(--ink);
}

.btn-quiet:hover:not(:disabled) {
  border-color: var(--basil);
  color: var(--basil-deep);
}

.btn-danger {
  color: var(--tomato);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--tomato);
  color: var(--tomato);
}

.btn-wide {
  width: 100%;
  min-height: 2.875rem;
  font-size: var(--step-0);
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--basil-deep);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.linkish:hover:not(:disabled) {
  text-decoration-thickness: 2px;
}

.linkish:disabled {
  color: var(--ink-2);
  cursor: default;
}

.field {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.field-label {
  font-weight: 600;
  font-size: var(--step--1);
}

.field-hint {
  margin: 0;
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.4;
  max-width: 52ch;
}

.field-input {
  width: 100%;
  font: 400 var(--step-0) / 1.4 var(--font-text);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  margin-top: var(--space-1);
}

.field-input:focus-visible {
  border-color: var(--basil);
  border-radius: var(--radius-sm);
}

.field-input::placeholder {
  color: var(--ink-2);
  opacity: 0.8;
}

.field-notes {
  resize: vertical;
  min-height: 8rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.form-status {
  margin: 0;
  font-size: var(--step--1);
  color: var(--basil-deep);
  min-height: 1.4em;
}

.form-status.is-bad {
  color: var(--tomato);
}

/* ---------- the bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--bar-h);
  padding-inline: var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark-mark {
  width: 28px;
  height: 28px;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav a,
.nav-out {
  position: relative;
  padding: var(--space-2) var(--space-3);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--step--1);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.nav a:hover,
.nav-out:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

/* the active section is underlined by a short basil stroke */
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 0.1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--basil);
}

.nav-out {
  margin-left: var(--space-2);
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .bar .wordmark-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nav a,
  .nav-out {
    padding-inline: var(--space-2);
  }

  .nav a[aria-current="page"]::after {
    left: var(--space-2);
    right: var(--space-2);
  }

  .nav-out {
    margin-left: 0;
  }
}

.view {
  display: block;
  padding: var(--space-6) var(--gutter) var(--space-8);
}

.view-error {
  color: var(--tomato);
}

.page-head {
  max-width: 75rem;
  margin: 0 auto var(--space-6);
}

.page-title {
  font-size: var(--step-4);
}

/* ---------- the counter ---------- */

body[data-view="counter"] .view {
  padding-bottom: 0;
}

.counter {
  max-width: 90rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "talk"
    "card"
    "composer";
}

.counter:not(.has-card) {
  min-height: calc(100dvh - var(--bar-h) - var(--space-6));
  grid-template-rows: 1fr auto auto;
}

.talk {
  grid-area: talk;
  min-width: 0;
}

.card-col {
  grid-area: card;
  min-width: 0;
  margin-top: var(--space-5);
}

.composer {
  grid-area: composer;
}

@media (min-width: 900px) {
  .counter.has-card {
    grid-template-columns: minmax(20rem, 0.8fr) minmax(0, 1.2fr);
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "talk card"
      "composer card";
    column-gap: clamp(1.5rem, 3vw, 3rem);
    min-height: calc(100dvh - var(--bar-h) - var(--space-6));
  }

  .counter.has-card .card-col {
    margin-top: 0;
    position: sticky;
    top: calc(var(--bar-h) + var(--space-4));
    align-self: start;
    max-height: calc(100dvh - var(--bar-h) - var(--space-6));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 var(--space-2) var(--space-5);
    margin-inline: calc(-1 * var(--space-2));
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }

  .counter:not(.has-card) {
    max-width: 46rem;
  }
}

/* The first screen of a new conversation */

.intro {
  padding-block: clamp(2rem, 10vh, 6rem) var(--space-6);
}

.intro-title {
  font-size: var(--step-5);
  font-weight: 520;
  max-width: 14ch;
}

.intro-sub {
  margin: var(--space-4) 0 var(--space-6);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-2);
  color: var(--ink-2);
  max-width: 32ch;
  line-height: 1.35;
}

.intro-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-width: 40rem;
}

.example {
  font: 500 var(--step-0) / 1.25 var(--font-text);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: var(--pill);
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color 160ms var(--ease), color 160ms var(--ease), transform 120ms var(--ease);
}

.example:hover {
  border-color: var(--basil);
  color: var(--basil-deep);
}

.example:active {
  transform: scale(0.98);
}

.example:focus-visible {
  border-radius: var(--pill);
}

/* The conversation: the cook speaks in italic serif, the person in plain type on a paper slip */

.talk-log {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-top: var(--space-2);
}

.msg {
  max-width: 38rem;
  scroll-margin-top: calc(var(--bar-h) + var(--space-4));
  scroll-margin-bottom: 7rem;
}

.msg-cook-text {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}

.msg-cook {
  position: relative;
  padding-left: var(--space-5);
}

/* a small basil leaf in the margin marks the cook's voice */
.msg-cook::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 0 60% 0 60%;
  background: var(--basil);
  opacity: 0.85;
}

.msg-cook.is-writing .msg-cook-text::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.3em;
  border-radius: 50%;
  background: var(--saffron);
  vertical-align: 0.05em;
  animation: simmer 1.1s var(--ease) infinite;
}

@keyframes simmer {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.75);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.msg-me {
  align-self: flex-end;
  max-width: min(30rem, 88%);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  padding: var(--space-3) var(--space-4);
}

.msg-me-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-me-chose {
  margin: 0;
  font-size: var(--step--1);
  color: var(--ink-2);
}

.msg-me-text + .msg-me-chose {
  margin-top: var(--space-1);
}

.msg-error {
  margin: 0;
  max-width: 38rem;
  padding-left: var(--space-5);
  font-size: var(--step--1);
  color: var(--ink-2);
  position: relative;
}

.msg-error::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--tomato);
}

.notice {
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--saffron-tint);
  border-radius: var(--radius-sm);
  max-width: 38rem;
}

.notice p {
  margin: 0;
}

/* The composer, always at hand */

.composer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: var(--space-4) 0 var(--space-4);
  background: linear-gradient(to bottom, rgba(250, 246, 238, 0), var(--paper) 1.25rem);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: 1.4rem;
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  box-shadow: var(--shadow-2);
  transition: border-color 160ms var(--ease);
}

.composer-row:focus-within {
  border-color: var(--basil);
}

.composer-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  resize: none;
  font: 400 var(--step-0) / 1.45 var(--font-text);
  color: var(--ink);
  padding: 0.5rem 0;
  max-height: 12.5rem;
}

.composer-input:focus,
.composer-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.composer-input::placeholder {
  color: var(--ink-2);
}

.composer-input:disabled {
  background: transparent;
  color: var(--ink-2);
}

.composer-send,
.composer-stop {
  flex: none;
  min-width: 5.5rem;
}

.composer-send.is-apply {
  background: var(--basil-deep);
}

.btn-stop {
  background: var(--ink);
  color: var(--paper);
}

.btn-stop:hover {
  background: var(--tomato);
}

.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.token {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: 500 var(--step--1) / 1.2 var(--font-text);
  color: var(--ink);
  background: var(--saffron-tint);
  border: 1px solid var(--saffron);
  border-radius: var(--pill);
  padding: 0.35rem 0.6rem 0.35rem 0.65rem;
  cursor: pointer;
  animation: settle-in 220ms var(--ease);
}

.token:hover:not(:disabled) {
  background: #f7e6b4;
}

.token:focus-visible {
  border-radius: var(--pill);
}

.token-x {
  font-size: 1.05em;
  line-height: 1;
  color: var(--ink-2);
}

.pending-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--saffron);
  flex: none;
}

@keyframes settle-in {
  from {
    opacity: 0;
    transform: translateY(0.25rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The floating jump to the card, on one-column screens */

.recipe-jump {
  position: fixed;
  right: var(--gutter);
  bottom: 6.25rem;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.55rem 1rem;
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  box-shadow: var(--shadow-2);
}

.recipe-jump:focus-visible {
  border-radius: var(--pill);
}

.recipe-jump-dot {
  display: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--saffron);
}

.recipe-jump.has-dot .recipe-jump-dot {
  display: inline-block;
}

.card-slot:focus {
  outline: none;
}

/* ---------- the annotated recipe card ---------- */

.rcard {
  container: card / inline-size;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: var(--space-5) var(--space-5) var(--space-6);
  transition: opacity 260ms var(--ease), filter 260ms var(--ease);
}

.rcard.is-stale {
  opacity: 0.55;
  filter: saturate(0.6);
}

.rcard-head {
  position: relative;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
}

.rcard-head::after {
  /* the red rule of a recipe index card */
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-5));
  right: calc(-1 * var(--space-5));
  bottom: 0;
  height: 2px;
  background: var(--tomato);
  opacity: 0.55;
}

.rcard-title {
  font-size: var(--step-4);
  font-weight: 540;
  overflow-wrap: anywhere;
}

.rcard-summary {
  margin: var(--space-2) 0 0;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.4;
  max-width: 52ch;
}

.rcard-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-4);
}

.rcard-time {
  color: var(--ink-2);
  font-size: var(--step--1);
}

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

.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.stepper-label {
  font-size: var(--step--1);
  color: var(--ink-2);
  margin-right: var(--space-1);
}

.stepper-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: 500 var(--step-1) / 1 var(--font-text);
  cursor: pointer;
}

.stepper-btn:hover:not(:disabled) {
  border-color: var(--basil);
  color: var(--basil-deep);
}

.stepper-btn:focus-visible {
  border-radius: var(--pill);
}

.stepper-btn:disabled {
  color: var(--ink-3);
  cursor: default;
}

.stepper-value {
  min-width: 2ch;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 560;
}

.rcard-body {
  display: grid;
  gap: var(--space-6);
}

/* A wide card: ingredients on the left, the choices on the right, the method below both. */
@container card (min-width: 44rem) {
  .rcard-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-6);
  }

  .rcard-body .ings-wrap {
    grid-column: 1;
    grid-row: 1;
  }

  .rcard-body .yours {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .rcard-body .steps {
    grid-column: 1;
    grid-row: 2;
  }

  .rcard[data-mode="read"] .rcard-body .steps {
    grid-column: 2;
    grid-row: 1;
  }
}

/* Ingredients on ruled lines; a ring in the margin where a cook has a choice */

.ings-group {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: var(--step-1);
  margin: var(--space-4) 0 var(--space-2);
  color: var(--ink-2);
}

.ings-group:first-child {
  margin-top: 0;
}

.ings {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.ing {
  display: grid;
  grid-template-columns: 0.9rem 4.75rem minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-2);
  padding: 0.55rem var(--space-2) 0.55rem 0;
  border-bottom: 1px solid var(--line);
  border-radius: 2px;
  transition: background-color 200ms var(--ease), opacity 200ms var(--ease);
}

.ing-mark {
  align-self: start;
  justify-self: center;
  margin-top: 0.5em;
}

.ing-mark.has-mark,
.choice-mark {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 1.5px solid var(--saffron);
  transition: background-color 200ms var(--ease), transform 200ms var(--ease);
  flex: none;
}

.ing.is-lit {
  background: var(--saffron-tint);
}

.ing.is-lit .ing-mark,
.choice.is-lit .choice-mark,
.choice.has-pending .choice-mark {
  background: var(--saffron);
  transform: scale(1.15);
}

.ing-qty {
  font-weight: 600;
  white-space: nowrap;
  overflow-wrap: normal;
}

.ing-name {
  color: var(--ink);
}

.ing-optional {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
  font-size: var(--step--1);
  margin-left: var(--space-1);
}

.ing-note {
  display: block;
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.4;
}

/* a line the last change touched keeps a saffron tick in the margin */
.ing.is-changed,
.step.is-changed {
  box-shadow: inset 3px 0 0 var(--saffron);
}

.step.is-changed {
  border-radius: 2px;
}

/* the cook is rewriting: lines not reached yet are the old version, faded */
.is-ghost {
  opacity: 0.38;
}

.ing.is-new,
.step.is-new,
.note.is-new {
  animation: rewrite 1400ms var(--ease);
}

.ing.is-new .ing-text,
.ing.is-new .ing-qty,
.step.is-new .step-text {
  animation: settle 420ms var(--ease);
}

@keyframes rewrite {
  0%,
  35% {
    background-color: var(--saffron-tint);
  }
  100% {
    background-color: transparent;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateX(-0.4rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The method: a real sequence, so numbered */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: var(--space-3);
}

.step {
  counter-increment: step;
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  column-gap: var(--space-2);
  padding: 0.15rem var(--space-2) 0.15rem 0;
}

.step::before {
  content: counter(step);
  grid-row: 1 / span 2;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.35;
  color: var(--basil);
  text-align: center;
}

.step-text {
  line-height: 1.5;
}

.step-min {
  grid-column: 2;
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* Make it yours */

.yours-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: var(--step-2);
  margin-bottom: var(--space-2);
}

.choice {
  padding: var(--space-3) 0 var(--space-3);
  border-top: 1px dashed var(--line);
}

.yours-title + .choice {
  border-top: 0;
  padding-top: var(--space-1);
}

.choice-big {
  padding-bottom: var(--space-4);
}

.choice-q {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.choice-why {
  margin: var(--space-1) 0 var(--space-3);
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.4;
}

.choice-q + .chips,
.choice-q + .segmented {
  margin-top: var(--space-3);
}

.choice-hint {
  margin: var(--space-2) 0 0;
  min-height: 1.35em;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.35;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: 500 var(--step--1) / 1.2 var(--font-text);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: var(--pill);
  padding: 0.5rem 0.9rem;
  min-height: 2.25rem;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease),
    transform 160ms var(--ease);
}

.chip:hover:not(:disabled) {
  border-color: var(--basil);
}

.chip:active:not(:disabled),
.seg:active:not(:disabled) {
  transform: scale(0.97);
}

.chip[aria-pressed="true"] {
  background: var(--basil);
  border-color: var(--basil);
  color: #fff;
}

/* a pending change: outlined in saffron, with a dot; nothing is sent until Apply */
.chip.is-pending,
.chip.is-pending[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--saffron);
  padding: calc(0.5rem - 1px) calc(0.9rem - 1px);
}

/* the choice it would replace */
.chip.is-leaving {
  background: var(--basil-tint);
  border-color: var(--basil-tint);
  color: var(--basil-deep);
  text-decoration: line-through;
  text-decoration-color: rgba(43, 76, 40, 0.5);
}

.chip:disabled,
.seg:disabled {
  cursor: default;
}

.chip:focus-visible,
.seg:focus-visible {
  border-radius: var(--pill);
}

/* the big choice, which dish this is, as a segmented control */

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
  gap: 2px;
  padding: 3px;
  border-radius: 1.4rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  max-width: 100%;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: 600 var(--step--1) / 1.2 var(--font-text);
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--pill);
  padding: 0.55rem 1rem;
  min-height: 2.5rem;
  cursor: pointer;
  justify-content: center;
  text-align: center;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), transform 160ms var(--ease);
}

.seg:hover:not(:disabled) {
  color: var(--ink);
}

.seg[aria-pressed="true"] {
  background: var(--basil);
  color: #fff;
  box-shadow: var(--shadow-1);
}

.seg.is-pending,
.seg.is-pending[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--saffron);
}

.seg.is-leaving {
  background: var(--basil-tint);
  color: var(--basil-deep);
  text-decoration: line-through;
  text-decoration-color: rgba(43, 76, 40, 0.5);
}

.choice.is-ghost {
  opacity: 0.38;
}

/* Notes, nutrition and actions */

.notes {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: var(--space-4) 0 0;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: var(--space-3);
}

.note {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.5;
  max-width: 70ch;
}

.note::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.5em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--basil);
  opacity: 0.7;
}

.note[data-kind="cost"]::before {
  background: var(--saffron);
  opacity: 1;
}

.note[data-kind="safety"] {
  color: var(--ink);
}

.note[data-kind="safety"]::before {
  background: var(--tomato);
  border-radius: 1px;
  transform: rotate(45deg);
  opacity: 1;
}

.nutrition {
  margin: var(--space-4) 0 0;
  font-size: var(--step--1);
  color: var(--ink-2);
}

.nutrition-label {
  font-weight: 600;
  color: var(--ink);
}

.nutrition-note {
  display: block;
  font-style: italic;
  font-family: var(--font-display);
}

.rcard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.rcard-missing {
  margin-left: auto;
}

@media (max-width: 520px) {
  .rcard {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  .rcard-head::after {
    left: calc(-1 * var(--space-4));
    right: calc(-1 * var(--space-4));
  }

  .rcard-title {
    font-size: var(--step-3);
  }

  .ing {
    grid-template-columns: 0.9rem 4.25rem minmax(0, 1fr);
  }

  .rcard-missing {
    margin-left: 0;
  }
}

/* ---------- the book ---------- */

.book {
  max-width: 75rem;
  margin: 0 auto;
}

.book-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
}

.book-head .page-title {
  font-size: var(--step-5);
  font-weight: 520;
}

.book-tools {
  display: flex;
  flex: 0 1 30rem;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
}

.book-find {
  display: block;
  flex: 1 1 16rem;
  min-width: 0;
}

.book-search {
  margin: 0;
  border-radius: var(--pill);
  padding-inline: 1rem;
}

.book-search:focus-visible {
  border-radius: var(--pill);
}

.book-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
  gap: var(--space-5);
}

.book-card-link {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-5);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 200ms var(--ease), transform 200ms var(--ease);
}

.book-card-link:hover {
  box-shadow: var(--shadow-2);
}

.book-card-link:focus-visible {
  border-radius: var(--radius);
}

.book-card-title {
  font-size: var(--step-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 2px solid rgba(184, 64, 42, 0.45);
}

.book-card-summary {
  margin: 0 0 var(--space-4);
  color: var(--ink-2);
  font-size: var(--step--1);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-facts {
  margin: auto 0 0;
  display: flex;
  gap: var(--space-4);
  font-size: var(--step--1);
  font-weight: 600;
}

.tags {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tag {
  font-size: 0.8125rem;
  color: var(--ink-2);
  background: var(--paper-2);
  border-radius: var(--pill);
  padding: 0.1rem 0.6rem;
}

.book-empty {
  max-width: 32rem;
  padding: var(--space-7) 0;
}

.book-empty-text {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-2);
  line-height: 1.4;
  color: var(--ink-2);
}

.book-none {
  color: var(--ink-2);
}

.drafts {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px dashed var(--chip-border);
  max-width: 40rem;
}

.drafts-title {
  font-size: var(--step-3);
}

.drafts-sub {
  margin: var(--space-1) 0 var(--space-3);
  color: var(--ink-2);
  font-family: var(--font-display);
  font-style: italic;
}

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

.drafts-list li {
  border-bottom: 1px solid var(--line);
}

.drafts-list a {
  display: block;
  padding: var(--space-3) 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.drafts-list a:hover {
  color: var(--basil-deep);
}

/* ---------- a recipe ---------- */

.recipe-page {
  max-width: 60rem;
  margin: 0 auto;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

@media (max-width: 520px) {
  .recipe-actions .btn {
    padding-inline: 0.8rem;
  }

  .book-tools {
    flex-basis: 100%;
  }
}

.rename-input {
  font-family: var(--font-display);
  font-size: var(--step-3);
  margin: 0;
}

/* ---------- settings ---------- */

.settings {
  max-width: 42rem;
  margin: 0 auto;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.panel-title {
  font-size: var(--step-3);
  margin-bottom: var(--space-4);
}

.panel-note {
  margin: 0 0 var(--space-4);
  color: var(--ink-2);
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  margin: 0 0 var(--space-4);
}

.facts dt {
  font-weight: 600;
  font-size: var(--step--1);
}

.facts dd {
  margin: 0;
  font-size: var(--step--1);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.model-form {
  margin-bottom: var(--space-4);
}

.model-form .form-row {
  margin-bottom: var(--space-4);
}

.test-sample {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
}

/* ---------- sign-in and welcome ---------- */

.door {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-5) var(--space-4);
}

.door-main {
  width: min(25rem, 100%);
}

.door-wordmark {
  margin-bottom: var(--space-5);
}

.door-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: var(--space-6) var(--space-5) var(--space-5);
  position: relative;
}

.door-title {
  font-size: var(--step-4);
  font-weight: 520;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  position: relative;
}

.door-title::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-5));
  right: calc(-1 * var(--space-5));
  bottom: 0;
  height: 2px;
  background: var(--tomato);
  opacity: 0.55;
}

.door-sub {
  margin: calc(-1 * var(--space-2)) 0 var(--space-5);
  color: var(--ink-2);
  font-family: var(--font-display);
  font-style: italic;
}

.door-card .form-status {
  color: var(--tomato);
  margin-bottom: var(--space-3);
}

.door-card .form-status:empty {
  min-height: 0;
  margin: 0;
}

.door-small {
  margin: var(--space-5) 0 0;
  text-align: center;
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 0.8rem 0.7rem 1.2rem;
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--step--1);
  font-weight: 500;
  box-shadow: var(--shadow-2);
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.toast-action {
  background: none;
  border: 0;
  color: var(--saffron);
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.toast-action:focus-visible {
  box-shadow: 0 0 0 2px var(--saffron);
}

body[data-view="counter"] .toast {
  bottom: 6.5rem;
}

/* ---------- print: the card alone, at the chosen servings ---------- */

@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #fff;
  }

  .bar,
  .skip,
  .talk,
  .composer,
  .recipe-jump,
  .recipe-actions,
  .rcard-actions,
  .rcard-rebalance,
  .yours,
  .stepper-btn,
  .toast {
    display: none !important;
  }

  .view {
    padding: 0;
  }

  .counter,
  .counter.has-card {
    display: block;
    min-height: 0;
  }

  .counter .card-col,
  .counter.has-card .card-col {
    position: static;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .rcard {
    box-shadow: none;
    padding: 0;
    opacity: 1;
    filter: none;
  }

  .rcard-head::after {
    left: 0;
    right: 0;
  }

  .ing,
  .step,
  .note {
    break-inside: avoid;
    animation: none !important;
    box-shadow: none !important;
  }

  .is-ghost {
    opacity: 1;
  }
}

.door-google {
  margin-top: 10px;
  gap: 10px;
}
.door-google[hidden] {
  display: none;
}
