/* TSM Group Inc. — estilos del sitio.
   Todos los colores, medidas y tipografía vienen de tokens.css (sistema de diseño).
   Aquí solo se decide cómo se acomodan. */

/* Fuente Archivo alojada en nuestro servidor (licencia SIL OFL, ver assets/fonts/Archivo-OFL.txt).
   Un solo archivo variable: todos los pesos de 400 a 800, caracteres latinos (EN/ES). */
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-wght.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--link); }
a:focus-visible {
  outline: var(--stroke-focus) solid var(--focus);
  outline-offset: var(--stroke-focus);
  border-radius: var(--radius-1);
}

/* Encabezado: el logo manda */
.masthead {
  padding: clamp(1rem, 3vw, 1.75rem) clamp(var(--space-4), 4vw, var(--space-7)) clamp(1rem, 3vw, 2rem);
}

.masthead__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
}

.logo { display: block; line-height: 0; }
.logo img {
  display: block;
  width: clamp(12rem, 30vw, var(--logo-width));
  height: auto;
}

/* Selector de idioma (componente LanguageSwitch) */
.lang {
  display: flex;
  gap: 1.25rem;
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.lang a {
  color: var(--ink-muted);
  text-decoration: none;
}
.lang a:hover { color: var(--link); text-decoration: underline; }
.lang a[aria-current="page"] {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--brand-orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

/* Columna derecha del encabezado: idioma arriba, menú abajo */
.masthead__nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-4);
}

/* Menú principal */
.menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.menu a {
  display: inline-block;
  padding: var(--space-1) 0;
  color: var(--heading);
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.menu a:hover { color: var(--link); border-bottom-color: var(--hairline); }
.menu a[aria-current] { color: var(--link); border-bottom-color: var(--brand-orange); }

/* En pantallas chicas el menú baja debajo del logo, a todo lo ancho */
@media (max-width: 640px) {
  .masthead__inner { flex-wrap: wrap; }
  .masthead__nav { display: contents; }
  .masthead__nav > nav:first-child { order: 1; }
  .masthead__nav > nav:last-child { order: 2; flex-basis: 100%; }
  .menu { padding-top: var(--space-3); border-top: 1px solid var(--hairline); }
}

/* El listón (componente Ribbon): el anillo del logo, desenrollado */
.ribbon {
  display: grid;
  grid-template-columns: 3fr 2fr 4fr;
  height: var(--stroke-ribbon);
}
.ribbon span:nth-child(1) { background: var(--brand-magenta); }
.ribbon span:nth-child(2) { background: var(--brand-orange); }
.ribbon span:nth-child(3) { background: var(--brand-teal); }

/* Contenido */
main {
  flex: 1;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(var(--space-4), 4vw, var(--space-7));
}

.content {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(var(--space-6), 5vw, var(--space-8));
  align-items: start;
}
.content--single { grid-template-columns: minmax(0, 1fr); }

.lead {
  margin: 0 0 var(--space-5);
  max-width: var(--measure);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--heading);
  text-wrap: balance;
}

.story {
  margin: 0 0 2.25rem;
  max-width: var(--measure);
  color: var(--ink-muted);
}

/* Bloque de contacto (componente ContactBlock) */
.contact {
  max-width: var(--measure);
  padding: 1.25rem var(--space-5);
  background: var(--surface-tint);
  border-left: var(--stroke-edge) solid var(--brand-magenta);
}

.contact p { margin: 0 0 var(--space-1); color: var(--ink-muted); font-size: 0.9375rem; }

.contact a {
  font-size: 1.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* Foto destacada */
.photo { margin: 0; }

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: var(--stroke-photo) solid var(--brand-orange);
}

.photo figcaption {
  margin-top: var(--space-3);
  font-size: 0.875rem;
  color: var(--ink-muted);
}

footer {
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: var(--space-5) clamp(var(--space-4), 4vw, var(--space-7));
  font-size: 0.8125rem;
}

footer p { max-width: var(--container); margin: 0 auto; }

/* --- Contacto ----------------------------------------------------------- */
.contact__more { margin: var(--space-4) 0 0; }
.contact .contact__more a { font-size: 0.9375rem; font-weight: 400; }
.contact a.btn {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: 1rem;
  text-decoration: none;
}

.eyebrow { margin: 0 0 var(--space-3); font-size: 0.9375rem; }

.paths {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-5);
  max-width: var(--container);
}
.path {
  padding: var(--space-5);
  border-top: var(--stroke-edge) solid var(--brand-teal);
  background: var(--surface-tint);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.path:nth-child(2) { border-top-color: var(--brand-magenta); }
.path:nth-child(3) { border-top-color: var(--brand-orange); }
.path h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; color: var(--heading); }
.path p { margin: 0; color: var(--ink-muted); }
.path .path__action { margin-top: auto; padding-top: var(--space-2); font-weight: 600; }
.path__action a { overflow-wrap: anywhere; }

/* --- Formularios (componente Button + campos) --------------------------- */
.form-page > div { max-width: 46rem; }

.form { display: grid; gap: var(--space-6); }

.group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: var(--space-5);
}
.group > legend {
  padding: 0 0 var(--space-3);
  margin-bottom: var(--space-2);
  width: 100%;
  border-bottom: 1px solid var(--hairline);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-5);
}

.field { display: grid; gap: var(--space-1); min-width: 0; align-content: start; }
.field > label,
.choices > legend { font-weight: 600; font-size: 0.9375rem; }

.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-2);
  padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 8rem; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.choice input:focus-visible,
.btn:focus-visible {
  outline: var(--stroke-focus) solid var(--focus);
  outline-offset: 2px;
}

.field [aria-invalid="true"] { border-color: var(--brand-magenta); border-width: 2px; }

.choices { margin: 0; padding: 0; border: 0; }
.choices > legend { padding: 0; margin-bottom: var(--space-2); }
.choices__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-2) var(--space-5);
}
.choice { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.choice input { margin-top: 0.3em; width: 1.05rem; height: 1.05rem; accent-color: var(--brand-teal); flex: none; }

.hint { margin: 0; font-size: 0.875rem; color: var(--ink-muted); }
.req { color: var(--accent-text); }

.field-error {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-text);
}
.has-error > legend,
.has-error .choice span { color: var(--accent-text); }

.consent { padding: var(--space-4); background: var(--surface-tint); }

.notice { padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5); border-left: var(--stroke-edge) solid; }
.notice h2 { margin: 0 0 var(--space-2); font-size: 1.25rem; color: var(--heading); }
.notice p { margin: 0; }
.notice--ok { background: var(--surface-tint); border-color: var(--brand-teal); }
.notice--error { background: var(--surface-tint); border-color: var(--brand-magenta); color: var(--ink); font-weight: 600; }

.btn {
  justify-self: start;
  font: 600 1rem/1 var(--font-sans);
  padding: 14px var(--space-5);
  border-radius: var(--radius-2);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: var(--brand-deep); }

/* Trampa para bots: fuera de la vista, sin usar display:none (algunos bots lo detectan). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 0.15s ease; }
}

@media (max-width: 760px) {
  .content { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .contact a { font-size: 1.0625rem; }
}

/* --- Textos largos (aviso de privacidad) -------------------------------- */
.prose { max-width: var(--measure); }
.prose h2 { margin: var(--space-7) 0 var(--space-3); font-size: 1.25rem; line-height: 1.3; color: var(--heading); }
.prose p, .prose ul { margin: 0 0 var(--space-4); }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: var(--space-2); }
.prose__meta { color: var(--ink-muted); font-size: 0.9375rem; }
.prose code { font-size: 0.9375em; }

.table-wrap { overflow-x: auto; margin: 0 0 var(--space-4); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: var(--space-3); border-bottom: 1px solid var(--hairline); }
.prose th { color: var(--heading); background: var(--surface-tint); }

footer a { color: inherit; }
.footer__sep { margin: 0 var(--space-2); }

/* --- Páginas de contenido: Inicio, Nosotros, Historia, Soluciones (2-nov-2026) --- */

/* Enlace "ir al contenido": invisible hasta que se navega con teclado */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--action);
  color: var(--on-action);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-4); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.kicker {
  margin: 0 0 var(--space-3);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.lead--hero { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0 0 var(--space-6); }
.actions .btn, a.btn { display: inline-block; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--action); border-color: var(--action); }
.btn-secondary:hover { background: var(--surface-tint); }

/* Tarjetas de soluciones */
.cards {
  list-style: none;
  margin: clamp(2.5rem, 6vw, 4rem) auto;
  padding: 0;
  max-width: var(--container);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-5);
}
.cards--flush { margin: 0 0 var(--space-4); }
.card {
  padding: var(--space-5);
  background: var(--surface-tint);
  border-top: var(--stroke-edge) solid var(--brand-teal);
}
.card:nth-child(2) { border-top-color: var(--brand-magenta); }
.card:nth-child(3) { border-top-color: var(--brand-orange); }
.card h2, .card h3 { margin: 0 0 var(--space-2); font-size: 1.25rem; line-height: 1.3; }
.card h2 a, .card h3 a { color: var(--heading); text-decoration: none; }
.card h2 a:hover, .card h3 a:hover { text-decoration: underline; }
.card p { margin: 0; color: var(--ink-muted); }

/* Bloques de texto con título */
.content--split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: clamp(var(--space-5), 4vw, var(--space-7));
  max-width: var(--container);
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
}
.content--single > .content--split { margin: 0; }
.block { max-width: 40rem; }
.block h2, .solution h2, .band h2 {
  margin: 0 0 var(--space-3);
  font-size: 1.375rem;
  line-height: 1.3;
  color: var(--heading);
}
.block p { margin: 0 0 var(--space-4); }

.ticks { margin: 0 0 var(--space-4); padding-left: 1.25rem; }
.ticks li { margin-bottom: var(--space-2); }
.ticks li::marker { color: var(--brand-orange); }

.teaser { max-width: 46rem; margin: 0; font-size: 1.125rem; }
.teaser a { font-weight: 600; white-space: nowrap; }

/* Banda para proveedores */
.band {
  max-width: 46rem;
  margin: 0;
  padding: var(--space-4) var(--space-5);
  border-left: var(--stroke-edge) solid var(--brand-orange);
  background: var(--surface-tint);
}
.band p { margin: 0 0 var(--space-2); }
.band p:last-child { margin-bottom: 0; }
.band a { font-weight: 600; }

/* Soluciones */
.toc ul { list-style: none; margin: 0 0 var(--space-6); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.toc a { font-weight: 600; }
.solution {
  max-width: 46rem;
  margin: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--hairline);
  scroll-margin-top: var(--space-5);
}
.solution p { margin: 0 0 var(--space-4); }
.solution__action { font-weight: 600; }

/* Historia */
.prose--wide { max-width: 46rem; }
.prose--wide h2 { font-size: 1.375rem; }

/* Línea de tiempo: horizontal en pantallas grandes, vertical en el celular */
.timeline {
  list-style: none;
  margin: var(--space-6) 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
  border-top: 3px solid var(--brand-teal);
}
.timeline li {
  position: relative;
  padding-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
  line-height: 1.35;
}
.timeline li::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand-teal);
}
.timeline li:last-child::before { background: var(--brand-orange); border-color: var(--brand-orange); }
.timeline__year { font-weight: 700; font-size: 1.0625rem; color: var(--heading); }
.timeline__place { font-weight: 600; }
.timeline__detail { color: var(--ink-muted); }

@media (max-width: 760px) {
  .timeline {
    grid-template-columns: minmax(0, 1fr);
    border-top: 0;
    border-left: 3px solid var(--brand-teal);
    gap: var(--space-4);
    padding-left: var(--space-5);
  }
  .timeline li { padding-top: 0; }
  .timeline li::before { top: 4px; left: calc(-1 * var(--space-5) - 9px); }
}

/* Recorte de fotos con la elipse Loop (2:1, inclinada 15°). Ver claude/elipse-loop-componente.md.
   Uso: <div class="loop-photo"> … <img> … </div>. La foto debe ser 16:9. */
.loop-photo {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  -webkit-mask: url("/assets/img/loop-ellipse.svg") center / 100% 100% no-repeat;
          mask: url("/assets/img/loop-ellipse.svg") center / 100% 100% no-repeat;
}
.loop-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Subtítulos dentro de un grupo de casillas (categorías de proveedores) */
.choices__group { margin: var(--space-4) 0 var(--space-2); font-size: 0.875rem; font-weight: 700; color: var(--heading); text-transform: uppercase; letter-spacing: 0.05em; }
.choices > .choices__group:first-of-type { margin-top: 0; }
