/* /challenges/ only: the symptom walk beside the sticky knots, the order split,
   the four questions as a raised table crossing into the band below, the closing statement.
   Owner: ux-designer builder C. Shared components come from layout.css. */

/* ---- 1. symptoms: ruled walk beside the sticky knot line (navy) ---------- */
/* the heading, the knots and the list share one grid: the knots start beside the heading, on the first screen */
.ails { display: grid; gap: var(--space-6); }
.ails__head { max-inline-size: 40rem; }
.ails__figure { order: 1; }
.ails__list { order: 2; }
.ails__sticky { position: relative; color: var(--mark); }
/* the knot figure's slot keeps its drawing's proportion (420x600) before and after the moment lands */
.ails__sticky { aspect-ratio: 420 / 600; max-inline-size: 420px; }

.ails__list { border-block-start: 3px solid var(--text); }
.ail {
  display: grid;
  gap: var(--space-3);
  padding-block: var(--space-6);
  border-block-end: 1px solid var(--rule);
  position: relative;
}
/* the step's own rule: turns teal as the knot beside it straightens */
.ail::before {
  content: "";
  position: absolute;
  inset-block-start: -1px;
  inset-inline-start: 0;
  inline-size: 64px;
  block-size: 3px;
  background-color: var(--rule);
  transition: background-color var(--dur-layout, 240ms) var(--ease-standard, ease),
              inline-size var(--dur-layout, 240ms) var(--ease-standard, ease);
}
.ail:first-child::before { display: none; }
.ail.is-passed::before { background-color: var(--mark); }
.ail__name { font-size: clamp(1.5rem, 1.2rem + 0.8vw, 1.875rem); line-height: 1.2; }
.ail__how { color: var(--text-2); max-inline-size: 40rem; }
.ail__cost {
  max-inline-size: 40rem;
  padding-inline-start: var(--space-4);
  border-inline-start: 3px solid var(--mark);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-weight: 600;
}
.ail__label { color: var(--mark); font-weight: 700; }
.ail__fix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-block-start: var(--space-2);
}
.ail__fix .ail__label { color: var(--text-2); }
.ail:target .ail__name { color: var(--mark); }

/* below 1024px the knot figure has no column to stand beside the list, so it is hidden and each symptom carries its
   own knot from the same drawing: it unwinds into the line that runs to the service button beside it as the symptom
   scrolls past (motion.js sequences marks .is-passed and the scope .mo-steps-live). At rest, with no script or with
   reduced motion, the line and its arrow are drawn and the knot is gone, as in the figure's own rest. */
.ail__glyph { display: none; }
@media (max-width: 1023.98px) {
  .ails__figure { display: none; }
  .ail__fix { display: grid; grid-template-columns: minmax(56px, 104px) auto; justify-content: start; }
  .ail__fix .ail__label { grid-column: 1 / -1; }
  .ail__glyph { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
}
.ail__glyph .g-node { fill: var(--text-2); }
.ail__glyph .g-knot { fill: none; stroke: var(--text-2); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: -1.02; }
.ail__glyph .g-line { fill: none; stroke: var(--mark); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 2; stroke-dashoffset: 0; }
.ail__glyph .g-head { fill: var(--mark); }
.mo-steps-live .ail__glyph .g-knot { transition: stroke-dashoffset var(--dur-authored) var(--ease-standard); }
.mo-steps-live .ail__glyph .g-line { transition: stroke-dashoffset var(--dur-authored) var(--ease-arrive); }
.mo-steps-live .ail__glyph .g-head { transition: opacity 0s linear calc(var(--dur-authored) * .55); }
.mo-steps-live .ail:not(.is-passed) .ail__glyph .g-knot { stroke-dashoffset: 0; }
.mo-steps-live .ail:not(.is-passed) .ail__glyph .g-line { stroke-dashoffset: 1.02; }
.mo-steps-live .ail:not(.is-passed) .ail__glyph .g-head { opacity: 0; transition-delay: 0s; }

.ails__end { align-items: center; gap: var(--space-4) var(--space-5); }
.ails__end-line { font-size: var(--t-lead); font-weight: 600; }

@media (min-width: 1024px) {
  .ails { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
  .ails__head { grid-column: 1 / span 7; grid-row: 1; }
  .ails__list { grid-column: 1 / span 7; grid-row: 2; order: 0; }
  .ails__figure { grid-column: 9 / span 4; grid-row: 1 / span 2; order: 0; align-self: stretch; }
  .ails__sticky { position: sticky; inset-block-start: calc(var(--head-h) + var(--space-7)); }
  .ail { padding-block: var(--space-5); }
}

/* ---- 2. what comes first: heading held beside the method (white) -------- */
.order__grid { display: grid; gap: var(--space-5) var(--gutter); }
.order__title { max-inline-size: 16ch; }
.order__lead { font-size: var(--t-lead); line-height: 1.6; font-weight: 600; max-inline-size: 40rem; }
.order__body {
  margin-block-start: var(--space-5);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--rule);
  color: var(--text-2);
  max-inline-size: 40rem;
}
@media (min-width: 1024px) {
  .order__grid { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
  .order__title { grid-column: 1 / span 5; }
  .order__text { grid-column: 7 / span 6; padding-block-start: var(--space-3); }
}

/* ---- 3. the four questions: one raised table crossing into the paper band */
main > .ask { padding-block-end: 0; }
.ask__panel {
  position: relative;
  z-index: 2;
  margin-block: var(--space-7) calc(-1 * var(--space-8));
  padding: var(--space-5) var(--space-5) var(--space-3);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-raised);
}
.ask__table { inline-size: 100%; border-collapse: collapse; }
.ask__caption {
  caption-side: top;
  padding-block-end: var(--space-4);
  text-align: start;
  color: var(--text-2);
  font-weight: 700;
  font-size: 1rem;
}
.ask__table thead th {
  padding-block: 0 var(--space-3);
  border-block-end: 3px solid var(--text);
  text-align: start;
  color: var(--text-2);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--face-text);
}
.ask__table tbody th,
.ask__table tbody td {
  padding-block: var(--space-4);
  border-block-end: 1px solid var(--rule);
  text-align: start;
  vertical-align: baseline;
}
.ask__table tbody tr:last-child th,
.ask__table tbody tr:last-child td { border-block-end: 0; }
.ask__table tbody th {
  padding-inline-end: var(--space-4);
  inline-size: 42%;
  font-family: var(--face-display);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.3;
}
.ask__table tbody td { font-size: 1.125rem; line-height: 1.5; font-weight: 600; color: var(--text); }
@media (min-width: 900px) {
  .ask__panel { padding: var(--space-6) var(--space-7) var(--space-5); margin-block-end: calc(-1 * var(--space-9)); }
  .ask__table tbody th, .ask__table tbody td { padding-block: var(--space-5); }
  .ask__table tbody th { font-size: 1.625rem; inline-size: 40%; }
  .ask__table tbody td { font-size: var(--t-lead); }
}

/* ---- 4. why the order matters: the closing statement on paper ----------- */
main > .why { padding-block-start: calc(var(--section-pad) + var(--space-8)); }
.why__grid { display: grid; gap: var(--space-5) var(--gutter); }
.why__title {
  font-size: clamp(2.125rem, 1.2rem + 2.6vw, 3.5rem);
  max-inline-size: 22ch;
  padding-inline-start: var(--space-5);
  border-inline-start: 6px solid var(--mark);
}
.why__lead { color: var(--text-2); font-size: var(--t-lead); line-height: 1.6; max-inline-size: 40rem; }
@media (min-width: 900px) {
  main > .why { padding-block-start: calc(var(--section-pad) + var(--space-9)); }
}
@media (min-width: 1024px) {
  .why__grid { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; }
  .why__title { grid-column: 1 / span 7; }
  .why__lead { grid-column: 8 / span 5; }
}
