/*
 * Ahonui, paper and lava.
 *
 * What every page shares: the tokens, the type, the masthead, the footer,
 * the button and the consent banner. A page adds one stylesheet of its own.
 *
 * The colours are his, as the scene he is built from names them:
 * LINE is the ink, LAVA the one accent, LAVA_HOT the celebration, SHADE the
 * night. The app keeps its own palette, and the drawn phones keep the
 * app's (phone.css).
 *
 * Three rules the numbers make:
 * - A lava button carries an ink label. Ink on lava is 5.8 to 1, white on
 *   lava is 3.1 and fails.
 * - Lava is never body text on paper: 2.7 to 1.
 * - Hot is for a habit met and nothing else.
 */

@font-face {
  font-family: "Bricolage Grotesque";
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f6f1e7;
  --paper2: #ece5d6;
  --ink: #17171a;
  --ink2: #46423c;
  --ink3: #6c6762;
  --lava: #f26a1b;
  --lava-up: #ff8a3d;
  --hot: #ffcb4a;
  --basalt: #2c2d30;
  --hair: rgba(23, 23, 26, 0.22);

  /* A night slab is basalt whatever the page wears. */
  --night: #2c2d30;
  --night-ink: #f6f1e7;
  --night-ink2: #d9d2c3;
  --night-lava: #ff9a57;
  --night-hair: rgba(246, 241, 231, 0.22);

  /* His stage is paper in every appearance: his outline is ink and his
     body basalt, so on a dark ground he is gone. */
  --stage: #ece5d6;
  --stage-ink: #17171a;
  --stage-ink2: #46423c;

  --display: "Bricolage Grotesque", "Arial Black", "Helvetica Neue", Helvetica, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --page: 80rem;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --rule: 3px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.5 var(--sans);
}

img,
picture,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

h2 {
  font-size: clamp(2.5rem, 5.6vw, 5.5rem);
  line-height: 0.95;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.label {
  font: 0.8125rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink2);
}

.skip {
  position: absolute;
  left: -999rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
}

[hidden] {
  display: none !important;
}

/* ---------- The button ---------- */

/* Square, never a pill. The border is ink in both appearances, so the
   button is one object wherever it sits. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0 1.75rem;
  border: var(--rule) solid #17171a;
  border-radius: 6px;
  background: var(--lava);
  color: #17171a;
  font: 700 1.125rem/1.15 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* A label that wraps on a narrow phone keeps its lines apart and never
     pushes the button past its column (AHO-636). */
  max-width: 100%;
  padding-block: 0.6rem;
  text-wrap: balance;
  -webkit-tap-highlight-color: transparent;
}

/* Hover only where there is a pointer to hover with: on a phone the first
   tap left the lighter fill stuck on the button. Pressing is its own state. */
@media (hover: hover) {
  .button:hover {
    background: var(--lava-up);
  }
}

.button:active {
  background: var(--lava-up);
  transform: translateY(1px);
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

.button:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* The second thing to press: the same button, in outline. */
.button.ghost {
  border-color: var(--ink);
  background: none;
  color: var(--ink);
}

@media (hover: hover) {
  .button.ghost:hover {
    background: var(--paper2);
  }
}

.button.ghost:active {
  background: var(--paper2);
}

/* Two buttons side by side, one under the other where they do not fit. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button.small {
  min-height: 3rem;
  padding: 0 1.25rem;
  font-size: 1rem;
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: var(--rule) solid var(--ink);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  font: 800 1.75rem/1 var(--display);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand img {
  border-radius: 0.45rem;
}

.masthead nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2.25rem);
}

.masthead nav a:not(.button) {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
  text-decoration: none;
}

.masthead nav a:not(.button):hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

/* On a phone the masthead is the name and one button, and under them a
   row of mono labels: there was no way from a phone to How it works,
   Quests or Support (AHO-636). The demo is beside the download further
   down, and in the footer. */
@media (max-width: 44rem) {
  .masthead .wrap {
    flex-wrap: wrap;
    row-gap: 0;
    min-height: 0;
    padding-top: 0.75rem;
  }

  .masthead nav {
    display: contents;
  }

  .masthead nav .button {
    order: 1;
    white-space: nowrap;
  }

  .masthead .wrap::after {
    content: "";
    order: 2;
    flex-basis: 100%;
  }

  .masthead nav a:not(.button) {
    order: 3;
    font: 0.8125rem/1 var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .masthead nav .button.ghost {
    display: none;
  }
}

.masthead nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.35em;
}

@media (max-width: 22.5rem) {
  .masthead .brand {
    gap: 0.5rem;
    font-size: 1.5rem;
  }

  .masthead nav .button.small {
    padding-inline: 0.875rem;
  }
}

/* ---------- Footer ---------- */

footer {
  margin-top: clamp(4rem, 10vw, 8rem);
  padding-bottom: 3rem;
  color: var(--ink2);
  font-size: 0.9375rem;
}

footer .wrap > nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 2rem;
  padding-block: 1.5rem;
  border-top: var(--rule) solid var(--ink);
  font: 0.8125rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

footer nav a,
footer nav button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ink);
  text-decoration: none;
}

footer nav a:hover {
  text-decoration: underline;
}

footer .accounts {
  display: inline-flex;
  gap: 0;
  margin-left: auto;
}

/* A whole fingertip each, not the 20 pixels the mark is. */
footer .accounts a {
  min-width: 2.75rem;
  justify-content: center;
}

footer .accounts svg {
  width: 1.25rem;
  height: 1.25rem;
}

footer p {
  max-width: 52rem;
  margin-top: 0.5rem;
}

footer nav .consent-link {
  display: none;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.js footer nav .consent-link {
  display: inline-flex;
}

/* ---------- Cookies ---------- */

.consent {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  padding: 1.25rem 0 1.5rem;
  border-top: var(--rule) solid var(--ink);
  background: var(--paper2);
  color: var(--ink2);
  font-size: 0.9375rem;
}

.consent .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}

.consent p {
  max-width: 44rem;
  margin: 0 auto 0 0;
}

.consent a {
  color: var(--ink);
}

.consent-buttons {
  display: flex;
  gap: 0.75rem;
}

.consent button {
  min-height: 2.75rem;
  padding: 0 1.2rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
}

/* On a phone: shorter, two equal buttons, and clear of the home
   indicator. It took nearly a third of the screen, then a quarter of a
   small one (AHO-843). The words stay whole; the type and the air go. */
@media (max-width: 44rem) {
  .consent {
    padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
    font-size: 0.8125rem;
    line-height: 1.35;
  }

  .consent .wrap {
    gap: 0.6rem;
  }

  .consent-buttons {
    width: 100%;
  }

  .consent-buttons button {
    flex: 1;
  }
}

.consent .consent-yes {
  border-color: #17171a;
  background: var(--lava);
  color: #17171a;
}
