/* =============================================================================
   REB RESOURCES PAGE — APPLET STYLES
   Loaded after styles.css, only on resources.html. Reuses the site's existing
   custom properties (--orange, --ink, --muted, --soft, --line, --shadow, etc.)
   defined in :root in styles.css, and its .section/.eyebrow/.display/.lead/
   .btn/.btn-orange/.btn-dark/.btn-outline components.
   Mobile-first: base rules target small screens, larger layouts live in the
   min-width media queries near the bottom of each block.
   ============================================================================= */

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

/* ---------- Reveal-on-scroll ------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Applet section shell ---------------------------------------- */
.applet-section + .applet-section {
  padding-top: 0;
}
.applet-head {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}
.pdf-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.76rem;
  font-weight: 800;
  transition: border-color 0.2s ease-out, color 0.2s ease-out;
}
.pdf-link:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ---------- Sector selector ---------------------------------------------- */
.sector-select {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0;
}
.sector-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s ease-out, background-color 0.2s ease-out, color 0.2s ease-out, transform 0.15s ease-out;
}
.sector-btn:hover {
  border-color: var(--orange);
}
.sector-btn:active {
  transform: scale(0.96);
}
.sector-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

/* ---------- Sticky overall readiness bar ---------------------------------- */
.readiness-sticky {
  position: sticky;
  top: 78px;
  z-index: 800;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.readiness-sticky-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.readiness-label {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.readiness-pct {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--orange);
}
.readiness-bar {
  height: 8px;
  background: #ece9e3;
  border-radius: 999px;
  overflow: hidden;
}
.readiness-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--orange), var(--orange2));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (min-width: 901px) {
  .readiness-sticky {
    top: 88px;
  }
}

/* ---------- Checklist category cards --------------------------------------- */
.checklist-categories {
  display: grid;
  gap: 20px;
  margin-top: 8px;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #111;
  color: #fff;
  padding: 16px 20px;
}
.cat-head h3 {
  margin: 0;
  font-size: 0.96rem;
}
.cat-count {
  font-size: 0.72rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.cat-progress {
  height: 4px;
  background: #2a2a2a;
}
.cat-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--orange);
  transition: width 0.35s ease-out;
}

/* ---------- Checklist rows / custom animated checkbox ------------------------ */
.check-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.25s ease-out;
}
.check-row:first-child {
  border-top: 0;
}
.check-row:hover {
  background: #fafaf8;
}
.check-row.is-priority {
  background: linear-gradient(90deg, rgba(233, 97, 38, 0.06), transparent 45%);
}
.check-row.is-checked {
  background: #fff7f2;
}
.check-input {
  position: absolute;
  opacity: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  top: 16px;
  left: 18px;
  cursor: pointer;
}
.check-input:focus-visible ~ .check-box {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
.check-box {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid #c9c9c3;
  border-radius: 6px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  background: #fff;
  transition: border-color 0.25s ease-out, background-color 0.25s ease-out;
}
.check-input:checked ~ .check-box {
  border-color: var(--orange);
  background: var(--orange);
}
.check-box svg {
  width: 14px;
  height: 14px;
}
.check-path {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  transition: stroke-dashoffset 0.3s ease-out;
}
.check-input:checked ~ .check-box .check-path {
  stroke-dashoffset: 0;
}
.check-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.check-label {
  font-size: 0.89rem;
  color: var(--ink);
  line-height: 1.45;
}
.check-row.is-checked .check-label {
  color: #767676;
}
.sector-badge[hidden] {
  display: none;
}
.sector-badge {
  display: inline-block;
  width: max-content;
  background: rgba(233, 97, 38, 0.12);
  color: var(--orange);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 9px;
  border-radius: 999px;
}

/* ---------- Results panel (checklist) -------------------------------------- */
.applet-results {
  margin-top: 44px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
}
.results-band {
  margin-bottom: 26px;
}
.band-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
}
.band-message {
  font-size: 1rem;
  color: var(--ink);
  max-width: 620px;
  margin: 0;
}
.where-to-start h3 {
  font-size: 1.02rem;
  margin: 0 0 14px;
}
.where-to-start ol,
.quiz-priorities ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.where-to-start li,
.quiz-priorities li {
  background: var(--soft);
  border-left: 3px solid var(--orange);
  padding: 14px 16px;
  border-radius: 4px;
  font-size: 0.87rem;
}
.wts-cat {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}

/* ---------- CTA card (shared) ------------------------------------------------ */
.cta-mount {
  margin-top: 8px;
}
.cta-card {
  margin-top: 36px;
  background: var(--orange);
  color: #fff;
  border-radius: 18px;
  padding: clamp(26px, 5vw, 50px);
}
.cta-card h3 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.cta-card .cta-copy {
  margin: 0 0 24px;
  max-width: 520px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.94);
}
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.cta-primary-btn {
  background: #fff;
  color: #111;
}
.cta-primary-btn:hover {
  background: #111;
  color: #fff;
  transform: translateY(-2px);
}
.cta-secondary-link {
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 2px;
  transition: border-color 0.2s ease-out;
}
.cta-secondary-link:hover {
  border-color: #fff;
}
.lead-capture {
  margin-top: 26px;
}
.lead-toggle {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s ease-out;
}
.lead-toggle:hover {
  background: rgba(255, 255, 255, 0.24);
}
.lead-form[hidden] {
  display: none;
}
.lead-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.lead-form input {
  flex: 1 1 160px;
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.85rem;
  outline: none;
}
.lead-form button {
  flex: none;
}
.lead-status {
  width: 100%;
  font-size: 0.78rem;
  margin-top: 4px;
  color: #fff;
}

/* ---------- Feedback trigger + modal (shared) -------------------------------- */
.feedback-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 34px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.2s ease-out;
}
.feedback-trigger:hover {
  color: var(--orange);
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.feedback-modal[hidden] {
  display: none;
}
.feedback-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.feedback-modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  padding: 32px;
  max-height: 90vh;
  overflow: auto;
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.feedback-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: #f2f2f0;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease-out, color 0.2s ease-out;
}
.feedback-close:hover {
  background: var(--orange);
  color: #fff;
}
.feedback-modal-card h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}
.feedback-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 18px;
}
.rating-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.rate-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #d9d9d9;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s ease-out, background-color 0.2s ease-out, color 0.2s ease-out, transform 0.15s ease-out;
}
.rate-btn:hover {
  border-color: var(--orange);
}
.rate-btn.selected {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  transform: scale(1.08);
}
#feedbackForm textarea,
#feedbackForm input {
  width: 100%;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  padding: 11px 13px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}
#feedbackForm textarea {
  min-height: 90px;
  resize: vertical;
}
#feedbackForm textarea:focus,
#feedbackForm input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(233, 97, 38, 0.1);
}
.feedback-status {
  font-size: 0.78rem;
  min-height: 1em;
}

/* =============================================================================
   APPLET 2 — QUIZ
   ============================================================================= */
.quiz-shell {
  background: var(--soft);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 44px);
  margin-top: 36px;
}
.quiz-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.quiz-progress-bar {
  flex: 1;
  max-width: 220px;
  height: 5px;
  background: #e3e3dd;
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--orange);
  transition: width 0.4s ease-out;
}
.quiz-screen-wrap {
  position: relative;
}
.quiz-screen {
  display: none;
}
.quiz-screen.active {
  display: block;
}
@keyframes qEnterNext {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes qEnterBack {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.quiz-screen.enter-next {
  animation: qEnterNext 0.35s ease-out;
}
.quiz-screen.enter-back {
  animation: qEnterBack 0.35s ease-out;
}
.quiz-q-text {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  margin: 0 0 22px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out;
}
.quiz-opt:hover {
  border-color: var(--orange);
}
.quiz-opt:active {
  transform: scale(0.98);
}
.opt-key {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d4d4ce;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 900;
  transition: border-color 0.2s ease-out, background-color 0.2s ease-out, color 0.2s ease-out;
}
.opt-text {
  font-size: 0.92rem;
  color: var(--ink);
}
.quiz-opt.selected {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(233, 97, 38, 0.12);
}
.quiz-opt.selected .opt-key {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
}
.quiz-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Quiz results ------------------------------------------------------ */
.quiz-results {
  margin-top: 40px;
  text-align: center;
}
.quiz-results[hidden] {
  display: none;
}
.score-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 20px;
}
.score-ring {
  width: 100%;
  height: 100%;
}
.ring-track {
  fill: none;
  stroke: #eee;
  stroke-width: 12;
}
.ring-fill {
  fill: none;
  stroke: var(--orange);
  stroke-width: 12;
  stroke-linecap: round;
  transform-origin: 80px 80px;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-ring-label strong {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.score-ring-label span {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-top: 4px;
}
.quiz-results .band-message {
  max-width: 520px;
  margin: 0 auto 30px;
}
.quiz-priorities {
  text-align: left;
  max-width: 560px;
  margin: 0 auto 10px;
}
.quiz-priorities h3 {
  font-size: 1.02rem;
  margin: 0 0 14px;
  text-align: center;
}
.quiz-retake {
  margin-top: 30px;
}

/* ---------- Mobile-only sticky CTA bar ----------------------------------------- */
.mobile-cta-bar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 1500;
  background: #111;
  color: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(140%);
  transition: transform 0.35s ease-out;
  pointer-events: none;
}
.mobile-cta-bar span {
  font-size: 0.78rem;
  font-weight: 700;
}
.mobile-cta-bar.show {
  transform: translateY(0);
  pointer-events: auto;
}
@media (min-width: 681px) {
  .mobile-cta-bar {
    display: none;
  }
}

/* ---------- Larger screens ------------------------------------------------------ */
@media (min-width: 560px) {
  .quiz-options {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 700px) {
  .applet-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

/* ---------- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #checklist-app *,
  #quiz-app *,
  .feedback-modal *,
  .mobile-cta-bar {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
