/*
 * Fire Stopping — on-site Capture: BASE + DESKTOP layout (>=1025px).
 *
 * Rebuilt to match the fire-door desktop capture (inspections/show/_capture.php
 * + inspection_show.css @media min-width:1025px): white section cards with
 * eyebrow+title headers, compact 28px inset fields, inset guidance banners, a
 * review readout card (display-font stat values), a status-badge row and the
 * dark "Save" button. Tokens are mapped 1:1 to the fire-door hardcoded values
 * (#f7f5f0 = --canvas, #1a1815 = --ink, #c49510 = --accent, etc.). The mobile
 * stepper flow lives in fire-stopping-capture-mobile.css. Loaded on survey-show.
 */

/* ---- Mobile-only chrome is hidden by default; the mobile file shows it -----
   (the mobile stylesheet loads after this one and re-shows these inside its
   @media (max-width:1024px) block, so desktop >=1025px keeps them hidden). */
.fss-cap-entry,
.fss-cap-setupbar,
.fss-cap-mbar,
.fss-cap-intro,
.fss-cap-labelscreen,
.fss-cap-foot,
.fss-cap-statusbanner,
.fss-cap-reasonchips,
.fss-cap-sevpills {
  display: none;
}
/* NB: the exit-confirm sheet (.fss-cap-exitmodal) is intentionally NOT listed
   here. It's a .modal hidden by its own [hidden] attribute and only ever opened
   on mobile; a non-media display:none here would beat .modal{display:flex} and
   keep it hidden on mobile too. It never opens on desktop, so [hidden] suffices. */

/* ===== Desktop capture gate ====================================================
   Penetration capture is a touch flow (the stepper activates for any coarse pointer
   or ≤1024px). On true desktop the whole capture form is hidden and replaced by a
   "mobile/tablet only" notice — a 1:1 mirror of the fire-door door-capture gate
   (inspection_show.css). The `min-width: 1025px AND not (any-pointer: coarse)`
   condition is the exact complement of the stepper's activation in
   fire-stopping-capture-mobile.css, so every device shows one or the other. */
.page-section--fs-survey-show .capture-desktop-gate__notice {
  /* Hidden across the whole capture range (≤1024 + any coarse-pointer device). */
  display: none;
}

@media (min-width: 1025px) and (not (any-pointer: coarse)) {
  /* Scoped to the .capture-desktop-gate wrapper the real _capture.php emits. The
     /demo/fs survey reuses .page-section--fs-survey-show + .fss-cap but has NO
     gate wrapper, so (like the fire-door demo) it keeps showing the capture form
     as a showcase — only the real app hides it behind the notice. */
  .page-section--fs-survey-show .capture-desktop-gate > .fss-cap {
    display: none;
  }

  .page-section--fs-survey-show .capture-desktop-gate__notice {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 640px;
    margin: 24px auto;
    padding: 24px 28px;
    border: 1px solid var(--rule, rgba(26, 24, 21, 0.1));
    border-radius: var(--radius-lg, 18px);
    background: var(--surface-card, #ffffff);
    box-shadow: var(--shadow-card, 0 1px 4px rgba(26, 24, 21, 0.06));
  }

  .page-section--fs-survey-show .capture-desktop-gate__notice-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--surface-subtle, #f2efe9);
    color: var(--ink-3, #6b6458);
  }

  .page-section--fs-survey-show .capture-desktop-gate__notice-icon svg {
    width: 24px;
    height: 24px;
  }

  .page-section--fs-survey-show .capture-desktop-gate__notice-copy strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink, #1a1815);
  }

  .page-section--fs-survey-show .capture-desktop-gate__notice-copy p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-3, #6b6458);
  }

  html[data-theme="dark"] .page-section--fs-survey-show .capture-desktop-gate__notice {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.22);
  }
}

/* Neutralise the global bare-form card chrome (style.css `form {…}` sets a
   card bg + 16px padding + 12px grid gap on every form outside a .modal).
   Without this the form paints a card *around* the section cards (card-in-card)
   and its padding/gap reads as dead space. Mirrors `.modal form` /
   `.sidebar-nav__form`. The mobile file re-hides/-shows .fss-cap-form via its
   own display rules at <=1024px, which win inside their media query. */
.fss-cap-form {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
  gap: 0;
}

/* ---- Section cards (shared) ---------------------------------------------- */
/* Match fire-door .cap-section: white, radius 12, shadow-card ring, no border. */
.fss-cap-section {
  background: var(--surface-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ---- Section header: eyebrow + title + sub (fire-door .cap-sec-header) ----- */
.fss-cap-sec-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
}

.fss-cap-eyebrow {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.fss-cap-sec-title {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.fss-cap-sec-sub {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink-4);
}

.fss-cap-sec-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- Guidance banner (fire-door .cap-setup-icm-progress.icm-mobile-statusbanner) */
.fss-cap-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface-inset);
}

.fss-cap-banner__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--ink-3);
  color: var(--surface-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fss-cap-banner__icon svg {
  width: 13px;
  height: 13px;
}

.fss-cap-banner__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fss-cap-banner__copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.fss-cap-banner__copy p {
  margin: 0;
  color: var(--ink-4);
  font-size: 11.5px;
  font-weight: 300;
  line-height: 1.45;
}

/* ---- Fields (shared) — compact, inset (fire-door .f-input/.f-select) ------- */
.fss-cap-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.fss-cap-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* flex-basis is for fields sitting SIDE-BY-SIDE inside a .fss-cap-row (main
   axis = width). It must NOT be set on the bare .fss-cap-field, because those
   are direct children of the column-flex .fss-cap-sec-body where flex-basis
   would apply to the HEIGHT and stretch each field to 180px tall (dead space). */
.fss-cap-row .fss-cap-field {
  flex: 1 1 180px;
}

.fss-cap-row .fss-cap-field--sm {
  flex: 0 1 150px;
}

.fss-cap-flabel {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.fss-cap :where(input[type="text"], input[type="number"], input[type="search"], select) {
  width: 100%;
  min-height: 28px;
  height: 28px;
  padding: 0 24px 0 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fss-cap textarea {
  width: 100%;
  min-height: 92px;
  padding: 8px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fss-cap :where(input, select, textarea):focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.fss-cap :where(input, textarea)::placeholder {
  color: var(--ink-4);
}

/* ---- Status toggle grid (shared) ----------------------------------------- */
.fss-cap-togglegrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fss-cap-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  background: var(--surface-card);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.fss-cap-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.fss-cap-toggle:active {
  transform: scale(0.97);
}

/* Checked toggles are black/white for every status (matching the fire-door
   capture toggles .icm-mobile-togglebtn.is-active.is-*). The toggle label
   distinguishes pass/fail/defective/na — the project's button system never
   brand-colours a button fill. */
.fss-cap-toggle--pass:has(input:checked),
.fss-cap-toggle--fail:has(input:checked),
.fss-cap-toggle--defective:has(input:checked),
.fss-cap-toggle--na:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface-card);
}

/* ---- System picker hint -------------------------------------------------- */
.fss-cap-syshint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-4);
}

.fss-cap-syshint--empty {
  padding: 10px 12px;
  border: 1px dashed var(--rule-strong);
  border-radius: 9px;
  background: var(--surface-subtle);
}

/* ---- Photos (fire-door .file-upload-card: inset card + white tile) -------- */
.fss-cap-photozone {
  position: relative;
  border: 1px dashed var(--rule-strong);
  border-radius: 10px;
  background: var(--canvas);
  padding: 6px;
}

.fss-cap-photozone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.fss-cap-photozone__action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface-card);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.fss-cap-photozone__action:hover {
  box-shadow: 0 12px 24px rgba(26, 24, 21, 0.08);
  transform: translateY(-1px);
}

.fss-cap-photozone__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

.fss-cap-photozone__action strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.fss-cap-photozone__action p {
  margin: 0;
  color: var(--ink-4);
  font-size: 12px;
}

/* ---- Before / During / After staged evidence ---------------------------- */
.fss-cap-photolead {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}

.fss-cap-photostage {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fss-cap-photostage__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.fss-cap-photostage__label {
  position: relative;
  padding-left: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.fss-cap-photostage__label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 999px;
  background: var(--accent);
}

.fss-cap-photostage[data-fss-cap-photostage="during"] .fss-cap-photostage__label::before {
  background: var(--info, #2563a8);
}

.fss-cap-photostage[data-fss-cap-photostage="after"] .fss-cap-photostage__label::before {
  background: var(--success);
}

.fss-cap-photostage__hint {
  font-size: 11.5px;
  color: var(--ink-4);
}

.fss-cap-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fss-cap-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  background: var(--surface-inset);
}

.fss-cap-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fss-cap-thumb__del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(26, 24, 21, 0.62);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.fss-cap-thumb--pending::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.45);
}

/* ---- Review readout card (fire-door .cap-review-readout) ------------------ */
.fss-cap-readout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px 16px;
  background: var(--surface-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(26, 24, 21, 0.04);
}

.fss-cap-readout__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fss-cap-readout__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--canvas);
  border: 1px solid var(--rule);
}

.fss-cap-readout__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.fss-cap-readout__value {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.fss-cap-readout__detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.fss-cap-readout[data-summary-status="pass"] [data-fss-cap-sum-status] { color: var(--success); }
.fss-cap-readout[data-summary-status="fail"] [data-fss-cap-sum-status] { color: var(--danger); }
.fss-cap-readout[data-summary-status="defective"] [data-fss-cap-sum-status] { color: var(--accent-strong); }
.fss-cap-readout[data-summary-status="na"] [data-fss-cap-sum-status] { color: var(--ink-3); }

/* ---- Status-badge row + dark save button (fire-door .cap-status-row) ------ */
.fss-cap-statusrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.fss-cap-statusrow__sp {
  flex: 1;
}

.fss-cap-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  font-size: 11.5px;
  font-weight: 500;
}

.fss-cap-badge--green {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(30, 122, 69, 0.2);
}

.fss-cap-badge--neutral {
  background: var(--surface-inset);
  color: var(--ink-3);
}

.fss-cap-savebtn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface-card);
  font: 600 13px/1 var(--font-sans);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}

.fss-cap-savebtn:hover {
  background: var(--ink-2);
}

.fss-cap-savebtn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Save buttons show a spinner while the AJAX save is in flight. The FS save
   buttons (.fss-cap-savebtn / .fss-cap-footbtn / .fss-cap-mbar__btn) aren't .btn,
   so they need their own rule mirroring .btn[data-loading="1"] in style.css.
   The JS sets data-loading="1" + aria-busy in setSaving(). currentColor keeps the
   spinner visible on the white-on-dark buttons. */
.fss-cap [data-loading="1"] {
  position: relative;
  pointer-events: none;
}

.fss-cap [data-loading="1"]::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  vertical-align: -2px;
  animation: fdBtnSpin 0.8s linear infinite;
  opacity: 0.85;
}

.fss-cap-cancelbtn {
  align-self: flex-start;
}

/* Penetrations-tab status/severity chips now live in fire-stopping-survey-show.css
   (.fss-pen-chip) — forked to the doors pass-chip/sev-chip treatment. */

/* ==========================================================================
   DESKTOP layout (>=1025px): two-column form, all steps visible at once.
   ========================================================================== */
@media (min-width: 1025px) {
  /* Show every step section even though the markup defaults some to [hidden]
     for the mobile stepper's initial state. */
  .fss-cap .fss-cap-section[hidden] {
    display: block !important;
  }

  .fss-cap-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 16px;
    align-items: start;
  }

  .fss-cap-grid__primary,
  .fss-cap-grid__secondary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
  }
}

/* Dark mode: tokens are theme-aware, but soften the photo dashed zone. */
html[data-theme="dark"] .fss-cap-photozone,
html[data-theme="dark"] .fss-cap-syshint--empty {
  background: rgba(15, 23, 42, 0.4);
}

html[data-theme="dark"] .fss-cap-photozone__action {
  background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] .fss-cap-readout__item {
  background: rgba(15, 23, 42, 0.4);
}
