/* ==========================================================================
   CoSA — Constructora de Soluciones Arquitectónicas
   Hoja de estilos única. Los valores de diseño viven en :root.
   ========================================================================== */

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color */
  --fondo: #141414;
  --texto: #e9e6e0;
  --tenue: #9a9893;          /* 6.6:1 sobre --fondo */
  --linea: #34332f;

  /* Tipografía */
  --fuente: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-base: clamp(0.8125rem, 0.72rem + 0.25vw, 0.9375rem);  /* 13–15 px */
  --t-grande: clamp(1.125rem, 0.95rem + 0.8vw, 1.625rem);    /* 18–26 px */
  --t-chica: 0.75rem;                                       /* 12 px */

  /* Espacio */
  --margen: clamp(1rem, 0.6rem + 1.6vw, 2rem);

  /* Cursor-foto */
  --foto-base: min(30vw, 440px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
}

body {
  font-family: var(--fuente);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100svh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--tenue); }
:focus-visible { outline: 1px solid var(--texto); outline-offset: 4px; }

img { display: block; max-width: 100%; }

.solo-lector {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.etiqueta {
  font-size: var(--t-chica);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tenue);
  font-weight: 400;
  margin: 0;
}

/* Enlaces de navegación: área táctil de 44 px sin cambiar el aspecto */
.nav a, .pie a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--t-chica);
}

/* ==========================================================================
   HOME
   ========================================================================== */

.home {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.home .encabezado,
.home .pie {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: calc(var(--margen) - 12px) var(--margen);
}

.nombre-completo {
  display: block;
  width: clamp(15rem, 28vw, 26rem);
  color: var(--texto);
}
.nombre-completo svg { display: block; width: 100%; height: auto; }

.home .centro {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

.simbolo {
  width: auto;
  height: min(52vh, 30rem);
  aspect-ratio: 332.49 / 372.43;
  color: var(--texto);
}

/* Home: el símbolo va por encima de las fotos y se invierte donde una foto lo cruza.
   Con mix-blend-mode: difference, el color se resta del fondo: --logo-mezcla está
   calculado para que sobre --fondo se vea exactamente --texto (#e9e6e0). */
.home .simbolo {
  --logo-mezcla: #fdfaf4;              /* = --texto + --fondo, canal por canal */
  height: min(36.4vh, 21rem);          /* 30 % más chico que antes */
  position: relative;
  z-index: 6;                          /* por encima del escenario (z-index 5) */
  color: var(--logo-mezcla);
  mix-blend-mode: difference;
  pointer-events: none;
}
.simbolo svg { display: block; width: 100%; height: 100%; }

.pie .tenue { color: var(--tenue); font-size: var(--t-chica); letter-spacing: 0.08em; text-transform: uppercase; }

/* --- Escenario de fotos --------------------------------------------------
   Sin JavaScript: se ve la primera foto, centrada, sin animación. */
.escenario {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.escenario img {
  grid-area: 1 / 1;
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
  object-fit: contain;
  visibility: hidden;
}
.escenario img:first-child { visibility: visible; }
.js .escenario img:first-child { visibility: hidden; }
.escenario img.activa { visibility: visible !important; }
.contador { font-variant-numeric: tabular-nums; }

/* --- Modo cursor (mouse / trackpad) --------------------------------------- */
.modo-cursor { cursor: none; }
.modo-cursor a, .modo-cursor button { cursor: pointer; }

.modo-cursor .escenario {
  position: fixed;
  inset: auto;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  display: block;
  z-index: 5;
  opacity: 0;
  transition: opacity 120ms linear;
  will-change: transform;
}
.modo-cursor .escenario.visible { opacity: 1; }
.modo-cursor.sobre-enlace .escenario { opacity: 0; }

.modo-cursor .escenario img {
  position: absolute;
  max-width: none;
  max-height: none;
  /* ancho, alto y desplazamiento los calcula cursor.js */
}

/* --- Modo táctil (celular / tablet) --------------------------------------- */
.modo-tactil .centro {
  grid-template-rows: 1fr;
}
.modo-tactil .simbolo {
  position: absolute;
  top: 0;
  left: var(--margen);
  height: 5.5rem;
  z-index: 6;
}
.modo-tactil .escenario {
  position: absolute;
  inset: 6.5rem var(--margen) 0.5rem;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.modo-tactil .escenario img {
  max-width: 100%;
  max-height: 100%;
}

/* En pantallas angostas el nombre completo baja al pie */
@media (max-width: 40rem) {
  .home .encabezado .nombre-completo { display: none; }
  .home .encabezado { justify-content: flex-end; }
  .pie-nombre { display: block !important; width: 100%; }
  .home .pie { flex-wrap: wrap; row-gap: 0; }
}
.pie-nombre { display: none; }

@media (prefers-reduced-motion: reduce) {
  .modo-cursor .escenario { transition: none; }
}

/* ==========================================================================
   INFORMACIÓN
   ========================================================================== */

.info .encabezado {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--margen) - 8px) var(--margen);
  background: var(--fondo);
}
.info .encabezado .simbolo-chico { display: block; width: 2.6rem; color: var(--texto); }
.info .encabezado .simbolo-chico svg { display: block; width: 100%; height: auto; }

.info main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--margen);
  row-gap: clamp(3rem, 6vw, 6rem);
  padding: clamp(2rem, 6vw, 5rem) var(--margen) clamp(3rem, 8vw, 7rem);
}

.bloque { grid-column: 1 / -1; border-top: 1px solid var(--linea); padding-top: 0.9rem; }
.bloque .etiqueta { margin-bottom: 1.6rem; }

.oficina { grid-column: 1 / -1; }
.oficina .texto {
  font-size: var(--t-base);
  line-height: 1.6;
  columns: 2 22rem;          /* dos columnas; una sola en pantallas angostas */
  column-gap: calc(var(--margen) * 2);
}
.oficina .texto p { margin: 0 0 1em; text-wrap: pretty; break-inside: avoid; }

/* Listado de proyectos */
.proyectos table { width: 100%; border-collapse: collapse; }
.proyectos th {
  text-align: left; font-weight: 400;
  font-size: var(--t-chica); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--tenue);
  padding: 0 1rem 0.7rem 0;
}
.proyectos td {
  padding: 0.85rem 1rem 0.85rem 0;
  border-top: 1px solid var(--linea);
  vertical-align: top;
}
.proyectos .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.proyectos .pendiente td { color: var(--tenue); }

@media (max-width: 48rem) {
  .proyectos thead { display: none; }
  .proyectos tr { display: grid; grid-template-columns: 4rem 1fr; border-top: 1px solid var(--linea); padding: 0.8rem 0; }
  .proyectos td { border: 0; padding: 0.1rem 0; }
  .proyectos td:first-child { grid-row: span 3; }
  .proyectos td.tipo, .proyectos td.ubicacion { color: var(--tenue); }
}

/* Contacto */
.contacto dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 2rem;
  margin: 0;
  font-size: var(--t-grande);
}
.contacto dt { color: var(--tenue); font-size: var(--t-chica); text-transform: uppercase; letter-spacing: 0.08em; padding-top: 0.55em; }
.contacto dd { margin: 0; }
.contacto dd a { display: inline-block; min-height: 44px; padding-top: 0.15em; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; text-decoration-color: var(--linea); }
.contacto dd a:hover { text-decoration-color: var(--tenue); }


.info .pie {
  display: block;
  padding: 0 var(--margen) var(--margen);
  color: var(--tenue);
}
.info .pie .nombre-completo { width: min(100%, 40rem); color: var(--tenue); margin-bottom: 0.8rem; }
.info .pie p { margin: 0; font-size: var(--t-chica); letter-spacing: 0.08em; text-transform: uppercase; }

/* ==========================================================================
   404
   ========================================================================== */
.no-encontrada {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.5rem;
  text-align: center;
  padding: var(--margen);
}
.no-encontrada .simbolo { height: min(30vh, 14rem); }
