/* ==========================================================================
   The one header of every page: the landing page, the dashboard and the API
   docs read this stylesheet (assets/site-header.js writes the markup).
   Colours are the live tokens of src/dashboard/src/theme/tokens.css in both
   looks. Inter sets the words a person reads; JetBrains Mono sets the
   logotype and the four keys. Every property the row's boxes depend on is
   set here, so each page's own styles leave the row the same.
   ========================================================================== */

:root {
  --sh-ground: #0a0806;
  --sh-panel: #14110e;
  --sh-ink: #f5f0e4;
  --sh-quiet: #d8ccb0;
  --sh-edge: #a89878;
  --sh-rule: color-mix(in srgb, #a89878 40%, #0a0806);
  --sh-accent: #e8b44a;
  --sh-mark-line: #f5f0e4;
  --sh-mark-amber: #e8b44a;
  --sh-mark-rust: #e06530;
  --sh-mark-teal: #4ca8a8;
  --sh-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --sh-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --sh-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}
html.light {
  --sh-ground: #f0e6d2;
  --sh-panel: #f3eada;
  --sh-ink: #1a1208;
  --sh-quiet: #4a3e2c;
  --sh-edge: #6a5c44;
  --sh-rule: color-mix(in srgb, #6a5c44 40%, #f0e6d2);
  --sh-accent: #6b4700;
  --sh-mark-line: #8a7e6c;
  --sh-mark-amber: #6b4700;
  --sh-mark-rust: #8e2c0c;
  --sh-mark-teal: #186060;
  --sh-shadow: 0 12px 32px rgba(60, 40, 10, 0.2);
}

/* The skip link: hidden at rest, shown on focus at the top left. */
.sh-skip {
  position: absolute;
  left: 8px;
  top: -200px;
  z-index: 1000;
  box-sizing: border-box;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  background: var(--sh-ground);
  color: var(--sh-ink);
  border: 1px solid var(--sh-edge);
  font: 400 15px/1.4 var(--sh-sans);
  text-decoration: none;
}
.sh-skip:focus { top: 6px; }
.sh-skip:focus-visible { outline: 2px solid var(--sh-accent); outline-offset: 2px; }

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

.sh-bar {
  position: sticky;
  top: 0;
  z-index: var(--sh-z, 300);
  display: block;
  margin: 0;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--sh-ground);
  color: var(--sh-ink);
  border: 0;
  border-bottom: 1px solid var(--sh-rule);
  font: 400 15px/1.4 var(--sh-sans);
  letter-spacing: normal;
  text-align: left;
}

.sh-row {
  --sh-pad: 16px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: calc(1200px + 2 * var(--sh-pad));
  height: 55px;
  margin: 0 auto;
  padding: 0 var(--sh-pad);
}
@media (min-width: 600px) { .sh-row { --sh-pad: 24px; } }

.sh-row > * { flex-shrink: 0; }
.sh-row :focus-visible,
.sh-menu :focus-visible {
  outline: 2px solid var(--sh-accent);
  outline-offset: 2px;
}
.sh-row :focus:not(:focus-visible),
.sh-menu :focus:not(:focus-visible) { outline: none; }

.sh-bar a,
.sh-bar button {
  margin: 0;
  font-family: var(--sh-sans);
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sh-bar button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

/* The mark and the logotype: one link home. */
.sh-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: var(--sh-ink);
}
.sh-mark { display: block; width: 28px; height: 28px; flex-shrink: 0; overflow: visible; }
.sh-wordmark {
  display: none;
  font: 600 18px/1 var(--sh-mono);
  letter-spacing: 0.08em;
  color: var(--sh-ink);
  white-space: nowrap;
}
.sh-cosm { color: var(--sh-accent); }
.sh-home:hover .sh-wordmark { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (min-width: 600px) { .sh-wordmark { display: inline; } }

.sh-spoke { stroke: var(--sh-mark-line); stroke-width: 1.6; opacity: 0.5; }
.sh-cross { stroke: var(--sh-mark-line); stroke-width: 1.1; opacity: 0.18; }
.sh-glow { fill: var(--sh-mark-amber); opacity: 0.08; }
.sh-hub { fill: var(--sh-mark-amber); }
.sh-dot-amber { fill: var(--sh-mark-amber); }
.sh-dot-rust { fill: var(--sh-mark-rust); }
.sh-dot-teal { fill: var(--sh-mark-teal); }

/* The mark breathes for under 5 seconds after load and while it is pointed at or focused. */
@keyframes sh-hub-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes sh-spoke-breathe { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.3; } }
@keyframes sh-glow-breathe { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.2; } }
.sh-bar[data-breathe] .sh-hub { animation: sh-hub-breathe 2.2s ease-in-out 2; }
.sh-bar[data-breathe] .sh-spoke { animation: sh-spoke-breathe 2.2s ease-in-out 2; }
.sh-bar[data-breathe] .sh-glow { animation: sh-glow-breathe 2.2s ease-in-out 2; }
.sh-home:hover .sh-hub,
.sh-home:focus-visible .sh-hub { animation: sh-hub-breathe 2.2s ease-in-out infinite; }
.sh-home:hover .sh-spoke,
.sh-home:focus-visible .sh-spoke { animation: sh-spoke-breathe 2.2s ease-in-out infinite; }
.sh-home:hover .sh-glow,
.sh-home:focus-visible .sh-glow { animation: sh-glow-breathe 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .sh-bar .sh-mark * { animation: none !important; }
}

/* The keys: RUN, WATCH, REPORTS and MORE, plain words on the ground. The
   group takes the row's free width, so what follows it stands at the right. */
.sh-nav {
  display: flex;
  align-items: center;
  flex: 1 0 auto;
  gap: 8px;
  min-width: auto;
}
.sh-keys {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.sh-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sh-ink);
  white-space: nowrap;
}
.sh-bar .sh-key {
  font: 600 15px/1 var(--sh-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-underline-offset: 8px;
}
.sh-key:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.sh-key:active { background: var(--sh-panel); text-decoration: underline; text-decoration-thickness: 2px; }
.sh-key[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sh-accent);
}
.sh-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.sh-more[aria-expanded="true"] .sh-caret { margin-top: 4px; transform: rotate(225deg); }

/* The status: the visitor's free-run state, a link to Settings at the key field. */
.sh-status {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0;
  border: 0;
  color: var(--sh-quiet);
  font: 400 15px/1.4 var(--sh-sans);
  white-space: nowrap;
}
.sh-status:hover { color: var(--sh-ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.sh-status[data-empty] { visibility: hidden; }
.sh-status-box { display: inline-grid; justify-items: end; }
.sh-status-box > * { grid-area: 1 / 1; }
.sh-reserve { visibility: hidden; }
.sh-reserve-short,
.sh-short { display: none; }
.sh-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* How it works: the one key with an edge besides the look switch. */
.sh-how {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--sh-edge);
  border-radius: 4px;
  background: transparent;
  color: var(--sh-ink);
  white-space: nowrap;
}
.sh-bar .sh-how { font: 600 15px/1 var(--sh-sans); }
.sh-how:hover { border-color: var(--sh-ink); }
.sh-how:active { transform: translateY(1px); }
.sh-how[aria-expanded="true"] { border-color: var(--sh-accent); }

.sh-slot { display: contents; }

/* The look switch: one 44 px key, a sun in the dark look and a moon in the light look. */
.sh-look {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--sh-edge);
  border-radius: 4px;
  color: var(--sh-ink);
}
.sh-look:hover { border-color: var(--sh-ink); }
.sh-glyph { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; }
.sh-moon { display: none; }
html.light .sh-sun { display: none; }
html.light .sh-moon { display: block; }

.sh-look-note:empty { display: none; }
.sh-look-note {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 16px 10px;
  color: var(--sh-ink);
  font: 400 15px/1.4 var(--sh-sans);
}

/* The fold: what does not fit goes into MORE, in one order. The window's
   width folds the row before the script runs; the script folds it further
   while it still does not fit. */
.sh-bar:is([data-fold="1"], [data-fold="2"], [data-fold="3"], [data-fold="4"], [data-fold="5"], [data-fold="6"], [data-fold="7"]) :is(.sh-long, .sh-reserve-long) { display: none; }
.sh-bar:is([data-fold="1"], [data-fold="2"], [data-fold="3"], [data-fold="4"], [data-fold="5"], [data-fold="6"], [data-fold="7"]) :is(.sh-short, .sh-reserve-short) { display: inline; }
.sh-bar:is([data-fold="2"], [data-fold="3"], [data-fold="4"], [data-fold="5"], [data-fold="6"], [data-fold="7"]) .sh-how { display: none; }
.sh-bar:is([data-fold="3"], [data-fold="4"], [data-fold="5"], [data-fold="6"], [data-fold="7"]) .sh-status { display: none; }
.sh-bar:is([data-fold="4"], [data-fold="5"], [data-fold="6"], [data-fold="7"]) .sh-key[data-tab="reports"] { display: none; }
.sh-bar:is([data-fold="5"], [data-fold="6"], [data-fold="7"]) .sh-key[data-tab="sim"] { display: none; }
/* The look switch leaves the row for its item in MORE, which names the look it switches to. */
.sh-bar:is([data-fold="6"], [data-fold="7"]) .sh-look { display: none; }
.sh-bar[data-fold="7"] .sh-wordmark { display: none; }
@media (max-width: 959.98px) {
  .sh-long, .sh-reserve-long { display: none; }
  .sh-short, .sh-reserve-short { display: inline; }
}
@media (max-width: 839.98px) { .sh-how { display: none; } }
@media (max-width: 579.98px) { .sh-status { display: none; } }
@media (max-width: 469.98px) { .sh-key[data-tab="reports"] { display: none; } }
@media (max-width: 349.98px) { .sh-key[data-tab="sim"] { display: none; } }

/* Past the last fold the keys scroll in one row behind previous and next keys. */
.sh-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--sh-edge);
  border-radius: 4px;
  color: var(--sh-ink);
  font: 600 20px/1 var(--sh-sans);
}
.sh-arrow[hidden] { display: none; }
.sh-arrow:disabled { color: var(--sh-quiet); cursor: default; opacity: 0.75; }
.sh-bar[data-scroll] .sh-nav { flex: 1 1 0; min-width: 0; }
.sh-bar[data-scroll] .sh-keys {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}
.sh-bar[data-scroll] .sh-keys::-webkit-scrollbar { display: none; }

/* MORE's menu: one column at the sheet's full width that scrolls only up and down. */
.sh-menu {
  position: fixed;
  z-index: 1;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 8px 0;
  background: var(--sh-panel);
  color: var(--sh-ink);
  border: 1px solid var(--sh-edge);
  border-radius: 4px;
  box-shadow: var(--sh-shadow);
  animation: sh-menu-in 120ms ease-out;
}
.sh-menu[hidden] { display: none; }
/* On a phone the menu is a sheet across the page's column, whatever width
   the script placed it at before the window narrowed. */
@media (max-width: 599.98px) {
  .sh-menu { left: 16px !important; right: 16px !important; width: auto !important; }
}
@keyframes sh-menu-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sh-menu { animation: none; } }
.sh-item {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: var(--sh-ink);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.sh-item:hover,
.sh-item:focus-visible { background: var(--sh-ground); }
.sh-item[aria-current="page"] .sh-item-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sh-accent);
  text-underline-offset: 4px;
}
.sh-item-name { display: block; font: 600 18px/1.35 var(--sh-sans); color: var(--sh-ink); }
.sh-item-line { display: block; margin-top: 2px; font: 400 15px/1.4 var(--sh-sans); color: var(--sh-quiet); }
.sh-rule { height: 1px; margin: 8px 16px; background: var(--sh-rule); }

@media print {
  .sh-bar, .sh-skip { display: none; }
}
