/* lazyenv's page, in the TUI's default themes, light or dark as the reader's system is or as they pick with the switch, on the reader's own system fonts. */

:root {
  color-scheme: light dark;
  /* lazyenv's default light theme (internal/tui/styles.go in lazyenv), on a light terminal's white. */
  --ground: #ffffff;
  --fg: #1f2937;
  --primary: #7b2fbe;
  --muted: #6b7280;
  --border: #d1d5db;
  --cursor: #e5e7eb;
  /* The terminal the demo was recorded in, behind the video until it loads. */
  --screen: #1c1c26;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--ground);
}

/* lazyenv's default dark theme, on the demo's own terminal, so the recording sits flush with the page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1c1c26;
    --fg: #f8f8f2;
    --primary: #bd93f9;
    /* The theme's #6272a4, lifted so small text reads at 4.5:1 or more. */
    --muted: #9aa5ce;
    --border: #44475a;
    --cursor: #44475a;
  }
}

/* The same two themes when the reader picks one with the switch (theme.js). */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #1c1c26;
  --fg: #f8f8f2;
  --primary: #bd93f9;
  --muted: #9aa5ce;
  --border: #44475a;
  --cursor: #44475a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-size: 1.0625rem;
  -webkit-text-size-adjust: 100%;
}

/* Selected text takes the TUI's cursor row. */
::selection {
  background: var(--cursor);
  color: var(--fg);
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--primary);
}

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

code,
kbd {
  font-family: var(--mono);
}

p {
  margin: 0 0 1rem;
  max-width: 36em;
}

.wrap {
  width: min(64rem, 100% - 2.75rem);
  margin-inline: auto;
}

/* The head every page of the site shares, as site/style.css draws it, in lazyenv's theme: the way back and the catalogue number over a heavy rule. */
.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1.25rem 0.5rem;
  border-bottom: 3px solid var(--fg);
  font-size: 0.9375rem;
  font-weight: 900;
  line-height: 1.55;
}

.head a {
  text-decoration: none;
}

.cat {
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* The theme switch, at the right just under the head, up in the hero's padding so the page without it (no script) keeps its spacing, drawn as a TUI checkbox: [ ] dark theme, then [x] dark theme with the x in violet, as the keys are. */
.theme {
  align-self: flex-end;
  margin-top: -0.75rem;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
}

.box::before {
  content: "[";
}

.box::after {
  content: "] ";
  white-space: pre;
}

.box span::before {
  content: " ";
  white-space: pre;
}

.theme[aria-checked="true"] .box span::before {
  content: "x";
  color: var(--primary);
}

.theme:hover {
  color: var(--primary);
}

.hero {
  display: flex;
  flex-direction: column;
  padding-block: 1.5rem 2rem;
}

.name {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: clamp(2.75rem, 11vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.lead {
  margin: 0;
  font-size: 1.25rem;
}

/* The demo, edge to edge on a phone so its 68 columns get every pixel; framed in a panel's border once there is room. */
.demo video {
  width: 100%;
  aspect-ratio: 1080 / 608;
  background: var(--screen);
}

@media (min-width: 40rem) {
  .demo {
    width: min(64rem, 100% - 2.75rem);
    margin-inline: auto;
  }

  .demo video {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
  }
}

/* A panel, as the TUI draws one: a rounded border, its title in bold violet with a muted count. */
.panel {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--primary);
}

.panel h2 span {
  font-weight: 400;
  color: var(--muted);
}

.panel p {
  text-wrap: balance;
}

.panel > :last-child {
  margin-bottom: 0;
}

/* What it does, as the help bar reads: [key]action, then what the action does. */
.keys {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.keys div {
  display: grid;
  gap: 0.125rem 1.5rem;
}

.keys dt {
  font-family: var(--mono);
  color: var(--muted);
}

.keys kbd {
  font-weight: 700;
  color: var(--primary);
}

.keys kbd::before,
.keys kbd::after {
  font-weight: 400;
  color: var(--muted);
}

.keys kbd::before {
  content: "[";
}

.keys kbd::after {
  content: "]";
}

.keys dd {
  margin: 0;
  max-width: 36em;
}

@media (min-width: 40rem) {
  .keys div {
    grid-template-columns: 10rem 1fr;
  }
}

.links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.links li + li {
  margin-top: 0.375rem;
}

footer {
  margin-top: 4rem;
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
