/* The website's one stylesheet (ADR-0048): system fonts, light and dark
   from the system's choice, and nothing loaded from another host. */

:root {
  --bg: #fbfaf7;
  --bg-raised: #ffffff;
  --text: #1d1f23;
  --muted: #5a5f69;
  --line: #e2e0da;
  --accent: #b33a2b;
  --accent-text: #ffffff;
  --ready: #1f7a3d;
  --in-progress: #8a5a00;
  --planned: #4b5563;
  --code-inline: #7a2a63;
  --code-inline-bg: #f1eee6;
  --code-keyword: #8b2c9f;
  --code-type: #0a6b75;
  --code-function: #6b5c00;
  --code-string: #9a4a10;
  --code-number: #1f5fbf;
  --code-comment: #4f6f52;
  --code-deleted: #b3261e;
  --code-inserted: #1a7a37;
  --radius: 10px;
  --wrap: 68rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --bg-raised: #1d2026;
    --text: #e8e6e1;
    --muted: #a3a8b2;
    --line: #2f333b;
    --accent: #f07a62;
    --accent-text: #15171b;
    --ready: #6fd394;
    --in-progress: #f0c060;
    --planned: #aeb6c2;
    --code-inline: #e9b8dc;
    --code-inline-bg: #2a2e36;
    --code-keyword: #c792ea;
    --code-type: #5fd0c0;
    --code-function: #dcdca0;
    --code-string: #e0a070;
    --code-number: #8fc4f0;
    --code-comment: #8fb08a;
    --code-deleted: #ff8a80;
    --code-inserted: #7ee29a;
  }
}

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Code blocks: the classes Zola writes (`highlight_theme = "css"`), by the
   tokens above. Punctuation and operators keep the text's color. */

.z-keyword,
.z-storage {
  color: var(--code-keyword);
}

.z-keyword.z-operator {
  color: inherit;
}

.z-support.z-type,
.z-entity.z-name {
  color: var(--code-type);
}

.z-support.z-function,
.z-entity.z-name.z-function,
.z-variable.z-function,
.z-entity.z-name.z-tag {
  color: var(--code-function);
}

.z-string {
  color: var(--code-string);
}

.z-constant {
  color: var(--code-number);
}

.z-comment {
  color: var(--code-comment);
}

.z-markup.z-deleted {
  color: var(--code-deleted);
}

.z-markup.z-inserted {
  color: var(--code-inserted);
}

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

a:hover {
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1rem;
}

/* The header: the wordmark and the menu. */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.wordmark {
  color: var(--text);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

main {
  flex: 1 0 auto;
  width: 100%;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

/* The home page. */

.hero {
  padding: 2rem 0 1.5rem;
  max-width: 44rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  margin: 0 0 1rem;
}

.hero p:first-of-type {
  font-size: 1.25rem;
}

.hero p {
  color: var(--muted);
}

.hero p:first-of-type,
.hero p strong {
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.status-key {
  color: var(--muted);
  font-size: 0.95rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card h2,
.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

.card p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.card .card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: auto 0 0;
  font-size: 0.95rem;
}

.status {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-ready {
  color: var(--ready);
}

.status-in-progress {
  color: var(--in-progress);
}

.status-planned {
  color: var(--planned);
}

.strip {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* Pages and posts. */

.prose {
  max-width: 44rem;
}

.prose h1 {
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  margin-top: 0;
}

/* Inline code: its own color and background, wrapping on a narrow screen. */
.prose :not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--code-inline-bg);
  color: var(--code-inline);
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* In a link it stays the link's color. */
.prose a > code {
  color: inherit;
}

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

.post-list {
  padding: 0;
  list-style: none;
}

.post-list li {
  margin-bottom: 1rem;
}

.post-list time {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: 0.4rem;
}

.post-list p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

/* Tables in a page scroll on their own on a narrow screen, never the page. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

/* The book: its contents, and each page's way to the next. */

.contents li {
  margin-bottom: 0.4rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 44rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* The footer. */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.footer-grid p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The tutorial's pictures of the game (the `try_it` shortcode). */

.prose figure {
  margin: 1rem 0;
}

.prose figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* A picture is drawn at twice the size it shows, so its text stays sharp. */
.prose figure.try-one img {
  max-width: min(100%, 24rem);
}

.prose figcaption {
  margin-top: 0.25rem;
  font-size: 0.9em;
  color: var(--muted);
}

.try-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.try-pair figure {
  margin: 0;
}

@media (max-width: 600px) {
  .try-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

.contents li.unnumbered {
  list-style: none;
}
