/* =========================================================
   CATÁLOGO DE TELAS — librito interactivo (productos Portantino)
   Lo dibuja catalogo-telas.js dentro de <section id="catalogoTelas">,
   que agrega product_page.js solo en sillas y sillones de Portantino.
   Las páginas escalan con su propio ancho (unidades cqw/cqh).
   ========================================================= */

.catalogo-telas {
  --ct-azul: var(--azul-principal, #0f2b73);
  --ct-azul-2: var(--azul-secundario, #2157AE);
  --ct-rojo: var(--rojo-secundario, #A31130);
  --ct-texto: var(--texto-principal, #17141f);
  --ct-texto-2: var(--texto-secundario, #595766);
  --ct-serif: Georgia, "Times New Roman", serif;

  margin: 56px 0 8px;
  padding-top: 40px;
  border-top: 1px solid var(--borde-suave, #e5e5e5);
}

/* ---------- Encabezado de la sección ---------- */

.ct-head {
  max-width: 640px;
  margin: 0 auto 24px;
  text-align: center;
}

.ct-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin: 0 0 10px;
  font-family: var(--ct-serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ct-rojo);
}

.ct-kicker::before,
.ct-kicker::after {
  content: "";
  width: 44px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.ct-head h2 {
  margin: 0 0 10px;
  font-family: var(--ct-serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
  color: var(--ct-texto);
}

.ct-lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ct-texto-2);
}

/* ---------- Escenario del libro ---------- */

.ct-stage {
  container-type: inline-size;
  padding: 32px 24px 22px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 40%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    #eef0f5;
}

.ct-book {
  width: 100%;
  margin: 0 auto;
  min-width: 0 !important; /* page-flip pone un min-width en línea; acá manda el contenedor */
}

.ct-book.is-loading {
  max-width: 1040px;
  aspect-ratio: 960 / 617;
  border-radius: 4px;
  background: #e3e6ee;
  display: grid;
  place-items: center;
  color: var(--ct-texto-2);
  font-size: 14px;
}

@container (max-width: 679px) {
  .ct-book { max-width: 520px !important; }
  .ct-book.is-loading { aspect-ratio: 480 / 617; }
}

/* Si page-flip no carga: muestras en grilla, sin efecto de libro */
.ct-book.is-fallback {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1040px;
}
.ct-book.is-fallback .ct-page {
  position: relative;
  aspect-ratio: 480 / 617;
  box-shadow: 0 1px 3px rgba(15, 43, 115, 0.10);
}

/* Tapa y contratapa centradas en apaisado (catalogo-telas.js pone data-shift) */
.ct-book.ct-anim .stf__block {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.ct-book[data-shift="cover"] .stf__block { transform: translateX(-25%); }
.ct-book[data-shift="back"] .stf__block { transform: translateX(25%); }

@media (prefers-reduced-motion: reduce) {
  .ct-book.ct-anim .stf__block { transition: none; }
}

.ct-book .stf__item {
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 43, 115, 0.10);
}

/* Lomo: sombra suave hacia el centro del libro abierto */
.ct-book .--left .ct-in::after,
.ct-book .--right .ct-in::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7cqw;
  pointer-events: none;
}
.ct-book .--left .ct-in::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0));
}
.ct-book .--right .ct-in::after {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0));
}
.ct-book .stf__wrapper.--portrait .ct-in::after,
.ct-book .--hard .ct-in::after { display: none; }

/* ---------- Página (base) ---------- */

.ct-page {
  container-type: size;
  background: #fff;
}

.ct-in {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  color: var(--ct-texto);
  font-family: "Roboto", Arial, sans-serif;
}

.ct-in img {
  display: block;
  max-width: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* Raya + texto en cursiva bordó, como "MUEBLES DE OFICINA" del logo */
.ct-rule {
  display: flex;
  align-items: center;
  gap: 2.2cqw;
  font-family: var(--ct-serif);
  font-style: italic;
  font-size: max(9px, 2.4cqw);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ct-rojo);
  white-space: nowrap;
}
.ct-rule::before,
.ct-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ct-texto);
  opacity: 0.35;
}
.ct-rule::before { flex: 0 0 7cqw; }

/* ---------- Tapa ---------- */

.ct-cover .ct-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6.5cqh;
}

.ct-cover__logo {
  flex: 0 0 auto;
  width: 62cqw;
  height: auto;
}

.ct-cover__title {
  margin-top: 3.6cqh;
  font-family: var(--ct-serif);
  font-size: 8.4cqw;
  line-height: 1;
  color: var(--ct-texto-2);
}

.ct-cover .ct-rule {
  width: 72cqw;
  margin-top: 2.2cqh;
}

.ct-cover__photo {
  flex: 1 1 auto;
  min-height: 0;
  align-self: stretch;
  margin: 3.4cqh 7cqw;
  overflow: hidden;
}

.ct-cover__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}

.ct-cover__foot {
  flex: 0 0 7.5cqh;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.4cqw;
  background: var(--ct-azul);
  border-top: 0.7cqw solid var(--ct-rojo);
  color: #fff;
  font-size: max(9px, 2.5cqw);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.ct-cover__foot i {
  width: 1cqw;
  height: 1cqw;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- Página de ambiente (izquierda) ---------- */

.ct-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 13cqw;
  background: var(--ct-azul);
  border-right: 0.7cqw solid var(--ct-rojo);
}

.ct-band__txt {
  position: absolute;
  left: 50%;
  bottom: 15cqh;
  transform: translateX(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  white-space: nowrap;
  color: #fff;
  font-size: max(9px, 2.5cqw);
  letter-spacing: 0.04em;
  opacity: 0.92;
}

.ct-band__icon {
  position: absolute;
  left: 50%;
  bottom: 4.5cqh;
  transform: translateX(-50%);
  width: 8.4cqw;
  height: 8.4cqw;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
}

.ct-band__icon img {
  width: auto;
  height: 5.6cqw;
}

.ct-amb__body {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 13.7cqw;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7cqh 7cqw 0;
}

.ct-amb__num {
  font-family: var(--ct-serif);
  font-style: italic;
  font-size: max(11px, 3.6cqw);
  color: var(--ct-rojo);
}

.ct-amb__name {
  margin-top: 0.6cqh;
  font-family: var(--ct-serif);
  font-size: 9cqw;
  line-height: 1;
  color: var(--ct-texto);
}

.ct-amb__body .ct-rule {
  width: 58cqw;
  margin-top: 2.2cqh;
}

.ct-amb__photo {
  margin-top: auto;
  margin-bottom: auto;
  width: min(62cqw, 52cqh);
  aspect-ratio: 1;
  border-radius: 50%;
  outline: 0.5cqw solid var(--ct-rojo);
  outline-offset: 1.6cqw;
  overflow: hidden;
  background: #eef0f5;
}

.ct-amb__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ct-amb__note {
  position: absolute;
  left: 21cqw;
  bottom: 3.4cqh;
  font-size: max(8px, 1.8cqw);
  color: var(--ct-texto-2);
  opacity: 0.8;
}

/* ---------- Página de muestras (derecha) ---------- */

.ct-sw .ct-in::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4.6cqw;
  background: var(--ct-azul);
  border-left: 0.7cqw solid var(--ct-rojo);
}

.ct-sw__head {
  position: absolute;
  top: 6cqh;
  left: 8cqw;
  right: 13cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ct-sw__title {
  margin: 0;
  font-family: var(--ct-serif);
  font-weight: 400;
  font-size: 8.4cqw;
  line-height: 1;
  color: var(--ct-texto);
}

.ct-sw__head .ct-rule {
  width: 100%;
  margin-top: 2cqh;
}

.ct-sw__grid {
  position: absolute;
  top: 21cqh;
  bottom: 4cqh;
  left: 8cqw;
  right: 13cqw;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 2cqh 6cqw;
}

.ct-sw__item {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1cqh;
  cursor: zoom-in;
  border-radius: 1.6cqw;
  -webkit-tap-highlight-color: transparent;
}

/* page-flip solo deja pasar el clic si el destino es el <button> mismo */
.ct-sw__item > * { pointer-events: none; }

.ct-sw__chip {
  width: min(23cqw, 13cqh);
  aspect-ratio: 1;
  border-radius: 1.6cqw;
  overflow: hidden;
  background: #eef0f5;
  box-shadow:
    0 0 0 1px rgba(23, 20, 31, 0.08),
    0 0.6cqw 1.6cqw rgba(15, 43, 115, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ct-sw__chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ct-sw__label {
  font-size: max(10px, 2.9cqw);
  line-height: 1.2;
  color: var(--ct-texto-2);
  text-align: center;
}

@media (hover: hover) {
  .ct-sw__item:hover .ct-sw__chip {
    transform: translateY(-2px) scale(1.04);
    box-shadow:
      0 0 0 1px rgba(23, 20, 31, 0.08),
      0 1cqw 2.6cqw rgba(15, 43, 115, 0.24);
  }
  .ct-sw__item:hover .ct-sw__label { color: var(--ct-texto); }
}

.ct-sw__item:focus-visible .ct-sw__chip {
  outline: 2px solid var(--ct-azul-2);
  outline-offset: 3px;
}

/* ---------- Contratapa ---------- */

.ct-back .ct-in {
  display: flex;
  flex-direction: column;
}

.ct-back__top {
  flex: 0 0 31cqh;
  display: grid;
  place-items: center;
  padding: 0 10cqw;
}

.ct-back__top img {
  width: 62cqw;
  height: auto;
}

.ct-back__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6cqh 9cqw 4cqh;
  background: var(--ct-azul);
  border-top: 0.7cqw solid var(--ct-rojo);
  color: #fff;
}

.ct-back__lead {
  margin: 0;
  font-family: var(--ct-serif);
  font-size: 6.4cqw;
  line-height: 1.15;
}

.ct-back__text {
  margin: 2cqh 0 0;
  max-width: 66cqw;
  font-size: max(11px, 3.1cqw);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.ct-back__wa {
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  margin-top: 4cqh;
  padding: 2.4cqw 5cqw;
  border-radius: 999px;
  background: #fff;
  color: var(--ct-azul) !important;
  font-weight: 700;
  font-size: max(11px, 3.1cqw);
  text-decoration: none;
  box-shadow: 0 0.8cqw 2.4cqw rgba(0, 0, 0, 0.25);
}

.ct-back__wa > * { pointer-events: none; }
.ct-back__wa img { width: 4.6cqw; height: 4.6cqw; }

.ct-back__info {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8cqh;
  font-size: max(10px, 2.6cqw);
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.8);
}

.ct-back__legal {
  margin: 3cqh 0 0;
  font-size: max(8px, 1.9cqw);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- Controles ---------- */

.ct-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1040px;
  margin: 22px auto 0;
}

.ct-arrow {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #cfd4e2;
  border-radius: 50%;
  background: #fff;
  color: var(--ct-azul);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.ct-arrow:hover:not(:disabled) {
  border-color: var(--ct-azul);
  background: #f4f6fb;
}

.ct-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.ct-tabs {
  flex: 1;
  display: flex;
  gap: 8px;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.ct-tabs::-webkit-scrollbar { display: none; }

.ct-tabs.is-scroll {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}

.ct-tab {
  flex: 0 0 auto;
  padding: 9px 15px;
  border: 1px solid #cfd4e2;
  border-radius: 999px;
  background: #fff;
  color: var(--ct-texto-2);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ct-tab:hover { border-color: var(--ct-azul); color: var(--ct-azul); }

.ct-tab.is-active {
  background: var(--ct-azul);
  border-color: var(--ct-azul);
  color: #fff;
}

.ct-hint {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ct-texto-2);
}

@media (max-width: 680px) {
  .catalogo-telas { margin-top: 40px; padding-top: 30px; }
  .ct-head h2 { font-size: 26px; }
  .ct-lead { font-size: 14px; }
  .ct-stage { padding: 18px 10px 14px; border-radius: 14px; }
  .ct-controls { gap: 6px; margin-top: 16px; }
  .ct-tabs { justify-content: flex-start; }
  .ct-arrow { width: 38px; height: 38px; }
  .ct-tab { padding: 8px 13px; font-size: 13px; }
}

/* ---------- Muestra ampliada ---------- */

.ct-lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 18, 40, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.ct-lb[hidden] { display: none; }

.ct-lb__card {
  position: relative;
  width: min(380px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-family: "Roboto", Arial, sans-serif;
}

.ct-lb__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--texto-secundario, #595766);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ct-lb__close:hover { background: #f1f2f6; }

.ct-lb__img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #eef0f5;
}

.ct-lb__tela {
  margin: 16px 0 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--rojo-secundario, #A31130);
}

.ct-lb__color {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 26px;
  color: var(--texto-principal, #17141f);
}

.ct-lb__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
}

.ct-lb__chip {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(23, 20, 31, 0.12);
}

.ct-lb__chip img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ct-lb__chip.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--azul-principal, #0f2b73);
}

.ct-lb__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #1a8f4c;
  color: #fff !important;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

.ct-lb__wa:hover { background: #157a40; }
.ct-lb__wa img { width: 20px; height: 20px; }

.ct-lb__note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--texto-secundario, #595766);
}

body.ct-lb-open { overflow: hidden; }
