/* Align With Me: one screen, no scrolling. A night sky above a horizon
   (hopes) and deep water below it (fears). */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #06070d;
  --ink: #ece9f2;
  --ink-2: #bdb9cb;
  --ink-3: #8c88a2;
  --hairline: rgba(236, 233, 242, 0.14);
  --glass: rgba(11, 11, 24, 0.72);
  --glass-strong: rgba(13, 13, 27, 0.9);

  /* Diverging hope/fear scale: validated for colorblind separation and
     >= 4.7:1 contrast on the night surface (docs/design-concepts.md). */
  --fear-3: #5379df;
  --fear-2: #849fe7;
  --fear-1: #b3c3ec;
  --mixed: #ebe7e2;
  --hope-1: #efcd97;
  --hope-2: #f1af5d;
  --hope-3: #ef8e2f;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: 20px;
  --horizon-y: 50vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--hope-1);
  outline-offset: 3px;
}

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

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}
#field.pointing {
  cursor: pointer;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  z-index: 6;
  pointer-events: none;
}
.masthead > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--serif);
  font-weight: 380;
  font-size: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand svg {
  flex: none;
}
.brand i {
  font-style: italic;
  color: var(--ink-2);
}

.tally {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tally .live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.5;
  transition: background 0.4s, opacity 0.4s;
}
.tally .live.on {
  background: var(--hope-1);
  opacity: 1;
  box-shadow: 0 0 8px var(--hope-2);
}

.controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.filters {
  display: flex;
  gap: 4px;
}
.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}
.filter:hover {
  border-color: var(--hairline);
  color: var(--ink);
}
.filter[aria-pressed='false'] {
  opacity: 0.45;
}
.filter[aria-pressed='false'] .key {
  background: var(--ink-3);
}
.key {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--c, var(--mixed));
  flex: none;
}
.k-hope {
  --c: var(--hope-2);
}
.k-mixed {
  --c: var(--mixed);
}
.k-fear {
  --c: var(--fear-2);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover {
  color: var(--ink);
  border-color: rgba(236, 233, 242, 0.32);
}

/* ---------------------------------------------------- zone labels (legend) */

.zone {
  position: absolute;
  left: var(--gutter);
  z-index: 2;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  pointer-events: none;
  transition: opacity 0.4s;
}
.zone b {
  font-weight: 500;
  color: var(--ink-2);
}
.zone-hope {
  top: 64px;
}
.zone-fear {
  bottom: 58px;
}

/* ------------------------------------------------------------------ compose */

.compose {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: var(--horizon-y);
  width: min(620px, calc(100% - 2 * var(--gutter)));
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 24px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  transition:
    border-color 0.3s,
    box-shadow 0.3s,
    opacity 0.45s,
    transform 0.45s;
}
.compose:focus-within {
  border-color: rgba(236, 233, 242, 0.34);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.5),
    0 0 0 6px rgba(236, 233, 242, 0.04);
}
.compose.away {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
}
.compose.busy {
  border-color: rgba(239, 205, 151, 0.4);
}
.compose.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes shake {
  10%,
  90% {
    transform: translate(calc(-50% - 1px), -50%);
  }
  20%,
  80% {
    transform: translate(calc(-50% + 3px), -50%);
  }
  30%,
  50%,
  70% {
    transform: translate(calc(-50% - 6px), -50%);
  }
  40%,
  60% {
    transform: translate(calc(-50% + 6px), -50%);
  }
}

.compose input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 360;
  line-height: 1.3;
  user-select: text;
  -webkit-user-select: text;
}
.compose input::placeholder {
  color: var(--ink-3);
  font-style: italic;
  opacity: 1;
}
.compose input:disabled {
  color: var(--ink-2);
}

.counter {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}
.counter.low {
  color: var(--hope-2);
}

.send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #0b0b16;
  cursor: pointer;
  transition:
    transform 0.2s,
    opacity 0.2s,
    background 0.2s;
}
.send:hover:not(:disabled) {
  transform: scale(1.06);
  background: #fff;
}
.send:disabled {
  opacity: 0.3;
  cursor: default;
}
.compose.busy .send svg {
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.note {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: calc(var(--horizon-y) + 40px);
  width: min(620px, calc(100% - 2 * var(--gutter)));
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  text-shadow: 0 0 14px var(--night), 0 0 4px var(--night);
  pointer-events: none;
  transition: opacity 0.4s;
}
.note b {
  font-weight: 600;
  color: var(--ink);
}
.note.warn {
  color: var(--hope-1);
}
.note.away {
  opacity: 0;
}

/* One quiet way to act on what was just said, after the kindred voices bloom. */
.note .offer {
  display: block;
  margin-top: 5px;
  animation: offer-in 0.9s ease 1.4s both;
}
@keyframes offer-in {
  from {
    opacity: 0;
  }
}

/* Links out to campaigns, and buttons that read as links */
.offer a,
.focus-offer a,
dialog.beyond li a,
.link {
  pointer-events: auto;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(236, 233, 242, 0.3);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: text-decoration-color 0.2s;
}
.offer a:hover,
.focus-offer a:hover,
dialog.beyond li a:hover,
.link:hover {
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------ theme labels */

.themes {
  position: absolute;
  inset: auto 0 0 0;
  height: 48px;
  z-index: 4;
}
.theme-label {
  position: absolute;
  bottom: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-3);
  transition:
    color 0.25s,
    left 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.4s;
}
.theme-label span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.theme-label::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 6px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-2), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.theme-label:hover,
.theme-label.hot,
.theme-label[aria-current='true'] {
  color: var(--ink);
}
.theme-label:hover::after,
.theme-label.hot::after,
.theme-label[aria-current='true']::after {
  opacity: 1;
}
.theme-label.fresh {
  animation: arrive 1.2s ease-out;
}
.theme-label.probe {
  position: absolute;
  left: -9999px;
  bottom: auto;
  width: auto;
  height: auto;
  padding: 0;
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
}

/* Narrow columns: labels alternate between two single-line rows. */
.themes.staggered {
  height: 64px;
}
.themes.staggered .theme-label {
  height: 30px;
  white-space: nowrap;
}
.themes.staggered .theme-label.upper {
  bottom: 26px;
}
.themes.staggered .theme-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.themes.staggered .theme-label::after {
  top: 3px;
}
.theme-label.mini span::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ----------------------------------------------------------- floating text */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.quote,
.whisper,
.tip,
.flight {
  position: absolute;
  margin: 0;
  font-family: var(--serif);
}

.quote {
  max-width: 250px;
  font-size: 15px;
  font-weight: 360;
  line-height: 1.38;
  color: var(--ink);
  text-shadow:
    0 0 16px var(--night),
    0 0 6px var(--night),
    0 0 2px var(--night);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  pointer-events: auto;
  cursor: pointer;
}
.quote.in {
  opacity: 1;
  transform: none;
}
.quote .key {
  margin-right: 8px;
  vertical-align: 0.3em;
}
.quote.kin {
  font-size: 14px;
  max-width: 230px;
}
.quote.kin .by {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.whisper {
  max-width: 230px;
  font-size: 14px;
  font-style: italic;
  font-weight: 330;
  line-height: 1.38;
  color: var(--ink-2);
  text-shadow: 0 0 14px var(--night), 0 0 4px var(--night);
  opacity: 0;
  transition: opacity 1.6s ease;
}
.whisper.in {
  opacity: 0.85;
}

.tip {
  z-index: 7;
  max-width: 290px;
  padding: 11px 14px 10px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}
.tip.in {
  opacity: 1;
}
.tip q {
  display: block;
  font-size: 16px;
  font-weight: 370;
  line-height: 1.38;
  quotes: none;
}
.tip .meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
}
.tip .meta b {
  font-weight: 500;
  color: var(--ink-2);
}

.flight {
  z-index: 8;
  font-size: 19px;
  font-weight: 360;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ------------------------------------------------------------- focus view */

.focus-head {
  position: absolute;
  z-index: 6;
  top: 58px;
  left: 50%;
  width: min(640px, calc(100% - 2 * var(--gutter)));
  transform: translateX(-50%);
  text-align: center;
  transition: opacity 0.4s;
}
.focus-head[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
}
.focus-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 340;
  letter-spacing: -0.005em;
  line-height: 1.15;
}
.focus-head p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}
.focus-head .counts {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.focus-head .counts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.focus-head .focus-offer {
  margin-top: 8px;
  font-size: 12.5px;
}
.focus-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(11, 11, 24, 0.55);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.pill:hover {
  color: var(--ink);
  border-color: rgba(236, 233, 242, 0.34);
}

/* Ambient ticker for live events */
.ticker {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(520px, 50vw);
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
}
.ticker.in {
  opacity: 1;
}

.empty {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: calc(var(--horizon-y) - 78px);
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-2);
  pointer-events: none;
}

/* ------------------------------------------------------------------- about */

dialog.about {
  width: min(540px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow: auto;
  padding: 30px 32px 26px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: #0d0d1b;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
dialog.about::backdrop {
  background: rgba(3, 3, 9, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
dialog.about h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 360;
  font-size: 26px;
}
dialog.about p,
dialog.about li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}
dialog.about p {
  margin: 0 0 12px;
}
dialog.about ul {
  margin: 0 0 14px;
  padding-left: 18px;
}
dialog.about li {
  margin-bottom: 4px;
}
dialog.about b {
  font-weight: 500;
  color: var(--ink);
}
dialog.about .legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
  font-size: 12px;
  color: var(--ink-2);
}
dialog.about .legend-row > span:not(.scale) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
dialog.about .scale {
  display: flex;
  height: 6px;
  width: 140px;
  border-radius: 3px;
  overflow: hidden;
}
dialog.about .scale i {
  flex: 1;
  align-self: stretch;
}
dialog.about .scale i:nth-child(1) {
  background: var(--fear-3);
}
dialog.about .scale i:nth-child(2) {
  background: var(--fear-2);
}
dialog.about .scale i:nth-child(3) {
  background: var(--fear-1);
}
dialog.about .scale i:nth-child(4) {
  background: var(--mixed);
}
dialog.about .scale i:nth-child(5) {
  background: var(--hope-1);
}
dialog.about .scale i:nth-child(6) {
  background: var(--hope-2);
}
dialog.about .scale i:nth-child(7) {
  background: var(--hope-3);
}
dialog.about .close-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-3);
}
/* Headings take focus when a dialog opens, so a stray Enter can't follow a link. */
dialog.about [tabindex='-1']:focus {
  outline: none;
}

/* "Beyond this page": campaigns, grouped by what you can do */
dialog.beyond h3 {
  margin: 16px 0 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
dialog.beyond ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
dialog.beyond li {
  margin: 0 0 9px;
  line-height: 1.4;
  color: var(--ink);
}
dialog.beyond .blurb {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
dialog.beyond .fine {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
kbd {
  font-family: var(--sans);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ phones */

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }
  .masthead {
    padding: 12px var(--gutter);
  }
  .brand {
    font-size: 16px;
  }
  .brand .wordmark-rest {
    display: none;
  }
  .filter .label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .filter {
    padding: 8px;
  }
  .controls {
    gap: 8px;
  }
  .tally .themes-count {
    display: none;
  }
  .zone-hope {
    top: 54px;
  }
  .compose {
    padding-left: 18px;
  }
  .compose input {
    font-size: 17px;
  }
  .send {
    width: 40px;
    height: 40px;
  }
  .theme-label {
    font-size: 9.5px;
    letter-spacing: 0.06em;
    padding: 0 2px;
  }
  .focus-head {
    top: 50px;
  }
  .focus-head h2 {
    font-size: 24px;
  }
  .focus-head p {
    font-size: 12px;
  }
  dialog.about {
    padding: 24px 22px 20px;
  }
  dialog.beyond h3 {
    margin-top: 12px;
  }
  dialog.beyond li {
    margin-bottom: 7px;
  }
  dialog.beyond .fine {
    margin-top: 12px;
  }
  .quote {
    font-size: 13.5px;
    max-width: 180px;
  }
  .quote.kin {
    font-size: 13px;
    max-width: 170px;
  }
  .ticker {
    display: none;
  }
  .flight {
    font-size: 17px;
  }
}

@media (max-width: 400px) {
  .tally {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compose.shake {
    animation: none;
  }
  .compose.busy .send svg {
    animation: none;
  }
  .quote,
  .whisper,
  .tip,
  .theme-label {
    transition-duration: 0.01s;
  }
  .theme-label.fresh {
    animation: none;
  }
}

@media (forced-colors: active) {
  .compose,
  .tip,
  dialog.about {
    border: 1px solid CanvasText;
  }
}
