/* Bakelyne — live price + weight estimate (v1). Loaded only by /design.
   Styles for #pricePanel (inside the sticky .studio-stage card) and the
   #priceBarMobile sticky summary bar that appears once the panel scrolls
   out of view on small screens. Tokens come from site.css. */

/* ==========================================================================
   Price panel — sits between the cake preview and the caption
   ========================================================================== */

#pricePanel {
  border-top: 1px solid var(--line-soft);
  padding: .9rem 0 0;
  margin-top: .9rem;
}
#pricePanel[hidden] { display: none; }

.pp-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .5rem;
}
.pp-label {
  font-family: var(--font-ui); font-weight: 500;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint);
}
.pp-toggle {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font-family: var(--font-ui); font-weight: 500;
  font-size: .74rem; letter-spacing: .04em;
  color: var(--accent-ink);
  text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px;
  transition: color .18s var(--ease);
}
.pp-toggle:hover { color: var(--cocoa); }

.pp-main {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .3rem 1rem;
}
.pp-price {
  display: flex; align-items: baseline; gap: .38rem;
  font-family: var(--font-display); color: var(--cocoa);
}
.pp-from { font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
.pp-figure {
  display: inline-block;
  font-size: 2rem; font-weight: 600; line-height: 1;
  transform-origin: left center;
}
.pp-num { font-weight: 600; } /* the animated digits */

.pp-meta {
  font-family: var(--font-ui); font-size: .86rem; color: var(--ink-soft);
  white-space: nowrap;
}

/* Subtle pulse when the price changes — scale up, fade back to rest. */
@keyframes ppPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.pp-figure.pp-pulse { animation: ppPulse .4s var(--ease-out); }

/* Collapsible breakdown — animates via grid-template-rows so no fixed
   height is ever guessed at. Closed by default. */
.pp-breakdown {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s var(--ease);
}
.pp-breakdown.open { grid-template-rows: 1fr; }
.pp-breakdown-in { overflow: hidden; min-height: 0; }

.pp-lines { padding-top: .7rem; display: grid; gap: 0; }
.pp-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-family: var(--font-ui); font-size: .86rem; color: var(--ink-soft);
  padding: .32rem 0; border-bottom: 1px dotted var(--line);
}
.pp-line-label { color: var(--cocoa); }
.pp-line-amt { color: var(--cocoa); font-weight: 500; white-space: nowrap; }
.pp-line-note { font-style: italic; color: var(--ink-faint); font-size: .82rem; white-space: nowrap; }

.pp-total {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: .5rem; padding-top: .6rem;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-ui); font-weight: 600; font-size: .92rem;
  color: var(--cocoa);
}

.pp-disclaimer {
  margin-top: .8rem;
  font-family: var(--font-ui); font-size: .72rem; color: var(--ink-faint);
}

/* Visually-hidden aria-live mirror — updated once, after the count-up settles. */
.pp-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

@media (prefers-reduced-motion: reduce) {
  .pp-breakdown { transition: none; }
  .pp-figure.pp-pulse { animation: none; }
}

/* ==========================================================================
   Mobile sticky bar — mirrors the guide price once #pricePanel scrolls
   out of view. Only relevant below the studio's own stack breakpoint.
   ========================================================================== */

#priceBarMobile {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 110; /* above page content, below the chat bubble (z-index 120) */
  transform: translateY(110%);
  transition: transform .3s var(--ease);
  pointer-events: none;
}
#priceBarMobile.visible { transform: translateY(0); pointer-events: auto; }

@media (min-width: 60.01rem) {
  #priceBarMobile { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  #priceBarMobile { transition: none; }
}

.pbm-btn {
  display: flex; align-items: baseline; gap: .5rem;
  width: 100%; min-height: 3.2rem;
  /* right padding keeps the price clear of the chat launcher's bottom-right corner */
  padding: .65rem 5rem .65rem 1.2rem;
  padding-bottom: calc(.65rem + env(safe-area-inset-bottom));
  background: var(--cream-card);
  border: none; border-top: 1px solid var(--line-soft);
  box-shadow: 0 -6px 18px rgba(74, 44, 33, .10);
  font-family: var(--font-ui); text-align: left; cursor: pointer;
  color: var(--cocoa);
}
.pbm-label {
  font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); white-space: nowrap;
}
.pbm-sep { color: var(--line); }
.pbm-price {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  color: var(--cocoa); white-space: nowrap;
}
.pbm-weight { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 22rem) {
  .pbm-btn { padding-right: 3.5rem; gap: .4rem; }
  .pbm-label { display: none; } /* first thing to go on very narrow phones */
  .pbm-sep:first-of-type { display: none; }
}
