/* ==========================================================================
   IMPETUS Citizen Science Toolkit - Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
:root {
  --impetus-dark: #1a1a2e;
  --impetus-teal: #00b4d8;
  --impetus-red: #e63946;
  --impetus-orange: #f4a261;
  --impetus-yellow: #e9c46a;
  --impetus-green: #2a9d8f;
  --impetus-blue: #457b9d;
  --impetus-purple: #6a4c93;
  --text-primary: #222222;
  --text-secondary: #555555;
  --bg-light: #f8f9fa;
  --border-radius: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.14);
  --sidebar-width: 280px;
  --transition: 0.25s ease;
}

/* --------------------------------------------------------------------------
   2. Base / Reset / Typography
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

.impetus-toolkit-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.impetus-toolkit-wrapper *,
.impetus-toolkit-wrapper *::before,
.impetus-toolkit-wrapper *::after {
  box-sizing: border-box;
}

.impetus-toolkit-wrapper h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 1rem;
}

.impetus-toolkit-wrapper h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.85rem;
}

.impetus-toolkit-wrapper h3 {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.75rem;
}

.impetus-toolkit-wrapper h4 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.6rem;
}

.impetus-toolkit-wrapper p {
  margin: 0 0 0.75rem;
  padding-bottom: 0 !important;
}

.impetus-toolkit-wrapper ul,
.impetus-toolkit-wrapper ol {
  padding-bottom: 0 !important;
}

.impetus-toolkit-wrapper a {
  color: var(--impetus-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.impetus-toolkit-wrapper a:hover {
  color: var(--impetus-teal);
}

.impetus-toolkit-wrapper ul,
.impetus-toolkit-wrapper ol {
  margin: 0 0 1em;
  padding-left: 1.5rem;
}

.impetus-toolkit-wrapper li {
  margin-bottom: 0.35rem;
}

.impetus-toolkit-wrapper img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   3. Theme Overrides (Salient / generic theme resets)
   -------------------------------------------------------------------------- */
.impetus-toolkit-page .main-content,
.impetus-toolkit-page #ajax-content-wrap,
.impetus-toolkit-page .container-wrap,
.impetus-toolkit-page .container,
.impetus-toolkit-page .post-area,
.impetus-toolkit-page .content-inner,
.impetus-toolkit-page .wpb_wrapper {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.impetus-toolkit-page #header-outer,
.impetus-toolkit-page #footer-outer {
  /* keep header/footer, just ensure toolkit area is clean */
}

/* --------------------------------------------------------------------------
   4. Progress Bar
   -------------------------------------------------------------------------- */
#impetus-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  z-index: 1000;
  background: linear-gradient(
    90deg,
    var(--impetus-red),
    var(--impetus-orange),
    var(--impetus-yellow),
    var(--impetus-green),
    var(--impetus-teal),
    var(--impetus-blue),
    var(--impetus-purple)
  );
  transition: width 0.3s ease;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. Skip to Content (a11y)
   -------------------------------------------------------------------------- */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 2000;
  background: var(--impetus-teal);
  color: #fff;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 0 0 var(--border-radius) 0;
  text-decoration: none;
}

.skip-to-content:focus {
  position: fixed;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
}

/* --------------------------------------------------------------------------
   6. Layout
   -------------------------------------------------------------------------- */
.impetus-toolkit-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  background: var(--bg-light);
}

/* --------------------------------------------------------------------------
   7. Sidebar Navigation
   -------------------------------------------------------------------------- */
.impetus-toolkit-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  background: #ffffff;
  z-index: 1000;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

body.nav-open .impetus-toolkit-nav {
  transform: translateX(0);
}

/* Desktop: sidebar always visible, below theme header */
@media (min-width: 901px) {
  .impetus-toolkit-nav {
    transform: translateX(0);
    top: var(--theme-header-height, 0px);
    height: calc(100vh - var(--theme-header-height, 0px));
  }
}

/* Sidebar header */
.impetus-toolkit-nav .nav-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.impetus-toolkit-nav .nav-header .nav-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--impetus-dark);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.3;
}

.impetus-toolkit-nav .nav-header .nav-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-weight: 400;
}

/* Nav sections (accordion) */
.impetus-toolkit-nav .nav-sections {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  border-bottom: 1px solid #f0f0f0;
}

.nav-section:last-child {
  border-bottom: none;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 24px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  line-height: 1.4;
}

.nav-section-title:hover {
  background: var(--bg-light);
  color: var(--impetus-teal);
}

/* Arrow indicator */
.nav-section-title::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.nav-section.expanded .nav-section-title::after {
  transform: rotate(45deg);
}

.nav-section.expanded .nav-section-title {
  color: var(--impetus-teal);
}

/* Phase title highlight when its page is active */
.nav-section.phase-active > .nav-section-title,
.nav-section.phase-active > .nav-section-link {
  color: var(--impetus-teal);
  font-weight: 700;
}

/* Direct link (no sub-items): same look as phase title, no arrow */
.impetus-toolkit-nav .nav-section-link,
.impetus-toolkit-wrapper .nav-section-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  text-align: left;
  line-height: 1.4;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.impetus-toolkit-nav .nav-section-link:hover,
.impetus-toolkit-wrapper .nav-section-link:hover {
  background: var(--bg-light);
  color: var(--impetus-teal);
}

.impetus-toolkit-nav .nav-section.phase-active > .nav-section-link {
  color: var(--impetus-teal);
}

.nav-section-link::after {
  display: none !important;
}

/* Flat nav items (overview): sub-item look, always visible */
.nav-section-flat {
  border-bottom: none;
}

.nav-section-flat .nav-section-link {
  padding: 6px 24px 6px 36px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
}

.impetus-toolkit-nav .nav-section-flat .nav-section-link:hover,
.impetus-toolkit-wrapper .nav-section-flat .nav-section-link:hover {
  color: var(--impetus-teal);
  background: rgba(0, 180, 216, 0.04);
}

.impetus-toolkit-nav .nav-section-flat.phase-active > .nav-section-link {
  color: var(--impetus-teal);
  border-left-color: var(--impetus-teal);
  background: rgba(0, 180, 216, 0.08);
  font-weight: 600;
}

/* Sub-items */
.nav-section-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-section.expanded .nav-section-items {
  max-height: 600px;
}

.nav-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item a {
  display: block;
  padding: 8px 24px 8px 36px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition),
    background var(--transition);
  line-height: 1.5;
}

.nav-item a:hover {
  color: var(--impetus-teal);
  background: rgba(0, 180, 216, 0.04);
}

.nav-item a.active {
  color: var(--impetus-teal);
  border-left-color: var(--impetus-teal);
  background: rgba(0, 180, 216, 0.08);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. Main Content Area
   -------------------------------------------------------------------------- */
.impetus-toolkit-content {
  margin-left: 0;
  flex: 1;
  min-width: 0;
  padding: 48px 56px 80px;
  max-width: 1100px;
}

/* Desktop: offset for fixed sidebar */
@media (min-width: 901px) {
  .impetus-toolkit-content {
    margin-left: var(--sidebar-width);
  }
}

/* Section tab behaviour: hide all, show only active */
.impetus-toolkit-content.tab-mode > .toolkit-section {
  display: none;
}

.impetus-toolkit-content.tab-mode > .toolkit-section.section-active {
  display: block;
}

/* Boxed layout: constrain the whole wrapper within the theme container */
.impetus-toolkit-page .impetus-toolkit-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

.impetus-toolkit-content > section {
  margin-bottom: 64px;
}

.impetus-toolkit-content > section:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   9. Heading Hierarchy
   -------------------------------------------------------------------------- */

/* H1 level — page title: rosso */
.toolkit-section > .toolkit-section-header {
  border-left: 5px solid var(--impetus-red);
  padding-left: 20px;
  margin-bottom: 32px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

/* H2 level — sub-section title: giallo */
.section-body .toolkit-section-header {
  border-left: 4px solid #f0c808;
  padding-left: 16px;
  margin-top: 40px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

/* H4 — sub-headings: verde (only direct section body, not inside cards) */
.impetus-toolkit-wrapper .section-body > h4 {
  border-left: 3px solid #4caf50;
  padding-left: 14px;
  margin-top: 32px;
  margin-bottom: 12px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

/* H4 inside cards: compact, no bar */
.card-tools h4,
.card-guidelines h4,
.card-info-box h4,
.card-guiding-questions h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 6px;
  border-left: none;
  padding-left: 0;
}

/* H5 — sub-sub-headings: azzurro (only direct section body) */
.impetus-toolkit-wrapper .section-body > h5 {
  border-left: 2px solid #42a5f5;
  padding-left: 12px;
  margin-top: 24px;
  margin-bottom: 1em;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   10. Card Base
   -------------------------------------------------------------------------- */
.toolkit-card {
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  transition: box-shadow var(--transition);
}

/* Card header shared */
.toolkit-card .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 1.1rem;
  font-weight: 600;
}

.toolkit-card .card-header .card-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.toolkit-card .card-body p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   10a. Card — Guiding Questions
   -------------------------------------------------------------------------- */
.card-guiding-questions {
  background: #e8f8fb;
  border-left: 4px solid var(--impetus-teal);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.card-guiding-questions .card-header,
.card-tools .card-header,
.card-guidelines .card-header,
.card-info-box .card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-guiding-questions .card-header::before {
  content: "\2753";
  margin-right: 4px;
  font-size: 1.1rem;
}

.card-guiding-questions .guiding-hint {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   10b. Card — Tools
   -------------------------------------------------------------------------- */
.card-tools {
  background: #e8f5e9;
  border-left: 4px solid var(--impetus-green);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.card-tools .card-header::before {
  content: "\1F6E0\FE0F";
  margin-right: 4px;
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   10c. Card — Guidelines
   -------------------------------------------------------------------------- */
.card-guidelines {
  background: #fff3e0;
  border-left: 4px solid var(--impetus-orange);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.card-guidelines .card-header::before {
  content: "\1F4CB";
  margin-right: 4px;
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   10d. Card — Info Box
   -------------------------------------------------------------------------- */
.card-info-box {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.card-info-box .card-header::before {
  content: "\2139\FE0F";
  margin-right: 4px;
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   10e. Card — Case Study (styled like tools, with left border)
   -------------------------------------------------------------------------- */
.card-case-study {
  background: #f0f7ff;
  border-left: 4px solid var(--impetus-blue);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  transition: box-shadow var(--transition);
}

.card-case-study:hover {
  box-shadow: var(--shadow);
}

.card-case-study .case-study-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  cursor: pointer;
}

.card-case-study .case-study-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: var(--impetus-blue);
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

.card-case-study .case-study-name {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.card-case-study .badge-country {
  background: #d0e4ff;
  color: var(--impetus-blue);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 20px;
}

/* Pathway badges — colors from advocacy pathways figure */
.card-case-study .badge-pathway {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 20px;
  color: #ffffff;
}

.card-case-study .badge-pathway-awareness {
  background: var(--impetus-red);
  color: #ffffff;
}

.card-case-study .badge-pathway-developing-policy {
  background: #f0c808;
  color: #4a3e00;
}

.card-case-study .badge-pathway-monitoring {
  background: #4caf50;
  color: #ffffff;
}

.card-case-study .badge-pathway-implementing {
  background: #42a5f5;
  color: #ffffff;
}

.card-case-study .case-study-image {
  float: right;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 12px 16px;
}

@media (max-width: 600px) {
  .card-case-study .case-study-image {
    float: none;
    display: block;
    margin: 0 auto 12px;
  }
}

/* --------------------------------------------------------------------------
   10f. Collapsible Cards
   -------------------------------------------------------------------------- */

/* Collapsed by default: hide everything except the header */
.card-collapsible:not(.card-expanded) > *:not(.card-header):not(.case-study-header) {
  display: none !important;
}

/* Header becomes clickable toggle */
.card-collapsible .card-header,
.card-collapsible .case-study-header {
  cursor: pointer;
  margin-bottom: 0;
}

.card-collapsible.card-expanded .card-header,
.card-collapsible.card-expanded .case-study-header {
  margin-bottom: 14px;
}

/* Arrow indicator */
.card-collapsible .card-header::after,
.card-collapsible .case-study-header::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.card-collapsible.card-expanded .card-header::after,
.card-collapsible.card-expanded .case-study-header::after {
  transform: rotate(45deg);
}

/* Case study: hide name and country from header when expanded (shown in body with labels) */
.card-case-study.card-expanded .case-study-name,
.card-case-study.card-expanded .badge-country {
  display: none;
}

/* Card body: tighter spacing */
.card-tools p,
.card-guidelines p,
.card-info-box p,
.card-guiding-questions p,
.card-case-study .case-study-body p {
  margin-bottom: 0.2rem;
}

.card-case-study {
  padding-bottom: 16px;
}

/* Collapsed card: reduce padding */
.card-collapsible:not(.card-expanded) {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* --------------------------------------------------------------------------
   10g. Figures
   -------------------------------------------------------------------------- */
.toolkit-figure {
  text-align: center;
  margin: 24px 0;
}

.toolkit-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
}

.figure-caption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 8px 0 24px;
}

/* --------------------------------------------------------------------------
   10g. CTA Button (Download / Read more)
   -------------------------------------------------------------------------- */
.toolkit-cta {
  display: inline-block;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--impetus-teal);
  border: 2px solid var(--impetus-teal);
  border-radius: 4px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-top: 12px;
  letter-spacing: 0.02em;
}

.toolkit-cta:hover,
.impetus-toolkit-wrapper .toolkit-cta:hover,
.impetus-toolkit-content .toolkit-cta:hover {
  background: var(--impetus-teal) !important;
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   10h. Footnote Tooltip
   -------------------------------------------------------------------------- */
.toolkit-footnote {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--impetus-teal);
  background: rgba(0, 180, 216, 0.1);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  vertical-align: super;
  position: relative;
  margin-left: 2px;
}

.toolkit-footnote .footnote-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--impetus-dark);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: var(--border-radius);
  width: 280px;
  line-height: 1.5;
  z-index: 50;
  box-shadow: var(--shadow-hover);
}

.toolkit-footnote .footnote-tooltip a {
  color: #ffffff;
  text-decoration: underline;
}

.toolkit-footnote .footnote-tooltip a:hover {
  color: var(--impetus-teal);
}

.toolkit-footnote .footnote-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--impetus-dark);
}

.toolkit-footnote:hover .footnote-tooltip,
.toolkit-footnote.active .footnote-tooltip,
.toolkit-footnote .footnote-tooltip:hover {
  display: block;
}

/* --------------------------------------------------------------------------
   10i. Video Embed
   -------------------------------------------------------------------------- */
.toolkit-video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 16px 0 24px;
  border-radius: var(--border-radius);
}

.toolkit-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--bg-light);
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
}

.badge--country {
  background: #e3f0ff;
  color: var(--impetus-blue);
}

.badge--topic {
  background: #e8f5e9;
  color: var(--impetus-green);
}

/* --------------------------------------------------------------------------
   11. Checklist
   -------------------------------------------------------------------------- */
.checklist-group {
  margin-bottom: 32px;
}

.checklist-group h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-light);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--impetus-green);
  cursor: pointer;
}

.checklist-item label {
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  transition: color var(--transition);
}

.checklist-item input[type="checkbox"]:checked + label {
  color: var(--text-secondary);
  text-decoration: line-through;
  text-decoration-color: var(--impetus-green);
  text-decoration-thickness: 2px;
}

/* --------------------------------------------------------------------------
   12. Glossary
   -------------------------------------------------------------------------- */
.glossary-filter {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  margin-bottom: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.glossary-filter:focus {
  border-color: var(--impetus-teal);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.glossary-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.glossary-table th {
  background: var(--impetus-dark);
  color: #ffffff;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.glossary-table th:first-child {
  border-radius: var(--border-radius) 0 0 0;
}

.glossary-table th:last-child {
  border-radius: 0 var(--border-radius) 0 0;
}

.glossary-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-size: 0.93rem;
  vertical-align: top;
  color: var(--text-primary);
}

.glossary-table tr:hover td {
  background: rgba(0, 180, 216, 0.03);
}

.glossary-table .glossary-term {
  font-weight: 600;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   13. Lifecycle Diagram (SVG)
   -------------------------------------------------------------------------- */
.lifecycle-diagram {
  display: block;
  margin: 32px auto;
  max-width: 800px;
  width: 100%;
  height: auto;
}

.lifecycle-diagram svg {
  width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   14. Dimensions of Engagement Framework (2x2 grid)
   -------------------------------------------------------------------------- */
.engagement-framework {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  max-width: 700px;
  margin: 32px auto;
  position: relative;
}

.engagement-framework .quadrant {
  background: #ffffff;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: box-shadow var(--transition);
}

.engagement-framework .quadrant:hover {
  box-shadow: var(--shadow-hover);
}

.engagement-framework .quadrant h4 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.engagement-framework .quadrant p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.engagement-framework .center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--impetus-teal);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.3);
  z-index: 2;
  line-height: 1.3;
  padding: 8px;
}

/* --------------------------------------------------------------------------
   15. Back to Top Button
   -------------------------------------------------------------------------- */
#impetus-back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--impetus-dark);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition), visibility var(--transition),
    transform var(--transition), background var(--transition);
  z-index: 90;
}

#impetus-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#impetus-back-to-top:hover {
  background: var(--impetus-teal);
}

/* --------------------------------------------------------------------------
   16. Accessibility — Focus Visible
   -------------------------------------------------------------------------- */
.impetus-toolkit-wrapper *:focus-visible {
  outline: 2px solid var(--impetus-teal);
  outline-offset: 2px;
}

/* Ensure nav links also get proper focus styles */
.impetus-toolkit-nav a:focus-visible,
.impetus-toolkit-nav button:focus-visible {
  outline: 2px solid var(--impetus-teal);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   17. Hamburger Button (mobile)
   -------------------------------------------------------------------------- */
/* Hamburger — fixed left side, vertically centered */
.impetus-hamburger {
  display: flex !important;
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--impetus-teal);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 180, 216, 0.35);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  transition: background var(--transition), box-shadow var(--transition);
}

.impetus-hamburger:hover {
  background: #0096b7;
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.45);
}

/* Desktop: hide hamburger and overlay */
@media (min-width: 901px) {
  .impetus-hamburger {
    display: none !important;
  }

  .impetus-nav-overlay {
    display: none !important;
  }
}

.impetus-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger to X animation when nav is open */
body.nav-open .impetus-hamburger {
  left: calc(var(--sidebar-width) + 12px);
}

body.nav-open .impetus-hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .impetus-hamburger span:nth-child(2) {
  opacity: 0;
}

body.nav-open .impetus-hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   18. Mobile Overlay
   -------------------------------------------------------------------------- */
/* Overlay element (placed in template as .impetus-nav-overlay) */
.impetus-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
  cursor: pointer;
}

body.nav-open .impetus-nav-overlay {
  display: block;
}

/* --------------------------------------------------------------------------
   19. Responsive — Mobile (max-width: 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .impetus-toolkit-content {
    padding: 32px 20px 80px;
  }

  #impetus-back-to-top {
    bottom: 24px;
    right: 24px;
  }

  /* Section headers smaller on mobile */
  .toolkit-section > .toolkit-section-header {
    font-size: 1.5rem;
    padding-left: 14px;
  }

  .section-body .toolkit-section-header {
    font-size: 1.25rem;
    padding-left: 12px;
  }

  .impetus-toolkit-wrapper h1 {
    font-size: 1.75rem;
  }

  .impetus-toolkit-wrapper h2 {
    font-size: 1.4rem;
  }

  .impetus-toolkit-wrapper h3 {
    font-size: 1.15rem;
  }

  /* Cards tighter padding on mobile */
  .toolkit-card {
    padding: 18px 20px;
  }

  .card-case-study {
    padding: 18px 20px;
  }

  /* Glossary table single column on mobile */
  .glossary-table,
  .glossary-table thead,
  .glossary-table tbody,
  .glossary-table tr,
  .glossary-table th,
  .glossary-table td {
    display: block;
    width: 100%;
  }

  .glossary-table thead {
    display: none;
  }

  .glossary-table tr {
    margin-bottom: 12px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    overflow: hidden;
  }

  .glossary-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    text-align: left;
  }

  .glossary-table td:first-child {
    background: var(--bg-light);
    font-weight: 600;
  }

  .glossary-table td:last-child {
    border-bottom: none;
  }

  /* Engagement framework single column on small screens */
  .engagement-framework {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .engagement-framework .center-circle {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 auto;
    order: -1;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .impetus-toolkit-content {
    padding: 20px 14px 80px;
  }

  .toolkit-card {
    padding: 14px 16px;
  }

  .card-case-study {
    padding: 14px 16px;
  }

  .toolkit-section > .toolkit-section-header {
    font-size: 1.3rem;
  }

  .section-body .toolkit-section-header {
    font-size: 1.1rem;
  }

  .impetus-toolkit-wrapper h1 {
    font-size: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   20. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .impetus-toolkit-nav,
  .impetus-hamburger,
  #impetus-progress-bar,
  #impetus-back-to-top,
  .skip-to-content {
    display: none !important;
  }

  .impetus-toolkit-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .impetus-toolkit-content.tab-mode > .toolkit-section {
    display: block !important;
  }

  .impetus-toolkit-wrapper {
    display: block;
    background: #ffffff;
  }

  .toolkit-card {
    break-inside: avoid;
    border: 1px solid #ddd;
    box-shadow: none !important;
  }

  .card-case-study {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd;
  }

  .card-guiding-questions {
    border: 1px solid var(--impetus-teal);
    border-left: 4px solid var(--impetus-teal);
  }

  .card-tools {
    border: 1px solid var(--impetus-green);
    border-left: 4px solid var(--impetus-green);
  }

  .card-guidelines {
    border: 1px solid var(--impetus-orange);
    border-left: 4px solid var(--impetus-orange);
  }

  .card-info-box {
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #666;
  }

  .impetus-toolkit-wrapper a {
    color: var(--impetus-blue);
    text-decoration: underline;
  }
}

/* --------------------------------------------------------------------------
   21. Utility Classes
   -------------------------------------------------------------------------- */
.impetus-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.impetus-text-center {
  text-align: center;
}

.impetus-mt-0 {
  margin-top: 0;
}

.impetus-mb-0 {
  margin-bottom: 0;
}

.impetus-mb-1 {
  margin-bottom: 8px;
}

.impetus-mb-2 {
  margin-bottom: 16px;
}

.impetus-mb-3 {
  margin-bottom: 24px;
}

.impetus-mb-4 {
  margin-bottom: 32px;
}
