:root {
  --bg: #e6ebee;
  --surface: #ffffff;
  --ink: #15212c;
  --muted: #566573;
  --line: #c9d2d9;
  --charge: #23a064;
  --charge-dark: #16784a;
  --danger: #c23b2a;
  --radius: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 16px;
  display: grid;
  gap: 48px;
  align-items: start;
}

@media (min-width: 900px) {
  .page {
    grid-template-columns: 1fr 480px;
    gap: 72px;
    padding-top: 96px;
  }
  .intro { position: sticky; top: 96px; }
}

/* Intro */

.brand {
  margin: 0 0 24px;
  font-weight: 700;
  color: var(--charge-dark);
}

h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.lead {
  margin: 24px 0 32px;
  max-width: 38ch;
  font-size: 1.2rem;
  color: var(--muted);
}

.services {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 46ch;
  border-top: 1px solid var(--line);
}

.services li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.services strong { color: var(--ink); font-weight: 600; }

/* Ticket */

.ticket {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px 32px;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -32px rgba(21, 33, 44, .45);
}

/* Perforated tear-off edge, like a repair ticket */
.ticket::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: -6px;
  height: 12px;
  background: radial-gradient(circle at 6px 6px, var(--bg) 5px, transparent 5.5px) 0 0 / 18px 12px repeat-x;
}

@media (min-width: 520px) {
  .ticket { padding: 32px 36px 36px; }
}

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px dashed var(--line);
}

.ticket-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-stretch: 108%;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Battery that charges as the form progresses */
.battery {
  position: relative;
  width: 34px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 2px;
}

.battery::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 4px;
  width: 3px;
  height: 4px;
  background: var(--ink);
  border-radius: 0 2px 2px 0;
}

.battery-fill {
  display: block;
  height: 100%;
  width: 50%;
  border-radius: 1px;
  background: var(--charge);
  transition: width .7s var(--ease);
}

.ticket[data-progress="2"] .battery-fill { width: 100%; }

/* Form */

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 20px;
  font-size: 1.5rem;
  font-weight: 700;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.step.is-entering { animation: step-in .45s var(--ease) both; }
.step.is-entering.from-left { animation-name: step-in-left; }

@keyframes step-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

@keyframes step-in-left {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}

.row {
  display: grid;
  gap: 0 16px;
}

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

.field { margin-bottom: 18px; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: .95rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: #f6f8f9;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}

textarea { display: block; resize: vertical; min-height: 120px; }

input::placeholder,
textarea::placeholder { color: #8b97a2; }

input:hover,
textarea:hover { border-color: #a9b5be; }

input:focus,
textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--charge);
  box-shadow: 0 0 0 4px rgba(35, 160, 100, .18);
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

.error {
  margin: 0;
  max-height: 0;
  overflow: hidden;
  font-size: .9rem;
  color: var(--danger);
  opacity: 0;
  transition: max-height .25s var(--ease), opacity .25s, margin .25s;
}

.field.is-invalid input,
.field.is-invalid textarea { border-color: var(--danger); }

.field.is-invalid input:focus,
.field.is-invalid textarea:focus { box-shadow: 0 0 0 4px rgba(194, 59, 42, .15); }

.field.is-invalid .error {
  max-height: 3em;
  margin-top: 6px;
  opacity: 1;
}

.field.shake { animation: shake .4s; }

@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.form-error {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fbecea;
  color: var(--danger);
  font-size: .95rem;
}

/* Buttons */

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  position: relative;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 13px 22px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, transform .15s;
}

.btn:active { transform: scale(.97); }

.btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover { background: #2a3a48; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  margin-right: auto;
}

.btn-ghost:hover { background: #eef2f4; }

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
}

.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-text { visibility: hidden; }
.btn.is-loading .spinner { opacity: 1; animation: spin .7s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Success */

.done {
  text-align: center;
  padding: 24px 0 8px;
  outline: none;
  animation: step-in .45s var(--ease) both;
}

.done h2 {
  margin: 16px 0 8px;
  font-size: 1.5rem;
  font-stretch: 108%;
}

.done p { margin: 0 auto; max-width: 30ch; color: var(--muted); }
.done strong { color: var(--ink); white-space: nowrap; }

.check {
  width: 64px;
  height: 64px;
  fill: none;
  stroke: var(--charge);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw .6s var(--ease) forwards;
}

.check path {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: draw .35s .5s var(--ease) forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}
