/* ==========================================================================
   Techsai 2026 — capa visual
   Se carga DESPUÉS de los estilos en línea de php/header.php y los
   sobrescribe de forma suave para todas las páginas. Los estilos .ts-*
   son de la nueva portada (index.php).
   ========================================================================== */

:root {
  --ts-ink: #212f3d;        /* pizarra de marca */
  --ts-ink-deep: #17222d;   /* fondo de hero y pie */
  --ts-orange: #ff9400;     /* naranja de marca */
  --ts-orange-ink: #b86400; /* naranja legible sobre fondo claro (AA) */
  --ts-paper: #f4f6f8;      /* gris frío de sección */
  --ts-steel: #5b6b7b;      /* texto secundario */
  --ts-line: #d9e0e6;       /* separadores */
  --ts-radius: 10px;
  --ts-wrap: 1180px;
}

/* ---------- Base (todas las páginas) ---------- */

body {
  font-size: 18px;
  line-height: 1.65;
  text-align: left;               /* el texto justificado creaba "ríos" difíciles de leer */
  color: var(--ts-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ts-orange-ink); text-underline-offset: 3px; }
a:hover { color: var(--ts-ink); }

:focus-visible {
  outline: 3px solid var(--ts-orange);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4, h5 { letter-spacing: -0.015em; }
h2::after, h3::after { height: 0; }

/* Imágenes de contenido: sombra más suave, sin borde negro */
img {
  border: 1px solid var(--ts-line);
  box-shadow: 0 8px 24px rgba(23, 34, 45, 0.12);
  border-radius: 8px;
}
.imgnoborder { border: none; box-shadow: none; border-radius: 0; }

/* ---------- Barra de navegación (blanca) ---------- */

.navbar.fixed-top {
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--ts-line);
  box-shadow: 0 1px 12px rgba(23, 34, 45, 0.06);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.navbar .navbar-brand { gap: 10px; }
.navbar .navbar-brand a { display: block; line-height: 0; }
.navbar .ts-logo { width: 42px; height: auto; margin: 0; }
/* Compensación óptica: la masa naranja del logo está arriba y lo hace parecer más alto */
.navbar .ts-logo { transform: translateY(3px); }
.navbar .brand-text strong { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; line-height: 1; color: var(--ts-ink); }
/* Lema alineado a la línea base de "Techsai"; el bloque se sube 1,5px para quedar
   centrado ópticamente con el logo (medido en captura) */
.navbar .brand-text { align-items: baseline; gap: 0.75rem; transform: translateY(-1.5px); }
.navbar .brand-text .tagline { color: var(--ts-steel); font-size: 13px; font-weight: 500; padding-left: 0.75rem; border-left: 1px solid var(--ts-line); line-height: 1.3; }

/* Los enlaces del menú llevan .text-white en el HTML: se pasan a color pizarra */
.navbar .text-white { color: var(--ts-ink) !important; }
.navbar .nav-link {
  font-size: 16px !important;
  font-weight: 600;
  padding: 0.5rem 0.8rem !important;
  border-radius: 6px;
  color: var(--ts-ink);
}
.navbar .nav-link svg { width: 16px; height: 16px; margin-right: 4px; opacity: 0.55; }
.navbar .nav-link:hover { background: var(--ts-paper); }
.navbar .nav-link:hover span { color: var(--ts-orange-ink) !important; }
.navbar .nav-link:hover svg { opacity: 1; color: var(--ts-orange-ink) !important; }

/* "Comprar" como acción principal */
.navbar a.nav-link[href$="/compra.php"] { background: var(--ts-orange); margin-left: 0.4rem; }
.navbar a.nav-link[href$="/compra.php"] span,
.navbar a.nav-link[href$="/compra.php"] svg { color: var(--ts-ink-deep) !important; opacity: 1; }
.navbar a.nav-link[href$="/compra.php"]:hover { background: #ffa933; }
.navbar a.nav-link[href$="/compra.php"]:hover span,
.navbar a.nav-link[href$="/compra.php"]:hover svg { color: var(--ts-ink-deep) !important; }

.navbar .dropdown-menu {
  background: #fff !important;
  border: 1px solid var(--ts-line);
  border-radius: var(--ts-radius);
  padding: 0.4rem;
  box-shadow: 0 16px 40px rgba(23, 34, 45, 0.14);
}
.navbar .dropdown-item { border-radius: 6px; font-size: 16px; padding: 0.5rem 0.9rem; }
.navbar .dropdown-item:hover, .navbar .dropdown-item:focus { background: rgba(255, 148, 0, 0.12); }
.navbar .dropdown-item:hover { color: var(--ts-orange-ink) !important; }
.navbar .dropdown-divider { border-top-color: var(--ts-line) !important; }

.navbar .navbar-toggler { border-color: var(--ts-line); }

@media (max-width: 991.98px) {
  .navbar .navbar-collapse { padding: 0.5rem 0 0.8rem; }
  .navbar a.nav-link[href$="/compra.php"] { margin: 0.4rem 0 0; display: inline-block; }
}

/* ---------- Cabecera de páginas interiores (título + migas) ---------- */

.container-xl > .bg-light.shadow.text-center:first-of-type,
.container-fluid.container-xl.mt-5 > .bg-light.shadow {
  background: var(--ts-paper) !important;
  border: none !important;
  border-left: 6px solid var(--ts-orange) !important;
  box-shadow: none !important;
  border-radius: var(--ts-radius);
  text-align: left !important;
  padding: 2rem 2.2rem !important;
}
.container-fluid.container-xl.mt-5 > .bg-light.shadow h1 {
  text-align: left !important;
  text-transform: none;
  text-shadow: none;
  font-weight: 800;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem);
  line-height: 1.08;
  color: var(--ts-ink);
  margin-bottom: 0.35rem !important;
}
.container-fluid.container-xl.mt-5 > .bg-light.shadow h2 {
  text-align: left !important;
  color: var(--ts-steel);
  font-size: clamp(1.1rem, 0.9rem + 0.9vw, 1.6rem);
  font-weight: 500;
  margin: 0;
}

.breadcrumb { font-size: 15px; margin-bottom: 0.8rem; }
.breadcrumb a { color: var(--ts-steel); text-decoration: none; }
.breadcrumb a:hover { color: var(--ts-orange-ink); text-decoration: underline; }
.container-fluid.container-xl.mt-5 > .bg-light.mx-3 {
  background: transparent !important;
  border: none !important;
  padding-top: 0.4rem !important;
}

/* ---------- Botones ---------- */

.btn-warning, .btn-ts {
  background: var(--ts-orange);
  border-color: var(--ts-orange);
  color: var(--ts-ink-deep);
  font-weight: 700;
}
.btn-warning:hover, .btn-ts:hover { background: #ffa933; border-color: #ffa933; color: var(--ts-ink-deep); }

/* ---------- Pie de página ---------- */

.ts-footer {
  background: var(--ts-ink-deep);
  color: #c9d2db;
  font-size: 16px;
  line-height: 1.6;
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}
.ts-footer a { color: #fff; text-decoration: none; }
.ts-footer a:hover { color: var(--ts-orange); text-decoration: underline; }
.ts-footer h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ts-orange);
  margin: 0 0 0.9rem;
}
.ts-footer ul { list-style: none; padding: 0; margin: 0; }
.ts-footer li { margin-bottom: 0.4rem; }
.ts-footer .ts-footer-brand { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.01em; }
.ts-footer .ts-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  font-size: 14px;
  color: #8e9cab;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

/* ==========================================================================
   Portada
   ========================================================================== */

.ts-wrap { max-width: var(--ts-wrap); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Hero ---------- */

.ts-hero {
  position: relative;
  background:
    radial-gradient(900px 500px at 85% 10%, rgba(255, 148, 0, 0.10), transparent 60%),
    var(--ts-ink-deep);
  color: #fff;
  padding: 9rem 0 0;
  overflow: hidden;
}
.ts-hero h1 {
  font-size: clamp(2.4rem, 1.4rem + 4.2vw, 5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-transform: none;
  text-shadow: none;
  color: #fff;
  max-width: 14ch;
  margin: 0 0 1.5rem;
  hyphens: none;
}
.ts-hero-lead {
  font-size: clamp(1.1rem, 1rem + 0.45vw, 1.35rem);
  color: #c9d2db;
  max-width: 36rem;
  margin: 0 0 2.2rem;
}
.ts-hero-lead strong { color: #fff; font-weight: 700; }

.ts-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.ts-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 17px;
  padding: 0.95rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ts-btn svg { width: 20px; height: 20px; flex: none; }
.ts-btn-primary { background: var(--ts-orange); color: var(--ts-ink-deep); }
.ts-btn-primary:hover { background: #ffa933; color: var(--ts-ink-deep); }
.ts-btn-ghost { color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.35); }
.ts-btn-ghost:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, 0.06); }

/* La onda: la red se corta, el SAI mantiene la línea */
.ts-wave { margin-top: 4.5rem; position: relative; }
.ts-wave svg { display: block; width: 100%; height: auto; }
.ts-wave-legend {
  display: flex;
  gap: 1.8rem;
  flex-wrap: wrap;
  font-size: 14px;
  color: #8e9cab;
  padding: 0 0 1.4rem;
}
.ts-wave-legend span { display: inline-flex; align-items: center; gap: 0.5rem; }
.ts-wave-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px dashed #6c7c8c; }
.ts-wave-legend i.ups { border-top: 3px solid var(--ts-orange); }

.ts-wave .ups-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: ts-draw 2.4s cubic-bezier(.45,.05,.25,1) 0.3s forwards;
}
@keyframes ts-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ts-wave .ups-line { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Franja de credenciales ---------- */

.ts-facts { background: var(--ts-ink); color: #fff; }
.ts-facts ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.ts-facts li {
  padding: 1.6rem 1.25rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 15px;
  color: #c9d2db;
  line-height: 1.45;
}
.ts-facts li:first-child { border-left: none; padding-left: 0; }
.ts-facts strong { display: block; color: #fff; font-size: 17px; font-weight: 700; margin-bottom: 0.15rem; }
@media (max-width: 900px) {
  .ts-facts ul { grid-template-columns: 1fr 1fr; }
  .ts-facts li { padding-left: 1.25rem !important; }
  .ts-facts li:nth-child(odd) { border-left: none; padding-left: 0 !important; }
  .ts-facts li:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, 0.1); }
}
@media (max-width: 520px) {
  .ts-facts ul { grid-template-columns: 1fr; }
  .ts-facts li { border-left: none !important; padding: 1.1rem 0 !important; }
  .ts-facts li + li { border-top: 1px solid rgba(255, 255, 255, 0.1); }
}

/* ---------- Secciones ---------- */

.ts-section { padding: 5.5rem 0; }
.ts-section-alt { background: var(--ts-paper); }
.ts-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 3rem;
  align-items: end;
  margin-bottom: 3rem;
}
.ts-section-head h2 {
  font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  margin: 0;
  color: var(--ts-ink);
}
.ts-section-head p { color: var(--ts-steel); margin: 0; max-width: 34rem; }
@media (max-width: 800px) { .ts-section-head { grid-template-columns: 1fr; } }

/* Servicios: filas, no tarjetas */
.ts-services { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ts-line); }
.ts-service {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.5fr) 190px;
  gap: 1rem 2rem;
  align-items: start;
  padding: 2rem 0;
  border-bottom: 1px solid var(--ts-line);
}
.ts-service-icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: rgba(255, 148, 0, 0.12);
  color: var(--ts-orange-ink);
  display: grid; place-items: center;
}
.ts-service-icon svg { width: 28px; height: 28px; }
.ts-service h3 { font-size: 1.35rem; font-weight: 800; margin: 0.6rem 0 0; line-height: 1.25; }
.ts-service p { color: var(--ts-steel); margin: 0.5rem 0 0; }
.ts-service .ts-link { margin-top: 0.6rem; white-space: nowrap; justify-self: end; }
.ts-link {
  font-weight: 700;
  color: var(--ts-ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ts-orange);
  padding-bottom: 2px;
}
.ts-link:hover { color: var(--ts-orange-ink); }
@media (max-width: 900px) {
  .ts-service { grid-template-columns: 56px minmax(0, 1fr); }
  .ts-service p, .ts-service .ts-link { grid-column: 2; }
  .ts-service .ts-link { justify-self: start; margin-top: 0; }
}

/* Productos */
.ts-products { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 1.25rem; }
.ts-product {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ts-line);
  border-radius: var(--ts-radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ts-ink);
  transition: border-color 0.15s ease;
}
.ts-product:hover { border-color: var(--ts-orange); color: var(--ts-ink); }
.ts-product-img {
  background: #fff;
  height: 260px;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--ts-line);
}
.ts-product-img img {
  border: none; box-shadow: none; border-radius: 0;
  margin: 0; max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain;
}
.ts-product-body { padding: 1.4rem 1.5rem 1.6rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.ts-product h3 { font-size: 1.3rem; font-weight: 800; margin: 0; }
.ts-product p { color: var(--ts-steel); margin: 0; font-size: 16px; flex: 1; }
.ts-product .ts-link { align-self: flex-start; margin-top: 0.6rem; }
@media (max-width: 900px) { .ts-products { grid-template-columns: 1fr; } }

/* Llamada final */
.ts-cta { background: var(--ts-orange); color: var(--ts-ink-deep); padding: 4rem 0; }
.ts-cta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2rem 4rem;
  align-items: center;
}
.ts-cta h2 {
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.8rem);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 0.8rem;
  color: var(--ts-ink-deep);
}
.ts-cta p { margin: 0; font-size: 18px; }
.ts-cta dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.2rem; font-size: 17px; }
.ts-cta dt { font-weight: 500; opacity: 0.8; }
.ts-cta dd { margin: 0; font-weight: 700; }
.ts-cta a { color: var(--ts-ink-deep); }
.ts-cta a:hover { color: #000; }
@media (max-width: 800px) { .ts-cta-grid { grid-template-columns: 1fr; } }

/* Ajustes finales de portada */
.ts-product-img img { max-height: 212px; }
main:has(> .ts-cta:last-child) ~ .ts-footer { margin-top: 0; }

/* ---------- Ajustes móvil ---------- */
.ts-wave-legend i.cut { width: 14px; height: 14px; border: none; background: rgba(255,255,255,0.12); border-radius: 2px; }
@media (max-width: 575.98px) {
  .navbar .brand-text .tagline { display: none; }
}
@media (max-width: 700px) {
  .ts-hero { padding-top: 7rem; }
  .ts-wave { margin-top: 3rem; }
  .ts-wave svg { height: 150px; }
  .ts-wave svg text { display: none; }
  .ts-wave-legend { gap: 0.6rem 1.2rem; }
  .ts-actions .ts-btn { width: 100%; justify-content: center; }
  .ts-section { padding: 4rem 0; }
}
@media (max-width: 900px) {
  .ts-service { row-gap: 0.4rem; padding: 1.6rem 0; }
  .ts-service h3 { margin-top: 0.9rem; }
}

/* Teléfono móvil bajo los botones del hero */
.ts-hero-alt { margin: 1.1rem 0 0; font-size: 16px; color: #8e9cab; }
.ts-hero-alt a { color: #fff; font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--ts-orange); padding-bottom: 1px; white-space: nowrap; }
.ts-hero-alt a:hover { color: var(--ts-orange); }
@media (max-width: 700px) { .ts-hero-alt { text-align: center; } }

@media (max-width: 575.98px) { .navbar .brand-text strong { font-size: 24px; } .navbar .ts-logo { width: 38px; } }
.navbar .brand-extension:empty { display: none; }

/* Lema en dos líneas (una por frase) a partir de tableta; interlineado algo más abierto
   para que los descendentes (g) no toquen los acentos (í) cuando el texto se parte en móvil */
.ts-hero h1 { line-height: 1.1; max-width: none; font-size: clamp(2.3rem, 1rem + 4.2vw, 4.6rem); }
@media (min-width: 768px) { .ts-hero h1 span { display: block; white-space: nowrap; } }
@media (max-width: 991.98px) { .navbar .brand-text .tagline { display: none; } }

/* ---------- Selector de idioma ---------- */
.navbar .ts-lang {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 0.6rem;
  padding: 3px;
  border: 1px solid var(--ts-line);
  border-radius: 8px;
  align-self: center;
}
.navbar .ts-lang-opt {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ts-steel);
  text-decoration: none;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  line-height: 1;
}
.navbar .ts-lang-opt:hover { color: var(--ts-ink); background: var(--ts-paper); }
.navbar .ts-lang-opt.is-active { background: var(--ts-ink); color: #fff; }
@media (max-width: 991.98px) {
  .navbar .ts-lang { margin: 0.6rem 0 0; align-self: flex-start; display: inline-flex; }
}

/* ---------- Banner de cookies en móvil: botones apilados (los textos en catalán son más largos) ---------- */
@media (max-width: 700px) {
  #cookie-consent-banner .cookie-consent-content { flex-direction: column; align-items: stretch; gap: 0.9rem; }
  #cookie-consent-banner .cookie-consent-buttons { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
  #cookie-consent-banner .cookie-consent-buttons button { width: 100%; margin: 0; }
}
/* Flecha del desplegable en la misma línea que el texto (en móvil el span era display:block) */
.navbar .nav-link span.clearfix { display: inline-block !important; }
