/* DB Olympics: the design shared by every page. Page-specific rules stay in each page. */

/* Source Serif 4 (SIL Open Font License, fonts/OFL.txt), self-hosted: variable in weight and optical size */
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("fonts/source-serif-4.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("fonts/source-serif-4-italic.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #ffffff;
  --code-bg: #f7f7f5;
  --c-kw: #1d4f91; --c-str: #8a4a12; --c-num: #6a3d9a; --c-com: #8b887f;
  --ink: #1b1b1a;
  --ink-2: #4f4d48;
  --muted: #8b887f;
  --rule: #e6e4de;
  --rule-strong: #c9c5b9;
  --accent: #1d4f91;
  --accent-wash: rgba(29, 79, 145, 0.07);
  --s1: #dfe9f7; --s2: #b7d0ef; --s3: #84ade0; --s4: #4f86cc; --s5: #2a63ad; --s6: #154381;
  --wrong: #c8372f;
  --timeout: #e3a21a;
  --error: #8d8a83;
  --none: transparent;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #151514; --ink: #ecebe5; --ink-2: #bdbab1; --muted: #85827a;
    --rule: #2c2b29; --rule-strong: #45433f; --accent: #8db4ec; --accent-wash: rgba(141, 180, 236, 0.08);
    --s1: #1d2c42; --s2: #234472; --s3: #2e5f9e; --s4: #4a82cc; --s5: #7eaae6; --s6: #c3d8f6;
    --wrong: #e5675f; --timeout: #e9b23e; --error: #a8a59d;
    --code-bg: #1d1d1c; --c-kw: #8db4ec; --c-str: #e0a46c; --c-num: #c3a6ef; --c-com: #85827a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151514; --ink: #ecebe5; --ink-2: #bdbab1; --muted: #85827a;
  --rule: #2c2b29; --rule-strong: #45433f; --accent: #8db4ec; --accent-wash: rgba(141, 180, 236, 0.08);
  --s1: #1d2c42; --s2: #234472; --s3: #2e5f9e; --s4: #4a82cc; --s5: #7eaae6; --s6: #c3d8f6;
  --wrong: #e5675f; --timeout: #e9b23e; --error: #a8a59d;
  --code-bg: #1d1d1c; --c-kw: #8db4ec; --c-str: #e0a46c; --c-num: #c3a6ef; --c-com: #85827a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  overflow-x: clip;  /* the magnifier may reach past the page edge without making the page scroll */
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--serif); font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
}
.page { max-width: 1000px; margin: 0 auto; padding: 28px 24px 96px; }
.measure { max-width: 640px; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.sc { font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
.num { font-variant-numeric: lining-nums tabular-nums; }

/* Header */
.title { display: flex; align-items: center; gap: 20px; margin: 0 0 18px; }
.title .logo { color: var(--ink); flex: none; }
h1 { font-weight: 600; font-size: 56px; line-height: 1; letter-spacing: -0.02em; margin: 0; }
.tagline { font-size: 25px; line-height: 1.3; margin: 0 0 8px; max-width: 760px; }
.abstract { color: var(--ink-2); margin: 0; }

/* Sections */
section { margin-top: 64px; }
h2 { font-weight: 600; font-size: 23px; margin: 0 0 8px; }
h2 .n { color: var(--muted); font-weight: 400; margin-right: 0.7em; }
figure { margin: 0; }
figcaption { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin-top: 14px; max-width: 640px; }
figcaption b { font-weight: 600; color: var(--ink); font-variant-caps: all-small-caps; letter-spacing: 0.06em; }

/* Hover notes: the detail of a short sentence, on hover, focus or tap */
.hn { text-decoration-line: underline; text-decoration-style: dashed; text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: help; }
.hn:hover, .hn:focus { text-decoration-color: var(--muted); outline: none; }

/* Tooltip */
.tip {
  position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; max-width: min(300px, calc(100vw - 16px)); will-change: transform;
  background: var(--paper); border: 1px solid var(--rule-strong); padding: 8px 11px 9px;
  font-size: 13.5px; line-height: 1.4; box-shadow: 0 2px 10px rgba(0,0,0,0.06); display: none;
}
.tip .t { font-weight: 600; }
.tip .m { color: var(--muted); }

/* Code */
pre.sql {
  grid-column: 1 / -1; min-width: 0; margin: 0; padding: 14px 16px; background: var(--code-bg); border-radius: 3px;
  font: 12.5px/1.6 var(--mono); color: var(--ink); white-space: pre; overflow: auto; max-height: 340px; tab-size: 2;
}
pre.sql .kw { color: var(--c-kw); }
pre.sql .str { color: var(--c-str); }
pre.sql .num { color: var(--c-num); }
pre.sql .com { color: var(--c-com); font-style: italic; }
pre.sql .fn { color: var(--ink); font-weight: 600; }


/* Footer */
footer { margin-top: 80px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Inner pages: a small wordmark back to the start page */
.crumb { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-2); text-decoration: none; margin: 0 0 40px; }
/* the line at the top of every page: the way home on the left (not on the start page), the pages on the right */
/* as high as the logo on every page, so that the menu sits in the same place on the start page, without the logo */
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 40px; min-height: 26px; }
.topbar.home { justify-content: flex-end; margin-bottom: 8px; }
.topbar .crumb { margin: 0; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.topnav .here { color: var(--ink-2); }
.topnav .theme { font: inherit; background: none; border: 0; padding: 0 2px; color: var(--muted); cursor: pointer; display: inline-flex; align-self: center; }
.topnav .theme:hover { color: var(--ink-2); }
.topnav .github { display: inline-flex; align-self: center; padding: 0 2px; }
.topnav .github:hover { color: var(--ink-2); text-decoration: none; }
@media (max-width: 640px) { .topnav { gap: 4px 12px; flex-wrap: nowrap; white-space: nowrap; } }  /* the pages and the theme button on one line on a phone */
.crumb .logo { color: var(--ink); }
.crumb b { font-weight: 600; color: var(--ink); }
.crumb:hover b { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }

/* the criteria for dialect differences: a gap between the cases, their branches close to them */
.criteria > li + li { margin-top: 0.8em; }
.criteria ul { margin: 0.25em 0 0; }
.criteria ul li + li { margin-top: 0.2em; }
