/* The loader shown while the app starts (index.html #boot; removed by main.ts when ready).
   External file because the page's CSP allows no inline styles. Colours are the brand green and
   neutrals from tokens.css, written out here because tokens.css is not loaded yet. */
#boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(15, 157, 88, 0.1), transparent 60%),
    #f7f8f7;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Ubuntu Mono", Menlo, Consolas, monospace;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
#boot::before {
  /* a faint blueprint grid, fading out from the centre */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 157, 88, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 157, 88, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0, transparent 65%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0, transparent 65%);
  animation: boot-grid 6s linear infinite;
}
#boot.boot-done {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}
.boot-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.boot-page {
  width: 132px;
  height: 168px;
  overflow: visible;
}
.boot-outline {
  fill: rgba(255, 255, 255, 0.85);
  stroke: #0f9d58;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  animation: boot-draw 1.4s cubic-bezier(0.6, 0, 0.2, 1) forwards;
  filter: drop-shadow(0 0 6px rgba(15, 157, 88, 0.35));
}
.boot-fold {
  fill: none;
  stroke: #0f9d58;
  stroke-width: 2;
  stroke-linejoin: round;
  opacity: 0;
  animation: boot-in 0.4s 1.1s forwards;
}
.boot-line {
  fill: #0f9d58;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: left center;
  animation: boot-line 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.boot-line:nth-of-type(1) { animation-delay: 0.9s; }
.boot-line:nth-of-type(2) { animation-delay: 1.05s; }
.boot-line:nth-of-type(3) { animation-delay: 1.2s; }
.boot-line:nth-of-type(4) { animation-delay: 1.35s; }
.boot-line:nth-of-type(5) { animation-delay: 1.5s; }
.boot-corner {
  fill: none;
  stroke: #0b8043;
  stroke-width: 2.5;
  stroke-linecap: round;
  animation: boot-pulse 1.8s ease-in-out infinite;
}
.boot-beam {
  fill: url(#boot-beam-grad);
  animation: boot-scan 2.2s ease-in-out 1.2s infinite;
  opacity: 0;
}
.boot-logo {
  height: 34px;
  width: auto;
  opacity: 0;
  animation: boot-in 0.6s 0.5s forwards;
}
.boot-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.boot-track {
  position: relative;
  width: 220px;
  height: 3px;
  border-radius: 3px;
  background: rgba(15, 157, 88, 0.15);
  overflow: visible;
}
.boot-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #0b8043, #0f9d58 70%, #6ee7a8);
  box-shadow: 0 0 10px rgba(15, 157, 88, 0.7);
  animation: boot-fill 10s cubic-bezier(0.25, 0.6, 0.3, 1) forwards;
}
#boot.boot-done .boot-fill {
  animation: none;
  width: 100%;
  transition: width 0.3s ease;
}
.boot-status {
  position: relative;
  width: 260px;
  height: 16px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5b6560;
  text-align: center;
}
.boot-status span {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: boot-step 2.5s linear forwards;
}
.boot-status span:nth-child(1) { animation-delay: 0s; }
.boot-status span:nth-child(2) { animation-delay: 2.5s; }
.boot-status span:nth-child(3) { animation-delay: 5s; }
.boot-status span:nth-child(4) { animation-delay: 7.5s; animation-fill-mode: forwards; }
.boot-status span::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 11px;
  margin-left: 4px;
  vertical-align: -1px;
  background: #0f9d58;
  animation: boot-blink 0.9s steps(1) infinite;
}

@keyframes boot-draw { to { stroke-dashoffset: 0; } }
@keyframes boot-in { to { opacity: 1; } }
@keyframes boot-line { from { opacity: 0; transform: scaleX(0); } to { opacity: 0.85; transform: scaleX(1); } }
@keyframes boot-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes boot-scan {
  0% { transform: translateY(-14px); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(176px); opacity: 0; }
}
@keyframes boot-fill { 0% { width: 0; } 40% { width: 55%; } 75% { width: 82%; } 100% { width: 94%; } }
@keyframes boot-step {
  0% { opacity: 0; transform: translateY(5px); }
  6%, 94% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-5px); }
}
@keyframes boot-blink { 50% { opacity: 0; } }
@keyframes boot-grid { to { background-position: 32px 32px; } }

.boot-status span:nth-child(4) { animation-name: boot-step-last; }
@keyframes boot-step-last {
  0% { opacity: 0; transform: translateY(5px); }
  8%, 100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #boot, #boot * , #boot::before { animation-duration: 0.01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .boot-beam { display: none; }
  .boot-status span:not(:nth-child(4)) { display: none; }
}
