/* ============================================================
   LegalCheck — Documento legal (Términos, Políticas)
   Alcance: body.lc-legal. El resto del sitio queda intacto.

   Estructura: masthead oscuro + rejilla de dos columnas
   (índice sticky + cuerpo con medida de línea controlada),
   al estilo de las páginas legales de producto.
   ============================================================ */

.lc-legal {
    --ink: #0a0a0a;
    --ink-soft: #22262b;
    --body-ink: #3d4148;
    --muted: #71757d;
    --muted-soft: #9a9ea6;

    --paper: #ffffff;
    --canvas: #f6f6f3;
    --cream: #f2f4ee;
    --moss: #0f1715;
    --moss-soft: #17211e;

    --lime: #c9fe6e;
    --lime-deep: #a8e051;
    --lime-ink: #4a7c00;
    --lime-wash: #f4fce6;

    --rule: rgba(10, 10, 10, 0.09);
    --rule-strong: rgba(10, 10, 10, 0.16);
    --rule-dark: rgba(255, 255, 255, 0.13);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    /* Alto del header fijo + aire, para anclas y sticky */
    --nav-offset: 104px;

    background: var(--canvas);
    color: var(--body-ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.7;
    letter-spacing: -0.003em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* El degradado radial global compite con el papel del documento */
.lc-legal::before {
    background-image: none !important;
}

html:has(body.lc-legal) {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html:has(body.lc-legal) {
        scroll-behavior: auto;
    }
}

/* ===== Barra de progreso de lectura =============================== */

.lc-legal .lc-progress {
    position: fixed;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1080;
    pointer-events: none;
}

.lc-legal .lc-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--lime-deep), var(--lime));
    transform-origin: left center;
    transition: width 0.08s linear;
}

/* ===== Masthead =================================================== */

.lc-legal .lc-doc-masthead {
    position: relative;
    background: var(--moss);
    color: #f4f6f2;
    overflow: hidden;
    isolation: isolate;
}

.lc-legal .lc-doc-masthead::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(70% 120% at 88% -10%, rgba(201, 254, 110, 0.16) 0%, transparent 58%),
        radial-gradient(50% 90% at 0% 110%, rgba(201, 254, 110, 0.07) 0%, transparent 60%);
    z-index: -1;
}

/* Trama fina: da textura sin ruido visual */
.lc-legal .lc-doc-masthead::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
    mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
    z-index: -1;
}

.lc-legal .lc-doc-masthead-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 78px 32px 68px;
}

.lc-legal .lc-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 26px;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
    color: rgba(244, 246, 242, 0.55);
}

.lc-legal .lc-crumb a {
    color: rgba(244, 246, 242, 0.72);
    text-decoration: none;
    transition: color 0.2s ease;
}

.lc-legal .lc-crumb a:hover {
    color: var(--lime);
}

.lc-legal .lc-crumb li + li::before {
    content: "/";
    margin-right: 8px;
    color: rgba(244, 246, 242, 0.3);
}

.lc-legal .lc-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime);
    margin: 0 0 20px;
}

.lc-legal .lc-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 4px rgba(201, 254, 110, 0.15);
}

.lc-legal .lc-doc-title {
    font-size: clamp(2.2rem, 5.2vw, 3.5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: #fbfdf8;
    margin: 0 0 18px;
    max-width: 18ch;
}

.lc-legal .lc-doc-standfirst {
    font-size: clamp(1rem, 1.6vw, 1.12rem);
    line-height: 1.6;
    color: rgba(244, 246, 242, 0.66);
    max-width: 52ch;
    margin: 0 0 34px;
}

.lc-legal .lc-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 30px;
    padding: 0;
    list-style: none;
}

.lc-legal .lc-doc-meta li {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--rule-dark);
    border-radius: 999px;
    font-size: 0.82rem;
    color: rgba(244, 246, 242, 0.88);
    background: rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(2px);
}

.lc-legal .lc-doc-meta b {
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(244, 246, 242, 0.45);
}

.lc-legal .lc-doc-meta strong {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.lc-legal .lc-doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.lc-legal .lc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.lc-legal .lc-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.lc-legal .lc-btn-primary {
    background: var(--lime);
    color: #0a0a0a;
}

.lc-legal .lc-btn-primary:hover {
    background: #dbffa0;
    transform: translateY(-1px);
}

.lc-legal .lc-btn-ghost {
    background: transparent;
    color: rgba(244, 246, 242, 0.9);
    border-color: var(--rule-dark);
}

.lc-legal .lc-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

/* ===== Rejilla del documento ====================================== */

.lc-legal .lc-doc-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 32px 120px;
}

.lc-legal .lc-doc-grid {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 72px;
    align-items: start;
}

/* ===== Índice lateral ============================================= */

.lc-legal .lc-toc {
    position: sticky;
    top: var(--nav-offset);
    padding: 44px 0 24px;
    max-height: calc(100vh - var(--nav-offset) - 24px);
    display: flex;
    flex-direction: column;
}

.lc-legal .lc-toc-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted-soft);
    margin: 0 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
}

.lc-legal .lc-toc-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
}

.lc-legal .lc-toc-list::-webkit-scrollbar {
    width: 4px;
}

.lc-legal .lc-toc-list::-webkit-scrollbar-thumb {
    background: var(--rule-strong);
    border-radius: 4px;
}

.lc-legal .lc-toc-link {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 4px;
    padding: 6px 0 6px 12px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    font-size: 0.845rem;
    line-height: 1.42;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.lc-legal .lc-toc-link span {
    font-variant-numeric: tabular-nums;
    color: var(--muted-soft);
    transition: color 0.18s ease;
}

.lc-legal .lc-toc-link:hover {
    color: var(--ink);
    border-left-color: var(--rule-strong);
}

.lc-legal .lc-toc-link.is-active {
    color: var(--ink);
    font-weight: 700;
    border-left-color: var(--lime-deep);
}

.lc-legal .lc-toc-link.is-active span {
    color: var(--lime-ink);
}

/* Índice colapsable en móvil */
.lc-legal .lc-toc-mobile {
    display: none;
    margin: 28px 0 0;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.lc-legal .lc-toc-mobile > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.lc-legal .lc-toc-mobile > summary::-webkit-details-marker {
    display: none;
}

.lc-legal .lc-toc-mobile > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.22s ease;
}

.lc-legal .lc-toc-mobile[open] > summary::after {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.lc-legal .lc-toc-mobile .lc-toc-list {
    padding: 4px 20px 20px;
    max-height: 52vh;
}

/* ===== Cuerpo del documento ======================================= */

.lc-legal .lc-doc-body {
    padding: 44px 0 0;
    max-width: 72ch;
}

.lc-legal .lc-doc-lead {
    font-size: 1.06rem;
    line-height: 1.68;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    padding: 26px 28px;
    margin: 0 0 8px;
}

.lc-legal .lc-doc-lead p {
    margin: 0;
}

.lc-legal .lc-doc-lead p + p {
    margin-top: 12px;
}

.lc-legal .lc-doc-section {
    padding: 56px 0 4px;
    scroll-margin-top: var(--nav-offset);
    border-top: 1px solid var(--rule);
}

.lc-legal .lc-doc-section:first-of-type {
    border-top: 0;
}

.lc-legal .lc-doc-section-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin: 0 0 26px;
}

.lc-legal .lc-doc-num {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    color: var(--lime-ink);
    background: var(--lime-wash);
    border-radius: 7px;
    padding: 5px 9px;
    line-height: 1;
    transform: translateY(-3px);
}

.lc-legal .lc-doc-section h2 {
    font-size: clamp(1.35rem, 2.4vw, 1.62rem);
    font-weight: 800;
    line-height: 1.22;
    letter-spacing: -0.028em;
    color: var(--ink);
    margin: 0;
}

.lc-legal .lc-anchor {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--muted-soft);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.18s ease, color 0.18s ease;
}

.lc-legal .lc-doc-section-head:hover .lc-anchor,
.lc-legal .lc-anchor:focus-visible {
    opacity: 1;
}

.lc-legal .lc-anchor:hover {
    color: var(--lime-ink);
}

.lc-legal .lc-doc-section h3 {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.012em;
    color: var(--ink);
    margin: 36px 0 12px;
}

.lc-legal .lc-doc-section h3:first-of-type {
    margin-top: 4px;
}

.lc-legal .lc-doc-section p {
    margin: 0 0 16px;
}

.lc-legal .lc-doc-section a:not(.lc-anchor):not(.lc-btn) {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--lime-deep);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.lc-legal .lc-doc-section a:not(.lc-anchor):not(.lc-btn):hover {
    background: var(--lime-wash);
}

.lc-legal .lc-doc-section strong {
    color: var(--ink-soft);
    font-weight: 700;
}

/* Listas con viñeta propia (guion corto en lima) */
.lc-legal .lc-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
}

.lc-legal .lc-list li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 11px;
}

.lc-legal .lc-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.72em;
    width: 11px;
    height: 2px;
    border-radius: 2px;
    background: var(--lime-deep);
}

/* Definiciones (sección 3) */
.lc-legal .lc-defs {
    margin: 0 0 8px;
    border-top: 1px solid var(--rule);
}

.lc-legal .lc-defs > div {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 8px 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
}

.lc-legal .lc-defs dt {
    font-weight: 700;
    color: var(--ink);
    line-height: 1.5;
}

.lc-legal .lc-defs dd {
    margin: 0;
    color: var(--body-ink);
}

/* Nota destacada */
.lc-legal .lc-note {
    display: flex;
    gap: 14px;
    background: var(--lime-wash);
    border: 1px solid #e2f2c4;
    border-left: 3px solid var(--lime-deep);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin: 0 0 20px;
}

.lc-legal .lc-note svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: var(--lime-ink);
    transform: translateY(3px);
}

.lc-legal .lc-note p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.62;
    color: var(--ink-soft);
}

/* Cierre: tarjeta de contacto */
.lc-legal .lc-doc-colophon {
    margin-top: 64px;
    background: var(--moss);
    color: rgba(244, 246, 242, 0.72);
    border-radius: var(--radius-lg);
    padding: 34px 36px;
}

.lc-legal .lc-doc-colophon h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fbfdf8;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
}

.lc-legal .lc-doc-colophon p {
    margin: 0 0 4px;
    font-size: 0.92rem;
    line-height: 1.65;
}

.lc-legal .lc-doc-colophon a {
    color: var(--lime);
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 254, 110, 0.35);
    transition: border-color 0.2s ease;
}

.lc-legal .lc-doc-colophon a:hover {
    border-bottom-color: var(--lime);
}

.lc-legal .lc-doc-colophon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 26px;
    margin-top: 22px;
    padding-top: 24px;
    border-top: 1px solid var(--rule-dark);
}

.lc-legal .lc-doc-colophon-grid h3 {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(244, 246, 242, 0.4);
    margin: 0 0 8px;
}

/* ===== Volver arriba ============================================== */

.lc-legal .lc-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 17px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 600;
    box-shadow: 0 8px 26px -8px rgba(10, 10, 10, 0.22);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.lc-legal .lc-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lc-legal .lc-top:hover {
    background: var(--ink);
    color: var(--lime);
    border-color: var(--ink);
}

.lc-legal .lc-top svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

/* ===== Responsive ================================================= */

@media (max-width: 1099.98px) {
    .lc-legal .lc-doc-grid {
        gap: 48px;
    }

    .lc-legal .lc-doc-grid {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 991.98px) {
    .lc-legal .lc-doc-masthead-inner {
        padding: 56px 24px 48px;
    }

    .lc-legal .lc-doc-shell {
        padding: 0 24px 90px;
    }

    .lc-legal .lc-doc-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .lc-legal .lc-toc {
        display: none;
    }

    .lc-legal .lc-toc-mobile {
        display: block;
    }

    .lc-legal .lc-doc-body {
        padding-top: 20px;
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .lc-legal {
        font-size: 16px;
    }

    .lc-legal .lc-doc-masthead-inner {
        padding: 42px 20px 40px;
    }

    .lc-legal .lc-doc-shell {
        padding: 0 20px 70px;
    }

    .lc-legal .lc-doc-title {
        max-width: none;
    }

    .lc-legal .lc-doc-actions .lc-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .lc-legal .lc-doc-section {
        padding-top: 44px;
    }

    .lc-legal .lc-doc-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .lc-legal .lc-doc-num {
        transform: none;
    }

    .lc-legal .lc-doc-lead {
        padding: 22px 20px;
    }

    .lc-legal .lc-defs > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .lc-legal .lc-doc-colophon {
        padding: 26px 22px;
    }

    .lc-legal .lc-top {
        right: 16px;
        bottom: 16px;
    }
}

/* ===== Impresión / guardar como PDF =============================== */

@media print {
    .lc-legal {
        font-size: 10.5pt;
        line-height: 1.5;
        background: #fff;
        color: #000;
        padding-top: 0 !important;
    }

    .lc-legal header,
    .lc-legal footer,
    .lc-legal .lc-progress,
    .lc-legal .lc-toc,
    .lc-legal .lc-toc-mobile,
    .lc-legal .lc-top,
    .lc-legal .lc-doc-actions,
    .lc-legal .lc-crumb,
    .lc-legal .lc-anchor {
        display: none !important;
    }

    .lc-legal .lc-doc-masthead {
        background: #fff !important;
        color: #000;
        border-bottom: 2pt solid #000;
    }

    .lc-legal .lc-doc-masthead::before,
    .lc-legal .lc-doc-masthead::after {
        display: none;
    }

    .lc-legal .lc-doc-masthead-inner {
        padding: 0 0 16pt;
    }

    .lc-legal .lc-eyebrow,
    .lc-legal .lc-doc-title,
    .lc-legal .lc-doc-standfirst {
        color: #000;
    }

    .lc-legal .lc-doc-meta li {
        border-color: #999;
        color: #000;
        background: none;
    }

    .lc-legal .lc-doc-meta b {
        color: #555;
    }

    .lc-legal .lc-doc-shell {
        max-width: none;
        padding: 0;
    }

    .lc-legal .lc-doc-grid {
        display: block;
    }

    .lc-legal .lc-doc-body {
        max-width: none;
        padding: 0;
    }

    .lc-legal .lc-doc-section {
        padding: 14pt 0 0;
        break-inside: auto;
    }

    .lc-legal .lc-doc-section-head,
    .lc-legal .lc-doc-section h3 {
        break-after: avoid;
    }

    .lc-legal .lc-doc-num {
        background: none;
        color: #000;
        padding: 0;
    }

    .lc-legal .lc-note,
    .lc-legal .lc-doc-lead {
        background: none;
        border: 1pt solid #bbb;
        break-inside: avoid;
    }

    .lc-legal .lc-doc-colophon {
        background: none !important;
        color: #000;
        border: 1pt solid #999;
        break-inside: avoid;
    }

    .lc-legal .lc-doc-colophon h2,
    .lc-legal .lc-doc-colophon a,
    .lc-legal .lc-doc-colophon-grid h3 {
        color: #000;
    }
}
