/* Sky Window launch site. The page is one night: --t (0 to 1) is scroll progress through the document. */

@property --t {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --boost {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  /* light (default) */
  --bg: #f4f2ed;
  --bg-glow: #e9e6f2;
  --surface: #ffffff;
  --surface-raised: #fbfaf7;
  --border: #dcd8ce;
  --text: #121a2e;
  --text-muted: #4a5470;
  --accent: #8a4a00;
  --accent-fill: #f2b14c;
  --accent-ink: #1a1000;
  --accent-soft: #fbe7c6;
  --focus: #2c4fd6;

  --sky-day: #8ec5f0;
  --sky-golden: #f2b14c;
  --sky-blue: #4467b3;
  --sky-twilight: #2a2f6b;
  --sky-night: #0f1530;
  --sky-deep: #060a18;
  --star: #f6efd9;
  --moon-lit: #f6efd9;
  --moon-dark: #2a3150;
  --moon-up: #c9b98a;

  --rating-excellent: #1f7a4d;
  --rating-good: #3d6fb8;
  --rating-fair: #a8660a;
  --rating-poor: #a6475a;
  --rating-none: #6b7184;

  --night-text: #e7ebf5;
  --night-muted: #a6b0c8;
  --ground: color-mix(in oklch, var(--sky-night) 82%, var(--bg));
  --shadow:
    0 1px 2px rgb(18 26 46 / 0.08), 0 24px 48px -12px rgb(18 26 46 / 0.28);
  --shadow-big:
    0 2px 4px rgb(18 26 46 / 0.1), 0 40px 80px -20px rgb(18 26 46 / 0.45);

  --font-display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --font-body:
    "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1020;
    --bg-glow: #1b2246;
    --surface: #111a30;
    --surface-raised: #17213b;
    --border: #26314f;
    --text: #e7ebf5;
    --text-muted: #a6b0c8;
    --accent: #f2b14c;
    --accent-fill: #f2b14c;
    --accent-ink: #1a1000;
    --accent-soft: #3a2a12;
    --focus: #8fb0ff;

    --sky-day: #5f9fd6;
    --sky-golden: #e9a23b;
    --sky-blue: #3a5aa8;
    --sky-twilight: #252a63;
    --sky-night: #060a18;
    --sky-deep: #03050d;
    --star: #f3ead0;
    --moon-lit: #f3ead0;
    --moon-dark: #1c2440;
    --moon-up: #b9a874;

    --rating-excellent: #4fd69c;
    --rating-good: #7fa8f5;
    --rating-fair: #f2b14c;
    --rating-poor: #e58a9b;
    --rating-none: #7d859c;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 24px 48px -12px rgb(0 0 0 / 0.6);
    --shadow-big:
      0 2px 4px rgb(0 0 0 / 0.3), 0 40px 80px -20px rgb(0 0 0 / 0.75);
  }
}

/* Night vision demo: set by the "Try night vision" button, red on black, zero blue channel, no white */
:root[data-theme="night"] {
  --bg: #000000;
  --bg-glow: #1a0000;
  --surface: #0d0000;
  --surface-raised: #140000;
  --border: #3a0800;
  --text: #ff4400;
  --text-muted: #ff1a00;
  --accent: #ff6a00;
  --accent-fill: #ff6a00;
  --accent-ink: #000000;
  --accent-soft: #2a0800;
  --focus: #ff6a00;
  --sky-day: #661400;
  --sky-golden: #8a2600;
  --sky-blue: #4a0c00;
  --sky-twilight: #2a0500;
  --sky-night: #0d0000;
  --sky-deep: #000000;
  --star: #ff4400;
  --moon-lit: #ff4400;
  --moon-dark: #260500;
  --moon-up: #8a2000;
  --rating-excellent: #ff5500;
  --rating-good: #e03000;
  --rating-fair: #b02000;
  --rating-poor: #801400;
  --rating-none: #4a0a00;
  --night-text: var(--text);
  --night-muted: var(--text-muted);
  --shadow: none;
  --shadow-big: none;
}

/* Scroll progress drives the sky. Browsers without scroll timelines get --t from main.js. */
@keyframes sky-progress {
  to {
    --t: 1;
  }
}
@supports (animation-timeline: scroll()) {
  :root {
    animation: sky-progress linear both;
    animation-timeline: scroll(root);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--sky-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
}
ol,
ul {
  padding: 0;
  list-style: none;
}
p {
  max-width: 62ch;
}

a {
  color: inherit;
}

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

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

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 20;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
}
.skip:focus {
  top: 12px;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0;
}

em {
  font-style: italic;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.section-title,
.hero__title,
.closing__title,
.feature__title,
.step__title,
.readout__name,
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings:
    "SOFT" 50,
    "WONK" 0;
}

.section-title {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variation-settings:
    "SOFT" 50,
    "WONK" 0,
    "opsz" 144;
  max-width: 20ch;
  text-wrap: balance;
}
.section-title em,
.hero__title em {
  font-weight: 400;
}

.lead {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ---------- The sky layer ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--sky-deep);
  will-change: transform;
  pointer-events: none;
}
.sky__layer {
  position: absolute;
  inset: 0;
}
.sky__layer--base {
  background: linear-gradient(
    to bottom,
    var(--sky-day) 0%,
    color-mix(in oklch, var(--sky-day) 62%, var(--bg)) 64%,
    color-mix(in oklch, var(--sky-golden) 70%, var(--bg)) 90%,
    var(--sky-golden) 100%
  );
}
.sky__layer--golden {
  background: linear-gradient(
    to bottom,
    var(--sky-blue) 0%,
    color-mix(in oklch, var(--sky-blue) 55%, var(--sky-golden)) 72%,
    var(--sky-golden) 100%
  );
  opacity: clamp(0, var(--t) * 4, 1);
}
.sky__layer--twilight {
  background: linear-gradient(
    to bottom,
    var(--sky-twilight) 0%,
    var(--sky-twilight) 40%,
    var(--sky-blue) 100%
  );
  opacity: clamp(0, (var(--t) - 0.25) / 0.15, 1);
}
.sky__layer--night {
  background: linear-gradient(
    to bottom,
    var(--sky-deep) 0%,
    var(--sky-deep) 45%,
    var(--sky-night) 100%
  );
  opacity: clamp(0, (var(--t) - 0.4) / 0.15, 1);
}
@media (prefers-color-scheme: dark) {
  /* The hero starts at dusk: light text always has contrast. */
  :root:not([data-theme="night"]) .sky__layer--base {
    background: linear-gradient(
      to bottom,
      var(--sky-twilight) 0%,
      color-mix(in oklch, var(--sky-twilight) 50%, var(--sky-blue)) 46%,
      var(--sky-blue) 74%,
      var(--sky-golden) 100%
    );
  }
}

.sky__stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: max(clamp(0, (var(--t) - 0.45) * 4, 1), var(--boost));
  transition: --boost 600ms ease;
}
.is-dark .sky__stars {
  --boost: 1;
}
.sky__stars .glow {
  filter: url(#star-glow);
}
.tw {
  animation: twinkle 7s ease-in-out infinite;
}
.tw1 {
  animation-duration: 6s;
}
.tw2 {
  animation-duration: 8.5s;
  animation-delay: -2s;
}
.tw3 {
  animation-duration: 7.2s;
  animation-delay: -4s;
}
.tw4 {
  animation-duration: 9s;
  animation-delay: -1s;
}
.tw5 {
  animation-duration: 6.6s;
  animation-delay: -5s;
}
.tw6 {
  animation-duration: 8s;
  animation-delay: -3s;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.sky__moon {
  position: absolute;
  top: 11svh;
  right: 14vw;
  width: clamp(36px, 4vw, 56px);
  height: auto;
  filter: drop-shadow(
    0 0 12px color-mix(in srgb, var(--moon-lit) 45%, transparent)
  );
  transform: translateY(calc(clamp(0, (var(--t) - 0.05) / 0.3, 1) * 92svh));
}
@media (max-width: 559px) {
  .sky__moon {
    right: 3vw;
  }
}
/* Without the 360vh night scrub the page is much shorter, so the ramp
   reaches deep night by t = 0.22, before #features scrolls into view. */
@media (max-width: 719px), (prefers-reduced-motion: reduce) {
  .sky__layer--golden {
    opacity: clamp(0, var(--t) / 0.07, 1);
  }
  .sky__layer--twilight {
    opacity: clamp(0, (var(--t) - 0.07) / 0.07, 1);
  }
  .sky__layer--night {
    opacity: clamp(0, (var(--t) - 0.14) / 0.08, 1);
  }
  .sky__stars {
    opacity: max(clamp(0, (var(--t) - 0.18) * 6, 1), var(--boost));
  }
  .sky__moon {
    transform: translateY(
      calc(clamp(0, (var(--t) - 0.03) / 0.15, 1) * 92svh)
    );
  }
}

.sky__ridge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 12svh;
}

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  font: 600 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 200ms var(--ease),
    background-color 200ms ease,
    box-shadow 200ms ease,
    color 200ms ease;
}
.btn--primary {
  background: var(--accent-fill);
  color: var(--accent-ink);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.35) inset,
    0 8px 20px -8px rgb(138 74 0 / 0.55);
}
:root[data-theme="night"] .btn--primary,
:root[data-theme="night"] .on-sky .section-title {
  box-shadow: none;
  text-shadow: none;
}
.btn--primary:hover {
  background: color-mix(in oklch, var(--accent-fill) 88%, white);
  transform: translateY(-1px);
}
.btn--primary:active {
  transform: translateY(0);
  background: color-mix(in oklch, var(--accent-fill) 88%, black);
}
.btn--small {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.9375rem;
}
.btn--ghost {
  min-height: 44px;
  padding: 0 20px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
}
.btn--ghost:hover {
  border-color: var(--text-muted);
  background: var(--surface-raised);
}
.btn--ghost:active {
  transform: translateY(1px);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition:
    text-decoration-color 200ms ease,
    color 200ms ease;
}
.text-link:hover {
  text-decoration-thickness: 2px;
}
.text-link:active {
  color: var(--text-muted);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  border-bottom: 1px solid transparent;
  transition:
    background-color 250ms ease,
    border-color 250ms ease;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--text);
}
.brand__name {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.logo {
  flex: none;
  display: block;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  text-underline-offset: 4px;
}
.site-nav__link:hover {
  text-decoration: underline;
}
.site-nav__link:active {
  color: var(--text-muted);
}
@media (max-width: 559px) {
  .site-nav__link {
    display: none;
  }
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100svh;
  margin-top: -64px;
  padding: 104px 0 15svh;
  display: flex;
  align-items: center;
}
.hero__inner {
  display: grid;
  gap: 48px;
  align-items: center;
}
.hero__copy {
  text-align: center;
  justify-items: center;
  display: grid;
}
.hero__title {
  font-size: clamp(2.75rem, 1.6rem + 5.2vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-variation-settings:
    "SOFT" 50,
    "WONK" 0,
    "opsz" 144;
  max-width: 14ch;
}
.hero__title .line {
  display: inline-block;
}
.hero__lead {
  color: var(--text);
  margin-top: 24px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 32px;
}
.fine {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
/* On the hero sky, muted text takes more ink to stay readable. */
:root:not([data-theme="night"]) .hero__copy .eyebrow,
:root:not([data-theme="night"]) .hero .fine {
  color: color-mix(in oklch, var(--text) 82%, var(--text-muted));
}

.tonight {
  width: 100%;
  max-width: 460px;
  justify-self: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.tonight__list {
  display: grid;
  gap: 10px;
}
.tonight__row {
  display: grid;
  grid-template-columns: 28px 1fr 20px auto;
  grid-template-areas: "rank date moon dark" "rank rating rating rating";
  align-items: center;
  gap: 2px 12px;
  padding: 10px 14px 10px 12px;
  background: var(--surface-raised);
  border-radius: 12px;
  border-left: 3px solid var(--rating);
}
.tonight__rank {
  grid-area: rank;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent-ink);
  font: 600 0.875rem/1 var(--font-mono);
}
.tonight__date {
  grid-area: date;
  font-weight: 600;
}
.tonight__row .moon {
  grid-area: moon;
  width: 20px;
  height: 20px;
}
.tonight__row .num {
  grid-area: dark;
  text-align: right;
}
.tonight__rating {
  grid-area: rating;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.tonight__foot {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.tonight__foot .num {
  font-weight: 400;
}

@media (min-width: 520px) {
  .tonight__row {
    grid-template-columns: 28px 1fr 20px 5.5rem 5.5rem;
    grid-template-areas: "rank date moon dark rating";
  }
  .tonight__rating {
    text-align: right;
    font-size: inherit;
    color: var(--text);
  }
}

@media (min-width: 960px) {
  .hero {
    padding-bottom: 18svh;
  }
  .hero__inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 56px;
  }
  .hero__copy {
    text-align: left;
    justify-items: start;
  }
  .hero__actions {
    justify-content: flex-start;
  }
  .tonight {
    transform: rotate(-2deg);
  }
}

/* Load motion */
@media (prefers-reduced-motion: no-preference) {
  .hero__title .line,
  .hero__lead,
  .hero__actions,
  .fine {
    animation: rise 800ms var(--ease) both;
  }
  .hero__title .line:nth-child(2) {
    animation-delay: 80ms;
  }
  .hero__title .line:nth-child(3) {
    animation-delay: 160ms;
  }
  .hero__lead {
    animation-delay: 240ms;
  }
  .hero__actions {
    animation-delay: 300ms;
  }
  .fine {
    animation-delay: 340ms;
  }
  .tonight {
    animation: rise 900ms var(--ease) 360ms both;
  }
}
/* translate, not transform, so the card keeps its tilt */
@keyframes rise {
  from {
    opacity: 0;
    translate: 0 12px;
  }
}

/* ---------- Sections, cards ---------- */

.section {
  padding-block: clamp(64px, 10vw, 128px);
}

.card,
.band {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card {
  border-radius: 20px;
  padding: 28px;
}
.band {
  border-radius: 24px;
  padding: clamp(24px, 6vw, 64px);
}

/* Text sitting straight on the night sky */
.on-sky {
  color: var(--night-text);
}
.on-sky .eyebrow,
.on-sky .lead {
  color: var(--night-muted);
}
.on-sky .section-title {
  text-shadow: 0 1px 24px rgb(3 5 13 / 0.5);
}

/* Reveals: only hidden once main.js is running */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    --delay: calc(var(--i, 0) * 100ms);
    opacity: 0;
    translate: 0 12px;
    transition:
      opacity 700ms var(--ease) var(--delay),
      translate 700ms var(--ease) var(--delay);
  }
  .js .bento .reveal {
    --delay: calc(var(--i, 0) * 70ms);
    transition:
      opacity 700ms var(--ease) var(--delay),
      translate 700ms var(--ease) var(--delay),
      transform 200ms var(--ease),
      border-color 200ms ease;
  }
  .js .reveal.is-in {
    opacity: 1;
    translate: none;
  }
}

/* ---------- How it works ---------- */

.steps {
  display: grid;
  gap: 40px;
  margin-top: 48px;
}
@media (min-width: 860px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}
.step__art {
  height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}
.step__num {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 400;
}
.step__title {
  font-size: 1.375rem;
  line-height: 1.2;
  margin: 12px 0 8px;
}
.step p {
  color: var(--text-muted);
}

.mock-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--focus);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
}
.mock-search > span {
  color: var(--text);
}
.caret {
  display: inline-block;
  width: 1.5px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--text);
}
.mock-result {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 0.9375rem;
  font-weight: 500;
}
.mock-dates {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 400;
}
.mock-dates__arrow {
  color: var(--text-muted);
}
.mock-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.mini {
  position: relative;
  display: grid;
  place-items: center;
  height: 52px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--rating);
  font: 500 0.8125rem var(--font-mono);
}
.mini b {
  font-weight: 500;
}
.mini__star {
  position: absolute;
  top: 2px;
  right: 4px;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--accent-fill);
}

/* ---------- One night ---------- */

.night {
  position: relative;
  padding-block: clamp(64px, 10vw, 128px);
}
.night__card {
  position: relative;
  overflow: clip;
}
.night__date {
  margin-top: 12px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.night__date .num {
  color: var(--text);
}

.readout {
  display: none;
}

.tl {
  display: none;
  position: relative;
  margin-top: 32px;
}
.tl__sky {
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(
    to right,
    var(--sky-day) 0 13.54%,
    var(--sky-golden) 13.54% 19.44%,
    var(--sky-blue) 19.44% 20.49%,
    var(--sky-twilight) 20.49% 26.39%,
    var(--sky-night) 26.39% 73.26%,
    var(--sky-twilight) 73.26% 79.17%,
    var(--sky-blue) 79.17% 80.21%,
    var(--sky-golden) 80.21% 86.11%,
    var(--sky-day) 86.11% 100%
  );
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.tl__moon {
  position: relative;
  height: 18px;
  margin-top: 8px;
  border-radius: 9px;
  background: linear-gradient(
    to right,
    var(--moon-up) 0 22.34%,
    transparent 22.34%
  );
}
.tl__moon span {
  position: absolute;
  left: calc(22.34% + 8px);
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.tl__ticks {
  position: relative;
  height: 24px;
  margin-top: 10px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}
.tl__ticks span {
  position: absolute;
  left: calc(var(--at) * 100%);
  transform: translateX(-50%);
}
.tl__ticks span:first-child {
  transform: none;
}
.tl__ticks span:last-child {
  transform: translateX(-100%);
}
.tl__cursor-track {
  display: none;
  position: absolute;
  top: -10px;
  bottom: 30px;
  left: 0;
  width: 100%;
  transform: translateX(calc(var(--p) * 100%));
  will-change: transform;
  pointer-events: none;
}
.tl__cursor {
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  background: var(--accent-fill);
  box-shadow: 0 0 12px var(--accent-fill);
}
.tl__cursor::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-fill);
}

/* Events: a vertical timeline on phones, a labelled list with reduced motion */
.night__events {
  position: relative;
  display: grid;
  gap: 4px;
  margin-top: 32px;
  padding-left: 32px;
}
.night__events::before,
.night__events::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 6px;
}
.night__events::before {
  left: 0;
  width: 12px;
  background: linear-gradient(
    to bottom,
    var(--sky-day) 0 13.54%,
    var(--sky-golden) 13.54% 19.44%,
    var(--sky-blue) 19.44% 20.49%,
    var(--sky-twilight) 20.49% 26.39%,
    var(--sky-night) 26.39% 73.26%,
    var(--sky-twilight) 73.26% 79.17%,
    var(--sky-blue) 79.17% 80.21%,
    var(--sky-golden) 80.21% 86.11%,
    var(--sky-day) 86.11% 100%
  );
}
.night__events::after {
  left: 16px;
  width: 4px;
  background: linear-gradient(
    to bottom,
    var(--moon-up) 0 22.34%,
    transparent 22.34%
  );
}
.event {
  display: grid;
  grid-template-columns: 4.25rem 1fr;
  grid-template-areas: "time name" "time note";
  column-gap: 12px;
  padding: 12px 0 12px 14px;
  border-left: 3px solid transparent;
}
.event__time {
  grid-area: time;
  font-size: 0.9375rem;
  padding-top: 2px;
}
.event__name {
  grid-area: name;
  font-weight: 600;
}
.event__note {
  grid-area: note;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.event--dark {
  grid-template-columns: 1fr;
  grid-template-areas: "name" "time" "note";
  margin-block: 8px;
  padding: 16px 16px 16px 14px;
  border-left-color: var(--accent-fill);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
}
.event--dark .event__time {
  font-size: 2rem;
  line-height: 1.2;
  padding: 0;
  color: var(--text);
}

@media (min-width: 720px) {
  .tl {
    display: block;
  }
  .night__events {
    display: block;
    columns: 2;
    column-gap: 32px;
    padding-left: 0;
  }
  .event {
    break-inside: avoid;
  }
  .night__events::before,
  .night__events::after {
    display: none;
  }
}

/* The sticky scrub: wide screens with motion allowed */
@media (min-width: 720px) and (prefers-reduced-motion: no-preference) {
  .night {
    height: 360vh;
    padding: 0;
    view-timeline: --night block;
  }
  .night__stage {
    position: sticky;
    top: 0;
    height: 100svh;
    display: grid;
    align-items: center;
    padding-top: 64px;
  }
  .readout {
    display: block;
    margin-top: 28px;
    min-height: 6.5rem;
  }
  .readout__line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 20px;
    max-width: none;
  }
  .readout__name {
    font-size: 2.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .readout__time {
    font-size: 2rem;
    color: var(--accent);
  }
  .readout__caption {
    margin-top: 8px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 500ms ease;
  }
  .night.is-peak .readout__caption {
    opacity: 1;
  }
  .tl__cursor-track {
    display: block;
  }
  .night__events {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}
@supports (animation-timeline: view()) {
  @media (min-width: 720px) and (prefers-reduced-motion: no-preference) {
    .night {
      animation: night-progress linear both;
      animation-timeline: --night;
      animation-range: contain 0% contain 100%;
    }
  }
}
@keyframes night-progress {
  from {
    --p: 0;
  }
  to {
    --p: 1;
  }
}
@media (min-width: 720px) and (max-height: 760px) and (prefers-reduced-motion: no-preference) {
  .night__card .lead {
    display: none;
  }
}

/* ---------- Features ---------- */

.bento {
  display: grid;
  gap: 20px;
  margin-top: 48px;
}
@media (min-width: 720px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .feature--a,
  .feature--f {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1080px) {
  .bento {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .feature--a {
    grid-column: span 7;
  }
  .feature--b {
    grid-column: span 5;
  }
  .feature--c,
  .feature--d,
  .feature--e {
    grid-column: span 4;
  }
  .feature--f {
    grid-column: span 12;
  }
}
.feature {
  display: flex;
  flex-direction: column;
  transition:
    transform 200ms var(--ease),
    border-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .feature:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
  }
}
.feature__art {
  margin-bottom: 24px;
}
.feature__title {
  font-size: 1.375rem;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.feature p {
  color: var(--text-muted);
}
.feature .feature__art p {
  max-width: none;
}

.cal__caption {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cal__caption .num {
  color: var(--text);
}
.cal__head,
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal__head {
  margin-bottom: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}
.cal__cell {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  min-height: 72px;
  padding: 6px 2px 7px;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--rating);
  text-align: center;
}
.cal__day {
  font: 500 0.75rem/1 var(--font-mono);
  justify-self: start;
  padding-left: 4px;
}
.cal__cell .moon {
  width: 16px;
  height: 16px;
}
.cal__dark {
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.15;
}
.cal__star {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--accent-fill);
}
@media (max-width: 519px) {
  .cal__dark {
    font-size: 0.6875rem;
    word-spacing: 100vw;
  }
  .cal__day {
    font-size: 0.8125rem;
  }
  .cal__cell {
    min-height: 80px;
  }
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend li::before {
  content: "";
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--rating);
}

.rating--excellent {
  --rating: var(--rating-excellent);
}
.rating--good {
  --rating: var(--rating-good);
}
.rating--fair {
  --rating: var(--rating-fair);
}
.rating--poor {
  --rating: var(--rating-poor);
}
.rating--none {
  --rating: var(--rating-none);
}

.hours {
  display: grid;
  align-content: center;
  gap: 28px;
}
.feature--b .feature__art {
  flex: 1;
}
.feature--b .feature__title {
  margin-top: auto;
}
.hours__summary {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
}
.hours__summary span {
  color: var(--text);
}
.hours__label {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.hours__bar {
  display: flex;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
}
.seg--blue {
  background: var(--sky-blue);
}
.seg--golden {
  background: var(--sky-golden);
}
.hours__times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8125rem;
  font-weight: 400;
}
.hours__row:first-of-type .hours__times span:nth-child(2) {
  margin-right: auto;
  margin-left: 4%;
}
.hours__row:last-of-type .hours__times span:nth-child(2) {
  margin-left: auto;
  margin-right: 4%;
}
.hours__key {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.key::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.key--blue::before {
  background: var(--sky-blue);
}
.key--golden::before {
  background: var(--sky-golden);
}

.moons {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px 0 4px;
}
.moons figure {
  display: grid;
  justify-items: center;
  gap: 12px;
}
.moon--big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--moon-dark) 30%, transparent);
}
.moons figcaption {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.moons figcaption .num {
  font-weight: 400;
}

.feature--d .feature__art {
  display: grid;
  justify-items: center;
  gap: 18px;
}
.phone-mini {
  width: 180px;
  padding: 26px 10px 30px;
  border-radius: 24px;
  background: #000000;
  border: 5px solid #260500;
}
.phone-mini__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.phone-mini__row > span {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 6px;
  background: #140000;
  border-bottom: 2px solid #ff5500;
  color: #ff4400;
  font-family: var(--font-mono);
}
.phone-mini b {
  font-size: 0.75rem;
  font-weight: 500;
}
.phone-mini i {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.6875rem;
  line-height: 1;
  font-style: normal;
  color: #ff6a00;
}
.phone-mini em {
  font-size: 0.6875rem;
  font-style: normal;
}
.night-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.polar {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.polar__sun {
  width: 160px;
  height: auto;
}
.polar__cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 92px;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--rating);
}
.polar__word {
  font-weight: 600;
}

.feature--f {
  display: grid;
  gap: 20px;
  align-items: center;
}
@media (min-width: 1080px) {
  .feature--f {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 40px;
  }
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
}
.facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.facts svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 519px) {
  .card {
    padding: 20px;
  }
}

/* ---------- The real app ---------- */

.try__head {
  margin-bottom: 48px;
}
.device {
  position: relative;
  margin-inline: auto;
  width: min(100%, 390px);
  height: 760px;
  border-radius: 40px;
  border: 10px solid var(--text);
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-big);
}
.device__bar {
  display: none;
}
.device__screen {
  position: relative;
  height: 100%;
}
.device iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}
.device__tap {
  display: none;
}
@media (pointer: coarse) {
  .device:not(.is-live) iframe {
    pointer-events: none;
  }
  .device__tap {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font: 600 0.9375rem var(--font-body);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 200ms var(--ease);
  }
  .device__tap:active {
    transform: translateX(-50%) scale(0.97);
  }
  .device.is-live .device__tap {
    display: none;
  }
}
@media (min-width: 960px) {
  .device {
    width: 100%;
    max-width: 1120px;
    height: 720px;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
  }
  .device__bar {
    position: relative;
    display: flex;
    align-items: center;
    flex: none;
    height: 40px;
    padding: 0 16px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
  }
  .device__dots {
    display: flex;
    gap: 8px;
  }
  .device__dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
  }
  .device__label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-muted);
  }
  .device__screen {
    flex: 1;
    height: auto;
  }
}
.try__open {
  margin: 20px auto 0;
  text-align: center;
  color: var(--night-muted);
  font-size: 0.9375rem;
}
.try__open .text-link {
  color: var(--night-text);
}

/* ---------- Method ---------- */

.thresholds {
  display: grid;
  gap: 4px 40px;
  margin-top: 40px;
}
@media (min-width: 820px) {
  .thresholds {
    grid-template-columns: 1fr 1fr;
  }
}
.threshold {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.swatch {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
}
.swatch--day {
  background: var(--sky-day);
}
.swatch--golden {
  background: var(--sky-golden);
}
.swatch--blue {
  background: var(--sky-blue);
}
.swatch--night {
  background: var(--sky-night);
}
.swatch--moon {
  background: var(--moon-up);
}
.swatch--all {
  background: linear-gradient(
    to right,
    var(--sky-day),
    var(--sky-golden),
    var(--sky-blue),
    var(--sky-night) 50%,
    var(--sky-blue),
    var(--sky-golden),
    var(--sky-day)
  );
}
.threshold dt {
  font-weight: 600;
}
.threshold dd {
  color: var(--text-muted);
}

.callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 40px;
  padding: 20px 22px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
}
.callout svg {
  flex: none;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

/* ---------- Closing ---------- */

.closing {
  padding-block: 20vh;
  color: var(--night-text);
  text-align: center;
}
.closing__inner {
  display: grid;
  justify-items: center;
  gap: 28px;
}
.logo--big {
  width: 64px;
  height: 64px;
}
.closing__title {
  font-size: clamp(2.25rem, 1.4rem + 3.8vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variation-settings:
    "SOFT" 50,
    "WONK" 0,
    "opsz" 144;
  max-width: 16ch;
  text-wrap: balance;
}
.closing__note {
  color: var(--night-muted);
  font-size: 0.9375rem;
}
@media (prefers-reduced-motion: no-preference) {
  .closing.is-in .logo__star {
    animation: twinkle 1.2s ease-in-out 300ms 1;
  }
  .closing.is-in .logo__star + .logo__star {
    animation-delay: 600ms;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ground);
  color: var(--night-muted);
  font-size: 0.875rem;
  padding: 20px 0;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}
.site-footer nav {
  display: flex;
  gap: 20px;
}
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-underline-offset: 4px;
  transition: color 200ms ease;
}
.site-footer a:hover {
  color: var(--night-text);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .tw {
    animation: none;
  }
  .sky__stars,
  .site-header,
  .btn,
  .feature,
  .device__tap {
    transition: none;
  }
  .feature:hover,
  .btn:hover,
  .btn:active {
    transform: none;
  }
}
