/*
 * The root page at interleaving.ai.
 *
 * Every colour, type weight, control size and radius here is Interleave's
 * `app/DesignSystem.json`, declared once below and once more for dark, and named
 * after its role there. `tests/hosting.test.cjs` compares the two blocks with that
 * file when the `interleave` checkout sits beside this repository. Two things are
 * derived rather than copied, because the file is sized for an app's controls and
 * has no display size: the heading is `h1` doubled (one and a half times on a
 * phone), and the large buttons are one and a half control heights.
 *
 * The page runs no script, so it follows the reader's light or dark preference and
 * offers no toggle. Its policy allows no inline style, and nothing here needs one.
 */

:root {
  color-scheme: light dark;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #67676f;
  --surface: #f4f4f5;
  --chip: #e3e3e7;
  --line: #dadadf;
  --accent: #ff5a1f;
  --accent-hover: #ff6a33;
  --accent-pressed: #e84d14;
  --on-accent: #18181b;
  /* accent1's text ink, because its base measures 2.84:1 on this surface and a
     focus ring has to clear 3:1. */
  --focus: #c2410c;
  --hover: rgb(24 24 27 / 0.05);
  --pressed: rgb(24 24 27 / 0.09);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Inter, sans-serif;
  --control-height: 28px;
  --button-radius: 7px;
  --brand-mark: 28px;
  --brand-mark-radius: 8px;
  --pane: 10px;
  --stage: 26px;
  --gutter: var(--stage);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #ededf0;
    --text-secondary: #b4b4bc;
    --text-muted: #8e8e97;
    --surface: #18181b;
    --chip: #26262b;
    --line: #2a2a30;
    --accent: #ff6b33;
    --accent-hover: #ff7b47;
    --accent-pressed: #ee5c26;
    --focus: #ff6b33;
    --hover: rgb(255 255 255 / 0.06);
    --pressed: rgb(255 255 255 / 0.1);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface);
  color: var(--text);
  font: 400 13px/18px var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

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

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

.lockup {
  display: inline-flex;
  align-items: center;
  gap: var(--pane);
  border-radius: var(--button-radius);
  color: var(--text);
  font: 600 15px/20px var(--font-ui);
  letter-spacing: -0.2px;
  text-decoration: none;
}

.lockup img {
  display: block;
  width: var(--brand-mark);
  height: var(--brand-mark);
  border-radius: var(--brand-mark-radius);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  font: 500 13px/18px var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease;
}

.button-primary {
  background-color: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background-color: var(--accent-hover);
}

.button-primary:active {
  background-color: var(--accent-pressed);
}

.button-secondary {
  border-color: var(--line);
  background-color: var(--chip);
  color: var(--text);
}

.button-secondary:hover {
  background-image: linear-gradient(var(--hover), var(--hover));
}

.button-secondary:active {
  background-image: linear-gradient(var(--pressed), var(--pressed));
}

.button-large {
  height: calc(var(--control-height) * 1.5);
  padding: 0 18px;
  font: 600 15px/20px var(--font-ui);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--stage) * 2) var(--gutter);
  text-align: center;
}

/* The two-colour mark on light. Its second colour is the light theme's ink, so on
   dark the single-colour mark takes the page's ink instead, through a mask: an
   <img> cannot pass the page's colour into `currentColor`. */
.hero-mark {
  width: calc(var(--brand-mark) * 4);
  height: calc(var(--brand-mark) * 4);
  margin-bottom: var(--stage);
}

.hero-mark img,
.hero-mono {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-mono {
  display: none;
  background-color: var(--text);
  -webkit-mask: url("/brand/interleave-plain-mono.svg") center / contain no-repeat;
  mask: url("/brand/interleave-plain-mono.svg") center / contain no-repeat;
}

@media (prefers-color-scheme: dark) {
  .hero-mark img {
    display: none;
  }

  .hero-mono {
    display: block;
  }
}

.hero h1 {
  max-width: 14em;
  margin: 0;
  font: 600 48px/60px var(--font-ui);
  letter-spacing: -0.0133em;
  text-wrap: balance;
}

.lede {
  max-width: 34em;
  margin: 16px 0 0;
  color: var(--text-secondary);
  font: 400 18px/24px var(--font-ui);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--pane);
  margin-top: var(--stage);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
  padding: var(--stage) var(--gutter);
  color: var(--text-muted);
  font: 400 12px/16px var(--font-ui);
}

.foot a {
  color: var(--text-secondary);
  text-decoration: none;
}

.foot a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  :root {
    --gutter: 16px;
  }

  .hero h1 {
    font: 600 36px/45px var(--font-ui);
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
