/* ==========================================================
   1. GLOBAL RESETS & TYPOGRAPHY
   ========================================================== */
*, *::before, *::after {
  box-sizing: border-box !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Georgia, serif;
  line-height: 1.7;
  color: #2d3748;
  background-color: #f7fafc;
  margin: 0;
  padding: 0;
}

/* Base Headings & Text Formatting */
h1, h2, h3, h4 {
  color: #1a202c;
  line-height: 1.3;
}

p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.lead {
  font-size: 1.15rem;
  font-weight: 400;
  color: #4a5568;
}

ul, ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ==========================================================
   2. MAIN LAYOUT & CONTAINER CONSTRAINTS
   ========================================================== */
.container {
  width: 100% !important;
  max-width: 800px !important; /* Main page column width */
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  box-sizing: border-box !important;
}

article.content {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  clear: both;
}

section {
  margin-bottom: 2.5rem;
  clear: both;
}

/* ==========================================================
   3. SITE HEADER & DEDICATION BLOCK
   ========================================================== */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 40px 0 30px;
  margin-bottom: 40px;
}

.category {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: #d69e2e;
  font-weight: 700;
  margin-bottom: 8px;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
  margin-bottom: 20px;
}

.dedication {
  background-color: #fefcbf;
  border-left: 4px solid #d69e2e;
  padding: 15px 20px;
  font-size: 0.95rem;
  color: #744210;
  border-radius: 0 4px 4px 0;
}

.dedication p {
  margin: 0;
}

/* ==========================================================
   4. SECTION HEADINGS
   ========================================================== */
h2 {
  font-size: 1.6rem;
  border-bottom: 2px solid #edf2f7;
  padding-bottom: 8px;
  margin-top: 40px;
  margin-bottom: 20px;
}

h3 {
  font-size: 1.25rem;
  margin-top: 25px;
  margin-bottom: 12px;
}

/* ==========================================================
   5. EVOLUTION FLOWCHART SECTION
   ========================================================== */
.evolution-flow {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin: 30px 0;
}

.flow-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flow-step {
  background: #edf2f7;
  padding: 12px;
  border-radius: 6px;
  flex: 1;
  min-width: 140px;
  text-align: center;
}

.flow-step h3 {
  font-size: 0.95rem;
  margin: 0 0 4px 0;
}

.flow-step p {
  font-size: 0.8rem;
  margin: 0;
  color: #718096;
}

.flow-arrow {
  font-weight: bold;
  color: #cbd5e0;
}

/* ==========================================================
   6. STRICT IMAGE & FIGURE CONTAINMENT (TRIMS TO TEXT WIDTH)
   ========================================================== */
figure, 
figure.article-image {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 1.5rem 0 !important;
  padding: 0 !important;
  text-align: center;
  clear: both !important;
  box-sizing: border-box !important;
}

img, 
figure img, 
figure.article-image img {
  display: block !important;
  max-width: 100% !important; /* Forces images to fit exactly in text column */
  width: auto !important;     /* Prevents artificial stretching */
  height: auto !important;    /* Preserves original ratio */
  margin: 0 auto !important;  /* Centers images */
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  box-sizing: border-box !important;
}

figure.article-image figcaption {
  margin-top: 8px;
  font-size: 0.875rem;
  color: #718096;
  font-style: italic;
  text-align: center;
}

/* Grid layout for displaying figures side-by-side without overflow */
.image-grid {
  display: flex !important;
  gap: 15px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 1.5rem 0 !important;
  box-sizing: border-box !important;
}

.image-grid figure, 
.image-grid .article-image {
  flex: 1 1 0% !important;
  min-width: 0 !important; /* Stops flex containers from overflowing */
  margin: 0 !important;
}

.image-grid img {
  width: 100% !important;
}

/* ==========================================================
   7. CALLOUT & TAKEAWAY CONTAINERS
   ========================================================== */
.callout-box {
  background: #edf2f7;
  border-radius: 6px;
  padding: 20px;
  margin: 25px 0;
  width: 100% !important;
  max-width: 100% !important;
  clear: both;
  overflow: hidden;
  box-sizing: border-box !important;
}

.callout-box h4 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.takeaway-box {
  background: #fffaf0;
  border: 1px solid #feebc8;
  border-left: 4px solid #dd6b20;
  padding: 20px;
  border-radius: 4px;
  margin: 30px 0;
  width: 100% !important;
  max-width: 100% !important;
  clear: both;
  overflow: hidden;
  box-sizing: border-box !important;
}

.takeaway-box h3 {
  margin-top: 0;
  color: #c05621;
}

/* ==========================================================
   8. RESPONSIVE MOBILE BREAKPOINTS
   ========================================================== */
@media (max-width: 640px) {
  .flow-container {
    flex-direction: column;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .image-grid {
    flex-direction: column !important;
  }
}