/* =============================================
   A BURNER FIELD GUIDE
   Desert warmth meets SA spring
   ============================================= */

/* ─── CSS Variables ─── */
:root {
  /* Warm Desert Tones */
  --sand:           #E8D5B0;
  --sand-light:     #F5EDD8;
  --sand-deep:      #C9A97A;
  --ochre:          #C47B2B;
  --ochre-dark:     #9A5E1A;
  --terracotta:     #B85C38;
  --dusk:           #7A4E2D;
  --dust:           #D4B483;
  
  --desert-sand:    #F7EFE5;
  --desert-ochre:   #C87941;
  --terracotta:     #8B4513;
  
  /* Spring Johannesburg Tones */
  --jacaranda-purple: #6A4C93;
  --spring-green:    #52796F;
  
  --spring-green:       #5C8A3C;
  --spring-green-light: #7AAF58;
  --spring-green-pale:  #C8DDB8;
  --spring-purple:      #6B4E8A;
  --spring-purple-light:#8E6FAD;
  --spring-purple-pale: #D4C5E8;

  /* Neutral/Text */
  --text-dark:          #3E362E;

  --ink:                #2A1F0E;
  --ink-mid:            #4A3728;
  --ink-soft:           #6B5744;
  --parchment:          #FAF6EE;

  --sidebar-w:          280px;
  --header-h:           80px;
  --footer-h:           90px;
  --transition:         0.3s ease;

  --font-display:       'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-body:          'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-ui:            'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background-color: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ─── Texture Overlay ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ─── Fundamentals ─── */
.endnote { font-size:70%; }
.centred { text-align: center; margin-left: auto; margin-right: auto; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--sand-light); }
::-webkit-scrollbar-thumb { background: var(--sand-deep); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ochre); }

/* =============================================
   HEADER
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--dusk) 0%, var(--ochre-dark) 50%, var(--terracotta) 100%);
  border-bottom: 3px solid var(--ochre);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  box-shadow: 0 3px 20px rgba(42, 31, 14, 0.35);
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--spring-green), var(--spring-purple), var(--spring-green));
  opacity: 0.7;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Hamburger / sidebar toggle */
.sidebar-toggle {
  background: none;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { border-color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.1); }
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--sand-light);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.sidebar-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sidebar-toggle.active span:nth-child(2) { opacity: 0; }
.sidebar-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.site-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.site-title .org-name {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sand-deep);
  margin-bottom: 2px;
}
.site-title .guide-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--sand-light);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* PDF Buttons in header */
.header-pdfs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn-pdf svg { flex-shrink: 0; }

.btn-pdf--principles {
  background: rgba(92, 138, 60, 0.2);
  border-color: var(--spring-green-light);
  color: var(--spring-green-pale);
}
.btn-pdf--principles:hover {
  background: var(--spring-green);
  border-color: var(--spring-green);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(92,138,60,0.4);
}

.btn-pdf--consent {
  background: rgba(107, 78, 138, 0.2);
  border-color: var(--spring-purple-light);
  color: var(--spring-purple-pale);
}
.btn-pdf--consent:hover {
  background: var(--spring-purple);
  border-color: var(--spring-purple);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107,78,138,0.4);
}

.btn-pdf--dusty {
  background: rgba(196, 123, 43, 0.2);
  border-color: var(--sand-deep);
  color: var(--sand);
}
.btn-pdf--dusty:hover {
  background: var(--ochre);
  border-color: var(--ochre);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196,123,43,0.4);
}

/* =============================================
   LAYOUT SHELL
   ============================================= */
.layout {
  display: flex;
  flex: 1;
  position: relative;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-h);
  background: rgba(42, 31, 14, 0.5);
  z-index: 49;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* =============================================
   SIDEBAR / CONTENTS TREE
   ============================================= */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  /* background: linear-gradient(180deg, var(--dusk) 0%, var(--ink-mid) 100%); */
  background: #FFFFFF;
  border-right: 2px solid var(--ochre-dark);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition), width var(--transition);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ochre-dark); border-radius: 4px; }

.sidebar-inner { padding: 1.25rem 0 2rem; }

.sidebar-section-title {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ochre-dark);
  padding: 0.75rem 1.25rem 0.4rem;
  border-top: 1px solid rgba(201,169,122,0.2);
  margin-top: 0.5rem;
}
.sidebar-section-title:first-child { border-top: none; margin-top: 0; }

/* Sidebar main links */
.sidebar-link {
  display: block;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  gap: 0.5rem;
}
.sidebar-link:hover { background: rgba(196,123,43,0.15); }
.sidebar-link a {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dust);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.sidebar-link a.active {
  color: var(--ochre);
}
.sidebar-link a:hover {
  color: var(--ochre-dark);
}

/* Chapter heading row (collapsible) */
.chapter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition);
  gap: 0.5rem;
}
.chapter-toggle:hover { background: rgba(196,123,43,0.15); }

.chapter-toggle-label {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dust);
  line-height: 1.3;
}

.chapter-toggle.active .chapter-toggle-label { color: var(--ochre); }

.chapter-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--sand-deep);
  transition: transform var(--transition);
}
.chapter-toggle.active .chapter-chevron { transform: rotate(180deg); }

/* Chapter sub-items */
.chapter-items {
  list-style: none;
  overflow: hidden;
  /* height controlled by JS */
}

.chapter-items li a {
  display: block;
  padding: 0.45rem 1.25rem 0.45rem 2rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ochre);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.35;
}

.chapter-items li a:hover {
  color: var(--ochre-dark);
  border-left-color: var(--ochre-dark);
  background: rgba(196,123,43,0.1);
  padding-left: 2.25rem;
}

.chapter-items li a.active {
  color: var(--dusk);
  border-left-color: var(--spring-green-light);
  background: rgba(92,138,60,0.15);
  font-style: normal;
  font-weight: 600;
}

/* =============================================
   MAIN CONTENT AREA
   ============================================= */
.main-content {
  flex: 1;
  padding: 2.5rem 2rem 3rem;
  max-width: 860px;
  min-width: 0;
}

/* Page intro header */
.page-intro {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--sand-deep);
  position: relative;
}
.page-intro::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--spring-green), var(--spring-purple));
  border-radius: 2px;
}

.page-intro h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--ochre-dark);
  line-height: 1.15;
  margin-bottom: 0.6rem;
}

.page-intro .subtitle {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ─── Under Construction ─── */
.under-construction {
  text-align: center;
  padding: 5rem 2rem;
}
.under-construction .uc-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  display: block;
}
.under-construction h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--spring-purple);
  margin-bottom: 1rem;
}
.under-construction p {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

/* =============================================
   ACCORDION / BLOCKS
   ============================================= */
.accordion { display: flex; flex-direction: column; gap: 0.6rem; }

.accordion-item, .guide-block {
  border-radius: 8px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(42,31,14,0.07);
  transition: box-shadow var(--transition), border-color var(--transition);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.accordion-item {
  overflow: hidden;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid var(--sand-deep);
}
.guide-block {
  overflow: auto;
  margin-bottom: 2em;
  padding-bottom: 2em;
  background: rgba(196,123,43,0.12);
  border: 1px solid rgba(196,123,43,0.3);
}
.accordion-item:hover { box-shadow: 0 4px 18px rgba(42,31,14,0.12); }
.accordion-item.open { border-color: var(--ochre); }

/* Description blocks and buttons */
.guide-description {
  float: left;
  max-width: 70%;
  padding: 0 1.6em;
}
.btn-bar {
  float: right;
  text-align: unset;
  margin: auto;
  width: auto;
}
.btn-pdf.btn-more {
  color: #000;
}
.guide-image {
  padding: 20px 5px 0;
  white-space: nowrap;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.guide-image img {
  border-radius: 4px;
}

/* Accordion trigger */
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  gap: 1rem;
  text-align: left;
  transition: background var(--transition);
}
.accordion-trigger:hover { background: rgba(196,123,43,0.06); }
.accordion-item.open .accordion-trigger { background: rgba(196,123,43,0.08); }

.accordion-trigger-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.accordion-number {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ochre);
  background: rgba(196,123,43,0.12);
  border: 1px solid rgba(196,123,43,0.3);
  border-radius: 4px;
  padding: 3px 7px;
  flex-shrink: 0;
  white-space: nowrap;
}

.accordion-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dusk);
  line-height: 1.3;
}
.accordion-item.open .accordion-title { color: var(--ochre-dark); }

.accordion-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--sand-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition);
}
.accordion-item.open .accordion-icon {
  background: var(--ochre);
  transform: rotate(45deg);
}
.accordion-icon svg { color: white; width: 12px; height: 12px; }

/* Accordion body */
.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.accordion-item.open .accordion-body { max-height: 3000px; }

.accordion-content {
  padding: 0 1.4rem 1.6rem;
  border-top: 1px solid var(--sand-deep);
}

/* ─── Content Sub-sections ─── */
.content-section {
  margin-top: 1.4rem;
}

.content-section-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
}

.label--principle {
  background: rgba(196,123,43,0.12);
  color: var(--ochre-dark);
  border: 1px solid rgba(196,123,43,0.3);
}
.label--default {
  background: rgba(92,138,60,0.12);
  color: var(--spring-green);
  border: 1px solid rgba(92,138,60,0.3);
}
.label--pragmatic {
  background: rgba(107,78,138,0.1);
  color: var(--spring-purple);
  border: 1px solid rgba(107,78,138,0.25);
}
.label--deeper {
  background: rgba(184,92,56,0.1);
  color: var(--terracotta);
  border: 1px solid rgba(184,92,56,0.25);
}

.content-section p {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink-mid);
  margin-bottom: 0.5em;
}

.content-section ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.content-section ul li {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-mid);
  padding-left: 1.4rem;
  position: relative;
}
.content-section ul li::before {
  content: '◆';
  position: absolute;
  left: 0;
  font-size: 0.45rem;
  color: var(--spring-purple);
  top: 0.52rem;
}

.content-section .deeper-text {
  font-style: italic;
  color: var(--ink-soft);
  border-left: 3px solid var(--terracotta);
  padding-left: 1rem;
  background: rgba(184,92,56,0.04);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
}

/* Divider between sections */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--sand-deep), transparent);
  margin: 1.2rem 0 0;
  opacity: 0.5;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  background: linear-gradient(135deg, var(--ink) 0%, var(--dusk) 100%);
  border-top: 3px solid var(--ochre-dark);
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--spring-purple), var(--spring-green), var(--spring-purple));
  opacity: 0.6;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  color: var(--sand-deep);
}

.footer-pdfs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-copy {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
}

/* =============================================
   RESPONSIVE — MOBILE / TABLET
   ============================================= */
@media (max-width: 900px) {
  .header-pdfs { display: none; } /* hidden on mobile — appear in footer */

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(42,31,14,0.3);
  }
  .sidebar.open { transform: translateX(0); }

  .guide-description { float: none; max-width: unset; }
  .guide-description .btn-bar { float: none; margin: 0.6em auto; text-align: center; width: 200px; }

  .main-content { padding: 1.5rem 1rem 2rem; }
  .page-intro h1 { font-size: 1.75rem; }

  .footer-pdfs { justify-content: flex-start; }
  .footer-copy { display: none; }
}

@media (max-width: 600px) {
  .site-header { padding: 0 1rem; }
  .guide-name { font-size: 1.15rem !important; }
  .footer-pdfs .btn-pdf { font-size: 0.65rem; padding: 5px 9px; }
  .accordion-title { font-size: 1.05rem; }
  .guide-description { float: none; max-width: unset; }
  .guide-description .btn-bar { float: none; margin: 0.6em auto; text-align: center; width: 200px; }
}

/* =============================================
   UTILITY
   ============================================= */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* Smooth highlight when jumping via menu */
@keyframes highlightPulse {
  0%   { box-shadow: 0 0 0 4px rgba(196,123,43,0); }
  40%  { box-shadow: 0 0 0 6px rgba(196,123,43,0.35); }
  100% { box-shadow: 0 0 0 4px rgba(196,123,43,0); }
}
.accordion-item.highlighted { animation: highlightPulse 1.2s ease forwards; }

/* Placeholder text style */
.placeholder-text {
  color: var(--ink-soft);
  font-style: italic;
  opacity: 0.7;
}
