/* Sky Quality Meter Workbench - User Guide.
   One stylesheet for every page. Opened straight from disk by the browser, so nothing here
   loads from the network. Sized generously on purpose: readable text is the point. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --side: #f3f5f8;
  --fg: #16202b;
  --muted: #55606c;
  --line: #d8dee5;
  --accent: #2a5d9f;
  --accent-soft: #e6eef8;
  --code: #eef1f4;
  --note: #eaf2fc;
  --note-edge: #2a78d6;
  --warn: #fdf0ea;
  --warn-edge: #c8582f;

  /* The Bortle class colours, exactly as the application draws them (AppTheme.Light.BandRamp),
     with the text colour it picks for each. A test keeps these in step with the code. */
  --band-1: #3b3f45; --band-1-ink: #ffffff;
  --band-2: #8a9096; --band-2-ink: #101010;
  --band-3: #9db8ea; --band-3-ink: #101010;
  --band-4: #a6d8ae; --band-4-ink: #101010;
  --band-5: #c8e391; --band-5-ink: #101010;
  --band-6: #f6e6a2; --band-6-ink: #101010;
  --band-7: #f8c697; --band-7-ink: #101010;
  --band-8: #f1a79f; --band-8-ink: #101010;
  --band-9: #f3eeea; --band-9-ink: #101010;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141e;
    --side: #131c27;
    --fg: #e6ebf1;
    --muted: #a2afbc;
    --line: #2a3542;
    --accent: #86b6ee;
    --accent-soft: #1b2a3c;
    --code: #18222e;
    --note: #142336;
    --note-edge: #4f95e6;
    --warn: #2a1c16;
    --warn-edge: #e07a52;

    /* AppTheme.Dark.BandRamp. */
    --band-1: #2b3038; --band-1-ink: #ffffff;
    --band-2: #4b535d; --band-2-ink: #ffffff;
    --band-3: #3f5f99; --band-3-ink: #ffffff;
    --band-4: #3f7a55; --band-4-ink: #ffffff;
    --band-5: #6c8640; --band-5-ink: #101010;
    --band-6: #958741; --band-6-ink: #101010;
    --band-7: #9c6a40; --band-7-ink: #ffffff;
    --band-8: #954e48; --band-8-ink: #ffffff;
    --band-9: #b4aea9; --band-9-ink: #101010;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

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

/* ---- Top bar --------------------------------------------------------------------------------- */

.topbar {
  border-bottom: 1px solid var(--line);
  padding: 14px max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  gap: 8px 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.topbar .product { font-weight: 700; color: var(--fg); text-decoration: none; }
.topbar .section { color: var(--muted); }
.topbar .site { margin-left: auto; color: var(--accent); text-decoration: none; }
.topbar .site:hover { text-decoration: underline; }

/* ---- Layout: contents down the side, the page beside it -------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

nav.contents {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
}
nav.contents h2 {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 8px 10px;
  border: 0;
  padding: 0;
}
nav.contents ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
nav.contents a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
  font-size: 16px;
}
nav.contents a:hover { background: var(--accent-soft); }
nav.contents a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

main {
  padding: 28px max(24px, env(safe-area-inset-right, 0px)) 64px 40px;
  max-width: 50rem;
}

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.contents { border-right: 0; border-bottom: 1px solid var(--line); }
  nav.contents ol { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  main { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
}

/* ---- Type ------------------------------------------------------------------------------------- */

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 .4rem; text-wrap: balance; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); text-wrap: balance; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
.lede { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
p, li { max-width: 68ch; }
.menu { font-weight: 600; }

code {
  background: var(--code);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: .9em;
}

/* ---- Tables ----------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--side); }
tbody th { width: 28%; }

/* ---- Bortle class swatches ------------------------------------------------------------------- */

td.band { font-weight: 700; text-align: center; width: 4.5rem; }
td.band-1 { background: var(--band-1); color: var(--band-1-ink); }
td.band-2 { background: var(--band-2); color: var(--band-2-ink); }
td.band-3 { background: var(--band-3); color: var(--band-3-ink); }
td.band-4 { background: var(--band-4); color: var(--band-4-ink); }
td.band-5 { background: var(--band-5); color: var(--band-5-ink); }
td.band-6 { background: var(--band-6); color: var(--band-6-ink); }
td.band-7 { background: var(--band-7); color: var(--band-7-ink); }
td.band-8 { background: var(--band-8); color: var(--band-8-ink); }
td.band-9 { background: var(--band-9); color: var(--band-9-ink); }

/* ---- Call-outs -------------------------------------------------------------------------------- */

.note, .warn { border-left: 4px solid; padding: .8rem 1rem; margin: 1.2rem 0; border-radius: 0 6px 6px 0; }
.note { background: var(--note); border-color: var(--note-edge); }
.warn { background: var(--warn); border-color: var(--warn-edge); }
.note > :first-child, .warn > :first-child { margin-top: 0; }
.note > :last-child, .warn > :last-child { margin-bottom: 0; }

/* ---- Screenshots ----------------------------------------------------------------------------- */

figure { margin: 1.4rem 0; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
figcaption { color: var(--muted); font-size: .92rem; margin-top: .45rem; max-width: 68ch; }

/* ---- Steps ------------------------------------------------------------------------------------ */

ol.steps { padding-left: 1.4rem; display: grid; gap: .6rem; }

/* ---- Home page cards -------------------------------------------------------------------------- */

.cards { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cards a {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
}
.cards a:hover { border-color: var(--accent); background: var(--accent-soft); }
.cards b { color: var(--accent); font-size: 1.05rem; }
.cards span { color: var(--muted); font-size: .95rem; line-height: 1.45; }
.start { font-size: 1.05rem; }

/* ---- Previous / next -------------------------------------------------------------------------- */

.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; display: grid; }
.pager small { color: var(--muted); font-size: .85rem; }
.pager .next { text-align: right; margin-left: auto; }

footer { color: var(--muted); font-size: .9rem; margin-top: 2.5rem; }
