/* ===========================================================
   SUBSCRIPTION PAGE
   Rebuilt responsive layout
   Keeps STI Assets visual styling while removing rigid widths
   and native fieldset/file-input overflow issues.
   =========================================================== */

.sub-page,
.sub-page *,
.sub-page *::before,
.sub-page *::after {
  box-sizing: border-box;
}

.sub-page {
  width: 100%;
  min-width: 0;
  overflow-x: clip;
  background: var(--color-bg-alt, #f5f7f9);
  padding-bottom: clamp(64px, 8vw, 96px);
}

.sub-shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
  min-width: 0;
}

/* ---------- Hero ---------- */

.sub-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: clamp(32px, 5vw, 48px);
  padding: clamp(56px, 7vw, 80px) 0 clamp(44px, 6vw, 64px);
  background: var(--color-primary, #033669);
}

.sub-hero-media,
.sub-hero-overlay {
  position: absolute;
  inset: 0;
}

.sub-hero-media {
  z-index: -2;
}

.sub-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.sub-hero-overlay {
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      rgba(2, 32, 62, 0.96) 0%,
      rgba(3, 54, 105, 0.91) 48%,
      rgba(3, 54, 105, 0.74) 100%
    );
}

.sub-eyebrow {
  margin: 0;
  color: var(--color-accent, #f68634);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sub-hero-title {
  max-width: 780px;
  margin: 14px 0 0;
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.sub-hero-lead {
  max-width: 64ch;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(0.96rem, 1.2vw, 1.04rem);
  line-height: 1.7;
}

.sub-hero-alt {
  max-width: 64ch;
  margin: 22px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.88rem;
  line-height: 1.7;
}

.sub-hero-alt a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sub-hero-alt a:hover {
  color: var(--color-accent, #f68634);
}

/* ---------- Main page layout ---------- */

.sub-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(32px, 4vw, 52px);
  align-items: start;
  min-width: 0;
}

.sub-form {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

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

.sub-rail {
  position: sticky;
  top: 112px;
  min-width: 0;
}

.sub-rail-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid rgba(3, 54, 105, 0.12);
}

.sub-rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: -1px;
  padding: 11px 10px 11px 18px;
  border-left: 2px solid transparent;
  color: var(--color-text-muted, #63717d);
  font-size: 0.88rem;
  line-height: 1.35;
  transition:
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-rail-item span {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(3, 54, 105, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
}

.sub-rail-item.is-active {
  color: var(--color-primary, #033669);
  border-left-color: var(--color-primary, #033669);
  font-weight: 600;
}

.sub-rail-item.is-active span {
  background: var(--color-primary, #033669);
  color: #fff;
}

.sub-rail-item.is-done span {
  background: var(--color-accent, #f68634);
  color: #fff;
}

/* ---------- Form cards ---------- */

.sub-section {
  display: block;
  width: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  margin: 0 0 20px;
  padding: clamp(24px, 3vw, 34px);
  overflow: visible;
  background: #fff;
  border: 0;
  border-radius: var(--radius-card, 8px);
  box-shadow: var(--shadow-sm, 0 8px 24px rgba(3, 54, 105, 0.06));
}

fieldset.sub-section {
  padding-block-start: clamp(24px, 3vw, 34px);
}

.sub-section-title {
  display: block;
  width: auto;
  max-width: 100%;
  padding: 0;
  margin: 0 0 6px;
  color: var(--color-primary, #033669);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

legend.sub-section-title {
  float: none;
}

.sub-section-note,
.sub-help {
  margin: 0;
  color: var(--color-text-muted, #63717d);
  font-size: 0.84rem;
  line-height: 1.55;
}

.sub-section-note {
  margin-bottom: 22px;
}

.sub-subheading {
  margin: 34px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--color-hairline, #e6ebf0);
  color: var(--color-primary, #033669);
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- Form grids ---------- */

.sub-grid,
.sub-choice-grid,
.sub-upload-grid {
  width: 100%;
  min-width: 0;
}

.sub-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.sub-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sub-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sub-grid > *,
.sub-choice-grid > *,
.sub-upload-grid > * {
  min-width: 0;
}

.sub-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 18px;
}

.sub-grid .sub-field {
  margin-bottom: 0;
}

.sub-field-narrow {
  width: min(100%, 360px);
  max-width: 100%;
}

.sub-field label,
.sub-label,
.sub-upload > label {
  color: var(--color-text, #17212b);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.sub-field label span[aria-hidden],
.sub-label span[aria-hidden],
.sub-upload label span[aria-hidden] {
  color: var(--color-accent, #f68634);
}

.sub-field input[type="text"],
.sub-field input[type="tel"],
.sub-field input[type="email"],
.sub-field input[type="date"],
.sub-field select,
.sub-field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  background: #fff;
  color: var(--color-text, #17212b);
  border: 1px solid rgba(3, 54, 105, 0.18);
  border-radius: var(--radius, 6px);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  transition:
    border-color 150ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-field textarea {
  min-height: 86px;
  resize: vertical;
}

.sub-field select {
  appearance: auto;
}

.sub-field input:focus,
.sub-field select:focus,
.sub-field textarea:focus {
  outline: none;
  border-color: var(--color-primary, #033669);
  box-shadow: 0 0 0 3px rgba(3, 54, 105, 0.12);
}

.sub-field input[aria-invalid="true"],
.sub-field select[aria-invalid="true"],
.sub-field textarea[aria-invalid="true"] {
  border-color: #c0392b;
}

/* ---------- Product choices ---------- */

.sub-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.sub-choice {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.sub-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sub-choice-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 18px;
  border: 1px solid rgba(3, 54, 105, 0.16);
  border-radius: var(--radius-card, 8px);
  overflow-wrap: anywhere;
  transition:
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-choice-name {
  color: var(--color-primary, #033669);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
}

.sub-choice-meta {
  color: var(--color-text-muted, #63717d);
  font-size: 0.8rem;
  line-height: 1.5;
}

.sub-choice input:checked + .sub-choice-body {
  border-color: var(--color-primary, #033669);
  background: rgba(3, 54, 105, 0.04);
  box-shadow: inset 0 0 0 1px var(--color-primary, #033669);
}

.sub-choice input:focus-visible + .sub-choice-body {
  outline: 3px solid var(--color-accent-action, #f68634);
  outline-offset: 2px;
}

/* ---------- Pills and risk scale ---------- */

.sub-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.sub-stack {
  display: grid;
  gap: 10px;
  width: 100%;
}

.sub-pill {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.sub-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sub-pill span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 9px 16px;
  border: 1px solid rgba(3, 54, 105, 0.18);
  border-radius: 999px;
  color: var(--color-text-muted, #63717d);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition: all 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-pill-block {
  display: block;
}

.sub-pill-block span {
  display: flex;
  width: 100%;
  border-radius: var(--radius, 6px);
}

.sub-pill input:checked + span {
  background: var(--color-primary, #033669);
  border-color: var(--color-primary, #033669);
  color: #fff;
}

.sub-pill input:focus-visible + span {
  outline: 3px solid var(--color-accent-action, #f68634);
  outline-offset: 2px;
}

.sub-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 330px);
  min-width: 0;
}

.sub-scale-item {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.sub-scale-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sub-scale-item span {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  max-height: 52px;
  border: 1px solid rgba(3, 54, 105, 0.18);
  border-radius: var(--radius, 6px);
  color: var(--color-text-muted, #63717d);
  font-weight: 600;
  transition: all 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-scale-item input:checked + span {
  background: var(--color-primary, #033669);
  border-color: var(--color-primary, #033669);
  color: #fff;
}

.sub-scale-item input:focus-visible + span {
  outline: 3px solid var(--color-accent-action, #f68634);
  outline-offset: 2px;
}

/* ---------- Uploads ---------- */

.sub-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.sub-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  overflow: hidden;
  border: 1px dashed rgba(3, 54, 105, 0.26);
  border-radius: var(--radius-card, 8px);
  transition:
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-upload.is-filled {
  border-style: solid;
  border-color: var(--color-primary, #033669);
  background: rgba(3, 54, 105, 0.03);
}

.sub-upload input[type="file"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-muted, #63717d);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-upload input[type="file"]::file-selector-button {
  max-width: 100%;
  margin-right: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(3, 54, 105, 0.2);
  border-radius: var(--radius, 6px);
  background: #fff;
  color: var(--color-primary, #033669);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.sub-filename {
  max-width: 100%;
  margin: 0;
  color: var(--color-primary, #033669);
  font-size: 0.8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- Attestation ---------- */

.sub-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  color: var(--color-text, #17212b);
  font-size: 0.92rem;
  line-height: 1.55;
  cursor: pointer;
}

.sub-check > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sub-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--color-primary, #033669);
}

.sub-secure-note,
.sub-disclaimer {
  width: 100%;
  min-width: 0;
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--color-bg-alt, #f5f7f9);
  border-radius: var(--radius, 6px);
  color: var(--color-text-muted, #63717d);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ---------- Actions ---------- */

.sub-actions {
  width: 100%;
  min-width: 0;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--color-hairline, #e6ebf0);
}

.sub-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 48px;
  padding: 14px 28px;
  background: var(--color-primary, #033669);
  color: #fff;
  border: 1px solid var(--color-primary, #033669);
  border-radius: var(--radius, 6px);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-submit:hover:not(:disabled) {
  background: #04477f;
  transform: translateY(-2px);
}

.sub-submit:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

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

.sub-error,
.sub-form-error {
  max-width: 100%;
  margin: 0;
  color: #c0392b;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sub-error:empty,
.sub-form-error:empty {
  display: none;
}

.sub-form-error {
  margin-top: 14px;
  font-weight: 600;
}

.sub-summary {
  width: 100%;
  min-width: 0;
  margin: 0 0 20px;
  padding: 18px 20px;
  background: #fdecea;
  border-left: 3px solid #c0392b;
  border-radius: var(--radius, 6px);
}

.sub-summary:focus {
  outline: none;
}

.sub-summary-title {
  margin: 0 0 8px;
  color: #c0392b;
  font-size: 0.95rem;
  font-weight: 600;
}

.sub-summary ul {
  margin: 0;
  padding-left: 18px;
}

.sub-summary li {
  margin-bottom: 4px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.sub-summary a {
  color: #c0392b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sub-field.has-error input,
.sub-field.has-error select,
.sub-field.has-error textarea {
  border-color: #c0392b;
}

.sub-upload.has-error {
  border-color: #c0392b;
  background: #fdf6f5;
}

.sub-section.has-error .sub-section-title::after {
  content: " — needs attention";
  color: #c0392b;
  font-size: 0.8rem;
  font-weight: 500;
}

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

.sub-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Responsive: laptop/tablet ---------- */

@media (max-width: 1100px) {
  .sub-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .sub-rail {
    position: static;
  }

  .sub-rail-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    border: 0;
  }

  .sub-rail-item {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(3, 54, 105, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
  }

  .sub-rail-item.is-active {
    border-color: rgba(3, 54, 105, 0.26);
    background: #fff;
  }

  .sub-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sub-choice-grid,
  .sub-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Responsive: tablet/mobile ---------- */

@media (max-width: 760px) {
  .sub-shell {
    width: min(100% - 32px, 1180px);
  }

  .sub-hero {
    padding: 46px 0 40px;
    margin-bottom: 28px;
  }

  .sub-rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sub-grid-2,
  .sub-grid-3,
  .sub-choice-grid,
  .sub-upload-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sub-section {
    padding: 22px;
  }

  .sub-pill-row {
    gap: 8px;
  }

  .sub-pill span {
    padding: 9px 13px;
  }

  .sub-submit {
    width: 100%;
  }
}

/* ---------- Responsive: narrow mobile ---------- */

@media (max-width: 480px) {
  .sub-shell {
    width: min(100% - 24px, 1180px);
  }

  .sub-hero-title {
    font-size: clamp(1.85rem, 9vw, 2.3rem);
  }

  .sub-section {
    padding: 18px;
    border-radius: 6px;
  }

  .sub-rail-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .sub-rail-item {
    padding: 9px 10px;
  }

  .sub-scale {
    width: 100%;
    gap: 7px;
  }

  .sub-upload {
    padding: 14px;
  }

  .sub-secure-note,
  .sub-disclaimer {
    padding: 12px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sub-submit:hover:not(:disabled) {
    transform: none;
  }

  .sub-page * {
    transition-duration: 1ms !important;
  }
}
