/*
 * The home page, in the window direction. Loaded only on the home page, after
 * site.css, whose type, buttons, tags and glass it uses. The page stands on
 * Dusk's deepest colour so the app's own window, which wears Dusk's rail and
 * ground, is the lightest thing on it.
 *
 * Motion: transform and opacity only, tied to the visitor's scrolling. Nothing
 * here loops. Everything that moves is under html.pin (scripts on, motion
 * welcome, set by scripts/home.js before the first paint); without it the page
 * is still and complete, and every step carries its own picture.
 */

:root {
  --head: 73px; /* the site header, measured again by home.js */
  --col: clamp(320px, 27vw, 460px); /* the words beside the pinned window */
  --gap: clamp(32px, 3.4vw, 64px);
  --bar: 32px; /* the window's title bar */
  --rail: #222447;
  --rail-rule: #3a3d73;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

.wrap-home,
body.home .site-head .wrap,
body.home .site-foot .wrap {
  max-width: calc(1640px + var(--gutter) * 2);
}

.small-print {
  max-width: 96ch;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.5;
}
.small-print strong {
  color: var(--ink);
  font-weight: 700;
}

/* ---- The hero: a short plain line, then the window ------------------------ */

.walk {
  position: relative;
}
.walk-hero {
  position: relative;
  padding: clamp(22px, 3.4vh, 44px) 0 clamp(20px, 3vh, 32px);
}
/* The page's one still light, behind the hero and the window. */
.walk-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 -46vh 0;
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(98, 83, 240, 0.32), rgba(98, 83, 240, 0.08) 52%, transparent 72%),
    radial-gradient(30% 30% at 8% 30%, rgba(79, 209, 232, 0.08), transparent 70%);
  pointer-events: none;
}
.hero-copy {
  display: grid;
  justify-items: center;
  gap: clamp(10px, 1.6vh, 16px);
  text-align: center;
}
.hero-title {
  max-width: 24ch;
  font-size: clamp(34px, 3.9vw, 70px);
  line-height: 1;
  text-wrap: balance;
}
.hero-lede {
  max-width: 66ch;
  font-size: clamp(17px, 1.25vw, 20px);
  text-wrap: pretty;
}
.hero-copy .actions {
  justify-content: center;
  margin-top: 4px;
}

/* ---- The window ----------------------------------------------------------- */

.stage {
  padding: 0 var(--gutter);
}
.stage-box {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.glow,
.target-wrap,
.strip {
  display: none;
}
.win {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(189, 191, 224, 0.24);
  border-radius: 10px;
  background: var(--rail);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 44px 90px -34px rgba(4, 4, 22, 0.9);
}
.win-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--bar);
  padding-left: 12px;
  border-bottom: 1px solid var(--rail-rule);
  background: var(--rail);
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.win-bar img {
  width: 18px;
}
.win-name {
  color: var(--ink);
  font-weight: 600;
}
.win-titles {
  position: relative;
  flex: 1;
  height: 100%;
}
.win-titles span {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translate3d(0, 4px, 0);
  transition:
    opacity 240ms var(--ease-out),
    transform 240ms var(--ease-out);
}
.win-titles span::before {
  content: "/";
  margin-right: 9px;
  opacity: 0.5;
}
.win-titles .is-on {
  opacity: 1;
  transform: none;
}
.win-controls {
  display: flex;
  height: 100%;
}
.win-controls svg {
  width: 38px;
  height: 100%;
  padding: 9px 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.win-view {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ground-2);
}
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.screen img,
.screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.screen video {
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}
.screen video.is-playing {
  opacity: 1;
}
/* Still: only the first screen shows; each step below carries its own picture. */
.screen:not(.is-on) {
  display: none;
}

/* ---- The steps, still: words and a close crop beside a whole screen -------- */

.walk-steps {
  padding-top: clamp(48px, 6vw, 96px);
}
.walk-step {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--gap);
  align-items: center;
  padding: clamp(28px, 4vw, 64px) 0;
}
.step-text {
  display: grid;
  justify-items: start;
  gap: 14px;
}
.walk-step .num {
  margin-right: 12px;
  color: var(--primary-text);
  font-weight: 700;
}
.walk-step h2 {
  font-size: clamp(30px, 2.7vw, 50px);
  text-wrap: balance;
}
.walk-step .lede {
  font-size: clamp(16px, 1.15vw, 19px);
  text-wrap: pretty;
}
/* The peak of the walk: the player's own story, in the timeline's warm light. */
.walk-peak h2 {
  color: var(--pro-text);
}
.walk-peak .num {
  color: var(--pro-text);
}
.plan-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--soft);
  font-size: 14px;
}
.plan-line .tag + span + .tag {
  margin-left: 6px;
}
.crop {
  width: min(100%, var(--w, 360px));
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid rgba(189, 191, 224, 0.22);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 48px -24px rgba(4, 4, 22, 0.85);
}
.crop img {
  width: 100%;
}
.step-shot {
  overflow: hidden;
  border: 1px solid rgba(189, 191, 224, 0.22);
  border-radius: 10px;
  box-shadow: 0 30px 70px -34px rgba(4, 4, 22, 0.9);
}
.step-shot img {
  width: 100%;
}
@media (max-width: 899px) {
  .walk-step {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* On a phone the close crops, made for its width, carry each step. */
@media (max-width: 760px) {
  .step-shot {
    display: none;
  }
  .crop {
    width: 100%;
  }
}

/* ---- The window, pinned: wide screens with scripts on and motion welcome --- */

@media (min-width: 1024px) and (min-height: 620px) {
  html.pin .walk {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  html.pin .walk-hero {
    grid-area: 1 / 1;
    z-index: 3;
    min-height: calc(100vh - var(--head));
    min-height: calc(100svh - var(--head));
    pointer-events: none;
  }
  html.pin .hero-copy {
    pointer-events: auto;
  }
  html.pin .stage {
    grid-area: 1 / 1 / 3 / 2;
    position: sticky;
    top: var(--head);
    z-index: 2;
    align-self: start;
    height: calc(100vh - var(--head));
    height: calc(100svh - var(--head));
    overflow: hidden;
    pointer-events: none;
  }
  html.pin .stage-box {
    max-width: 1640px;
    height: 100%;
  }
  /* Where the window comes to rest: laid out here, read by the script on load and resize. */
  html.pin .target-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 0 58px;
    visibility: hidden;
  }
  html.pin .window-target {
    width: min(calc(100% - var(--col) - var(--gap)), calc((100vh - var(--head) - 130px) * 1.6));
  }
  html.pin .window-target::before {
    content: "";
    display: block;
    padding-top: calc(62.5% + var(--bar));
  }
  /* As the hero: wide and centred under the words, running off the bottom of the screen. */
  html.pin .win {
    --hw: min(100%, 1480px, calc((100vh - var(--head)) * 1.36));
    position: absolute;
    top: var(--hero-top, 58vh);
    left: calc((100% - var(--hw)) / 2);
    width: var(--hw);
    transform-origin: 0 0;
    will-change: transform;
  }
  /* At rest the window is drawn again at its own size, so its words are sharp. */
  html.pin .stage.is-settled .win {
    will-change: auto;
  }
  html.pin .screen:not(.is-on) {
    display: block;
  }
  html.pin .screen {
    opacity: 0;
    transition: opacity 320ms var(--ease-out);
  }
  html.pin .screen.is-on {
    opacity: 1;
  }
  /* Light behind the window where it rests; it follows the screen being shown. */
  html.pin .glow {
    display: block;
    position: absolute;
    right: -6%;
    top: 4%;
    width: calc(100% - var(--col));
    height: 92%;
    opacity: 0;
    transition: opacity 600ms var(--ease-out);
    pointer-events: none;
  }
  html.pin .glow-violet {
    background: radial-gradient(closest-side, rgba(98, 83, 240, 0.42), rgba(98, 83, 240, 0.1) 55%, transparent);
  }
  html.pin .glow-cyan {
    background: radial-gradient(closest-side, rgba(79, 209, 232, 0.24), rgba(98, 83, 240, 0.1) 55%, transparent);
  }
  html.pin .glow-brass {
    background: radial-gradient(closest-side, rgba(240, 185, 58, 0.26), rgba(98, 83, 240, 0.08) 55%, transparent);
  }
  html.pin .stage[data-tone="violet"] .glow-violet,
  html.pin .stage[data-tone="cyan"] .glow-cyan,
  html.pin .stage[data-tone="brass"] .glow-brass {
    opacity: 1;
  }
  /* The screens of the walk under the window, with how far along it the page is. */
  html.pin .strip {
    display: block;
    position: absolute;
    left: var(--strip-left, 40%);
    top: var(--strip-top, 90%);
    width: var(--strip-width, 60%);
    opacity: 0;
    transform: translate3d(0, 8px, 0);
    transition:
      opacity 240ms var(--ease-out),
      transform 240ms var(--ease-out);
  }
  html.pin .stage.is-settled .strip {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  html.pin .strip ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  html.pin .strip a {
    display: block;
    padding: 8px 0 6px;
    color: var(--soft);
    text-decoration: none;
    transition: color 200ms var(--ease-out);
  }
  html.pin .strip a:hover,
  html.pin .strip a.is-on {
    color: var(--ink);
  }
  html.pin .strip-bar {
    display: block;
    height: 3px;
    overflow: hidden;
    background: rgba(189, 191, 224, 0.16);
  }
  html.pin .strip-bar i {
    display: block;
    height: 100%;
    background: var(--stroke);
    transform: scaleX(0);
    transform-origin: left center;
  }
  /* The words pass on the left; the window, above them, uncovers them as it settles. */
  html.pin .walk-steps {
    grid-area: 2 / 1;
    z-index: 1;
    padding-top: 10vh;
    padding-bottom: 0;
  }
  html.pin .walk-step {
    display: block;
    width: var(--col);
    min-height: 75vh;
    padding: 0;
  }
  html.pin .walk-step.walk-peak {
    min-height: 96vh;
  }
  html.pin .step-shot {
    display: none;
  }
  html.pin .walk-step h2 {
    font-size: clamp(30px, 2.6vw, 50px);
  }
  html.pin .crop {
    max-height: 40vh;
  }
  html.pin .crop img {
    max-height: 40vh;
    object-fit: cover;
    object-position: left top;
  }
}

/* ---- Sections after the walk ---------------------------------------------- */

.home-section {
  padding: clamp(72px, 8vw, 140px) 0 0;
}
.home-head {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 1000px;
}
.home-head h2 {
  font-size: clamp(32px, 4vw, 68px);
  text-wrap: balance;
}
.home-head .lede {
  max-width: 64ch;
}

/* Your own data: each card a part of the app, made for the screen it is on. */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 24px);
  margin-top: clamp(28px, 3.4vw, 52px);
}
.card {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rail-rule);
  border-radius: 10px;
  background: var(--rail);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 50px -30px rgba(4, 4, 22, 0.8);
}
.card-row {
  grid-column: span 12;
  flex-direction: row;
  align-items: center;
}
.card-shot {
  border-bottom: 1px solid var(--rail-rule);
  background: var(--ground-2);
}
.card-shot img {
  width: 100%;
}
.card-row .card-text {
  flex: 5;
}
.card-row .card-shot {
  flex: 7;
  border-bottom: 0;
  border-right: 1px solid var(--rail-rule);
}
.card-text {
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 8px;
  padding: clamp(18px, 2vw, 32px);
}
.card h3 {
  font-size: clamp(20px, 1.7vw, 28px);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.2;
  text-wrap: balance;
}
.card p:not(.label) {
  color: var(--soft);
  font-size: 16px;
}
.card .link-arrow {
  margin-top: 4px;
}

/* What it never does. */
.never-top {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: var(--gap);
  align-items: center;
}
.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(10px, 1.4vw, 22px);
}
.desk > div {
  display: grid;
  align-content: start;
  gap: 10px;
}
.desk-game i {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  background: linear-gradient(160deg, #1f1e4b, var(--night));
  color: var(--soft);
  font-size: clamp(14px, 1.3vw, 20px);
  font-style: normal;
  font-weight: 800;
  font-stretch: 112%;
}
.desk-app img {
  width: 100%;
  border: 1px solid rgba(189, 191, 224, 0.22);
  border-radius: 8px;
  box-shadow: 0 24px 50px -26px rgba(4, 4, 22, 0.9);
}
.desk .label {
  font-size: 11px;
}
.desk .label strong {
  color: var(--ink);
  font-weight: 700;
}
/* Winwall takes its place beside the game: one short move, once, as it arrives. */
@media (prefers-reduced-motion: no-preference) {
  html.motion .desk .desk-app {
    transform: translate3d(-18%, 0, 0);
    transition: transform 620ms var(--ease-soft) 160ms;
  }
  html.motion .desk.in .desk-app {
    transform: none;
  }
}
.nevers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin: clamp(36px, 4.6vw, 72px) 0 0;
  padding: 0;
  list-style: none;
}
.nevers li {
  display: grid;
  align-content: start;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.nevers svg {
  width: 30px;
  height: 30px;
  color: var(--primary-text);
}
.nevers h3 {
  font-size: clamp(21px, 1.9vw, 30px);
  font-weight: 900;
  font-stretch: 125%;
  font-style: italic;
  line-height: 1.08;
  text-wrap: balance;
}
.nevers p {
  color: var(--soft);
  font-size: 16px;
}

/* The plans at a glance: nothing to buy here. */
.glances {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 24px);
  margin-top: clamp(28px, 3.4vw, 52px);
}
.glance {
  --plan: var(--rule);
  --plan-ink: var(--ink);
  --plan-text: var(--ink);
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: clamp(20px, 2.2vw, 32px);
  border: 1px solid var(--rail-rule);
  border-top: 3px solid var(--plan);
  border-radius: 10px;
  background: var(--rail);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 24px 50px -30px rgba(4, 4, 22, 0.8);
}
.glance-free {
  --plan: var(--ink);
  --plan-ink: var(--ground);
}
.glance-plus {
  --plan: var(--plus);
  --plan-ink: var(--plus-ink);
  --plan-text: var(--plus-text);
}
.glance-pro {
  --plan: var(--pro);
  --plan-ink: var(--pro-ink);
  --plan-text: var(--pro-text);
}
.glance h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(24px, 2.2vw, 34px);
  color: var(--plan-text);
  text-transform: uppercase;
}
.glance .plan-icon {
  background: var(--plan);
  color: var(--plan-ink);
}
.glance-price {
  color: var(--soft);
  font-size: 15px;
}
.glance-price .display {
  margin-right: 6px;
  color: var(--plan-text);
  font-size: clamp(30px, 2.8vw, 44px);
}
.glance-year {
  display: block;
}
.glance-line {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}
.glance ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--rail-rule);
  list-style: none;
  color: var(--soft);
  font-size: 15px;
}
.glance li {
  position: relative;
  padding-left: 18px;
}
.glance li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 9px;
  height: 4px;
  background: var(--plan);
  transform: skewX(-24deg);
}
.glance-flag {
  justify-self: start;
  padding: 2px 8px;
  border: 1px solid rgba(248, 201, 79, 0.5);
  border-radius: 4px;
  color: var(--pro-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
@media (min-width: 1100px) {
  .glance-flag {
    position: absolute;
    top: clamp(20px, 2.2vw, 32px);
    right: clamp(20px, 2.2vw, 32px);
  }
}

/* The action, at the end: the thread, and how to join. */
.close {
  padding-bottom: clamp(72px, 8vw, 140px);
}
.close-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--gap);
  align-items: center;
}
.close-text {
  display: grid;
  justify-items: start;
  gap: 18px;
}
.close-mark {
  width: clamp(64px, 6vw, 96px);
}
.close-text h2 {
  font-size: clamp(36px, 5vw, 84px);
  text-wrap: balance;
}
.close-text .lede {
  max-width: 56ch;
}

/* Cards that can be pointed at lift a hair, as the app's do. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card,
  .glance {
    transition:
      transform var(--motion-quick) var(--ease-out),
      border-color var(--motion-quick) var(--ease-out);
  }
  .card:hover,
  .glance:hover {
    transform: translate3d(0, -3px, 0);
  }
}

/* ---- Narrower -------------------------------------------------------------- */

@media (max-width: 1023px) {
  .never-top,
  .close-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .card {
    grid-column: span 12;
  }
  .card-row {
    flex-direction: column;
    align-items: stretch;
  }
  .card-row .card-shot {
    border-right: 0;
    border-bottom: 1px solid var(--rail-rule);
  }
}
@media (max-width: 899px) {
  .glances,
  .nevers {
    grid-template-columns: minmax(0, 1fr);
  }
  .nevers {
    gap: 26px;
  }
}
@media (max-width: 760px) {
  .hero-copy {
    justify-items: start;
    text-align: left;
  }
  .hero-copy .actions {
    justify-content: flex-start;
  }
  .hero-copy .actions .btn {
    flex: 1 1 auto;
  }
  .win-controls,
  .win-titles {
    display: none;
  }
}

/* Two cards side by side keep one height: the picture's ground fills what the words leave. */
@media (min-width: 1024px) {
  .card:not(.card-row) .card-shot {
    display: grid;
    flex: 1 1 auto;
    place-items: center;
  }
  .card:not(.card-row) .card-text {
    flex: none;
  }
}
