/* =============================================================
   BUILD YOUR FRIO: mini game (homepage)
   Remove this file + assets/js/build.js + the marked block in
   index.html to take the game out again.
   ============================================================= */
.bf{ position:relative; overflow:hidden; }
.bf-grid{ display:grid; gap:2rem; align-items:center; }
@media (min-width: 960px){ .bf-grid{ grid-template-columns:1fr 1.05fr; gap:4.5rem; } }

.bf-intro{ display:grid; gap:1rem; }
.bf-intro .lead{ max-width:30em; }

/* steps */
.bf-steps{ display:flex; gap:.4rem; margin-top:.6rem; }
.bf-steps li{ flex:1; height:4px; border-radius:4px; background:var(--line); position:relative; overflow:hidden; }
.bf-steps li::after{ content:""; position:absolute; inset:0; background:var(--leaf); transform:scaleX(0); transform-origin:left; transition:transform .6s var(--ease); }
.bf-steps li.done::after,.bf-steps li.now::after{ transform:scaleX(1); }
.bf-steps li.now::after{ opacity:.45; }

.bf-step-title{ display:flex; align-items:baseline; gap:.7rem; margin-top:1.2rem; }
.bf-step-title b{ font-family:var(--serif); font-weight:400; font-style:italic; color:var(--leaf); font-size:1.6rem; line-height:1; }
.bf-step-title h3{ font-size:clamp(1.6rem,1.3rem + 1vw,2.1rem); }
.bf-hint{ color:var(--ink-2); font-size:.95rem; margin-top:.25rem; }

/* tray of ingredients */
.bf-tray{ display:grid; grid-template-columns:repeat(auto-fill, minmax(118px,1fr)); gap:.75rem; margin-top:1.1rem; min-height:142px; }
.bf-item{ position:relative; display:grid; justify-items:center; align-content:center; gap:.45rem; padding:1rem .6rem .85rem;
  background:var(--white); border:1.5px solid var(--line); border-radius:16px; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none;
  transition:transform .3s var(--ease), border-color .2s, box-shadow .3s var(--ease), opacity .3s; animation:bfIn .5s var(--ease) both; animation-delay:calc(var(--i,0) * 70ms); }
.bf-item:hover{ border-color:var(--leaf); transform:translateY(-3px); box-shadow:0 14px 28px -20px rgba(28,26,23,.5); }
.bf-item:active{ cursor:grabbing; }
.bf-item:focus-visible{ outline:2px solid var(--focus); outline-offset:3px; }
.bf-item svg{ width:52px; height:52px; pointer-events:none; }
.bf-item span{ font-weight:600; font-size:.92rem; line-height:1.2; text-align:center; pointer-events:none; }
.bf-item small{ display:block; font-weight:400; font-size:.78rem; color:var(--ink-2); }
.bf-item.is-dragging{ opacity:.35; transform:scale(.96); }
.bf-tray.is-busy .bf-item{ pointer-events:none; opacity:.45; }
.bf-item--skip{ background:transparent; border-style:dashed; }
@keyframes bfIn{ from{ opacity:0; transform:translateY(12px) scale(.96); } }

.bf-ghost{ position:fixed; left:0; top:0; z-index:300; pointer-events:none; width:78px; height:78px; display:grid; place-items:center;
  background:var(--white); border-radius:50%; box-shadow:0 18px 40px -14px rgba(28,26,23,.45); transform:translate(-50%,-50%) scale(1.05); }
.bf-ghost svg{ width:50px; height:50px; }
.bf-ghost.is-back{ transition:transform .35s var(--ease), opacity .35s; opacity:0; }

/* the cup stage */
.bf-stage{ position:relative; display:grid; place-items:center; padding:1rem 0; }
.bf-stage::before{ content:""; position:absolute; width:min(92%,460px); aspect-ratio:1; border-radius:50%;
  background:radial-gradient(circle at 50% 45%, #fffdf9 0%, var(--paper-2) 62%, transparent 72%); }
.bf-cupwrap{ position:relative; width:min(78vw,320px); transition:transform .4s var(--ease); }
.bf-cupwrap.is-target{ transform:scale(1.04); }
.bf-cupwrap.is-target .bf-drop{ opacity:1; transform:translate(-50%,0) scale(1); }
.bf-cupwrap.is-done{ animation:bfBounce .8s var(--ease); }
@keyframes bfBounce{ 30%{ transform:translateY(-10px) rotate(-2deg); } 60%{ transform:translateY(0) rotate(1.5deg); } }
.bf-cup{ width:100%; height:auto; overflow:visible; display:block; }
.bf-drop{ position:absolute; left:50%; top:-14px; transform:translate(-50%,6px) scale(.9); opacity:0; transition:opacity .25s, transform .3s var(--ease);
  background:var(--leaf); color:#fff; font-size:.8rem; font-weight:600; padding:.35rem .8rem; border-radius:999px; white-space:nowrap; }
.bf-shadow{ width:62%; height:16px; margin:-6px auto 0; border-radius:50%; background:radial-gradient(ellipse, rgba(28,26,23,.22), transparent 70%); }

/* svg parts */
.bf-cup .lvl{ transition:transform 1.15s cubic-bezier(.3,.7,.25,1), opacity .9s ease; }
.bf-cup .ice{ transition:transform .7s cubic-bezier(.3,1.35,.5,1), opacity .3s; }
.bf-cup .stream{ transition:opacity .2s; }
.bf-cup .swirl{ stroke-dasharray:260; stroke-dashoffset:260; transition:stroke-dashoffset 1.6s ease .3s, opacity .6s; }
.bf-cup .swirl.on{ stroke-dashoffset:0; }
.bf-cup .lid{ transition:transform .6s cubic-bezier(.3,1.4,.5,1), opacity .3s; }
.bf-cup .dust circle{ transition:opacity .4s; }
.bf-logo{ filter:drop-shadow(0 0 1.2px rgba(28,26,23,.35)); }

/* result */
.bf-result{ display:none; margin-top:1.2rem; padding:1.3rem 1.4rem; border-radius:16px; background:var(--ink); color:var(--paper); gap:.9rem; }
.bf-result.is-shown{ display:grid; animation:bfIn .6s var(--ease) both; }
.bf-result .label{ color:#9cc2a9; }
.bf-result h3{ font-size:clamp(1.7rem,1.3rem + 1.4vw,2.3rem); }
.bf-result p{ color:#c9c1b4; }
.bf-result .btn--primary{ background:#9cc2a9; color:var(--ink); }
.bf-result .btn--line{ border-color:var(--paper); color:var(--paper); }
.bf-result .btn--line:hover{ background:var(--paper); color:var(--ink); }
.bf-restart{ margin-top:1rem; font-size:.9rem; font-weight:600; color:var(--ink-2); text-decoration:underline; text-underline-offset:3px; padding:.5rem 0; }

@media (max-width: 959px){
  .bf-stage{ order:-1; padding:0; }
  .bf-tray{ grid-template-columns:repeat(auto-fill, minmax(100px,1fr)); }
  .bf-item svg{ width:44px; height:44px; }
}
@media (prefers-reduced-motion: reduce){
  .bf-cup .lvl,.bf-cup .ice,.bf-cup .lid,.bf-cup .swirl{ transition:none; }
  .bf-cupwrap.is-done{ animation:none; }
}
.bf-cup .ice,.bf-cup .foam,.bf-cup .dust,.bf-cup .lid{ transform-box:fill-box; transform-origin:center; }
.bf-cup .foam,.bf-cup .dust{ transform-box:view-box; transform-origin:0 0; transition:opacity .6s ease; }
.bf-tray[hidden]{ display:none; }
.bf-result.is-shown{ margin-top:1.4rem; }

/* phone layout: intro, then cup, then the tray right under it */
@media (max-width: 959px){
  .bf-grid{ gap:0; }
  .bf-play{ display:contents; }
  .bf-intro{ order:1; margin-bottom:.4rem; }
  .bf-stage{ order:2; padding:.6rem 0 0; }
  .bf-steps{ order:3; }
  .bf-step-title{ order:4; margin-top:.9rem; }
  .bf-hint{ order:5; }
  .bf-tray{ order:6; min-height:0; }
  .bf-result{ order:7; }
  .bf-restart{ order:8; justify-self:start; }
  .bf-cupwrap{ width:min(54vw,220px); }
  .bf-stage::before{ width:min(78vw,330px); }
  .bf-tray{ grid-template-columns:repeat(3,1fr); gap:.55rem; }
  .bf-item{ padding:.75rem .4rem .7rem; border-radius:14px; }
  .bf-item span{ font-size:.85rem; }
}
.bf-step-title b:empty{ display:none; }

/* ---------- v2 effects ---------- */
/* rippling surface */
.bf-cup .wave{ animation:bfWave 2.6s linear infinite; }
@keyframes bfWave{ to{ transform:translateX(-40px); } }
.bf-cup .wave-amp{ transform-box:fill-box; transform-origin:50% 100%; transition:transform .45s var(--ease); }
.bf-cup.is-pouring .wave-amp{ transform:scaleY(2.3); }
.bf-cup.is-pouring .wave{ animation-duration:.8s; }

/* the pour flows */
.bf-cup .stream{ stroke-dasharray:46 6; animation:bfFlow .45s linear infinite; transition:opacity .2s; }
@keyframes bfFlow{ to{ stroke-dashoffset:-52; } }

/* bubbles once there's coffee in */
.bf-cup .bubbles{ opacity:0; transition:opacity .8s; }
.bf-cup.has-base .bubbles{ opacity:1; }
.bf-cup .bubbles circle{ transform-box:fill-box; animation:bfRise var(--d,3s) ease-in infinite; animation-delay:var(--dl,0s); }
@keyframes bfRise{ 0%{ transform:translateY(0); opacity:0; } 20%{ opacity:.85; } 100%{ transform:translateY(-110px); opacity:0; } }

/* condensation: frío */
.bf-cup .dew > *{ opacity:0; transition:opacity .9s ease; transition-delay:var(--dl,0s); }
.bf-cup.is-cold .dew > *{ opacity:1; }
.bf-cup.is-cold .dew .drip{ animation:bfDrip var(--dd,7s) ease-in infinite; animation-delay:calc(var(--dl,0s) + 1.5s); }
@keyframes bfDrip{ 0%,35%{ transform:translateY(0); opacity:1; } 90%{ opacity:.9; } 100%{ transform:translateY(70px); opacity:0; } }

/* cup reacts when something lands */
.bf-cupwrap.is-squish{ animation:bfSquish .5s var(--ease); }
@keyframes bfSquish{ 0%{ transform:none; } 30%{ transform:scale(1.04,.95); } 65%{ transform:scale(.98,1.03); } 100%{ transform:none; } }

/* bean burst + glow at the finish */
.bf-bean{ position:absolute; width:16px; height:22px; margin:-11px 0 0 -8px; pointer-events:none; z-index:3; }
.bf-bean svg{ width:100%; height:100%; display:block; }
.bf-bean--leaf{ width:12px; height:12px; margin:-6px 0 0 -6px; border-radius:50%; background:#9cc2a9; }
.bf-stage::after{ content:""; position:absolute; width:min(70%,340px); aspect-ratio:1; border-radius:50%; border:2px solid rgba(46,94,69,.35); opacity:0; pointer-events:none; }
.bf-stage.is-glow::after{ animation:bfRing 1.2s var(--ease); }
@keyframes bfRing{ 0%{ transform:scale(.6); opacity:.9; } 100%{ transform:scale(1.35); opacity:0; } }

/* cards: tilt is set by JS, keep it smooth */
.bf-item{ transform-style:preserve-3d; will-change:transform; }
.bf-tray.is-busy .bf-item{ transform:none !important; }

/* result buttons */
.bf-result .btn svg{ flex:none; }
.bf-again{ color:#c9c1b4; font-weight:600; font-size:.92rem; text-decoration:underline; text-underline-offset:3px; padding:.6rem .2rem; }
.bf-again:hover{ color:var(--paper); }

@media (prefers-reduced-motion: reduce){
  .bf-cup .wave,.bf-cup .stream,.bf-cup .bubbles circle,.bf-cup .dew .drip{ animation:none !important; }
  .bf-cupwrap.is-squish{ animation:none; }
}

/* ---------- v3: realistic graphics ---------- */
.bf-cup .swirl{ stroke-dasharray:none; stroke-dashoffset:0; opacity:0; transition:opacity 1.6s ease .25s; }
.bf-cup .swirl.on{ opacity:.55; }
.bf-cup .surf{ stroke:rgba(255,255,255,.28); stroke-width:1; }
.bf-cup .surf-wrap{ transform-box:fill-box; transform-origin:50% 50%; }
.bf-cup.is-pouring .surf-wrap{ animation:bfSlosh .55s ease-in-out infinite alternate; }
@keyframes bfSlosh{ from{ transform:scale(1,1) rotate(0deg); } to{ transform:scale(1.01,1.7) rotate(-1.6deg); } }

.bf-cup .ice{ transition:transform .75s cubic-bezier(.3,1.3,.5,1), opacity .3s; }
.bf-cup .ice-bob{ transform-box:fill-box; transform-origin:center; }
.bf-cup.has-base .ice-bob{ animation:bfBob 3.4s ease-in-out infinite; animation-delay:var(--bd,0s); }
@keyframes bfBob{ 0%,100%{ transform:translateY(-1.5px) rotate(-1.5deg); } 50%{ transform:translateY(2px) rotate(1.5deg); } }

.bf-cup .caustic{ transition:opacity 1s ease, fill .8s; }
.bf-cup .frost{ opacity:0; transition:opacity 1.4s ease; pointer-events:none; }
.bf-cup.is-cold .frost{ opacity:.2; }
.bf-cup .dew > g{ opacity:0; transition:opacity 1s ease; transition-delay:var(--dl,0s); }
.bf-cup.is-cold .dew > g{ opacity:1; }
.bf-cup .straw{ transform-box:fill-box; transform-origin:center; transition:transform .9s cubic-bezier(.3,1.15,.5,1), opacity .3s; }
.bf-cup .stream{ transition:opacity .18s; }
.bf-cup .stream-main{ stroke-dasharray:44 5; animation:bfFlow .4s linear infinite; }

/* the ingredient tips over the cup to pour */
.bf-vessel{ position:absolute; z-index:4; left:39%; top:4%; width:22%; aspect-ratio:1; pointer-events:none; opacity:0;
  transform-origin:50% 10%; filter:drop-shadow(0 10px 14px rgba(28,26,23,.28)); }
.bf-vessel svg{ width:100%; height:100%; display:block; }
.bf-vessel.is-pouring{ animation:bfTip var(--ms,1600ms) cubic-bezier(.45,.05,.3,1) both; }
@keyframes bfTip{
  0%{ opacity:0; transform:translate(70%,-70%) rotate(-10deg); }
  16%{ opacity:1; transform:translate(0,0) rotate(-128deg); }
  84%{ opacity:1; transform:translate(0,0) rotate(-128deg); }
  100%{ opacity:0; transform:translate(70%,-70%) rotate(-20deg); }
}
.bf-shadow{ width:70%; height:18px; margin-top:-14px; background:radial-gradient(ellipse, rgba(28,26,23,.26), transparent 70%); }
@media (prefers-reduced-motion: reduce){
  .bf-cup .ice-bob,.bf-cup .surf-wrap,.bf-cup .stream-main{ animation:none !important; }
  .bf-vessel{ display:none; }
}

/* ---------- v4: hands-on controls ---------- */
.bf-actions{ display:flex; align-items:center; gap:1.2rem; margin-top:1.1rem; min-height:96px; }
.bf-act{ position:relative; flex:none; width:96px; height:96px; border-radius:50%; display:grid; place-items:center; text-align:center;
  background:var(--leaf); color:#fff; font-weight:700; font-size:.9rem; line-height:1.15; padding:.6rem;
  box-shadow:0 14px 30px -14px rgba(35,74,54,.75), inset 0 -4px 0 rgba(0,0,0,.18);
  touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;
  transition:transform .2s var(--ease), box-shadow .2s var(--ease), background .2s; }
.bf-act:hover{ background:var(--leaf-dk); }
.bf-act:active,.bf-act.is-active{ transform:scale(.94); box-shadow:0 6px 16px -10px rgba(35,74,54,.75), inset 0 3px 6px rgba(0,0,0,.25); }
.bf-act-ring{ position:absolute; inset:-7px; border-radius:50%; border:2px solid rgba(46,94,69,.35); animation:bfPulse 1.8s ease-out infinite; pointer-events:none; }
.bf-act.is-active .bf-act-ring{ animation-duration:.6s; border-color:rgba(46,94,69,.6); }
@keyframes bfPulse{ 0%{ transform:scale(.9); opacity:1; } 100%{ transform:scale(1.25); opacity:0; } }
.bf-act-label{ position:relative; }
.bf-act-side{ display:grid; gap:.6rem; justify-items:start; min-width:0; }
.bf-meter{ font-weight:600; color:var(--ink-2); font-size:1rem; min-height:1.4em; transition:color .2s; }
.bf-meter.is-good{ color:var(--leaf); }
.bf-meter.is-over{ color:#b5651d; }

/* while the visitor holds to pour, the liquid follows instantly */
.bf-cup.is-live .lvl{ transition:none !important; }

/* fill line */
.bf-cup .target,.bf-cup .target-tag{ opacity:0; transition:opacity .4s; pointer-events:none; }
.bf-cup.show-target .target,.bf-cup.show-target .target-tag{ opacity:1; }
.bf-cup.show-target .target line{ animation:bfDash 1.2s linear infinite; }
@keyframes bfDash{ to{ stroke-dashoffset:-22; } }

/* the vessel hovers, tilts while you hold, squirts when you pump */
.bf-vessel{ transition:transform .38s cubic-bezier(.4,.1,.3,1), opacity .3s; transform:translate(90%,-90%) rotate(0deg); }
.bf-vessel.is-ready{ opacity:1; transform:translate(42%,-38%) rotate(-28deg); animation:bfHover 2.4s ease-in-out infinite; }
.bf-vessel.is-held{ transform:translate(0,0) rotate(-128deg); animation:none; }
.bf-vessel.is-squirt{ animation:bfSquirt .52s cubic-bezier(.4,.1,.3,1); }
@keyframes bfHover{ 0%,100%{ translate:0 0; } 50%{ translate:0 -4px; } }
@keyframes bfSquirt{ 0%{ transform:translate(42%,-38%) rotate(-28deg); } 35%,60%{ transform:translate(0,0) rotate(-128deg); } 100%{ transform:translate(42%,-38%) rotate(-28deg); } }

/* stirring */
.bf-cup .marble{ transform-box:fill-box; transform-origin:center; }
.bf-cupwrap.is-stirring{ cursor:grab; }
.bf-cupwrap.is-stirring:active{ cursor:grabbing; }
.bf-cupwrap{ touch-action:pan-y; -webkit-user-select:none; user-select:none; }
.bf-cupwrap.is-stirring{ touch-action:none; }

@media (max-width: 959px){
  .bf-actions{ order:6; }
  .bf-act{ width:88px; height:88px; }
}
@media (prefers-reduced-motion: reduce){
  .bf-act-ring,.bf-vessel.is-ready,.bf-cup.show-target .target line{ animation:none !important; }
}
.bf-cupwrap.is-hands{ touch-action:none; }
.bf-vessel{ width:28%; left:36%; top:3.5%; }

/* ---------- hero shortcut: "Make your own Frio" ---------- */
.play-chip{ position:absolute; z-index:3; left:-1.6rem; top:2.2rem; display:flex; align-items:center; gap:.75rem;
  padding:.6rem .95rem .6rem .6rem; border-radius:999px; background:var(--white); color:var(--ink); text-decoration:none;
  box-shadow:0 16px 34px -16px rgba(28,26,23,.45), 0 0 0 1px rgba(28,26,23,.06);
  transition:transform .35s var(--ease), box-shadow .35s var(--ease); animation:playIn .8s var(--ease) 1.2s both; }
.play-chip::before{ content:""; position:absolute; inset:-5px; border-radius:999px; border:2px solid rgba(46,94,69,.4); animation:bfPulse 2.2s ease-out infinite; pointer-events:none; }
.play-chip:hover{ transform:translateY(-3px) scale(1.03); box-shadow:0 22px 40px -16px rgba(28,26,23,.5), 0 0 0 1px rgba(46,94,69,.25); }
.play-cup{ width:42px; height:42px; border-radius:50%; background:var(--leaf-tint); display:grid; place-items:center; flex:none; }
.play-cup svg{ width:20px; height:26px; animation:playBob 2.4s ease-in-out infinite; }
.play-fill{ animation:playFill 3.2s ease-in-out infinite; }
.play-milk{ animation:playMilk 3.2s ease-in-out infinite; }
.play-text{ display:grid; line-height:1.2; }
.play-text strong{ font-weight:700; font-size:.95rem; }
.play-text small{ font-size:.78rem; color:var(--ink-2); }
.play-arrow{ width:28px; height:28px; border-radius:50%; background:var(--leaf); color:#fff; display:grid; place-items:center; font-size:.9rem; flex:none;
  animation:playNudge 1.6s ease-in-out infinite; }
@keyframes playIn{ from{ opacity:0; transform:translateY(12px) scale(.94); } }
@keyframes playBob{ 0%,100%{ transform:rotate(-6deg); } 50%{ transform:rotate(6deg); } }
@keyframes playFill{ 0%{ transform:translateY(24px); } 40%,80%{ transform:translateY(8px); } 100%{ transform:translateY(24px); } }
@keyframes playMilk{ 0%,30%{ transform:translateY(24px); } 60%,80%{ transform:translateY(15px); } 100%{ transform:translateY(24px); } }
@keyframes playNudge{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(3px); } }
html.intro-on .play-chip{ animation-delay:2.6s; }
@media (max-width: 959px){
  .play-chip{ left:.7rem; top:.7rem; padding:.45rem .8rem .45rem .45rem; gap:.6rem; }
  .play-cup{ width:36px; height:36px; }
  .play-text strong{ font-size:.88rem; }
  .play-arrow{ width:24px; height:24px; }
}
@media (prefers-reduced-motion: reduce){
  .play-chip,.play-chip::before,.play-cup svg,.play-fill,.play-milk,.play-arrow{ animation:none !important; }
}
