/* M84 sites. Always dark: one screen, the black hole and the name. */

:root {
  color-scheme: dark;
  --space: #000;
  --on-space: #f4efe8;
  --on-space-dim: rgba(244, 239, 232, 0.66);
  --ember: #ffa25e;

  --ink: #ece6dd;
  --link: #ffb07a;
}

* { box-sizing: border-box; }

html {
  background: var(--space);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--space);
  color: var(--ink);
  font: 400 17px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

a { color: var(--link); text-underline-offset: 0.18em; }
a:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; border-radius: 3px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- The black hole, behind everything ---------- */

.bh {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  display: block;
  z-index: 0;
  background: var(--space) url("poster-wide.jpg") center / cover no-repeat;
}

@media (orientation: portrait) {
  .bh { background-image: url("poster-tall.jpg"); }
}

/* Once the live drawing is up, the still underneath is not needed. */
.bh.is-on { background-image: none; }

/* ---------- The one screen: only the logo ---------- */

.stage {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  color: var(--on-space);
}

.brand {
  position: absolute;
  left: max(6vw, env(safe-area-inset-left), 24px);
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.logo {
  margin: 0;
  font-weight: 300;
  font-size: clamp(64px, 11vw, 168px);
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--on-space);
  text-shadow: 0 0 40px rgba(255, 170, 100, 0.18);
}

.tagline {
  margin: 0.9em 0 0 0.12em;
  max-width: 26em;
  font-weight: 400;
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: rgba(244, 239, 232, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 18px rgba(0, 0, 0, 0.75);
}

.logo-word { display: inline-flex; }
.logo-word span { display: inline-block; }

@media (orientation: portrait) {
  .brand {
    top: auto;
    bottom: max(14svh, calc(env(safe-area-inset-bottom) + 96px));
    transform: none;
  }
  .logo { font-size: clamp(64px, 24vw, 132px); }
}


/* The intro: the logo condenses out of light while the disc forms. Only when
   scripts run and the reader has not asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .js .logo-word span {
    opacity: 0;
  }

  /* The intro starts from an empty sky, not from the still image: the still
     is framed for one screen shape and would jump to the live framing. */
  .js .bh { background-image: none; }
  .js.no-gl .bh,
  .js.bh-late .bh { background-image: url("poster-wide.jpg"); }

  .js.bh-go .logo-word span {
    animation: form 2.2s cubic-bezier(0.2, 0.7, 0.1, 1) forwards;
  }

  .js.bh-go .logo-word span:nth-child(1) { animation-delay: 2.2s; }
  .js.bh-go .logo-word span:nth-child(2) { animation-delay: 2.5s; }
  .js.bh-go .logo-word span:nth-child(3) { animation-delay: 2.8s; }

  .js.bh-quick .logo-word span:nth-child(n) { animation-duration: 1s; animation-delay: 0.2s; }

  /* The line under the name fades in once the name has formed. */
  .js .tagline { opacity: 0; }
  .js.bh-go .tagline { animation: rise 1.4s ease-out 4s forwards; }
  .js.bh-quick .tagline { animation-duration: 0.8s; animation-delay: 0.6s; }

}

@media (prefers-reduced-motion: no-preference) and (orientation: portrait) {
  .js.no-gl .bh,
  .js.bh-late .bh { background-image: url("poster-tall.jpg"); }
}

@keyframes rise {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}

@keyframes form {
  0%   { opacity: 0; filter: blur(18px); transform: translateX(-0.9em) scaleX(1.8); }
  45%  { opacity: 1; filter: blur(4px); }
  100% { opacity: 1; filter: blur(0); transform: none; }
}


/* ---------- m84.app ---------- */

.app-page { color: var(--on-space); }
.app-page .stage { height: 100vh; height: 100svh; }

.app-copy {
  position: absolute;
  left: max(6vw, env(safe-area-inset-left), 24px);
  right: 24px;
  bottom: max(48px, calc(env(safe-area-inset-bottom) + 32px));
  max-width: 30rem;
}

.app-copy .mark {
  display: block;
  margin-bottom: 18px;
  color: var(--on-space);
  text-decoration: none;
  font-weight: 300;
  font-size: 40px;
  letter-spacing: 0.08em;
}

.app-copy h1 {
  margin: 0 0 12px;
  font-weight: 500;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.app-copy p { margin: 0 0 12px; color: var(--on-space-dim); }
.app-copy a { color: var(--on-space); }
