/* Am I Shouting website. Colours are the app's Slate theme (crates/app/src/theme.rs), light
   and dark, so the site and the app look like one thing. One typeface, the app's own. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #eef1f5;
  --raised: #ffffff;
  --line: #c3ccd7;
  --text: #18212c;
  --muted: #536071;
  --calm: #23735f;
  --carry: #a3520a;
  /* The gauge's face is always the dark slate, as in the app icon. */
  --face: #18202b;
  --face-raised: #222c39;
  --face-line: #3a4656;
  --face-calm: #6fbfa8;
  --face-carry: #f0a04b;

  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.4rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.2rem, 1.4rem + 3.6vw, 3.4rem);
  --measure: 38rem;
  --page: 68rem;
  --gap: 1.5rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18202b;
    --raised: #222c39;
    --line: #3a4656;
    --text: #e4e8ed;
    --muted: #9aa6b4;
    --calm: #6fbfa8;
    --carry: #f0a04b;
    --face: #222c39;
    --face-raised: #2b3746;
  }
}

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

html {
  font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  font-size: 100%;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: var(--step-0);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* `hidden` wins over any display a class sets. */
[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--calm);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--calm);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 {
  font-size: var(--step-3);
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--step-2);
  letter-spacing: -0.01em;
}
h3 {
  font-size: var(--step-1);
}
p,
ul,
ol {
  margin: 0 0 1em;
  max-width: var(--measure);
}

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

.skip {
  position: absolute;
  left: -100vw;
}
.skip:focus {
  left: var(--gap);
  top: 0.5rem;
  background: var(--raised);
  padding: 0.5rem 1rem;
  z-index: 2;
}

/* ---- header and footer ---- */

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--text);
  text-decoration: none;
}
.brand img {
  width: 2rem;
  height: 2rem;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--text);
}
.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--calm);
}

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--step--1);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer a {
  color: var(--muted);
}

/* ---- hero: the gauge is the one bold thing on the site ---- */

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 2rem 4rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
}
.hero p.lede {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--muted);
  max-width: 34rem;
}
@media (max-width: 52rem) {
  .hero .wrap {
    grid-template-columns: 1fr;
    padding-top: 1.5rem;
  }
  .hero .gauge-demo {
    max-width: 15rem;
  }
}

.gauge-demo {
  margin: 0;
  width: 100%;
  max-width: 24rem;
  justify-self: center;
}
.gauge-demo svg {
  width: 100%;
  height: auto;
  display: block;
}
.gauge-demo .face {
  fill: var(--face);
}
.gauge-demo .well {
  fill: var(--face-raised);
}
.gauge-demo .normal-ring {
  fill: none;
  stroke: var(--face-line);
  stroke-width: 2;
}
.gauge-demo .warn-ring {
  fill: none;
  stroke: #e4e8ed;
  stroke-width: 2.5;
  stroke-dasharray: 7 6;
}
.gauge-demo .disc {
  fill: var(--face-calm);
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--level, 0.72));
}
.gauge-demo.carrying .disc {
  fill: var(--face-carry);
}
.gauge-demo figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1rem;
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--calm);
  min-height: 2em;
}
.gauge-demo.carrying figcaption {
  color: var(--carry);
}
/* Shape carries the state as well as colour, as in the app: circle, then triangle. */
.state-mark {
  width: 0.8em;
  height: 0.8em;
  background: currentColor;
  border-radius: 50%;
}
.gauge-demo.carrying .state-mark {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 90%, 0 90%);
}

/* ---- buttons ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-top: 1.75rem;
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.3rem;
  border-radius: 0.6rem;
  border: 2px solid var(--calm);
  background: var(--calm);
  color: var(--bg);
  text-decoration: none;
  cursor: pointer;
}
.button:hover {
  filter: brightness(1.08);
}
.button.secondary {
  background: transparent;
  color: var(--calm);
}
.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ---- content sections ---- */

.section {
  padding: 3.5rem 0 0;
}
.section > .wrap > h2 {
  margin-bottom: 1rem;
}
.page-title {
  padding-top: 2.5rem;
}
.page-title p {
  font-size: var(--step-1);
  color: var(--muted);
  line-height: 1.45;
}

/* The three steps really are a sequence, so they are numbered. */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem 3rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  border-top: 2px solid var(--line);
  padding-top: 1rem;
}
.steps li::before {
  content: counter(step);
  display: block;
  font-weight: 600;
  font-size: var(--step-2);
  color: var(--calm);
  line-height: 1;
  margin-bottom: 0.6rem;
}
.steps h3 {
  margin-bottom: 0.4rem;
}
.steps p {
  color: var(--muted);
  margin: 0;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 17rem));
  gap: 2rem;
  margin: 0;
}
.shots figure {
  margin: 0;
}
.shots img {
  border-radius: 0.75rem;
  border: 1px solid var(--line);
}
.shots figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: var(--step--1);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem 4rem;
}

.prose h2 {
  margin-top: 2.5rem;
}
.prose li {
  margin-bottom: 0.4em;
}
.muted {
  color: var(--muted);
}

/* ---- pricing ---- */

.price-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 46rem;
  margin: 1rem 0 0.75rem;
}
.price-table th,
.price-table td {
  text-align: left;
  padding: 1.1rem 1rem 1.1rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.price-table thead th {
  font-size: var(--step--1);
  color: var(--muted);
  font-weight: 400;
  padding-bottom: 0.5rem;
}
.price-table tbody th {
  font-weight: 600;
}
.price-table .price {
  font-weight: 600;
  font-size: var(--step-1);
  white-space: nowrap;
}

/* ---- downloads ---- */

.downloads {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  max-width: 46rem;
}
.downloads li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.downloads li.this-computer {
  border-bottom-color: var(--calm);
}
.downloads .platform {
  font-weight: 600;
  font-size: var(--step-1);
}
.downloads .note {
  display: block;
  font-weight: 400;
  font-size: var(--step--1);
  color: var(--muted);
}

/* ---- forms ---- */

.form {
  max-width: 34rem;
  margin-top: 1.5rem;
}
.field {
  margin-bottom: 1.25rem;
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--step--1);
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1.5px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
}
.field textarea {
  min-height: 9rem;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--calm);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--calm) 30%, transparent);
}
/* Bots fill this in; people never see it. */
.trap {
  position: absolute;
  left: -100vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-status {
  margin-top: 1rem;
  min-height: 1.5em;
}
.form-status.error {
  color: var(--carry);
}
.form-status.done {
  color: var(--calm);
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  .gauge-demo .disc {
    transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1), fill 0.3s ease;
  }
}

/* A page's first section follows straight on from its title. */
.page-title + .section {
  padding-top: 0.5rem;
}
