*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --cpc-green: #2D5016;
  --cpc-green-mid: #3D6B20;
  --cpc-green-light: #EEF3E8;
  --cpc-red: #C0392B;
  --cpc-tan: #F5F0E8;
  --cpc-tan-dark: #D9C9A8;
  --cpc-gold: #B8860B;
  --cpc-text: #1A2E0A;
  --bg: #F7F5F0;
  --card-bg: #ffffff;
  --border: rgba(0,0,0,0.12);
  --text-secondary: #5a5a4a;
}
.hdys-scope {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--bg);
  color: var(--cpc-text);
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
}
.hdys-scope .wrap { max-width: 700px; margin: 0 auto; }

/* Full-screen takeover: when the host page contains the [hdys_survey]
   shortcode, the plugin adds the body class .hdys-fullscreen. We then
   pin the survey above all theme chrome (header, sidebar, footer). */
body.hdys-fullscreen { overflow: hidden !important; }
body.hdys-fullscreen .hdys-scope {
  position: fixed;
  inset: 0;
  z-index: 999999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Keep the WP admin bar visible above the takeover for logged-in editors */
body.hdys-fullscreen.admin-bar .hdys-scope { top: 32px; }
@media screen and (max-width: 782px) {
  body.hdys-fullscreen.admin-bar .hdys-scope { top: 46px; }
}

/* Header */
.header {
  background: var(--cpc-green);
  border-radius: 16px;
  padding: 2.25rem 2.25rem 2rem;
  margin-bottom: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.header::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 60px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
}
.header-badge {
  display: inline-block;
  background: var(--cpc-red);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 0.85rem;
}
.header h1 {
  font-family: 'Nunito', sans-serif;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.header p {
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.65;
  max-width: 540px;
}
.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 1.5rem;
}
.meta-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 5px;
}
.meta-field input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 0.5px solid rgba(255,255,255,0.28);
  border-radius: 7px;
  padding: 8px 10px;
  color: #fff;
  font-size: 13px;
  font-family: 'Nunito Sans', sans-serif;
}
.meta-field input::placeholder { color: rgba(255,255,255,0.38); }
.meta-field input:focus { outline: none; border-color: rgba(255,255,255,0.65); background: rgba(255,255,255,0.16); }

/* Instructions */
.instructions {
  background: var(--cpc-tan);
  border: 0.5px solid var(--cpc-tan-dark);
  border-radius: 12px;
  padding: 1.35rem 1.6rem;
  margin-bottom: 1.5rem;
}
.instructions h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cpc-green);
  margin-bottom: 0.7rem;
}
.instructions ol { padding-left: 1.25rem; }
.instructions li {
  font-size: 13.5px;
  color: #4a3c1e;
  line-height: 1.7;
  margin-bottom: 0.25rem;
}
.legend-row {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--cpc-tan-dark);
  flex-wrap: wrap;
}
.leg { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #6b5a35; }
.leg-swatch { width: 30px; height: 14px; border-radius: 4px; }
.leg-swatch.current { background: var(--cpc-green-light); border: 2px solid var(--cpc-green); }
.leg-swatch.ideal { background: #dbeeff; border: 2px solid #2980b9; }
.leg-swatch.both { background: #d4ebd0; border: 2px solid var(--cpc-green-mid); }

/* Progress */
.progress-wrap { margin-bottom: 1.1rem; }
.progress-text { font-size: 12px; color: var(--text-secondary); text-align: right; margin-bottom: 5px; }
.progress-bar-bg { background: var(--cpc-tan-dark); border-radius: 4px; height: 4px; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: var(--cpc-green); transition: width 0.3s; width: 0%; }

/* Question card */
.q-card {
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.q-num {
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cpc-green-mid);
  margin-bottom: 0.35rem;
}
.q-title {
  font-family: 'Nunito', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--cpc-text);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.8rem;
}
.mode-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.mode-tabs {
  display: inline-flex;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.mtab {
  padding: 5px 14px;
  font-size: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.13s;
}
.mtab.active { background: var(--cpc-green); color: #fff; }
.mtab:hover:not(.active) { background: var(--cpc-green-light); }

.options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.9rem; }
.opt-row { display: flex; align-items: flex-start; gap: 9px; }
.opt-letter {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: var(--cpc-green-mid);
  min-width: 18px;
  padding-top: 10px;
  user-select: none;
}
.opt-btn {
  flex: 1;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: left;
  font-size: 13.5px;
  font-family: 'Nunito Sans', sans-serif;
  color: var(--cpc-text);
  cursor: pointer;
  transition: all 0.13s;
  line-height: 1.55;
}
.opt-btn:hover { border-color: var(--cpc-green-mid); background: var(--cpc-green-light); }
.opt-btn.sel-current { border-color: var(--cpc-green); background: var(--cpc-green-light); font-weight: 600; }
.opt-btn.sel-ideal { border-color: #2980b9; background: #dbeeff; }
.opt-btn.sel-both { border-color: var(--cpc-green); background: #d4ebd0; font-weight: 600; }

.hard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 0.8rem;
  border-top: 0.5px solid rgba(0,0,0,0.08);
  flex-wrap: wrap;
}
.hard-label { font-size: 12.5px; color: var(--text-secondary); }
.hard-tabs {
  display: inline-flex;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.htab {
  padding: 4px 16px;
  font-size: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.13s;
}
.htab.yes { background: var(--cpc-red); color: #fff; }
.htab.no { background: var(--cpc-green-mid); color: #fff; }

/* Validation notice */
.hdys-notice {
  background: #fdecea;
  border: 1px solid var(--cpc-red);
  border-left: 4px solid var(--cpc-red);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
  color: #5a1a14;
  font-size: 13.5px;
  line-height: 1.6;
}
.hdys-notice strong { display: block; margin-bottom: 0.4rem; color: var(--cpc-red); }
.hdys-notice ul { margin: 0.25rem 0 0 1.25rem; padding: 0; }
.hdys-notice li { margin: 2px 0; }

/* Highlight cards that still need answers when validation fails */
.q-card.unanswered {
  border-color: var(--cpc-red);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.18);
}

/* Submit */
.submit-wrap { text-align: center; margin-top: 2.25rem; }
.submit-btn {
  background: var(--cpc-green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px 48px;
  font-size: 16px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.submit-btn:hover { background: var(--cpc-green-mid); }

/* Result */
.result {
  display: none;
  background: var(--cpc-green);
  color: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  margin-top: 2rem;
}
.result-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0.35rem;
}
.result-score {
  font-family: 'Nunito', sans-serif;
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  margin: 0.25rem 0;
}
.result-bar-bg { background: rgba(255,255,255,0.2); border-radius: 4px; height: 6px; margin: 1rem auto; max-width: 360px; overflow: hidden; }
.result-bar-fill { height: 100%; border-radius: 4px; background: #fff; transition: width 0.7s ease; }
.result-sub { display: flex; justify-content: center; margin: 0.75rem 0 0.25rem; }
.result-sub-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.result-sub-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; }
.result-sub-val { font-family: 'Nunito', sans-serif; font-size: 28px; font-weight: 800; opacity: 0.85; }
.result-msg {
  font-size: 14.5px;
  opacity: 0.88;
  line-height: 1.7;
  margin: 0.75rem auto 0;
  max-width: 460px;
}
.result-detail {
  margin-top: 1.5rem;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  font-size: 13px;
  text-align: left;
}
.result-detail p { margin-bottom: 0.4rem; opacity: 0.88; line-height: 1.6; }
.result-detail .detail-head { font-weight: 700; opacity: 1; margin-bottom: 0.6rem; }

.print-btn {
  margin-top: 1.5rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.print-btn:hover { background: rgba(255,255,255,0.22); }

.footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.7;
}

@media (max-width: 520px) {
  .meta-row { grid-template-columns: 1fr 1fr; }
  .header h1 { font-size: 24px; }
  .hdys-scope { padding: 1rem 0.75rem 3rem; }
}
@media (max-width: 380px) {
  .meta-row { grid-template-columns: 1fr; }
}

/* ── Print ─────────────────────────────────────────────────────────────────
   Two things have to happen in print:
   1. UNDO the full-screen overlay. position:fixed + overflow:auto causes
      print engines to output only the currently-visible viewport — every
      question scrolled off-screen gets clipped. We restore static flow so
      the survey paginates normally.
   2. HIDE theme chrome and interactive controls so the printed page is
      just the survey + score. */
@media print {
  @page { margin: 0.5in; }

  html, body { background: #fff !important; }
  body.hdys-fullscreen { overflow: visible !important; }
  body.hdys-fullscreen .hdys-scope,
  .hdys-scope {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    overflow: visible !important;
    z-index: auto !important;
    padding: 0 !important;
    background: #fff !important;
  }

  /* Hide WordPress admin bar and common theme chrome */
  #wpadminbar,
  header, .site-header, #masthead, #site-header,
  nav, .site-navigation, .main-navigation, #site-navigation,
  aside, .sidebar, #sidebar, .widget-area,
  footer.site-footer, .site-footer, #colophon {
    display: none !important;
  }

  /* Hide interactive UI that doesn't belong on paper */
  .submit-wrap, .print-btn, .mode-row, .hard-row, .progress-wrap { display: none !important; }

  /* Force backgrounds and brand colors to actually print */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .hdys-scope .wrap { max-width: 100%; }
  .q-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
  .result { break-inside: avoid; page-break-inside: avoid; }
  .header, .result { box-shadow: none; }
}