/* Wherewith's site. Colors are tokens, redefined for dark mode; the layout,
   code, and tab styles follow Hrefine's and Chromarite's sites. */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --text: #17202b;
  --muted: #55606d;
  --border: #dbe1e8;
  --accent: #3d4fc4;
  --accent-2: #0b7a72;
  --code-bg: #f0f3f7;
  --keyword: #8a2be2;
  --string: #0f7a4a;
  --number: #b0461a;
  --comment: #5f6977;
  --type: #1d5fa8;
  /* The opening: holes, quoted names, placeholders, and what differs. */
  --hole: #b0461a;
  --hole-bg: #fdf0e6;
  --name: #3d4fc4;
  --param: #0b7a72;
  --param-bg: #e6f5f3;
  --mark-bg: #fdeaa6;
  --mark-edge: #e2b93b;
  /* What a card's dialect refuses. */
  --refused: #b42318;
  color-scheme: light dark;
}

/* Layout rules like `display: flex` would otherwise show hidden elements. */
[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171c23;
    --text: #e6ebf1;
    --muted: #a0abb8;
    --border: #2c3440;
    --accent: #9aa8ff;
    --accent-2: #5fd6c8;
    --code-bg: #1c232c;
    --keyword: #c9a0ff;
    --string: #7fd4a4;
    --number: #f0a274;
    --comment: #8b97a5;
    --type: #8cc4ff;
    --hole: #f0a274;
    --hole-bg: #3a2616;
    --name: #9aa8ff;
    --param: #5fd6c8;
    --param-bg: #12302d;
    --mark-bg: #45390f;
    --mark-edge: #8a7020;
    --refused: #ff9d8f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1rem;
}

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

code,
pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

code {
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

h1,
h2 {
  line-height: 1.2;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.9rem;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--surface);
  padding: 0.25rem 0.5rem;
}

/* The top bar. */

.top {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  /* A strip of the two accents along the top. */
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: 100% 5px;
  background-repeat: no-repeat;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.5rem;
}

.brand {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.bar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
}

/* The opening: one common query, and what each database gets. */

.opening {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0 1.75rem;
}

.slogan {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.slogan strong {
  color: var(--text);
}

.opening h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.015em;
}

.lead {
  margin: 0 0 1.25rem;
  max-width: 50rem;
  color: var(--muted);
}

.punch {
  margin: 1rem 0 0;
  font-size: clamp(1.1rem, 2.6vw, 1.35rem);
  font-weight: 650;
}

.hero-demo {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--bg);
}

.hero-demo p {
  margin: 0;
}

.label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* The common query, as written. */
.hero-demo pre.common-query {
  margin: 0.3rem 0 0.4rem;
  max-width: 44rem;
  font-size: 0.9rem;
}

.tag {
  color: var(--keyword);
  font-weight: 600;
}

/* The quote starting each line of a Temper multi-line string. */
.margin {
  color: var(--muted);
}

.hole {
  color: var(--hole);
  background: var(--hole-bg);
  border-radius: 0.2rem;
  padding: 0 0.1em;
}

.hero-demo .checked {
  max-width: 52rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* What each database's driver gets: two across, or one on a phone. */
.rendered {
  list-style: none;
  margin: 0.3rem 0 0.8rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr));
  gap: 0.7rem;
}

.target {
  min-width: 0;
  padding: 0.6rem 0.75rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.hero-demo .db {
  margin-bottom: 0.3rem;
  font-weight: 650;
}

.db .style {
  margin-left: 0.4rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}

pre.sql {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 0.4rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre.sql mark {
  color: inherit;
  background: var(--mark-bg);
  box-shadow: inset 0 -2px var(--mark-edge);
  border-radius: 0.2rem;
  padding: 0 0.1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero-demo .why {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.why code {
  color: var(--text);
}

.q-name {
  color: var(--name);
  font-weight: 650;
}

.q-str {
  color: var(--string);
}

.q-param {
  color: var(--param);
  font-weight: 700;
  background: var(--param-bg);
  border-radius: 0.2rem;
  padding: 0 0.15em;
}

.params code {
  color: var(--hole);
}

.q-param-key {
  color: var(--param);
  background: var(--param-bg);
  font-weight: 650;
  font-size: 0.9rem;
  border-radius: 0.25rem;
  padding: 0.05rem 0.4rem;
}

/* On a phone, less padding, for the SQL's width. */
@media (max-width: 40rem) {
  .hero-demo {
    padding: 0.75rem 0.6rem;
  }

  .target {
    padding: 0.5rem 0.55rem 0.6rem;
  }

  .hero-demo pre.common-query {
    font-size: 0.82rem;
  }
}

/* Sections. */

main > section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

main > section p {
  max-width: 52rem;
}

.small-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.code-label,
.output-label {
  margin: 1rem 0 0.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

/* Code tabs. */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 1.25rem 0 0.4rem;
}

.tabs button {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.3rem 0.8rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.tabs button[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.run {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

pre.source,
pre.output {
  margin: 0.4rem 0 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 0.5rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code {
  font-size: inherit;
  overflow-wrap: normal;
}

.tok-comment {
  color: var(--comment);
  font-style: italic;
}

.tok-string {
  color: var(--string);
}

.tok-number {
  color: var(--number);
}

.tok-keyword {
  color: var(--keyword);
}

.tok-type {
  color: var(--type);
}

/* The tour: one row of tabs, kept in view, for every step. */

.tour-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 0;
  padding: 0.5rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.step {
  margin-top: 1.75rem;
  /* Clear of the sticky tabs, when a link jumps here. */
  scroll-margin-top: 3.5rem;
}

.step h3 {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
}

.step .output-label {
  margin-top: 0.5rem;
}

/* Each line of a step's output on its own, wrapped with a hanging indent,
   so long refusals read whole. */
.step-output span {
  display: block;
  padding-left: 1.5em;
  text-indent: -1.5em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* One row of tabs on phones, scrolling sideways, so it covers less. */
@media (max-width: 40rem) {
  .tour-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .tour-tabs button {
    flex: none;
  }
}

.tour-run {
  scroll-margin-top: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

button.primary {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: 0.45rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
}

button.primary:hover {
  filter: brightness(1.1);
}

button.primary:disabled {
  cursor: progress;
  opacity: 0.7;
}

/* Why. */

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

.reasons li {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent-2);
  border-radius: 0.5rem;
  background: var(--surface);
}

.reasons strong {
  display: block;
  margin-bottom: 0.2rem;
}

/* Where dialects differ: a card each, with what each dialect does. */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.card {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--surface);
  font-size: 0.95rem;
}

.card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.card p {
  margin: 0 0 0.5rem;
}

.card-example {
  margin-top: 0.25rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.4rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.card .card-call {
  margin: 0 0 0.2rem;
  color: var(--muted);
}

.card-call code {
  color: var(--text);
}

.card-rows {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
}

.card-rows:last-child {
  margin-bottom: 0;
}

.card-rows li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  padding: 0.15rem 0;
  border-top: 1px solid var(--border);
}

.card-rows .who {
  color: var(--muted);
}

.card-rows .who::after {
  content: ":";
}

.card-rows .gives code {
  color: var(--param);
  font-weight: 600;
}

.refused {
  color: var(--refused);
  font-weight: 650;
}

/* The dialect table. */

.table-scroll {
  overflow-x: auto;
  container-type: inline-size;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.dialects .server {
  background: var(--code-bg);
}

.dialects .server th {
  padding-left: 0.4rem;
}

/* Narrow: each language a block, with each database's label beside its
   cell, by the width the table has, not the screen's. */
@container (max-width: 40rem) {
  .dialects thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .dialects tr,
  .dialects th,
  .dialects td {
    display: block;
  }

  .dialects tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
  }

  .dialects .server {
    padding: 0.5rem 0.4rem;
  }

  .dialects th,
  .dialects td {
    border: none;
    padding: 0.1rem 0;
  }

  .dialects td {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 0.5rem;
  }

  .dialects td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.85rem;
  }
}

footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
