@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ========================
   TOKENS
   ======================== */
:root {
  --forest: #14532d;
  --forest-mid: #166534;
  --green: #16a34a;
  --green-light: #22c55e;
  --green-muted: #f0fdf4;
  --green-subtle: #dcfce7;

  --ink: #111827;
  --ink-mid: #374151;
  --ink-light: #6b7280;
  --border: #e5e7eb;
  --surface: #f9fafb;
  --white: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;

  --header-height: 68px;
  --max-w: 1100px;
  --pad: clamp(1rem, 4vw, 1.75rem);
}

/* ========================
   BASE
   ======================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--white);
  min-height: 100vh;
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ========================
   HEADER
   ======================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  gap: 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.logo-small {
  height: 34px;
  width: auto;
  display: block;
}

.group-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.97rem;
  color: var(--forest);
  line-height: 1.2;
}

/* ========================
   NAV
   ======================== */

/* Desktop: nav centrado sobre el header, fuera del stacking context del blur */
.main-nav {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--header-height);
  display: flex;
  align-items: center;
  z-index: 101; /* por encima del header (100) para recibir eventos */
}

.nav-grid {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--ink-mid);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  appearance: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--green-muted);
  color: var(--green);
  outline: none;
}

.nav-link.is-active {
  background: var(--green-subtle);
  color: var(--forest-mid);
}

/* ========================
   HEADER CONTROLS
   ======================== */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-left: auto; /* siempre a la derecha — el nav ya no está dentro del header */
}

.nav-lang {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}


.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-light);
  padding: 0.2rem 0.25rem;
  border-radius: var(--r-sm);
  transition: color 0.15s;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--green);
}

.lang-btn.is-active {
  font-weight: 800;
  color: var(--forest-mid);
}

.lang-sep {
  color: var(--border);
  font-size: 0.75rem;
  user-select: none;
  line-height: 1;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  transition: background 0.18s;
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: var(--green-muted);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* ========================
   PANELS
   ======================== */
main {
  flex: 1;
  width: 100%;
}

.panel-stack {
  position: relative;
  min-height: calc(100svh - var(--header-height));
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
  animation: panelIn 0.35s ease;
}

.panel-hero.is-active {
  display: flex;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================
   HERO
   ======================== */
.panel-hero {
  position: relative;
  min-height: 100svh;
  background-color: var(--forest);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--white);
  margin-top: calc(-1 * var(--header-height));
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    165deg,
    rgba(8, 24, 14, 0.2) 0%,
    rgba(8, 24, 14, 0.5) 45%,
    rgba(8, 24, 14, 0.92) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(3rem + var(--header-height)) var(--pad) 5rem;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  min-height: 100svh;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--green-light);
  margin: 0 0 1rem;
}

.hero-kicker::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 2px;
  background: currentColor;
  flex-shrink: 0;
}

.hero-content h1 {
  margin: 0 0 1.25rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.025em;
  max-width: 14ch;
}

.hero-content > p:not(.hero-kicker) {
  margin: 0 0 2rem;
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: rgba(255, 255, 255, 0.75);
  max-width: 42ch;
  font-weight: 400;
}

.hero-ctas {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ========================
   BUTTONS
   ======================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.4rem;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  white-space: nowrap;
  background: var(--green);
  color: var(--white);
  line-height: 1;
}

.button:hover,
.button:focus-visible {
  background: var(--green-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  outline: none;
}

.button-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white);
}

.button-outline:hover,
.button-outline:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  transform: translateY(-1px);
}

/* legacy alias */
.button-green {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white);
}

.button-green:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

/* ========================
   CONTENT PANELS
   ======================== */
.content-card {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem var(--pad) 4rem;
  width: 100%;
}

.content-card h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 0.5rem;
  border-bottom: none;
  padding-bottom: 0;
}

.content-card > p {
  color: var(--ink-light);
  font-size: 1.05rem;
  max-width: 55ch;
  margin: 0 0 2rem;
}

/* ========================
   SECTION BLOCKS
   ======================== */
.section-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  margin: 0 0 1rem;
  box-shadow: var(--shadow-sm);
}

.section-block:last-child {
  margin-bottom: 0;
}

.section-block h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--forest-mid);
  margin: 0 0 0.75rem;
  border-top: none;
  padding-top: 0;
}

.section-block p {
  color: var(--ink-mid);
  margin: 0;
  font-size: 0.97rem;
}

.section-block > p + p {
  border-top: none;
  padding-top: 0.65rem;
  margin-top: 0.65rem;
}

.section-block ul {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}

.section-block li {
  margin-bottom: 0.5rem;
  color: var(--ink-mid);
  font-size: 0.97rem;
}

.section-block li:last-child {
  margin-bottom: 0;
}

/* ========================
   BRANCHES
   ======================== */
.branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.branch-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.branch-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--forest-mid), var(--green-light));
}

.branch-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.branch-card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.4rem;
  border-top: none;
  padding-top: 0;
}

.branch-age {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  background: var(--green-subtle);
  color: var(--forest-mid);
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0 0 0.8rem;
  border: none;
}

.branch-card p:not(.branch-age) {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-light);
  line-height: 1.55;
}

/* ========================
   FAQ
   ======================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.faq-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.faq-item[open] {
  box-shadow: var(--shadow-md);
}

.faq-item summary {
  padding: 1.1rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  list-style: none;
  user-select: none;
  transition: background 0.18s;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::marker {
  display: none;
}

.faq-item summary:hover {
  background: var(--green-muted);
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--green);
  flex-shrink: 0;
  transition: transform 0.22s ease;
  line-height: 1;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 0.9rem 1.25rem 1.1rem;
  font-size: 0.93rem;
  color: var(--ink-mid);
  line-height: 1.65;
  margin: 0;
  border-top: 1px solid var(--border);
}

/* ========================
   PANEL FULL (centered: join, contact)
   ======================== */
.panel-full {
  height: calc(100svh - var(--header-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
  padding: 2rem var(--pad);
  overflow: hidden;
}

.panel-full h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.panel-full > p {
  color: var(--ink-light);
  font-size: 1.05rem;
  max-width: 38ch;
  margin: 0 0 1rem;
}

.cta-note {
  margin-bottom: 1.5rem !important;
}

.cta-card {
  background: var(--surface);
}

/* ========================
   SOCIAL LINKS
   ======================== */
.social-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink-mid);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s,
    border-color 0.2s;
}

.social-links a:hover,
.social-links a:focus-visible {
  background: var(--green-muted);
  color: var(--forest-mid);
  border-color: var(--green-subtle);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  outline: none;
}

.social-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.social-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* ========================
   FOOTER
   ======================== */
.site-footer {
  padding: 1.5rem var(--pad);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-light);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ========================
   MOBILE (≤ 760px)
   ======================== */
@media (max-width: 1500px) {
  .menu-toggle {
    display: flex;
  }

  /* mobile: nav drawer lateral */
  .main-nav {
    left: auto;
    right: 0;
    transform: translateX(100%);
    height: 100vh;
    width: min(300px, 88vw);
    background: var(--white);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    overflow-y: auto;
    padding: calc(var(--header-height) + 0.75rem) 0.75rem 1rem;
  }

  .main-nav.is-open {
    transform: translateX(0);
  }

  .nav-grid {
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--r-sm);
  }

  .hero-ctas {
    flex-direction: column;
    align-items: flex-start;
  }

  .branches-grid {
    grid-template-columns: 1fr 1fr;
  }

  .social-links {
    flex-direction: column;
    align-items: stretch;
  }

  .social-links a {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .branches-grid {
    grid-template-columns: 1fr;
  }

  .group-name {
    display: none;
  }
}

/* ========================
   THEME TOGGLE BUTTON
   ======================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-mid);
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--green-muted);
  color: var(--green);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.icon-sun,
.icon-moon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Light mode: mostrar luna (cambiar a oscuro) */
.icon-sun { display: none; }
.icon-moon { display: flex; }

/* Dark mode: mostrar sol (cambiar a claro) */
html[data-theme="dark"] .icon-sun { display: flex; }
html[data-theme="dark"] .icon-moon { display: none; }

/* ========================
   DARK MODE
   ======================== */
html[data-theme="dark"] {
  --forest: #4ade80;
  --forest-mid: #22c55e;
  --green: #22c55e;
  --green-light: #4ade80;
  --green-muted: rgba(34, 197, 94, 0.08);
  --green-subtle: rgba(34, 197, 94, 0.15);

  --ink: #f1f5f9;
  --ink-mid: #cbd5e1;
  --ink-light: #94a3b8;
  --border: #334155;
  --surface: #1e293b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] body {
  background: #0f172a;
}

html[data-theme="dark"] .site-header {
  background: rgba(15, 23, 42, 0.95);
}

html[data-theme="dark"] .section-block,
html[data-theme="dark"] .branch-card,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .social-links a {
  background: #1e293b;
}

html[data-theme="dark"] .panel-full {
  background: #0f172a;
}

html[data-theme="dark"] .site-footer {
  background: #1e293b;
}

html[data-theme="dark"] .menu-toggle {
  background: #1e293b;
}

html[data-theme="dark"] .menu-toggle span {
  background: var(--ink);
}

@media (max-width: 1500px) {
  html[data-theme="dark"] .main-nav {
    background: #1e293b;
  }
}


/* ========================
   REDUCED MOTION
   ======================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
