:root {
  color-scheme: light dark;
  --bg: #f6f3ef;
  --ink: #16120f;
  --muted: #6b625b;
  --red: #a30d0d;
  --red-text: #a30d0d;
  --grid: rgb(163 13 13 / 8%);
  --line: rgb(22 18 15 / 14%);
  --track: rgb(22 18 15 / 8%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d0c;
    --ink: #f3eee9;
    --muted: #a39a92;
    --red: #d42b2b;
    --red-text: #f1605c;
    --grid: rgb(212 43 43 / 10%);
    --line: rgb(255 255 255 / 16%);
    --track: rgb(255 255 255 / 10%);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--bg);
  color: var(--ink);
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: -60px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
  animation: drift 18s linear infinite;
  pointer-events: none;
  content: "";
}

@keyframes drift {
  to { transform: translate(44px, 44px); }
}

main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, 100%);
  padding: 40px 24px;
  text-align: center;
}

.stage {
  position: relative;
  width: min(310px, 74vw, 100%);
  padding: clamp(22px, 7vw, 34px);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 60px -28px rgb(0 0 0 / 35%), 0 0 0 1px var(--line);
}

.logo {
  position: relative;
}

.logo img {
  display: block;
  width: 100%;
  height: auto;
}

.ghost {
  opacity: 0;
  filter: grayscale(1);
}

.logo.is-building .ghost {
  opacity: 0.12;
}

.blocks,
.solid {
  position: absolute;
  inset: 0;
}

.blk {
  position: absolute;
  background-image: url("./athlex-mark-light.png");
  opacity: 0;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 70%);
}

.blk.in {
  animation: drop 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes drop {
  0% { opacity: 0; transform: translateY(-90px) rotate(-14deg) scale(1.15); }
  55% { opacity: 1; transform: translateY(3px); }
  78% { transform: translateY(-2px); }
  100% { opacity: 1; transform: none; }
}

.solid {
  transition: opacity 0.5s;
}

.logo.is-building .solid {
  opacity: 0;
}

.logo.is-building.done .solid {
  opacity: 1;
}

.c {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--red);
  opacity: 0.85;
}

.c.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.c.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.c.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.c.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.brand {
  margin-top: 34px;
  color: var(--red-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

h1 {
  margin-top: 14px;
  font-size: clamp(1.75rem, 6.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 span {
  color: var(--red);
}

p {
  max-width: 42ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
}

.bar {
  width: min(400px, 100%);
  margin-top: 34px;
}

.row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.row strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.track {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--track);
}

.fill {
  width: calc(var(--p, 1) * 100%);
  height: 100%;
  border-radius: 99px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #1a1412 10px 20px);
  background-size: 28.28px 100%;
}

.bar.is-building .fill {
  animation: hazard 1s linear infinite;
}

@keyframes hazard {
  to { background-position: 28.28px 0; }
}

.steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
  padding: 0;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.75rem;
  list-style: none;
  transition: color 0.4s, border-color 0.4s;
}

.steps i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--track);
  transition: background 0.4s, box-shadow 0.4s;
}

.steps li.on {
  border-color: var(--red);
  color: var(--ink);
}

.steps li.on i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgb(163 13 13 / 18%);
}

footer {
  margin-top: 38px;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

a {
  color: var(--red-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

a:hover,
a:focus-visible {
  text-decoration-thickness: 2px;
}

.error .brand {
  margin-top: 0;
}

.error a {
  margin-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .bar.is-building .fill,
  .blk.in {
    animation: none;
  }

  .solid,
  .steps li,
  .steps i {
    transition: none;
  }
}
