/* Boot rite: the first loading screen. Markup is built by boot-rite.js inside
   #bootScreen; the forge machine is drawn on .boot-rite-canvas. */
#bootScreen {
  --boot-progress: 0;
  display: block;
  overflow: hidden;
  /* What shows before the canvas has a frame, and for good where WebGL2 is missing:
     a dark hall with the forge glowing below. */
  background:
    radial-gradient(120% 62% at 50% 116%, rgba(150, 22, 6, 0.5), transparent 64%),
    radial-gradient(52% 44% at 50% 40%, rgba(70, 26, 12, 0.3), transparent 72%),
    #050506;
  transition: opacity 380ms ease;
}

/* The hand-off: the canvas opens onto the map, so nothing may sit behind it. */
#bootScreen.is-revealing {
  background: transparent;
}

/* Still of the dormant machine; boot-rite.js sizes and places it to match the canvas. */
.boot-rite-poster {
  position: absolute;
  left: 50%;
  top: 50%;
  background: url("boot-rite-poster.webp") center / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

/* Gone once the canvas has faded in over it, so it cannot show through the iris. */
#bootScreen.is-live .boot-rite-poster {
  opacity: 0;
  transition: opacity 0s linear 700ms;
}

@media (max-aspect-ratio: 1/1) {
  .boot-rite-poster {
    -webkit-mask-image: linear-gradient(0deg, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(0deg, transparent, #000 10%, #000 90%, transparent);
  }
}

.boot-rite-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 700ms ease;
}

#bootScreen.is-live .boot-rite-canvas {
  opacity: 1;
}

.boot-rite {
  --boot-serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --boot-mono: Consolas, "Liberation Mono", ui-monospace, monospace;
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #cdc2ae;
  /* A scrim under the lower third keeps the type readable over the relief. */
  background: linear-gradient(to top, rgba(4, 4, 5, 0.86), rgba(4, 4, 5, 0.5) 16%, transparent 34%);
  transition: opacity 420ms ease;
}

#bootScreen.is-revealing .boot-rite {
  opacity: 0;
}

/* Hairline brackets in the four corners, as on an instrument's viewport. */
.boot-rite::before {
  --mark: rgba(214, 160, 112, 0.4);
  content: "";
  position: absolute;
  inset: clamp(8px, 1.1vw, 14px);
  background:
    linear-gradient(var(--mark), var(--mark)) left top / 22px 1px no-repeat,
    linear-gradient(var(--mark), var(--mark)) left top / 1px 22px no-repeat,
    linear-gradient(var(--mark), var(--mark)) right top / 22px 1px no-repeat,
    linear-gradient(var(--mark), var(--mark)) right top / 1px 22px no-repeat,
    linear-gradient(var(--mark), var(--mark)) left bottom / 22px 1px no-repeat,
    linear-gradient(var(--mark), var(--mark)) left bottom / 1px 22px no-repeat,
    linear-gradient(var(--mark), var(--mark)) right bottom / 22px 1px no-repeat,
    linear-gradient(var(--mark), var(--mark)) right bottom / 1px 22px no-repeat;
}

.boot-rite p,
.boot-rite ol {
  margin: 0;
  padding: 0;
}

.boot-rite-head {
  position: absolute;
  top: clamp(14px, 3.2vh, 32px);
  left: 0;
  right: 0;
  text-align: center;
  font: 11px/1 var(--boot-mono);
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  text-transform: uppercase;
  color: rgba(214, 160, 112, 0.62);
}

.boot-rite-head::before,
.boot-rite-head::after {
  content: "++";
  margin: 0 1.1em;
  color: rgba(214, 160, 112, 0.34);
}

.boot-rite-centre {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(26px, 6vh, 64px);
  text-align: center;
}

.boot-rite-title {
  font: 400 clamp(21px, 2.25vw, 36px) / 1.1 var(--boot-serif);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  /* Struck metal: bright at the top of each letter, falling to bronze. */
  color: #ebe2cf;
  background: linear-gradient(180deg, #fffaf0 10%, #e6dabd 50%, #ad9a72 96%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.85)) drop-shadow(0 0 18px rgba(255, 96, 24, 0.3));
  animation: bootRiteTitle 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* The title draws together out of the dark. */
@keyframes bootRiteTitle {
  from {
    opacity: 0;
    letter-spacing: 0.52em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-rite-title {
    animation: none;
  }
}

/* A hairline with a lozenge at its centre. */
.boot-rite-rule {
  position: relative;
  width: min(460px, 64vw);
  height: 1px;
  margin: 16px auto 15px;
  background: linear-gradient(90deg, transparent, rgba(255, 140, 62, 0.7) 22%, rgba(255, 140, 62, 0.7) 78%, transparent);
}

.boot-rite-rule::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: #ff9a55;
  box-shadow: 0 0 12px rgba(255, 110, 30, 0.9);
  transform: translate(-50%, -50%) rotate(45deg);
}

.boot-rite-now {
  font: 12.5px/1.35 var(--boot-mono);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: #ff9a55;
  text-shadow: 0 0 14px rgba(255, 90, 20, 0.55);
}

.boot-rite-count {
  display: none;
  margin-top: 10px;
  font: 10.5px/1.3 var(--boot-mono);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: rgba(205, 194, 174, 0.55);
}

/* Shown only where the machine is not: progress as a plain rule. */
.boot-rite-bar {
  display: none;
  width: min(460px, 64vw);
  height: 2px;
  margin: 18px auto 0;
  background: rgba(255, 140, 62, 0.16);
}

.boot-rite-bar span {
  display: block;
  height: 100%;
  background: #ff9a55;
  box-shadow: 0 0 12px rgba(255, 110, 30, 0.8);
  transform: scaleX(var(--boot-progress));
  transform-origin: 0 50%;
}

#bootScreen.is-plain .boot-rite-bar,
#bootScreen.is-plain .boot-rite-count {
  display: block;
}

.boot-rite-list {
  position: absolute;
  left: clamp(22px, 3.6vw, 68px);
  bottom: clamp(26px, 6vh, 64px);
  list-style: none;
  font: 10.5px/1 var(--boot-mono);
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.boot-rite-list li {
  display: grid;
  grid-template-columns: 3.6em auto;
  align-items: center;
  padding: 7px 14px 7px 0;
  color: rgba(205, 194, 174, 0.34);
  border-top: 1px solid rgba(214, 160, 112, 0.12);
  transition: color 240ms ease;
}

.boot-rite-list li:last-child {
  border-bottom: 1px solid rgba(214, 160, 112, 0.12);
}

.boot-rite-list i {
  font-style: normal;
}

.boot-rite-list li.active {
  color: #ff9a55;
  text-shadow: 0 0 12px rgba(255, 90, 20, 0.5);
}

.boot-rite-list li.done {
  color: rgba(205, 194, 174, 0.66);
}

.boot-rite-gauge {
  position: absolute;
  right: clamp(22px, 3.6vw, 68px);
  bottom: clamp(26px, 6vh, 64px);
  text-align: right;
  font: 10px/1 var(--boot-mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(205, 194, 174, 0.55);
}

.boot-rite-gauge b {
  font: 400 clamp(40px, 4.4vw, 68px) / 0.9 var(--boot-serif);
  letter-spacing: 0.04em;
  color: #ebe2cf;
  text-shadow: 0 0 30px rgba(255, 96, 24, 0.4);
  font-variant-numeric: tabular-nums lining-nums;
}

.boot-rite-gauge i {
  font: 400 clamp(15px, 1.4vw, 21px) / 1 var(--boot-serif);
  font-style: normal;
  letter-spacing: 0.08em;
  color: rgba(214, 160, 112, 0.7);
}

.boot-rite-gauge span {
  display: block;
  margin-top: 12px;
}

@media (max-width: 1180px), (max-aspect-ratio: 1/1) {
  .boot-rite-list,
  .boot-rite-gauge {
    display: none;
  }

  .boot-rite-count {
    display: block;
  }
}

@media (max-width: 560px) {
  .boot-rite::before {
    display: none;
  }

  .boot-rite-head {
    font-size: 9px;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }

  /* The title wraps to two lines here, and one gradient spans both: keep it shallow
     so the second line is not left dim. */
  .boot-rite-title {
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    background-image: linear-gradient(180deg, #fffaf0, #dccfb0);
  }

  .boot-rite-now {
    font-size: 11px;
    letter-spacing: 0.2em;
    text-indent: 0.2em;
    padding: 0 16px;
  }
}

/* Sound toggle. It sits on the boot screen itself, outside the click-through overlay. */
.boot-rite-sound {
  position: absolute;
  top: clamp(10px, 2.4vh, 24px);
  right: clamp(14px, 2.2vw, 40px);
  padding: 7px 10px;
  font: 10px/1 Consolas, "Liberation Mono", ui-monospace, monospace;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  color: rgba(214, 160, 112, 0.72);
  background: rgba(8, 8, 9, 0.55);
  border: 1px solid rgba(214, 160, 112, 0.28);
  cursor: pointer;
  transition: opacity 420ms ease, color 160ms ease, border-color 160ms ease;
}

.boot-rite-sound[aria-pressed="true"],
.boot-rite-sound:hover,
.boot-rite-sound:focus-visible {
  color: #ff9a55;
  border-color: rgba(255, 154, 85, 0.6);
}

.boot-rite-sound:focus-visible {
  outline: 1px solid #ff9a55;
  outline-offset: 2px;
}

#bootScreen.is-revealing .boot-rite-sound {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 560px) {
  .boot-rite-sound {
    top: auto;
    right: 10px;
    bottom: 10px;
    padding: 6px 8px;
    font-size: 9px;
  }
}
