/* User guide of the Gaia DR4 variable-star app (guide/index.html). Served under the app's strict
   Content-Security-Policy: this file is the page's only style (no inline styles), system fonts only. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --text: #1d2230;
  --muted: #545b6b;
  --line: #dcd8cd;
  --accent: #8a5a00;
  --accent-soft: #f6ead0;
  --link: #1f5fae;
  --link-visited: #6a3fa0;
  --kbd-bg: #ffffff;
  --kbd-line: #b9b4a6;
  --note-bg: #eef4fb;
  --note-line: #9fbbe0;
  --warn-bg: #fdf3e3;
  --warn-line: #e3b866;
  --code-bg: #efece4;
  --shadow: 0 1px 2px rgba(20, 24, 36, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --surface: #121827;
    --surface-2: #19203a;
    --text: #e6eaf3;
    --muted: #a4adc2;
    --line: #2b3450;
    --accent: #f0c27a;
    --accent-soft: #2a2414;
    --link: #8fb8ff;
    --link-visited: #c3a6ff;
    --kbd-bg: #1d2440;
    --kbd-line: #46507a;
    --note-bg: #122036;
    --note-line: #35588c;
    --warn-bg: #2a2010;
    --warn-line: #8a6a2a;
    --code-bg: #1b2238;
    --shadow: none;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* ---------------------------------------------------------------- layout */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-inner {
  max-width: 54rem;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand small {
  font-weight: 400;
  color: var(--muted);
}

.back {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.back:hover,
.back:focus-visible {
  border-color: var(--accent);
}

main {
  max-width: 54rem;
  margin: 0 auto;
  padding: 8px 16px 64px;
}

header.intro {
  padding: 24px 0 8px;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 12px;
}

h1 .accent {
  color: var(--accent);
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 12px;
}

h2 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 56px 0 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

h3 {
  font-size: 1.22rem;
  line-height: 1.3;
  margin: 32px 0 8px;
}

h4 {
  font-size: 1.05rem;
  margin: 22px 0 6px;
}

h2,
h3,
h4 {
  scroll-margin-top: 16px;
}

h2 .num {
  color: var(--accent);
  margin-right: 0.35em;
}

p,
ul,
ol,
dl {
  margin: 0 0 14px;
}

ul,
ol {
  padding-left: 1.4em;
}

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

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:visited {
  color: var(--link-visited);
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

strong {
  font-weight: 650;
}

/* long tokens (URLs, option strings) never widen the page; in tables a word breaks only when it cannot fit (the
   columns size to their longest words) */
p,
li,
dd,
figcaption {
  overflow-wrap: anywhere;
}

td,
th {
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- table of contents */

nav.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px 6px;
  margin: 16px 0 8px;
  box-shadow: var(--shadow);
}

nav.toc h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

nav.toc ol {
  margin: 0 0 8px;
  padding-left: 1.6em;
}

nav.toc ol ol {
  margin: 4px 0 6px;
  padding-left: 1.2em;
  list-style: lower-alpha;
  font-size: 0.95em;
}

nav.toc li + li {
  margin-top: 2px;
}

@media (min-width: 760px) {
  nav.toc > ol {
    columns: 2;
    column-gap: 32px;
  }

  nav.toc > ol > li {
    break-inside: avoid;
  }
}

/* ---------------------------------------------------------------- tables, keys, code */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.45;
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 650;
  padding: 10px 12px 4px;
}

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

thead th {
  background: var(--surface-2);
  font-weight: 650;
  border-top: 0;
}

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

td.keys,
th.keys {
  white-space: nowrap;
}

/* the key tables share one key column width */
th.keys {
  width: 30%;
}

/* option strings break only where the page allows (<wbr> after "="), not inside a word */
td code {
  overflow-wrap: normal;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  font-family: var(--mono);
  font-size: 0.85em;
  line-height: 1.6;
  text-align: center;
  color: var(--text);
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  white-space: nowrap;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

.ui {
  font-weight: 600;
  white-space: normal;
}

/* ---------------------------------------------------------------- notes, figures, definition lists */

.note,
.tip,
.warn {
  border-left: 4px solid var(--note-line);
  background: var(--note-bg);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 16px;
}

.tip {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.warn {
  border-left-color: var(--warn-line);
  background: var(--warn-bg);
}

.note > :last-child,
.tip > :last-child,
.warn > :last-child {
  margin-bottom: 0;
}

.label {
  font-weight: 700;
  margin-right: 0.3em;
}

figure {
  margin: 18px 0 24px;
}

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

figcaption {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 8px;
}

/* a tall picture (the VR Expert menu): narrower than the column */
figure.narrow img {
  max-width: min(100%, 380px);
}

dl.terms dt {
  font-weight: 650;
  margin-top: 10px;
}

dl.terms dd {
  margin: 2px 0 0;
  padding-left: 1.2em;
}

.stage-list {
  list-style: none;
  padding: 0;
  counter-reset: none;
}

.stage-list > li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 10px;
}

.stage-list .stage-key {
  display: inline-block;
  min-width: 1.6em;
  margin-right: 0.4em;
  font-weight: 700;
  color: var(--accent);
}

.diagram {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  margin: 8px 0 4px;
  color: var(--text);
}

.diagram .box {
  fill: var(--surface);
  stroke: var(--line);
}

.diagram .box-hi {
  fill: var(--accent-soft);
  stroke: var(--accent);
}

.diagram .t {
  fill: var(--text);
  font-family: var(--font);
  font-size: 13px;
}

.diagram .t-small {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 11px;
}

.diagram .arrow {
  stroke: var(--muted);
  fill: none;
}

.diagram .arrow-head {
  fill: var(--muted);
}

.top-link {
  font-size: 0.9rem;
  margin: 18px 0 0;
}

footer {
  max-width: 54rem;
  margin: 0 auto;
  padding: 18px 16px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  h2 {
    font-size: 1.4rem;
    margin-top: 44px;
  }

  th,
  td {
    padding: 7px 9px;
  }

  tbody th {
    white-space: normal;
  }
}

/* ---------------------------------------------------------------- print */

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f1f1;
    --text: #000000;
    --muted: #333333;
    --line: #bbbbbb;
    --accent: #6b4500;
    --accent-soft: #ffffff;
    --link: #000000;
    --link-visited: #000000;
    --kbd-bg: #ffffff;
    --kbd-line: #888888;
    --note-bg: #ffffff;
    --warn-bg: #ffffff;
    --code-bg: #f1f1f1;
    --shadow: none;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .topbar,
  .skip,
  .top-link {
    display: none;
  }

  main,
  footer {
    max-width: none;
    padding: 0;
  }

  nav.toc {
    break-after: page;
  }

  nav.toc h2 {
    break-before: auto;
  }

  nav.toc > ol {
    columns: 2;
    column-gap: 24px;
  }

  nav.toc > ol > li {
    break-inside: avoid;
  }

  h2 {
    break-before: page;
    margin-top: 0;
  }

  h2,
  h3,
  h4 {
    break-after: avoid;
  }

  figure,
  .table-wrap,
  tr,
  .stage-list > li,
  .note,
  .tip,
  .warn {
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }

  figure img {
    max-height: 9cm;
    width: auto;
    border: 0;
  }

  /* the targets of external links (internal anchors stay as they are) */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    overflow-wrap: anywhere;
  }
}
