/* The front page's look, see DESIGN.md. The same family as the console (~/Projects/vtt/website/style.css):
   every colour comes from the variables below, which theme.js sets from the visitor's theme.
   These defaults are Serika Dark. */
:root {
  --bg: #323437;
  --main: #e2b714;
  --subAlt: #2c2e31;
  --text: #d1d0c5;
  --error: #ca4754;
  --ok: #6cc48a;
  --onMain: #323437;
  --mutedMix: 72%;
  --muted: color-mix(in srgb, var(--text) var(--mutedMix), var(--bg));
  --line: color-mix(in srgb, var(--text) 15%, var(--bg));
  --field-line: color-mix(in srgb, var(--text) 30%, var(--bg));
  --hover: color-mix(in srgb, var(--text) 7%, transparent);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --top: 48px;
  --page: 1080px;
  --gutter: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
p,
ol,
ul,
pre {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--main);
  text-underline-offset: 2px;
}

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

code,
pre {
  font-family: var(--mono);
  font-size: 13px;
}

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

.help {
  color: var(--muted);
  font-size: 13px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The top bar */
#top {
  position: relative;
  z-index: 10;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 var(--gutter);
  background: var(--subAlt);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

#brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.logo {
  width: 40px;
  height: 18px;
  flex: none;
}

#nav {
  display: flex;
  gap: 4px;
}

#nav a,
#small-menu nav a {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  text-decoration: none;
}

#nav a:hover,
#small-menu nav a:hover {
  background: var(--hover);
}

#nav a[aria-current],
#small-menu nav a[aria-current] {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--main);
  text-decoration-thickness: 2px;
}

.top-button {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.top-button:hover,
.top-button[aria-expanded="true"],
#small-menu[open] > summary {
  background: var(--hover);
}

/* Small squares showing a theme's colours */
.swatches {
  display: inline-flex;
}

.swatches span {
  width: 12px;
  height: 12px;
  margin-left: -1px;
  border: 1px solid var(--line);
}

/* The theme menu */
.menu {
  position: absolute;
  top: 44px;
  right: 12px;
  min-width: 220px;
  max-height: calc(100vh - 60px);
  overflow: auto;
  padding: 4px 0;
  background: var(--subAlt);
  border: 1px solid var(--line);
}

.menu h3 {
  padding: 8px 12px 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu button {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 12px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menu button:hover {
  background: var(--hover);
}

.menu button[aria-checked="true"] {
  font-weight: 600;
}

.menu button[aria-checked="true"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--main);
}

/* The phone menu, only on narrow screens */
#small-menu {
  display: none;
}

#small-menu > summary {
  list-style: none;
}

#small-menu > summary::-webkit-details-marker {
  display: none;
}

#small-menu nav {
  position: absolute;
  top: 44px;
  right: 12px;
  min-width: 180px;
  padding: 4px 0;
  background: var(--subAlt);
  border: 1px solid var(--line);
}

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }

  /* The logo is VTT, so on phones it stands alone */
  #brand .long,
  #nav,
  #theme-name {
    display: none;
  }

  .logo {
    width: 44px;
    height: 20px;
  }

  #small-menu {
    display: block;
  }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  background: none;
  border: 1px solid var(--field-line);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button:hover {
  background: var(--hover);
}

.button.primary {
  background: var(--main);
  border-color: var(--main);
  color: var(--onMain);
}

.button.primary:hover {
  background: color-mix(in srgb, var(--main) 86%, var(--onMain));
}

/* The page */
main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-child {
  border-bottom: 0;
}

.opening {
  padding: 64px 0 48px;
}

h1 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
  font-weight: 600;
}

.lead {
  max-width: 640px;
  margin-top: 10px;
  color: var(--muted);
}

.opening .lead {
  font-size: 17px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.section > .table-scroll,
.section > .plans,
.section > .steps {
  margin-top: 20px;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

thead th {
  padding: 9px 14px;
  background: var(--subAlt);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

td,
tbody th {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:first-child td,
tbody tr:first-child th {
  border-top: 0;
}

tbody th {
  white-space: nowrap;
}

tr.us th,
tr.us td {
  font-weight: 700;
}

table.rows tbody th {
  width: 1%;
}

/* How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding: 14px;
  border: 1px solid var(--line);
}

.steps h3::before {
  content: counter(step) ". ";
}

.steps p {
  margin-top: 4px;
  color: var(--muted);
}

.section > .help {
  margin-top: 20px;
}

/* Code and config. Long lines wrap rather than scroll, so nothing needs scrolling sideways on a phone */
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre.code {
  margin-top: 6px;
  padding: 10px 14px;
  background: var(--subAlt);
  border: 1px solid var(--line);
}

/* Plans, one panel each, side by side for comparing. None is highlighted */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

/* Holds the space while loading so the page doesn't jump when they arrive */
.plans.loading {
  display: flex;
  align-items: center;
  min-height: 280px;
  padding: 14px;
  border: 1px solid var(--line);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
}

.panel > h3 {
  padding: 8px 14px;
  background: var(--subAlt);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.plan {
  display: flex;
  flex-direction: column;
}

.plan .panel-body {
  flex: 1;
  padding: 14px;
  white-space: pre-line;
}

.plan table {
  flex: none;
}

.plan tbody tr:first-child th,
.plan tbody tr:first-child td {
  border-top: 1px solid var(--line);
}

.plan tbody th {
  width: 1%;
  color: var(--muted);
  font-weight: 400;
}

.plan-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 52px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

/* Pages written in Markdown */
.prose > * + * {
  margin-top: 14px;
}

.prose > h2 {
  margin-top: 32px;
}

/* Keep lines short enough to read */
.prose > p,
.prose > ul,
.prose > ol {
  max-width: 640px;
}

.prose > .lead {
  margin-top: 10px;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li + li {
  margin-top: 4px;
}

.prose table {
  max-width: 760px;
  border: 1px solid var(--line);
}

.prose > table {
  margin-top: 24px;
}

.link-list {
  list-style: none;
  padding-left: 0 !important;
}

/* The footer */
#footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 16px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

#footer nav {
  display: flex;
  gap: 16px;
}

.prose code {
  padding: 0 4px;
  background: var(--subAlt);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.prose pre {
  padding: 10px 14px;
  background: var(--subAlt);
  border: 1px solid var(--line);
}

.prose pre code {
  padding: 0;
  background: none;
  border: 0;
}

.prose td,
.prose th {
  white-space: normal;
}

.prose h2 + p,
.prose h2 + ul,
.prose h2 + ol {
  margin-top: 10px;
}

/* Something that needs noticing, with a bar down its left side as in the console */
.notice {
  padding: 10px 14px;
  background: var(--subAlt);
  border-left: 3px solid var(--main);
}

/* An address in a table stays on one line, so it never breaks mid-address */
.prose td code {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .prose td,
  .prose th {
    padding: 8px;
  }
}
