/*
  shared/site-header.css
  Estilos canónicos del header del Sistema B.
  Fuente: extraído de home2/home2.css.
  Cargado por todas las páginas secundarias Sistema B.
  NO lo carga home2v2 (lo hereda de home2.css directamente).
*/

/* ══════════════════════════════════════════════
   VARIABLES BASE (idénticas a home2.css)
   Scoped to .site-header to avoid collision with
   page-level CSS that uses resolved hsl() values.
   ══════════════════════════════════════════════ */

.site-header {
  --foreground: 240 10% 12%;
  --primary: 250 85% 60%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 18% 95.8%;
  --muted-foreground: 240 4% 46%;
  --border: 240 6% 88%;
  --shell-bar-bg: hsla(243, 26%, 87%, 0.96);
}

[data-theme="dark"] .site-header {
  --foreground: 220 15% 92%;
  --primary: 252 80% 68%;
  --primary-foreground: 0 0% 100%;
  --secondary: 240 8% 16%;
  --muted-foreground: 240 5% 58%;
  --border: 240 6% 22%;
  --shell-bar-bg: hsla(243, 20%, 12%, 0.96);
}

/* Accessible skip link injected by shared/site-header.js */
.skip-link {
  position: fixed;
  left: 0.8rem;
  top: -3rem;
  z-index: 120;
  padding: 0.58rem 0.82rem;
  border-radius: 0.58rem;
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  font-size: 0.8rem;
  font-weight: 620;
  line-height: 1;
  text-decoration: none;
  transition: top 0.14s ease;
}
.skip-link:focus { top: 0.8rem; }


/* Keep header dropdown geometry inside its panel */
.site-header,
.site-header *,
.site-header *::before,
.site-header *::after {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════ */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 70;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  border-bottom: 1px solid hsl(250 18% 78% / 0.95);
  background: var(--shell-bar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px hsl(250 30% 20% / 0.08), 0 1px 0 hsl(0 0% 100% / 0.55) inset;
}

.site-header * {
  text-rendering: inherit;
  -webkit-font-smoothing: inherit;
}

[data-theme="dark"] .site-header {
  border-bottom-color: hsl(250 15% 18% / 0.38);
  box-shadow: 0 8px 24px hsl(240 30% 4% / 0.32);
}

.brand-row {
  max-width: 42rem;
  margin: 0 auto;
  height: 4.2rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
}

.brand-icon { width: 3.5rem; height: 3.5rem; flex-shrink: 0; }
.mark-body { fill: hsl(var(--foreground)); }
.mark-diamond { fill: var(--shell-bar-bg); }

.brand-title {
  font-family: "Crimson Pro", serif;
  font-size: 1.752rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  text-transform: lowercase;
  color: hsl(var(--foreground));
}
.brand-title .wm-d { font-weight: 300; opacity: 0.42; }

.header-controls { display: inline-flex; align-items: center; gap: 0; }

.header-btn {
  width: 2.16rem; height: 2.16rem;
  border-radius: 0.72rem;
  color: hsl(var(--muted-foreground));
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.14s ease;
  background: none; border: none; cursor: pointer;
}
.header-btn:hover { color: hsl(var(--foreground)); }

/* ══════════════════════════════════════════════
   LANG SWITCH (pill ES·EN)
   ══════════════════════════════════════════════ */

.lang-switch-v2 {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.24rem 0.52rem;
  border-radius: 999px;
  border: 1px solid hsl(240 6% 88%);
  background: transparent;
  transition: background 0.14s ease;
}
[data-theme="dark"] .lang-switch-v2 {
  border-color: hsl(240 6% 22%);
}
.lang-switch-v2:hover {
  background: hsl(var(--secondary) / 0.5);
}
.lang-opt {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  line-height: 1;
  transition: color 0.12s ease;
}
.lang-opt.active { color: hsl(var(--foreground)); }
.lang-opt:hover  { color: hsl(var(--primary)); }
.lang-sep {
  font-size: 0.55rem;
  color: hsl(240 6% 88%);
  user-select: none;
  line-height: 1;
}
[data-theme="dark"] .lang-sep {
  color: hsl(240 6% 22%);
}

/* ══════════════════════════════════════════════
   HAMBURGER
   ══════════════════════════════════════════════ */

.menu-lines {
  width: 18px; height: 18px;
  display: flex; flex-direction: column;
  justify-content: center; gap: 4px;
}
.menu-lines span {
  display: block; height: 1.5px;
  border-radius: 2px; background: currentColor;
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s;
}
.menu-lines.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-lines.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-lines.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ══════════════════════════════════════════════
   MENÚ DESPLEGABLE
   ══════════════════════════════════════════════ */

.site-menu {
  position: absolute;
  right: max(0.6rem, calc((100vw - 42rem) / 2));
  top: calc(100% + 0.55rem);
  width: min(19.6rem, calc(100vw - 2rem));
  border: 1px solid rgba(226, 220, 238, 0.98);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 28px 74px rgba(31, 26, 49, 0.21), 0 1px 0 rgba(255, 255, 255, 0.92) inset;
  padding: 0.68rem;
  animation: menuIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 80;
}
[data-theme="dark"] .site-menu {
  border-color: rgba(80, 65, 110, 0.28);
  background: hsl(240 10% 11% / 0.99);
  box-shadow: 0 28px 74px rgba(5, 4, 10, 0.55);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.menu-list { display: grid; gap: 0.12rem; }
.menu-list a {
  width: 100%; min-height: 3.08rem;
  border-radius: 16px; background: transparent;
  text-align: left; padding: 0 0.7rem;
  color: #6f6878;
  display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: 0.66rem; align-items: center;
  text-decoration: none;
}
.menu-list a:hover,
.menu-list a.current { background: #f8f5ff; }
.menu-list a.current { box-shadow: inset 3px 0 0 hsl(var(--primary)); }

[data-theme="dark"] .menu-list a { color: hsl(var(--muted-foreground)); }
[data-theme="dark"] .menu-list a:hover,
[data-theme="dark"] .menu-list a.current { background: hsl(250 15% 18%); }

.menu-icon {
  width: 34px; height: 34px; border-radius: 14px;
  background: #f1ecff; color: hsl(var(--primary));
  display: grid; place-items: center;
}
[data-theme="dark"] .menu-icon { background: hsl(250 20% 22%); }

.menu-list strong {
  display: block; color: #2d2836;
  font-size: 0.97rem; font-weight: 850;
  letter-spacing: -0.016em; line-height: 1.1;
}
[data-theme="dark"] .menu-list strong { color: hsl(var(--foreground)); }

.menu-list em {
  display: block; margin-top: 0.16rem;
  color: #92899e; font-style: normal;
  font-size: 0.67rem; font-weight: 640; line-height: 1.12;
}
[data-theme="dark"] .menu-list em { color: hsl(var(--muted-foreground)); }

.menu-support {
  width: 100%; margin-top: 0.62rem;
  min-height: 3.92rem;
  border: 1px solid #4b3c72; border-radius: 20px;
  background: radial-gradient(circle at 16% 0, rgba(255,255,255,0.2), transparent 38%),
              linear-gradient(135deg, #241f2c, #4b3c72);
  box-shadow: 0 13px 28px rgba(45, 39, 54, 0.17);
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center; gap: 0.68rem;
  padding: 0.68rem 0.76rem;
  text-align: left; color: #fff;
  text-decoration: none;
}
.support-logo {
  width: 40px; height: 40px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  display: grid; place-items: center;
}
.support-logo .brand-icon-small { width: 30px; height: 30px; }
.menu-support strong {
  display: block; color: #fff;
  font-size: 0.9rem; font-weight: 860;
}
.menu-support em {
  display: block; margin-top: 0.16rem;
  color: rgba(255, 255, 255, 0.75);
  font-style: normal; font-size: 0.68rem; font-weight: 620; line-height: 1.22;
}
.menu-support > svg { justify-self: end; color: rgba(255, 255, 255, 0.74); }

/* ══════════════════════════════════════════════
   DARK MODE — comprehensive menu overrides
   ══════════════════════════════════════════════ */

[data-theme="dark"] .menu-support {
  border-color: rgba(120, 100, 160, 0.4);
  background: radial-gradient(circle at 16% 0, rgba(255,255,255,0.08), transparent 38%),
              linear-gradient(135deg, hsl(250 18% 14%), hsl(250 22% 20%));
  box-shadow: 0 13px 28px rgba(0, 0, 0, 0.35);
}

/* Match home2v2 mobile header scale exactly */
@media (max-width: 768px) {
  .brand-row { padding: 0 0.64rem; }
  .brand-link { gap: 0.14rem; }
  .brand-title { font-size: 1.5rem; }
}

/* Mobile menu focus should not look like the current-page marker */
.menu-list a:focus-visible,
.menu-support:focus-visible {
  outline: 2px solid hsl(var(--primary) / 0.45);
  outline-offset: 3px;
  box-shadow: none;
}

.menu-list a.current:focus-visible {
  outline: none;
}
