/* hyperstack's site. System fonts only; nothing loaded from elsewhere. Phone first: every rule below
   is for a narrow screen, and the min-width queries widen it. */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #474747;
  --accent: #0b5cad;
  --line: #c9ced6;
  --panel: #f3f5f8;
  --slot: #8a5a00;
  --focus: #0b5cad;
  --brand: #00cccc;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --fg: #e8e8e8;
    --muted: #b8bcc4;
    --accent: #8ebcff;
    --line: #3a404a;
    --panel: #1c2026;
    --slot: #f0c060;
    --focus: #8ebcff;
    --brand: #00cccc;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
  border-top: 4px solid var(--brand);
}

a { color: var(--accent); text-underline-offset: 0.15em; }

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

.skip {
  position: absolute;
  left: 1rem;
  top: -100px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--focus);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* The page's width: wide enough for the grids, with the prose kept to a readable measure. */
.site-header, main, .site-footer {
  max-width: 64rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.prose { max-width: 42rem; }

/* The header: the mark and wordmark, then Docs, Apps and Library. The same on every page. Every target
   is at least 44px each way. On a narrow phone the nav wraps under the wordmark. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.wordmark { margin: 0; font-weight: 700; font-size: 1.2rem; letter-spacing: 0.01em; }
.wordmark a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  color: var(--fg);
  text-decoration: none;
}
.wordmark img { display: block; width: 1.5rem; height: 1.5rem; border-radius: 3px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.6rem 0 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.6rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--brand); }

main { padding-bottom: 1rem; }
main section { padding: 1.75rem 0; }
main section + section { border-top: 1px solid var(--line); }

h1 { font-size: clamp(1.9rem, 7vw, 3rem); line-height: 1.15; margin: 1.25rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 4vw, 1.6rem); line-height: 1.25; margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 0.4rem; }

.lede { font-size: 1.15rem; max-width: 40rem; }
.measure { font-size: 0.9rem; color: var(--muted); max-width: 40rem; }

.notice {
  max-width: 40rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--panel);
}

/* Commands, in the docs: a block scrolls inside itself, never the page. */
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.45;
}
pre code { font-size: 0.88rem; }

ul { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }

/* The welcome page's hero. */
.hero { padding-top: 1rem; padding-bottom: 2rem; }

/* How it goes: three numbered steps, stacked on a phone and side by side from 48rem. */
.steps {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 1rem 1rem 1rem 3.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--brand);
  color: var(--fg);
  font-weight: 700;
}
.steps strong { display: block; }

/* A grid of panels: the three words, need and costs, and the library's cards. */
.grid { display: grid; gap: 0.75rem; }
.panel {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel ul { margin: 0; }

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

.checks { list-style: none; padding-left: 0; max-width: 42rem; }
.checks li { position: relative; padding-left: 1.6rem; margin-bottom: 0.6rem; }
.checks li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.45em;
  width: 0.45rem;
  height: 0.8rem;
  border: solid var(--brand);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.runs { list-style: none; padding-left: 0; max-width: 42rem; }
.runs li { padding-left: 1rem; border-left: 3px solid var(--brand); margin-bottom: 0.9rem; }

.next { margin: 0; }
.go { font-weight: 600; }

.status { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; max-width: 42rem; }
.status dt { font-weight: 700; }
.status dd { margin: 0; }

/* The library's cards. A card's state is a text label, never a button. */
.cards { display: grid; gap: 1rem; padding: 0.5rem 0 1.5rem; }
.card { display: flex; flex-direction: column; border-top: 4px solid var(--brand); }
.card h2 { margin-bottom: 0.25rem; }
.state {
  align-self: flex-start;
  margin: 0 0 0.75rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slot);
  border: 1px solid var(--slot);
  border-radius: 4px;
}
.card .works { margin-top: auto; padding-top: 0.75rem; }

@media (min-width: 48rem) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .hero { padding-top: 2rem; padding-bottom: 2.5rem; }
}

.site-footer {
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer p { margin: 0.25rem 0; }

/* The apps page: each card leads with its screenshot, 16:10, scaled to the card's width. */
.card.app { overflow: hidden; }
.card.app > img {
  display: block;
  width: calc(100% + 2.2rem);
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 10;
  margin: -1rem -1.1rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.runs-on { font-size: 0.95rem; color: var(--muted); }
