/* ============================================================
 * AutoStore Fit Tool - module.css
 * Mobile-first. Defaults follow the Kardex 2020 design system
 * (see assets/css/ui_12_1_21.css): Open Sans body, MaxPro
 * headings, bronze #976e44 accent, slate #546a7a text, pill
 * uppercase buttons. Retheme by overriding the variables below.
 * ============================================================ */
.asft-root {
  --asft-primary: #976e44;            /* Kardex bronze accent */
  --asft-primary-dark: #7a5937;       /* hover/active state */
  --asft-primary-contrast: #ffffff;
  --asft-font: inherit;               /* body font; the page loads Open Sans */
  --asft-heading-font: MaxPro, "Open Sans", sans-serif;
  --asft-radius: 4px;                 /* cards and panels */
  --asft-btn-radius: 100px;           /* Kardex buttons are pills */
  --asft-text: #546a7a;               /* Kardex slate */
  --asft-muted: #6f8a9d;
  --asft-border: #dde1e4;
  --asft-surface: #ffffff;
  --asft-surface-tint: #eff3f6;       /* Kardex light panel background */
  --asft-max-width: 44rem;

  font-family: var(--asft-font);
  color: var(--asft-text);
  max-width: var(--asft-max-width);
  margin: 0 auto;
}

/* Site-wide resets (e.g. section { display: block } in the Kardex ui_*.css)
 * are author styles and defeat the UA stylesheet's [hidden] { display: none },
 * which would reveal every quiz step at once. Enforce it inside the module. */
.asft-root [hidden] { display: none !important; }

/* ---------- Collapsible wrapper ---------- */
.asft-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.25rem;
  font-family: var(--asft-heading-font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--asft-text);
  background: var(--asft-surface-tint);
  border: 1px solid var(--asft-border);
  border-radius: var(--asft-radius);
  cursor: pointer;
}

.asft-toggle:hover { border-color: var(--asft-primary); color: var(--asft-primary); }

.asft-toggle:focus-visible {
  outline: 2px solid var(--asft-primary);
  outline-offset: 2px;
}

.asft-toggle-icon {
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-right: 2px solid var(--asft-primary);
  border-bottom: 2px solid var(--asft-primary);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.asft-toggle.is-open .asft-toggle-icon { transform: rotate(-135deg); }

.asft-toggle + .asft-body { margin-top: 1.25rem; }

/* ---------- Intro ---------- */
.asft-intro { margin-bottom: 1.5rem; }

.asft-intro-headline {
  margin: 0 0 0.5rem;
  font-family: var(--asft-heading-font);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--asft-text);
}

.asft-intro-text { color: var(--asft-muted); }

.asft-intro--center { text-align: center; }

/* ---------- Progress ---------- */
.asft-progress { margin-bottom: 1.5rem; }

.asft-progress-text {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.166em;
  text-transform: uppercase;
  color: var(--asft-muted);
}

.asft-progress-track {
  height: 4px;
  background: var(--asft-border);
  border-radius: 999px;
  overflow: hidden;
}

.asft-progress-fill {
  height: 100%;
  width: 0;
  background: var(--asft-primary);
  border-radius: inherit;
  transition: width 0.3s ease;
}

/* ---------- Steps ---------- */
.asft-step { outline: none; }

.asft-step.is-active { animation: asft-step-in 0.3s ease both; }

@keyframes asft-step-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}

.asft-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.asft-question {
  padding: 0;
  margin-bottom: 1.25rem;
  font-family: var(--asft-heading-font);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--asft-text);
}

/* ---------- Answer cards ---------- */
.asft-answers {
  display: grid;
  gap: 0.75rem;
}

.asft-card {
  position: relative;
  display: block;
  padding: 1rem 1.25rem;
  background: var(--asft-surface);
  border: 1px solid var(--asft-border);
  border-radius: var(--asft-radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.asft-card:hover { border-color: var(--asft-primary); }

/* The real radio input stays in the tree for keyboard and screen
 * reader support; the card is its visual representation. */
.asft-card-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

/* Focus ring only for keyboard navigation. Plain :focus-within also fires
 * on mouse clicks, which stacked this outline on top of the selection ring
 * and read as a double line around the chosen answer. */
.asft-card:has(.asft-card-input:focus-visible) {
  outline: 2px solid var(--asft-primary);
  outline-offset: 2px;
}

@supports not selector(:has(*)) {
  .asft-card:focus-within {
    outline: 2px solid var(--asft-primary);
    outline-offset: 2px;
  }
}

.asft-card-input:checked ~ .asft-card-label { font-weight: 700; color: var(--asft-primary); }

.asft-card:has(.asft-card-input:checked) {
  border-color: var(--asft-primary);
  background: var(--asft-surface-tint);
  box-shadow: 0 0 0 1px var(--asft-primary);
}

/* Fallback for browsers without :has() support. Gated so it never stacks
 * on top of the :has() rule above (that produced a double outline). */
@supports not selector(:has(*)) {
  .asft-card-input:checked + .asft-card-label::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--asft-primary);
    border-radius: var(--asft-radius);
    pointer-events: none;
  }
}

.asft-card-label { display: block; }

/* ---------- Navigation ---------- */
.asft-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.asft-nav [data-asft-next] { margin-left: auto; }

/* Kardex button: pill, bold uppercase Open Sans, wide tracking */
.asft-btn {
  display: inline-block;
  padding: 1.1em 2.5em 1em;
  font-family: var(--asft-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: 0.166em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  border-radius: var(--asft-btn-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.asft-btn:focus-visible {
  outline: 2px solid var(--asft-primary);
  outline-offset: 2px;
}

.asft-btn--primary {
  background: var(--asft-primary);
  border-color: var(--asft-primary);
  color: var(--asft-primary-contrast);
}

.asft-btn--primary:hover {
  background: var(--asft-primary-dark);
  border-color: var(--asft-primary-dark);
}

.asft-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--asft-primary);
  border-color: var(--asft-primary);
}

.asft-btn--ghost {
  background: transparent;
  color: var(--asft-primary);
  border-color: var(--asft-primary);
}

.asft-btn--ghost:hover {
  background: var(--asft-primary);
  color: var(--asft-primary-contrast);
}

/* ---------- Form step ---------- */
/* HubSpot's inline validation messages (.hsfc-ErrorAlert) render in-flow
 * and push everything below them down the moment a field is left invalid.
 * Reserve a constant slot under every field and position the message
 * inside it, so validation never shifts the layout. */
.asft-root .hs-form-html [class*="hsfc-"][class*="Field"] {
  position: relative;
  padding-bottom: 1.5rem;
}

.asft-root .hs-form-html .hsfc-ErrorAlert {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* In the error state HubSpot also adds margin-bottom to the input to make
 * room for the in-flow message; with the message absolute it is pure
 * layout shift, so neutralize it (it is 0 in the normal state anyway). */
.asft-root .hs-form-html [class*="hsfc-"][class*="Field"] input,
.asft-root .hs-form-html [class*="hsfc-"][class*="Field"] select,
.asft-root .hs-form-html [class*="hsfc-"][class*="Field"] textarea {
  margin-bottom: 0 !important;
}

.asft-editor-note {
  padding: 1rem;
  color: var(--asft-muted);
  border: 1px dashed var(--asft-border);
  border-radius: var(--asft-radius);
}

/* ---------- Result view ---------- */
.asft-results { outline: none; }

.asft-result {
  animation: asft-step-in 0.3s ease both;
  padding: 1.75rem;
  background: var(--asft-surface-tint);
  border-radius: var(--asft-radius);
}

.asft-result-headline {
  margin: 0 0 0.75rem;
  font-family: var(--asft-heading-font);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--asft-text);
}

.asft-result-body { margin-bottom: 1.5rem; }

.asft-result-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.asft-restart-row { margin-top: 1rem; }

/* ---------- Larger screens ---------- */
@media (min-width: 600px) {
  .asft-intro-headline, .asft-result-headline { font-size: 2rem; }
  .asft-question { font-size: 1.45rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .asft-step.is-active,
  .asft-result { animation: none; }
  .asft-progress-fill,
  .asft-toggle-icon,
  .asft-card,
  .asft-btn { transition: none; }
}
