:root {
  --sky-0: #14072e;
  --sky-1: #2b1063;
  --sky-2: #56209a;
  --sky-3: #7430b0;
  --glow: #ff8fd8;
  --water: #130822;
  --text: #f6eeff;
  --soft: #cfbaf3;
  --orchid: #cda6ff;
  --warm: #ffbe94;
  --line: rgba(233, 214, 255, .2);
  --display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: clamp(1.1rem, 4vw, 3.5rem);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--water);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--body);
}

h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: .18em; }
a:hover { color: var(--orchid); }

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

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

/* Sky: the first screen, ending on the horizon line */

.sky {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(90% 34% at 50% 100%, rgba(255, 143, 216, .34), transparent 72%),
    linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 36%, var(--sky-2) 74%, var(--sky-3) 100%);
  border-bottom: 2px solid #ffd3ef;
  box-shadow: 0 0 34px rgba(255, 143, 216, .55);
  position: relative;
  z-index: 1;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .9rem 1.5rem;
  padding: 1.15rem var(--pad) 0;
}

.brand {
  font-family: var(--display);
  font-size: 1.2rem;
  line-height: 1;
  padding-bottom: .55rem;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: .7rem;
}

.store {
  display: grid;
  gap: .2rem;
  font-size: .82rem;
  color: var(--soft);
}

.store select,
.lang {
  font: 600 1rem/1.2 var(--body);
  color: var(--text);
  background-color: rgba(20, 7, 46, .5);
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .55rem .85rem;
  cursor: pointer;
}

.store select {
  appearance: none;
  max-width: 15.5rem;
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23f6eeff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  background-size: .7rem;
}

.store select option {
  background: #1c0d3a;
  color: var(--text);
}

.store select:hover,
.lang:hover { border-color: var(--orchid); }

/* The statement: one sentence with the countdown as its middle */

.clock {
  container-type: inline-size;
  align-self: center;
  padding: 2.5rem var(--pad);
}

.statement { font-weight: 400; }

.lead {
  display: block;
  font: 600 clamp(1.15rem, 2.5cqw, 1.9rem)/1.2 var(--body);
  color: var(--soft);
}

.digits {
  display: flex;
  align-items: baseline;
  gap: .2em;
  margin: .1em 0 .14em;
  font-family: var(--display);
  font-size: min(12.4cqw, 12rem);
  line-height: 1;
  white-space: nowrap;
  text-shadow: .035em .045em 0 #d955b8;
}

.digits[data-groups="3"] { font-size: min(14.6cqw, 14rem); }

.digits.is-word {
  font-size: min(10.6cqw, 11rem);
  white-space: normal;
  text-wrap: balance;
}

.grp {
  display: inline-flex;
  align-items: baseline;
  gap: .05em;
}

.num i {
  display: inline-block;
  width: .78em;
  text-align: center;
  font-style: normal;
}

.unit {
  font: 700 max(.25em, .8rem)/1 var(--body);
  color: var(--orchid);
  text-shadow: none;
}

.tail {
  display: block;
  max-width: 33em;
  font: 500 clamp(1.1rem, 2.3cqw, 1.55rem)/1.35 var(--body);
  text-wrap: balance;
}

.yours {
  margin-top: .7rem;
  font-size: clamp(1rem, 1.9cqw, 1.2rem);
  font-weight: 600;
  color: var(--warm);
}

.hint {
  margin-top: .7rem;
  max-width: 62ch;
  font-size: .95rem;
  color: var(--soft);
}

/* The night strip: 15 unlock waves standing on the horizon, on a real time axis */

.strip { padding: 0 var(--pad); }

.track {
  position: relative;
  height: 5.8rem;
}

.tick {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .25rem .3rem 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 700 .8rem/1 var(--body);
  cursor: pointer;
}

.tick-label {
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(20, 7, 46, .8);
}

.tick-label small {
  font-size: .85em;
  font-weight: 500;
  opacity: .85;
}

.tick-mark {
  width: 2px;
  height: .9rem;
  background: var(--text);
  border-radius: 2px 2px 0 0;
}

.tick:hover .tick-mark { height: 1.3rem; }

.tick.is-past { color: var(--warm); }
.tick.is-past .tick-mark { background: var(--warm); }

.tick.is-selected { font-size: 1rem; z-index: 2; }
.tick.is-selected .tick-mark {
  width: 4px;
  height: 2.1rem;
}

.now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed var(--warm);
  pointer-events: none;
  z-index: 1;
}

.now span {
  position: absolute;
  top: -.2rem;
  left: .45rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--warm);
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(20, 7, 46, .8);
}

.now.flip span {
  left: auto;
  right: .45rem;
}

/* Water: everything below the horizon */

.water {
  padding: 0 var(--pad) 3.5rem;
  background:
    radial-gradient(70% 8rem at 50% 0, rgba(255, 143, 216, .26), transparent 75%),
    linear-gradient(180deg, #2c1254 0, var(--water) 24rem);
}

.caption {
  padding-top: 1.2rem;
  font-weight: 600;
  min-height: 3rem;
}

.waves {
  max-width: 72rem;
  margin-top: 4.5rem;
}

.waves h2 {
  max-width: 17em;
  font: 400 clamp(1.75rem, 4.2vw, 2.9rem)/1.1 var(--display);
  text-wrap: balance;
}

.intro {
  max-width: 64ch;
  margin-top: 1rem;
  color: var(--soft);
}

.wave-list { margin-top: 2.2rem; }

.wave {
  display: grid;
  grid-template-columns: 2.4rem 8.5rem 1fr 13.5rem;
  grid-template-areas: "n when mid delta";
  gap: .2rem 1.4rem;
  align-items: baseline;
  padding: 1.05rem .9rem;
  margin: 0 -.9rem;
  border-top: 1px solid var(--line);
}

.wave:last-child { border-bottom: 1px solid var(--line); }

.wave.is-selected {
  background: linear-gradient(90deg, rgba(205, 166, 255, .17), rgba(205, 166, 255, 0) 85%);
}

.wave-n {
  grid-area: n;
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--orchid);
}

.wave.is-selected .wave-n { color: var(--text); }

.wave-when { grid-area: when; }

.wave-time {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.wave-day {
  display: block;
  font-size: .9rem;
  color: var(--soft);
}

.wave-mid { grid-area: mid; }

.wave-where {
  margin-bottom: .5rem;
  font-size: .95rem;
  color: var(--soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.chip {
  font: 500 .95rem/1.2 var(--body);
  color: var(--text);
  background: rgba(205, 166, 255, .13);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .32rem .75rem;
  cursor: pointer;
}

.chip:hover { border-color: var(--orchid); }

.chip[aria-pressed="true"] {
  background: var(--text);
  color: var(--sky-0);
  font-weight: 700;
}

.wave-delta {
  grid-area: delta;
  text-align: right;
  font-size: .95rem;
  color: var(--soft);
}

.wave.is-selected .wave-delta {
  color: var(--text);
  font-weight: 700;
}

.wave.is-past .wave-delta {
  color: var(--warm);
  font-weight: 600;
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 2rem 3.5rem;
  max-width: 72rem;
  margin-top: 4.5rem;
}

.notes h3 {
  font: 400 1.35rem/1.2 var(--display);
  margin-bottom: .6rem;
}

.notes p {
  max-width: 58ch;
  color: var(--soft);
}

.foot {
  max-width: 72rem;
  margin-top: 4.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: .88rem;
  color: var(--soft);
}

.foot p { max-width: 78ch; }
.foot p + p { margin-top: .6rem; }

@media (max-width: 760px) {
  .controls { width: 100%; }
  .store { flex: 1; }
  .store select { width: 100%; max-width: none; }

  .tick:not(.is-selected) .tick-label { display: none; }
  .tick { padding-inline: .1rem; }

  .wave {
    grid-template-columns: 2rem 1fr auto;
    grid-template-areas:
      "n when delta"
      ". mid mid";
    gap: .5rem .8rem;
  }

  .wave-delta { font-size: .88rem; }
}
