/* The Helius Review — coming soon. Black and white, one typeface, no build step. */

@font-face {
  font-family: "Libre Caslon Text";
  src: url("fonts/LibreCaslonText-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Libre Caslon Text";
  src: url("fonts/LibreCaslonText-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f4f1ea;
  --fg: #090909;
  --fg-2: #55534e;
  --fg-3: #8d897f;
  --line: #d8d4ca;
  --serif: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.18, 1);
  --gutter: clamp(20px, 4.4vw, 56px);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 1.5px solid var(--fg);
  outline-offset: 4px;
  border-radius: 2px;
}

p,
h1 {
  margin: 0;
  font-weight: 400;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
}

/* ---------- Top line ---------- */

.top {
  padding: clamp(18px, 3.2vh, 28px) 0 0;
  font-size: 14px;
  font-style: italic;
  text-align: center;
  color: var(--fg-2);
}

/* ---------- Masthead ---------- */

.rule {
  position: relative;
  height: 1px;
  background: var(--fg);
  transform-origin: left center;
}

.logo {
  display: flex;
  justify-content: center;
  padding: clamp(20px, 3.6vh, 32px) 0 clamp(22px, 4.2vh, 38px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.logo__art {
  display: block;
  width: min(100%, clamp(250px, 38vw, 470px));
  height: auto;
  overflow: visible;
}

.lbox,
.lname {
  fill: var(--fg);
}

.lcol,
.ldot {
  fill: var(--bg);
}

.lbox,
.lcol,
.ldot,
.lg {
  transform-box: fill-box;
}

/* ---------- Headline ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(40px, 8vh, 88px) 0 clamp(36px, 7vh, 72px);
}

.soon {
  font-size: clamp(40px, 7.4vw, 100px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.soon__line {
  display: inline-block;
  white-space: nowrap;
  /* Words rise into this window; the room below is for the g and the point. */
  clip-path: inset(-0.3em -0.3em -0.28em -0.3em);
}

.soon__w {
  display: inline-block;
}

.soon__w--i {
  font-style: italic;
  padding-right: 0.03em;
}

/* The full stop is the point from the mark. */
.point {
  display: inline-block;
  border-radius: 50%;
  background: var(--fg);
  width: 0.135em;
  height: 0.135em;
  margin-left: 0.045em;
}

.desc {
  max-width: 30ch;
  margin-top: clamp(22px, 4vh, 36px);
  font-size: clamp(20px, 2.3vw, 26px);
  line-height: 1.4;
  color: var(--fg-2);
  text-wrap: balance;
}

.follow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: clamp(24px, 4.4vh, 40px);
  padding: 2px 0 5px;
  font-size: 17px;
  font-style: italic;
}

.follow::before,
.follow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
}

.follow::before {
  opacity: 0.28;
}

.follow::after {
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s var(--ease-in-out);
}

.follow__arrow {
  transition: transform 0.35s var(--ease-out);
}

@media (hover: hover) {
  .follow:hover::after {
    transform: scaleX(1);
    transform-origin: left center;
  }

  .follow:hover .follow__arrow {
    transform: translate(2px, -2px);
  }
}

/* ---------- Foot ---------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.6vh, 22px) 0 clamp(18px, 3.2vh, 28px);
  font-size: 14px;
  font-style: italic;
  color: var(--fg-2);
}

.endorse {
  display: block;
  color: var(--fg-2);
  transition: color 0.3s ease;
}

.endorse svg {
  display: block;
  height: 20px;
  width: auto;
}

@media (hover: hover) {
  .endorse:hover {
    color: var(--fg);
  }
}

/* ---------- Motion ---------- */

@keyframes box-in {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

@keyframes col-rise {
  from {
    clip-path: inset(100% 0 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes dot-pop {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

@keyframes letter-set {
  from {
    opacity: 0;
    transform: translateY(42%);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes word-rise {
  from {
    transform: translateY(150%);
  }

  to {
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

/* Start states. `.anim` is set before first paint by the inline script. */
.anim .lbox {
  transform: scaleY(0);
  transform-origin: 50% 100%;
}

.anim .lcol {
  clip-path: inset(100% 0 0 0);
}

.anim .ldot {
  transform: scale(0);
  transform-origin: 50% 50%;
}

.anim .lg,
.anim .top,
.anim .desc,
.anim .follow,
.anim .foot {
  opacity: 0;
}

.anim .rule {
  transform: scaleX(0);
}

.anim .soon__w {
  transform: translateY(150%);
}

/* Replay: `.replay` alone puts the logo back at its start state, then `.play`
   lets the same animations run again. */
.anim.replay:not(.play) .lbox,
.anim.replay:not(.play) .lcol,
.anim.replay:not(.play) .ldot,
.anim.replay:not(.play) .lg {
  animation: none;
}

/* Playing. `.play` restarts the logo on its own when it is clicked. */
.anim.ready .lbox,
.anim.play .lbox {
  animation: box-in 0.6s var(--ease-in-out) forwards;
}

.anim.ready .lcol,
.anim.play .lcol {
  animation: col-rise 0.62s var(--ease-in-out) forwards;
  animation-delay: calc(360ms + var(--n) * 130ms);
}

.anim.ready .ldot,
.anim.play .ldot {
  animation: dot-pop 0.45s var(--ease-out) forwards;
  animation-delay: 820ms;
}

.anim.ready .lg,
.anim.play .lg {
  animation: letter-set 0.7s var(--ease-out) forwards;
  animation-delay: calc(520ms + var(--n) * 34ms);
}

.anim.ready .rule {
  transform: none;
  animation: draw 1.25s var(--ease-in-out) backwards;
}

.anim.ready .masthead .rule:last-child {
  animation-delay: 0.18s;
}

.anim.ready .top,
.anim.ready .desc,
.anim.ready .follow,
.anim.ready .foot {
  opacity: 1;
  animation: fade-in 1s ease backwards;
}

.anim.ready .top {
  animation-delay: 0.2s;
}

.anim.ready .soon__w {
  animation: word-rise 1s var(--ease-out) forwards;
  animation-delay: calc(650ms + var(--n) * 110ms);
}

.anim.ready .desc {
  animation-delay: 1.35s;
}

.anim.ready .follow {
  animation-delay: 1.5s;
}

.anim.ready .foot {
  animation-delay: 1.65s;
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .top,
  .foot {
    font-size: 13px;
  }

  .logo__art {
    width: min(100%, 300px);
  }

  /* The line is about 5.85em wide; keep it well inside the gutters. */
  .soon {
    font-size: min(60px, calc((100vw - 2 * var(--gutter)) / 8.2));
  }

  .endorse svg {
    height: 17px;
  }
}

@media (max-width: 360px) {
  .foot {
    flex-direction: column;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
