/* ==========================================================================
   Foster sign-up

   Palette "Porch Light" -- the light left on for someone bringing an animal
   home after dark. Warm oat paper, a deep mulberry panel, and one marigold
   that only ever means "progress" or "focus". Reasoning is in the README.

   Contrast, measured not guessed:
     ink on paper          14.0:1
     ink-soft on paper      5.7:1
     white on plum          9.4:1
     marigold-bright/plum   4.6:1
     alert on surface       6.8:1
   Marigold on light is 3.3:1, which is enough for a focus ring and a rail
   fill and not enough for text, so it is never used for text.
   ========================================================================== */

:root {
  --paper:        #F5F1E8;
  --surface:      #FFFDF8;
  --surface-sunk: #FAF6EE;
  --ink:          #2A2320;
  --ink-soft:     #6B5C52;
  --line:         #E4DACA;
  --line-strong:  #CFC1AC;

  --plum:         #6E3350;
  --plum-deep:    #522540;
  --plum-tint:    #F3E7ED;

  --marigold:        #C97E14;
  --marigold-bright: #E9A93C;
  --marigold-wash:   #FBF0DC;

  --pine:  #3E6B58;
  --alert: #A32F3C;
  --alert-wash: #FBEDEE;

  /* Rounded where the OS has a rounded face, humanist everywhere else. The
     identity here is carried by colour and the rail, not by a downloaded
     typeface -- no third-party font requests, by design. */
  --font-display: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display",
                  "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
                  "Helvetica Neue", Arial, sans-serif;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(42, 35, 32, .05), 0 12px 32px -12px rgba(42, 35, 32, .18);
  --tap:       46px;
}

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

/* Every step, the file chip, and the done panel are toggled with the hidden
   attribute. Any `display` rule below would silently beat the UA stylesheet's
   [hidden] and leave the element on screen, so settle it once, here. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  padding: 0 0 3rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;      /* 17px floor; also stops iOS zooming inputs */
  line-height: 1.55;
}

h1, h2, .rail__heading, .btn, .done__title {
  font-family: var(--font-display);
  letter-spacing: -.011em;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--plum);
  color: #fff;
  padding: .75rem 1.25rem;
  z-index: 10;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The honeypot. Off-canvas rather than display:none, because some bots skip
   fields that are outright hidden. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Test-site banner.

   Loud on purpose. Someone is about to be asked for their name, email and phone
   number, so the warning has to survive being skim-read on a phone. It sits
   above everything, is not dismissible, and uses the one colour the rest of the
   page reserves for "pay attention" -- turned up to a solid fill, which nothing
   else on the page does.
   ========================================================================== */

.testbar {
  background: #6A3A05;          /* deep marigold; 8.9:1 against white text */
  color: #FFF6E6;
  border-bottom: 3px solid var(--marigold-bright);
}

.testbar__inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: .875rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .875rem;
  align-items: start;
}

.testbar__icon { flex: none; color: var(--marigold-bright); margin-top: .1rem; }

.testbar__title {
  margin: 0 0 .25rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.testbar__body {
  margin: 0;
  font-size: .9375rem;
  line-height: 1.5;
  color: #F3E2C8;
}

@media (max-width: 30rem) {
  .testbar__inner { padding: .75rem .875rem; gap: .625rem; }
  .testbar__title { font-size: 1rem; }
  .testbar__body { font-size: .875rem; }
}

/* --- masthead ----------------------------------------------------------- */

.masthead {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  text-align: center;
}
.masthead__eyebrow {
  margin: 0 0 .25rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--marigold);
}
.masthead__name {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.125rem);
  font-weight: 700;
  color: var(--plum-deep);
}

/* --- shell -------------------------------------------------------------- */

.shell {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 19rem 1fr;
  align-items: stretch;
  border-radius: var(--radius);
}

.rail, .panel {
  /* The two halves share one card; the radius lives on the outer corners. */
  box-shadow: var(--shadow);
}

/* ==========================================================================
   The progress rail -- the one element meant to be memorable.
   ========================================================================== */

.rail {
  background: linear-gradient(163deg, var(--plum) 0%, var(--plum-deep) 100%);
  color: #fff;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 2.25rem 1.5rem;
}

.rail__heading {
  margin: 0 0 1.75rem;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
}

.rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rail;
}

.rail__step {
  position: relative;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .875rem;
  align-items: center;
  min-height: 3.5rem;
  padding-bottom: .25rem;
}

/* The connector. Each step draws the segment above itself, so the run of
   filled segments is exactly the run of completed steps. */
.rail__step + .rail__step::before {
  content: "";
  position: absolute;
  left: .9375rem;
  bottom: 100%;
  width: 2px;
  height: 1.5rem;
  background: rgba(255, 255, 255, .22);
  transform: scaleY(1);
  transform-origin: top;
  transition: background .35s ease;
}
.rail__step.is-done::before,
.rail__step.is-current::before { background: var(--marigold-bright); }

.rail__marker {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 2px solid rgba(255, 255, 255, .38);
  color: rgba(255, 255, 255, .72);
  background: transparent;
  transition: background .25s ease, border-color .25s ease, color .25s ease,
              box-shadow .25s ease;
}

.rail__label {
  font-size: .9375rem;
  color: rgba(255, 255, 255, .74);
  transition: color .25s ease;
}

.rail__step.is-done .rail__marker {
  background: var(--marigold-bright);
  border-color: var(--marigold-bright);
  color: var(--plum-deep);
  /* The tick is drawn, not a glyph, so it cannot go missing with a font. */
  font-size: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23522540' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 1rem 1rem;
  background-repeat: no-repeat;
  background-position: center;
}
.rail__step.is-done .rail__label { color: rgba(255, 255, 255, .9); }

.rail__step.is-current .rail__marker {
  background: #fff;
  border-color: #fff;
  color: var(--plum-deep);
  box-shadow: 0 0 0 5px rgba(233, 169, 60, .32);
}
.rail__step.is-current .rail__label {
  color: #fff;
  font-weight: 600;
}

.rail__count {
  margin: 1.75rem 0 0;
  font-size: .875rem;
  color: rgba(255, 255, 255, .68);
}

/* --- panel -------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 2.25rem 2.25rem 2rem;
  min-width: 0;
}

.loading { color: var(--ink-soft); padding: 2rem 0; }

.step__title {
  margin: 0 0 .5rem;
  font-size: 1.4375rem;
  font-weight: 700;
  line-height: 1.25;
}
/* Focused programmatically on each step change so screen readers announce the
   new heading. It is not a control, so it should not look like one. */
.step__title:focus, .done:focus { outline: none; }
.step__hint {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-size: .96875rem;
}

/* --- fields ------------------------------------------------------------- */

.field { margin: 0 0 1.375rem; border: 0; padding: 0; min-width: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

label, .label-ish, legend {
  display: block;
  margin: 0 0 .375rem;
  font-weight: 600;
  font-size: .9375rem;
  color: var(--ink);
  padding: 0;
}

/* Choices are labels too, but their text is a sentence to read rather than a
   name to scan. Semi-bold on eleven long descriptions is a wall. */
.choice, .help-item, .consent { font-weight: 400; margin-bottom: 0; }

.optional {
  font-weight: 400;
  font-size: .8125rem;
  color: var(--ink-soft);
}

input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: .625rem .875rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface-sunk);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, background .15s ease;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }

select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B5C52' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .875rem center;
  background-size: 1.125rem;
}

input:hover, select:hover, textarea:hover { border-color: var(--ink-soft); }

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, [type="file"]:focus-visible + .file-button {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
  border-color: var(--plum);
  background: var(--surface);
}

.field-hint {
  margin: .375rem 0 0;
  font-size: .875rem;
  color: var(--ink-soft);
}

.field-error, .form-error {
  margin: .375rem 0 0;
  font-size: .875rem;
  font-weight: 500;
  color: var(--alert);
}
.field-error:empty { display: none; }

.form-error {
  margin: 0 0 1.25rem;
  padding: .875rem 1rem;
  background: var(--alert-wash);
  border-left: 3px solid var(--alert);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.is-invalid { border-color: var(--alert) !important; background: var(--alert-wash); }

.notice {
  padding: 1rem 1.125rem;
  border-radius: var(--radius-sm);
  margin: 0 0 1.5rem;
}
.notice--warn { background: var(--marigold-wash); border-left: 3px solid var(--marigold); }
.notice p { margin: 0; }

/* --- choices ------------------------------------------------------------ */

.choice-list { display: grid; gap: .625rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: .625rem; }

.choice {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: var(--tap);
  padding: .625rem 1rem;
  background: var(--surface-sunk);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--plum); }
.choice input { accent-color: var(--plum); width: 1.15rem; height: 1.15rem; margin: 0; flex: none; }
.choice:has(input:checked) { border-color: var(--plum); background: var(--plum-tint); }
.choice:has(input:focus-visible) { outline: 3px solid var(--marigold); outline-offset: 2px; }
.choice-row .choice { flex: 1 1 8rem; }

/* species toggles */
.species {
  display: flex;
  gap: .875rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.species-toggle {
  flex: 1 1 9rem;
  display: grid;
  justify-items: center;
  gap: .5rem;
  padding: 1.125rem .75rem;
  background: var(--surface-sunk);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease;
}
.species-toggle:hover { border-color: var(--plum); }
.species-toggle:has(input:checked) {
  border-color: var(--plum);
  background: var(--plum-tint);
  color: var(--plum-deep);
}
.species-toggle:has(input:focus-visible) { outline: 3px solid var(--marigold); outline-offset: 2px; }
.species-toggle input { accent-color: var(--plum); width: 1.15rem; height: 1.15rem; }
.species-toggle svg { color: var(--plum); }

.size-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.25rem; }
.size-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.size-group > div { display: grid; gap: .5rem; }
.size-group[hidden] { display: none; }

/* the eleven ways to help */
.help-list { display: grid; gap: .625rem; }
.help-item {
  display: grid;
  grid-template-columns: 1.15rem 1fr;
  gap: .875rem;
  align-items: start;
  padding: .875rem 1rem;
  background: var(--surface-sunk);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .96875rem;
  line-height: 1.45;
  transition: border-color .15s ease, background .15s ease;
}
.help-item:hover { border-color: var(--plum); }
.help-item:has(input:checked) { border-color: var(--plum); background: var(--plum-tint); }
.help-item:has(input:focus-visible) { outline: 3px solid var(--marigold); outline-offset: 2px; }
.help-item input { accent-color: var(--plum); width: 1.15rem; height: 1.15rem; margin: .15rem 0 0; }

/* --- file attach -------------------------------------------------------- */

.file-button {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--tap);
  margin: .25rem 0 0;
  padding: .625rem 1.125rem;
  background: var(--surface);
  border: 1.5px solid var(--plum);
  border-radius: var(--radius-sm);
  color: var(--plum);
  font-weight: 600;
  font-size: .9375rem;
  cursor: pointer;
}
.file-button:hover { background: var(--plum-tint); }

.file-chosen {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: .625rem 0 0;
  font-size: .9375rem;
  color: var(--ink-soft);
}
.link-button {
  background: none;
  border: 0;
  padding: .25rem;
  font: inherit;
  font-weight: 600;
  color: var(--plum);
  text-decoration: underline;
  cursor: pointer;
}

/* --- consents ----------------------------------------------------------- */

.consents { margin-top: 1.75rem; display: grid; gap: 1rem; }
.consent {
  display: grid;
  grid-template-columns: 1.15rem 1fr;
  gap: .875rem;
  align-items: start;
  font-weight: 400;
  font-size: .96875rem;
  line-height: 1.5;
  cursor: pointer;
  margin: 0;
}
.consent input { accent-color: var(--plum); width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; }
.consent a { color: var(--plum); font-weight: 600; }
.consent__fine {
  display: block;
  margin-top: .375rem;
  font-size: .8125rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* --- actions ------------------------------------------------------------ */

.actions {
  display: flex;
  gap: .875rem;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.btn {
  min-height: var(--tap);
  padding: .625rem 1.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn--primary { background: var(--plum); color: #fff; margin-left: auto; }
.btn--primary:hover:not(:disabled) { background: var(--plum-deep); }
.btn--primary:disabled { opacity: .42; cursor: not-allowed; }
.btn--quiet { background: transparent; color: var(--plum); border-color: var(--line-strong); }
.btn--quiet:hover { border-color: var(--plum); background: var(--plum-tint); }

/* --- done --------------------------------------------------------------- */

.done { padding: 1rem 0 .5rem; }
.done__mark {
  width: 3.5rem; height: 3.5rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pine);
  color: #fff;
  margin-bottom: 1.25rem;
}
.done__title { margin: 0 0 .625rem; font-size: 1.625rem; font-weight: 700; }
.done__lede { margin: 0 0 1.5rem; color: var(--ink-soft); }
.done__next { margin: 0 0 1.5rem; padding-left: 1.25rem; display: grid; gap: .5rem; }
.done__ref { margin: 0; font-size: .875rem; color: var(--ink-soft); }

/* --- footer ------------------------------------------------------------- */

.footer {
  max-width: 62rem;
  margin: 2rem auto 0;
  padding: 0 1.25rem;
  text-align: center;
  font-size: .875rem;
  color: var(--ink-soft);
}
.footer p { margin: 0; }

/* ==========================================================================
   Narrow screens. The rail turns into a horizontal strip and keeps its
   identity -- the markers and the marigold fill survive, the labels do not.
   ========================================================================== */

@media (max-width: 56rem) {
  body { padding-bottom: 2rem; }
  .masthead { padding: 1.75rem 1rem 1rem; }
  .shell { grid-template-columns: 1fr; padding: 0 1rem; }

  .rail {
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem 1.25rem 1.125rem;
    box-shadow: none;
  }
  .rail__heading { display: none; }

  .rail__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: center;
  }
  .rail__step {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 0;
    padding: 0;
  }
  .rail__label { display: none; }

  /* connector runs left now, not up */
  .rail__step + .rail__step::before {
    left: auto;
    right: 50%;
    bottom: auto;
    top: 50%;
    width: calc(100% - 2rem);
    height: 2px;
    transform: translate(-1rem, -1px);
  }

  .rail__count {
    margin: .875rem 0 0;
    text-align: center;
    color: #fff;
    font-weight: 600;
  }

  .panel {
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 1.5rem 1.25rem 1.5rem;
  }
  .step__title { font-size: 1.3125rem; }
}

@media (max-width: 30rem) {
  .grid-2, .size-groups { grid-template-columns: 1fr; }
  .shell, .masthead, .footer { padding-left: .75rem; padding-right: .75rem; }
  .panel { padding: 1.25rem 1rem 1.25rem; }
  .actions { gap: .625rem; }
  .btn { padding: .625rem 1.125rem; flex: 1 1 auto; }
  .btn--primary { margin-left: 0; }
  .species { gap: .625rem; }
  .rail__marker { width: 1.75rem; height: 1.75rem; font-size: .8125rem; }
  .rail__step + .rail__step::before { width: calc(100% - 1.75rem); transform: translate(-.875rem, -1px); }
}

/* ==========================================================================
   Reduced motion. Nothing here is load-bearing, so it all just stops.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  input[type="text"], input[type="email"], input[type="tel"], select, textarea,
  .choice, .help-item, .species-toggle { border-width: 2px; border-color: var(--ink); }
}
