:root {
  --ink: #15372a;
  --moss: #46664f;
  --paper: #ffffff;
  --wash: #f1f6ea;
  --field: #cfe5b0;
  --stripe: #c3dba0;
  --shep: #f0601e;
  --fleece: #ffffff;
  --rule: #d3dfc8;
  --bubble-out: #0a84ff;
  --bubble-in: #e9e9eb;
  --bubble-in-text: #000000;
  --danger: #b3261e;
  --pen-floor-opacity: 0.45;
  --display: "Zilla Slab", Rockwell, Georgia, serif;
  --text: "Lexend", system-ui, sans-serif;
  --bubble-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4eee6;
    --moss: #a8bfb1;
    --paper: #0f1c16;
    --wash: #15261d;
    --field: #1e3a2a;
    --stripe: #22422f;
    --shep: #ff7a3d;
    --fleece: #f4f7f2;
    --rule: #2b4436;
    --bubble-in: #3a3a3c;
    --bubble-in-text: #ffffff;
    --danger: #ff8a80;
    --pen-floor-opacity: 0.1;
  }
}

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

[hidden] {
  display: none !important;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--text);
}

svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

h1,
h2,
h3,
legend {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  margin: 0;
}

.wrap {
  width: min(100% - 40px, 1080px);
  margin-inline: auto;
}

.narrow > * {
  max-width: 660px;
}

/* Hero: a morning training field */

.hero {
  background: var(--field);
  padding: 20px 0 56px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 44px;
}

.wordmark {
  font: 700 30px/1 var(--display);
  text-decoration: none;
}

.audience {
  font-size: 16px;
  color: var(--moss);
}

.hero-grid {
  display: grid;
  gap: 40px;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 56px;
  }
}

.greeting {
  font: 700 24px/1.2 var(--display);
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(46px, 11vw, 76px);
  line-height: 0.98;
  max-width: 9ch;
}

.lede {
  font-size: 20px;
  max-width: 34ch;
  margin: 22px 0 28px;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 19px/1 var(--text);
  text-decoration: none;
}

.cta:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--paper));
}

.cta-note {
  font-size: 16px;
  color: var(--moss);
  max-width: 40ch;
  margin: 14px 0 0;
}

/* Herding illustration. The default state is the finished picture; app.js
   rewinds it to the start and plays the run once. */

.herd-figure {
  margin: 0;
}

.herd {
  width: 100%;
  height: auto;
}

.herd .stripe-a {
  fill: var(--field);
}

.herd .stripe-b {
  fill: var(--stripe);
}

.herd .boundary {
  fill: none;
  stroke: var(--fleece);
  stroke-width: 2.5;
}

.herd .pen-floor {
  fill: var(--fleece);
  opacity: var(--pen-floor-opacity);
}

.herd .pen {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.herd .trail {
  fill: none;
  stroke: var(--shep);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.herd .sheep circle {
  fill: var(--fleece);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.herd text {
  font-family: var(--text);
  font-size: 13px;
  fill: var(--ink);
}

.herd .pen-label,
.herd .shep-dot text {
  font-weight: 600;
}

.herd .shep-dot circle {
  fill: var(--shep);
  stroke: var(--fleece);
  stroke-width: 2.5;
}

.herd .due-1 {
  transform: translate(116px, -14px);
}

.herd .due-2 {
  transform: translate(152px, -18px);
}

.herd .due-3 {
  transform: translate(106px, -10px);
}

.herd .shep-dot {
  transform: translate(34px, 108px);
}

.herd.ready .due,
.herd.ready .shep-dot {
  transform: none;
}

.herd.ready .shep-dot {
  opacity: 0;
}

/* Hidden as well as rewound: a round cap would otherwise leave a dot. */
.herd.ready .trail {
  stroke-dashoffset: 1;
  opacity: 0;
}

.herd.ready.play .trail {
  opacity: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.7s cubic-bezier(0.45, 0, 0.25, 1);
}

.herd.ready.play .shep-dot {
  opacity: 1;
}

.herd.ready.play .due {
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.herd.ready.play .due-1 {
  transform: translate(116px, -14px);
  transition-delay: 1.75s;
}

.herd.ready.play .due-2 {
  transform: translate(152px, -18px);
  transition-delay: 1.87s;
}

.herd.ready.play .due-3 {
  transform: translate(106px, -10px);
  transition-delay: 1.99s;
}

.herd-figure figcaption {
  margin-top: 14px;
  font: 700 19px/1.2 var(--display);
}

/* Sections */

.section {
  padding: 72px 0;
}

.section-tight {
  padding-top: 24px;
}

.section h2 {
  font-size: clamp(32px, 6vw, 42px);
  margin-bottom: 12px;
}

.section-intro {
  color: var(--moss);
  max-width: 46ch;
  margin: 0 0 8px;
}

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 36px 0 0;
  display: grid;
  gap: 30px;
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 16px;
  align-content: start;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font: 700 20px/1 var(--display);
}

.steps h3 {
  font-size: 23px;
  margin: 9px 0 6px;
}

.steps p {
  margin: 0;
  color: var(--moss);
  max-width: 38ch;
}

/* Phone mockups */

.phones {
  display: grid;
  gap: 32px;
  margin-top: 28px;
}

@media (min-width: 760px) {
  .phones {
    grid-template-columns: repeat(2, minmax(0, 380px));
    align-items: start;
  }
}

.phone {
  margin: 0;
}

.phone-label {
  font: 700 19px/1.2 var(--display);
  margin-bottom: 12px;
}

.screen {
  max-width: 380px;
  border: 1.5px solid var(--rule);
  border-radius: 34px;
  padding: 18px 14px 22px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thread-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rule);
  color: var(--ink);
  font: 600 18px/1 var(--text);
}

.avatar-shep {
  background: var(--shep);
  color: #15372a;
}

.thread-name {
  font-size: 14px;
  font-weight: 600;
}

.stamp {
  font: 12px/1.3 var(--bubble-font);
  color: var(--moss);
  text-align: center;
  margin: 8px 0 2px;
}

.bubble {
  max-width: 84%;
  margin: 0;
  padding: 8px 13px;
  border-radius: 19px;
  font: 15px/1.4 var(--bubble-font);
}

.bubble.in {
  align-self: flex-start;
  background: var(--bubble-in);
  color: var(--bubble-in-text);
}

.bubble.out {
  align-self: flex-end;
  background: var(--bubble-out);
  color: #ffffff;
}

.send-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.send-chip {
  padding: 5px 11px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--bubble-out);
  font-size: 14px;
  font-weight: 600;
}

.voice {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wave {
  display: flex;
  align-items: center;
  gap: 3px;
}

.wave i {
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
}

.wave i:nth-child(2n) {
  height: 17px;
}

.wave i:nth-child(3n) {
  height: 7px;
}

/* Good to know */

.notes {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  border-top: 1px solid var(--rule);
}

.notes li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

/* Questions */

.ask {
  background: var(--wash);
}

.question {
  border: 0;
  margin: 0;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
}

#take > .question:first-child {
  margin-top: 24px;
}

.question legend {
  float: left;
  width: 100%;
  padding: 0;
  font-size: 23px;
  line-height: 1.2;
}

.hint {
  clear: both;
  font-size: 16px;
  color: var(--moss);
  margin: 0;
  padding-top: 4px;
}

.choices {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
}

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-size: 17px;
  line-height: 1.2;
}

.choice input:checked + span {
  background: var(--ink);
  color: var(--paper);
}

.choice input:checked + span::before {
  content: "✓";
  margin-right: 8px;
  font-weight: 600;
}

.choice input:focus-visible + span {
  outline: 3px solid var(--shep);
  outline-offset: 2px;
}

.question.has-error legend {
  color: var(--danger);
}

.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 16px;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 6px;
}

.field + .field {
  margin-top: 22px;
}

.field label {
  font-weight: 600;
}

.field .hint {
  padding-top: 0;
}

textarea,
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  color: inherit;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.send {
  width: 100%;
  min-height: 60px;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 20px/1 var(--text);
  cursor: pointer;
}

.send:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--paper));
}

.send:disabled {
  cursor: progress;
}

@media (min-width: 640px) {
  .send {
    width: auto;
    padding: 0 40px;
  }
}

.status {
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 600;
}

.status:empty {
  margin: 0;
}

.thanks {
  padding-top: 8px;
}

.thanks:focus {
  outline: none;
}

.thanks p {
  margin: 12px 0 0;
  max-width: 44ch;
}

.foot {
  padding: 40px 0 56px;
  color: var(--moss);
  font-size: 16px;
}

.foot p {
  margin: 0;
}
