/* Live price badge — shown only after a price has been delivered, so the customer can keep
 * designing and watch the number move.
 *
 * Sits in the gap ABOVE .addon-tray (which owns right:18px from top:104px down), so collapsed it
 * never covers the door/window tray. Expanded it overlays the tray on purpose — the customer asked
 * for the breakdown, and collapsing gives the tray straight back. z-index 6 = the viewport-mount
 * tier in studio-foundation.css's contract.
 *
 * Deliberately the inverse of every other studio surface: the tray, tools and inspector are light
 * glass, so the one authoritative number on screen is dark glass. It reads as the price at a glance
 * without inventing a colour outside the navy palette. */
.price-hud {
  --ph-ink: #f3f8fd;
  --ph-dim: #a7c2d9;
  --ph-rim: #ffffff2b;
  --ph-hair: #ffffff1f;
  --ph-up: #f2bb81;    /* costs more — warm sand, never an alarm red: more barn is not an error */
  --ph-down: #93d8ac;  /* costs less */
  --ph-flag: #ffd89d;  /* needs a rep */
  position: absolute;
  z-index: 6;
  top: 20px;
  right: 18px;
  /* Sized for the widest figure a real barn produces: an 80 x 288 fully enclosed 26-gauge range is
     "$498,378-$529,206", 17 characters. The [data-long] step below is the safety valve past that. */
  width: 268px;
  max-width: calc(100% - 36px);
  border: 1px solid var(--ph-rim);
  border-radius: 20px;
  background: linear-gradient(152deg, #21496af2, #0e2a42f7);
  box-shadow: 0 18px 45px #0a24364d, 0 3px 10px #0a243626, inset 0 1px 0 #ffffff2e;
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  color: var(--ph-ink);
  overflow: hidden;
  animation: ph-in .42s var(--sf-ease, cubic-bezier(.2, .9, .25, 1.15)) both;
}
.price-hud[hidden] { display: none !important; }

@keyframes ph-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---- collapsed bar (the default) ------------------------------------------------------------ */
.ph-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  width: 100%;
  padding: 11px 13px 12px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ph-eyebrow {
  grid-column: 1;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--ph-dim);
  text-transform: uppercase;
}
.ph-chevron {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ph-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .3s var(--sf-ease, cubic-bezier(.2, .9, .25, 1.15));
}
.price-hud[data-open="true"] .ph-chevron { transform: rotate(180deg); }
.ph-figure {
  grid-column: 1;
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.14;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ph-figure[data-long="true"] { font-size: 16px; letter-spacing: -.035em; }
/* The figure pulses when it changes, so a number that moved is never missed. Transform and
 * opacity only — it runs over a live WebGL canvas. */
.ph-figure[data-bump="true"] { animation: ph-bump .34s var(--sf-ease, cubic-bezier(.2, .9, .25, 1.15)); }
@keyframes ph-bump { 40% { transform: scale(1.055); opacity: .82; } to { transform: none; opacity: 1; } }

.ph-delta {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--ph-dim);
  font-variant-numeric: tabular-nums;
}
.ph-delta[data-dir="up"] { color: var(--ph-up); }
.ph-delta[data-dir="down"] { color: var(--ph-down); }
.ph-delta[hidden] { display: none; }
.ph-arrow { font-size: 8px; line-height: 1; }

.ph-toggle:hover .ph-chevron { stroke: var(--ph-ink); }
.ph-toggle:active { transform: scale(.985); }
.ph-toggle:focus-visible { outline: 3px solid #7fc0f5; outline-offset: -3px; border-radius: 18px !important; }

/* ---- expanded panel ------------------------------------------------------------------------- */
.ph-panel { padding: 0 13px 13px; }
.ph-panel[hidden] { display: none; }
/* The breakdown is the only part that scrolls, so the send button below it is always reachable. */
.ph-scroll {
  max-height: min(46vh, 330px);
  overflow-y: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
/* Fades the cut edge only while there is more below, so a clipped line reads as scrollable rather
   than as a rendering fault. Set from JS, because CSS cannot ask whether a box overflows. */
.ph-scroll[data-more="true"] {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}
.ph-lines { margin: 0; border-top: 1px solid var(--ph-hair); padding-top: 9px; }
.ph-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  line-height: 1.7;
  color: #dbe8f3;
}
.ph-line span { min-width: 0; }
.ph-line b {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ph-ink);
}
.ph-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ph-hair);
  font-size: 11.5px;
}
.ph-total span { color: var(--ph-dim); }

/* "Want a better price? Call Joshua" (Gilmar in Spanish) — directly under the estimate. The question
 * stays quiet; the call itself is the one pill in the breakdown, so it reads as the thing to press.
 * The same line, with the same number, sits under the range on the receipt (estimate-dialog.css). */
.ph-call {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 10px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ph-dim);
}
.ph-call[hidden] { display: none; }
.ph-call a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #ffffff47;
  border-radius: 999px;
  background: #ffffff17;
  color: var(--ph-ink);
  font: 700 10.5px 'Satoshi', Arial, sans-serif;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .18s var(--sf-ease, cubic-bezier(.2, .9, .25, 1.15));
}
.ph-call a:hover { background: #ffffff2e; border-color: #ffffff8a; }
.ph-call a:active { transform: translateY(1px) scale(.985); }
.ph-call a:focus-visible { outline: 3px solid #7fc0f5; outline-offset: 2px; }

.ph-flag {
  display: flex;
  gap: 7px;
  margin: 11px 0 0;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid #ffd89a2b;
  background: #ffd89a14;
  font-size: 10.5px;
  line-height: 1.6;
  color: #f4e3c6;
}
.ph-flag[hidden] { display: none; }
.ph-flag svg { flex: none; width: 13px; height: 13px; margin-top: 2px; fill: var(--ph-flag); }
.ph-flag ul { margin: 4px 0 0; padding-left: 15px; }
.ph-flag li { margin: 2px 0; }

.ph-send {
  width: 100%;
  min-height: 40px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #ffffff3d !important;
  border-radius: 13px !important;
  background: linear-gradient(150deg, #e8f2fb, #c2d9ee) !important;
  box-shadow: 0 4px 12px #08233521, inset 0 1px 0 #ffffffc4 !important;
  color: #123249 !important;
  font: 700 11.5px 'Satoshi', Arial, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .18s var(--sf-ease, cubic-bezier(.2, .9, .25, 1.15)), box-shadow .18s ease, background .18s ease;
}
.ph-send:hover { background: linear-gradient(150deg, #fbfdff, #d6e8f8) !important; box-shadow: 0 6px 16px #0823352e, inset 0 1px 0 #fff !important; }
.ph-send:active { transform: translateY(1px) scale(.99); }
.ph-send:focus-visible { outline: 3px solid #7fc0f5; outline-offset: 2px; }

.ph-note { margin: 8px 2px 0; font-size: 9.5px; line-height: 1.6; color: var(--ph-dim); }

/* ---- narrow desktop / tablet ---------------------------------------------------------------- */
@media (max-width: 1050px) and (min-width: 651px) {
  .price-hud { right: 12px; top: 14px; width: 232px; border-radius: 17px; }
  .ph-figure { font-size: 17px; }
  .ph-figure[data-long="true"] { font-size: 14.5px; }
  .ph-toggle { padding: 9px 11px 10px; }
  .ph-panel { padding: 0 11px 11px; }
}

/* ---- phone + short landscape ----------------------------------------------------------------
 * The tray moves to the bottom at these sizes, so the whole right edge is free. The scene title
 * is given less room rather than letting the two overlap. */
@media (max-width: 650px), (max-width: 1000px) and (max-height: 500px) {
  /* Collapsed it has to share the top edge with the scene title, so it stays narrow. Expanded it is
     given room to breathe — the customer opened it, and the tray is bottom-anchored at this size. */
  .price-hud { top: 14px; right: 14px; width: 196px; border-radius: 16px; }
  .price-hud[data-open="true"] { width: min(300px, calc(100% - 28px)); }
  .ph-toggle { padding: 8px 10px 9px; gap: 3px 8px; }
  .ph-eyebrow { font-size: 7.5px; letter-spacing: .12em; }
  .ph-figure { font-size: 15px; }
  .ph-figure[data-long="true"] { font-size: 13px; }
  .ph-delta { font-size: 9.5px; }
  .ph-chevron { width: 16px; height: 16px; }
  .ph-panel { padding: 0 10px 11px; }
  /* #viewport is only ~58dvh at this size, so the badge must not swallow the barn behind it. */
  .ph-scroll { max-height: min(34vh, 210px); }
  .ph-send { min-height: 44px; }
  .ph-call a { min-height: 44px; }
  /* A live price is worth more than the tagline on a 390 px screen, and the studio already hides
     this headline when the inspector is open. The eyebrow and the dimensions line stay, capped so
     they can never reach the badge: 196 card + 14 right inset + 18 left inset + 8 gap = 236. A
     percentage cap cannot promise that — at 320 px the two still met. The dimensions line wraps
     instead, which is the right trade at that width. */
  html.has-price-hud .scene-title { max-width: calc(100% - 236px); }
  html.has-price-hud .scene-title h1 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .price-hud, .ph-figure[data-bump="true"] { animation: none; }
  .ph-chevron, .ph-send, .ph-call a { transition: none; }
  .ph-toggle:active, .ph-send:active, .ph-call a:active { transform: none; }
}
