/* The style of the written pages. The tool has its own style sheet.
   The two share the same colours, so the site feels like one place. */

:root {
  --bg: #ffffff;
  --bg-sunken: #f6f8fa;
  --bg-raised: #ffffff;
  --bg-hover: #eef1f4;
  --border: #d6dde4;
  --border-strong: #b9c3cd;
  --text: #1c2128;
  --text-dim: #5b6977;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --key: #8250df;
  --string: #0a7d4b;
  --danger: #c0392b;
  --number: #0550ae;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d1117;
    --bg-sunken: #161b22;
    --bg-raised: #161b22;
    --bg-hover: #21262d;
    --border: #2a313c;
    --border-strong: #3d4653;
    --text: #e6edf3;
    --text-dim: #9198a1;
    --accent: #4493f8;
    --key: #d2a8ff;
    --string: #7ee787;
    --danger: #ff7b72;
    --number: #79c0ff;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0d1117;
  --bg-sunken: #161b22;
  --bg-raised: #161b22;
  --bg-hover: #21262d;
  --border: #2a313c;
  --border-strong: #3d4653;
  --text: #e6edf3;
  --text-dim: #9198a1;
  --accent: #4493f8;
  --key: #d2a8ff;
  --string: #7ee787;
  --danger: #ff7b72;
  --number: #79c0ff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* --- the header --- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.site-head-in {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
}

.site-brand svg {
  width: 26px;
  height: 26px;
}

.site-nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 15px;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--text);
}

.site-cta {
  background: var(--accent);
  color: var(--accent-text) !important;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
}

/* --- the page --- */
main {
  max-width: 740px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

main.wide {
  max-width: 1040px;
}

h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 0 0 8px;
}

h2 {
  font-size: 1.35rem;
  margin: 2.2em 0 0.6em;
  padding-top: 0.3em;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  margin: 1.8em 0 0.5em;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 28px;
}

p,
li {
  overflow-wrap: break-word;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

blockquote {
  margin: 1.5em 0;
  padding: 2px 16px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.93rem;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-dim);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

/* --- the boxes --- */
.card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  text-decoration: none;
  color: inherit;
  margin-bottom: 14px;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.card h2,
.card h3 {
  margin: 0 0 4px;
  border: none;
  padding: 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.try {
  margin: 2em 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-sunken);
}

.try p {
  margin: 0 0 10px;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
}

/* --- the advertisement places --- */
.ad {
  margin: 28px auto;
  text-align: center;
  min-height: 90px;
  overflow: hidden;
}

.ad:empty {
  display: none;
}

/* --- the footer --- */
.site-foot {
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.site-foot-in {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.site-foot a {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 16px;
}

.site-foot a:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.6rem;
  }
  main {
    padding: 24px 16px 48px;
  }
}

/* --- the crumb trail on a guide --- */
.crumb-trail {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.crumb-trail a {
  color: var(--text-dim);
  text-decoration: none;
}

.crumb-trail a:hover {
  color: var(--text);
  text-decoration: underline;
}

.crumb-trail span {
  padding: 0 4px;
  color: var(--border-strong);
}

/* --- the list of parts at the top of a long guide --- */
.toc {
  margin: 0 0 2em;
  padding: 14px 18px 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.toc p {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.toc ol {
  margin: 0;
  padding-left: 1.3em;
  font-size: 0.95rem;
}

.toc li {
  margin-bottom: 3px;
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* A heading must not hide under the sticky header when you jump to it. */
main h2[id] {
  scroll-margin-top: 72px;
}

/* --- the groups on the list of guides --- */
.group {
  margin-bottom: 2.4em;
}

.group h2 {
  margin-top: 1.6em;
  margin-bottom: 0.2em;
}

.group-blurb {
  margin: 0 0 14px;
  color: var(--text-dim);
}

.group .card h3 {
  margin: 0 0 4px;
  border: none;
  padding: 0;
  font-size: 1.05rem;
  color: var(--accent);
}

.foot-org {
  opacity: 0.75;
}

.meta a {
  color: var(--text-dim);
}

.meta a:hover {
  color: var(--text);
}

/* --- the link under a sample that opens it in the tool --- */
.try-link {
  margin: -0.9em 0 1.6em;
  font-size: 0.9rem;
}

.try-link a {
  text-decoration: none;
  color: var(--accent);
}

.try-link a:hover {
  text-decoration: underline;
}

/* --- the drawings in the guides --- */
.fig {
  margin: 1.8em 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.fig svg {
  display: block;
  width: 100%;
  min-width: 440px;
  max-width: 680px;
  height: auto;
}

.fig figcaption {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.fig text {
  font-family: var(--sans);
  fill: var(--text);
}

.fig text.mono {
  font-family: var(--mono);
}

.fig text.dim {
  fill: var(--text-dim);
}

.fig .box {
  fill: var(--bg-sunken);
  stroke: var(--border);
}

.fig .box-accent {
  fill: none;
  stroke: var(--accent);
}

.fig .line {
  stroke: var(--border-strong);
  fill: none;
}

/* What the language pages add to the shared sheet. */

/* A row of links to the other languages. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1em 0 1.6em;
}

.chip {
  display: inline-block;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* The options of one language. */
.opt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0 1.6em;
  font-size: 0.94rem;
}

.opt-table th,
.opt-table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.opt-table th {
  color: var(--text-dim);
  font-weight: 600;
  border-bottom-color: var(--border-strong);
}

.opt-table code {
  font-size: 0.86em;
}

/* The one mistake that catches people, for this language. */
.warn {
  border-left: 3px solid var(--literal);
  background: var(--bg-sunken);
  padding: 10px 14px;
  margin: 1em 0 1.6em;
}

.code-cut {
  margin-top: -0.6em;
  color: var(--text-dim);
  font-size: 0.9rem;
}

@media (max-width: 620px) {
  .opt-table {
    font-size: 0.88rem;
  }

  .opt-table th:nth-child(3),
  .opt-table td:nth-child(3) {
    display: none;
  }
}
