/* Punto Legal — Estudio Jurídico
   Paleta y tipografía según Manual de Marca v1.0
   Incluye tema claro/oscuro y animaciones sutiles. */

@view-transition {
  navigation: auto;
}

:root {
  color-scheme: light dark;

  /* Colores de marca (fijos, no cambian con el tema) */
  --petroleo: #0B4A53;
  --azul: #0B2545;
  --teal: #0AA29B;
  --teal-claro: #DDEFEF;
  --blanco: #FFFFFF;

  /* Roles semánticos — tema claro (por defecto) */
  --bg: #FFFFFF;
  --panel-bg: #FFFFFF;
  --panel-body: #FAFDFD;
  --surface: var(--teal-claro);
  --surface-muted: #F4F4F4;
  --heading: var(--petroleo);
  --text: var(--azul);
  --text-muted: #4A5A5C;
  --text-faint: #8A8F8F;
  --border: #E3ECEC;
  --header-bg: rgba(255, 255, 255, 0.92);

  --font: Arial, "Helvetica Neue", Helvetica, "Open Sans", Inter, sans-serif;

  --radius: 10px;
  --shadow: 0 8px 24px rgba(11, 37, 69, 0.08);
  --header-h: 76px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081C20;
    --panel-bg: #0F2A2F;
    --panel-body: #0A2226;
    --surface: #113238;
    --surface-muted: #16383D;
    --heading: #EEF9F8;
    --text: #D3E6E4;
    --text-muted: #A9C6C3;
    --text-faint: #7FA3A1;
    --border: rgba(238, 249, 248, 0.12);
    --header-bg: rgba(10, 34, 38, 0.85);
  }
}

:root[data-theme="dark"] {
  --bg: #081C20;
  --panel-bg: #0F2A2F;
  --panel-body: #0A2226;
  --surface: #113238;
  --surface-muted: #16383D;
  --heading: #EEF9F8;
  --text: #D3E6E4;
  --text-muted: #A9C6C3;
  --text-faint: #7FA3A1;
  --border: rgba(238, 249, 248, 0.12);
  --header-bg: rgba(10, 34, 38, 0.85);
}

:root[data-theme="light"] {
  --bg: #FFFFFF;
  --panel-bg: #FFFFFF;
  --panel-body: #FAFDFD;
  --surface: var(--teal-claro);
  --surface-muted: #F4F4F4;
  --heading: var(--petroleo);
  --text: var(--azul);
  --text-muted: #4A5A5C;
  --text-faint: #8A8F8F;
  --border: #E3ECEC;
  --header-bg: rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4 { color: var(--heading); font-weight: 700; margin: 0 0 .5em; line-height: 1.25; transition: color .35s ease; }
h1 { font-size: clamp(1.9rem, 3.2vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--text-muted); transition: color .35s ease; }
a { color: inherit; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-block;
  color: var(--teal);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .78rem;
  margin-bottom: .6em;
}

.rule {
  width: 56px;
  height: 3px;
  background: var(--teal);
  border: none;
  margin: 0 0 1.5em;
  border-radius: 2px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { display: block; flex-shrink: 0; }

.btn-whatsapp {
  background: var(--teal);
  color: var(--blanco);
  box-shadow: 0 6px 18px rgba(10, 162, 155, .3);
}
.btn-whatsapp:hover { background: #08948e; box-shadow: 0 10px 22px rgba(10, 162, 155, .38); }

.btn-outline {
  background: transparent;
  border-color: var(--blanco);
  color: var(--blanco);
}
.btn-outline:hover { background: rgba(255,255,255,.12); }

.btn-outline-petroleo {
  background: transparent;
  border-color: var(--heading);
  color: var(--heading);
}
.btn-outline-petroleo:hover { background: var(--surface); }

.btn-block { width: 100%; justify-content: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  transition: background-color .35s ease, border-color .35s ease, box-shadow .25s ease;
}
.site-header.scrolled { box-shadow: 0 6px 20px rgba(11, 37, 69, .08); }
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.logo-mark {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: transform .25s ease;
}
.logo-mark svg { width: 100%; height: 100%; display: block; }
.site-header.scrolled .logo-mark { transform: scale(.9); }
.logo-divider { width: 1px; height: 36px; background: var(--border); }
.logo-text { line-height: 1.15; }
.logo-name { display: block; font-weight: 700; color: var(--heading); font-size: 1.37rem; letter-spacing: .01em; transition: color .35s ease; }
.logo-desc { display: block; font-size: .81rem; font-weight: 700; letter-spacing: .12em; color: var(--text-muted); transition: color .35s ease; }

.header-right { display: flex; align-items: center; gap: 18px; }

.main-nav { display: flex; align-items: center; gap: 32px; }
.main-nav ul { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0; }
.main-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  padding: 6px 10px;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--teal); }

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--heading);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .3s ease;
}
.theme-toggle:hover { background: var(--surface); transform: rotate(18deg); }
.theme-toggle svg { width: 19px; height: 19px; }

.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 40px; height: 40px;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--heading); border-radius: 2px; transition: background-color .35s ease; }

/* ---------- Hero (siempre sobre petróleo: fijo en ambos temas) ---------- */
.hero {
  background: var(--petroleo);
  color: var(--blanco);
  padding: 88px 0 80px;
  overflow: hidden;
}
.hero-inner { max-width: 680px; }
.hero h1 { color: var(--blanco); }
.hero p.lead { color: #CFE3E3; font-size: 1.1rem; max-width: 560px; }
.hero .actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 2em; }

.hero .eyebrow { animation: fadeInUp .6s ease both; }
.hero h1 { animation: fadeInUp .7s ease .08s both; }
.hero p.lead { animation: fadeInUp .7s ease .16s both; }
.hero .actions { animation: fadeInUp .7s ease .24s both; }

.page-hero {
  background: var(--petroleo);
  color: var(--blanco);
  padding: 64px 0;
}
.page-hero h1 { color: var(--blanco); margin-bottom: .3em; }
.page-hero p { color: #CFE3E3; max-width: 620px; margin: 0; }
.page-hero .eyebrow { animation: fadeInUp .6s ease both; }
.page-hero h1 { animation: fadeInUp .7s ease .08s both; }
.page-hero p { animation: fadeInUp .7s ease .16s both; }

/* ---------- Secciones ---------- */
section { padding: 72px 0; }
.section-alt { background: var(--surface); transition: background-color .35s ease; }
.section-head { max-width: 640px; margin: 0 auto 2.5em; text-align: center; }
.section-head .rule { margin-left: auto; margin-right: auto; }

/* ---------- Cards de áreas ---------- */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.area-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  transition: background-color .35s ease, transform .25s ease, box-shadow .25s ease;
}
.area-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.area-card .area-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--petroleo);
  margin-bottom: 18px;
}
.area-card h3 { margin-bottom: .5em; }
.area-card p { flex-grow: 1; }
.area-card a.btn { margin-top: 1em; align-self: flex-start; }

.area-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  margin-bottom: 28px;
  scroll-margin-top: 96px;
  transition: border-color .35s ease, transform .25s ease, box-shadow .25s ease;
}
.area-detail:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.area-detail .area-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--petroleo);
  margin-bottom: 16px;
}
.area-detail ul { color: var(--text-muted); padding-left: 1.2em; margin: 1em 0; }
.area-detail li { margin-bottom: .4em; }

/* ---------- Valores (somos / no somos) ---------- */
.values-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.values-col { padding: 28px; border-radius: var(--radius); transition: background-color .35s ease; }
.values-col.somos { background: var(--surface); }
.values-col.no-somos { background: var(--surface-muted); }
.values-col h4 { margin-bottom: .8em; }
.values-col ul { list-style: none; padding: 0; margin: 0; }
.values-col li { padding: 6px 0; border-bottom: 1px solid rgba(128,128,128,.15); }
.values-col.somos li { color: var(--heading); font-weight: 600; }
.values-col.no-somos li { color: var(--text-faint); }

/* ---------- Equipo ---------- */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.team-card { text-align: center; }
.team-photo {
  width: 128px; height: 128px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--heading);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.6rem;
  margin: 0 auto 16px;
  transition: background-color .35s ease, transform .25s ease;
}
.team-card:hover .team-photo { transform: scale(1.05); }
.team-card h4 { margin-bottom: .2em; color: var(--text); }
.team-role { color: var(--teal); font-weight: 700; font-size: .85rem; margin-bottom: .4em; }

/* ---------- Contacto ---------- */
.contact-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: start; }
.contact-info-card {
  background: var(--petroleo);
  color: var(--blanco);
  border-radius: var(--radius);
  padding: 36px;
}
.contact-info-card h3 { color: var(--blanco); }
.contact-list { list-style: none; padding: 0; margin: 1.2em 0 0; }
.contact-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.15); color: #CFE3E3; }
.contact-list li strong { color: var(--blanco); min-width: 90px; display: inline-block; }

.faq-shortcut {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color .35s ease, transform .25s ease, box-shadow .25s ease;
}
.faq-shortcut:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.faq-shortcut button.btn { margin-top: .5em; }

/* ---------- Footer (siempre sobre azul: fijo en ambos temas) ---------- */
.site-footer { background: var(--petroleo); color: #CFE3E3; padding: 56px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand .logo-name { color: var(--blanco); }
.footer-brand .logo-desc { color: #A9CFCC; }
.footer-brand p { color: #BEE0DD; max-width: 320px; margin-top: 14px; }
.footer-col h4 { color: var(--blanco); font-size: .95rem; margin-bottom: 1em; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #CFE3E3; text-decoration: none; font-size: .92rem; transition: color .2s ease; }
.footer-col a:hover { color: var(--teal-claro); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 24px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: .82rem; color: #8FBAB6;
}

/* ---------- Barra de progreso de scroll ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--petroleo));
  z-index: 300;
  transition: width .12s linear;
}

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--blanco);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(10,162,155,.4);
  z-index: 200;
  text-decoration: none;
  animation: floatIn .5s ease .4s both, waPulse 4.5s ease-out 1.4s infinite;
}
.wa-float:hover { transform: scale(1.08); animation-play-state: paused; }
.wa-float svg { width: 30px; height: 30px; }

/* ---------- Chatbot widget ---------- */
.chat-toggle {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--petroleo);
  color: var(--blanco);
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(11,74,83,.4);
  z-index: 200;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.4rem;
  animation: floatIn .5s ease .5s both;
  transition: transform .15s ease;
}
.chat-toggle:hover { transform: scale(1.08); }
.chat-toggle svg { width: 48px; height: 48px; display: block; }

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 168px;
  width: 340px;
  max-width: calc(100vw - 44px);
  max-height: min(480px, calc(100vh - 210px));
  background: var(--panel-bg);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(11,37,69,.25);
  z-index: 210;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease, visibility .22s, background-color .35s ease, border-color .35s ease;
}
.chat-panel.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }

.chat-head {
  background: var(--petroleo);
  color: var(--blanco);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.chat-head .logo-mark { width: 44px; height: 44px; }
.chat-head strong { display: block; font-size: .95rem; }
.chat-head span { display: block; font-size: .74rem; color: #CFE3E3; }
.chat-close {
  margin-left: auto; background: none; border: none; color: var(--blanco);
  font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 4px;
}

.chat-body { padding: 18px; overflow-y: auto; flex-grow: 1; background: var(--panel-body); transition: background-color .35s ease; }
.chat-msg {
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px 12px 12px 2px;
  font-size: .9rem;
  margin-bottom: 12px;
  max-width: 92%;
  animation: fadeInUp .35s ease both;
}
.chat-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.chat-option {
  background: var(--panel-bg);
  border: 1.5px solid var(--teal);
  color: var(--heading);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: .87rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
  animation: fadeInUp .3s ease both;
}
.chat-option:hover { background: var(--surface); transform: translateX(2px); }
.chat-cta { display: flex; animation: fadeInUp .35s ease both; }

/* ---------- Animaciones ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px) scale(.85); }
  to { opacity: 1; transform: none; }
}

@keyframes waPulse {
  0% { box-shadow: 0 10px 26px rgba(10,162,155,.4), 0 0 0 0 rgba(10,162,155,.45); }
  70% { box-shadow: 0 10px 26px rgba(10,162,155,.4), 0 0 0 16px rgba(10,162,155,0); }
  100% { box-shadow: 0 10px 26px rgba(10,162,155,.4), 0 0 0 0 rgba(10,162,155,0); }
}

/* Aparición al hacer scroll */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Stagger sutil para grupos de cards */
.areas-grid .area-card:nth-child(2).reveal { transition-delay: .1s; }
.areas-grid .area-card:nth-child(3).reveal { transition-delay: .2s; }
.team-grid .team-card:nth-child(2).reveal { transition-delay: .1s; }
.team-grid .team-card:nth-child(3).reveal { transition-delay: .2s; }
.values-grid .values-col:nth-child(2).reveal { transition-delay: .1s; }
.area-detail.reveal:nth-of-type(2) { transition-delay: .1s; }
.area-detail.reveal:nth-of-type(3) { transition-delay: .2s; }

/* Transición nativa entre páginas (View Transitions API) */
::view-transition-old(root) {
  animation: pl-page-out .32s cubic-bezier(.4,0,.2,1) both;
}
::view-transition-new(root) {
  animation: pl-page-in .38s cubic-bezier(.2,0,.2,1) both;
}
@keyframes pl-page-out {
  to { opacity: 0; transform: translateY(-10px); }
}
@keyframes pl-page-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* ---------- Accesibilidad: respetar reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero .eyebrow, .hero h1, .hero p.lead, .hero .actions,
  .page-hero .eyebrow, .page-hero h1, .page-hero p,
  .wa-float, .chat-toggle, .chat-msg, .chat-option, .chat-cta {
    animation: none !important;
  }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
  * { transition-duration: .001ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .main-nav ul { display: none; }
  .main-nav .btn-whatsapp { display: none; }
  .nav-toggle { display: flex; }
  .areas-grid, .team-grid { grid-template-columns: 1fr; }
  .values-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 158px; }
  .wa-float, .chat-toggle { right: 14px; }
}

/* Menú móvil abierto */
.main-nav.mobile-open {
  display: flex;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  padding: 20px 24px 28px;
  box-shadow: var(--shadow);
  animation: fadeInUp .25s ease both;
}
.main-nav.mobile-open ul { display: flex; flex-direction: column; gap: 4px; }
.main-nav.mobile-open .btn-whatsapp { display: inline-flex; margin-top: 16px; }
