/* The page's own loading scenes, shown while the app downloads (see
   boot_loader.js): the five scenes of design/embidetect-loading-screens.md,
   one root class per scene. logo.svg is the project's logo as one image, so
   where a scene would move its parts it enters as a whole instead, as the
   brief prescribes for that case. */
@font-face {
  font-family: 'Onest';
  font-weight: 600;
  src: url('assets/assets/fonts/Onest-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Geist Mono';
  font-weight: 400;
  src: url('assets/assets/fonts/GeistMono-Regular.ttf') format('truetype');
}

html, body { margin: 0; background: #FDFDFB; }

.boot {
  position: fixed; inset: 0; z-index: 1;
  min-height: 100vh; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 20px; overflow: hidden;
  background: #FDFDFB; color: #17201A;
  font-family: 'Onest', ui-sans-serif, system-ui, sans-serif;
}
.boot.is-leaving { opacity: 0; transition: opacity .25s ease-out; }
.boot__stage { position: relative; flex: none; }
.boot__logo { display: block; }

@keyframes boot-enter { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

/* Detection corners: the corner's colour, --cw its line, --cr its outer radius. */
.boot__corner { position: absolute; box-sizing: border-box; border: 0 solid currentColor; }
.boot__corner--tl { left: 0; top: 0; border-top-width: var(--cw); border-left-width: var(--cw); border-top-left-radius: var(--cr); }
.boot__corner--tr { right: 0; top: 0; border-top-width: var(--cw); border-right-width: var(--cw); border-top-right-radius: var(--cr); }
.boot__corner--bl { left: 0; bottom: 0; border-bottom-width: var(--cw); border-left-width: var(--cw); border-bottom-left-radius: var(--cr); }
.boot__corner--br { right: 0; bottom: 0; border-bottom-width: var(--cw); border-right-width: var(--cw); border-bottom-right-radius: var(--cr); }

/* The product name as a detection tag above a box (drawn-box, points). */
.boot__label {
  position: absolute; left: -2px; bottom: calc(100% + 6px); height: 30px; padding: 0 12px;
  display: flex; align-items: center; white-space: nowrap;
  border-radius: 8px 8px 8px 0; background: #1C4A31; color: #F7F9F6;
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
}
.boot__box { position: absolute; inset: 0; box-sizing: border-box; border: 2px solid #1C4A31; border-radius: 4px; }

/* 1 conveyor */
@keyframes bc-up { from { transform: translateY(105%); } to { transform: none; } }
@keyframes bc-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes bc-stripes { from { background-position: 0 0; } to { background-position: -48px 0; } }
@keyframes bc-track { from { transform: translateX(0); } to { transform: translateX(-780px); } }
@keyframes bc-frame {
  0% { transform: scale(1.16); opacity: .35; }
  16%, 62% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.16); opacity: .35; }
}
@keyframes bc-tag {
  0%, 8% { opacity: 0; transform: translateY(4px); }
  20%, 60% { opacity: 1; transform: none; }
  78%, 100% { opacity: 0; }
}

.boot--conveyor { gap: 44px; }
.boot--conveyor .boot__brand { display: flex; align-items: center; gap: 18px; max-width: 100%; }
.boot--conveyor .boot__logo { width: min(76px, 17vw); height: min(76px, 17vw); flex: none;
  animation: boot-enter .6s cubic-bezier(.16,.84,.24,1) backwards; }
.boot--conveyor .boot__mask { display: block; overflow: hidden; padding-bottom: .06em; font-size: min(54px, 12vw); }
.boot--conveyor .boot__word { display: block; font-weight: 600; letter-spacing: -0.045em; line-height: 1;
  animation: bc-up 1s cubic-bezier(.16,.84,.24,1) .55s backwards; }
.boot--conveyor .boot__belt {
  position: relative; flex: none; width: 520px; max-width: 100%; height: 168px;
  border-radius: 22px; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 2px, transparent 2px 48px) #2C312E;
  animation: bc-in .8s cubic-bezier(.2,.7,.2,1) .9s backwards, bc-stripes .59s linear infinite;
}
.boot--conveyor .boot__belt-line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255,255,255,.08); }
.boot--conveyor .boot__track { position: absolute; left: -65px; top: 0; height: 100%; display: flex;
  animation: bc-track 9.6s linear infinite; }
.boot--conveyor .boot__slot { position: relative; flex: none; width: 130px; height: 168px; }
.boot--conveyor .boot__parcel { position: absolute; border-radius: 3px; }
.boot--conveyor .boot__parcel-label { position: absolute; background: #D9D3C7; }
.boot--conveyor .boot__parcel-damage { position: absolute; background: #5A3E33; border-radius: 2px; }
.boot--conveyor .boot__belt-fade { position: absolute; inset: 0;
  background: linear-gradient(90deg, #2C312E 0%, transparent 26%, transparent 74%, #2C312E 100%); }
.boot--conveyor .boot__frame { position: absolute; left: 50%; top: 50%; width: 116px; height: 104px; margin: -52px 0 0 -58px;
  --cw: 2px; --cr: 7px; color: #A9D3B4;
  animation: bc-frame 1.6s cubic-bezier(.2,.7,.2,1) infinite; }
.boot--conveyor .boot__frame .boot__corner { width: 20px; height: 20px; }
.boot--conveyor .boot__parcel-tag-row { position: absolute; left: 0; right: 0; top: 14px; display: flex; justify-content: center; }
.boot--conveyor .boot__parcel-tag { padding: 3px 8px; border-radius: 6px; background: #A9D3B4; color: #12301F;
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 400;
  animation: bc-tag 1.6s ease infinite; }

/* 2 scan */
@keyframes bs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bs-tl { from { opacity: 0; transform: translate(-70px, -70px); } to { opacity: 1; transform: none; } }
@keyframes bs-tr { from { opacity: 0; transform: translate(70px, -70px); } to { opacity: 1; transform: none; } }
@keyframes bs-bl { from { opacity: 0; transform: translate(-70px, 70px); } to { opacity: 1; transform: none; } }
@keyframes bs-br { from { opacity: 0; transform: translate(70px, 70px); } to { opacity: 1; transform: none; } }
@keyframes bs-open { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes bs-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes bs-sweep {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(276px); opacity: 0; }
}

.boot--scan {
  background-image: linear-gradient(#EFF1ED 1px, transparent 1px),
    linear-gradient(90deg, #EFF1ED 1px, transparent 1px);
  background-size: 48px 48px; background-position: center;
}
.boot--scan .boot__stage { width: 300px; height: 300px; }
.boot--scan .boot__logo { position: absolute; left: 60px; top: 60px; width: 180px; height: 180px;
  animation: bs-fade .6s ease .1s backwards; }
.boot--scan .boot__corners { position: absolute; inset: 0; --cw: 3px; --cr: 14px; color: #1C4A31;
  animation: bs-breathe 2.4s cubic-bezier(.45,0,.55,1) 1.6s infinite; }
.boot--scan .boot__corner { width: 44px; height: 44px;
  animation: 1s cubic-bezier(.16,.84,.24,1) .4s backwards; }
.boot--scan .boot__corner--tl { animation-name: bs-tl; }
.boot--scan .boot__corner--tr { animation-name: bs-tr; }
.boot--scan .boot__corner--bl { animation-name: bs-bl; }
.boot--scan .boot__corner--br { animation-name: bs-br; }
.boot--scan .boot__tag { position: absolute; left: 0; top: -46px; height: 34px; padding: 0 14px;
  display: flex; align-items: center; white-space: nowrap;
  border-radius: 10px 10px 10px 0; background: #1C4A31; color: #F3F7F2;
  font-size: 20px; font-weight: 600; letter-spacing: -0.03em;
  animation: bs-open .7s cubic-bezier(.16,.84,.24,1) 1.25s backwards; }
.boot--scan .boot__scan { position: absolute; left: 12px; right: 12px; top: 12px; height: 2px;
  background: #1C4A31;
  box-shadow: 0 0 0 1px rgba(28,74,49,.08), 0 -18px 24px rgba(143,178,133,.35);
  opacity: 0; animation: bs-sweep 2.4s cubic-bezier(.45,0,.55,1) 1.4s infinite; }

/* 3 balance */
@keyframes bb-ring { 0% { transform: scale(.55); opacity: .5; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes bb-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.boot--balance { gap: 36px; }
.boot--balance .boot__stage { width: 220px; height: 220px; display: grid; place-items: center; }
.boot--balance .boot__logo { position: relative; width: 200px; height: 200px;
  animation: boot-enter .6s cubic-bezier(.16,.84,.24,1) .1s backwards; }
.boot--balance .boot__ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid #8FB285;
  opacity: 0; animation: bb-ring 2.4s cubic-bezier(.2,.7,.2,1) 1s infinite; }
.boot--balance .boot__ring--2 { animation-delay: 2.2s; }
.boot--balance .boot__name { font-size: 30px; font-weight: 600; letter-spacing: -0.03em;
  animation: bb-rise .9s cubic-bezier(.16,.84,.24,1) .5s backwards; }

/* 4 drawn-box */
@keyframes bd-box {
  0%, 8% { transform: scale(0); }
  40%, 84% { transform: scale(1); opacity: 1; }
  96%, 100% { transform: scale(1); opacity: 0; }
}
@keyframes bd-handle {
  0%, 40% { transform: scale(0); }
  48%, 84% { transform: scale(1); opacity: 1; }
  96%, 100% { transform: scale(1); opacity: 0; }
}
@keyframes bd-label {
  0%, 44% { clip-path: inset(0 100% 0 0); }
  58%, 84% { clip-path: inset(0); opacity: 1; }
  96%, 100% { clip-path: inset(0); opacity: 0; }
}
@keyframes bd-cursor {
  0% { transform: translate(-40px, -40px); opacity: 0; }
  8% { transform: translate(0, 0); opacity: 1; }
  40% { transform: translate(220px, 180px); opacity: 1; }
  52%, 100% { transform: translate(250px, 210px); opacity: 0; }
}

.boot--drawn-box .boot__stage { width: 220px; height: 180px; }
.boot--drawn-box .boot__logo { position: absolute; left: 40px; top: 20px; width: 140px; height: 140px; }
.boot--drawn-box .boot__box { background: rgba(143,178,133,.10); transform-origin: 0 0;
  animation: bd-box 3.6s cubic-bezier(.65,0,.35,1) infinite; }
.boot--drawn-box .boot__handle { position: absolute; width: 10px; height: 10px; box-sizing: border-box;
  background: #FDFDFB; border: 2px solid #1C4A31; border-radius: 2px;
  animation: bd-handle 3.6s cubic-bezier(.2,.7,.2,1) infinite; }
.boot--drawn-box .boot__handle--tl { left: -5px; top: -5px; }
.boot--drawn-box .boot__handle--tr { right: -5px; top: -5px; }
.boot--drawn-box .boot__handle--bl { left: -5px; bottom: -5px; }
.boot--drawn-box .boot__handle--br { right: -5px; bottom: -5px; }
.boot--drawn-box .boot__label { animation: bd-label 3.6s cubic-bezier(.16,.84,.24,1) infinite; }
.boot--drawn-box .boot__cursor { position: absolute; left: -12px; top: -12px; opacity: 0;
  animation: bd-cursor 3.6s cubic-bezier(.65,0,.35,1) infinite; }

/* 5 points */
@keyframes bp-dot {
  0% { transform: translate(var(--sx), var(--sy)); opacity: 0; }
  10% { opacity: 1; }
  42%, 54% { transform: translate(0, 0); opacity: 1; }
  64%, 100% { transform: translate(0, 0); opacity: 0; }
}
@keyframes bp-box {
  0%, 44% { opacity: 0; transform: scale(1.06); }
  54%, 86% { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes bp-label {
  0%, 50% { clip-path: inset(0 100% 0 0); }
  62%, 86% { clip-path: inset(0); opacity: 1; }
  96%, 100% { clip-path: inset(0); opacity: 0; }
}

.boot--points .boot__stage { width: 220px; height: 160px; }
.boot--points .boot__logo { position: absolute; left: 50px; top: 20px; width: 120px; height: 120px; }
.boot--points .boot__box { animation: bp-box 3.8s cubic-bezier(.16,.84,.24,1) infinite; }
.boot--points .boot__label { animation: bp-label 3.8s cubic-bezier(.16,.84,.24,1) infinite; }
.boot--points .boot__dots { position: absolute; inset: 0; }
.boot--points .boot__dot { position: absolute; left: calc(var(--x) - 4px); top: calc(var(--y) - 4px);
  width: 8px; height: 8px; border-radius: 50%; background: #1C4A31; opacity: 0;
  animation: bp-dot 3.8s cubic-bezier(.65,0,.35,1) infinite; }
.boot--points .boot__dot:nth-child(even) { background: #8FB285; }

/* Still, complete frames: the base states above are the finished scenes,
   and the purely decorative parts (rings, scan line, cursor, dots) rest
   hidden. */
@media (prefers-reduced-motion: reduce) {
  .boot *, .boot { animation: none !important; }
}
