/* ─────────────────────────────────────────────────────────────────────────
 * Hoja de estilos de CONTENIDO compartida (feature 061 — fidelidad visual).
 *
 * Fuente ÚNICA de las reglas globales que estilan los componentes de contenido
 * (Section grid/flex/scroll/overlay, botones de scroll, tablas de Html). La
 * cargan AMBOS frontends (Web.Sitio y Web.Cms) para que el contenido se vea
 * igual en el sitio y en el canvas del editor. Antes vivía duplicada en
 * `Web.Sitio/wwwroot/app.css` y `Web.Cms/wwwroot/app.css` (que divergían).
 *
 * Servida como static web asset de la RCL:
 *   _content/CHESS.PeopleApps.CMSCore.Web.Rendering/css/cms-content.css
 *
 * NO incluye tokens (:root), resets ni chrome propio de cada app (header/footer
 * del sitio, controles de edición del CMS).
 * ───────────────────────────────────────────────────────────────────────── */

.cms-section--grid-flexible {
    --max-column-width: calc(
        (100% / var(--max-columns)) -
        ((var(--max-columns) - 1) * var(--column-gap) / var(--max-columns))
    );
    grid-template-columns: repeat(
        auto-fill,
        minmax(max(var(--min-column-width, 12.5em), var(--max-column-width)), 1fr)
    );
}

/* ── Scroll horizontal de sección ──────────────────────────── */
.cms-section--scroll-x {
    anchor-name: --section;
    anchor-scope: --section;
    overflow-x: scroll;
    display: flex !important; /* override inline display:grid/flex */
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}

.cms-section--scroll-x::-webkit-scrollbar {
    display: none;
}

/* Overlay / tinte de la imagen de fondo del Section (pseudo-elemento, solo sobre el fondo).
   El color y la opacidad llegan como CSS vars inline (--cms-section-overlay-*) desde el renderer.
   Se usa opacity en vez de rgba calculado para no convertir hex→rgba en C#. */
.cms-section--overlay {
    position: relative;
}

.cms-section--overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--cms-section-overlay-color, #000);
    opacity: var(--cms-section-overlay-opacity, 0);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

/* El contenido queda por encima del tinte (sin esto el ::before posicionado taparía a los hijos). */
.cms-section--overlay > * {
    position: relative;
    z-index: 1;
}

/* Hijos de scroll — no aplica a los botones de navegación */
.cms-section--scroll-x > *:not(.cms-scroll-btn),
.cms-section--scroll-x > .cms-stack > *:not(.cms-scroll-btn) {
    flex: 0 0 max-content;
    width: max-content;
    scroll-snap-align: start;
}

/* Botones HTML de navegación */
.cms-scroll-btn {
    position: absolute;
    position-anchor: --section;
    margin-inline: 0.5em;
    flex-shrink: 0;
    background-color: #ffffff;
    cursor: pointer;
    border-radius: 100%;
    height: 42px;
    width: 42px;
    border: none;
    box-shadow: 0px 0px 9px 0px rgb(0 0 0 / 18%);
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: none;
    padding: 0;
}

/* Botón izquierda: sticky al borde izquierdo, primero en orden flex */
.cms-scroll-btn--left {
    position-area: left center;
    animation: cms-scroll-show-left linear both;
    animation-timeline: scroll(inline nearest);
    animation-range: 0px 50px;
}

@keyframes cms-scroll-show-left {
    from { opacity: 0; pointer-events: none; }
    to   { opacity: 1; pointer-events: auto; }
}

/* Botón derecha: sticky al borde derecho, último en orden flex */
.cms-scroll-btn--right {
    position-area: right center;
    animation: cms-scroll-hide-right linear both;
    animation-timeline: scroll(inline nearest);
    animation-range: calc(100% - 50px) 100%;
}

@keyframes cms-scroll-hide-right {
    from { opacity: 1; pointer-events: auto; }
    to   { opacity: 0; pointer-events: none; }
}

/* Unifica los bordes para evitar líneas dobles */
.cms-html table {
  width: 100%;
  border-collapse: collapse;
  font-family: sans-serif;
  margin: 20px 0;
}

/* Añade espacio y un borde gris suave a las celdas */
.cms-html table th,
.cms-html table td {
  padding: 10px 12px;
  border: 1px solid #ddd;
  text-align: left;
}

/* Da color de fondo y contraste a los encabezados */
.cms-html table th {
  background-color: #f4f4f4;
  color: #333;
  font-weight: bold;
}

/* Opcional: añade un tono gris claro al pasar por las filas */
.cms-html table tbody tr:hover {
  background-color: #f9f9f9;
}

.ql-snow .ql-tooltip{
    z-index: 2;
}

.cms-html p {
    min-height: 1em;
}

/* ── Índice lateral del Carousel (IndexEnabled) ──────────────────────────────
 * Compartido sitio↔canvas (feature 061): el sitio lo usa en CarouselRenderer y
 * el canvas del CMS en CarouselCanvasEditor. Antes vivía scoped en
 * CarouselRenderer.razor.css (no llegaba al canvas). La flecha decorativa
 * (::before con anchor-positioning) sigue scoped en el sitio. */
.cms-carousel__layout--index {
    display: flex;
    align-items: flex-start;
    gap: 0;
}
.cms-carousel__layout--index > .carousel {
    flex: 1 1 55%;
    min-width: 0;
}
.cms-carousel__index {
    flex: 1 1 45%;
    min-width: 0;
    box-sizing: border-box;
    padding: 24px 32px;
    overflow-y: auto;
}
.cms-carousel__index.carousel-size-pequeno { max-height: 320px; }
.cms-carousel__index.carousel-size-estandar { max-height: 480px; }
.cms-carousel__index.carousel-size-grande { max-height: 640px; }

.cms-carousel__index-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cms-carousel__index-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 14px 0;
    cursor: pointer;
    color: inherit;
    font-family: "Montserrat", sans-serif;
    font-size: 1rem;
    line-height: 1.4;
}
.cms-carousel__index-item:hover { text-decoration: underline; }
.cms-carousel__index-item.active { font-weight: 700; }

@media (max-width: 767.98px) {
    .cms-carousel__layout--index { flex-direction: column; }
    .cms-carousel__layout--index > .carousel { flex-basis: auto; width: 100%; }
    .cms-carousel__index { flex-basis: auto; width: 100%; }
    .cms-carousel__index.carousel-size-pequeno { max-height: 200px; }
    .cms-carousel__index.carousel-size-estandar { max-height: 280px; }
    .cms-carousel__index.carousel-size-grande { max-height: 360px; }
}
