/* PFM Regulations — Kenya */

:root {
  --pfm-green: #006b3f;
  --pfm-green-dark: #004d2e;
  --pfm-green-light: #e8f5ef;
  --pfm-gold: #c4a035;
  --pfm-gold-light: #f5efd6;
  --pfm-navy: #1a2e44;
  --pfm-text: #2c3e50;
  --pfm-muted: #6c757d;
  --pfm-border: #dee2e6;
  --pfm-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --pfm-radius: 12px;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
}

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&display=swap");

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

body.site-body {
  font-family: var(--font-sans);
  color: var(--pfm-text);
  background: #f4f6f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.site-navbar {
  background: linear-gradient(135deg, var(--pfm-green-dark) 0%, var(--pfm-green) 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.site-navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-navbar .nav-link {
  font-weight: 500;
  opacity: 0.9;
}

.site-navbar .nav-link:hover {
  opacity: 1;
}

.section-national .site-navbar {
  border-bottom: 3px solid var(--pfm-gold);
}

.section-county .site-navbar {
  border-bottom: 3px solid #5ba3c6;
}

/* Page hero */
.page-hero {
  background: linear-gradient(160deg, var(--pfm-navy) 0%, #2a4a6b 100%);
  color: #fff;
  padding: 2rem 0 2.5rem;
}

.section-national .page-hero {
  background: linear-gradient(160deg, var(--pfm-green-dark) 0%, var(--pfm-green) 55%, #00875a 100%);
}

.section-county .page-hero {
  background: linear-gradient(160deg, #1e4d6b 0%, #2d6a8a 55%, #3d8ab5 100%);
}

.breadcrumb-hero .breadcrumb-item,
.breadcrumb-hero .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
}

.breadcrumb-hero .breadcrumb-item.active {
  color: #fff;
}

.breadcrumb-hero .breadcrumb-item a:hover {
  color: #fff;
}

.page-hero-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.page-hero-sub {
  opacity: 0.88;
  margin: 0;
  font-size: 1rem;
  max-width: 52rem;
}

/* Home */
.page-home .page-hero,
.section-home .page-hero {
  display: none;
}

.section-home .site-navbar {
  border-bottom: 3px solid var(--pfm-gold);
}

.page-home .content-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.hero-home {
  background: linear-gradient(165deg, var(--pfm-navy) 0%, var(--pfm-green-dark) 45%, var(--pfm-green) 100%);
  color: #fff;
  margin: 0 -0px 0;
  border-radius: 0;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.35rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn-national {
  background: #fff;
  color: var(--pfm-green-dark);
  border: none;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 2rem;
  box-shadow: var(--pfm-shadow);
}

.btn-national:hover {
  background: var(--pfm-gold-light);
  color: var(--pfm-green-dark);
  transform: translateY(-1px);
}

.btn-county {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 2rem;
}

.btn-county:hover {
  background: #fff;
  color: #1e4d6b;
  border-color: #fff;
}

.info-panel {
  position: relative;
  padding: 2rem;
  border-radius: var(--pfm-radius);
  background: #fff;
  box-shadow: var(--pfm-shadow);
  border-left: 4px solid var(--pfm-green);
  transition: transform 0.2s, box-shadow 0.2s;
}

.info-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.info-national {
  border-left-color: var(--pfm-green);
}

.info-county {
  border-left-color: #3d8ab5;
}

.info-panel h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.info-panel a {
  color: var(--pfm-green);
  font-weight: 600;
  text-decoration: none;
}

.info-county a {
  color: #2d6a8a;
}

.feature-card {
  text-align: center;
  padding: 1.75rem 1.25rem;
  background: #fff;
  border-radius: var(--pfm-radius);
  box-shadow: var(--pfm-shadow);
  height: 100%;
}

.feature-card i {
  font-size: 2rem;
  color: var(--pfm-green);
  margin-bottom: 0.75rem;
  display: block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--pfm-muted);
  margin: 0;
}

/* Content card */
.content-card {
  background: #fff;
  border-radius: var(--pfm-radius);
  box-shadow: var(--pfm-shadow);
  padding: 2rem 2.25rem;
}

@media (max-width: 767.98px) {
  .content-card {
    padding: 1.25rem 1rem;
  }
}

/* Part cards (section index) */
.part-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.35rem 1.5rem;
  background: #fff;
  border-radius: var(--pfm-radius);
  border: 1px solid var(--pfm-border);
  text-decoration: none;
  color: inherit;
  height: 100%;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.part-card:hover {
  border-color: var(--pfm-green);
  box-shadow: var(--pfm-shadow);
  transform: translateY(-2px);
  color: inherit;
}

.part-card-national:hover {
  border-color: var(--pfm-green);
}

.part-card-county:hover {
  border-color: #3d8ab5;
}

.part-card-num {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pfm-green);
}

.part-card-county .part-card-num {
  color: #2d6a8a;
}

.part-card-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  padding-right: 1.5rem;
}

.part-card-arrow {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
}

.part-card:hover .part-card-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* Search */
.search-wrap {
  position: relative;
  max-width: 420px;
}

.search-wrap i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pfm-muted);
  pointer-events: none;
}

.search-wrap input {
  padding-left: 2.75rem;
  border-radius: 2rem;
  border: 1px solid var(--pfm-border);
}

.search-wrap input:focus {
  border-color: var(--pfm-green);
  box-shadow: 0 0 0 3px var(--pfm-green-light);
}

/* Sidebar */
.part-sidebar {
  padding-right: 0;
}

.sidebar-sticky {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sidebar-sticky::-webkit-scrollbar {
  width: 4px;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
  background: var(--pfm-border);
  border-radius: 4px;
}

.sidebar-block {
  background: #fff;
  border-radius: var(--pfm-radius);
  border: 1px solid var(--pfm-border);
  padding: 1rem;
  margin-bottom: 1rem;
}

.sidebar-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pfm-muted);
  margin-bottom: 0.65rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link {
  display: block;
  font-size: 0.8rem;
  color: var(--pfm-text);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  line-height: 1.35;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  background: var(--pfm-green-light);
  color: var(--pfm-green-dark);
}

.sidebar-link.active,
.sidebar-link.active-reg {
  background: var(--pfm-green-light);
  color: var(--pfm-green-dark);
  font-weight: 600;
  border-left-color: var(--pfm-green);
}

.regulations-nav .sidebar-link {
  font-size: 0.78rem;
}

.sidebar-reg-num {
  display: inline-block;
  min-width: 1.75rem;
  font-weight: 700;
  color: var(--pfm-green);
}

.regulations-nav .sidebar-link.hidden-by-search {
  display: none;
}

/* Legal content */
.legal-content {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1a1a1a;
}

.legal-content p {
  margin-bottom: 1rem;
}

.regulation-block {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

.regulation-block:last-child {
  border-bottom: none;
}

.regulation-heading {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--pfm-navy);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--pfm-gold-light);
  scroll-margin-top: 6rem;
}

.section-national .regulation-heading {
  color: var(--pfm-green-dark);
}

.regulation-num {
  display: inline-block;
  background: var(--pfm-green);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.section-county .regulation-num {
  background: #2d6a8a;
}

.definition {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--pfm-gold);
  font-style: italic;
}

.reg-subsection {
  margin-left: 0.5rem;
}

.reg-list {
  margin: 0.75rem 0 1rem 1.5rem;
}

.reg-list li {
  margin-bottom: 0.5rem;
}

.legal-note {
  font-size: 0.9rem;
  color: var(--pfm-muted);
  font-style: italic;
  margin-top: 0.75rem;
}

.regulation-block.hidden-by-search {
  display: none;
}

/* Pagination */
.part-pagination .btn {
  border-radius: 2rem;
  font-weight: 500;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--pfm-navy);
  color: rgba(255, 255, 255, 0.85);
}

.site-footer a {
  color: var(--pfm-gold);
}

/* Back to top */
.btn-back-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1030;
  box-shadow: var(--pfm-shadow);
  padding: 0;
}

.btn-back-top.visible {
  display: flex;
}

.section-national .btn-back-top {
  background: var(--pfm-green);
  border-color: var(--pfm-green);
}

.section-county .btn-back-top {
  background: #2d6a8a;
  border-color: #2d6a8a;
}

/* Part quiz */
.part-quiz {
  background: linear-gradient(180deg, #f8faf9 0%, #fff 100%);
  margin: 0 -2.25rem -2rem;
  padding: 2.5rem 2.25rem 2rem;
  border-radius: 0 0 var(--pfm-radius) var(--pfm-radius);
}

@media (max-width: 767.98px) {
  .part-quiz {
    margin: 0 -1rem -1.25rem;
    padding: 2rem 1rem 1.25rem;
  }
}

.quiz-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--pfm-navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-national .quiz-title i {
  color: var(--pfm-green);
}

.section-county .quiz-title i {
  color: #2d6a8a;
}

.quiz-question {
  background: #fff;
  border: 1px solid var(--pfm-border);
  border-radius: var(--pfm-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quiz-question.quiz-answered-correct {
  border-color: #198754;
  box-shadow: 0 0 0 1px rgba(25, 135, 84, 0.15);
}

.quiz-question.quiz-answered-wrong {
  border-color: #dc3545;
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.12);
}

.quiz-q {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

.quiz-num {
  color: var(--pfm-green);
  font-weight: 700;
  margin-right: 0.35rem;
}

.section-county .quiz-num {
  color: #2d6a8a;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--pfm-border);
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}

.quiz-option:hover {
  background: var(--pfm-green-light);
  border-color: #b8d4c4;
}

.quiz-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.quiz-option.is-correct {
  background: #d1e7dd;
  border-color: #198754;
}

.quiz-option.is-wrong {
  background: #f8d7da;
  border-color: #dc3545;
}

.quiz-feedback {
  font-size: 0.875rem;
  margin: 0.75rem 0 0;
  font-family: var(--font-sans);
}

.quiz-results {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--pfm-radius);
  font-weight: 600;
  font-family: var(--font-sans);
}

.quiz-results:not(.d-none) {
  background: var(--pfm-green-light);
  color: var(--pfm-green-dark);
  border: 1px solid #b8d4c4;
}

.sidebar-link-quiz {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--pfm-border);
  font-weight: 600;
}

/* Print */
@media print {
  .site-navbar,
  .part-sidebar,
  .part-toolbar,
  .part-quiz,
  .part-pagination,
  .btn-back-top,
  .site-footer,
  .no-print {
    display: none !important;
  }

  .content-card {
    box-shadow: none;
    padding: 0;
  }

  .page-hero {
    background: none !important;
    color: #000 !important;
    padding: 0 0 1rem;
  }

  .regulation-heading {
    page-break-after: avoid;
  }
}

/* Constitution course integration */
.pfm-course-main {
  padding: 1.5rem 0 3rem;
}

.pfm-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.pfm-crumb {
  color: var(--pfm-green);
  text-decoration: none;
}

.pfm-crumb:hover {
  text-decoration: underline;
}

.pfm-crumb--active {
  color: var(--pfm-muted);
  font-weight: 600;
}

.pfm-crumb-sep {
  color: var(--pfm-muted);
}

.pfm-content-card {
  background: #fff;
  border-radius: var(--pfm-radius);
  box-shadow: var(--pfm-shadow);
  padding: 1.5rem 1.75rem;
}

.pfm-part-sidebar .pfm-sidebar-sticky {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.pfm-constitution-bridge .pfm-part-link-list {
  margin: 0;
  padding-left: 1.25rem;
}

.pfm-constitution-bridge .pfm-part-link-list li {
  margin-bottom: 0.35rem;
}

.pfm-hub-intro .info-panel {
  border-radius: var(--pfm-radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  min-height: 10rem;
}

.pfm-hub-intro .info-national {
  background: var(--pfm-green-light);
  border: 1px solid #b8d4c4;
}

.pfm-hub-intro .info-county {
  background: var(--pfm-gold-light);
  border: 1px solid #e0d4a8;
}

/* PFM app shell (no Constitution course sidebar) */
body.pfm-shell {
  font-family: var(--font-sans);
  color: var(--pfm-text);
  background: #f0f3f6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0 !important;
}

body.pfm-shell.course-page,
body.pfm-shell.course-logged-in {
  padding-left: 0 !important;
}

.pfm-topbar {
  background: linear-gradient(135deg, var(--pfm-green-dark) 0%, var(--pfm-green) 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.section-national.pfm-shell .pfm-topbar {
  border-bottom: 3px solid var(--pfm-gold);
}

.section-county.pfm-shell .pfm-topbar {
  border-bottom: 3px solid #5ba3c6;
}

.pfm-topbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
}

.pfm-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.pfm-topbar-brand:hover {
  color: #fff;
  opacity: 0.92;
}

.pfm-topbar-links {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.pfm-topbar-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.pfm-topbar-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.pfm-shell-layout {
  display: flex;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  align-items: stretch;
}

.pfm-shell-sidebar {
  width: 17.5rem;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--pfm-border);
  overflow-y: auto;
  max-height: calc(100vh - 3.25rem);
  position: sticky;
  top: 3.25rem;
  align-self: flex-start;
}

.pfm-shell-offcanvas {
  --bs-offcanvas-width: min(20rem, 88vw);
}

.pfm-shell-offcanvas .pfm-shell-nav {
  padding: 0.5rem 0 1.5rem;
}

.pfm-shell-nav {
  padding: 1rem 0 1.5rem;
}

.pfm-shell-nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pfm-muted);
  margin: 1rem 1rem 0.35rem;
}

.pfm-shell-nav-label--secondary {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pfm-border);
}

.pfm-shell-nav-link {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  color: var(--pfm-text);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
}

.pfm-shell-nav-link i {
  margin-top: 0.1rem;
  opacity: 0.75;
}

.pfm-shell-nav-link:hover {
  background: var(--pfm-green-light);
  color: var(--pfm-green-dark);
}

.pfm-shell-nav-link.active {
  background: var(--pfm-green-light);
  color: var(--pfm-green-dark);
  border-left-color: var(--pfm-green);
  font-weight: 600;
}

.pfm-shell-nav-link--part {
  font-size: 0.82rem;
  padding-left: 1.15rem;
}

.pfm-shell-parts-nav {
  max-height: 40vh;
  overflow-y: auto;
}

.pfm-shell-content-sidebar {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pfm-border);
}

.pfm-shell-content-sidebar .sidebar-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pfm-muted);
  margin: 0 1rem 0.5rem;
}

.pfm-shell-content-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
}

.pfm-shell-content-sidebar .sidebar-link {
  display: block;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--pfm-text);
  text-decoration: none;
  line-height: 1.3;
}

.pfm-shell-content-sidebar .sidebar-link:hover,
.pfm-shell-content-sidebar .sidebar-link.active {
  background: #f4f6f8;
  color: var(--pfm-green-dark);
}

.pfm-shell-content-sidebar .regulations-nav {
  max-height: 28vh;
  overflow-y: auto;
}

.pfm-shell-nav-link--logout {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pfm-border);
  color: var(--pfm-muted);
}

.pfm-shell-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 2.5rem;
}

.pfm-page-header {
  margin-bottom: 1.25rem;
}

.pfm-page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
  color: var(--pfm-navy);
}

.section-national .pfm-page-title {
  color: var(--pfm-green-dark);
}

.pfm-page-sub {
  color: var(--pfm-muted);
  margin: 0;
}

.pfm-shell-footer {
  background: var(--pfm-navy);
  color: rgba(255, 255, 255, 0.85);
  padding: 1rem 0;
  font-size: 0.9rem;
  margin-top: auto;
}

.pfm-shell-footer a {
  color: #fff;
}

.pfm-back-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .pfm-shell-main {
    padding: 1rem;
  }
}

@media print {
  .pfm-topbar,
  .pfm-shell-sidebar,
  .pfm-shell-offcanvas,
  .pfm-shell-footer,
  .pfm-back-top,
  .pfm-sidebar-toggle {
    display: none !important;
  }

  .pfm-shell-layout {
    display: block;
  }

  .pfm-content-card {
    box-shadow: none;
    padding: 0;
  }
}
