/* ============================================================
   AdSense Legal Pages — Frontend
   Escopo: .alp-legal apenas.
   ============================================================ */

.alp-legal {
    --alp-fg:       #1a1a1a;
    --alp-fg-soft:  #4a4a4a;
    --alp-muted:    #6b7280;
    --alp-bg:       #ffffff;
    --alp-surface:  #f7f8fa;
    --alp-border:   #e3e6ea;
    --alp-accent:   #1a56db;
    --alp-accent-d: #123fa8;

    max-width: 760px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
    color: var(--alp-fg);
    font-size: 1.0625rem;
    line-height: 1.75;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Tipografia ---------- */

.alp-legal h2 {
    font-size: 1.3125rem;
    line-height: 1.35;
    font-weight: 650;
    letter-spacing: -0.011em;
    margin: 2.5rem 0 0.875rem;
    color: var(--alp-fg);
    scroll-margin-top: 5rem;
}

.alp-legal h2:first-of-type { margin-top: 1.5rem; }

.alp-legal h3 {
    font-size: 1.0625rem;
    font-weight: 650;
    margin: 1.75rem 0 0.625rem;
    color: var(--alp-fg);
    scroll-margin-top: 5rem;
}

.alp-legal p {
    margin: 0 0 1.125rem;
    color: var(--alp-fg-soft);
}

.alp-legal strong {
    color: var(--alp-fg);
    font-weight: 650;
}

.alp-legal a {
    color: var(--alp-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color .15s ease;
}

.alp-legal a:hover { color: var(--alp-accent-d); }

.alp-legal a:focus-visible {
    outline: 2px solid var(--alp-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---------- Lede (primeira seção) ---------- */

.alp-legal__lede {
    font-size: 1.0625rem;
    color: var(--alp-fg-soft);
    border-left: 3px solid var(--alp-accent);
    padding-left: 1rem;
    margin: 0 0 2rem;
    font-weight: 400;
}

/* ---------- Listas ---------- */

.alp-legal ul,
.alp-legal ol {
    margin: 0 0 1.25rem;
    padding-left: 1.5rem;
    color: var(--alp-fg-soft);
}

.alp-legal li {
    margin-bottom: 0.5rem;
    padding-left: 0.125rem;
}

.alp-legal li:last-child { margin-bottom: 0; }
.alp-legal ul li::marker { color: var(--alp-muted); }
.alp-legal ol li::marker {
    color: var(--alp-muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- Blockquote ---------- */

.alp-legal blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: var(--alp-surface);
    border-left: 3px solid var(--alp-accent);
    border-radius: 0 6px 6px 0;
    color: var(--alp-fg-soft);
    font-size: 1rem;
}

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

/* ---------- Tabela ---------- */

.alp-table-wrap {
    margin: 1.5rem 0 1.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--alp-border);
    border-radius: 8px;
}

.alp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    min-width: 640px;
}

.alp-table thead { background: var(--alp-surface); }

.alp-table th {
    text-align: left;
    font-weight: 650;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--alp-muted);
    padding: 0.75rem 0.875rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--alp-border);
}

.alp-table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--alp-border);
    color: var(--alp-fg-soft);
    vertical-align: top;
}

.alp-table tbody tr:last-child td { border-bottom: 0; }
.alp-table tbody tr:nth-child(even) { background: #fcfcfd; }

.alp-table td:first-child {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--alp-fg);
    white-space: nowrap;
}

/* ---------- TOC ---------- */

.alp-legal__toc {
    margin: 0 0 2.5rem;
    padding: 1.125rem 1.375rem;
    background: var(--alp-surface);
    border: 1px solid var(--alp-border);
    border-radius: 8px;
    font-size: 0.9375rem;
}

.alp-legal__toc:empty { display: none; }

.alp-legal__toc-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--alp-muted);
    margin-bottom: 0.75rem;
}

.alp-legal__toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: alp-toc;
}

.alp-legal__toc li {
    counter-increment: alp-toc;
    margin-bottom: 0.375rem;
    padding-left: 1.75rem;
    position: relative;
    line-height: 1.5;
}

.alp-legal__toc li::before {
    content: counter(alp-toc) ".";
    position: absolute;
    left: 0;
    color: var(--alp-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
}

.alp-legal__toc a {
    text-decoration: none;
    color: var(--alp-fg-soft);
}

.alp-legal__toc a:hover {
    color: var(--alp-accent);
    text-decoration: underline;
}

/* ---------- Meta da página ---------- */

.alp-legal__meta {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--alp-border);
}

.alp-legal__meta small {
    font-size: 0.8125rem;
    color: var(--alp-muted);
}

/* ---------- Autores ---------- */

.alp-authors {
    display: grid;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.alp-author {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--alp-surface);
    border: 1px solid var(--alp-border);
    border-radius: 8px;
    align-items: start;
}

.alp-author h3 {
    margin: 0 0 0.5rem;
    font-size: 1.0625rem;
    grid-column: 1 / -1;
}

.alp-author__photo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--alp-border);
}

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

.alp-author__bio {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--alp-fg-soft);
    grid-column: 2;
    grid-row: 2 / span 2;
}

.alp-author__bio p:last-child { margin-bottom: 0; }

.alp-author__meta {
    grid-column: 2;
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    font-size: 0.875rem;
    color: var(--alp-muted);
}

.alp-author__meta li { margin-bottom: 0.25rem; }
.alp-author__meta strong { color: var(--alp-fg-soft); }

/* ---------- Botões de preferências ---------- */

.alp-toggle,
.alp-revoke {
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5625rem 1.125rem;
    border-radius: 6px;
    border: 1px solid var(--alp-accent);
    background: #fff;
    color: var(--alp-accent);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.alp-toggle:hover {
    background: var(--alp-accent);
    color: #fff;
}

.alp-toggle[aria-pressed="true"] {
    background: var(--alp-accent);
    color: #fff;
    border-color: var(--alp-accent);
}

.alp-toggle[aria-pressed="true"]::before {
    content: "\2713 ";
}

.alp-revoke {
    border-color: #b91c1c;
    color: #b91c1c;
}

.alp-revoke:hover {
    background: #b91c1c;
    color: #fff;
}

.alp-toggle:focus-visible,
.alp-revoke:focus-visible {
    outline: 2px solid var(--alp-accent);
    outline-offset: 2px;
}

/* ---------- Contact info ---------- */

.alp-contact-info {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.25rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--alp-surface);
    border-radius: 8px;
    font-size: 0.9375rem;
}

.alp-contact-info dt {
    font-weight: 650;
    color: var(--alp-fg);
}

.alp-contact-info dd {
    margin: 0;
    color: var(--alp-fg-soft);
}

/* ---------- Responsivo ---------- */

@media (max-width: 640px) {
    .alp-legal {
        padding: 1.75rem 1rem 3rem;
        font-size: 1rem;
    }

    .alp-legal h2 {
        font-size: 1.1875rem;
        margin-top: 2rem;
    }

    .alp-author {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .alp-author__photo {
        width: 64px;
        height: 64px;
    }

    .alp-author__bio,
    .alp-author__meta {
        grid-column: 1;
        grid-row: auto;
    }

    .alp-legal__toc { padding: 1rem; }

    .alp-contact-info {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .alp-contact-info dt { margin-top: 0.5rem; }
}

/* ---------- Impressão ---------- */

@media print {
    .alp-legal__toc,
    .alp-consent,
    .alp-toggle,
    .alp-revoke { display: none !important; }

    .alp-legal {
        max-width: 100%;
        padding: 0;
        font-size: 11pt;
    }

    .alp-legal a {
        color: #000;
        text-decoration: none;
    }

    .alp-legal a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #555;
        word-break: break-all;
    }

    .alp-table {
        font-size: 9pt;
        min-width: 0;
    }
}

/* ---------- Movimento reduzido ---------- */

@media (prefers-reduced-motion: reduce) {
    .alp-legal *,
    .alp-legal *::before,
    .alp-legal *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   MELHORIAS PROFISSIONAIS — v1.2
   ============================================================ */

.alp-legal {
    font-feature-settings: "kern" 1, "liga" 1;
    text-wrap: pretty;
}

.alp-legal h2 {
    font-size: clamp(1.1875rem, 2.5vw, 1.375rem);
    text-wrap: balance;
}

.alp-legal p { max-width: 68ch; }
.alp-legal table { font-variant-numeric: tabular-nums; }

@media (min-width: 1100px) {
    .alp-legal {
        max-width: 1080px;
        display: grid;
        grid-template-columns: 240px 1fr;
        gap: 3rem;
        align-items: start;
    }

    .alp-legal__toc {
        position: sticky;
        top: 5rem;
        margin: 0;
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
        font-size: 0.875rem;
    }

    .alp-legal__body,
    .alp-legal__meta { grid-column: 2; }
}

.alp-legal__toc a.is-active {
    color: var(--alp-accent);
    font-weight: 600;
}

.alp-legal__toc a.is-active::before {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 0.35em;
    width: 3px;
    height: 1em;
    background: var(--alp-accent);
    border-radius: 2px;
}

.alp-cookie-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0 1rem;
}

.alp-cookie-filter button {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--alp-border);
    border-radius: 999px;
    background: #fff;
    color: var(--alp-fg-soft);
    cursor: pointer;
    transition: all .15s ease;
}

.alp-cookie-filter button:hover {
    border-color: var(--alp-accent);
    color: var(--alp-accent);
}

.alp-cookie-filter button[aria-pressed="true"] {
    background: var(--alp-accent);
    border-color: var(--alp-accent);
    color: #fff;
}

.alp-cookie-count {
    font-size: 0.8125rem;
    color: var(--alp-muted);
    margin: 0 0 0.75rem;
}

.alp-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 3px solid var(--alp-accent);
    background: var(--alp-surface);
    font-size: 0.9375rem;
    line-height: 1.65;
}

.alp-callout--warn {
    border-left-color: #dba617;
    background: #fef9e7;
}

.alp-callout--info {
    border-left-color: var(--alp-accent);
    background: #eff6ff;
}

.alp-callout p:last-child { margin-bottom: 0; }

.alp-contact-form { margin: 1.5rem 0; }

.alp-contact-form input[type="text"],
.alp-contact-form input[type="email"],
.alp-contact-form input[type="tel"],
.alp-contact-form textarea,
.alp-contact-form select {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--alp-border);
    border-radius: 6px;
    background: #fff;
    color: var(--alp-fg);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.alp-contact-form input:focus,
.alp-contact-form textarea:focus,
.alp-contact-form select:focus {
    outline: none;
    border-color: var(--alp-accent);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.alp-contact-form textarea {
    min-height: 140px;
    resize: vertical;
}

.alp-contact-form input[type="submit"],
.alp-contact-form button[type="submit"] {
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.6875rem 1.5rem;
    border: 1px solid var(--alp-accent);
    border-radius: 6px;
    background: var(--alp-accent);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease;
}

.alp-contact-form input[type="submit"]:hover,
.alp-contact-form button[type="submit"]:hover {
    background: var(--alp-accent-d);
}

.alp-contact-fallback {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--alp-surface);
    border-radius: 8px;
    border-left: 3px solid #dba617;
}

.alp-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 120%);
    z-index: 999997;
    background: #1a1a1a;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.alp-toast.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.alp-toast--warn { background: #7a5c00; }

.alp-back-top {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--alp-muted);
    text-decoration: none;
    margin-top: 0.75rem;
}

.alp-back-top:hover { color: var(--alp-accent); }

.alp-legal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
    justify-content: space-between;
}

.alp-legal__meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--alp-muted);
}

.alp-legal a:focus-visible,
.alp-legal button:focus-visible {
    outline: 2px solid var(--alp-accent);
    outline-offset: 3px;
    border-radius: 3px;
}

.alp-legal h2:target { scroll-margin-top: 5rem; }

@media print {
    .alp-legal { display: block; max-width: 100%; }

    .alp-legal__toc,
    .alp-cookie-filter,
    .alp-toast,
    .alp-back-top,
    .alp-contact-form input[type="submit"] {
        display: none !important;
    }

    .alp-legal h2 { page-break-after: avoid; }
    .alp-legal table { page-break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
    .alp-toast { transition: opacity .01ms; }
}