/* ===================================================================
   Carlos E. Villadiego — Site Stylesheet
   Theme: Hunter Green / Black / White
=================================================================== */

:root {
  --green: #2f5233;
  --green-dark: #1c331f;
  --green-darker: #10200f;
  --green-light: #4f7a55;
  --green-pale: #e8efe8;
  --black: #0d0f0d;
  --white: #ffffff;

  --bg: #ffffff;
  --bg-alt: #f4f6f4;
  --surface: #ffffff;
  --text: #12140f;
  --text-muted: #4c534d;
  --border: #e1e6e0;
  --accent: var(--green);
  --accent-dark: var(--green-dark);
  --accent-light: var(--green-light);
  --on-accent: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 10px 30px rgba(13, 15, 13, 0.08);
  --shadow-sm: 0 2px 10px rgba(13, 15, 13, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1140px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

html[data-theme="dark"] {
  --bg: #0d0f0d;
  --bg-alt: #15170f;
  --surface: #161914;
  --text: #f3f5f1;
  --text-muted: #b6bdb3;
  --border: #262b23;
  --accent: #6ea973;
  --accent-dark: #4f7a55;
  --accent-light: #8fc094;
  --on-accent: #0d0f0d;
  --header-bg: rgba(13, 15, 13, 0.88);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --green-pale: #1b241a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  transition: background 0.25s ease, color 0.25s ease;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; }

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  z-index: 300;
  transition: width 0.1s ease-out;
}

/* ============== Header / Nav ============== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.logo {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--green), var(--green-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.92rem;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links > li { position: relative; }

.nav-links > li > a,
.nav-links > li > button.nav-top-btn {
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-links > li > a:hover,
.nav-links > li > button.nav-top-btn:hover,
.nav-links > li > a.active {
  color: var(--accent);
  background: var(--green-pale);
}

.caret { font-size: 0.65rem; transform: translateY(1px); }

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 230px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 210;
}

.nav-links > li.open .dropdown { display: flex; }

.dropdown a {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
}
.dropdown a:hover { background: var(--green-pale); color: var(--accent); }
.dropdown a small { display: block; color: var(--text-muted); font-weight: 400; font-size: 0.76rem; margin-top: 1px; }

.nav-tools { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px; height: 18px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

/* ============== Hero ============== */
.hero {
  padding: 110px 0 80px;
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--black) 100%);
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(79,122,85,0.35), transparent 55%);
}
.hero-inner { max-width: 740px; margin: 0 auto; position: relative; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #a9caac;
  margin: 0 0 14px;
}

.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin: 0 0 18px; font-weight: 800; letter-spacing: -0.5px; }
.hero-sub { font-size: 1.08rem; color: rgba(255,255,255,0.85); margin: 0 auto 32px; max-width: 620px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.hero-location { font-size: 0.88rem; color: rgba(255,255,255,0.6); margin: 0; }

/* Page header (for interior pages) */
.page-hero {
  padding: 64px 0 48px;
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--black) 100%);
  color: #fff;
}
.breadcrumbs { font-size: 0.8rem; color: rgba(255,255,255,0.65); margin: 0 0 14px; }
.breadcrumbs a { color: rgba(255,255,255,0.85); }
.breadcrumbs a:hover { color: #fff; text-decoration: underline; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 10px; font-weight: 800; }
.page-hero p { color: rgba(255,255,255,0.82); max-width: 680px; margin: 0; font-size: 1.02rem; }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-light); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn-outline { border-color: rgba(255,255,255,0.4); color: #fff; }
.btn-outline:hover { border-color: #fff; transform: translateY(-2px); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

/* ============== Sections ============== */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 1.8rem; font-weight: 800; color: var(--text); margin: 0 0 12px; letter-spacing: -0.3px; }
.section-kicker { text-transform: uppercase; letter-spacing: 1.6px; font-size: 0.74rem; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
.section-lede { color: var(--text-muted); max-width: 700px; margin: 0 0 40px; font-size: 1.02rem; }
.about-text { font-size: 1.05rem; color: var(--text-muted); max-width: 760px; }

/* Cards grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.card h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--text); }
.card p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }
.card .card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--green-pale); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 14px;
}
.card-link { display: inline-block; margin-top: 14px; font-size: 0.84rem; font-weight: 700; color: var(--accent); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 28px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding-bottom: 36px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: -34px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.timeline-tag {
  display: inline-block; font-size: 0.76rem; font-weight: 700; color: var(--accent);
  background: var(--green-pale); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.timeline-content h3 { margin: 0 0 4px; font-size: 1.15rem; color: var(--text); }
.timeline-org { margin: 0 0 4px; font-weight: 700; color: var(--text-muted); }
.timeline-desc { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* Experience */
.experience-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-sm); }
.experience-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.experience-head h3 { margin: 0 0 4px; font-size: 1.2rem; }
.experience-list { margin: 0; padding-left: 20px; color: var(--text-muted); }
.experience-list li { margin-bottom: 10px; }
.experience-list li:last-child { margin-bottom: 0; }

/* Skills grid */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.contact-card { display: flex; flex-direction: column; gap: 6px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; transition: transform 0.2s ease, border-color 0.2s ease; }
.contact-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.contact-label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; }
.contact-value { font-size: 1rem; font-weight: 700; color: var(--accent); word-break: break-word; }

.contact-form { display: grid; gap: 16px; max-width: 620px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 0.84rem; font-weight: 700; color: var(--text); }
.form-row input, .form-row textarea {
  font: inherit; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.form-row input:focus, .form-row textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-note { font-size: 0.8rem; color: var(--text-muted); }

/* FAQ accordion */
.faq-list { display: grid; gap: 12px; max-width: 800px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.faq-question {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--text); padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-question .faq-plus { transition: transform 0.2s ease; color: var(--accent); font-size: 1.1rem; }
.faq-item.open .faq-plus { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.faq-item.open .faq-answer { max-height: 400px; }
.faq-answer-inner { padding: 0 20px 18px; color: var(--text-muted); font-size: 0.94rem; }

/* Article / Insights */
.article-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.article-body { max-width: 760px; font-size: 1.03rem; color: var(--text); }
.article-body p { margin: 0 0 18px; }
.article-body h2 { margin: 36px 0 14px; font-size: 1.35rem; color: var(--text); }
.article-body ul { margin: 0 0 18px; padding-left: 22px; color: var(--text-muted); }
.article-body li { margin-bottom: 8px; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--accent); background: var(--green-pale); padding: 3px 10px; border-radius: 999px; margin-right: 6px; }

/* Sitemap */
.sitemap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.sitemap-col h3 { font-size: 0.95rem; color: var(--accent); margin: 0 0 12px; text-transform: uppercase; letter-spacing: 1px; }
.sitemap-col ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.sitemap-col a { color: var(--text-muted); font-size: 0.92rem; }
.sitemap-col a:hover { color: var(--accent); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* Back to top */
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 250;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* Search modal */
.search-overlay {
  position: fixed; inset: 0; background: rgba(13,15,13,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh; z-index: 400;
}
.search-overlay.open { display: flex; }
.search-panel {
  width: 92%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px;
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.search-input-row input { flex: 1; border: none; background: none; font: inherit; font-size: 1rem; color: var(--text); outline: none; }
.search-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.search-result { display: block; padding: 12px 14px; border-radius: var(--radius-sm); }
.search-result:hover, .search-result.active { background: var(--green-pale); }
.search-result strong { color: var(--text); display: block; font-size: 0.92rem; }
.search-result span { color: var(--text-muted); font-size: 0.8rem; }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Callout / CTA */
.cta-band {
  background: linear-gradient(160deg, var(--green-dark), var(--black));
  color: #fff; border-radius: var(--radius); padding: 48px; text-align: center;
}
.cta-band h2 { margin: 0 0 10px; font-size: 1.6rem; }
.cta-band p { margin: 0 0 24px; color: rgba(255,255,255,0.82); max-width: 560px; margin-left: auto; margin-right: auto; }

/* Footer */
.site-footer { background: var(--black); color: rgba(255,255,255,0.7); padding: 56px 0 24px; }
.footer-top { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; padding-bottom: 36px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.footer-brand p { color: rgba(255,255,255,0.6); font-size: 0.88rem; max-width: 260px; }
.footer-col h4 { color: #fff; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 14px; }
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: rgba(255,255,255,0.62); font-size: 0.88rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 22px; font-size: 0.82rem; color: rgba(255,255,255,0.5); }
.footer-bottom a { color: rgba(255,255,255,0.5); }
.footer-bottom a:hover { color: #fff; }

/* Print */
@media print {
  .site-header, .site-footer, .back-to-top, .scroll-progress, .search-overlay, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .page-hero { background: none !important; color: #000 !important; padding: 0 0 20px; }
  .page-hero p, .breadcrumbs { color: #333 !important; }
}

/* Responsive */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .site-header.menu-open .nav-links {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px; max-height: 80vh; overflow-y: auto;
  }
  .site-header.menu-open .nav-links > li { width: 100%; }
  .site-header.menu-open .nav-links > li > a,
  .site-header.menu-open .nav-links > li > button.nav-top-btn { width: 100%; justify-content: space-between; }
  .site-header.menu-open .dropdown { position: static; transform: none; box-shadow: none; display: none; width: 100%; }
  .site-header.menu-open .nav-links > li.open .dropdown { display: flex; }
  .footer-top { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .hero { padding: 90px 0 56px; }
  .page-hero { padding: 52px 0 36px; }
  .footer-top { grid-template-columns: 1fr; }
  .cta-band { padding: 32px 20px; }
}
