/* Catálogo público OSBLACK. Los tokens de marca vienen de brand.css. */
:root {
  --oro-texto: #76581C;          /* dorado legible sobre blanco y crema */
  --linea: rgba(9, 15, 28, .13);
  --linea-noche: rgba(237, 222, 159, .22);
  --papel: #FFFFFF;
  --alto-buscador: 124px;
}

html.con-hoja { overflow: hidden; }
body { min-height: 100vh; display: flex; flex-direction: column; font-size: 15px; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fino { stroke-width: 1.5; }
[hidden] { display: none !important; }

.ancho { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 14px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.salto { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--os-dorado-claro); color: var(--os-noche); padding: 12px 16px; border-radius: var(--os-radio-sm); font-weight: 600; }
.salto:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--os-dorado); outline-offset: 2px; }
.cabecera :focus-visible, .buscador :focus-visible, .aviso :focus-visible { outline-color: var(--os-dorado-claro); }

/* ---------- Cabecera ---------- */
.cabecera { background: var(--os-noche); color: var(--os-crema); }
.cabecera__fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; }
.marca { display: inline-flex; align-items: center; min-height: 48px; text-decoration: none; }
.marca__logo { height: 36px; width: auto; display: block; }
.marca__texto { font-weight: 700; font-size: 20px; letter-spacing: .16em; color: var(--os-dorado-claro); }
.cabecera__enlaces { display: flex; gap: 2px; font-size: 12.5px; font-weight: 500; }
.cabecera__enlaces a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 7px; color: var(--os-gris-300); text-decoration: underline; text-decoration-color: rgba(198, 198, 198, .4); text-underline-offset: 3px; white-space: nowrap; }
.cabecera__enlaces a:hover { color: var(--os-dorado-claro); }

/* ---------- Franja de la feria ---------- */
.franja { background: var(--os-dorado-claro); color: var(--os-noche); }
.franja__fila { display: flex; align-items: center; gap: 14px; padding-top: 8px; padding-bottom: 8px; }
.franja__stand { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; padding-right: 14px; border-right: 2px solid var(--os-noche); }
.franja__stand span { font-size: 12px; font-weight: 600; }
.franja__stand b { font-size: 36px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.franja__texto { font-size: 13.5px; font-weight: 500; line-height: 1.4; max-width: 46ch; }
.franja__texto strong { font-weight: 700; display: block; font-size: 15px; }

/* ---------- Descargas ---------- */
.utiles { background: var(--os-crema); padding: 8px 0; }
.utiles__fila { display: flex; flex-wrap: wrap; gap: 8px; }
.utiles__fila .boton { flex: 1 1 150px; font-size: 13.5px; padding: 6px 10px; }
.descarga { margin-top: 10px; padding: 12px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--os-radio-sm); }
.descarga__texto { font-size: 13.5px; font-weight: 500; }
.descarga__fila { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
progress { flex: 1; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 5px; background: var(--os-gris-100); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--os-gris-100); }
progress::-webkit-progress-value { background: var(--os-dorado); }
progress::-moz-progress-bar { background: var(--os-dorado); }

/* ---------- Botones ---------- */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--os-toque); padding: 8px 16px; border-radius: var(--os-radio-sm); border: 1.5px solid transparent; background: var(--os-noche); color: var(--os-crema); font-weight: 600; font-size: 14.5px; line-height: 1.2; text-decoration: none; text-align: center; }
.boton--linea { background: transparent; color: var(--os-noche); border-color: var(--os-noche); }
@media (hover: hover) { .boton--linea:hover { background: var(--os-noche); color: var(--os-crema); } }
.boton:disabled { opacity: .55; cursor: default; }
.boton--wa { background: var(--os-whatsapp); color: var(--os-noche); font-weight: 700; }
.boton--wa:hover { filter: brightness(.95); }
.boton--oro { background: var(--os-dorado-claro); color: var(--os-noche); }
.boton--texto { background: transparent; color: var(--os-noche); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.boton--mini { padding: 6px 14px; font-size: 13.5px; }
.boton.es-activo { background: var(--os-noche); color: var(--os-dorado-claro); border-color: var(--os-noche); }

/* ---------- Buscador fijo ---------- */
.buscador { position: sticky; top: 0; z-index: 20; background: var(--os-noche); padding: 8px 0 0; box-shadow: 0 6px 14px -8px rgba(9, 15, 28, .55); }
.buscador__fila { display: flex; gap: 8px; }
.campo { position: relative; flex: 1; min-width: 0; }
.campo__lupa { position: absolute; left: 13px; top: 13px; color: var(--os-gris-700); pointer-events: none; }
.campo input { width: 100%; height: 48px; padding: 0 48px 0 44px; border: 2px solid transparent; border-radius: var(--os-radio-sm); background: var(--os-crema); color: var(--os-noche); font-size: 16px; font-weight: 500; -webkit-appearance: none; appearance: none; }
.campo input::placeholder { color: #5d5c5a; font-weight: 400; }
.campo input::-webkit-search-cancel-button { display: none; }
.campo input:focus { outline: none; border-color: var(--os-dorado); background: var(--papel); }
.campo__limpiar { position: absolute; right: 0; top: 0; width: 48px; height: 48px; display: grid; place-items: center; background: none; border: 0; color: var(--os-gris-700); border-radius: var(--os-radio-sm); }
.btn-sel { position: relative; flex: none; width: 48px; height: 48px; display: grid; place-items: center; background: transparent; border: 1.5px solid var(--linea-noche); border-radius: var(--os-radio-sm); color: var(--os-dorado-claro); }
.btn-sel.tiene { background: var(--os-dorado-claro); color: var(--os-noche); border-color: var(--os-dorado-claro); }
.btn-sel__n { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--os-noche); color: var(--os-dorado-claro); border: 1.5px solid var(--os-dorado-claro); font-size: 12px; font-weight: 700; line-height: 19px; text-align: center; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 10px; margin: 0 -14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: baseline; gap: 7px; min-height: 48px; padding: 0 14px; border-radius: 24px; border: 1.5px solid var(--linea-noche); background: transparent; color: var(--os-crema); font-size: 14px; font-weight: 500; white-space: nowrap; align-items: center; }
.chip b { font-weight: 600; font-size: 12.5px; color: var(--os-dorado-claro); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--os-dorado-claro); border-color: var(--os-dorado-claro); color: var(--os-noche); font-weight: 700; }
.chip[aria-pressed="true"] b { color: var(--os-noche); }
.chip.sin { opacity: .45; }

/* ---------- Aviso de versión ---------- */
.aviso { background: var(--os-noche-2); color: var(--os-crema); border-top: 1px solid var(--linea-noche); position: sticky; top: var(--alto-buscador); z-index: 19; }
.aviso__fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 8px; font-size: 13.5px; font-weight: 500; }

/* ---------- Grilla ---------- */
.principal { flex: 1; padding-top: 12px; padding-bottom: 40px; }
.conteo { font-size: 13.5px; font-weight: 500; color: var(--os-gris-700); min-height: 20px; margin-bottom: 10px; }
/* Mientras llega catalogo.json no se muestra la grilla ni el pie: al aparecer la franja, las descargas y los
   chips todo bajaba de golpe (salto de diseño, CLS 0,84 en Lighthouse). catalogo.js quita la clase al pintar. */
.cargando .principal, .cargando .pie { visibility: hidden; }
.cargando .conteo { visibility: visible; }
.conteo b { color: var(--os-noche); font-weight: 700; }
.grilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#centinela { height: 1px; }

.tarjeta { position: relative; background: var(--papel); border-radius: 6px; border: 1px solid var(--linea); content-visibility: auto; contain-intrinsic-size: auto 250px; }
.tarjeta__abre { display: block; height: 100%; padding-bottom: 10px; color: inherit; text-decoration: none; border-radius: 6px; }
.tarjeta__foto { display: block; aspect-ratio: 1 / 1; padding: 10px; border-radius: 6px 6px 0 0; background: var(--papel); }
.tarjeta__foto img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tarjeta__foto.sin-foto, .ficha__foto.sin-foto { background: var(--os-gris-100) url("../icons/logo-o.webp") center / 34% no-repeat; }
.tarjeta__foto.sin-foto img, .ficha__foto.sin-foto img { visibility: hidden; }
/* La referencia va como la etiqueta del entrepaño: es lo que el ferretero busca primero. */
.tarjeta__ref { display: block; width: -moz-fit-content; width: fit-content; max-width: calc(100% - 16px); margin: -13px 8px 0; padding: 4px 8px; border-radius: 4px; background: var(--os-noche); color: var(--os-dorado-claro); font-size: 13px; font-weight: 700; letter-spacing: .01em; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; position: relative; }
.tarjeta__nombre { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 7px 10px 0; font-size: 12.5px; font-weight: 500; line-height: 1.32; color: var(--os-gris-900); overflow-wrap: anywhere; }
.tarjeta__bulto { display: block; margin: 5px 10px 0; font-size: 12px; font-weight: 600; color: var(--oro-texto); }
.tarjeta__marca { position: absolute; top: 0; right: 0; width: 48px; height: 48px; display: grid; place-items: center; background: none; border: 0; border-radius: 6px; }
.tarjeta__marca::before { content: ""; width: 30px; height: 30px; border-radius: 50%; background: var(--papel); border: 1.5px solid var(--os-noche); box-shadow: 0 1px 4px rgba(9, 15, 28, .16); grid-area: 1 / 1; }
.tarjeta__marca svg { grid-area: 1 / 1; width: 16px; height: 16px; stroke-width: 2.4; color: var(--os-noche); position: relative; }
.tarjeta__marca .si { display: none; }
.tarjeta.marcada { border-color: var(--os-dorado); box-shadow: 0 0 0 1.5px var(--os-dorado); }
.tarjeta.marcada .tarjeta__marca::before { background: var(--os-dorado); border-color: var(--os-dorado); }
.tarjeta.marcada .tarjeta__marca .si { display: block; color: var(--os-noche); }
.tarjeta.marcada .tarjeta__marca .no { display: none; }
@media (hover: hover) { .tarjeta__abre:hover .tarjeta__nombre { text-decoration: underline; text-underline-offset: 2px; } }

.vacio { padding: 36px 8px 20px; text-align: left; max-width: 52ch; }
.vacio__titulo { font-size: 19px; font-weight: 700; margin-bottom: 6px; line-height: 1.25; }
.vacio p { color: var(--os-gris-700); }
.vacio .boton { margin-top: 16px; }

/* ---------- Pie ---------- */
.pie { background: var(--os-noche); color: var(--os-gris-300); padding: 22px 0 28px; font-size: 13px; }
.pie__empresa { color: var(--os-crema); font-weight: 600; font-size: 14px; }
.pie__lineas { margin-top: 2px; }
.pie__enlaces { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 8px; }
.pie__enlaces a { display: inline-flex; align-items: center; min-height: 48px; color: var(--os-dorado-claro); text-underline-offset: 3px; }
.pie__version { margin-top: 4px; font-size: 12px; color: #8d93a0; font-variant-numeric: tabular-nums; }

/* ---------- Hojas (ficha, selección, PDF) ---------- */
dialog.hoja { width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; padding: 0; border: 0; border-radius: 16px 16px 0 0; background: var(--os-crema); color: var(--os-noche); overflow: hidden; }
dialog.hoja[open] { display: flex; flex-direction: column; animation: sube .2s ease-out; }
dialog.hoja::backdrop { background: rgba(9, 15, 28, .62); }
@keyframes sube { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.hoja__cuerpo { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.hoja__cabeza { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; margin: 0 -16px 6px; padding: 4px 4px 4px 16px; background: var(--os-crema); border-bottom: 1px solid var(--linea); }
.hoja__cabeza h2 { font-size: 17px; font-weight: 700; }
.cerrar { width: 48px; height: 48px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: var(--os-noche); }
.hoja__acciones { display: grid; gap: 8px; margin-top: 16px; }

.ficha__foto { position: relative; margin: 0 -16px; background: var(--papel) center / contain no-repeat; aspect-ratio: 1 / 1; max-height: 52vh; width: calc(100% + 32px); display: grid; place-items: center; }
.ficha__foto img { width: 100%; height: 100%; object-fit: contain; padding: 14px; display: block; }
.ficha__cerrar { position: absolute; top: 6px; right: 6px; background: rgba(242, 239, 231, .92); z-index: 2; }
.ficha__datos { padding-top: 14px; }
.ficha__ref { display: inline-block; padding: 5px 11px; border-radius: 5px; background: var(--os-noche); color: var(--os-dorado-claro); font-size: 20px; font-weight: 700; line-height: 1.25; letter-spacing: .01em; overflow-wrap: anywhere; }
.ficha__nombre { margin-top: 10px; font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ficha__tabla { margin: 14px 0 0; display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--linea); font-size: 14px; }
.ficha__tabla dt, .ficha__tabla dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--linea); }
.ficha__tabla dt { color: var(--os-gris-700); padding-right: 18px; }
.ficha__tabla dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ficha__nota { margin-top: 10px; font-size: 12.5px; color: var(--os-gris-700); }
.ficha__dos { display: grid; grid-template-columns: 1.55fr 1fr; gap: 8px; }
.ficha__dos .boton { padding-left: 8px; padding-right: 8px; }

.sel-vacia { padding: 12px 0 8px; color: var(--os-gris-700); max-width: 44ch; }
.sel-lista li { display: grid; grid-template-columns: 56px 1fr 48px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.sel-lista img, .sel-lista .sel-foto { width: 56px; height: 56px; object-fit: contain; background: var(--papel); border-radius: 4px; border: 1px solid var(--linea); }
.sel-lista button.sel-abre { background: none; border: 0; padding: 4px 0; text-align: left; min-height: 48px; min-width: 0; }
.sel-lista b { display: block; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.sel-lista span { display: block; font-size: 12.5px; color: var(--os-gris-700); overflow-wrap: anywhere; line-height: 1.3; }

.pdf-lista li { border-bottom: 1px solid var(--linea); }
.pdf-lista a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 0; text-decoration: none; font-weight: 600; }
.pdf-lista a span { font-weight: 500; font-size: 13px; color: var(--os-gris-700); white-space: nowrap; }
.pdf-lista a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 2147483000; width: max-content; max-width: min(92vw, 420px); padding: 12px 16px; border-radius: var(--os-radio-sm); background: var(--os-noche); color: var(--os-crema); border: 1px solid var(--linea-noche); font-size: 14px; font-weight: 500; text-align: center; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.ver { opacity: 1; transform: translate(-50%, 0); }

.sin-js { padding: 24px 16px; }

/* ---------- Pantallas anchas ---------- */
@media (min-width: 560px) {
  .grilla { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
  .utiles__fila .boton { flex: 0 1 auto; font-size: 14.5px; padding: 8px 16px; }
}
@media (min-width: 760px) {
  body { font-size: 15.5px; }
  .ancho { padding: 0 24px; }
  .chips { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; overflow: visible; }
  .chip { min-height: 44px; }
  .cabecera__enlaces { font-size: 13.5px; gap: 10px; }
  .franja__texto { max-width: none; font-size: 15px; }
  .franja__texto strong { display: inline; font-size: inherit; margin-right: 6px; }
  .buscador__fila { max-width: 640px; }
  .tarjeta__nombre { font-size: 13px; }

  dialog.hoja { width: min(480px, 92vw); margin: auto; border-radius: 14px; max-height: 88vh; }
  dialog.hoja--ficha { width: min(900px, 94vw); }
  .hoja--ficha .hoja__cuerpo { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0 28px; padding: 0 28px 0 0; align-items: stretch; }
  .ficha__foto { margin: 0; width: 100%; max-height: none; aspect-ratio: auto; min-height: 430px; }
  .ficha__foto img { max-height: 520px; }
  .ficha__datos { padding: 28px 0; align-self: center; }
  .ficha__ref { font-size: 24px; }
  .ficha__nombre { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.hoja[open] { animation: none; }
  .toast { transition: none; }
}
