/*
  Ketzefet Patisserie (demo) - art direction
  Scene:   a pastry counter after closing time. One cake under a warm lamp
           in a dark room, then the lights come on over the cream counter
           where the box is packed.
  Palette: black cherry night for the cake's stage; cream, blush and
           chocolate ink for the counter; raspberry for the main action;
           gold only as hairlines.
  Type:    Bona Nova (display serif with a true italic, Hebrew + Latin),
           Rubik (text).
  Shape:   round and soft: pills, scalloped edges, paper cups.
*/

:root {
  --night: #1d0d10;
  --night-2: #3a141d;
  --cream: #fbf3ea;
  --card: #fffaf3;
  --ink: #2a1512;
  --ink-soft: #6d514b;
  --line: rgba(42, 21, 18, 0.18);
  --blush: #f2c9c4;
  --berry: #a51f3f;
  --gold: #c39a45;
  --display: 'Bona Nova', 'Times New Roman', serif;
  --text: 'Rubik', system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 3.5rem);
}

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

html {
  background: var(--night);
  scroll-padding-bottom: 11rem;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: clip;
}

h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
em { font-style: italic; }

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

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

.ribbon-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.4rem var(--gutter);
  background: #12070a;
  color: var(--cream);
  font-size: 0.875rem;
  text-align: center;
}
.ribbon-bar a:focus-visible { outline-color: var(--cream); }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  position: relative;
  z-index: 3;
  block-size: 4.5rem;
  padding: 1rem var(--gutter) 0.75rem;
  color: var(--cream);
}
.brand { color: #d9b9b3; letter-spacing: 0.04em; }
.brand strong {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--cream);
  margin-inline-end: 0.3em;
}
.lang { padding: 0.5rem 0; text-underline-offset: 0.3em; }
.top :focus-visible { outline-color: var(--cream); }

/* ---------- The cake's stage ---------- */

.story {
  position: relative;
  /* The header floats over the top of the stage, so the stage fills the first screen. */
  margin-top: -4.5rem;
  block-size: 480vh;
  background: var(--night);
  color: var(--cream);
}
.stage {
  position: sticky;
  top: 0;
  block-size: 100vh;
  block-size: 100svh;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 58%, rgba(255, 196, 150, 0.2), transparent 70%),
    radial-gradient(90% 70% at 50% 100%, var(--night-2), transparent 75%),
    var(--night);
}
#cake {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.stage.is-live #cake { opacity: 1; }

.stage-head {
  position: absolute;
  inset-inline: 0;
  top: clamp(7.2rem, 17vh, 9.5rem);
  z-index: 2;
  padding-inline: var(--gutter);
  text-align: center;
  pointer-events: none;
}
h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5.6rem);
  line-height: 1;
  text-wrap: balance;
}
h1 em, .order h2 em { color: #f0b9a8; }
.stage-head .lede {
  margin: 0.9rem auto 0;
  max-inline-size: 34ch;
  color: #dcc2bb;
}

.tags {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.tag {
  position: absolute;
  left: 0;
  top: 0;
  inline-size: 0;
  block-size: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform;
}
.tag.is-on { opacity: 1; }
/* A dot on the layer, a hairline, then the name. Left of the cake in Hebrew. */
.tag::after {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--paint);
  box-shadow: 0 0 0 1.5px var(--cream);
}
.tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: calc(var(--lead) * -1);
  inline-size: var(--lead);
  block-size: 1px;
  background: linear-gradient(to left, var(--cream), var(--gold));
  opacity: 0.8;
}
.tag span {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  transform: translate(calc(-100% - var(--lead) - 0.5rem), -50%);
  font-size: var(--tag-size);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}
.tags { --lead: 1.2rem; --tag-size: 0.8125rem; }
[dir='ltr'] .tag::before {
  left: 0;
  background: linear-gradient(to right, var(--cream), var(--gold));
}
[dir='ltr'] .tag span { transform: translate(calc(var(--lead) + 0.5rem), -50%); }

.caption {
  position: absolute;
  inset-inline: 0;
  bottom: 3.4rem;
  z-index: 2;
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  margin-inline: auto;
  inline-size: min(32rem, calc(100% - 2rem));
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(195, 154, 69, 0.45);
  border-radius: 1.2rem;
  background: rgba(29, 13, 16, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-align: center;
  min-block-size: 4.6rem;
  align-content: center;
}
.caption strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.15;
}
.caption strong:empty { display: none; }
.caption.is-layer strong::before {
  content: '';
  display: inline-block;
  inline-size: 0.6em;
  block-size: 0.6em;
  margin-inline-end: 0.45em;
  border-radius: 50%;
  background: var(--paint);
  box-shadow: 0 0 0 1.5px var(--cream);
}
.caption span { color: #e3cbc4; font-size: 0.9375rem; }

.scroll-hint {
  position: absolute;
  inset-inline: 0;
  bottom: 0.9rem;
  z-index: 2;
  text-align: center;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  color: #cfae79;
}
.scroll-hint::after {
  content: '';
  display: block;
  inline-size: 1px;
  block-size: 0.9rem;
  margin: 0.2rem auto 0;
  background: currentColor;
  animation: nudge 1.6s ease-in-out infinite;
  transform-origin: top;
}
@keyframes nudge {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.fallback { padding: 2rem var(--gutter); text-align: center; }

/* Without 3D: the layers as a still stack of bands. */
.story.no-3d { block-size: auto; }
.no-3d .stage {
  position: static;
  block-size: auto;
  padding: 2rem var(--gutter) 3rem;
}
.no-3d .stage-head { position: static; }
.no-3d #cake, .no-3d .tags, .no-3d .scroll-hint { display: none; }
.no-3d .caption { position: static; margin-top: 1.5rem; }
.flat-cake {
  display: grid;
  gap: 4px;
  inline-size: min(24rem, 100%);
  margin: 2rem auto 0;
}
.band {
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  background: var(--paint);
  color: #fff;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.5);
}

/* ---------- The counter: box builder ---------- */

.order {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding: 3.5rem var(--gutter) 3rem;
  background: var(--cream);
}
/* A scalloped cream edge over the dark stage, like piped cream. */
.order::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: -19px;
  block-size: 20px;
  background: radial-gradient(circle at 20px 20px, var(--cream) 19.5px, transparent 20px) repeat-x;
  background-size: 40px 20px;
}

.show { text-align: center; }
.order h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.1rem, 6.5vw, 3.6rem);
  line-height: 1.05;
  text-wrap: balance;
}
.order h2 em { color: var(--berry); }
.show .lede {
  margin: 0.8rem auto 0;
  max-inline-size: 36ch;
  color: var(--ink-soft);
}

.box {
  inline-size: min(100%, 27rem);
  margin: 1.5rem auto 0;
  transition: inline-size 0.35s ease;
}
.box[data-size='4'] { inline-size: min(100%, 19rem); }
.box[data-size='12'] { inline-size: min(100%, 33rem); }
.box-svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  overflow: visible;
  filter: drop-shadow(0 18px 22px rgba(74, 28, 22, 0.22));
}
.lid-name {
  font-family: var(--display);
  font-style: italic;
  font-size: 27px;
  fill: #8a2a3c;
}
.slot.is-filled { cursor: pointer; }
.drop { transform-box: fill-box; transform-origin: center; transition: transform 0.15s ease; }
.slot.is-filled:hover .drop { transform: scale(1.07) rotate(-4deg); }
.drop.is-new { animation: drop 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) backwards; }
@keyframes drop {
  from { transform: translateY(-46px) scale(0.3) rotate(-30deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.gift { transform-box: fill-box; transform-origin: center top; }
.gift.is-new { animation: tie 0.5s ease backwards; }
@keyframes tie {
  from { transform: scale(0.2); opacity: 0; }
}

.tip { margin-top: 0.9rem; font-size: 0.9375rem; color: var(--ink-soft); }
.allergens { min-block-size: 1.5em; margin-top: 0.25rem; font-size: 0.9375rem; font-weight: 500; color: var(--berry); }

.builder { display: grid; gap: 0; }
.step {
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.step h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.step h3 span {
  font-family: var(--text);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  color: var(--berry);
  margin-inline-end: 0.6em;
}
.step-note { margin-bottom: 0.75rem; font-size: 0.9375rem; color: var(--ink-soft); }

.sizes { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sizes button {
  inline-size: 3.6rem;
  block-size: 3.6rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-family: var(--display);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.sizes button:hover { transform: translateY(-2px); }
.sizes button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chips button {
  min-block-size: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.chips button:hover { background: var(--blush); }
.chips button[aria-pressed='true'] { background: var(--ink); color: var(--cream); }
.chips button[aria-pressed='true']::before { content: '✓ '; }

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.pick {
  display: grid;
  grid-template-rows: 1fr auto;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--card);
  overflow: hidden;
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.pick.is-off { opacity: 0.38; filter: grayscale(0.7); }
.pick-add {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.1rem;
  padding: 0.7rem 0.4rem 0.6rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: center;
}
.pick-add svg {
  inline-size: 5rem;
  block-size: 5rem;
  overflow: visible;
  transition: transform 0.25s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.pick-add:hover svg { transform: translateY(-4px) rotate(-6deg) scale(1.06); }
.pick-add[aria-disabled='true'] { cursor: not-allowed; opacity: 0.5; }
.pick-add[aria-disabled='true']:hover svg { transform: none; }
.pick-name { font-weight: 500; line-height: 1.2; }
.pick-price { font-size: 0.9375rem; color: var(--berry); font-weight: 500; }
.pick-contains { font-size: 0.75rem; line-height: 1.3; color: var(--ink-soft); }
.pick-less {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-block-size: 2.5rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--blush);
  cursor: pointer;
  font-weight: 500;
}
.pick-less[hidden] { display: none; }
.pick-less b {
  display: inline-grid;
  place-items: center;
  min-inline-size: 1.5rem;
  block-size: 1.5rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.875rem;
}
.full { margin-bottom: 0.75rem; color: var(--berry); font-weight: 500; }
.full[hidden] { display: none; }

.cakes { display: grid; gap: 0.5rem; }
.cakes button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-block-size: 3rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  text-align: start;
}
.cakes button b { color: var(--berry); font-weight: 500; white-space: nowrap; }
.cakes button[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fff; }

.check {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-block-size: 2.75rem;
  margin-bottom: 1rem;
  cursor: pointer;
}
.check input { inline-size: 1.4rem; block-size: 1.4rem; accent-color: var(--berry); }
.check b { color: var(--berry); font-weight: 500; margin-inline-start: 0.3em; }
.check.is-idle { color: var(--ink-soft); }

.field { display: grid; gap: 0.4rem; margin-bottom: 0.9rem; }
.field span { font-weight: 500; }
.field input {
  min-block-size: 3rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.field input[type='date'] { max-inline-size: 16rem; }
.field ::placeholder { color: #7d635d; }

.summary {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-inline: calc(var(--gutter) * -1);
  padding: 0.9rem var(--gutter) 1rem;
  border-top: 1px solid var(--ink);
  background: var(--cream);
}
.summary-line { font-weight: 500; }
.total { font-family: var(--display); font-size: 2.1rem; line-height: 1; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 3rem;
  padding: 0.6rem 1.6rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-main { background: var(--berry); border-color: var(--berry); color: #fff; }
.btn-main:hover { background: var(--ink); border-color: var(--ink); }
.btn-main:disabled { background: transparent; border-color: var(--line); color: var(--ink-soft); cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); }

/* ---------- Facts and footer ---------- */

.facts {
  display: grid;
  padding: 0 var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.facts article { padding: 2rem 0; border-bottom: 1px solid var(--line); }
.facts h2 {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  font-size: 1.8rem;
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.facts p { color: var(--ink-soft); max-inline-size: 36ch; }

.foot {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  padding: 4rem var(--gutter) 5rem;
  background: var(--night);
  color: var(--cream);
  text-align: center;
}
.foot p {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.15;
  max-inline-size: 24ch;
  text-wrap: balance;
}
.foot .btn-main:hover { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.foot :focus-visible { outline-color: var(--cream); }

/* ---------- Order sheet ---------- */

dialog {
  inline-size: min(31rem, calc(100vw - 2rem));
  padding: 2rem;
  border: 1px solid var(--gold);
  border-radius: 1.5rem;
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop { background: rgba(29, 13, 16, 0.7); }
dialog h2 { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1.2; }
.bubble {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: var(--blush);
  white-space: pre-line;
  text-align: start;
  overflow-wrap: anywhere;
}
.note { margin-bottom: 1.5rem; color: var(--ink-soft); }

@media (min-width: 40rem) {
  .tags { --lead: 2.4rem; --tag-size: 1rem; }
  .caption { bottom: 3.8rem; }
}

@media (min-width: 62rem) {
  .order {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 4rem;
    align-items: start;
    padding-block: 5rem 4rem;
  }
  .show {
    position: sticky;
    top: 4.5rem;
    text-align: start;
  }
  .show .lede { margin-inline: 0; }
  .tip, .allergens { text-align: center; }
  .summary { margin-inline: 0; padding-inline: 0; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts article { padding-block: 2.5rem 3rem; padding-inline: 0 2rem; border-bottom: 0; }
  .facts article + article { padding-inline-start: 2rem; border-inline-start: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  .drop.is-new, .gift.is-new, .scroll-hint::after { animation: none; }
  .slot.is-filled:hover .drop, .pick-add:hover svg, .sizes button:hover { transform: none; }
  .btn, .chips button, .pick, .pick-add svg, .sizes button, .box, #cake, .tag { transition: none; }
}
