/* Raleway for headings, Source Sans 3 for body text. */

:root {
  /* Carousel */
  --carousel-fade-stop: 33.33%;
  --carousel-gap: 0.25em;
  --carousel-slot: 3.6em;

  /* Colors */
  --color-accent: #000;
  --color-background: #ffffff;
  --color-muted: #6b7280;
  --color-text: #1a1a1a;

  /* Fonts */
  --font-body: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-heading: 'Raleway', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #f9fafb;
    --color-background: #0f172a;
    --color-muted: #9ca3af;
    --color-text: #e5e7eb;
    color-scheme: dark;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

.site {
  width: -webkit-fit-content;
  width: fit-content;
  margin: 0 auto;
}

/* Keep "Privacy is..." centered on the active carousel word. */
h1 {
  display: flex;
  align-items: center;
  gap: var(--carousel-gap);
  color: var(--color-muted);
}

/* Fixed clip window for the word carousel (the ul is the moving track). */
h1 > span {
  display: inline-block;
  height: var(--carousel-slot);
  overflow: hidden;
  vertical-align: middle;
  mask-image: linear-gradient(to bottom, transparent 0%, black var(--carousel-fade-stop), black calc(100% - var(--carousel-fade-stop)), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black var(--carousel-fade-stop), black calc(100% - var(--carousel-fade-stop)), transparent 100%);
}

/* Screen-reader-only text. */
h1 + p {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Word carousel. */
h1 > span > ul {
  margin: 0;
  padding: 0;
  list-style: none;
  animation: carousel 12.5s linear infinite;
}

h1 > span > ul > li {
  display: block;
  white-space: nowrap;
  line-height: var(--carousel-slot);
  color: var(--color-accent);
  text-align: left;
}

/* 12.5s = 5 words x (2s hold + 0.5s scroll); the keyframe stops are slots of
   the 6-item track (each slot is ~16.67% of the track, the duplicated first
   word makes the loop seamless). */
@keyframes carousel {
  0%      { transform: translateY(0); }
  16%     { transform: translateY(0); }
  20%     { transform: translateY(-16.6667%); }
  36%     { transform: translateY(-16.6667%); }
  40%     { transform: translateY(-33.3333%); }
  56%     { transform: translateY(-33.3333%); }
  60%     { transform: translateY(-50%); }
  76%     { transform: translateY(-50%); }
  80%     { transform: translateY(-66.6667%); }
  96%     { transform: translateY(-66.6667%); }
  100%    { transform: translateY(-83.3333%); }
}

@media (max-width: 40rem) {
  h1 {
    flex-direction: column;
    align-items: flex-start;
    font-size: clamp(1.5rem, 6vw, 2.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  h1 > span {
    height: auto;
    overflow: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  h1 > span > ul {
    animation: none;
  }

  h1 > span > ul > li {
    display: inline;
    line-height: inherit;
  }

  h1 > span > ul > li::after {
    content: " \00b7 ";
  }

  h1 > span > ul > li:last-child {
    display: none;
  }
}
