/* Sistema compartido de las páginas interiores de kelp-labs.com.
   index.html mantiene sus estilos inline y de aquí usa el topnav y el patrón de FAQ. */

:root {
  --paper:      oklch(0.99 0.002 200);
  --ink:        oklch(0.24 0.045 195);
  --ink-deep:   oklch(0.16 0.032 195);
  --muted:      oklch(0.45 0.03 195);
  --kelp:       oklch(0.42 0.08 168);
  --amber:      oklch(0.62 0.14 70);
  --amber-deep: oklch(0.56 0.135 70);
  --highlight:      #1AB389; /* highlight de marca: botones y negritas sobre oscuro */
  --highlight-deep: #179C77;
  --hairline:   oklch(0.9 0.01 195);
  --surface:    oklch(0.958 0.005 190);
  --mint:       oklch(0.84 0.09 172);
  --crema:      oklch(0.973 0.007 80);
  --crema-line: oklch(0.905 0.018 80);
  --elev: 0 2px 6px oklch(0.24 0.045 195 / 0.05), 0 26px 60px -28px oklch(0.24 0.045 195 / 0.22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: clip; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.02em; }
p { max-width: 70ch; }
:focus-visible { outline: 2px solid var(--kelp); outline-offset: 3px; border-radius: 2px; }

.container { max-width: 1180px; margin-inline: auto; padding-inline: clamp(1.25rem, 4.5vw, 3rem); }

/* Titular de sección solo para lectores de pantalla y buscadores: da jerarquía
   a secciones que visualmente no llevan título, sin tocar el diseño. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 0 0 6px 0;
}
.skip:focus { left: 0; }

/* ---- Secciones + armazón (raíles/cruces los inyecta site.js) ---- */
main > section { border-bottom: 1px solid var(--hairline); position: relative; }
section[id] { scroll-margin-top: 4.5rem; }
footer { position: relative; }
.section-pad { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-title { font-size: clamp(1.7rem, 1.1rem + 1.9vw, 2.5rem); font-weight: 600; line-height: 1.15; max-width: 24em; }

.rail {
  position: absolute; inset: 0; margin-inline: auto;
  width: 1180px; /* = max-width de .container */
  pointer-events: none; border-inline: 1px solid var(--hairline); z-index: 40;
}
.cruz {
  position: absolute; top: 0; left: var(--cruz-x); width: 15px; height: 15px;
  translate: -50% -50%; z-index: 45; pointer-events: none;
  color: oklch(0.45 0.03 195 / 0.55);
  background: linear-gradient(currentColor 0 0) center / 15px 1.5px no-repeat,
              linear-gradient(currentColor 0 0) center / 1.5px 15px no-repeat;
}
@media (max-width: 1260px) { .rail, .cruz { display: none; } }

/* ---- Highlight de negritas (mismo gesto que la home) ---- */
.hl-kelp {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--highlight);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.1em;
  text-decoration-skip-ink: none;
}

/* ---- Botones ---- */
.btn {
  display: inline-block; font-family: inherit; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none; color: var(--ink-deep); background: var(--highlight); border: none; border-radius: 6px;
  padding: 0.95rem 1.9rem; cursor: pointer;
  transition: background-color 160ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.btn:hover {
  background: var(--highlight-deep);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px #1AB38999;
}
.btn:active { transform: translateY(0); box-shadow: 0 3px 10px -6px #1AB38980; }

/* ============ Topnav (compartida por todas las páginas) ============ */
.topnav {
  position: sticky; top: 0; z-index: 20;
  background: oklch(0.99 0.002 200 / 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topnav-inner { display: flex; align-items: center; gap: 1rem; padding-block: 0.65rem; }
.wordmark { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.topnav .wordmark { margin-right: 0.75rem; }

.topnav-menu ul { display: flex; align-items: center; gap: 0.15rem; list-style: none; }
.topnav-menu li { position: relative; }
.tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.9375rem; font-weight: 500; color: var(--ink); text-decoration: none;
  padding: 0.45rem 0.85rem; border-radius: 999px;
  transition: background-color 140ms ease;
}
.tab:hover { background: var(--surface); }
.tab[aria-current="page"], .tab[data-section] {
  font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--highlight);
  text-decoration-thickness: 0.13em; text-underline-offset: 0.4em;
}
.chev { width: 10px; height: 10px; flex: none; opacity: 0.55; transition: transform 160ms ease; }
.has-menu:hover .chev, .has-menu:focus-within .chev { transform: rotate(180deg); }

.menu {
  position: absolute; top: 100%; left: 0; min-width: 320px; padding-top: 10px; z-index: 30;
  opacity: 0; visibility: hidden; translate: 0 6px;
  transition: opacity 160ms ease, translate 160ms ease, visibility 0s linear 160ms;
}
.has-menu:hover .menu, .has-menu:focus-within .menu {
  opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0s;
}
.menu-card {
  background: oklch(1 0 0); border: 1px solid var(--hairline); border-radius: 14px;
  box-shadow: var(--elev); padding: 0.5rem;
}
.menu-card a { display: grid; grid-template-columns: 20px 1fr; column-gap: 0.8rem;
                padding: 0.7rem 0.85rem; border-radius: 9px; text-decoration: none; }
.menu-card .ic { grid-row: 1 / span 2; align-self: start; margin-top: 2px; width: 20px; height: 20px; color: var(--kelp); }
.menu-card .ic svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor;
                     stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.menu-card a:hover { background: var(--surface); }
.menu-card a[aria-current="page"] { position: relative; background: oklch(0.42 0.08 168 / 0.07); }
.menu-card a[aria-current="page"] strong { color: var(--kelp); }
.menu-card a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
                                            width: 3px; border-radius: 999px; background: var(--kelp); }
.menu-card strong { display: block; font-size: 0.9375rem; font-weight: 600; color: var(--ink-deep); letter-spacing: -0.01em; }
.menu-card span { display: block; margin-top: 0.2rem; font-size: 0.8125rem; font-weight: 400; color: oklch(0.55 0.025 195); line-height: 1.4; white-space: nowrap; }

.nav-cta {
  margin-left: auto; font-size: 0.9375rem; font-weight: 600; text-decoration: none;
  color: var(--ink-deep); background: var(--highlight); padding: 0.6rem 1.15rem; border-radius: 6px; white-space: nowrap;
  transition: background-color 160ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.nav-cta:hover {
  background: var(--highlight-deep);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px #1AB38999;
}

.mobile-menu { display: none; }
@media (max-width: 960px) {
  .topnav-menu { display: none; }
  .mobile-menu { display: block; position: relative; margin-left: auto; }
  .nav-cta { margin-left: 0; }
  .mobile-menu summary {
    list-style: none; cursor: pointer; font-size: 0.9375rem; font-weight: 500;
    padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--hairline);
  }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu[open] summary { background: var(--surface); }
  .mm-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 230px;
    background: oklch(1 0 0); border: 1px solid var(--hairline); border-radius: 12px;
    box-shadow: var(--elev); padding: 0.5rem;
  }
  .mm-panel a { display: block; padding: 0.6rem 0.85rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
  .mm-panel a:hover { background: var(--surface); }
}
/* a 320 la cabecera (marca + Menú + CTA) se pasa por 3px */
@media (max-width: 400px) {
  .nav-cta { font-size: 0.875rem; padding-inline: 0.85rem; }
  .mobile-menu summary { padding-inline: 0.7rem; }
  .topnav-inner { gap: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .menu, .chev, .btn, .nav-cta, .tab { transition: none; }
}

/* ============ Primitivas de página interior ============ */
.page-hero { padding-block: clamp(3.5rem, 7vw, 5.5rem) clamp(3rem, 6vw, 4.5rem); }
.page-hero h1 {
  font-size: clamp(2.2rem, 1.4rem + 2.7vw, 3.4rem);
  font-weight: 600; line-height: 1.12; letter-spacing: -0.025em; max-width: 22ch;
}
.page-hero .lede { margin-top: 1.5rem; font-size: 1.1875rem; line-height: 1.62; max-width: 54ch; }

/* Entrada del hero al aterrizar en la página */
@media (prefers-reduced-motion: no-preference) {
  .page-hero .container > * { animation: hero-in 1s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .page-hero .container > *:nth-child(2) { animation-delay: 0.18s; }
  .page-hero .container > *:nth-child(3) { animation-delay: 0.34s; }
  .page-hero .container > *:nth-child(4) { animation-delay: 0.5s; }
  .page-hero + section > .container { animation: hero-in 1.15s cubic-bezier(0.22, 0.61, 0.36, 1) 0.32s both; }
}
@keyframes hero-in { from { opacity: 0; translate: 0 16px; } }

.prose { max-width: 60ch; }
.prose p { margin-top: 1.1rem; font-size: 1.0625rem; line-height: 1.65; }
.prose p:first-child { margin-top: 1.4rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; margin-top: 2.5rem; }
.card { background: oklch(1 0 0); border: 1px solid var(--hairline); border-radius: 7px; padding: 1.5rem 1.4rem; }
.card h3 { font-size: 1.0625rem; font-weight: 600; }
.card p { margin-top: 0.6rem; font-size: 0.9375rem; line-height: 1.55; color: var(--muted); }

/* card-enlace: la card entera navega (hubs → subpáginas) */
a.card { display: block; color: inherit; text-decoration: none; transition: border-color 160ms ease, transform 180ms ease, box-shadow 180ms ease; }
a.card:hover { border-color: oklch(0.78 0.03 190); transform: translateY(-2px); box-shadow: var(--elev); }
.card-more { display: block; margin-top: 0.9rem; font-size: 0.9375rem; font-weight: 500; color: var(--kelp); }
a.card:hover .card-more { text-decoration: underline; text-underline-offset: 4px; }

.cierre-lite { text-align: center; }
.cierre-lite .section-title { margin-inline: auto; }
.cierre-lite p { margin: 1.1rem auto 0; max-width: 44ch; }
.cierre-lite .btn { margin-top: 2.25rem; }

/* ============ Footer ============ */
footer { padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.75rem; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: clamp(2rem, 5vw, 4rem); flex-wrap: wrap; }
.footer-marca .wordmark { font-size: 1.25rem; }
.footer-sub { margin-top: 0.6rem; font-size: 0.9375rem; color: var(--muted); max-width: 34ch; }
.footer-nav, .footer-contacto { display: flex; flex-direction: column; gap: 0.55rem; }
.footer-nav a, .footer-contacto a { font-size: 0.9375rem; color: var(--ink); text-decoration: none; }
.footer-nav a:hover, .footer-contacto a:hover { text-decoration: underline; text-underline-offset: 4px; }
/* en tactil los enlaces del pie median 24px de alto: se suben a 44 */
@media (max-width: 640px) {
  .footer-nav, .footer-contacto { gap: 0; }
  .footer-nav a, .footer-contacto a { padding-block: 0.63rem; }
}
.footer-legal {
  margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.25rem; border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: 0.875rem; color: var(--muted);
}
.footer-legal a { color: inherit; text-underline-offset: 4px; }

/* ============ Preguntas (FAQ) — mismo patrón en la home y en las interiores ============ */
.faq-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(2.5rem, 6vw, 5rem); align-items: start; }
.faq-head .section-title { max-width: 14ch; }
.faq-lede { margin-top: 1.2rem; font-size: 1.0625rem; line-height: 1.6; color: var(--muted); max-width: 38ch; }
.faq-list { interpolate-size: allow-keywords; }
.faq-list details { border-bottom: 1px solid var(--hairline); }
.faq-list details:first-child { border-top: 1px solid var(--hairline); }
.faq-list summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem;
  padding: 1.35rem 0.25rem; cursor: pointer; list-style: none;
  font-size: 1.125rem; font-weight: 600; line-height: 1.35;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary:hover { color: var(--kelp); }
.faq-mark { flex: none; position: relative; width: 14px; height: 14px; align-self: center; transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1); }
.faq-mark::before, .faq-mark::after {
  content: ""; position: absolute; background: currentColor; border-radius: 2px;
}
.faq-mark::before { left: 0; right: 0; top: 6px; height: 1.5px; }
.faq-mark::after { top: 0; bottom: 0; left: 6px; width: 1.5px; }
.faq-list details[open] .faq-mark { transform: rotate(45deg); }
.faq-list details::details-content {
  height: 0; overflow: clip;
  transition: height 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), content-visibility 0.45s allow-discrete;
}
.faq-list details[open]::details-content { height: auto; }
.faq-a { padding: 0.15rem 0.25rem 1.5rem; font-size: 1.0625rem; line-height: 1.62; color: var(--muted); max-width: 58ch; }
.faq-a a { color: var(--kelp); font-weight: 600; text-underline-offset: 3px; }
@media (max-width: 900px) {
  .faq-grid { grid-template-columns: 1fr; }
}
