/*
 * One lit thing on a quiet page. The loop is the hero and the lamp on the
 * wake word is the only colour; everything else is ink on a limewashed wall.
 */

:root {
  --paper: #eef0ea;
  --ink: #14312b;
  --bracken: #5f6f5e;
  --rule: #cfd5cb;
  --lamp: #e9b84a;
  --lamp-glow: rgba(233, 184, 74, 0.35);
  --code: #e3e7de;

  --serif: "Young Serif", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 40rem;
  --gutter: clamp(1rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1f1b;
    --ink: #e7e9e2;
    --bracken: #9aa89a;
    --rule: #2b3f39;
    --lamp-glow: rgba(233, 184, 74, 0.22);
    --code: #17302a;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0 var(--gutter);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

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

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.005em;
  margin: 0;
}

/* ---------------------------------------------------------------- header */

.top {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.4rem 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.25rem;
  text-decoration: none;
}

.top nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.95rem;
}

.top nav a {
  text-decoration: none;
  color: var(--bracken);
}

.top nav a:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------------ main */

main {
  max-width: var(--measure);
  margin: 0 auto;
}

section {
  padding: 4.5rem 0 0;
}

section h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin-bottom: 0.7rem;
}

section p {
  margin: 0 0 1rem;
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding-top: 5.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  line-height: 1.12;
  max-width: 18ch;
  margin-bottom: 1.4rem;
}

.lede {
  font-size: 1.12rem;
  color: var(--ink);
  max-width: 34rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.6rem;
  margin-top: 1.8rem;
}

.install {
  font: inherit;
  color: inherit;
  background: var(--code);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 0.8rem;
}

.install:hover {
  border-color: var(--bracken);
}

.install code {
  font-size: 0.95rem;
}

.copied {
  font-size: 0.85rem;
  color: var(--bracken);
  min-width: 0;
}

.copied:empty::before {
  /* Reserve the width so the button does not jump when the word appears. */
  content: "copy";
  color: var(--bracken);
  opacity: 0.7;
}

.quiet {
  color: var(--bracken);
}

/* ------------------------------------------------------------------ loop */

.loop {
  padding-top: 4rem;
}

.loop ol {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* The path itself: a hairline down the left, in the ink. */
.loop ol::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 1px;
  background: var(--rule);
}

.loop li {
  position: relative;
  padding: 0.55rem 0 0.55rem 2.2rem;
  display: grid;
  grid-template-columns: minmax(8.5rem, 11rem) 1fr;
  gap: 0 1.2rem;
  align-items: baseline;
}

/* The stop on the path. Ink, except the one that is lit. */
.loop li::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.05rem;
  width: 7px;
  height: 7px;
  transform: translateX(-3px);
  border-radius: 50%;
  background: var(--ink);
}

.loop .lit::before {
  background: var(--lamp);
  box-shadow:
    0 0 0 6px var(--lamp-glow),
    0 0 22px 8px var(--lamp-glow);
}

.loop .what {
  font-family: var(--serif);
  font-size: 1.05rem;
}

.loop .lit .what {
  font-size: 1.2rem;
}

.loop .how {
  color: var(--bracken);
  font-size: 0.95rem;
}

/* The branch to the cloud sits off the main path, indented, as a fork would. */
.loop .branch {
  margin-left: 1.6rem;
}

.loop .branch::before {
  background: transparent;
  border: 1px solid var(--ink);
  width: 6px;
  height: 6px;
}

@media (max-width: 30rem) {
  .loop li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* --------------------------------------------------------------- pillars */

.pillars {
  display: grid;
  gap: 2.4rem;
}

.pillars h2 {
  font-size: 1.3rem;
}

/* ----------------------------------------------------------------- start */

.start pre {
  background: var(--code);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.1rem;
  line-height: 1.6;
}

.start pre code {
  font-size: 0.92rem;
}

.start .c {
  color: var(--bracken);
}

/* ---------------------------------------------------------------- footer */

footer {
  max-width: var(--measure);
  margin: 5rem auto 0;
  padding: 1.6rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--bracken);
  font-size: 0.92rem;
}

footer p {
  margin: 0;
}

/* --------------------------------------------------------------- utility */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .loop .lit::before {
    animation: settle 1.6s ease-out 1;
  }

  /* The lamp comes on once when the page loads, then holds. */
  @keyframes settle {
    from {
      box-shadow:
        0 0 0 0 var(--lamp-glow),
        0 0 0 0 var(--lamp-glow);
    }
  }
}
