/* Black, white and grey, like the apps, in light and dark. */
:root {
  color-scheme: light dark;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --line: #d2d2d7;
  --fill: #f2f2f7;
  --background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --line: #3a3a3c;
    --fill: #1c1c1e;
    --background: #000000;
  }
}

* {
  box-sizing: border-box;
}

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

/* Thai needs room above and below each line for its vowels and tone marks. */
body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 0 16px 48px;
  font: 17px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "Sukhumvit Set", Thonburi, "Noto Sans Thai", "Leelawadee UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--background);
  overflow-wrap: break-word;
}

header {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

header a {
  color: inherit;
  text-decoration: none;
}

h1 {
  margin: 32px 0 8px;
  font-size: 2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h2 {
  margin: 32px 0 8px;
  font-size: 1.3rem;
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

em {
  color: var(--secondary);
}

/* Thai has no italics; the grey sets it apart. */
[lang="th"] em {
  font-style: normal;
}

li + li {
  margin-top: 6px;
}

dt {
  margin-top: 16px;
  font-weight: 600;
}

dd {
  margin: 2px 0 0;
}

hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: 0.9rem;
}

/* An app's icon, rounded like on the Home Screen. The hairline keeps the dark icon apart from a black page. */
.app-icon {
  display: block;
  flex: none;
  width: 88px;
}

.app-icon img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px var(--line);
}

/* The home page lists the apps like a store. */
.apps {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.app {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.app + .app {
  margin-top: 0;
}

.app h2 {
  margin: 0;
  line-height: 1.3;
}

.app h2 a {
  text-decoration: none;
}

.app p {
  margin: 4px 0 0;
}

.subtitle {
  color: var(--secondary);
}

.badge {
  display: inline-block;
  margin-top: 12px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

/* Each half of an app's page opens with its icon beside the title. */
.app-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 32px 0 20px;
}

.app-head .app-icon {
  width: 72px;
}

.app-head h1 {
  margin: 0;
  font-size: 1.6rem;
}

.app-head h1 span {
  display: block;
  color: var(--secondary);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0;
}

.app-head p {
  margin: 4px 0 0;
  font-size: 0.95rem;
}
