/* ------------------------------------------------------------------------
   Automation Readiness intake.

   Loaded only on /readiness and /blueprint, so the rest of the site does not
   carry it. Builds on .si-form in style.css rather than restating it; only
   the parts the contact form never needed (option lists, per-field errors,
   progress, the confirmation panel, the Forms embed) live here.

   Mobile first. Every rule below is the small-screen rule; the single
   media query at the bottom is the only place a wider layout is described.
   Token names match assets/si-theme.css, with the literal hex as a fallback
   so this file still renders correctly if it is ever previewed standalone.
   ------------------------------------------------------------------------ */

.si-intake-wrap {
  max-width: 660px;
}

/* ---- Progress ---------------------------------------------------------- */

/*
   A count rather than a step indicator, because all seven questions are on
   one screen. It exists to signal how short the form is, which is the single
   most useful thing to tell someone deciding whether to start.
*/
.si-intake-progress {
  margin-bottom: .5rem;
}
.si-intake-progress-bar {
  height: 4px;
  border-radius: 100px;
  background: rgba(24, 44, 67, 0.10);
  overflow: hidden;
}
.si-intake-progress-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: var(--si-emerald, #46B491);
  transition: width .25s ease;
}
.si-intake-progress-text {
  margin: .5rem 0 0;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--si-text-subtle-dark, #5a6d85);
}

/* ---- Questions --------------------------------------------------------- */

.si-q {
  display: grid;
  gap: .45rem;
}

.si-q-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .45rem;
}

.si-q-label {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--si-prussian, #182C43);
  padding: 0;
}
legend.si-q-label {
  /* A legend does not participate in grid layout in every engine, so it is
     given its own bottom spacing instead of relying on the gap. */
  margin-bottom: .35rem;
}

.si-q-optional {
  margin-left: .4rem;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--si-text-subtle-dark, #5a6d85);
}

.si-q-help {
  margin: 0;
  font-size: 13.5px;
  font-style: italic;
  line-height: 1.5;
  color: var(--si-text-subtle-dark, #5a6d85);
}

/* ---- Option lists ------------------------------------------------------ */

.si-q-options {
  display: grid;
  gap: .5rem;
  margin-top: .2rem;
}

.si-q-option {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  /* 44px minimum touch target. Most of these options wrap to two lines on a
     phone, and a mis-tap on a form this short costs a submission. */
  min-height: 44px;
  padding: .7rem .9rem;
  border: 1px solid rgba(24, 44, 67, 0.16);
  border-radius: 8px;
  background: #fff;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--si-text-body-dark, #4a5e78);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.si-q-option:hover {
  border-color: rgba(70, 180, 145, 0.55);
}
.si-q-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--si-emerald, #46B491);
  cursor: pointer;
}
/* :has() drives the selected style. Where it is unsupported the checkbox
   still shows state on its own, so this is presentation only and nothing
   functional depends on it. */
.si-q-option:has(input:checked) {
  border-color: var(--si-emerald, #46B491);
  background: rgba(70, 180, 145, 0.07);
}
.si-q-option:has(input:focus-visible) {
  outline: 2px solid var(--si-emerald, #46B491);
  outline-offset: 2px;
}

.si-q-other {
  display: grid;
  gap: .35rem;
  margin-top: .6rem;
}
.si-q-other > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--si-text-subtle-dark, #5a6d85);
}

/* ---- Errors ------------------------------------------------------------ */

/*
   The error line is always in the DOM and always referenced by
   aria-describedby, and it is emptied rather than removed when a field
   becomes valid. Inserting the node only on failure is what makes screen
   readers miss the announcement.
*/
.si-q-error {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #B4530C;
  min-height: 0;
}
.si-q-error:empty {
  display: none;
}

.si-q[data-invalid="1"] input[type="text"],
.si-q[data-invalid="1"] input[type="email"],
.si-q[data-invalid="1"] textarea {
  border-color: var(--si-orange, #DC740E);
  box-shadow: 0 0 0 3px rgba(220, 116, 14, 0.14);
}
.si-q[data-invalid="1"] .si-q-options {
  padding-left: .7rem;
  border-left: 3px solid var(--si-orange, #DC740E);
}

.si-intake-formerror[hidden] {
  display: none;
}

/* ---- Honeypot ---------------------------------------------------------- */

/*
   Positioned off-canvas rather than display:none. Some bots skip fields that
   are display:none specifically because it is the obvious tell.
*/
.si-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.si-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;
  border: 0;
}

/* ---- Submit ------------------------------------------------------------ */

#si-intake-submit[aria-busy="true"] {
  opacity: .65;
  pointer-events: none;
}

.si-intake-fineprint {
  margin: -.4rem 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--si-text-subtle-dark, #5a6d85);
}

.si-intake-preview-flag code {
  font-family: var(--si-font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 12.5px;
  background: rgba(24, 44, 67, 0.07);
  padding: .1rem .35rem;
  border-radius: 4px;
}

/* ---- Confirmation ------------------------------------------------------ */

.si-intake-done {
  border-left: 3px solid var(--si-emerald, #46B491);
  background: rgba(70, 180, 145, 0.07);
  border-radius: 8px;
  padding: 1.6rem 1.5rem;
}
.si-intake-done[hidden] {
  display: none;
}
.si-intake-done:focus {
  outline: 2px solid var(--si-emerald, #46B491);
  outline-offset: 3px;
}
.si-intake-done-h {
  font-family: var(--si-font-serif, Georgia, serif);
  font-size: 24px;
  line-height: 1.25;
  margin: 0 0 .9rem;
  color: var(--si-prussian, #182C43);
}
.si-intake-done p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--si-text-body-dark, #4a5e78);
  margin: 0 0 1.1rem;
}
.si-intake-done p:last-child {
  margin-bottom: 0;
}
.si-intake-sample a {
  color: #2C7D63;
  font-weight: 600;
}
.si-intake-done-note:empty {
  display: none;
}
.si-intake-done-note {
  font-size: 13.5px !important;
  color: var(--si-text-subtle-dark, #5a6d85) !important;
}

/* ---- The AI Workflow Opportunity Brief ---------------------------------
   Rendered into #si-brief by si-intake.js from the REST response. The panel
   above is a short confirmation; this is a document somebody may read
   properly, forward, or print, so it gets document spacing rather than
   notice spacing.
   ------------------------------------------------------------------------ */

.si-brief-lede {
  font-size: 15px;
  line-height: 1.65;
  color: var(--si-text-subtle-dark, #5a6d85);
}
.si-brief {
  margin: 1.4rem 0 1.2rem;
  padding: 1.3rem 0 0;
  border-top: 1px solid rgba(24, 44, 67, 0.12);
}
.si-brief-section + .si-brief-section {
  margin-top: 1.3rem;
}
.si-brief-section h3 {
  font-family: var(--si-font-serif, Georgia, serif);
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 .4rem;
  color: var(--si-prussian, #182C43);
}
.si-intake-done .si-brief-section p {
  margin: 0;
}

/* The disclaimer is the one section that must not read as an afterthought,
   because it is the part that keeps everything above it honest. Set apart
   rather than shrunk. */
.si-brief-section-disclaimer {
  margin-top: 1.6rem !important;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(24, 44, 67, 0.12);
}
.si-intake-done .si-brief-section-disclaimer p {
  font-size: 13.5px;
  color: var(--si-text-subtle-dark, #5a6d85);
}

.si-brief-actions[hidden] {
  display: none;
}
.si-brief-actions .si-btn-secondary {
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
}

.si-brief-next {
  margin-top: 1.6rem;
  padding-top: 1.3rem;
  border-top: 1px solid rgba(24, 44, 67, 0.12);
}
.si-brief-next h3 {
  font-family: var(--si-font-serif, Georgia, serif);
  font-size: 18px;
  margin: 0 0 .5rem;
  color: var(--si-prussian, #182C43);
}

/* ---- Printing the brief -------------------------------------------------
   §16 rules out stored PDFs, so "save as PDF" is the browser's own print
   dialogue over this stylesheet. What survives is the brief and nothing
   else: no navigation, no form, no next-step pitch on a page somebody may
   be handing to a colleague.

   This used to be the visibility:hidden trick: hide body *, un-hide the
   brief, pin it to top:0 with position:absolute. It produced the right
   first page and then two things went wrong after it.

   visibility:hidden does not remove a box, it only stops it painting. Every
   hidden element kept its height, so the document stayed as tall as the
   full page: the nav, the hero, seven questions, the FAQ, and the footer.
   The brief was lifted out of that flow by position:absolute, so what came
   out of the printer was the brief on page one followed by several sheets
   of nothing. Somebody printing a two-minute assessment to hand to a
   colleague got a stack of blank paper stapled to it.

   The second failure is worse and only shows up on long answers. An
   absolutely positioned box is not fragmented across printed pages the way
   in-flow content is. A brief that runs past the bottom of page one is cut
   off there, and nothing indicates it. The visitor believes they have the
   whole thing.

   So: display:none rather than visibility:hidden, which removes the boxes
   and the height with them, and no positioning at all, which leaves the
   brief in normal flow where the printer will break it across pages.

   Written as an explicit walk down the ancestor chain because display:none
   on an ancestor takes its descendants with it, so the chain has to be
   re-shown level by level. The chain is asserted in
   tests/assets-test.php, which fails if page-readiness.php stops matching
   it. That is the trade for not depending on :has() to find the chain at
   runtime: markup drift breaks CI here instead of quietly breaking the
   printout, which nobody would notice, because printing is a thing people
   do once and do not report.
   ------------------------------------------------------------------------ */

@media print {
  /* Keep the completed brief readable when PDF background graphics are on. */
  body:has(#si-intake-done:not([hidden])) {
    background: var(--si-white, #FFFFFF) !important;
  }

  /*
     Scope guard. #si-intake-done carries the hidden attribute until the
     answers are submitted, so on the form itself there is no brief to
     print and this whole takeover would leave a blank sheet. Without the
     guard, Ctrl+P on the questions prints nothing at all. With it, the
     page prints normally, which is the correct answer to printing a form.

     :has() is the only part of this block that needs a recent browser. An
     engine that does not understand it drops these three rules and prints
     the entire page, brief included. That is a worse printout and a safe
     one, which is the right way round for a fallback.
  */
  /*
     Two levels, because the page content now sits inside a <main> landmark.

     This block used to run entirely against the direct children of body. On
     2026-08-26 a main landmark was added in header.php, so the sections this
     block reveals moved one level down and body's only interesting child
     became <main> itself. Left alone, rule 1 would have hidden <main> and
     Ctrl+P on a completed brief would have printed a blank sheet.

     assets-test.php caught it before it shipped, which is the reason that
     test simulates these rules against the rendered DOM instead of matching
     the stylesheet's text: a wrapper element changes the outcome here without
     changing a single character in this file.
  */
  body:has(#si-intake-done:not([hidden])) > *,
  body:has(#si-intake-done:not([hidden])) main > * {
    display: none !important;
  }
  body:has(#si-intake-done:not([hidden])) > main,
  body:has(#si-intake-done:not([hidden])) main > .si-light-section {
    display: block !important;
  }
  /* The FAQ is the page's second .si-light-section. Take it back out. */
  body:has(#si-intake-done:not([hidden])) main > .si-intake-faq-section {
    display: none !important;
  }

  .si-intake-wrap > * {
    display: none !important;
  }
  .si-intake-wrap > .si-intake-done {
    display: block !important;
  }

  /* The section and its inner wrapper exist to centre a column on screen. */
  .si-light-section {
    padding: 0;
    background: none;
  }
  .si-intake-wrap {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .si-intake-done {
    border-left: 0;
    background: transparent;
    padding: 0;
  }

  /* Inside the brief: the screen-only affordances and the pitch. */
  .si-brief-actions,
  .si-brief-next,
  .si-intake-done-note {
    display: none !important;
  }
  .si-brief-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ---- FAQ blocks (shared by both pages) --------------------------------- */

.si-intake-faq-section {
  border-top: 1px solid rgba(24, 44, 67, 0.08);
}
.si-intake-faq-h {
  font-family: var(--si-font-serif, Georgia, serif);
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 1.6rem;
  color: var(--si-prussian, #182C43);
}
.si-intake-faq h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 1.7rem 0 .45rem;
  color: var(--si-prussian, #182C43);
}
.si-intake-faq h3:first-child {
  margin-top: 0;
}
.si-intake-faq p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--si-text-body-dark, #4a5e78);
}

/* ---- Blueprint page ---------------------------------------------------- */

.si-blueprint-lede p {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--si-text-body-dark, #4a5e78);
  margin: 0 0 .9rem;
}
.si-blueprint-lede a {
  color: #2C7D63;
  font-weight: 600;
}
.si-blueprint-sample {
  font-weight: 500;
}
.si-blueprint-short {
  font-size: 14px !important;
  color: var(--si-text-subtle-dark, #5a6d85) !important;
}

.si-blueprint-embed {
  margin: 2rem 0 1rem;
  border: 1px solid rgba(24, 44, 67, 0.12);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.si-blueprint-embed iframe {
  display: block;
  width: 100%;
  border: 0;
  /* Microsoft Forms cannot report its own height to a cross-origin parent, so
     the frame is tall enough for the long intake and scrolls internally on a
     phone rather than being clipped. */
  min-height: 720px;
}

.si-blueprint-fallback {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--si-text-subtle-dark, #5a6d85);
}
.si-blueprint-fallback a {
  color: #2C7D63;
  font-weight: 600;
}

.si-blueprint-what {
  border-top: 1px solid rgba(24, 44, 67, 0.08);
}

/* ---- Wider than a phone ------------------------------------------------ */

@media (min-width: 720px) {
  .si-q-options {
    gap: .55rem;
  }
  .si-intake-done {
    padding: 2rem 2.2rem;
  }
  .si-intake-done-h {
    font-size: 28px;
  }
  .si-blueprint-embed iframe {
    min-height: 1100px;
  }
}

/* ---- Reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .si-intake-progress-bar > span,
  .si-q-option {
    transition: none;
  }
}
