/* ===================================================
   CRB Action — styles.css
   Mobile-first, earthy green/tan/amber palette
   WCAG AA contrast (≥4.5:1 for body text)
   =================================================== */

/* ---- Custom Properties ---- */
:root {
  --green-dark:   #1e4d1e;   /* nav, headings */
  --green-mid:    #2d6a2d;   /* nav bg, buttons */
  --green-light:  #4a8c4a;   /* accents, borders */
  --green-pale:   #e8f0e8;   /* section alt bg */
  --tan:          #faf7f2;   /* page bg */
  --tan-mid:      #f0ead8;   /* card bg */
  --tan-dark:     #c8bfa8;   /* borders */
  --amber:        #c96a10;   /* warning/CTA accent */
  --amber-light:  #fff3e0;   /* warning callout bg */
  --amber-dark:   #7a3d06;   /* warning callout text */
  --text:         #2d2a24;   /* body text — contrast 10:1 on tan */
  --text-muted:   #5a5449;   /* secondary text — contrast 5:1 on tan */
  --white:        #ffffff;
  --radius:       6px;
  --shadow:       0 2px 8px rgba(0,0,0,.12);
  --shadow-lg:    0 4px 16px rgba(0,0,0,.16);
  --transition:   0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem; /* offset for sticky nav */
  font-size: 16px;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--tan);
  color: var(--text);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--green-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover, a:focus { color: var(--amber); text-decoration: underline; }
a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol { padding-left: 1.4rem; }
li { margin-bottom: .35rem; }

h1, h2, h3, h4 {
  font-family: Georgia, serif;
  color: var(--green-dark);
  line-height: 1.3;
}

h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1rem; font-weight: bold; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

em { font-style: italic; }
strong { font-weight: bold; }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

/* ---- Navigation ---- */
nav.sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-mid);
  box-shadow: var(--shadow);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  gap: 1rem;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--white);
  letter-spacing: .03em;
  white-space: nowrap;
}

.nav-links {
  display: none;
  flex-direction: column;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: .25rem;
}

.nav-links--open {
  display: flex;
}

.nav-links a {
  display: block;
  color: var(--white);
  text-decoration: none;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  min-height: 44px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  font-size: .95rem;
  transition: background var(--transition);
}
.nav-links a:hover,
.nav-links a:focus {
  background: rgba(255,255,255,.2);
  color: var(--white);
  outline: none;
}
.nav-links a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* Hamburger button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
}
.nav-toggle:hover { border-color: var(--white); }
.nav-toggle:focus-visible { outline: 3px solid var(--amber); }

@media (min-width: 640px) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex;
    flex-direction: row;
    gap: .25rem;
  }
}

/* ---- Sections ---- */
.section {
  padding: 3rem 0 2.5rem;
}

.section--alt {
  background: var(--green-pale);
}

.section--hero {
  background: linear-gradient(160deg, #1e4d1e 0%, #2d6a2d 55%, #4a8c4a 100%);
  color: var(--white);
  padding: 3rem 0 3.5rem;
}

.section--hero h1,
.section--hero h2 {
  color: var(--white);
}

.section--hero .hero-subtitle {
  font-size: 1.15rem;
  opacity: .92;
  margin: .75rem 0 2rem;
  max-width: 640px;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: .5rem;
  padding-bottom: .5rem;
  border-bottom: 3px solid var(--green-light);
}

.section--alt .section-title {
  border-bottom-color: var(--green-mid);
}

.section-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  max-width: 680px;
}

.section--alt .section-intro { color: var(--text); }

.subsection-title {
  font-size: 1.2rem;
  margin: 2rem 0 .75rem;
  color: var(--green-dark);
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--tan-dark);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--green-pale);
}

.section--hero .card {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.25);
  color: var(--white);
}

.section--hero .card h2 {
  color: var(--white);
  border-bottom-color: rgba(255,255,255,.3);
}

.card--warning {
  border-left: 4px solid var(--amber);
}

.section--hero .card--warning {
  border-left-color: #ffd580;
}

/* ---- Callout Boxes ---- */
.callout {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.callout h3, .callout h4 { margin-bottom: .6rem; }

.callout ol, .callout ul { margin-top: .5rem; }

.callout--action {
  background: var(--tan-mid);
  border-left: 5px solid var(--green-mid);
}

.section--hero .callout--action {
  background: rgba(255,255,255,.15);
  border-left-color: #a8d5a8;
  color: var(--white);
}
.section--hero .callout--action h3,
.section--hero .callout--action ol,
.section--hero .callout--action li { color: var(--white); }

.callout--warning {
  background: var(--amber-light);
  border-left: 5px solid var(--amber);
  color: var(--amber-dark);
}
.callout--warning h3 { color: var(--amber-dark); }

.callout--tip {
  background: var(--green-pale);
  border-left: 5px solid var(--green-light);
}

/* ---- Alert Box (Hero CTA) ---- */
.alert-box {
  background: var(--amber);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2rem;
  max-width: 560px;
}

.alert-box strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: .6rem;
}

.alert-box a {
  color: var(--white);
  font-weight: bold;
}
.alert-box a:hover { opacity: .85; }

.alert-instructions {
  margin-top: .75rem;
  font-size: .9rem;
  opacity: .9;
}

/* ---- Photo Pair ---- */
.photo-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}

@media (min-width: 540px) {
  .photo-pair { grid-template-columns: 1fr 1fr; }
}

.photo-figure {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--tan-dark);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.photo-figure img {
  width: 100%;
  height: 240px;
  object-fit: contain;
  background: #fff;
  display: block;
  padding: .5rem;
}

@media (min-width: 540px) {
  .photo-figure img { height: 280px; }
}

.photo-figure figcaption {
  padding: .65rem 1rem;
  font-size: .9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--tan-dark);
  background: var(--tan-mid);
  line-height: 1.4;
}

/* ---- Comparison Table ---- */
.table-wrapper {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  background: var(--white);
  font-size: .95rem;
}

.comparison-table caption {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: left;
  padding: .5rem .75rem;
  caption-side: bottom;
  font-style: italic;
}

.comparison-table th,
.comparison-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--tan-dark);
  vertical-align: top;
}

.comparison-table thead th {
  background: var(--green-dark);
  color: var(--white);
  font-weight: bold;
  border-bottom: none;
}

.comparison-table tbody tr:nth-child(even) td,
.comparison-table tbody tr:nth-child(even) th {
  background: var(--tan);
}

.comparison-table th[scope="row"] {
  font-weight: bold;
  color: var(--green-dark);
  white-space: nowrap;
}

/* ---- Feature Lists ---- */
.feature-list {
  list-style: none;
  padding: 0;
}

.feature-list li {
  padding: .4rem 0 .4rem 1.6rem;
  position: relative;
  border-bottom: 1px solid var(--tan-dark);
}
.feature-list li:last-child { border-bottom: none; }

.feature-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--green-light);
  font-weight: bold;
}

ol.feature-list { list-style: none; counter-reset: ol-counter; }
ol.feature-list li { counter-increment: ol-counter; }
ol.feature-list li::before {
  content: counter(ol-counter) '.';
  color: var(--green-mid);
  font-weight: bold;
  font-size: .9rem;
  min-width: 1.4rem;
}

.pdf-link--external::before {
  content: '↗';
}

.accordion {
  border: 1px solid var(--tan-dark);
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}

.accordion-toggle {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  background: var(--tan-mid);
  border: none;
  padding: 1rem 1.25rem;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-family: Georgia, serif;
  font-weight: bold;
  color: var(--green-dark);
  min-height: 56px;
  transition: background var(--transition);
}

.accordion-toggle:hover { background: #e0d8c8; }

.accordion-toggle:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: -3px;
}

.accordion-icon { font-size: 1.3rem; flex-shrink: 0; }

.accordion-label {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  line-height: 1.3;
}

.accordion-tag {
  font-size: .75rem;
  font-weight: normal;
  background: var(--green-mid);
  color: var(--white);
  padding: .15rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
}

.accordion-tag--research {
  background: var(--amber);
}

.accordion-tag--organic {
  background: #5a7a2a;
}

.accordion-chevron {
  flex-shrink: 0;
  color: var(--green-light);
  font-size: .9rem;
  transition: transform var(--transition);
}

.accordion-body {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--tan-dark);
}

.accordion-body h4 {
  margin: 1rem 0 .5rem;
  color: var(--green-dark);
}

.accordion-body h4:first-child { margin-top: 0; }

/* ---- Lifecycle Diagram ---- */
.lifecycle-diagram {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 1.5rem 0;
}

.lifecycle-arrow {
  font-size: 1.5rem;
  color: var(--green-light);
  text-align: center;
  transform: rotate(90deg);
  line-height: 1;
  padding: .1rem;
}

.lifecycle-stage {
  background: var(--white);
  border: 1px solid var(--tan-dark);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.lifecycle-stage--highlight {
  border-color: var(--amber);
  border-width: 2px;
}

.lifecycle-icon { font-size: 1.8rem; margin-bottom: .4rem; }

.lifecycle-stage h3 {
  margin-bottom: .25rem;
  font-size: 1.1rem;
}

.lifecycle-duration {
  font-size: .85rem;
  font-weight: bold;
  color: var(--amber);
  margin-bottom: .5rem;
}

@media (min-width: 640px) {
  .lifecycle-diagram {
    flex-direction: row;
    align-items: stretch;
  }
  .lifecycle-arrow {
    transform: rotate(0deg);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
  }
  .lifecycle-stage { flex: 1; }
}

/* ---- PDF Links ---- */
.pdf-links {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--tan-dark);
}

.pdf-links h3 {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

.pdf-links ul {
  list-style: none;
  padding: 0;
}

.pdf-links li { margin-bottom: .4rem; }

.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--green-dark);
  font-size: .9rem;
  text-decoration: none;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  border: 1px solid var(--green-light);
  transition: background var(--transition), color var(--transition);
}

.pdf-link::before {
  content: '↓';
  font-weight: bold;
  color: var(--amber);
}

.pdf-link:hover, .pdf-link:focus {
  background: var(--green-pale);
  color: var(--green-dark);
  text-decoration: none;
}

.section--hero .pdf-links {
  border-top-color: rgba(255,255,255,.25);
}

.section--hero .pdf-link {
  color: var(--white);
  border-color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.1);
}
.section--hero .pdf-link:hover {
  background: rgba(255,255,255,.2);
}
.section--hero .pdf-links h3 { color: rgba(255,255,255,.7); }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: .75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: bold;
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
  text-align: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn--primary {
  background: var(--amber);
  color: var(--white);
}

.btn--primary:hover, .btn--primary:focus {
  background: var(--amber-dark);
  color: var(--white);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ---- Footer ---- */
.site-footer {
  background: var(--green-dark);
  color: rgba(255,255,255,.9);
  padding: 2.5rem 0 2rem;
  margin-top: 2rem;
}

.site-footer h2 {
  color: var(--white);
  font-size: 1.4rem;
  margin-bottom: .5rem;
}

.footer-report { margin-bottom: 2rem; }
.footer-report p { color: rgba(255,255,255,.85); }

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1rem 0;
}

.footer-instructions {
  font-size: .9rem;
  color: rgba(255,255,255,.75);
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

.footer-nav a {
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: .4rem .75rem;
  border-radius: var(--radius);
  font-size: .9rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
}
.footer-nav a:hover { color: var(--white); background: rgba(255,255,255,.15); }

.footer-credit {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 1rem;
  margin-bottom: 0;
}

.footer-credit a {
  color: rgba(255,255,255,.75);
}
.footer-credit a:hover { color: var(--white); }


.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.25rem;
  background: var(--green-mid);
  color: var(--white);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: bold;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 50;
}

.back-to-top--visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

/* ---- Print ---- */
@media print {
  nav.sticky, .back-to-top, .nav-toggle { display: none; }
  .section--hero { background: none; color: var(--text); }
  .section--hero h1, .section--hero h2 { color: var(--green-dark); }
  .accordion-body { display: block !important; }
  .accordion-body[hidden] { display: block !important; }
  a[href]::after { content: ' (' attr(href) ')'; font-size: .8em; }
  .pdf-link::after { content: none; }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
