/* Be Your Own Barista — the drink studio.
   ≥1180px: selection | dominant live preview | persistent summary (three columns).
   768–1179px: preview + selection side by side; summary becomes a bottom bar.
   <768px: compact sticky preview on top, selection below, summary bottom bar (content padded so it never hides anything). */
.page-barista { background: radial-gradient(70% 60% at 15% 0%, #FBE9CC 0%, transparent 60%), var(--bg); }
.page-barista .site-footer { margin-block-start: 0; }
.studio { padding-block-end: var(--sp-8); }
.studio__head { padding-block: clamp(20px, 3.5vw, 44px) var(--sp-5); display: grid; gap: 6px; }
.barista__title { font-size: clamp(2.2rem, 1.4rem + 3vw, 4rem); }
.studio__grid { display: grid; gap: clamp(16px, 2.2vw, 32px); align-items: start;
  grid-template-columns: minmax(360px, 1.12fr) minmax(340px, 1fr) minmax(250px, 290px); grid-template-areas: "panel stage summary"; }
.studio .step__title { font-size: var(--fs-h3); }
.studio__panel { grid-area: panel; min-width: 0; }
.studio__stage { grid-area: stage; min-width: 0; position: sticky; top: 84px; }
.studio__summary { grid-area: summary; min-width: 0; position: sticky; top: 84px; }

/* stage */
.stage { position: relative; border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-art); background: #EDDCC6; }
.stage__canvas { aspect-ratio: 4 / 5; max-height: calc(100vh - 120px); margin-inline: auto; }
.stage__canvas .studio-svg { width: 100%; height: 100%; display: block; }
.stage__canvas.is-ghost .pv-stage { opacity: 0.35; filter: grayscale(0.5); transition: opacity var(--t-slow); }
.stage__note { position: absolute; inset-block-end: 10px; inset-inline: 12px; font-size: 11px; color: rgb(36 22 17 / 0.62); text-align: center; }
.stage-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; position: absolute; inset-block-start: 14px; inset-inline: 14px; }
.stage-tags li { padding: 3px 12px; border-radius: var(--r-pill); background: var(--glass); backdrop-filter: blur(8px); border: 1px solid var(--glass-border); font-size: var(--fs-xs); font-weight: 600; animation: tag-in var(--t-med) var(--ease); }
.stage-tags .stage-hint { background: var(--c-espresso); color: var(--c-cream); border-color: transparent; }
@keyframes tag-in { from { opacity: 0; transform: translateY(4px); } }

/* base cards use the menu art */
.family-card__art img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-md); }
.family-card__art { aspect-ratio: 4 / 5; max-width: 132px; border-radius: var(--r-md); overflow: hidden; background: #EDDCC6; }
.family-card__fallback { display: block; width: 100%; height: 100%; background: radial-gradient(40% 30% at 50% 60%, var(--c), transparent 70%); }

/* stepper navigation */
.stepper-nav { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stepper-nav::-webkit-scrollbar { display: none; }
.stepper-nav li { flex: 1 0 auto; }
.stepper-nav__btn { width: 100%; display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 6px 12px 6px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--text-muted); }
.stepper-nav__btn[disabled] { cursor: not-allowed; opacity: 0.5; }
.stepper-nav__n { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-sunk); font-size: var(--fs-xs); font-weight: 700; color: var(--text); }
.stepper-nav__btn.is-done { color: var(--text); }
.stepper-nav__btn.is-done .stepper-nav__n { background: var(--c-matcha); color: #fff; }
.stepper-nav__btn[aria-current="step"] { background: var(--c-espresso); color: var(--c-cream); border-color: var(--c-espresso); }
.stepper-nav__btn[aria-current="step"] .stepper-nav__n { background: var(--c-saffron); color: var(--c-ink); }

/* step body */
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: clamp(18px, 3vw, 32px); min-height: 360px; display: grid; gap: var(--sp-5); align-content: start; }
.step__head { display: grid; gap: 6px; }
.step__title { font-size: var(--fs-h2); font-weight: 700; outline: none; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-block-start: var(--sp-4); }
.opt-group { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.opt-group__title { font-size: var(--fs-base); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.opt-group__title .i { width: 18px; height: 18px; color: var(--c-caramel-text); }
.i { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; }

/* drink base cards */
.family-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr)); }
.family-card { position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 14px 12px 16px; border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--c-warm-white); cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.family-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); transform: translateY(-2px); }
.family-card[aria-pressed="true"] { border-color: var(--c-espresso); box-shadow: inset 0 0 0 1.5px var(--c-espresso); background: #FBF5EC; }
.family-card__art { width: 100%; max-width: 120px; aspect-ratio: 240 / 300; display: block; }
.drink--mini { width: 100%; height: 100%; }
.family-card__name { font-weight: 700; font-size: var(--fs-base); line-height: 1.45; }
.family-card__en { font-family: var(--font-en); font-size: var(--fs-xs); color: var(--text-muted); }
.family-card__meta { font-size: var(--fs-sm); }
.family-card__temps { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.badge--cold { background: #DCE8EA; color: #24474C; }
.family-card__check, .opt-card__check { position: absolute; top: 10px; inset-inline-end: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--c-espresso); color: var(--c-cream); display: grid; place-items: center; opacity: 0; transform: scale(0.6); transition: opacity var(--t-fast), transform var(--t-fast); }
.family-card__check .i, .opt-card__check .i { width: 14px; height: 14px; }
[aria-pressed="true"] > .family-card__check, .opt-card.is-selected .opt-card__check { opacity: 1; transform: none; }

/* segmented controls */
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { position: relative; display: grid; justify-items: center; gap: 0; min-width: 120px; min-height: 52px; padding: 10px 18px; border-radius: var(--r-md); border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; text-align: center; }
.seg input { position: absolute; opacity: 0; }
.seg:has(input:checked) { background: var(--c-espresso); color: var(--c-cream); border-color: var(--c-espresso); }
.seg:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg.is-disabled { opacity: 0.55; cursor: not-allowed; font-weight: 500; }
.seg small { font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); max-width: 18ch; }

/* size cards */
.size-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.size-card { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 10px; border-radius: var(--r-lg); border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: center; }
.size-card input { position: absolute; opacity: 0; }
.size-card.is-selected, .size-card:has(input:checked) { border-color: var(--c-espresso); box-shadow: inset 0 0 0 1.5px var(--c-espresso); background: #FBF5EC; }
.size-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.size-card__icon { height: 56px; display: flex; align-items: end; color: var(--c-caramel); }
.size-card__icon svg { width: 48px; height: 48px; transform: scale(var(--s)); transform-origin: 50% 100%; transition: transform var(--t-med) var(--ease); }
.size-card__name { font-weight: 700; }
.size-card .price { font-weight: 600; font-size: var(--fs-sm); }

/* option rows (shots, decaf) */
.opt-list { display: grid; gap: 12px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--c-warm-white); width: 100%; text-align: start; font: inherit; color: inherit; }
.opt-row--toggle { cursor: pointer; }
.opt-row--toggle[aria-pressed="true"] { border-color: var(--c-espresso); box-shadow: inset 0 0 0 1px var(--c-espresso); }
.opt-row--toggle[disabled] { cursor: not-allowed; opacity: 0.7; }
.opt-row__text { display: grid; gap: 2px; }
.opt-row__name { font-weight: 600; }
.opt-reason { display: block; font-size: var(--fs-xs); color: var(--warning); font-weight: 500; }
.switch { width: 46px; height: 28px; flex: none; border-radius: 14px; background: var(--border-strong); position: relative; transition: background var(--t-fast); }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: inset-inline-start var(--t-fast) var(--ease); }
[aria-pressed="true"] > .switch { background: var(--c-matcha); }
[aria-pressed="true"] > .switch::after { inset-inline-start: 21px; }

/* option cards (milk, syrups, toppings) */
.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.opt-card { position: relative; border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--c-warm-white); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.opt-card:hover { border-color: var(--border-strong); }
.opt-card.is-selected { border-color: var(--c-espresso); box-shadow: inset 0 0 0 1.5px var(--c-espresso); background: #FBF5EC; }
.opt-card.is-disabled { background: var(--surface-sunk); border-style: dashed; }
.opt-card.is-disabled .opt-card__name { color: var(--text-muted); }
.opt-card.is-maxed:not(.is-selected) { opacity: 0.55; }
.opt-card__btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 40px 12px 12px; background: none; border: 0; text-align: start; cursor: pointer; font: inherit; color: inherit; border-radius: inherit; min-height: 64px; }
[dir="rtl"] .opt-card__btn { padding: 12px 12px 12px 40px; }
.opt-card__btn[aria-disabled="true"] { cursor: not-allowed; }
.opt-card__text { display: grid; gap: 1px; min-width: 0; }
.opt-card__name { font-weight: 600; line-height: 1.5; }
.opt-card__brand { font-family: var(--font-en); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-caramel-text); }
.opt-card__price { color: var(--text-muted); }
.opt-card__rec { color: var(--c-matcha-text); font-weight: 500; }
.opt-card__pumps { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px; }
.opt-card__pumps .stepper button { width: 36px; height: 36px; }
.swatch { --c: #ccc; width: 36px; height: 36px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.55), transparent 45%), var(--c); box-shadow: inset 0 -3px 6px rgb(0 0 0 / 0.15), 0 0 0 1px rgb(0 0 0 / 0.06); }
.swatch--syrup { border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; transform: rotate(180deg); }
.swatch--milk { border-radius: 10px 10px 14px 14px; }
.swatch--sauce { border-radius: 40% 60% 50% 50%; }
.rec-row { display: flex; gap: 10px; overflow-x: auto; padding-block-end: 4px; }
.rec-chip { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: var(--r-lg); border: 1.5px dashed var(--c-matcha); background: #F3F5EC; cursor: pointer; text-align: start; font: inherit; color: inherit; max-width: 300px; }
.rec-chip[aria-pressed="true"] { border-style: solid; border-color: var(--c-matcha-text); background: #E7ECDA; }
.rec-chip[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.rec-chip .swatch { width: 28px; height: 28px; }
.rec-chip span:last-child { display: grid; }
.rec-chip small { font-size: var(--fs-xs); color: var(--c-matcha-text); }
.shake { animation: shake 360ms; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* review */
.recipe { display: grid; gap: var(--sp-4); }
.recipe__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.recipe__lines li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-block-end: 1px solid var(--border); background: var(--c-warm-white); }
.recipe__lines li:first-child { font-weight: 700; background: #FBF5EC; }
.recipe__lines li:last-child { border-block-end: 0; }
.recipe__total { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-h3); font-weight: 700; padding-inline: 4px; }
.recipe__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.recipe__actions .i { width: 18px; height: 18px; }
.recipe__msg.is-ok { color: var(--c-matcha-text); font-weight: 600; }
.recipe__msg.is-error { color: var(--error); }
.recipe__msg .i { color: var(--c-matcha-text); }

/* persistent summary */
.summary { display: grid; gap: var(--sp-4); padding: var(--sp-5); border-radius: var(--r-xl); background: var(--c-espresso); color: var(--c-cream); box-shadow: var(--shadow-2); }
.summary .kicker { color: var(--c-saffron); }
.summary__name { font-weight: 800; font-size: var(--fs-lg); line-height: 1.4; overflow-wrap: anywhere; }
.summary__meta { color: var(--text-on-dark-muted); }
.summary__progress { display: grid; gap: 6px; color: var(--text-on-dark-muted); }
.summary__bar { height: 6px; border-radius: 3px; background: rgb(247 241 232 / 0.16); overflow: hidden; }
.summary__bar span { display: block; height: 100%; inline-size: 0; background: var(--c-saffron); border-radius: inherit; transition: inline-size var(--t-slow) var(--ease); }
.summary__recipe summary { cursor: pointer; font-weight: 700; font-size: var(--fs-sm); list-style: none; display: flex; justify-content: space-between; }
.summary__recipe summary::-webkit-details-marker { display: none; }
.summary__recipe summary::after { content: "−"; opacity: 0.7; }
.summary__recipe:not([open]) summary::after { content: "+"; }
.summary__lines { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); max-height: 38vh; overflow: auto; }
.summary__lines li { display: flex; justify-content: space-between; gap: 10px; padding-block-end: 6px; border-block-end: 1px dashed rgb(247 241 232 / 0.18); animation: tag-in var(--t-med) var(--ease); }
.summary__lines li .price { color: var(--c-cream); }
.summary__foot { display: grid; gap: 12px; border-block-start: 1px solid rgb(247 241 232 / 0.18); padding-block-start: var(--sp-4); }
.summary__total { font-size: var(--fs-h2); font-weight: 800; color: var(--c-saffron); line-height: 1.3; }
.summary__check { color: var(--text-on-dark-muted); display: flex; gap: 4px; align-items: center; }
.summary__check.is-ok { color: #BFD39A; }
.summary__check.is-error { color: #F3A79C; }
.summary__check .i { width: 14px; height: 14px; }
.summary .btn { width: 100%; }
.summary.is-empty { background: var(--surface); color: var(--text); border: 1px dashed var(--border-strong); box-shadow: none; }
.summary.is-empty .kicker { color: var(--c-caramel-text); }
.summary.is-empty .summary__meta { color: var(--text-muted); }

@media (max-width: 1179px) {
  .studio__grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr); grid-template-areas: "panel stage"; }
  .studio { padding-block-end: 120px; }
  /* summary → bottom bar */
  .studio__summary { grid-area: auto; position: fixed; inset-inline: 0; inset-block-end: 0; top: auto; z-index: 25; border-radius: var(--r-lg) var(--r-lg) 0 0;
    grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); }
  .studio__summary .kicker, .summary__progress, .summary__recipe { display: none; }
  .summary__name { font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .summary__foot { border: 0; padding: 0; grid-template-columns: auto auto; align-items: center; gap: 14px; }
  .summary__total { font-size: var(--fs-lg); }
  .summary .btn { width: auto; min-width: 140px; }
  .summary.is-empty { display: none; }
}
@media (max-width: 767px) {
  .studio__grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "panel"; gap: 14px; }
  .studio__stage { top: 60px; z-index: 6; }
  .stage { display: grid; grid-template-columns: 144px minmax(0, 1fr); grid-template-rows: 1fr auto; align-items: center; border-radius: var(--r-lg); }
  .stage__canvas { grid-row: span 2; aspect-ratio: 4 / 5; width: 144px; max-height: none; }
  .stage-tags { position: static; justify-content: flex-start; align-self: center; padding-inline: 12px; max-height: 120px; overflow: hidden; }
  .stage__note { position: static; grid-column: 2; padding: 0 12px 10px; text-align: start; font-size: 10px; line-height: 1.6; }
  .barista__title { font-size: var(--fs-h1); }
  .step { padding: 16px; border-radius: var(--r-lg); }
  .step__title { font-size: var(--fs-h3); }
  .family-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .family-card { padding: 10px 8px 12px; }
  .family-card__art { max-width: 96px; }
  .opt-grid { grid-template-columns: 1fr; }
  .seg { min-width: 0; flex: 1; }
  .size-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary__meta, .summary__check { display: none; }
  .studio__summary { grid-template-columns: minmax(0, 1fr) auto; }
  .summary .btn { min-width: 0; padding-inline: 16px; }
  .summary__total { font-size: var(--fs-md); }
  .stage-tags li { font-size: 11px; padding: 2px 9px; }
}
.page-barista .toast { inset-block-end: calc(96px + env(safe-area-inset-bottom)); }
.featured-recipes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block-start: 14px; } .featured-recipes__label { font-size: var(--fs-sm); color: var(--text-muted); }
