/* ============================================================
   Sistema de color · César Romero
   Los tokens viven acá y Tailwind los consume desde
   js/tailwind-config.js. Para cambiar un color del sitio
   completo, se cambia en este archivo y en ningún otro lado.

   Formato "R G B" sin comas: lo exige la sintaxis
   rgb(var(--token) / <alpha-value>) que permite bg-paper/85.
   ============================================================ */

:root {
  color-scheme: light;

  /* --- superficies, de la más al fondo a la más elevada --- */
  --paper:    250 250 250;   /* #fafafa · fondo base de la página   */
  --sunken:   242 242 244;   /* #f2f2f4 · bandas de sección         */
  --surface:  255 255 255;   /* #ffffff · tarjetas, píldoras        */
  --fog:      232 232 234;   /* #e8e8ea · bordes y divisores        */

  /* --- texto --- */
  --ink:       17  17  19;   /* #111113 · titulares y texto fuerte  */
  --smoke:     85  85  91;   /* #55555b · cuerpo                    */
  --mist:     110 110 117;   /* #6e6e75 · rótulos y datos menores   */

  /* --- acento --- */
  --accent:   138 100  20;   /* #8a6414 · ámbar, 5,1:1 sobre paper  */

  /* --- sección de cierre: el ancla de la página --- */
  --anchor-bg:     17  17  19;
  --anchor-fg:    250 250 250;
  --anchor-muted: 154 154 164;
  --anchor-line:   58  58  64;
  --anchor-accent:217 174  92;
}

/* Preferencia del sistema en oscuro, salvo que la persona haya
   elegido claro explícitamente. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --paper:     15  15  17;   /* #0f0f11 */
    --sunken:    20  20  23;   /* #141417 */
    --surface:   26  26  30;   /* #1a1a1e */
    --fog:       43  43  49;   /* #2b2b31 */

    --ink:      242 242 244;   /* #f2f2f4 · 18:1  */
    --smoke:    180 180 189;   /* #b4b4bd · 9,4:1 */
    --mist:     139 139 149;   /* #8b8b95 · 5,7:1 */

    --accent:   217 174  92;   /* #d9ae5c */

    /* En oscuro el ancla no se invierte a blanco: se eleva.
       Una banda clara acá encandilaría en vez de cerrar. */
    --anchor-bg:     26  26  30;
    --anchor-fg:    242 242 244;
    --anchor-muted: 139 139 149;
    --anchor-line:   58  58  64;
    --anchor-accent:217 174  92;
  }
}

/* Elección explícita de la persona: gana sobre el sistema. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --paper:     15  15  17;
  --sunken:    20  20  23;
  --surface:   26  26  30;
  --fog:       43  43  49;

  --ink:      242 242 244;
  --smoke:    180 180 189;
  --mist:     139 139 149;

  --accent:   217 174  92;

  --anchor-bg:     26  26  30;
  --anchor-fg:    242 242 244;
  --anchor-muted: 139 139 149;
  --anchor-line:   58  58  64;
  --anchor-accent:217 174  92;
}

/* El fondo se pinta desde CSS, no desde Tailwind: así el tema
   correcto aparece antes de que el navegador ejecute el JS. */
html { background-color: rgb(var(--paper)); }
body { background-color: rgb(var(--paper)); color: rgb(var(--ink)); }

/* ------------------------------------------------------------
   Chrome del sitio: barra superior + nav lateral + rail de contacto.
   Dimensiones en tokens para que el padding del body coincida.
   En viewport < 1024px solo queda la barra superior.
   ------------------------------------------------------------ */
:root {
  --chrome-header: 3.5rem;
  --chrome-nav: 10.75rem;
  --chrome-rail: 18.5rem;
}

body {
  padding-top: var(--chrome-header);
}

@media (min-width: 1024px) {
  body {
    padding-left: var(--chrome-nav);
  }
}

@media (min-width: 1280px) {
  body {
    padding-right: var(--chrome-rail);
  }
}

.site-skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 80;
  padding: 0.5rem 0.85rem;
  background: rgb(var(--ink));
  color: rgb(var(--paper));
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 999px;
}
.site-skip:focus {
  top: 0.65rem;
  outline: 2px solid rgb(var(--accent));
  outline-offset: 2px;
}

.site-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--chrome-header);
  padding: 0 1.25rem;
  border-bottom: 1px solid rgb(var(--fog));
  background: rgb(var(--paper) / 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
  color: rgb(var(--ink));
  text-decoration: none;
}
.site-brand-name {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-brand-role {
  display: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(var(--mist));
  white-space: nowrap;
}
@media (min-width: 640px) {
  .site-brand-role { display: inline; }
}

.site-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgb(var(--smoke));
  cursor: pointer;
}
.site-icon-btn:hover {
  background: rgb(var(--fog));
  color: rgb(var(--ink));
}
.site-icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}
.site-menu-btn { display: inline-flex; }
@media (min-width: 1024px) {
  .site-menu-btn { display: none; }
}

.site-sidenav,
.site-rail {
  display: none;
}

@media (min-width: 1024px) {
  .site-sidenav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--chrome-header);
    bottom: 0;
    left: 0;
    z-index: 40;
    width: var(--chrome-nav);
    overflow-y: auto;
    padding: 1rem 0.6rem;
    border-right: 1px solid rgb(var(--fog));
    background: rgb(var(--paper));
  }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
  .site-rail {
    display: block;
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    top: auto;
    left: auto;
    z-index: 46;
    width: max-content;
    max-width: calc(100vw - var(--chrome-nav) - 2.5rem);
    padding: 0;
    border: none;
    background: transparent;
  }
}

@media (min-width: 1280px) {
  .site-rail-chip {
    display: none;
  }
  .site-rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--chrome-header);
    right: 0;
    bottom: 0;
    z-index: 40;
    width: var(--chrome-rail);
    overflow-x: visible;
    overflow-y: auto;
    padding: 1.25rem 0.85rem;
    border-left: 1px solid rgb(var(--fog));
    background: rgb(var(--paper));
    box-sizing: border-box;
  }
}

.site-sidenav a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgb(var(--smoke));
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.site-sidenav a:hover {
  color: rgb(var(--ink));
  background: rgb(var(--sunken));
}
.site-sidenav a[aria-current="page"] {
  color: rgb(var(--ink));
  background: rgb(var(--sunken));
}

.site-rail-chip {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.7rem 0.7rem 0.95rem;
  border: 1px solid rgb(var(--fog));
  border-radius: 999px;
  background: rgb(var(--surface));
  box-shadow: 0 14px 40px rgb(var(--ink) / 0.16);
  color: rgb(var(--ink));
  text-decoration: none;
}
.site-rail-chip-copy {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.site-rail-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgb(var(--ink));
  color: rgb(var(--paper));
}
.site-rail-chip-btn svg {
  width: 1rem;
  height: 1rem;
}
.site-rail-chip:hover .site-rail-chip-btn {
  background: rgb(var(--smoke));
}

#contacto {
  scroll-margin-top: var(--chrome-header);
}

.site-rail-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.1rem 0.9rem 1.15rem;
  border: 1px solid rgb(var(--fog));
  border-radius: 0.85rem;
  background: rgb(var(--surface));
  box-sizing: border-box;
}

.site-rail-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgb(var(--ink));
}
.site-rail-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgb(var(--accent));
}
.site-rail-kicker {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgb(var(--ink));
}
.site-rail-copy {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(var(--smoke));
}
.site-rail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0.35rem 0 0;
}
.site-rail-meta > div {
  min-width: 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgb(var(--fog));
}
.site-rail-meta dt {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--mist));
}
.site-rail-meta dd {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgb(var(--ink));
  overflow-wrap: anywhere;
}
.site-rail-meta a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgb(var(--fog));
  text-underline-offset: 4px;
}
.site-rail-meta a:hover {
  text-decoration-color: rgb(var(--ink));
}

.site-rail-mail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}
.site-rail-email {
  display: inline-block;
  width: max-content;
  max-width: none;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.site-copy-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid rgb(var(--fog));
  border-radius: 999px;
  background: transparent;
  color: rgb(var(--mist));
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.site-copy-btn:hover {
  border-color: rgb(var(--ink));
  color: rgb(var(--ink));
}
.site-copy-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}

.site-nav-movil {
  position: fixed;
  top: var(--chrome-header);
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 1.25rem 1rem;
  border-bottom: 1px solid rgb(var(--fog));
  background: rgb(var(--paper));
  box-shadow: 0 12px 30px rgb(var(--ink) / 0.06);
  font-size: 0.875rem;
  font-weight: 600;
}
.site-nav-movil[hidden] { display: none; }
.site-nav-movil a,
.site-nav-movil-tema {
  display: block;
  width: 100%;
  padding: 0.9rem 0;
  border: 0;
  border-bottom: 1px solid rgb(var(--fog) / 0.7);
  background: transparent;
  color: rgb(var(--ink));
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.site-nav-movil a:last-of-type,
.site-nav-movil-tema {
  border-bottom: 0;
}
.site-nav-movil a[aria-current="page"] {
  color: rgb(var(--accent));
}
@media (min-width: 1024px) {
  .site-nav-movil { display: none !important; }
}

/* El cambio de tema no debe animarse: se ve como un parpadeo. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------
   Iconos del selector de tema.
   Cada icono muestra a dónde vas, no dónde estás.
   ------------------------------------------------------------ */
.tema-a-claro  { display: none; }
.tema-a-oscuro { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tema-a-claro  { display: block; }
  :root:not([data-theme="light"]) .tema-a-oscuro { display: none; }
}

:root[data-theme="dark"] .tema-a-claro  { display: block; }
:root[data-theme="dark"] .tema-a-oscuro { display: none; }

/* Visibilidad del rail: estas reglas van al final para ganar al display base. */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  aside.site-rail .site-rail-card { display: none; }
  aside.site-rail .site-rail-chip { display: flex; }
}
@media (min-width: 1280px) {
  aside.site-rail .site-rail-chip { display: none; }
  aside.site-rail .site-rail-card { display: flex; }
}
