/* Page styles for the hg design shell: body.hg.hg-start
   Linked after homeguide.css when a view sets
     <% content_for :design, "hg" %>
     <% content_for :hg_page, "start" %>

   Start EVERY selector with .hg-start (for example: .hg-start .hero { ... }).
   This file is also linked on un-migrated pages by stylesheet_link_tag :app,
   so an unscoped selector would restyle them; test/integration/hg_shell_test.rb
   fails if one slips in. Use the tokens from homeguide.css (var(--ink),
   var(--s-6), ...). No :root, no @import, no CSS nesting (Safari 15.4 floor).
   Prefix @keyframes names with hg-start-.

   Pages: starts/new (upload form), starts/capacity, starts/limited, and the
   analyzing / failed states of inspection_reports/show.
   Source: design/final/src/start.css, each selector prefixed with .hg-start. */

/* ==========================================================================
   /start: upload form
   ========================================================================== */
.hg-start .up { padding: 20px 0 48px; }
.hg-start .up-grid { display: grid; gap: 24px; }
.hg-start .up-head .way { margin-bottom: 24px; max-width: 560px; }
.hg-start .up-head .lead { margin-top: 12px; max-width: 46ch; }
.hg-start .up-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; list-style: none; }
.hg-start .up-chips .chip { height: 30px; padding: 0 12px 0 9px; }
.hg-start .up-main { min-width: 0; }
@media (max-width: 719px) { .hg-start .up-head .lead { font-size: 1.0625rem; } }
@media (min-width: 1000px) {
  .hg-start .up { padding: 40px 0 80px; }
  .hg-start .up-grid { grid-template-columns: minmax(0, 1fr) 380px; gap: 36px 72px; align-items: start; }
  .hg-start .up-head { grid-column: 1 / -1; }
  .hg-start .up-head .way { margin-bottom: 36px; }
  .hg-start .up-side { padding-top: 8px; }
}

.hg-start .up-form { display: grid; gap: 24px; padding: 20px 16px 20px; box-shadow: var(--shadow-2); }
@media (min-width: 720px) { .hg-start .up-form { padding: 32px; gap: 28px; } }
.hg-start .fnum { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--green-100); color: var(--green-800); font: 700 var(--text-micro)/1 var(--font-sans); vertical-align: 1px; }
.hg-start .field > label:not(.drop), .hg-start .field > .label, .hg-start .ptype legend { display: block; min-height: 24px; margin-bottom: 2px; padding: 0; }
.hg-start fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.hg-start .ptype legend { margin-bottom: 8px; }
.hg-start .opt { font-weight: 400; color: var(--ink-3); }

/* Errors. The summary sits at the top of the card; each message sits under
   the field it is about. [hidden] has to beat the display the shell gives. */
.hg-start .form-alert { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; padding: 14px 16px; border-radius: var(--r-md); background: var(--urgent-tint); border: 1px solid #EBC2B6; color: var(--urgent-ink); font-size: .9375rem; line-height: 1.45; }
.hg-start .form-alert > .icon { width: 20px; height: 20px; margin-top: 1px; }
.hg-start .form-alert p + p { margin-top: 6px; }
.hg-start .form-alert b { font-weight: 700; }
.hg-start .field .error { line-height: 1.45; }
.hg-start .field .error[hidden] { display: none; }
.hg-start .field .error + .error { margin-top: 6px; }
.hg-start .field .error a { color: inherit; }

/* Dropzone. The input is a real, focusable file input, clipped to 1px and
   parked at the bottom of the box so the browser's own "choose a file" bubble
   points at it. The picked state is pure CSS (a required file input becomes
   :valid once a file is chosen), so it works before or without JavaScript;
   upload_controller.js fills in the file name and size. */
.hg-start .drop { position: relative; width: 100%; }
.hg-start .drop > input { left: 50%; bottom: 18px; }
.hg-start .drop-ic .ic-ok, .hg-start .drop .drop-picked { display: none; }
.hg-start .drop > input:valid ~ .drop-empty { display: none; }
.hg-start .drop > input:valid ~ .drop-picked { display: block; }
.hg-start .drop > input:valid ~ .drop-ic { background: var(--green-600); color: #fff; }
.hg-start .drop > input:valid ~ .drop-ic .ic-up { display: none; }
.hg-start .drop > input:valid ~ .drop-ic .ic-ok { display: block; stroke-width: 2.5; }
.hg-start .drop:has(> input:valid) { border-style: solid; border-color: var(--green-600); background: var(--surface); }
.hg-start .drop-h u { color: var(--green-600); font-weight: 600; text-underline-offset: 3px; }
.hg-start .drop-h { max-width: 44ch; text-wrap: pretty; }
.hg-start .drop.is-error .drop-h { color: var(--ink-3); font-weight: 400; }
.hg-start .drop.is-error { background: #FDF3EF; }
.hg-start .drop.is-error:hover, .hg-start .drop.is-error.is-over { border-color: var(--urgent); background: var(--urgent-tint); }
.hg-start .drop.is-error:focus-within { border-color: var(--urgent); background: #FDF3EF; outline-color: var(--urgent); }
.hg-start .drop.is-over { border-style: solid; }

.hg-start .tip { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; }
.hg-start .tip .icon { width: 15px; height: 15px; margin-top: 2px; }
@media (min-width: 720px) { .hg-start .drop { padding: 36px 24px 32px; } .hg-start .tip { display: none; } }

.hg-start .up-row { display: grid; gap: 24px; }
@media (min-width: 720px) {
  .hg-start .up-row { grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
  .hg-start .up-row-who { grid-template-columns: minmax(0, 1fr) 200px; }
}

/* Property type: four radio tiles. The radio covers its tile, invisibly, so it
   stays focusable and the browser's "select one" bubble has somewhere to point. */
.hg-start .seg4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* A fieldset's legend is not a grid item, so the .field gap never reaches the
   tiles; this puts them on the same line as the ZIP input beside them. */
.hg-start .ptype .seg4 { margin-top: 6px; }
.hg-start .seg4 label { position: relative; display: block; cursor: pointer; }
.hg-start .seg4 input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.hg-start .seg4 span { display: grid; place-items: center; min-height: 52px; padding: 0 8px; border-radius: var(--r-md); border: 1.5px solid var(--line-field); background: var(--surface); font-size: .9375rem; font-weight: 500; text-align: center; transition: border-color .15s, background .15s; }
.hg-start .seg4 label:hover span { border-color: var(--ink-3); }
.hg-start .seg4 input:checked + span { border-color: var(--green-600); background: var(--green-50); color: var(--green-800); font-weight: 700; box-shadow: inset 0 0 0 1px var(--green-600); }
.hg-start .seg4 input:focus-visible + span { box-shadow: var(--ring); }
.hg-start .seg4 input:checked:focus-visible + span { box-shadow: inset 0 0 0 1px var(--green-600), var(--ring); }
@media (min-width: 720px) { .hg-start .seg4 { grid-template-columns: repeat(4, 1fr); } .hg-start .seg4 span { font-size: var(--text-small); padding: 0 4px; } }

.hg-start .up-form .btn-lg .icon { display: block; }
.hg-start .up-form[aria-busy="true"] .btn-lg .icon { display: none; }
.hg-start .up-note { display: flex; gap: 8px; align-items: flex-start; justify-content: center; margin-top: -12px; font-size: var(--text-small); color: var(--ink-3); }
.hg-start .up-note .icon { width: 15px; height: 15px; margin-top: 3px; }

/* side column */
.hg-start .up-side { display: grid; gap: 28px; align-content: start; }
.hg-start .side-block h2 { display: flex; align-items: center; gap: 8px; font: 600 1.0625rem/1.3 var(--font-sans); margin-bottom: 14px; }
.hg-start .next-list { display: grid; list-style: none; }
.hg-start .next-list li { position: relative; padding: 0 0 20px 30px; }
.hg-start .next-list li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--gold-500); z-index: 1; }
.hg-start .next-list li::after { content: ""; position: absolute; left: 10px; top: 12px; bottom: -8px; width: 1.5px; background: var(--line-strong); }
.hg-start .next-list li:last-child { padding-bottom: 0; }
.hg-start .next-list li:last-child::after { display: none; }
.hg-start .nl-t { display: block; font-size: var(--text-micro); font-weight: 600; color: var(--gold-700); }
.hg-start .next-list b { display: block; font-weight: 600; }
.hg-start .next-list p { font-size: .9375rem; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }
.hg-start .safe { padding: 20px; border-radius: var(--r-lg); background: var(--green-50); border: 1px solid var(--green-200); }
.hg-start .safe ul { display: grid; gap: 14px; list-style: none; }
.hg-start .safe li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; font-size: .9375rem; line-height: 1.45; color: var(--ink-2); }
.hg-start .safe li > .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--green-600); }
.hg-start .safe li b { display: block; color: var(--ink); font-weight: 600; }
.hg-start .safe .link { font-weight: 500; overflow-wrap: anywhere; }
.hg-start .side-links { list-style: none; margin-top: -8px; font-size: .9375rem; color: var(--ink-2); }
.hg-start .side-links li { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.hg-start .side-links .link { display: inline-flex; align-items: center; min-height: 44px; }

/* ==========================================================================
   Report page while it is not finished: analyzing, failed
   ========================================================================== */
.hg-start .an { padding: 24px 0 56px; }
@media (min-width: 1000px) { .hg-start .an { padding: 40px 0 96px; } }
.hg-start .an .way { margin: 0 0 24px; max-width: 560px; }
@media (min-width: 1000px) { .hg-start .an .way { margin-bottom: 36px; } }
.hg-start .an-card { display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; box-shadow: var(--shadow-2); }
.hg-start .an-left, .hg-start .an-right { min-width: 0; }
.hg-start .an-left { padding: 20px 16px 24px; }
.hg-start .an-right { display: grid; gap: 24px; align-content: start; padding: 22px 16px 24px; background: var(--surface-sunk); border-top: 1px solid var(--line); }
.hg-start .an-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; padding: 4px 16px; border-top: 1px solid var(--line); font-size: var(--text-small); color: var(--ink-3); }
.hg-start .an-foot > span { display: inline-flex; flex-wrap: wrap; align-items: center; column-gap: 5px; min-height: 44px; }
.hg-start .an-foot .link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
@media (min-width: 900px) {
  .hg-start .an-card { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .hg-start .an-left { padding: 36px 40px 36px; }
  .hg-start .an-right { gap: 28px; padding: 36px 36px; border-top: 0; border-left: 1px solid var(--line); }
  .hg-start .an-foot { grid-column: 1 / -1; padding: 4px 40px; }
}
.hg-start .filechip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-sunk); border: 1px solid var(--line); margin-bottom: 22px; }
.hg-start .filechip > .icon:first-child { width: 22px; height: 22px; color: var(--ink-3); }
.hg-start .filechip > span { flex: 1; min-width: 0; }
.hg-start .filechip b { display: block; font-size: var(--text-small); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hg-start .filechip small { display: block; font-size: var(--text-micro); color: var(--ink-3); }
.hg-start .filechip .ok { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: var(--green-600); color: #fff; stroke-width: 3; }
.hg-start .an-eta { margin-top: 6px; color: var(--ink-2); }
.hg-start .an .progress { margin: 18px 0 8px; height: 10px; background: var(--paper-deep); }
.hg-start .an .progress > i { background: linear-gradient(90deg, var(--green-600), #3F7D5D); position: relative; overflow: hidden; transition: width .6s ease; }
.hg-start .an .progress > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-100%); animation: hg-start-sweep 1.8s infinite; }
@keyframes hg-start-sweep { to { transform: translateX(100%); } }
@keyframes hg-start-spin { to { transform: rotate(360deg); } }
.hg-start .an-meta { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-small); color: var(--ink-3); }
.hg-start .an-preview { margin-top: 10px; font-weight: 600; color: var(--ink); }
.hg-start .an-preview[hidden] { display: none; }
.hg-start .an-steps { margin-top: 14px; list-style: none; }
.hg-start .an-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 48px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink-3); line-height: 1.35; }
.hg-start .an-steps li:first-child { border-top: 0; }
.hg-start .an-steps i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); color: #fff; }
.hg-start .an-steps i .icon { display: none; width: 13px; height: 13px; stroke-width: 3; }
.hg-start .an-steps b { font-size: var(--text-small); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.hg-start .an-steps b:empty { display: none; }
.hg-start .an-steps .is-done { color: var(--ink); }
.hg-start .an-steps .is-done i { background: var(--green-600); border-color: var(--green-600); }
.hg-start .an-steps .is-done i .icon { display: block; }
.hg-start .an-steps .is-now { color: var(--ink); font-weight: 600; }
.hg-start .an-steps .is-now i { border-color: var(--green-200); border-top-color: var(--green-600); animation: hg-start-spin .9s linear infinite; }
.hg-start .an-steps .is-now b { color: var(--green-600); }
/* Reduced motion: the spinner would freeze as a broken ring, so show a dot. */
@media (prefers-reduced-motion: reduce) {
  .hg-start .an-steps .is-now i { border-color: var(--green-600); box-shadow: 0 0 0 4px var(--green-100); }
  .hg-start .an-steps .is-now i::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); }
  .hg-start .an .progress > i::after { display: none; }
}

.hg-start .an-right h2 { font: 600 1.0625rem/1.3 var(--font-sans); color: var(--ink); }
.hg-start .an-leave { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; }
.hg-start .an-leave > .icon { width: 22px; height: 22px; margin-top: 2px; color: var(--green-600); }
.hg-start .an-leave b { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.hg-start .an-leave p { margin-top: 2px; font-size: .9375rem; line-height: 1.5; color: var(--ink-2); }
.hg-start .an-get { padding-top: 22px; border-top: 1px solid var(--line); }
.hg-start .an-get .ticks { margin-top: 12px; }
.hg-start .an-get .ticks li { font-size: .9375rem; font-weight: 400; color: var(--ink-2); }
.hg-start .an-sample { margin-top: 14px; font-size: .9375rem; }
.hg-start .an-sample .link { display: inline-flex; align-items: center; min-height: 44px; }

/* failed */
.hg-start .fail-card { display: grid; gap: 16px; max-width: 760px; padding: 24px 16px; box-shadow: var(--shadow-2); }
.hg-start .fail-body { min-width: 0; }
.hg-start .fail-body > p { margin-top: 12px; color: var(--ink-2); max-width: 62ch; }
.hg-start .fail-body > .small { margin-top: 10px; color: var(--ink-3); }
.hg-start .fail-hint { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--gold-50); border: 1px solid var(--gold-100); }
.hg-start .fail-hint .icon { width: 18px; height: 18px; margin-top: 3px; color: var(--gold-700); }
.hg-start .fail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hg-start .fail-body > .fail-foot { display: flex; flex-wrap: wrap; align-items: center; column-gap: 5px; max-width: none; margin: 18px 0 -12px; padding-top: 6px; border-top: 1px solid var(--line); font-size: var(--text-small); color: var(--ink-3); }
.hg-start .fail-foot .link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
@media (max-width: 559px) { .hg-start .fail-actions .btn { width: 100%; } }
@media (min-width: 720px) { .hg-start .fail-card { grid-template-columns: 52px minmax(0, 1fr); gap: 24px; padding: 36px 40px; } }

/* ==========================================================================
   Single-message pages: capacity, waitlisted, rate limited
   ========================================================================== */
.hg-start .note-page { padding: 32px 0 64px; }
@media (min-width: 720px) { .hg-start .note-page { padding: 72px 0 112px; } }
.hg-start .note-card { max-width: 560px; margin-inline: auto; padding: 28px 20px; box-shadow: var(--shadow-2); }
@media (min-width: 720px) { .hg-start .note-card { padding: 44px 48px; } }
.hg-start .note-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--gold-100); color: var(--gold-700); }
.hg-start .note-ic .icon { width: 24px; height: 24px; }
.hg-start .note-ic-ok { background: var(--green-100); color: var(--green-600); }
.hg-start .note-ic-ok .icon { stroke-width: 2.5; }
.hg-start .note-ic-alert { background: var(--urgent-tint); color: var(--urgent); }
.hg-start .note-card h1 { margin-top: 18px; }
.hg-start .note-body { margin-top: 12px; color: var(--ink-2); text-wrap: pretty; }
.hg-start .note-body strong { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.hg-start .note-form { display: grid; gap: 16px; margin-top: 24px; }
.hg-start .note-actions { margin-top: 24px; }
.hg-start .note-foot { margin: 22px 0 -12px; padding-top: 8px; border-top: 1px solid var(--line); font-size: .9375rem; }
.hg-start .note-foot .link { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 559px) { .hg-start .note-actions .btn { width: 100%; } }

/* who is doing the sorting, said once on the wait screen */
.hg-start .an-ai { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: var(--text-small); line-height: 1.45; color: var(--ink-3); }
.hg-start .an-ai .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
