/* Each color is light-dark(light, dark), following the browser's theme or the one chosen with the switch */
:root {
  color-scheme: light dark;
  --text: light-dark(#111111, #f0f0f0);
  --muted: light-dark(#5c5c5c, #a3a3a3);
  --background: light-dark(#ffffff, #000000);
  --accent: light-dark(#000000, #ffffff);
  --divider: light-dark(#e2e2e2, #2e2e2e);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--background);
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.brand img {
  border-radius: 25%;
}

/*
 * On phones narrower than 360px, the switches only fit beside the icon, so the name moves below the
 * header, above the page's title. Screen readers still read it in the header.
 */
.brand-name {
  display: none;
}

@media (max-width: 22.4rem) {
  .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .brand-name {
    display: block;
    margin: 1.25rem 0 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .brand-name + h1 {
    margin-top: 0.5rem;
  }
}

/* The theme and language switches: pills with the current choice filled in */
.switches {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.switch {
  display: flex;
  margin: 0;
  padding: 0.1875rem;
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: var(--background);
}

.switch[hidden] {
  display: none;
}

.switch a,
.switch label {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  box-sizing: border-box;
  padding: 0 0.5rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
}

.switch label {
  padding: 0;
}

.switch a:hover,
.switch label:hover {
  color: var(--text);
}

.switch [aria-current="page"],
.switch label:has(:checked) {
  color: var(--background);
  background: var(--accent);
}

.switch a:focus-visible,
.switch label:has(:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hidden, but still read by screen readers and, for the theme switch's radio buttons, focusable */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

a {
  color: var(--accent);
}

h1 {
  line-height: 1.2;
}

h2 {
  margin-top: 2rem;
}

/* Home page: a wordmark, and each app as a tile in the app's own theme, so it's easy to recognize */
.home {
  --dots: light-dark(#d6d6d6, #262626);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

/* The wordmark is the brand, so the header only has the switches */
.home header {
  padding-bottom: 0;
  border-bottom: none;
}

.hero {
  padding: 1.5rem 0 2.5rem;
}

.wordmark {
  margin: 0;
  font-size: clamp(3.25rem, 14vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.wordmark span {
  color: var(--muted);
}

/* A blinking cursor after the domain */
.wordmark::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 0.8em;
  margin-left: 0.06em;
  background: currentColor;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark::after {
    animation: none;
  }
}

.lede {
  max-width: 28rem;
  margin: 1.25rem 0 0;
  font-size: 1.2rem;
  color: var(--muted);
}

.label {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--divider);
  border-radius: 1.5rem;
  color: var(--text);
  background: var(--background);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app:has(.app-name a):hover,
.app:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgb(0 0 0 / 18%);
}

.app-art {
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--art, var(--divider));
}

.app-art img {
  border-radius: 50%;
}

.app-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.app-name {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
}

/* The whole tile opens the app's page */
.app-name a {
  color: inherit;
  text-decoration: none;
}

.app-name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.app-name a:focus-visible {
  outline: none;
}

.app-name a:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: inherit;
}

.app p {
  margin: 0.5rem 0;
}

.app .google-play {
  margin: 0.75rem 0;
}

/* Like the privacy link, the badge sits above the link that covers the tile */
.app .google-play a {
  position: relative;
}

.app-secondary {
  position: relative;
  font-size: 0.9rem;
}

.app-placeholder {
  display: grid;
  place-items: center;
  min-height: 6rem;
  padding: 1.5rem;
  border-style: dashed;
  color: var(--muted);
  background: transparent;
}

.updated {
  color: var(--muted);
}

/* Google's Get it on Google Play badge, as it is, with a quarter of its height of clear space around */
.google-play {
  margin: 1.5rem 0;
}

.google-play a {
  display: block;
  width: fit-content;
}

.google-play img {
  display: block;
  width: auto;
  height: 3rem;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--divider);
  color: var(--muted);
  font-size: 0.9rem;
}

.trademarks {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}
