/* HUDsplay landing page: Fira Code, comment-style headings. Every color comes from the
   overlay's theme variables (hud/theme.css, switched by the theme picker in live.js), so
   the page and its live widgets always wear the same theme. */
:root {
  --bg: var(--c-bg);
  --bg-2: color-mix(in srgb, var(--c-bg) 94%, var(--c-fg));
  --bg-3: color-mix(in srgb, var(--c-bg) 88%, var(--c-fg));
  --border: var(--c-border);
  --fg: var(--c-fg);
  --fg-soft: color-mix(in srgb, var(--c-fg) 85%, var(--c-bg));
  --muted: var(--c-muted);
  --comment: var(--c-comment);
  --keyword: var(--c-label);
  --var: var(--c-name);
  --num: var(--c-pos);
  --string: var(--c-number);
  --gold: var(--c-me);
  --good: var(--c-good);
  --accent: var(--c-label);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 56px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--font);
  /* same smoothing as the overlay: grayscale antialiasing, unhinted glyphs, no faked bold */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  font-synthesis: none;
  overflow-x: hidden;
  transition: background-color 0.2s, color 0.2s;
}
a { color: var(--var); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
code, kbd {
  font: inherit;
  font-size: 0.92em;
  color: var(--string);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 0.3em;
}
kbd { color: var(--fg); }

.comment { color: var(--comment); font-style: italic; margin: 0 0 0.3em; }
/* wordmark, like the //H logo: "//" and "splay" comment green, "HUD" gold */
.lg-slash, .lg-splay { color: var(--comment); }
.lg-hud { color: var(--gold); }

/* ---------- title bar with editor tabs */
.titlebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 1rem;
  height: 44px;
  padding: 0 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs a {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.tabs a:first-child { border-left: 1px solid var(--border); }
.tabs a:hover { color: var(--fg); background: var(--bg); text-decoration: none; }
.gh { display: flex; align-items: center; font-size: 0.85rem; white-space: nowrap; }
.theme-pick { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); }
select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
}

main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
section { padding: 4rem 0 1rem; }

/* ---------- hero */
.hero { text-align: center; padding-top: 4.5rem; }
.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 9vw, 5.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.lead { max-width: 40rem; margin: 1rem auto 0; font-size: 1.1rem; }
.cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.8rem; }
.btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--fg);
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary {
  background: color-mix(in srgb, var(--accent) 70%, #000);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.9rem; }

/* editor-like window frame around the live widgets */
.window {
  margin: 2.5rem 0 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: left;
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }
.window-bar em { margin-left: 8px; color: var(--muted); font-size: 0.8rem; font-style: normal; }
.window figcaption { padding: 0.5rem 0.8rem; color: var(--muted); font-size: 0.8rem; background: var(--bg-2); border-top: 1px solid var(--border); }

/* ---------- live widgets (the overlay's .hud styles, placed in the page flow) */
.hud {
  font: 13px/1.5 var(--font);
  font-feature-settings: "calt" 1, "liga" 1;
  color: var(--c-fg);
  user-select: none;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
.hud .widget { position: relative; width: max-content; max-width: 100%; }
.hud .live { min-width: 0; }
/* a dark "sim" backdrop behind the widgets, tinted by the theme */
.stage, .specimen {
  background:
    radial-gradient(ellipse at 50% 120%, color-mix(in srgb, var(--c-bg) 55%, #6b7a8c) 0%, color-mix(in srgb, var(--c-bg) 70%, #000) 55%, color-mix(in srgb, var(--c-bg) 40%, #000) 100%);
}
.stage {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
  font-size: 12px; /* the overlay's 13px base, a touch smaller so 3 columns fit */
}
.stage .col { display: flex; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
.stage .live[data-w="map"] .widget { font-size: 13px; } /* the map gets the spare width */
.stage .col.mid { align-items: center; }
.stage .pair { display: flex; gap: 0.8rem; align-items: flex-start; flex-wrap: wrap; }

.specimen {
  display: grid;
  place-items: center;
  min-height: 9rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.specimen.stack { gap: 0.8rem; }

/* the real edit panel, in the page instead of floating over the sim */
.panel-demo #edit-panel {
  display: block;
  position: static;
  width: 100%;
  max-width: 22rem;
  max-height: none;
  margin: 0 auto;
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--fg);
  user-select: auto;
}
.panel-demo #edit-panel #theme-rows { max-height: none; }
.panel-demo #edit-panel select, .panel-demo #edit-panel button { color: var(--fg); background: var(--bg-3); border-color: var(--border); }
.panel-demo #edit-panel .section > summary { color: var(--comment); }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.note { color: var(--muted); font-size: 0.9rem; }

/* ---------- feature grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.features > div {
  padding: 1rem 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.features h2 { margin: 0 0 0.3rem; font-size: 1rem; font-weight: 500; color: var(--comment); font-style: italic; }
.features p { margin: 0; color: var(--fg-soft); font-size: 0.9rem; }

/* ---------- sections */
.section-title { margin: 0 0 1.5rem; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; }

.widget-doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  padding: 1.8rem 0;
  border-top: 1px solid var(--border);
}
.widget-doc h3 { margin: 0 0 0.4rem; color: var(--comment); font-style: italic; font-weight: 500; font-size: 1.15rem; }
.widget-doc p { margin: 0 0 0.6rem; }
.widget-doc ul, .edit ul, .install ol { margin: 0; padding-left: 1.2rem; color: var(--fg-soft); }
.widget-doc li, .edit li, .install li { margin: 0.25rem 0; }
.widget-doc li::marker, .edit li::marker { color: var(--keyword); }

.faq details {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-2);
  margin: 0 0 0.6rem;
  padding: 0.6rem 1rem;
}
.faq summary { cursor: pointer; color: var(--var); }
.faq details p { margin: 0.6rem 0 0.2rem; color: var(--fg-soft); }

footer {
  margin-top: 4rem;
  padding: 2rem 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 0.9rem;
}
footer .small { color: var(--muted); font-size: 0.8rem; margin: 0.3rem 0 0; }
footer .ua { max-width: 40rem; margin: 0.8rem auto 0; font-size: 0.85rem; }

/* ---------- smaller screens */
@media (max-width: 1080px) {
  /* 2 columns, the map full width underneath */
  .stage { grid-template-columns: auto auto; justify-content: space-evenly; }
  .stage .col:last-child { grid-column: 1 / -1; align-items: center; }
}
@media (max-width: 820px) {
  .stage { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .stage .col { align-items: center; max-width: 100%; }
  .stage .pair { justify-content: center; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .widget-doc, .edit-grid { grid-template-columns: 1fr; gap: 1rem; }
  .gh, .theme-pick span { display: none; }
  .tabs a { padding: 0 0.7rem; }
  section { padding-top: 3rem; }
  .stage, .specimen { padding: 0.8rem; }
}
/* the relative is ~39em wide: shrink it to fit a phone (16px gutters + paddings) */
@media (max-width: 560px) {
  .hud .live[data-w="relative"] .widget { font-size: min(13px, calc((100vw - 64px) / 39.5)); }
  .hud .live[data-w="map"] .widget { font-size: min(13px, calc((100vw - 64px) / 21.5)); }
}
