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

:root {
  /* Paleta — Warm Grey (P6) + acento earth */
  --warm-white:  #FAF9F7;   /* Warm Grey 50  — fondo principal */
  --linen:       #E8E6E1;   /* Warm Grey 100 — fondo secciones */
  --ink:         #27241D;   /* Warm Grey 900 — texto principal */
  --forest:      #423D33;   /* Warm Grey 800 — CTA / primario */
  --forest-light:#504A40;   /* Warm Grey 700 — hover */
  --earth:       #8B7355;   /* umber cálido  — acento */
  --sage:        #F0EFEA;   /* Warm Grey ~75 — hover suave */
  --muted:       #625D52;   /* Warm Grey 600 — texto secundario */
  --stone-light: #A39E93;   /* Warm Grey 400 — texto terciario */
  --border:      rgba(39,36,29,0.08);
  --border-dark: rgba(39,36,29,0.18);

  /* Tipografía */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Radios */
  --radius:    2px;
  --radius-lg: 6px;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --warm-white:  #1A1714;   /* Warm Grey ~950 — fondo oscuro */
  --linen:       #222019;   /* Warm Grey ~920 — superficie oscura */
  --ink:         #FAF9F7;   /* Warm Grey 50  — texto claro */
  --forest:      #D3CEC4;   /* Warm Grey 200 — CTA invertido en dark */
  --forest-light:#B8B2A7;   /* Warm Grey 300 — hover */
  --earth:       #C8A97A;   /* umber claro: ~8:1 contraste */
  --sage:        #1E1C18;   /* superficie más oscura */
  --muted:       #A39E93;   /* Warm Grey 400 */
  --stone-light: #625D52;   /* Warm Grey 600 */
  --border:      rgba(250,249,247,0.08);
  --border-dark: rgba(250,249,247,0.16);
}

[data-theme="dark"] #main-nav {
  background: rgba(26,23,20,0.94);
}

[data-theme="dark"] .nav-mobile {
  background: #1A1714;
}

[data-theme="dark"] footer {
  background: #0F0E0C;
}

[data-theme="dark"] .nav-hamburger span {
  background: var(--ink);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--warm-white);
  color: var(--ink);
  line-height: 1.6;
  font-weight: 300;
  transition: background 0.3s ease, color 0.3s ease;
  /* Las animaciones de entrada de GSAP arrancan con translateX(+-32px), que
     asoma fuera del viewport y genera scroll horizontal hasta que se disparan.
     Se usa clip y no hidden: hidden convierte al body en contenedor de scroll
     y rompe los position:sticky del portafolio y del panel. hidden queda como
     respaldo para navegadores sin soporte de clip. */
  overflow-x: hidden;
  overflow-x: clip;
}

/* ── NAV ── */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 56px;
  height: 72px;
  background: rgba(250,249,247,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  gap: 40px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
}

.nav-links a {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

.nav-cta {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 11px 26px;
  background: var(--forest);
  color: var(--warm-white);
  border-radius: var(--radius);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.15s;
  cursor: pointer;
}

.nav-cta:hover { background: var(--forest-light); transform: translateY(-1px); }

/* ── DARK MODE TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}

.theme-toggle:hover {
  color: var(--ink);
  background: var(--linen);
}

.theme-toggle svg { width: 16px; height: 16px; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ── SECTION LABEL ── */
.section-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--earth);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-label::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--earth);
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 16px 36px;
  background: var(--forest);
  color: var(--warm-white);
  border-radius: var(--radius);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.15s;
  cursor: pointer;
}

.btn-primary:hover { background: var(--forest-light); transform: translateY(-2px); }

.btn-secondary {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
  transition: color 0.2s, border-color 0.2s;
}

.btn-secondary:hover { color: var(--forest); border-color: var(--forest); }

/* ── FOOTER ── */
footer {
  background: var(--ink);
  padding: 72px 80px 48px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 36px;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: #FAF9F7;
}

.footer-brand p {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(250,249,247,0.72);
  font-weight: 400;
  margin-top: 12px;
  max-width: 360px;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-links a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(250,249,247,0.72);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--warm-white); }

.footer-social { display: flex; gap: 12px; }

.social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.social-link:hover {
  border-color: var(--earth);
  background: rgba(139,115,85,0.12);
}

.social-link svg { width: 18px; height: 18px; color: rgba(250,249,247,0.8); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(250,249,247,0.62);
}

/* ── HAMBURGER ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 110;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--charcoal);
  transition: transform 0.28s ease, opacity 0.2s ease;
  transform-origin: center;
}

/* X al abrir */
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Overlay oscuro */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,28,26,0.5);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-overlay.open { opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  #main-nav { padding: 0 32px; }
  footer { padding: 56px 40px 40px; }
}

/* ── HAMBURGER BUTTON ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.nav-hamburger:hover { background: var(--linen); }

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── MOBILE MENU PANEL ── */
.nav-mobile {
  display: none;
  position: fixed;
  top: 72px;
  left: 0; right: 0;
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px 40px;
  z-index: 99;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.25s ease;
}

.nav-mobile.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.nav-mobile-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 32px;
}

.nav-mobile-links li { border-bottom: 1px solid var(--border); }

.nav-mobile-links a {
  display: block;
  padding: 18px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-mobile-links a:hover { color: var(--forest); }

.nav-mobile-cta {
  display: block;
  text-align: center;
  padding: 16px;
  background: var(--forest);
  color: var(--warm-white);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s;
}

.nav-mobile-cta:hover { background: var(--forest-light); }

/* ── OVERLAY ── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,25,23,0.4);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.nav-overlay.open { opacity: 1; pointer-events: all; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-cta-desktop { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile { display: block; }
  .nav-overlay { display: block; }
  #main-nav { padding: 0 24px; }
  .theme-toggle { margin-left: auto; margin-right: 4px; }
  .footer-top { flex-direction: column; gap: 48px; }
  footer { padding: 48px 24px 36px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}
