/* Food Mom · Kitchen notebook + Preeti's colours
   Fraunces: SIL Open Font License 1.1 (/fonts/OFL.txt), served locally with zero CDN requests. */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: var(--tg-theme-bg-color, #fcfbf6);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --ink: var(--tg-theme-text-color, #1d211e);
  --green: #3d6a43;
  --deep: #2a4d30;
  --citrus: #f4a73a;
  --cdeep: #8a4f00;
  --danger: #a3361f;
  --danger-wash: #fde9e4;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--paper));
  --faint: color-mix(in srgb, var(--ink) 40%, var(--paper));
  --line: color-mix(in srgb, var(--ink) 11%, var(--paper));
  --wash: color-mix(in srgb, var(--ink) 4%, var(--paper));
  --green-wash: color-mix(in srgb, var(--green) 9%, var(--paper));
  --citrus-wash: color-mix(in srgb, var(--citrus) 15%, var(--paper));
  --side: 20px;
  --gap: 28px;
  --tap: 44px;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --disp: "Fraunces", Georgia, serif;
}

html.tg-dark {
  --green: #487d4f;
  --deep: #9ad8a1;
  --cdeep: #f7c66f;
  --danger: #ff9b87;
  --danger-wash: #3d201c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

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

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  min-height: var(--tap);
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.disp,
h1,
.bubble b,
.card-title {
  font-family: var(--disp);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-optical-sizing: auto;
}

/* App shell: edge-to-edge on 390px phone, calm centered notebook on 1440px desktop */
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding: 10px var(--side) calc(48px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 860px) {
  body {
    background:
      radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--green) 8%, transparent) 1px, transparent 1.6px) 0 0 / 22px 22px,
      var(--wash);
  }

  .shell {
    padding: 28px 24px 44px;
  }

  .app {
    flex: 0 1 auto;
    min-height: min(760px, calc(100dvh - 72px));
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 22px 36px 48px;
    box-shadow: 0 18px 44px -28px rgba(29, 33, 30, 0.25);
  }
}

/* Top bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 12px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--deep);
  min-height: var(--tap);
}

.mark,
.mom-s,
.gatemom {
  display: block;
  flex: none;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--citrus);
  overflow: hidden;
}

.mark svg,
.mom-s svg,
.gatemom svg,
.bigmom svg {
  width: 100%;
  height: 100%;
  display: block;
}

.me-pill {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: var(--green-wash);
  color: var(--deep);
  border: 1px solid var(--line);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
  min-height: var(--tap);
  padding-right: 12px;
}

.back svg {
  width: 9px;
  height: 15px;
  flex: none;
}

.textbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--green);
  font-weight: 600;
  font-size: 14.5px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.textbtn:hover {
  background: var(--green-wash);
}

.tg .back,
.tg .top.backonly {
  display: none;
}

.tg .brand {
  visibility: hidden;
}

/* Type */
h1 {
  font-size: 30px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 14px 0 6px;
  color: var(--deep);
}

h2 {
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--green);
  margin: var(--gap) 0 8px;
}

.lede {
  font-size: 15px;
  line-height: 22px;
  color: var(--muted);
  margin: 0;
}

.lede strong,
.lede b {
  color: var(--ink);
}

/* Small Food Mom voice line */
.momline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.mom-s {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--citrus);
  overflow: hidden;
}

.momline p {
  margin: 0;
  font-size: 15px;
  line-height: 21px;
  color: var(--muted);
  font-style: italic;
}

/* Home mascot greeting */
.greet {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 10px;
}

.bigmom {
  width: 118px;
  height: 132px;
  flex: none;
}

.bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 104px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 18px 18px 18px 4px;
  display: flex;
  align-items: center;
  overflow-wrap: break-word;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--citrus) 45%, transparent);
}

.bubble b {
  display: block;
  font-size: 20px;
  line-height: 25px;
  font-weight: 700;
  color: var(--deep);
}

.bubble span {
  display: block;
  font-size: 14.5px;
  line-height: 20px;
  color: var(--muted);
  margin-top: 4px;
}

.dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  animation: dotpulse 1s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dotpulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dots i,
  .spin {
    animation: none;
  }
}

/* Safe dish chips under greeting */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.dish-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--citrus) 65%, var(--paper));
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.dish-chip:hover {
  background: var(--citrus-wash);
  border-color: var(--citrus);
}

.dish-chip small {
  font-weight: 500;
  color: var(--muted);
  font-size: 12.5px;
}

.sublink-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap);
  color: var(--green);
  font-weight: 600;
  font-size: 14.5px;
}

/* Preeti's 3-box home (one calm bordered group, no tab bar) */
.boxes {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.box {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 74px;
  padding: 12px 16px;
  text-align: left;
  border-top: 1px solid var(--line);
  transition: background 0.12s ease;
}

.box:first-child {
  border-top: 0;
}

.box:hover {
  background: var(--green-wash);
}

.box .ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-wash);
  color: var(--green);
  display: grid;
  place-items: center;
  flex: none;
}

.box .ic svg {
  width: 22px;
  height: 22px;
}

.box .t {
  flex: 1;
  min-width: 0;
}

.box .t b {
  display: block;
  font-size: 17px;
  line-height: 22px;
  font-weight: 650;
  color: var(--ink);
}

.box .t span {
  display: block;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
  margin-top: 2px;
}

.chev {
  color: var(--faint);
  font-size: 22px;
  line-height: 1;
  flex: none;
}

/* Rows */
.rows {
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.row-stack {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.row-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
}

.row .t,
.row-head .t {
  flex: 1;
  min-width: 0;
}

.row .t b,
.row-head .t b {
  display: block;
  font-size: 16.5px;
  line-height: 22px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: break-word;
}

.row .t span,
.row-head .t span {
  display: block;
  font-size: 13.5px;
  line-height: 19px;
  color: var(--muted);
  overflow-wrap: break-word;
}

.row .r {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.row .r.soon {
  color: var(--ink);
  font-weight: 600;
}

.row .r.soon::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--citrus);
  margin-right: 7px;
  vertical-align: 1px;
}

.ok {
  color: var(--green);
  font-weight: 600;
}

/* Custom circular tick (44px tap area on row/button, 26px visible mark) */
.tick {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
  flex: none;
  display: grid;
  place-items: center;
  color: transparent;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.tick svg {
  width: 14px;
  height: 14px;
}

.is-done .tick,
.is-stocked .tick {
  border-color: var(--green);
  background: var(--green-wash);
  color: var(--green);
}

.is-done .t b {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: var(--line);
}

/* Buttons & pills */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--green);
  color: #ffffff;
  font-weight: 650;
  font-size: 16.5px;
  margin-top: 22px;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--citrus) 80%, var(--deep));
}

.primary:hover {
  background: var(--deep);
}

.primary[disabled],
[aria-busy="true"] {
  opacity: 0.72;
  pointer-events: none;
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: 12px;
  background: var(--green-wash);
  color: var(--deep);
  font-weight: 600;
  font-size: 14.5px;
}

.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  color: var(--muted);
  font-size: 15px;
  margin-top: 10px;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--citrus-wash);
  color: var(--cdeep);
}

.pill-tag.green {
  background: var(--green-wash);
  color: var(--deep);
}

/* Label-check & callout strips */
.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  background: var(--citrus-wash);
  border: 1px solid color-mix(in srgb, var(--citrus) 45%, var(--paper));
  border-radius: 14px;
  padding: 11px 14px;
  margin-top: 16px;
}

.note .ni {
  flex: none;
  font-weight: 700;
  color: var(--cdeep);
}

.note ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.alert-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--danger-wash);
  color: var(--danger);
  font-size: 14.5px;
  line-height: 20px;
  font-weight: 500;
}

.rules-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 22px;
  color: var(--ink);
}

/* Dish drawings */
.dish {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 12px;
  background: var(--wash);
  display: grid;
  place-items: center;
}

.dish svg {
  width: 40px;
  height: 40px;
}

.dish.big {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  margin-top: 12px;
}

.dish.big svg {
  width: 68px;
  height: 68px;
}

/* Recipe card */
.meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 14.5px;
  color: var(--muted);
  margin-top: 6px;
}

.meta-row b {
  color: var(--ink);
}

.steps {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 12px 0;
  font-size: 16px;
  line-height: 24px;
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  flex: none;
  width: 24px;
  font-weight: 700;
  color: var(--green);
}

.tip-box {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--green-wash);
  font-size: 14.5px;
  line-height: 21px;
  color: var(--ink);
}

/* Menu card */
.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.menu-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.day-card.is-today {
  border-color: var(--green);
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.day-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--deep);
}

.day-head small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.row-head a[data-slot-link] {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.swap-panel {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--wash);
  border: 1px solid var(--line);
}

.swap-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.swap-form select {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  flex: 1 1 180px;
  min-width: 0;
  min-height: var(--tap);
  height: var(--tap);
  padding: 8px 10px;
  padding-right: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' viewBox='0 0 14 8'%3E%3Cpath d='m1 1 6 6 6-6' fill='none' stroke='%23687569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px 8px;
  font-size: 16px;
}

@media (max-width: 640px) {
  .swap-form select {
    flex: none;
    width: 100%;
  }

  .swap-panel {
    padding-inline: 4px;
  }
}

.swap-form button {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 10px;
  background: var(--green);
  color: #ffffff;
  font-weight: 600;
  font-size: 14.5px;
}

.slot-error {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--danger);
  font-weight: 500;
}

/* Gate screens */
.gate-wrap {
  max-width: 460px;
  margin: 28px auto 0;
}

.gatemom {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--citrus);
  overflow: hidden;
}

/* Busy spinner + toast */
.busy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 15px;
  margin-top: 14px;
  min-height: 24px;
}

.spin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex: none;
}

.btn-spin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: #1d211e;
  color: #fcfbf6;
  font-size: 14.5px;
  line-height: 20px;
  padding: 12px 18px;
  border-radius: 12px;
  max-width: min(360px, calc(100vw - 32px));
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty-card {
  margin-top: 18px;
  padding: 24px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.empty-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
}

.unchecked-banner,
.unchecked-section {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--citrus-wash);
  border: 1px solid color-mix(in srgb, var(--cdeep) 24%, var(--line));
}

.unchecked-banner b {
  display: block;
  color: var(--cdeep);
  font-size: 15px;
  line-height: 20px;
}

.unchecked-banner span {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
}

.unchecked-section h2 {
  margin-top: 0;
  color: var(--cdeep);
}

.unchecked-section .t b,
.unchecked-section .t span {
  white-space: pre-wrap;
}
