/* ============================================
   CAN MALAYSIA FEED ITSELF?
   FIT2179 DV2 — styles.css
   Shell version — headings & layout only
   ============================================ */

/* --- Variables --- */
:root {
  /* greens */
  --green-dark:    #1E4008;
  --green-mid:     #3B6D11;
  --green-light:   #C0DD97;
  --green-pale:    #EDF5DC;
  --green-bg:      #F4F8EC;

  /* amber */
  --amber-dark:    #3D2000;
  --amber-mid:     #B86E00;
  --amber-light:   #F9C96A;
  --amber-pale:    #FEF6E4;

  /* teal */
  --teal-dark:     #053528;
  --teal-mid:      #1A9B72;
  --teal-light:    #8FD9C0;
  --teal-pale:     #E4F7F1;

  /* coral */
  --coral-dark:    #3D1206;
  --coral-mid:     #C94E24;
  --coral-light:   #F2A98A;
  --coral-pale:    #FEF0E8;

  /* sage (section 5) */
  --purple-dark:     #252060;
  --purple-mid:      #6B63CC;
  --purple-light:    #C4BFEE;
  --purple-pale:     #F0EFF9;

  /* neutrals */
  --bg:            #F7F3EC;
  --white:         #FFFFFF;
  --text-dark:     #1A1916;
  --text-mid:      #5A5855;
  --text-light:    #9A9793;
  --border:        #E2DDD4;

  /* fonts */
  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'DM Sans', 'Helvetica Neue', sans-serif;

  /* spacing */
  --section-pad:   6rem 2rem;
  --max-width:     1100px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 18px; }
body {
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text-dark);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   HERO
   ============================================ */
#hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--green-pale);

  /* subtle grain texture feel via gradient */
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(144,204,100,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(60,120,20,0.10) 0%, transparent 60%);
}

/* large decorative circle behind hero text */
.hero-bg-deco {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(144,204,100,0.22) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* floating food emoji deco */
.deco {
  position: absolute;
  font-size: 2.4rem;
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
  animation: floatDeco 6s ease-in-out infinite;
}
.d1  { top: 6%;   left: 4%;   animation-delay: 0s;    font-size: 2.2rem; }
.d2  { top: 8%;   left: 88%;  animation-delay: 1.2s;  font-size: 1.9rem; }
.d3  { top: 45%;  left: 3%;   animation-delay: 2.1s;  font-size: 2rem;   }
.d4  { top: 45%;  left: 95%;  animation-delay: 0.7s;  font-size: 1.8rem; }
.d5  { top: 75%;  left: 5%;   animation-delay: 1.8s;  font-size: 2rem;   }
.d6  { top: 75%;  left: 88%;  animation-delay: 3s;    font-size: 1.8rem; }
.d7  { top: 88%;  left: 30%;   animation-delay: 0.4s;  font-size: 1.9rem; }
.d8  { top: 88%;  left: 68%;  animation-delay: 2.5s;  font-size: 1.7rem; }
.d9  { top: 10%;  left: 25%;  animation-delay: 1.5s;  font-size: 1.6rem; }
.d10 { top: 10%;  left: 68%;  animation-delay: 0.9s;  font-size: 1.6rem; }
.d11 { top: 45%;  left: 20%;  animation-delay: 2.8s;  font-size: 1.7rem; }
.d12 { top: 4%;  left: 47%;  animation-delay: 1.1s;  font-size: 3rem; }
.d13 { top: 45%;  left: 78%;  animation-delay: 3.5s;  font-size: 1.9rem; }



@keyframes floatDeco {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50%       { transform: translateY(-12px) rotate(4deg); }
}

/* hero text content */
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 3000px;
  padding: 0.5rem 2rem;
  text-align: center;
}

#hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--green-dark);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.hero-sub {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--green-mid);
  margin-bottom: 1rem;
}
.hero-body {
  font-size: 1.2rem;
  color: var(--text-mid);
  max-width: 1000px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-body strong {
  font-family: var(--font-display);
  color: var(--green-dark);
  font-weight: 500;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(7px); }
}

/* ============================================
   PAGE SECTIONS — shared base
   ============================================ */
.page-section {
  padding: var(--section-pad);
  position: relative;
}

/* inner content constrained to max-width */
.page-section > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* section background colours */
.bg-amber { background-color: var(--amber-pale); }
.bg-teal  { background-color: var(--teal-pale);  }
.bg-coral { background-color: var(--coral-pale);  }
.bg-purple  { background-color: var(--purple-pale);   }

/* default section bg */
#section1 { background-color: var(--white); margin-bottom: -6rem; }


/* ============================================
   SECTION PILLS
   ============================================ */
.section-pill {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.35rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.2rem;
  position: absolute;
  top: 2rem;
  left: 2rem;
}
.pill-green { background: var(--green-light);  color: var(--green-dark); border: 1px solid #8EBF5A; }
.pill-amber { background: var(--amber-light);  color: var(--amber-dark); border: 1px solid #D4940A; }
.pill-teal  { background: var(--teal-light);   color: var(--teal-dark);  border: 1px solid #18856A; }
.pill-coral { background: var(--coral-light);  color: var(--coral-dark); border: 1px solid #B84020; }
.pill-purple  { background: var(--purple-light);   color: var(--purple-dark);  border: 1px solid #8A84CC; }

/* ============================================
   SECTION HEADINGS
   ============================================ */
.page-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--text-dark);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  max-width: 1050px;
}

.page-section h2 em {
  font-style: italic;
  color: var(--text-mid);
}

/* section intro paragraph */
.section-intro {
  font-size: 1.2rem;
  color: var(--text-mid);
  max-width: 1045px;
  line-height: 1.75;
  margin-bottom: 0.6rem;
}

/* small data source credit */
.section-source {
  font-size: 0.73rem;
  color: var(--text-light);
  letter-spacing: 0.03em;
  margin-bottom: 2.5rem;
  font-style: italic;
}

/* left border accent on section intro */
.section-intro-block {
  border-left: 3px solid var(--green-light);
  padding-left: 1rem;
  margin-bottom: 2.5rem;
}
.bg-blue { background-color: #EBF5FB; }
.pill-blue { background: #AED6F1; color: #1A5276; border: 1px solid #2E86C1; }
/* ============================================
   DIVIDERS BETWEEN SECTIONS
   ============================================ */
.page-section::after {
  content: '';
  display: block;
  height: 0;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  position: relative;
  background: var(--green-dark);
  color: rgba(255,255,255,0.75);
  padding: 3.5rem 2rem 2.5rem;
  text-align: center;
  overflow: hidden;
}

/* big decorative rice emoji behind footer */
.footer-rice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14rem;
  opacity: 0.04;
  pointer-events: none;
  user-select: none;
}

.footer-inner {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}

.footer-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.footer-sub {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 1.2rem;
}

.footer-sources {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1rem;
}

.footer-sources a {
  color: var(--green-light);
  text-decoration: none;
  font-weight: 500;
}
.footer-sources a:hover { text-decoration: underline; }

.footer-credit {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.4rem;
}

.footer-ai {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  font-style: italic;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  :root { --section-pad: 4rem 1.2rem; }
  #hero h1 { font-size: 2.6rem; }
  .page-section h2 { font-size: 1.8rem; }
  .deco { display: none; }
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-cards { margin-bottom: 2.5rem; }

.card {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.4rem 1.2rem;
  margin: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.card-red { border-color: #F09595; background: #FFF5F5; }
.card-icon { font-size: 1.6rem; margin-bottom: 0rem; }
.card-num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #1E4008;
  line-height: 1;
}
.card-red .card-num { color: #C94E24; }
.card-label { font-size: 0.9rem; color: #5A5855; line-height: 1.4; font-family: 'DM Sans', sans-serif; }

.insight-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  background: var(--green-pale);
  border-left: 3px solid var(--green-dark);
  border-radius: 8px;
  margin-left: 0.51rem;;
  padding: 1rem 1.2rem;
  margin-top: 1.2rem;
  max-width: 480px;
}

.insight-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.insight-card p {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin: 0;
  font-family: 'DM Sans', sans-serif;
}
/* ============================================
   CHART BOXES
   ============================================ */
.chart-row { margin-bottom: 1.5rem; }
.w-55 { width: 55%; }
.w-45 { width: 45%; }
.chart-box {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.5rem;
  margin: 0.4rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  height: 570px;
  overflow:hidden;
}
.chart-box-1 {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.5rem;
  margin: 0.4rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  height: 540px;
  overflow:hidden;
}
.chart-box-2 {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.5rem;
  margin: 0.4rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  height: 780px;
  overflow:hidden;
}
.chart-box-3 {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  height: 400px;
  overflow:hidden;
}
.chart-box-4 {
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  height: 580px;
  overflow:hidden;
}

.chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: #1A1916;
  margin-bottom: 0.3rem;
}

.chart-sub {
  font-size: 0.93rem;
  color: #5A5855;
  margin-bottom: 1rem;
  line-height: 1.5;
  font-family: var(--font-body);
}

.chart-sub-5 {
  font-size: 0.93rem;
  color: #5A5855;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  line-height: 1.5;
  font-family: var(--font-body);
}

.vega-embed { width: 100%; }
.vega-embed canvas, .vega-embed svg { max-width: 100%; }
#chart5 {
  display: flex;
  justify-content: center;
}
#chart6 .vega-embed {
  margin: 0 auto;
  display: block;
}

#chart6 .vega-embed canvas,
#chart6 .vega-embed svg {
  display: block;
  margin: 0 auto;
}
#chart6 .vega-bind {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: #5A5855;
}

#chart6 .vega-bind select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
}

#chart6 .vega-bind label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
}

#chart11 {
  display: flex;
  justify-content: center;
}

#chart14 .vega-embed {
  margin: 0 auto;
}

.gauge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 1rem 0;
}

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border: 1px solid #E2DDD4;
  border-radius: 12px;
  padding: 1.2rem 1rem 1rem;
}

.gauge-title {
  font-size: 13px;
  font-weight: 500;
  color: #5F5E5A;
  margin-bottom: 0.8rem;
  font-family: 'DM Sans', sans-serif;
}

.gauge-svg { width: 140px; height: 80px; }

.gauge-status {
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
}

.status-green { background: #EAF3DE; color: #3B6D11; }
.status-amber { background: #FAEEDA; color: #854F0B; }
.status-red { background: #FCEBEB; color: #A32D2D; }

.conclusion-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal-mid);
  border-radius: 14px;
  padding: 2rem;
  margin-top: 2rem;
  max-width: 1100px;
  margin-left: 9.5rem;
  margin-right: auto;
}

.conclusion-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--teal-dark);
  margin-bottom: 1rem;
}

.conclusion-body {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.85;
  font-family: 'DM Sans', sans-serif;
}