/* ==========================================================================
   Legal pages (privacy-policy.php, cookie-policy.php)
   Document reader: sticky contents with scroll-spy and numbered sections
   (the site header already shows the scroll-progress line).
   ========================================================================== */

/* Header ----------------------------------------------------------------- */

.legal-header {
    position: relative;
    padding: 3rem 0 3.25rem;
    background:
        radial-gradient(40% 120% at 100% 0%, rgba(236, 31, 39, .08) 0%, rgba(236, 31, 39, 0) 70%),
        var(--ph-white);
    border-bottom: 1px solid var(--ph-border);
}

.legal-header__row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.legal-header__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--ph-red-soft);
    color: var(--ph-red-strong);
    font-size: 2rem;
}

.legal-header__title {
    margin: 0;
    font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

/* Layout ----------------------------------------------------------------- */

.legal {
    padding: 4rem 0 6rem;
    background: #fafafa;
}

.legal__grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 4rem;
    align-items: start;
}

/* Contents ----------------------------------------------------------------- */

.legal-toc {
    position: sticky;
    top: calc(var(--ph-header-h) + 32px);
    max-height: calc(100vh - var(--ph-header-h) - 64px);
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 8px;
    box-shadow: var(--ph-shadow-sm);
}

.legal-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: toc;
}

.legal-toc__list li { counter-increment: toc; }

.legal-toc__list a {
    position: relative;
    display: flex;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: 6px;
    color: var(--ph-muted);
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}

.legal-toc__list a::before {
    content: counter(toc, decimal-leading-zero);
    flex-shrink: 0;
    min-width: 1.5rem;
    font-family: var(--ph-font-heading);
    font-size: .78rem;
    font-weight: 700;
    color: #b3b9c4;
    line-height: 1.75;
}

.legal-toc__list a:hover { color: var(--ph-ink); background: #f5f6f8; }

.legal-toc__list a.is-active {
    color: var(--ph-ink);
    background: var(--ph-red-soft);
    font-weight: 600;
}

.legal-toc__list a.is-active::before { color: var(--ph-red-strong); }

/* Document ------------------------------------------------------------------ */

.legal-doc {
    padding: 1rem 3.5rem 2rem;
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 8px;
    box-shadow: 0 30px 60px -45px rgba(13, 17, 23, .4);
    counter-reset: section;
}

.legal-doc__section {
    position: relative;
    padding: 2.5rem 0 2.25rem;
    counter-increment: section;
    scroll-margin-top: calc(var(--ph-header-h) + 24px);
}

.legal-doc__section + .legal-doc__section { border-top: 1px solid var(--ph-border); }

.legal-doc__section h2 {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin: 0 0 1.1rem;
    font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem);
    font-weight: 700;
    letter-spacing: 0;
}

.legal-doc__section h2::before {
    content: counter(section, decimal-leading-zero);
    flex-shrink: 0;
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .08em;
    color: var(--ph-red-strong);
}

.legal-doc__section p {
    margin: 0 0 1rem;
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--ph-body);
}

.legal-doc__section p:last-child { margin-bottom: 0; }

.legal-points {
    display: grid;
    gap: .75rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.legal-points li {
    position: relative;
    padding-block: 1rem 1rem; padding-inline: 3rem 1.25rem;
    border-radius: 6px;
    background: #f7f8fa;
    border: 1px solid var(--ph-border);
    font-size: .98rem;
    line-height: 1.7;
    color: var(--ph-body);
}

.legal-points li::before {
    content: "\F26A"; /* bootstrap-icons check-circle-fill */
    position: absolute;
    inset-inline-start: 1.1rem;
    top: 1.05rem;
    font-family: "bootstrap-icons";
    color: var(--ph-red-strong);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .legal__grid { grid-template-columns: 1fr; gap: 2rem; }
    .legal-toc { position: static; max-height: none; }
    .legal-toc__list a.is-active { background: none; font-weight: 500; color: var(--ph-muted); }
    .legal-toc__list a.is-active::before { color: #b3b9c4; }
    .legal-doc { padding: .5rem 2rem 1.5rem; }
}

@media (max-width: 575.98px) {
    .legal-header { padding: 2rem 0 2.25rem; }
    .legal-header__icon { width: 54px; height: 54px; border-radius: 14px; font-size: 1.5rem; }
    .legal { padding: 2rem 0 4rem; }
    .legal-doc { padding: .25rem 1.25rem 1rem; }
    .legal-doc__section { padding: 1.75rem 0; }
    .legal-doc__section h2 { gap: .65rem; }
    .legal-doc__section p { font-size: .98rem; }
    .legal-points li { padding-block: .9rem .9rem; padding-inline: 2.6rem 1rem; }
    .legal-points li::before { inset-inline-start: .9rem; }
}
