/* The Kindex design language, as decided on the design canvas: one monospace typeface, square corners,
   no brand color, the name as the mark, and robots drawn in dots. The values are copied from the canvas's
   tokens.css, so a change there must be repeated here. */
:root {
  --ui: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --head-weight: 500;
  --head-track: -0.03em;

  /* An arrival takes its time. Blocks of one group arrive in reading order, this far apart. */
  --ease-arrive: cubic-bezier(0.25, 0.8, 0.25, 1);
  --time-arrive: 520ms;
  /* Feedback to a press or hover stays fast. */
  --time-feedback: 120ms;
  --stagger: 50ms;

  /* Light theme. Graphite with black ink. */
  --ground: #c9c9c6;
  --line: #a8a8a5;
  --ink: #0c0c0c;
  --ink-soft: #262624;
  --quiet: #585855;

  --gutter: clamp(20px, 4vw, 48px);
  --page-width: 1080px;
  --robot-width: 420px;
  --robot-width-small: 260px;
  --product-name-width: 10ch;
  /* The robot drawing is 56 dots wide and 59 dots tall. */
  --robot-ratio: 56 / 59;

  color-scheme: light;
}

/* Dark theme. White on near-black. It is written twice and the two blocks must stay the same: the first follows
   the device setting until the visitor picks a theme, and the second is the theme the visitor picked. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0b0d0b;
    --line: #232a24;
    --ink: #e9efe8;
    --ink-soft: #cfd6ce;
    --quiet: #7b867c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ground: #0b0d0b;
  --line: #232a24;
  --ink: #e9efe8;
  --ink-soft: #cfd6ce;
  --quiet: #7b867c;
  color-scheme: dark;
}

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

html { background: var(--ground); }

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  max-width: calc(var(--page-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  background: var(--ground);
  color: var(--ink);
  font: 14.5px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--gutter) 0;
}

/* Two options in one box. The current theme is the solid one. */
.theme-switch {
  display: flex;
  border: 1px solid var(--line);
}

/* The switch does nothing without its script, so it stays hidden until the script shows it. */
.theme-switch[hidden] { display: none; }

.theme-switch button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--quiet);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color var(--time-feedback), color var(--time-feedback);
}

.theme-switch button:hover { color: var(--ink); }

.theme-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--ground);
}

.theme-switch button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.mark {
  color: inherit;
  font-size: 17px;
  font-weight: var(--head-weight);
  letter-spacing: var(--head-track);
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: var(--gutter);
  padding: var(--gutter) 0;
}

.pitch h1 {
  margin: 0 0 40px;
  font-size: clamp(28px, 4vw, 46px);
  font-weight: var(--head-weight);
  line-height: 1.1;
  letter-spacing: var(--head-track);
  text-wrap: balance;
}

.products { max-width: 60ch; }

.products h2 {
  margin: 0 0 8px;
  color: var(--quiet);
  font-size: 12.5px;
  font-weight: 400;
}

.products dl { margin: 0; }

/* One row per product: the name in a fixed column, so the descriptions line up. */
.products dl > div {
  display: grid;
  grid-template-columns: var(--product-name-width) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.products dt { font-weight: var(--head-weight); }

.products dd {
  margin: 0;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* The drawing is a mask, so its dots take the ink color of whichever theme is showing. */
.robot {
  justify-self: center;
  width: min(100%, var(--robot-width));
  aspect-ratio: var(--robot-ratio);
  background: var(--ink);
  -webkit-mask: url("robot.svg") center / contain no-repeat;
  mask: url("robot.svg") center / contain no-repeat;
}

.foot {
  display: flex;
  justify-content: space-between;
  padding: 16px 0 var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 12.5px;
}

@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .robot { order: -1; justify-self: start; width: var(--robot-width-small); }
}

@media (prefers-reduced-motion: no-preference) {
  .mark, .theme-switch, .pitch h1, .products, .robot, .foot {
    animation: arrive var(--time-arrive) var(--ease-arrive) both;
  }
  .pitch h1 { animation-delay: var(--stagger); }
  .products { animation-delay: calc(2 * var(--stagger)); }
  .robot { animation-delay: calc(3 * var(--stagger)); }
  .foot { animation-delay: calc(4 * var(--stagger)); }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(8px); }
}
