/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  /* Use native browser smooth scrolling for a lag-free experience */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-secondary);
  background-color: var(--color-base);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  /* iOS momentum scrolling on touch devices */
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Typography */
h1 {
  color: #295334;
  text-align: center;
  font-family: 'Alegreya', serif;
  font-size: 40px;
  font-style: normal;
  font-weight: 700;
  line-height: 45px;
  letter-spacing: 2px;
  margin-bottom: 2rem;
}

h2,
h3,
h4,
h5,
h6 {
  color: #295334;
  text-align: center;
  font-family: 'Alegreya', serif;
  font-size: 30px;
  font-style: normal;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: 2px;
  margin-bottom: 2rem;
}

/* Swirl decoration — appears on all H1 headings as requested */
h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1::after {
  content: '';
  display: block;
  width: 120px;
  height: 67px;
  margin-top: 0px;
  background: url('https://underthebanyan.co/img/utb-design-element-swirl.png') no-repeat center / contain;
  opacity: 1;
}

@media (max-width: 768px) {

  h2,
  h3,
  h4,
  h5,
  h6 {
    font-size: 28px;
    /* 30% reduction from 40px */
  }
}

/* Adjusting Kerning for all caps Alegreya Serif as requested */
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  /* Reduced from typical 0.1em or higher */
}

/* ─── Body / Paragraph Text ─────────────────────────────────────────────── */
/* Default: Merriweather 20px / lh 34 / #534631 — excludes .intro-text */
p {
  color: #534631;
  text-align: center;
  font-family: 'Merriweather', serif;
  font-size: 20px;
  font-style: normal;
  font-weight: 400;
  line-height: 34px;
  margin-bottom: 1.5rem;
}

/* ─── Block / Contained Text ────────────────────────────────────────────── */
/* Text inside cards, sub-sections, accordions, footer cols, SDG items etc. */
.pillar-card p,
.study-area-card p,
.faq-answer p,
.faq-item p,
.offering-desc,
.offering-content p,
.sdg-content p,
.footer-col p,
.footer-col li,
.node-desc,
.text-block p {
  font-family: 'Merriweather', serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 30px;
  color: #534631;
}

/* Intro / About text container — 1050px centered */
.intro-text {
  max-width: 1050px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Introduction — Intro section paragraph text */
.intro-description {
  color: #534631;
  text-align: center;
  font-family: 'Merriweather', serif;
  font-size: 24px;
  font-style: normal;
  font-weight: 400;
  line-height: 44px;
}

/* ─── Card Heading ───────────────────────────────────────────────────────── */
.card-heading {
  color: #295334;
  font-family: 'Merriweather', serif;
  font-size: 18px;
  font-style: normal;
  font-weight: bold;
  line-height: 30px;
  letter-spacing: 0.9px;
  text-align: left;
  margin-bottom: 0.75rem;
}

/* ─── Card Description ───────────────────────────────────────────────────── */
.card-description {
  width: 260px;
  color: #534631;
  font-family: 'Merriweather', serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 30px;
  text-align: left;
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

ul,
ol {
  list-style-position: inside;
  margin-bottom: 1.5rem;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--mobile-gutter);
}

.section {
  padding: 6rem 0;
}

/* Flex & Grid Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 1rem;
}

.gap-2 {
  gap: 2rem;
}

.gap-3 {
  gap: 3rem;
}

.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Buttons & Links */
.btn {
  display: inline-block;
  padding: 1rem 2rem;
  font-family: var(--font-secondary);
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background-color 0.3s ease;
  border: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-accent-1);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 20px rgba(70, 165, 109, 0.2);
}

.btn-secondary {
  background-color: var(--color-accent-3);
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: #e5b935;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 20px rgba(253, 206, 60, 0.2);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: #fff;
}

.link-highlight {
  position: relative;
  display: inline-block;
  font-weight: 600;
  color: var(--color-primary);
}

.link-highlight::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--color-accent-3);
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease-out;
}

.link-highlight:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* Decorative Elements */
.underline-scribble {
  position: relative;
  display: inline-block;
}

.underline-scribble::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 Q 25 2, 50 5 T 100 5' stroke='%23FDCE3C' stroke-width='3' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: -1;
}

/* Playful blobs */
.blob {
  position: absolute;
  filter: blur(40px);
  z-index: 0;
  opacity: 0.6;
  border-radius: 50%;
  animation: blobFloat 10s infinite alternate ease-in-out;
}

@keyframes blobFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(20px, -20px) scale(1.1);
  }

  100% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    color: #295334 !important;
    font-family: 'Alegreya', serif !important;
    font-size: 26px !important;
    font-style: normal !important;
    font-weight: 700 !important;
    line-height: 34px !important;
  }

  h1::after {
    width: 50px !important;
    height: 34px !important;
    margin-top: 10px !important;
  }

  h2 {
    font-size: 1.8rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.4rem;
    line-height: 1.4;
  }

  p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .grid-cols-2,
  .grid-cols-3 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .section {
    padding: 3.5rem var(--mobile-gutter);
    /* Safe Area Awareness */
    padding-left: calc(var(--mobile-gutter) + var(--safe-area-left));
    padding-right: calc(var(--mobile-gutter) + var(--safe-area-right));
  }

  .container {
    padding-left: 0;
    padding-right: 0;
    /* Since section already handles the gutters on mobile, we can zero out container padding if it's inside a section, or better yet, keep it consistent. */
  }

  /* Ensuring long words don't break layout */
  p, h1, h2, h3, h4, .intro-description {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Improved padding globally for elements that might touch the edge */
  .flex-col > * {
    max-width: 100%;
  }

  /* Responsive Spacing Utility */
  .section-airy {
    padding-top: 5rem !important;
    padding-bottom: 5rem !important;
  }
}

/* Styling for the card containing only the image */
.pillar-card.image-only-card {
  padding: 0;
  /* Removes default padding so the image touches the edges */
  overflow: hidden;
  /* Keeps the image within the card's 20px border-radius */
  min-height: 242px;
  /* Matches your specific card height */
  display: flex;
}

/* Ensures the image fills the 340x242 space perfectly without stretching */
.pillar-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}