/* Tupperware pantry prototype. Tokens follow ~/.claude/brand-kits/tupperware (brand brain).
   Shape rule: buttons and chips are pills, surfaces and images are 20px, thumbnails 12px. */

@font-face {
  font-family: "Heebo";
  src: url(fonts/heebo-hebrew-wght-normal.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo";
  src: url(fonts/heebo-latin-wght-normal.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face { font-family: "Earl Tupper Sans"; src: url(fonts/EarlTupperSans-Black-900.otf) format("opentype"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Earl Tupper Sans"; src: url(fonts/EarlTupperSans-Regular-400.otf) format("opentype"); font-weight: 400; font-display: swap; }

:root {
  --green: #00524F;
  --green-dark: #00332F;
  --green-tint: #E6F2F1;
  --orange: #FF7500;
  --aqua: #7BD6DC;
  --aqua-dark: #62ABB0;
  --aqua-tint: #D7F3F4;
  --wash: #F2FBFC;
  --surface: #FFFFFF;
  --ink: #12302E;
  --ink-soft: #3F5C5A;
  --line: #CFE3E2;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgb(0 51 47 / .06), 0 8px 24px -12px rgb(0 51 47 / .22);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --col: 34rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: clip;
  min-height: 100dvh;
  background: var(--wash);
  color: var(--ink);
  font: 400 1rem/1.6 "Heebo", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
html { scrollbar-color: var(--aqua-dark) var(--wash); }
::selection { background: var(--aqua); color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--aqua-dark); outline-offset: 3px; border-radius: 8px; }
button, label.btn { font: inherit; }

/* ---------- header band ---------- */
.band {
  position: sticky; top: 0; z-index: 10;
  background: var(--green);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.band-inner {
  max-width: var(--col); margin: 0 auto;
  display: flex; align-items: baseline; gap: .75rem;
  padding: .85rem 1rem .9rem;
}
.wordmark { font: 900 1.35rem/1 "Earl Tupper Sans", "Heebo", sans-serif; letter-spacing: -.01em; }
.band-title { font-weight: 300; font-size: 1rem; opacity: .9; white-space: nowrap; }
.restart {
  margin-inline-start: auto; align-self: center; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgb(255 255 255 / .12); color: #fff; border: 0;
  border-radius: 999px; padding: .35rem .8rem; font-size: .875rem; cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.restart:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .restart:hover { background: rgb(255 255 255 / .2); } }

/* ---------- icons (Phosphor, masked so they take the text color) ---------- */
.ic {
  display: inline-block; width: 1.25em; height: 1.25em; flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

/* ---------- thread ---------- */
.thread {
  max-width: var(--col); margin: 0 auto;
  padding: 1.5rem 1rem calc(7rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 1.75rem;
}
.msg {
  display: grid; grid-template-columns: 2.25rem 1fr; gap: .75rem; align-items: start;
  opacity: 1; transform: none;
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out);
}
@starting-style { .msg:not(#welcome) { opacity: 0; transform: translateY(8px); } }
.avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green); color: #fff;
  font: 900 1.1rem/1 "Earl Tupper Sans", sans-serif;
}
.msg-body { min-width: 0; }
.msg-body > p { margin: 0 0 .9rem; max-width: 60ch; color: var(--ink); }
.lead {
  margin: .1rem 0 .6rem;
  font-size: clamp(1.5rem, 5.5vw, 1.9rem); line-height: 1.2; font-weight: 800;
  color: var(--green); text-wrap: balance;
}
.msg h2 { margin: .1rem 0 .35rem; font-size: 1.15rem; line-height: 1.35; font-weight: 700; text-wrap: balance; }
.muted { color: var(--ink-soft); font-size: .9rem; }

/* user photo message */
.msg.user { grid-template-columns: 1fr; justify-items: end; }
.msg.user img {
  width: min(62%, 15rem); aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 20px; box-shadow: var(--shadow); display: block;
}

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .25rem 0 .9rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.25rem;
  border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 600; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px -8px rgb(0 82 79 / .7); }
.btn-quiet { background: var(--surface); color: var(--green); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-cart { background: var(--orange); color: var(--green-dark); font-weight: 800; }
.btn[disabled] { opacity: .5; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--green-dark); }
  .btn-quiet:hover { box-shadow: inset 0 0 0 1.5px var(--aqua-dark); }
  .btn-cart:hover { background: #FF8A26; }
}
.link {
  background: none; border: 0; padding: .25rem 0; cursor: pointer;
  color: var(--green); font-weight: 500; font-size: .95rem;
  text-decoration: underline; text-underline-offset: .25em; text-decoration-color: var(--aqua-dark);
}
/* ---------- typing ---------- */
.typing .msg-body { display: flex; align-items: center; gap: .6rem; padding-top: .35rem; }
.typing-text { margin: 0 !important; color: var(--ink-soft); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--aqua-dark); animation: blink 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- recognized items: chips by shelf ---------- */
.shelves { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; margin: .4rem 0 1rem; }
.shelf-name { font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin: 0 0 .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 2.5rem; max-width: 100%;
  padding: .4rem .85rem .4rem .7rem;
  border-radius: 999px; border: 0; cursor: pointer;
  background: var(--green-tint); color: var(--ink);
  font: 500 .95rem/1.25 "Heebo", sans-serif; text-align: start;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease;
}
.chip:active { transform: scale(.96); }
.chip .ic { width: 1.05rem; height: 1.05rem; color: var(--green); }
.chip-name { min-width: 0; overflow-wrap: anywhere; }
.chip-count { flex: none; }
.chip .ic { flex: none; }
.chip-count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="false"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-soft); }
.chip[aria-pressed="false"] .chip-name { text-decoration: line-through; text-decoration-color: var(--ink-soft); }
.chip[aria-pressed="false"] .ic { color: var(--ink-soft); }
/* ---------- plan ---------- */
.plan {
  min-width: 0;
  margin: .5rem 0 .9rem; padding: .35rem 0;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  list-style: none;
}
.line {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: .25rem .8rem; align-items: center;
  padding: .8rem .9rem;
}
.line + .line { border-top: 1px solid var(--line); }
.line img {
  grid-row: 1 / span 3; align-self: start; width: 3.5rem; height: 3.5rem; object-fit: contain;
  border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
}
.line-title { min-width: 0; overflow-wrap: anywhere; grid-column: 2; font-weight: 600; line-height: 1.3; font-size: .98rem; }
.line-title a { color: inherit; text-decoration: none; }
.line-for { grid-column: 2; font-size: .875rem; color: var(--ink-soft); line-height: 1.4; }
.line-foot { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem; margin-top: .25rem; }
.line-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stepper {
  display: inline-flex; align-items: center; gap: .1rem;
  background: var(--green-tint); border-radius: 999px; padding: .15rem;
}
.stepper button {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--green);
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.stepper button:active { transform: scale(.9); }
.stepper button .ic { width: 1rem; height: 1rem; }
.stepper output { min-width: 1.4rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.line.removed { opacity: .45; }
.skipped { overflow-wrap: anywhere; margin: 0 0 .9rem; font-size: .9rem; color: var(--ink-soft); }
.skipped strong { color: var(--ink); font-weight: 600; }

/* ---------- before / after ---------- */
.compare {
  position: relative; margin: .5rem 0 .6rem;
  border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  aspect-ratio: 3 / 4; background: var(--green-tint);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  --pos: 50%;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-touch-callout: none; }
/* RTL: the organized image sits on the right, revealed from the right edge */
.compare .after { clip-path: inset(0 0 0 calc(100% - var(--pos))); }
.compare .handle {
  position: absolute; top: 0; bottom: 0; right: var(--pos); width: 0;
  pointer-events: none;
}
.compare .handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgb(0 51 47 / .15); }
.compare .knob {
  position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: #fff; color: var(--green); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgb(0 51 47 / .3);
}
.compare .knob .ic { width: 1.4rem; height: 1.4rem; }
.compare .tag {
  position: absolute; bottom: .75rem; padding: .25rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: rgb(0 51 47 / .72); color: #fff;
  pointer-events: none;
}
.compare .tag-after { right: .75rem; }
.compare .tag-before { left: .75rem; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare.sweep .after { transition: clip-path 1100ms var(--ease-in-out); }
.compare.sweep .handle { transition: right 1100ms var(--ease-in-out); }

.render-wait {
  margin: .5rem 0 .6rem; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; position: relative;
  background: var(--green-tint);
}
.render-wait img { width: 100%; height: 100%; object-fit: cover; filter: blur(6px) saturate(.6); opacity: .55; transform: scale(1.04); }
.render-wait p {
  position: absolute; inset: auto 1rem 1rem; margin: 0; padding: .6rem .9rem;
  background: var(--surface); border-radius: 14px; font-size: .95rem; box-shadow: var(--shadow);
}
.render-wait .bar { display: block; height: 3px; margin-top: .5rem; border-radius: 3px; background: var(--line); overflow: hidden; }
.render-wait .bar::after { content: ""; display: block; height: 100%; width: 100%; background: var(--green); transform-origin: right; animation: fill 40s linear forwards; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(.95); } }

/* ---------- errors ---------- */
.error { display: flex; gap: .5rem; align-items: flex-start; color: var(--danger); margin: 0 0 .8rem; }
.error .ic { margin-top: .2rem; }

/* ---------- cart bar ---------- */
.cartbar {
  position: fixed; inset: auto 0 0; z-index: 10;
  background: var(--green-dark); color: #fff;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(0);
  transition: transform 320ms var(--ease-out);
}
@starting-style { .cartbar { transform: translateY(100%); } }
.cartbar[hidden] { display: none; }
.cartbar-inner { max-width: var(--col); margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; }
.cart-sum { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cart-count { font-size: .85rem; opacity: .85; }
.cart-total { font-size: clamp(1.05rem, 4.6vw, 1.3rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.cartbar .btn-cart { margin-inline-start: auto; flex: none; padding-inline: 1rem; }
.cartbar-inner { gap: .75rem; }
.cartbar { contain: inline-size; overflow: hidden; }
.cart-total { white-space: nowrap; }

.note { font-size: .8rem; color: var(--ink-soft); margin: .25rem 0 0; }

@media (prefers-reduced-motion: reduce) {
  .msg, .cartbar, .compare.sweep .after, .compare.sweep .handle { transition: opacity 200ms ease; transform: none; }
  @starting-style { .msg { transform: none; } .cartbar { transform: none; } }
  .dots i { animation: none; opacity: .6; }
  .render-wait .bar::after { animation: none; transform: scaleX(.5); }
}

.btn-cart.is-empty { opacity: .5; pointer-events: none; }
@media (max-width: 400px) {
  .band-inner:has(.restart:not([hidden])) .band-title { display: none; }
}
/* Keep the whole before/after in view on short, wide screens. */
.compare, .render-wait { width: min(100%, calc(72dvh * .75)); margin-inline: auto; }

/* Narrow phones: content blocks use the avatar gutter too, so lists keep their measure. */
@media (max-width: 400px) {
  .thread { padding-inline: .75rem; }
  .msg { grid-template-columns: 1.75rem 1fr; gap: .6rem; }
  .avatar { width: 1.75rem; height: 1.75rem; font-size: .9rem; }
  .shelves, .plan, .compare, .render-wait { margin-inline-start: -2.35rem; }
  .compare, .render-wait { width: auto; }
}

/* Opening frame: a real before/after from the sample photo, so the promise is visible before anyone taps. */
.teaser {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  margin: 1.5rem 0 0; padding: .6rem; border-radius: 20px;
  background: var(--green);
}
.teaser figure { margin: 0; position: relative; }
.teaser img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; }
.teaser figcaption {
  position: absolute; bottom: .5rem; inset-inline-start: .5rem;
  padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: #FFE5AA; color: var(--green-dark);
}
.teaser p { grid-column: 1 / -1; margin: .1rem .2rem 0; color: #fff; font-size: .85rem; opacity: .9; }

/* =====================================================================================
   v2 (2026-11-18): מזווה בקליק. Critique fixes: image follows the cart, the flow stops on the plan,
   a playful wait, a finale that ends on the pantry, 44px targets, a visible focus ring, no text under 14px.
   ===================================================================================== */
:focus-visible { outline-color: var(--green); }
.band :focus-visible, .cartbar :focus-visible, .finale :focus-visible { outline-color: var(--aqua); }
.band-title { font-weight: 400; opacity: 1; }
.band-title b { font-weight: 800; color: var(--aqua); }
.restart { min-height: 2.75rem; padding-inline: .9rem; }
@media (max-width: 400px) {
  .band-inner:has(.restart:not([hidden])) .band-title { display: inline; }
  .restart span { display: none; }
  .restart { width: 2.75rem; padding: 0; justify-content: center; }
}

/* text floor */
.note, .privacy { font-size: .875rem; }
.shelf-name, .cart-count, .compare .tag, .teaser figcaption { font-size: .875rem; }
.privacy { color: var(--ink-soft); margin: .75rem 0 0; max-width: 60ch; line-height: 1.5; }
.privacy a { color: var(--green); text-underline-offset: .2em; text-decoration-color: var(--aqua-dark); }

/* targets */
.chip { min-height: 2.75rem; }

/* ---------- plan rows lead with the food, product name second ---------- */
.line { grid-template-columns: 4.5rem minmax(0, 1fr); gap: .15rem .85rem; }
.line img {
  width: 4.5rem; height: 4.5rem; padding: .3rem; object-fit: contain;
  background: var(--aqua-tint); box-shadow: none; border-radius: 14px;
}
.line-for { grid-column: 2; grid-row: 1; font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.35; }
.line-title { grid-row: 2; font-size: .9rem; font-weight: 500; color: var(--ink-soft); }
.line-title a { display: inline-block; padding-block: .3rem; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .2em; }
.line-foot { grid-row: 3; }
.line-price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.line-price .unit { font-size: .875rem; font-weight: 400; color: var(--ink-soft); }
.line-price strong { font-size: 1.05rem; }
.line.removed .stepper button[data-d="1"] { opacity: 1; }
.line.removed { opacity: 1; }
.line.removed > :not(.line-foot), .line.removed .line-price { opacity: .45; }

.to-render { display: block; margin-top: .9rem; }
.to-render.ready { color: var(--green); font-weight: 700; animation: nudge 600ms var(--ease-out) 1; }
@keyframes nudge { 0% { transform: translateY(0); } 35% { transform: translateY(-3px); } 100% { transform: translateY(0); } }

/* ---------- the wait: your own shelves, with the chosen containers clicking in ---------- */
.render-wait .ghost { width: 100%; height: 100%; object-fit: cover; filter: blur(8px) saturate(.5); opacity: .5; transform: scale(1.06); }
.render-wait img:not(.ghost) { filter: none; opacity: 1; transform: none; }
.incoming {
  position: absolute; inset: 1rem 1rem 6.5rem; margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); align-content: center; gap: .6rem;
}
.incoming li {
  aspect-ratio: 1; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; padding: .4rem;
  opacity: 0; transform: scale(.85) translateY(6px);
  animation: click-in 260ms var(--ease-out) forwards;
  animation-delay: calc(var(--d) * 1.6s + .4s);
}
.incoming li img { width: 100%; height: 100%; object-fit: contain; }
@keyframes click-in {
  60% { opacity: 1; transform: scale(1.04) translateY(0); }
  100% { opacity: 1; transform: none; }
}
.render-wait p { display: flex; flex-direction: column; gap: .15rem; }
.render-wait p small { font-size: .875rem; color: var(--ink-soft); }
.wait-line { font-weight: 700; color: var(--green); }
.wait-line.swap { animation: swap-in 240ms var(--ease-out); }
@keyframes swap-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.render-wait .bar { display: none; }

/* ---------- the picture is out of date ---------- */
.stale-bar {
  position: absolute; inset: auto .75rem 3rem; z-index: 2;
  display: none; flex-direction: column; gap: .55rem; align-items: flex-start;
  padding: .8rem .9rem; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
  font-size: .95rem; font-weight: 600; color: var(--ink);
}
.compare.stale .stale-bar { display: flex; animation: swap-in 240ms var(--ease-out); }
.compare.stale .after { filter: grayscale(.6) brightness(.95); }
.btn-sm { min-height: 2.75rem; padding: .5rem 1rem; font-size: .95rem; }

/* ---------- finale: end on the pantry, then the cart ---------- */
.finale {
  margin: 1rem 0 .5rem; padding: 1.4rem 1.25rem 1.3rem; border-radius: 24px;
  background: var(--green); color: #fff; box-shadow: var(--shadow);
}
.finale-title { margin: 0 0 .35rem; font-size: clamp(1.7rem, 7vw, 2.2rem); font-weight: 900; line-height: 1.1; letter-spacing: -.01em; }
.finale-title span { color: var(--aqua); }
.finale-sub { margin: 0 0 1rem; color: #fff; opacity: .92; max-width: 40ch; }
.finale-sub b { font-variant-numeric: tabular-nums; }
.btn-lg { min-height: 3.4rem; width: 100%; font-size: 1.1rem; }
.btn-cart.is-empty { opacity: .5; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .incoming li { animation: none; opacity: 1; transform: none; }
  .wait-line.swap, .compare.stale .stale-bar, .to-render.ready { animation: none; }
}
