/* brand.css — sistema visual Lemus Digital v3 («De la idea a la producción»).
 *
 * Base compartida por la portada, el blog y las páginas sueltas: tokens, Figtree local,
 * header, menú móvil, botones, footer y conmutador ES/EN. Tema claro único: no hay
 * selector dark público (el dark del paquete de diseño es solo una propuesta).
 *
 * CACHÉ: firebase.json sirve el CSS como immutable 1 año. Al cambiar este archivo hay
 * que subir el ?v= en TODAS las páginas que lo enlazan (grep -r "brand.css?v=").
 */
@font-face {
  font-family: Figtree;
  src: url('/fonts/Figtree-latin-variable.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ld-font-sans: Figtree, Arial, sans-serif;
  --ld-font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

  --ld-background: #F5F1E8;
  --ld-surface: #FFFFFF;
  --ld-surface-muted: #E6E2D9;
  --ld-foreground: #202A30;
  --ld-text-secondary: #566169;
  --ld-text-muted: #626B70;
  --ld-border: #CBC9C1;
  --ld-border-control: #7B807F;
  --ld-primary: #202A30;
  --ld-primary-hover: #354650;
  --ld-primary-active: #152027;
  --ld-on-primary: #F5F1E8;
  --ld-accent: #53788C;
  --ld-accent-ink: #3B5E72;
  --ld-accent-soft: #DFE8EB;
  --ld-focus: #3B5E72;
  --ld-success: #176548;
  --ld-success-soft: #E4F1EC;
  --ld-danger: #A8201A;
  --ld-danger-soft: #F9E3E1;
  --ld-overlay: #202A3099;

  --ld-radius-control: 3px;
  --ld-radius-panel: 8px;
  --ld-radius-dialog: 12px;
  --ld-content-max: 1280px;
  --ld-gutter: 48px;
  --ld-control-height: 44px;
  --ld-duration: 160ms;

  color-scheme: light;
}
@media (max-width: 950px) { :root { --ld-gutter: 28px; } }
@media (max-width: 680px) { :root { --ld-gutter: 22px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ld-background);
  color: var(--ld-foreground);
  font: 400 16px/1.55 var(--ld-font-sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
button, a, summary { touch-action: manipulation; }
::selection { background: var(--ld-accent); color: #fff; }
:is(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--ld-focus);
  outline-offset: 4px;
}

/* ========== i18n TOGGLE ========== */
/* html[lang] lo fija el bootstrap del <head> antes del primer render. */
html[lang="es"] [data-lang="en"],
html[lang="en"] [data-lang="es"] { display: none !important; }

/* ========== LAYOUT ========== */
.ld-wrap { width: min(var(--ld-content-max), 100%); padding: 0 var(--ld-gutter); margin: 0 auto; }

.ld-skip {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  background: var(--ld-primary); color: var(--ld-on-primary);
  padding: 12px 18px; border-radius: var(--ld-radius-control);
  font-weight: 600; text-decoration: none;
}
.ld-skip:focus { top: 12px; }

.ld-eyebrow {
  font: 400 11px/18px var(--ld-font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* ========== BOTONES ========== */
.ld-button {
  min-height: var(--ld-control-height);
  display: inline-flex; align-items: center; justify-content: center; gap: 20px;
  padding: 12px 21px;
  border: 1px solid var(--ld-primary);
  border-radius: var(--ld-radius-control);
  font: 600 14px/20px var(--ld-font-sans);
  background: var(--ld-primary); color: var(--ld-on-primary);
  text-decoration: none; cursor: pointer;
  transition: background var(--ld-duration), border-color var(--ld-duration);
}
.ld-button:hover { background: var(--ld-primary-hover); border-color: var(--ld-primary-hover); }
.ld-button:active { background: var(--ld-primary-active); }
.ld-button:disabled { opacity: .45; cursor: not-allowed; }
.ld-button--light { background: var(--ld-background); color: var(--ld-foreground); border-color: var(--ld-background); }
.ld-button--light:hover { background: #fff; border-color: #fff; }
.ld-button--outline { background: transparent; color: var(--ld-foreground); border-color: var(--ld-border-control); }
.ld-button--outline:hover { background: var(--ld-surface-muted); border-color: var(--ld-foreground); }
.ld-button svg { width: 18px; height: 18px; flex: none; }
[class~="ld-textlink"] svg { width: 16px; height: 16px; vertical-align: -3px; margin-left: 6px; }
.ld-textlink { font-size: 14px; text-underline-offset: 6px; color: var(--ld-accent-ink); font-weight: 600; }

/* ========== HEADER ========== */
.ld-header { position: sticky; top: 0; z-index: 50; background: var(--ld-background); box-shadow: 0 1px 0 var(--ld-border); }
.ld-nav { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.ld-brand { display: inline-flex; align-items: center; flex: none; }
.ld-brand img { display: block; width: 195px; height: auto; }
.ld-nav-links { display: flex; gap: 32px; font-size: 14px; font-weight: 500; }
.ld-nav-links a { text-decoration: none; padding: 8px 0; }
.ld-nav-links a:hover, .ld-nav-links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
.ld-nav-cta { display: flex; align-items: center; gap: 20px; }
.ld-nav-cta .ld-button { padding: 10px 19px; }

.ld-lang { display: inline-flex; align-items: center; font: 500 12px/1 var(--ld-font-mono); letter-spacing: .08em; }
.ld-lang button {
  min-width: 36px; min-height: 36px; padding: 0 6px;
  border: 0; background: none; cursor: pointer;
  color: var(--ld-text-secondary);
}
.ld-lang button[aria-current="page"] { color: var(--ld-foreground); font-weight: 700; text-decoration: underline; text-underline-offset: 6px; }
.ld-lang .ld-sep { color: var(--ld-border-control); }

.ld-menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: none; border: 1px solid var(--ld-border-control); border-radius: var(--ld-radius-control);
  cursor: pointer;
}
.ld-menu-toggle svg { width: 22px; height: 22px; }
.ld-menu-toggle .ld-i-close { display: none; }
.ld-header.menu-open .ld-menu-toggle .ld-i-open { display: none; }
.ld-header.menu-open .ld-menu-toggle .ld-i-close { display: block; }

@media (max-width: 950px) {
  .ld-nav { min-height: 84px; gap: 16px; flex-wrap: wrap; }
  .ld-brand img { width: 165px; }
  .ld-menu-toggle { display: inline-flex; }
  .ld-nav-cta .ld-button { display: none; }
  .ld-nav-links {
    display: none; order: 3; width: 100%;
    flex-direction: column; gap: 0;
    border-top: 1px solid var(--ld-border); padding: 8px 0 20px;
  }
  .ld-nav-links a { padding: 14px 0; font-size: 17px; border-bottom: 1px solid var(--ld-border); }
  .ld-header.menu-open .ld-nav-links { display: flex; max-height: calc(100vh - 120px); overflow-y: auto; }
  .ld-nav-links .ld-nav-cta-item { display: inline-flex; margin-top: 18px; border: 0; }
}
@media (min-width: 951px) { .ld-nav-links .ld-nav-cta-item { display: none; } }

/* Variante para páginas con más enlaces propios (p. ej. /automatizacion). */
.ld-nav-links--dense { gap: 22px; font-size: 13.5px; }
@media (max-width: 1180px) and (min-width: 951px) { .ld-nav-links--dense { gap: 14px; font-size: 13px; } .ld-brand img { width: 165px; } }

/* ========== FOOTER ========== */
.ld-footer { background: var(--ld-foreground); color: var(--ld-background); }
.ld-footer a { text-underline-offset: 4px; }
/* #3B5E72 sobre grafito da ~2.1:1; el anillo de foco necesita >= 3:1 */
.ld-footer :is(a, button):focus-visible { outline-color: #F5F1E8; }
.ld-footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px;
  padding-top: 64px; padding-bottom: 40px;
}
.ld-footer-brand img { display: block; width: 190px; height: auto; margin-bottom: 20px; }
.ld-footer p { margin: 0 0 6px; font-size: 14px; color: #D4D8D9; line-height: 1.6; }
.ld-footer h3 { margin: 0 0 14px; font: 400 11px/18px var(--ld-font-mono); letter-spacing: .16em; text-transform: uppercase; color: #D4D0C6; }
.ld-footer ul { list-style: none; margin: 0; padding: 0; }
.ld-footer li { margin-bottom: 6px; }
.ld-footer li a, .ld-footer p a { font-size: 14px; color: #F5F1E8; }
.ld-footer-legal {
  border-top: 1px solid #48555C; padding-top: 22px; padding-bottom: 28px;
  display: flex; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap;
  font-size: 13px; color: #D4D8D9;
}
.ld-footer-legal a { color: #F5F1E8; }
@media (max-width: 950px) { .ld-footer-grid { grid-template-columns: 1fr 1fr; } .ld-footer-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .ld-footer-grid { grid-template-columns: 1fr; padding-top: 48px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ld-button { transition: none; }
}
