:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1e1e1e;
  --muted: #6b6b6b;
  --green: #2f5d50;
  --green-dark: #244840;
  --tan: #d6c7a1;
  --terracotta: #c86a3b;
  --border: #e6e0d4;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }

.wrap,
.site-main,
.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}
.site-main { padding: 2rem 0 4rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}
.site-brand img {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  padding: .85rem 1.2rem;
  font-weight: 600;
}
.button:hover { background: var(--green-dark); color: #fff; }
.button--secondary {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}
.button--small {
  padding: .6rem .95rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0 1rem;
}
.hero__content,
.hero__featured,
.featured-card,
.simple-card,
.episode-card,
.guest-card,
.newsletter-box,
.page-template,
.post-template,
.guest-profile,
.site-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero__content,
.hero__featured,
.newsletter-box,
.page-template,
.post-template,
.guest-profile {
  padding: 1.5rem;
}
.hero__content h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.1;
  margin: .25rem 0 1rem;
}
.hero__lede { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.hero__actions { display: flex; gap: .85rem; flex-wrap: wrap; margin-top: 1rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
  color: var(--terracotta);
  font-weight: 700;
  margin: 0 0 .4rem;
}

.section { margin-top: 2rem; }
.section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.section__head h1,
.section__head h2,
.section h1,
.section h2,
.post-template h1,
.page-template h1,
.guest-profile h1 {
  line-height: 1.15;
  margin: 0;
}
.card-grid {
  display: grid;
  gap: 1.25rem;
}
.card-grid--episodes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid--guests { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.episode-card,
.guest-card,
.simple-card,
.featured-card {
  overflow: hidden;
}
.episode-card__body,
.guest-card__body,
.simple-card,
.featured-card {
  padding: 1rem;
}
.episode-card__image,
.guest-card__image,
.featured-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.guest-card__image { aspect-ratio: 1 / 1; }
.episode-number {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--terracotta);
  font-weight: 700;
  margin: 0 0 .45rem;
}
.meta-icons {
  color: var(--muted);
  font-size: .95rem;
  min-height: 1.2rem;
  margin-bottom: .55rem;
}
.text-link {
  font-weight: 700;
}

.post-template__image,
.page-template__image {
  width: 100%;
  border-radius: 10px;
  margin: 1rem 0 1rem;
}
.post-template__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.guest-profile__header {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.guest-profile__media img {
  width: 100%;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.rte > *:first-child { margin-top: 0; }
.rte > *:last-child { margin-bottom: 0; }

.species-grid {
  display: grid;
  gap: 1.25rem;
}

.newsletter-box {
  text-align: center;
}

.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 3rem auto 2rem;
  padding: 1.5rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr .8fr;
  gap: 1.5rem;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
}
.site-footer li + li { margin-top: .35rem; }

.kg-width-wide {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.kg-width-full {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

@media (max-width: 980px) {
  .hero,
  .guest-profile__header {
    grid-template-columns: 1fr;
  }
  .card-grid--episodes,
  .card-grid--guests,
  .site-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .site-header__inner,
  .section__head {
    display: block;
  }
  .site-nav {
    margin-top: .75rem;
  }
  .card-grid--episodes,
  .card-grid--guests,
  .site-footer__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Upcoming Events ─────────────────────────────────────────────────────── */

.section--events { margin-top: 1.5rem; }

/*
  HOW TO WRITE EVENTS in the Ghost editor (HTML card, slug: events):

  Without image:
  <ul>
    <li>
      <strong>Grazing Conference</strong>
      <br>April 12–14, 2026 | Tulsa, OK
      <br>Annual gathering for regenerative graziers in the southern plains.
      <br><a href="https://example.com">Register →</a>
    </li>
  </ul>

  With image (optional — omit the <img> line if no image):
  <ul>
    <li>
      <img src="https://your-site.ghost.io/content/images/event-poster.jpg" alt="Event name">
      <strong>Grazing Conference</strong>
      <br>April 12–14, 2026 | Tulsa, OK
      <br>Annual gathering for regenerative graziers in the southern plains.
      <br><a href="https://example.com">Register →</a>
    </li>
  </ul>
*/

.events-grid ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.events-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 3px solid var(--terracotta);
  overflow: hidden;
  font-size: .95rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

/* Image sits edge-to-edge at top — pulled out of the card padding with negative margins */
.events-grid li img {
  width: calc(100% + 2rem);
  margin: -1rem -1rem .85rem -1rem;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* Event name */
.events-grid li strong {
  display: block;
  font-size: 1rem;
  color: var(--green);
  margin-bottom: .35rem;
}

/* Register / learn more link */
.events-grid li a {
  display: inline-block;
  margin-top: .5rem;
  font-weight: 700;
  font-size: .88rem;
  color: var(--terracotta);
}
.events-grid li a:hover { color: var(--green); }

.events-grid:empty { display: none; }

/* ── Sponsors ─────────────────────────────────────────────────────────────── */

/*
  HOW TO WRITE SPONSORS in the Ghost editor (HTML card, slug: sponsors):

  <ul>
    <li>
      <img src="https://your-site.ghost.io/content/images/sponsor-logo.png" alt="Sponsor Name">
      <strong>Sponsor Name</strong>
      One sentence about what they do or offer.
      <a href="https://example.com">Learn more →</a>
    </li>
  </ul>

  Upload logos to Ghost Admin → Settings → Design → Upload, or via the
  image upload in any post/page editor (then copy the URL).
  Use transparent PNG logos for best results.
  Recommended logo size: 300×120px or similar wide format.
*/

.sponsors-grid ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.sponsors-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem 1rem;
  font-size: .95rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
}

/* Logo — constrained height, left-aligned, transparent-friendly */
.sponsors-grid li img {
  max-height: 112px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin-bottom: .5rem;
}

.sponsors-grid li strong {
  font-size: 1rem;
  color: var(--green);
}

.sponsors-grid li a {
  font-weight: 700;
  font-size: .88rem;
  color: var(--terracotta);
  margin-top: auto;
  padding-top: .35rem;
}
.sponsors-grid li a:hover { color: var(--green); }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .events-grid ul   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sponsors-grid ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .events-grid ul   { grid-template-columns: 1fr; }
  .sponsors-grid ul { grid-template-columns: 1fr; }
}

/* ── Dynamic nav with dropdowns ──────────────────────────────────────────── */

/*
  The nav is built from a Ghost page (slug: nav-menu) using an HTML card.
  Top-level <li> = nav item. Nested <ul> = dropdown submenu.

  Example structure in the HTML card:
  <ul>
    <li><a href="/podcast/">Podcast</a></li>
    <li>
      <a href="/learn/">Learn</a>
      <ul>
        <li><a href="/species/">Species</a></li>
        <li><a href="/maps/">Maps</a></li>
      </ul>
    </li>
  </ul>
*/

.site-nav--dynamic ul {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Each top-level nav item */
.site-nav--dynamic > ul > li {
  position: relative;
}

/* Top-level links */
.site-nav--dynamic > ul > li > a {
  color: var(--text);
  font-size: .95rem;
  font-weight: 500;
  padding: .35rem 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.site-nav--dynamic > ul > li > a:hover {
  color: var(--green);
}

/* Arrow indicator on items that have a submenu */
.site-nav--dynamic > ul > li:has(ul) > a::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .5;
  transition: transform .2s;
}
.site-nav--dynamic > ul > li:has(ul):hover > a::after,
.site-nav--dynamic > ul > li:has(ul).is-open > a::after {
  transform: rotate(180deg);
  opacity: 1;
}

/* Dropdown submenu */
.site-nav--dynamic ul ul {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: absolute;
  top: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .4rem 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, visibility .15s;
  z-index: 200;
}

/* Small notch at top of dropdown */
.site-nav--dynamic ul ul::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  rotate: 45deg;
}

/* Show on hover (desktop) or .is-open (tap/mobile) */
.site-nav--dynamic > ul > li:hover > ul,
.site-nav--dynamic > ul > li.is-open > ul {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Submenu links */
.site-nav--dynamic ul ul a {
  display: block;
  padding: .5rem 1.1rem;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
}
.site-nav--dynamic ul ul a:hover {
  color: var(--green);
  background: var(--bg);
}

/* ── Mobile hamburger ─────────────────────────────────────────────────────── */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* Hamburger → X animation */
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .site-nav--dynamic {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    z-index: 100;
  }
  body.nav-open .site-nav--dynamic { display: flex; flex-direction: column; gap: .5rem; }

  .site-nav--dynamic ul { flex-direction: column; align-items: flex-start; gap: 0; }
  .site-nav--dynamic > ul > li { width: 100%; }
  .site-nav--dynamic > ul > li > a { padding: .6rem 0; width: 100%; }

  /* Mobile submenu — shown inline when .is-open */
  .site-nav--dynamic ul ul {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
    padding: 0 0 0 .75rem;
    margin: 0 0 .5rem;
    min-width: auto;
    width: 100%;
    opacity: 1;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s, visibility .2s;
    pointer-events: none;
  }
  .site-nav--dynamic ul ul::before { display: none; }
  .site-nav--dynamic > ul > li.is-open > ul {
    visibility: visible;
    max-height: 300px;
    pointer-events: auto;
  }

  .site-nav--dynamic ul ul a { padding: .4rem 0; font-size: .9rem; }
}
