/* Nila 01 hero: the school office on one screen, on a sheet of Naalai-blue construction paper.
   The ground is set through the kit's ground variables (not .pk-ground--blue, whose descendant rules would turn the
   text inside every paper card pale). The stage: Nila rises behind a paper laptop with the office screen, and a late
   alert flies from it to a parent's phone. The modules board (02) and the key rack (03) share this page's paper and
   its stepped entrances (the keyframes live here). Paper pieces enter on twos (each pose held 83 ms); see 01-hero.js. */

.ni, .nl { --pk-c: var(--blue); --pk-tex: var(--pk-tex-blue); --pk-tex-size: 512px 512px; --pk-blend: normal;
  --pk-fg: #FFFFFF; --pk-fg-2: #E3E9FF; --pk-rim: #9FB2F2; color: #FFFFFF; }
:is(.ni, .nl) :focus-visible { outline-color: var(--lemon); }
.ni { padding-top: clamp(44px, 5vw, 80px); overflow-x: clip; } /* the phone slides in from past the edge: never a sideways scroll */
.ni__top { display: grid; gap: clamp(40px, 5vw, 72px); align-items: center; }
@media (min-width: 980px) { .ni__top { grid-template-columns: minmax(0, 4.5fr) minmax(0, 7.5fr); } }

/* ---------- Copy */
.ni__copy { max-width: 36rem; }
.ni__logo { display: block; width: auto; height: 84px; margin: 0 0 clamp(14px, 2vw, 22px) -2px; } /* Nila's own logo, on the blue paper */
@media (max-width: 559.98px) { .ni__logo { height: 70px; } }
.ni__h { color: #FFFFFF; text-wrap: balance; }
.ni__h1 { display: block; font: 800 clamp(40px, 4.6vw, 68px)/1.02 var(--font-display); letter-spacing: -.02em; }
.ni__h2 { display: block; margin-top: 12px; font: 800 clamp(22px, 2vw, 29px)/1.2 var(--font-display); color: var(--lemon); letter-spacing: -.005em; }
.ni__lead { margin-top: 20px; font: 600 var(--t-lead)/1.55 var(--font-body); color: #F0F3FF; max-width: 33em; }
.ni__lead span[lang] { font-weight: 700; color: #FFFFFF; }
/* the price: a sun-yellow paper tag, punched and tied */
.ni__price { position: relative; isolation: isolate; display: grid; justify-items: start; width: fit-content; margin-top: 34px;
  padding: 20px 34px 22px 58px; color: var(--ink); background: var(--sun);
  border-radius: 14px 26px 22px 12px / 12px 22px 26px 14px; rotate: -2deg;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 1px 1.5px rgba(11, 26, 85, .4), 0 16px 26px -14px rgba(11, 26, 85, .6); }
.ni__price::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: url(/assets/art/textures/grain-tile.webp) 0 0 / 256px 256px; mix-blend-mode: multiply; opacity: .45; }
.ni__hole { position: absolute; left: 20px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  background: #22349C; box-shadow: inset 0 2px 2px rgba(0, 0, 0, .35), 0 0 0 3px #FFE28A; }
.ni__hole::before { content: ""; position: absolute; left: -46px; top: -30px; width: 58px; height: 38px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 58 38'%3E%3Cpath d='M2 2C14 6 22 16 30 24S46 35 54 36' fill='none' stroke='%23FFF4DC' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
.ni__amount { font: 800 clamp(68px, 7.4vw, 108px)/.86 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.ni__per { margin-top: 8px; font: 800 20px/1.2 var(--font-body); color: var(--ink); }
.ni__all { margin-top: 4px; font: 700 16.5px/1.3 var(--font-body); color: #5A3A06; }
.ni__actions { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-top: 34px; }
.ni__small { margin-top: 18px; max-width: 30em; font: 600 var(--t-small)/1.5 var(--font-body); color: #E3E9FF; }

/* ---------- The stage (sized in container units, so the drawing keeps its composition at every width) */
.ni__stage { position: relative; container-type: inline-size; width: 100%; max-width: 720px; justify-self: center; }
.ni__scene { position: relative; height: 96cqi; }
.ni__moon { position: absolute; z-index: 0; right: -4cqi; top: -11cqi; width: 30cqi; margin: 0; }
.ni__moon-art { position: relative; display: block; aspect-ratio: 300 / 305; }
.ni__pose { position: absolute; inset: 0; width: 100%; height: 100%; }
.ni__pose--wink { opacity: 0; }
.ni.is-wink .ni__pose--wink { opacity: 1; }
.ni.is-wink .ni__pose--smile { opacity: 0; }
.ni__star { position: absolute; left: 48%; top: 8.5%; width: 13.333%; height: auto; transform-origin: 50% 50%; }
.ni__bubble { position: absolute; right: 96%; top: 10%; width: max-content; max-width: 25cqi;
  font: 800 clamp(14px, 2.2cqi, 16px)/1.3 var(--font-body); --pk-bub: var(--card);
  border-radius: 1.1em 1.25em .3em 1.15em / 1.2em 1.1em .3em 1.25em; }
.ni__bubble::after { left: auto; right: -.55em; clip-path: polygon(0 0, 100% 100%, 0 100%); }
/* the laptop is wide enough that its screen stays above the kit's 520 px compact point at desktop sizes */
.ni__laptop { position: absolute; z-index: 1; left: 0; top: 13cqi; width: 92cqi; }
.ni__laptop .pk-laptop { --pk-laptop-w: 100%; }
.ni__laptop .pk-nila__att { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.ni__laptop .pk-nila__classes { align-content: space-evenly; }
/* the screen at 360 to 520 wide (desktops from 980 to about 1250 wide): the full office, not the phone's short version
   with two half-empty cards */
@container (min-width: 360px) and (max-width: 520px) {
  .ni__laptop .pk-nila__grid { grid-template-columns: 1.05fr 1fr; grid-template-rows: auto 1fr; padding: 1em 1.1em 1.1em; gap: .8em; }
  .ni__laptop .pk-nila__att { grid-row: span 2; }
  .ni__laptop .pk-nila__classes, .ni__laptop .pk-nila__notes li + li { display: grid; }
  .ni__laptop .pk-nila__mods { display: block; }
}
.ni__sticker { position: absolute; z-index: 2; left: 4cqi; top: -1.8cqi; rotate: -6deg; box-shadow: 0 1px 1px rgba(11, 26, 85, .3), 0 6px 10px -6px rgba(11, 26, 85, .5); }
.ni__floor { position: absolute; z-index: 0; left: 4cqi; top: 72cqi; width: 86cqi; height: 6cqi; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(8, 18, 70, .42), rgba(8, 18, 70, 0)); pointer-events: none; }
.ni__phone { position: absolute; z-index: 2; right: -1cqi; top: 39cqi; width: 23cqi; rotate: 4deg; }
.ni__phone .pk-phone { --pk-phone-w: 100%; }
.ni__phone .pk-phone__app .tag { margin-left: auto; height: auto; min-height: 1.7em; padding: .2em .6em; font-size: max(11px, .7em); }
.ni__ph { padding: .2em 1.05em 1em; }
.ni__ph-day { font: 800 1.7em/1 var(--font-display); color: var(--blue); letter-spacing: -.01em; }
.ni__ph-who { margin-top: .3em; font: 800 .82em/1.2 var(--font-body); color: var(--ink); }
.ni__ph-list { display: grid; gap: .55em; margin-top: .9em; }
.ni__ph-list li { display: flex; align-items: center; gap: .6em; padding: .55em .6em; border-radius: .7em .85em .75em .6em / .78em .6em .85em .7em;
  background: var(--card); font: 800 .82em/1 var(--font-body); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(90, 42, 0, .14), 0 .35em .65em -.45em rgba(90, 42, 0, .4); }
.ni__ph-list img { width: 2.2em; height: 2.2em; flex: none; }
.ni__alert { position: absolute; z-index: 3; right: 6cqi; top: 60cqi; width: 50cqi; rotate: -2deg; }
.ni__alert .pk-alert { --pk-fs: clamp(11.5px, 2.2cqi, 15.5px); box-shadow: var(--pk-edge-light), 0 1px 1.5px rgba(11, 26, 85, .35), 0 22px 34px -16px rgba(11, 26, 85, .65); }
.ni__alert .pk-alert__title { font-size: 1.12em; }

@media (max-width: 599.98px) {
  .ni__price { padding: 18px 26px 20px 52px; }
  /* phone: the late alert sits under the laptop at a size that can be read */
  .ni__scene { height: auto; padding-top: 34cqi; display: grid; }
  .ni__laptop { position: relative; top: auto; width: 100%; }
  .ni__floor, .ni__phone { display: none; }
  .ni__alert { position: relative; right: auto; top: auto; width: 92%; margin: -8cqi 0 0 auto; }
  .ni__alert .pk-alert { --pk-fs: 14.5px; }
  .ni__moon { width: 30cqi; top: 0; }
  .ni__sticker { left: -1cqi; top: -6.5cqi; }
  .ni__bubble { top: 0; font-size: 14px; max-width: 40cqi; }
}

/* ---------- Entrances (on twos). Pre-states only once 06-nila.js has marked the section (.b-ready) and motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.rm) :is(.ni, .nm, .nl) [data-b].b-wait:not(.b-in) { opacity: 0; }
  :is(.ni, .nm, .nl) [data-b].b-in { animation: var(--b-anim) var(--b-dur, 500ms) steps(1, end) var(--b-at, 0ms) both; }
  :is(.ni, .nm) [data-b="drop"], .nm [data-b="board"] { --b-anim: ni-drop; }
  .nm [data-b="pin"] { --b-anim: ni-pin; --b-dur: 900ms; transform-origin: 50% 10px; }
  .ni [data-b="rise"] { --b-anim: ni-rise; --b-dur: 830ms; }
  .ni [data-b="slide"] { --b-anim: ni-slide; --b-dur: 580ms; }
  .ni [data-b="floor"] { --b-anim: ni-floor; }
  .ni [data-b="fly"] { --b-anim: ni-fly; --b-dur: 1050ms; }
  .nl [data-b="swing"] { --b-anim: ni-fade; --b-dur: 250ms; }
  .ni .ni__star.is-twinkle { animation: ni-twinkle 667ms steps(1, end) both; }
}
/* the stage is the first view: its pieces wait without the script's help (scripting is known when the CSS is read),
   and show by themselves after 3 s if the script never runs */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .ni__stage [data-b]:not(.b-in) { opacity: 0; animation: ni-failsafe 1ms 3s forwards; }
}
@keyframes ni-failsafe { to { opacity: 1; } }
@keyframes ni-drop {
  0% { opacity: 0; transform: translateY(-28px) rotate(-1.4deg) scale(1.03); }
  16.67% { opacity: 1; transform: translateY(-15px) rotate(-.8deg) scale(1.016); }
  33.33% { transform: translateY(-6px) rotate(-.3deg) scale(1.006); }
  50% { transform: translateY(-1.5px) rotate(-.08deg) scale(1.001); }
  66.67%, 100% { opacity: 1; transform: none; }
}
/* a module is pinned to the board: it drops, the pin catches, it swings a few times and hangs (paper motion "pin") */
@keyframes ni-pin {
  0% { opacity: 0; transform: translateY(-20px) rotate(-11deg) scale(1.05); animation-timing-function: var(--pm-fall); }
  22% { opacity: 1; }
  30% { opacity: 1; transform: translateY(0) rotate(6deg) scale(1.02, .96); animation-timing-function: var(--pm-wobble); }
  100% { opacity: 1; transform: none; }
}
@keyframes ni-rise {
  0% { opacity: 0; transform: translateY(26%); }
  10% { opacity: .5; transform: translateY(20%); }
  20% { opacity: 1; transform: translateY(14%); }
  30% { transform: translateY(9%); }
  40% { transform: translateY(5.5%); }
  50% { transform: translateY(3%); }
  60% { transform: translateY(1.4%); }
  70% { transform: translateY(.5%); }
  80%, 100% { opacity: 1; transform: none; }
}
@keyframes ni-slide {
  0% { opacity: 0; transform: translateX(30%) rotate(8deg); }
  14.3% { opacity: 1; transform: translateX(15%) rotate(4.5deg); }
  28.6% { transform: translateX(6%) rotate(2deg); }
  42.9% { transform: translateX(2%) rotate(.6deg); }
  57.1%, 100% { opacity: 1; transform: none; }
}
@keyframes ni-floor {
  0% { opacity: .2; transform: scale(1.3, 1.8); }
  16.67% { opacity: .45; transform: scale(1.18, 1.45); }
  33.33% { opacity: .75; transform: scale(1.07, 1.18); }
  50% { opacity: .92; transform: scale(1.02, 1.04); }
  66.67%, 100% { opacity: 1; transform: none; }
}
/* the alert leaves the office screen (--fx, --fy: set by 06-nila.js from the layout) and lands on the phone */
@keyframes ni-fly {
  0% { opacity: 0; transform: translate(var(--fx, -40cqi), var(--fy, -22cqi)) scale(.36) rotate(-10deg); animation-timing-function: cubic-bezier(.3, .7, .25, 1); }
  14% { opacity: 1; }
  60% { opacity: 1; transform: translate(0, 0) scale(1.04, .96) rotate(1.8deg); animation-timing-function: var(--pm-spring); }
  100% { opacity: 1; transform: none; }
}
@keyframes ni-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ni-twinkle {
  0% { transform: scale(1) rotate(0deg); }
  12.5% { transform: scale(.72) rotate(-10deg); }
  25% { transform: scale(1.22) rotate(8deg); }
  37.5% { transform: scale(.94) rotate(-3deg); }
  50%, 100% { transform: none; }
}

/* ---------- Preferences */
@media (prefers-reduced-motion: reduce) {
  :is(.ni, .nm, .nl) [data-b] { animation: none !important; opacity: 1 !important; transform: none !important; }
}
@media (prefers-contrast: more) {
  .ni__price { box-shadow: inset 0 0 0 2px var(--ink); }
  .ni__price::after { display: none; }
  .ni__small, .ni__lead { color: #FFFFFF; }
}
@media (forced-colors: active) {
  .ni__price { border: 1px solid CanvasText; }
}

/* R5: Nila, live in 3D (static picture first), in the corner of the stage; her bubble stays at her side */
.ni__moon.toy3d { width: 34cqi; right: -2cqi; top: -22cqi; z-index: 2; }
@media (max-width: 899.98px) { .ni__moon.toy3d { width: 38cqi; top: -12cqi; right: 0; } }

/* R6 motion: the laptop's class bars grow from the left once the laptop has landed, one after another, and settle (spring) */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.rm) .ni__laptop.b-in .pk-nila__classes i::after { transform-origin: 0 50%; animation: ni-bar 760ms var(--pm-spring) calc(1150ms + var(--k, 0) * 90ms) backwards; }
  .pk-nila__classes li:nth-child(2) i::after { --k: 1; } .pk-nila__classes li:nth-child(3) i::after { --k: 2; }
  .pk-nila__classes li:nth-child(4) i::after { --k: 3; } .pk-nila__classes li:nth-child(5) i::after { --k: 4; }
}
@keyframes ni-bar { 0% { transform: scaleX(0); animation-timing-function: var(--pm-glide); } 62% { transform: scaleX(1.06); } }
