/* =====================================================================
   Côte de Nuits · kode   the evening's code, then Proppen (the cork)
   Magnus 09.11 chose prototype C "Proppen" (.shots/v12/kode/C/, FEEDBACK-30-10 §54, §58) as the evening's entrance.
   Ported from its kode.css unchanged in look: a painted bottle of Burgundy in a candlelit cellar; the evening's code
   is entered below it; the right code eases the cork out, warm light wells up out of the neck, rises and fills the
   stage, and the guest book (the app's own names screen, css/screens/intro.css) comes up out of the light, standing
   over the same cellar softly blurred (.pk-cellar, also the ground of the hand-over to Porten, js/screens/to-gate.js).
   Builds on css/base.css and intro.css (tokens, .op-*, the in-flame / in-wash / in-rule keyframes): nothing here
   invents a colour. Prefix "pk-" (as the prototype). Only transform and opacity animate.
   ===================================================================== */

/* the screen: opaque ink, its own way in (the veil and the dark, js enter) instead of core's settle; blend modes
   stay inside it (never reaching the world's canvas under the stage) */
.scr-kode{background:var(--ink);isolation:isolate;overflow:hidden;overflow:clip}
.scr-kode.is-entering{opacity:1;transform:none}
/* the cellar covers the stage: the world under it (and its stand-in painting) is not composited meanwhile
   (js/screens/kode.js under(); the world keeps booting and drawing, nobody sees it) */
#op-stage.pk-under #op-world,#op-stage.pk-under #op-backdrop{visibility:hidden}

/* ---------------- the cellar: the painting, the candle, the bottle's light ---------------- */
.pk-world{position:absolute;inset:0;overflow:hidden;overflow:clip}
/* the camera: translate + scale from the stage's top-left corner (js: cam) */
.pk-scene{position:absolute;left:0;top:0;width:1180px;height:820px;transform-origin:0 0}
/* the painting runs 140 px above the stage (a dark band of the vault for the push-in toward the neck) */
.pk-bg{position:absolute;left:0;top:-140px;width:1180px;height:960px;display:block;-webkit-user-drag:none;pointer-events:none}

/* the candle keeps burning: a living halo over the painted flame, and its warmth breathing on the glass */
.pk-candle{position:absolute;left:180px;top:160px;width:0;height:0;pointer-events:none}
.pk-candle i{position:absolute;border-radius:50%}
.pk-c-halo{left:-70px;top:-74px;width:140px;height:140px;mix-blend-mode:screen;
  background:radial-gradient(closest-side,rgba(255,226,170,.42),rgba(255,184,104,.14) 46%,rgba(255,170,90,0));
  animation:in-flame 2.9s ease-in-out infinite}
.pk-c-wash{left:-300px;top:-260px;width:600px;height:600px;
  background:radial-gradient(closest-side,rgba(255,170,90,.10),rgba(255,150,80,.04) 55%,rgba(255,150,80,0));
  animation:in-wash 5.3s ease-in-out infinite}
/* the candle's light on the bottle's left edge, breathing a little with the flame */
.pk-sheen{position:absolute;left:510px;top:120px;width:110px;height:380px;pointer-events:none;mix-blend-mode:screen;opacity:.55;
  background:radial-gradient(50% 50% at 40% 50%,rgba(255,190,120,.16),rgba(255,170,100,0) 70%);
  animation:pk-sheen 4.7s ease-in-out infinite}
@keyframes pk-sheen{0%,100%{opacity:.55}38%{opacity:.8}61%{opacity:.45}}

/* the wine lit from within when the light wells up (an SVG of the bottle's own outline, js) */
.pk-inner{position:absolute;left:0;top:0;width:1180px;height:820px;overflow:visible;pointer-events:none;opacity:0;mix-blend-mode:screen}

/* the cork: clipped at the lip, so it comes up out of the neck; free once it has left it */
.pk-corkwrap{position:absolute;overflow:hidden;pointer-events:none}
.pk-corkwrap.is-free{overflow:visible}
.pk-cork{position:absolute;display:block;-webkit-user-drag:none;transform-origin:50% 100%}

/* the light: gathering under the cork, the bloom at its release, the column rising out of the neck */
.pk-lip,.pk-bloom,.pk-plume{position:absolute;display:block;pointer-events:none;opacity:0;will-change:transform,opacity}
.pk-lip{width:76px;height:52px;margin:-30px 0 0 -38px;border-radius:50%;mix-blend-mode:screen;
  background:radial-gradient(closest-side,rgba(255,244,222,.95),rgba(255,206,140,.4) 42%,rgba(234,164,92,0))}
.pk-bloom{width:360px;height:360px;margin:-180px 0 0 -180px;border-radius:50%;mix-blend-mode:screen;
  background:radial-gradient(closest-side,rgba(255,250,238,1),rgba(255,226,170,.72) 20%,rgba(240,170,96,.26) 52%,rgba(234,164,92,0))}
/* the column's light centre sits on the mouth (92 % down its box); its foot fades out over the neck (mask), so
   there is no edge where the light begins */
.pk-plume{width:380px;height:640px;margin:-589px 0 0 -190px;transform-origin:50% 92%;mix-blend-mode:screen;
  background:radial-gradient(50% 92% at 50% 92%,rgba(255,246,226,.92) 0,rgba(255,221,160,.6) 15%,rgba(240,170,96,.26) 40%,rgba(208,104,58,.08) 68%,rgba(208,104,58,0) 100%);
  -webkit-mask-image:linear-gradient(0deg,transparent 0,#000 9%);mask-image:linear-gradient(0deg,transparent 0,#000 9%)}
.pk-plume.is-core{width:84px;height:260px;margin:-239px 0 0 -42px;
  background:radial-gradient(50% 92% at 50% 92%,rgba(255,252,242,.9) 0,rgba(255,232,186,.5) 32%,rgba(255,214,150,0) 100%)}
/* the light welling up: soft swells that rise out of the neck and open as they rise */
.pk-puffs{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none}
.pk-puff{position:absolute;left:0;top:0;width:240px;height:240px;margin:-120px 0 0 -120px;border-radius:50%;opacity:0;
  will-change:transform,opacity;
  background:radial-gradient(closest-side,rgba(255,238,204,.6),rgba(250,200,130,.3) 38%,rgba(234,164,92,.09) 68%,rgba(234,164,92,0))}

/* under the code: the table falls into the dark */
.pk-shade{position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(180deg,rgba(9,2,4,0) 0,rgba(9,2,4,0) 58%,rgba(9,2,4,.46) 78%,rgba(9,2,4,.7) 100%)}

/* ---------------- the code ---------------- */
.pk-code{position:absolute;inset:0;pointer-events:none}
.pk-code>*{pointer-events:auto}
/* the words and the four lines; they lift above the iPad's own keyboard when it is open (js kbd) */
.pk-lift{position:absolute;inset:0;pointer-events:none!important;transition:transform .55s var(--ease-out)}
.pk-lift>*{pointer-events:auto}
.pk-keys{transition:opacity .4s var(--ease-out)}
.scr-kode.is-kbd .pk-lift{transform:translateY(var(--lift,0px))}
.scr-kode.is-kbd .pk-keys{opacity:0;pointer-events:none}
.scr-kode.is-kbd .pk-shade{opacity:1}
.pk-kbdshade{position:absolute;inset:0;pointer-events:none;opacity:0;background:rgba(9,2,4,.5);transition:opacity .5s var(--ease-out)}
.scr-kode.is-kbd .pk-kbdshade{opacity:1}
.pk-kick{position:absolute;left:0;right:0;top:562px;display:flex;align-items:center;justify-content:center;gap:16px;white-space:nowrap;
  font:400 12.5px/1 var(--sans);letter-spacing:.32em;text-transform:uppercase;color:var(--brass-hi);text-shadow:var(--halo);pointer-events:none}
.pk-kick span{margin-right:-.32em}
.pk-kick i{display:block;width:40px;height:1px;background:linear-gradient(90deg,rgba(226,192,148,0),rgba(226,192,148,.75));transform-origin:100% 50%}
.pk-kick i:last-child{background:linear-gradient(270deg,rgba(226,192,148,0),rgba(226,192,148,.75));transform-origin:0 50%}
.pk-lede{position:absolute;left:0;right:0;top:584px;height:30px;margin:0;text-align:center;pointer-events:none;
  font:italic 400 22px/30px var(--serif);color:var(--cream-hi);text-shadow:var(--halo)}
.pk-lede span{position:absolute;left:0;right:0;top:0;transition:opacity .5s var(--ease-out),transform .6s var(--ease-out)}
.pk-lede-err{opacity:0;transform:translateY(6px);color:var(--blush)}
.pk-lede.is-err .pk-lede-t{opacity:0;transform:translateY(-6px)}
.pk-lede.is-err .pk-lede-err{opacity:1;transform:none}

/* four places for the four figures: a figure on a brass line each, as the guest book writes a name on one */
.pk-slots{position:absolute;left:438px;top:620px;width:304px;height:70px}
.pk-slot{position:absolute;top:0;width:56px;height:70px}
.pk-digit{position:absolute;left:0;right:0;top:4px;height:54px;text-align:center;font-size:46px;line-height:54px;color:var(--cream-hi);
  text-shadow:0 1px 2px rgba(9,2,4,.6),0 0 18px rgba(9,2,4,.7);opacity:0;transform:translateY(10px);
  transition:opacity .35s var(--ease-out),transform .5s var(--ease-out),color .4s}
.pk-slot.is-filled .pk-digit{opacity:1;transform:none}
.pk-rule{position:absolute;left:4px;right:4px;bottom:6px;height:1px;background:var(--brass-lo);transition:background .4s}
.pk-slot.is-filled .pk-rule{background:rgba(201,156,110,.6)}
.pk-slot.is-current .pk-rule{animation:in-rule 2.8s ease-in-out infinite}
/* the lamp in the line: the next place to write glows softly; the right code lights all four */
.pk-glow{position:absolute;left:-6px;right:-6px;bottom:5px;height:3px;border-radius:2px;opacity:0;transform:scaleX(.2);
  background:radial-gradient(closest-side,rgba(255,215,156,.95),rgba(255,215,156,0));
  transition:opacity .4s var(--ease-out),transform .6s var(--ease-out)}
.pk-slot.is-current .pk-glow{opacity:.75;transform:scaleX(.62)}
.pk-slot.is-lit .pk-glow{opacity:1;transform:scaleX(1);transition-duration:.3s,.5s}
.pk-slot.is-lit .pk-rule{background:rgba(226,192,148,.85)}
.pk-slot.is-lit .pk-digit{color:#fff1dc;text-shadow:0 1px 2px rgba(9,2,4,.5),0 0 22px rgba(255,190,120,.35)}
.pk-slots.is-wrong .pk-digit{color:var(--blush)}
/* the iPad's own number keyboard: an invisible field over the four places (tap them) */
.pk-hidden{position:absolute;left:0;top:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;background:transparent;
  color:transparent;caret-color:transparent;font-size:16px;opacity:.011;-webkit-appearance:none;appearance:none;border-radius:0;cursor:pointer}

/* the keys: a calm row of figures, 1 … 9 0 and a small back arrow */
.pk-keys{position:absolute;left:0;right:0;top:716px;height:58px}
.pk-key{position:absolute;top:0;width:58px;height:58px;margin:0;padding:0;border:0;border-radius:50%;cursor:pointer;background:none;color:var(--cream-hi);
  font-size:27px;line-height:58px;text-align:center;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.pk-key::before,.pk-key::after{content:"";position:absolute;inset:0;border-radius:50%;pointer-events:none}
.pk-key::before{background:rgba(20,9,10,.46);box-shadow:inset 0 0 0 1px rgba(201,156,110,.30)}
/* pressed: the key lights like Klar (a warm lamp-brown fill, its ring brighter, a little glow) */
.pk-key::after{opacity:0;background:linear-gradient(180deg,#5a2a16,#2a120c);
  box-shadow:inset 0 1px 0 rgba(255,220,172,.24),inset 0 0 0 1px rgba(201,156,110,.55),0 0 34px -6px rgba(234,164,92,.6);
  transition:opacity .45s var(--ease-lamp)}
.pk-key>span{position:relative;z-index:1;display:block;transition:transform .25s var(--ease-out)}
.pk-key.is-press::after{opacity:1;transition-duration:.06s}
.pk-key.is-press>span{transform:scale(.94)}
.pk-key.is-back::before{background:none;box-shadow:none}
.pk-key.is-back .op-glyph{display:block;margin:0 auto;stroke:var(--brass)}
.pk-key.is-back>span{line-height:0}

/* the demo code, only with ?demo=1 */
.pk-demo{position:absolute;right:26px;bottom:20px;font:400 11px/1 var(--sans);letter-spacing:.14em;color:var(--brass);opacity:.5;pointer-events:none;white-space:nowrap}

/* ---------------- the light that fills the stage ---------------- */
.pk-motes{position:absolute;left:0;top:0;width:1180px;height:820px;pointer-events:none;z-index:4}
.pk-flood{position:absolute;left:0;top:0;width:640px;height:640px;margin:-320px 0 0 -320px;border-radius:50%;pointer-events:none;opacity:0;z-index:7;
  will-change:transform,opacity;
  background:radial-gradient(closest-side,#fff6e6 0,#ffe6bc 18%,rgba(250,200,134,.96) 38%,rgba(234,164,92,.78) 58%,rgba(208,104,58,.42) 76%,
    rgba(160,50,40,.14) 90%,rgba(126,21,40,0) 100%)}
/* at the full: the whole stage is the light, pale gold at the neck, deepening to amber and a breath of wine at the edges */
.pk-wash{position:absolute;inset:0;pointer-events:none;opacity:0;z-index:7;will-change:opacity;
  background:radial-gradient(80% 80% at 50% 39%,#ffe6b8 0,#f9cc8c 22%,#eba862 50%,#c46a40 78%,#7e2630 100%)}
.pk-veil{position:absolute;inset:0;background:var(--ink);pointer-events:none;z-index:9}
/* the way in: the candle first, then its light reaches the bottle and the room */
.pk-dark{position:absolute;inset:0;pointer-events:none;z-index:8;opacity:0;
  background:radial-gradient(circle at 180px 162px,rgba(9,2,4,0) 0,rgba(9,2,4,.42) 70px,rgba(9,2,4,.9) 300px,var(--ink) 620px)}
/* at the full light the guest book is mounted under it: the light is lifted onto the stage above the screens and
   fades there (js handOff, its own opacity on the compositor) */
.pk-out{position:absolute;inset:0;pointer-events:none;z-index:30}
/* the calm way (reduced motion, no GSAP): the code goes, the cellar crossfades into the guest book */
.scr-kode.is-calmout .pk-code,.scr-kode.is-calmout .pk-demo{opacity:0;transition:opacity .5s var(--ease-in-out)}

/* ---------------- the guest book's ground (names over the cellar; the way to the gate) ---------------- */
/* the cellar softly blurred and darkened; what is left of the light is a warm breath over the table, where the
   bottle stands open between the cards */
.pk-cellar{position:absolute;inset:0;overflow:hidden;overflow:clip;pointer-events:none;background:var(--ink)}
.pk-cellar-img{position:absolute;left:0;top:0;width:1180px;height:820px;display:block;-webkit-user-drag:none}
.pk-cellar-dim{position:absolute;inset:0;background:rgba(9,2,4,.34)}
.pk-cellar-glow{position:absolute;left:290px;top:-260px;width:600px;height:600px;border-radius:50%;
  background:radial-gradient(closest-side,rgba(255,200,130,.24),rgba(234,164,92,.08) 55%,rgba(234,164,92,0));
  animation:in-wash 6.2s ease-in-out infinite}

/* ---------------- calm: no movement, a fade ---------------- */
@media (prefers-reduced-motion: reduce){
  .pk-c-halo,.pk-c-wash,.pk-sheen,.pk-cellar-glow,.pk-slot.is-current .pk-rule{animation:none}
  .pk-digit{transform:none!important}
}
.scr-kode.pk-calm .pk-c-halo,.scr-kode.pk-calm .pk-c-wash,.scr-kode.pk-calm .pk-sheen{animation:none}
.scr-kode.pk-calm .pk-digit{transform:none!important}
.op-shot .scr-kode *,.op-shot .pk-cellar *{animation:none!important}
