/* ===================================
   FECON — Federación Costarricense
   para la Conservación de la Naturaleza
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
  --green-dark: #1a3a2a;
  --green-mid: #2d6a4f;
  --green-bright: #40916c;
  --green-light: #74c69d;
  --green-pale: #d8f3dc;
  --earth: #6b4226;
  --gold: #b5893a;
  --off-white: #f8f5f0;
  --white: #ffffff;
  --text-dark: #1a1a1a;
  --text-mid: #444;
  --text-light: #777;
  --border: #e0dbd4;
  --shadow: rgba(26,58,42,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  color: var(--text-dark);
  background: var(--off-white);
  line-height: 1.7;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ===== TOPBAR ===== */
.topbar {
  background: var(--green-dark);
  color: rgba(255,255,255,0.7);
  font-size: 0.78rem;
  padding: 6px 0;
  letter-spacing: 0.04em;
}
.topbar .wrap {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: flex-end; gap: 20px;
}
.topbar a { color: rgba(255,255,255,0.7); transition: color 0.2s; }
.topbar a:hover { color: var(--green-light); }

/* ===== HEADER ===== */
.site-header {
  background: var(--white);
  box-shadow: 0 2px 12px var(--shadow);
  position: sticky; top: 0; z-index: 100;
  /* allow dropdown to overflow visually */
  overflow: visible;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 70px; overflow: visible;
}
.logo img { height: 48px; width: auto; }

/* ===== NAV ===== */
.main-nav { overflow: visible; }
.main-nav > ul {
  list-style: none;
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0; padding: 0;
}
.main-nav > ul > li {
  position: relative;
  flex-shrink: 0;
}
.main-nav > ul > li > a {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 4px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dark);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.active > a {
  color: var(--green-mid); background: var(--green-pale);
}
.main-nav > ul > li > a i { font-size: 0.85em; color: var(--green-mid); }

/* Dropdown — hidden by default, shown only on hover */
.sub-menu {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  min-width: 210px;
  list-style: none;
  border-top: 3px solid var(--green-mid);
  z-index: 9999;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.sub-menu li a {
  display: block; padding: 10px 18px;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-mid);
  transition: color 0.15s, background 0.15s;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sub-menu li:last-child a { border-bottom: none; }
.sub-menu li a:hover { color: var(--green-mid); background: var(--green-pale); }

/* Show on hover — both parent li AND sub-menu itself to avoid gap flicker */
.main-nav > ul > li:hover > .sub-menu,
.sub-menu:hover {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 8px; background: none; border: none;
}
.hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--green-dark); border-radius: 2px;
  transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-bright) 100%);
  color: var(--white); padding: 90px 24px 80px;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; max-width: 780px; margin: 0 auto; }
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700; line-height: 1.2;
  margin-bottom: 20px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.hero p {
  font-size: 1.15rem; opacity: 0.9;
  max-width: 560px; margin: 0 auto 30px;
}
.hero-btn {
  display: inline-block; padding: 13px 34px;
  background: var(--white); color: var(--green-dark);
  border-radius: 3px; font-weight: 700;
  font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(0,0,0,0.15);
}
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.2); }

/* ===== CATEGORY ICONS ===== */
.category-icons {
  background: var(--white);
  padding: 44px 24px;
  border-bottom: 1px solid var(--border);
}
.category-icons .wrap { max-width: 1000px; margin: 0 auto; }
.icons-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px; text-align: center;
}
.icon-item a {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 8px; border-radius: 8px; transition: background 0.2s;
}
.icon-item a:hover { background: var(--green-pale); }
.icon-item img { width: 64px; height: 64px; object-fit: contain; margin: 0 auto; }
.icon-item span {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--green-dark);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 1200px; margin: 0 auto;
  padding: 48px 24px;
  display: grid; grid-template-columns: 1fr 340px; gap: 48px;
}

/* ===== SECTION HEADING ===== */
.section-heading {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px; padding-bottom: 12px;
  border-bottom: 2px solid var(--green-mid);
}
.section-heading a {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem; font-weight: 700;
  color: var(--green-dark); text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-heading .badge {
  display: inline-block; background: var(--green-mid);
  color: var(--white); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px;
}

/* ===== NEWS GRID ===== */
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 48px; }
.news-card {
  background: var(--white); border-radius: 6px; overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column;
}
.news-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px var(--shadow); }
.news-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr; }
.card-img {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--green-pale), var(--green-light));
  min-height: 200px;
}
.news-card.featured .card-img { min-height: 280px; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.news-card:hover .card-img img { transform: scale(1.04); }
.card-tag {
  position: absolute; top: 12px; left: 12px;
  background: var(--green-mid); color: var(--white);
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 2px;
}
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 600; line-height: 1.4;
  color: var(--text-dark); margin-bottom: 10px; flex: 1;
}
.news-card.featured .card-body h2 { font-size: 1.3rem; }
.card-body h2 a:hover { color: var(--green-mid); }
.card-date { font-size: 0.78rem; color: var(--text-light); }
.card-excerpt { font-size: 0.88rem; color: var(--text-mid); margin: 8px 0; }

/* Thumbnail list */
.thumb-list { display: flex; flex-direction: column; gap: 16px; }
.thumb-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.thumb-item:last-child { border-bottom: none; padding-bottom: 0; }
.thumb-img {
  width: 86px; height: 64px; flex-shrink: 0;
  border-radius: 4px; overflow: hidden;
  background: var(--green-pale);
}
.thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.thumb-tag { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green-mid); }
.thumb-title { font-size: 0.88rem; font-weight: 600; line-height: 1.4; color: var(--text-dark); margin-top: 4px; }
.thumb-title a:hover { color: var(--green-mid); }

/* ===== SIDEBAR ===== */
.sidebar-section { margin-bottom: 40px; }
.sidebar-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--green-dark);
  padding-bottom: 10px; border-bottom: 2px solid var(--green-mid);
  margin-bottom: 16px;
}
.sidebar-list { list-style: none; }
.sidebar-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list li a { font-size: 0.88rem; color: var(--text-mid); transition: color 0.2s; }
.sidebar-list li a:hover { color: var(--green-mid); }

/* About widget */
.about-widget {
  background: var(--green-dark); color: var(--white);
  border-radius: 6px; padding: 24px;
}
.about-widget h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; margin-bottom: 12px;
  color: var(--green-light);
}
.about-widget p { font-size: 0.88rem; opacity: 0.85; line-height: 1.6; margin-bottom: 14px; }
.about-widget a {
  display: inline-block; padding: 8px 18px;
  background: var(--green-bright); color: var(--white);
  border-radius: 3px; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: background 0.2s;
}
.about-widget a:hover { background: var(--green-light); }

/* ===== PAGE HEADER (inner pages) ===== */
.page-hero {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: var(--white); padding: 60px 24px;
  text-align: center;
}
.page-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700; margin-bottom: 12px;
}
.page-hero p { font-size: 1rem; opacity: 0.85; max-width: 560px; margin: 0 auto; }
.breadcrumb {
  font-size: 0.8rem; opacity: 0.7; margin-bottom: 10px;
  display: flex; justify-content: center; gap: 8px; align-items: center;
}
.breadcrumb a { color: rgba(255,255,255,0.8); }
.breadcrumb a:hover { color: var(--white); }
.breadcrumb span { opacity: 0.5; }

/* ===== ABOUT PAGE ===== */
.about-content {
  max-width: 1200px; margin: 0 auto; padding: 60px 24px;
  display: grid; grid-template-columns: 1fr 360px; gap: 60px;
}
.about-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem; color: var(--green-dark);
  margin-bottom: 16px; margin-top: 32px;
}
.about-text h2:first-child { margin-top: 0; }
.about-text p { margin-bottom: 16px; color: var(--text-mid); }
.about-text ul { margin: 12px 0 16px 24px; color: var(--text-mid); }
.about-text ul li { margin-bottom: 8px; }

.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 32px; }
.team-card {
  background: var(--white); border-radius: 6px; overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow); text-align: center; padding-bottom: 20px;
}
.team-card img { width: 100%; height: 180px; object-fit: cover; }
.team-card h4 { font-size: 0.95rem; font-weight: 700; margin: 14px 14px 4px; color: var(--green-dark); }
.team-card p { font-size: 0.82rem; color: var(--text-light); padding: 0 14px; }

/* ===== CONTACT PAGE ===== */
.contact-content {
  max-width: 1200px; margin: 0 auto; padding: 60px 24px;
  display: grid; grid-template-columns: 1fr 400px; gap: 60px;
}
.contact-form label {
  display: block; font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dark); margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 4px;
  font-family: 'Source Sans 3', sans-serif; font-size: 0.95rem;
  color: var(--text-dark); background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 20px;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none; border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}
.contact-form textarea { min-height: 140px; resize: vertical; }
.btn-submit {
  display: inline-block; padding: 13px 36px;
  background: var(--green-mid); color: var(--white);
  border: none; border-radius: 3px; cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: background 0.2s, transform 0.2s;
}
.btn-submit:hover { background: var(--green-dark); transform: translateY(-1px); }

.contact-info h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem; color: var(--green-dark); margin-bottom: 20px;
}
.contact-detail {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 20px;
}
.contact-detail i { font-size: 1.1rem; color: var(--green-mid); margin-top: 2px; flex-shrink: 0; }
.contact-detail div { font-size: 0.9rem; color: var(--text-mid); line-height: 1.5; }
.contact-detail strong { display: block; color: var(--text-dark); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.social-links { display: flex; gap: 12px; margin-top: 24px; }
.social-links a {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--green-pale); color: var(--green-dark);
  font-size: 0.95rem; transition: background 0.2s, color 0.2s;
}
.social-links a:hover { background: var(--green-mid); color: var(--white); }

/* ===== CATEGORY PAGE ===== */
.category-content {
  max-width: 1200px; margin: 0 auto; padding: 60px 24px;
  display: grid; grid-template-columns: 1fr 300px; gap: 48px;
}
.posts-list { display: grid; gap: 28px; }
.post-card {
  background: var(--white); border-radius: 6px; overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow);
  display: grid; grid-template-columns: 240px 1fr;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px var(--shadow); }
.post-card .card-img { min-height: 180px; }
.post-card .card-body { padding: 24px; }
.post-card h2 { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 600; margin-bottom: 10px; }
.post-card p { font-size: 0.88rem; color: var(--text-mid); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.75);
  margin-top: 60px;
}
.footer-top {
  max-width: 1200px; margin: 0 auto;
  padding: 56px 24px 40px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px;
}
.footer-brand img { height: 44px; margin-bottom: 18px; filter: brightness(0) invert(1); }
.footer-brand p { font-size: 0.88rem; opacity: 0.75; line-height: 1.6; max-width: 260px; }
.footer-col h4 {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--green-light);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: 0.88rem; opacity: 0.75; transition: opacity 0.2s; }
.footer-col ul li a:hover { opacity: 1; color: var(--green-light); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 18px 24px;
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; opacity: 0.6;
}

/* ===== BACK TO TOP ===== */
.back-top {
  position: fixed; bottom: 28px; right: 28px;
  width: 42px; height: 42px; background: var(--green-mid);
  color: var(--white); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.back-top.visible { opacity: 1; pointer-events: all; }
.back-top:hover { transform: translateY(-3px); }

/* ===== NOTICE (form success) ===== */
.form-notice {
  padding: 14px 20px; border-radius: 4px;
  font-size: 0.9rem; font-weight: 600;
  display: none; margin-top: 12px;
}
.form-notice.success { background: var(--green-pale); color: var(--green-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-content { grid-template-columns: 1fr; }
  .about-content, .contact-content, .category-content { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .news-card.featured { grid-template-columns: 1fr; }
  .post-card { grid-template-columns: 1fr; }
  .icons-grid { grid-template-columns: repeat(3, 1fr); }
  .team-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: block;
    position: absolute; top: 70px; left: 0; right: 0;
    background: var(--white); box-shadow: 0 8px 24px var(--shadow);
    padding: 16px; z-index: 9999;
  }
  .main-nav.open > ul { flex-direction: column; align-items: stretch; }
  .main-nav.open > ul > li > a { width: 100%; }
  .hamburger { display: flex; }
  /* on mobile sub-menu renders inline, always visible inside open menu */
  .main-nav.open .sub-menu {
    visibility: visible; opacity: 1; pointer-events: auto;
    position: static; box-shadow: none; border-top: none;
    padding-left: 16px; border-left: 2px solid var(--green-pale);
    margin: 4px 0 8px;
  }
  .icons-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
