/* The landing page of the main domain. Colours, type, the top bar and cards are the app's
   (base.css, served from frontend/css).

   Layout: one column of sections on the app's page colour, parted by space. The top is centred:
   the headline, then the playable captcha on a large card. Every section after it is the same
   row: what it says on the left, the thing itself on the right.

   The page adds four pale washes to the theme. They sit behind the top of the page and fill the
   numbers and tiles further down, and are never used for text. */

:root {
  --measure: 34em;
  --gutter: 24px;
  --gap: clamp(32px, 6vw, 80px);
  --section: clamp(44px, 7vw, 84px);
  --wash-yellow: #fff0bd;
  --wash-pink: #ffd9e3;
  --wash-blue: #dcebff;
  --wash-violet: #e6deff;
  --demo-width: 680px;
}

body {
  background:
    radial-gradient(520px 380px at 12% 150px, var(--wash-yellow) 0, transparent 70%) no-repeat,
    radial-gradient(560px 420px at 90% 260px, var(--wash-pink) 0, transparent 70%) no-repeat,
    radial-gradient(700px 480px at 50% 760px, var(--wash-blue) 0, transparent 70%) no-repeat,
    var(--page);
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.top-inner,
.row,
.foot {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---- The bar at the top ---- */

/* It has no ground of its own, so the page's colour runs behind it, and it scrolls away with
   the page. */
.top {
  background: none;
  border: 0;
}

.sections {
  display: flex;
  gap: 28px;
  font-size: 0.9rem;
}

.sections a,
.login {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.sections a:hover,
.login:hover {
  text-decoration: underline;
}

.account {
  gap: 16px;
  font-size: 0.9rem;
}

/* ---- A section ---- */

.row {
  display: grid;
  gap: var(--gap);
  align-items: start;
  padding-block: var(--section);
}

@media (min-width: 900px) {
  .row { grid-template-columns: 1fr 1fr; }
}

/* Text and code may be long: they wrap or scroll inside their column, never widen the page. */
.say,
.show {
  min-width: 0;
  margin: 0;
}

.say {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.say > * {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 3.9rem);
  line-height: 1.1;
}

/* Two sentences, a line each. */
h1 span {
  display: block;
}

/* A stroke of highlighter through the lower half of the words. */
h1 mark {
  color: inherit;
  background: linear-gradient(transparent 52%, var(--mark) 52% 90%, transparent 90%);
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.1rem);
  line-height: 1.15;
}

h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
}

.say p {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.0625rem;
}

.say p.lead {
  font-size: 1.2rem;
}

.say p.hint,
.hint {
  font-size: 0.875rem;
}

.show p {
  margin: 0;
  color: var(--muted);
}

/* ---- Buttons and links to act on ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding-top: 8px;
}

/* A link that looks like the app's buttons (forms.css). */
.button {
  display: inline-block;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--button-ink);
  text-decoration: none;
  background: var(--button);
  border: 1px solid var(--button);
  border-radius: var(--radius-button);
}

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

.button.small {
  padding: 7px 16px;
}

.button.plain {
  color: var(--ink);
  background: var(--card);
  border-color: var(--line-strong);
}

.button.plain:hover {
  background: var(--page);
}

.more {
  font-weight: 500;
  text-decoration: none;
}

.more:hover {
  text-decoration: underline;
}

.more::after {
  content: " \203A";
}

/* ---- The top: the headline, then the captcha, to play ---- */

.hero {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 44px;
  padding-block: clamp(40px, 7vw, 88px);
  text-align: center;
}

.hero .say {
  justify-items: center;
}

.hero .say p.lead {
  max-width: 36em;
}

.hero .actions {
  justify-content: center;
}

.hero .show {
  width: 100%;
  max-width: var(--demo-width);
}

/* The one large card, lifted off the page. On a phone its edge is thinner, so the board is
   as large as it can be. */
.demo {
  --demo-pad: 12px;
  --demo-extra: 306px;
  margin: 0 0 18px;
  padding: var(--demo-pad);
  border: 0;
  border-radius: 26px;
  box-shadow: 0 30px 80px rgb(91 61 245 / 0.2);
}

/* The frame is as tall as a round needs at the width it has: the board is as wide as the frame,
   and the words and buttons around it take a fixed amount more. The amount is larger where the
   frame is narrow, because the words above the board then take more lines. */
.demo iframe {
  display: block;
  width: 100%;
  height: calc((min(100vw - 2 * var(--gutter), var(--demo-width)) - 2 * var(--demo-pad)) * 0.5667 + var(--demo-extra));
  border: 0;
}

@media (min-width: 350px) {
  .demo { --demo-extra: 280px; }
}

@media (min-width: 410px) {
  .demo { --demo-extra: 238px; }
}

@media (min-width: 481px) {
  .demo { --demo-pad: 20px; border-radius: 32px; }
}

@media (min-width: 728px) {
  .demo { --demo-extra: 218px; }
}

/* ---- How it works ---- */

.ledger {
  justify-self: stretch;
  max-width: 420px;
  margin-top: 12px;
  padding: 18px 20px 8px;
  border-color: transparent;
  box-shadow: 0 12px 40px rgb(29 26 58 / 0.08);
}

.say .ledger-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}

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

.ledger li {
  display: grid;
  grid-template-columns: 3.6em 1fr 1.5em 5.6em;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.who {
  color: var(--muted);
}

.count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.bar {
  height: 8px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--link-line);
  border-radius: 99px;
}

.w4 { width: 20%; }
.w7 { width: 35%; }
.w11 { width: 55%; }
.w20 { width: 100%; }

.state {
  justify-self: end;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--button-ink);
  background: var(--accent);
}

.state.ok {
  font-weight: 500;
  color: var(--ok);
  background: var(--ok-tint);
}

.asked .who,
.asked .count {
  color: var(--ink);
  font-weight: 600;
}

.asked .bar i {
  background: var(--accent);
}

/* The four steps are a sequence, so they are numbered. */
.steps {
  display: grid;
  gap: 28px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 3.4em 1fr;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  font-family: var(--font-display);
  font-weight: 800;
  background: var(--wash-yellow);
  border-radius: 50%;
}

.steps li:nth-child(2)::before { background: var(--wash-pink); }
.steps li:nth-child(3)::before { background: var(--wash-blue); }
.steps li:nth-child(4)::before { background: var(--wash-violet); }

.steps p {
  grid-column: 2;
  max-width: var(--measure);
}

/* ---- What it is like to run ---- */

.traits {
  display: grid;
  gap: 16px;
  padding: 0;
  list-style: none;
}

.traits li {
  padding: 22px;
  background: var(--wash-yellow);
  border-radius: var(--radius);
}

.traits li:nth-child(2) { background: var(--wash-pink); }
.traits li:nth-child(3) { background: var(--wash-blue); }
.traits li:nth-child(4) { background: var(--wash-violet); }

@media (min-width: 560px) {
  .traits { grid-template-columns: 1fr 1fr; }
}

.traits svg {
  width: 22px;
  height: 22px;
  margin-bottom: 10px;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Darker than the usual quiet text, which is too faint on a tile. */
.traits p {
  color: #4b4466;
  font-size: 0.95rem;
}

/* ---- Developers ---- */

.code {
  padding: 22px 24px;
  overflow-x: auto;
  color: var(--panel-ink);
  background: var(--panel);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
}

.code .note {
  color: var(--panel-muted);
}

/* ---- The end of the page ---- */

.closing {
  align-items: center;
}

.closing .actions {
  padding-top: 0;
}

@media (min-width: 900px) {
  .closing .actions { justify-content: flex-end; }
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 28px 40px;
  color: var(--muted);
  font-size: 0.875rem;
}

.foot p {
  margin: 0;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

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

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

.top .brand,
.account a {
  white-space: nowrap;
}

/* On a phone the bar has room for the name and one button. "Log in" is at the foot of the page. */
@media (max-width: 480px) {
  .login { display: none; }
}

@media (max-width: 760px) {
  .sections { display: none; }
  .code { padding: 16px; font-size: 0.74rem; }
}
