/*
 * Page template — namespace .pd-*
 * Cho static pages (Terms of Service, Privacy Policy, Contact, About, Sitemap, etc.)
 * Layout: 2 cột — Sidebar TOC sticky + Main content. Mobile stack.
 */

.pd {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 0 40px;
    color: #1f2937;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.7;
}

/* ─── HEAD ─── */
.pd__head {
    padding: 28px 32px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 28px;
}
.pd__crumb {
    margin-bottom: 14px;
    font-size: 13px;
}
.pd__title {
    margin: 0 0 12px;
    font-family: "Oswald", "Roboto Condensed", sans-serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.15;
    color: #0f172a;
    letter-spacing: -.5px;
}
.pd__meta {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.pd__meta svg { color: #94a3b8; }
.pd__updated, .pd__reading {
    display: inline-flex; align-items: center; gap: 5px;
}
.pd__sep { color: #cbd5e1; }

/* ─── LAYOUT (2 cột desktop, stack mobile) ─── */
.pd__layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

/* ─── TOC sidebar ─── */
.pd__toc {
    position: sticky;
    top: 96px;        /* dưới header fixed 70 + admin bar 32 */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 18px 8px 18px 18px;
    border-left: 2px solid #e2e8f0;
    font-size: 13px;
}
.pd__toc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: "Roboto Condensed", sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}
.pd__toc-head svg { color: #94a3b8; }
.pd__toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: tocsec;
}
.pd__toc-list li { margin: 4px 0; }
.pd__toc-list a {
    display: block;
    padding: 5px 10px 5px 12px;
    color: #475569;
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -14px;
    border-radius: 0 6px 6px 0;
    transition: color .15s, background .15s, border-color .15s;
    font-size: 13px;
    line-height: 1.4;
}
.pd__toc-list a:hover {
    color: #0f172a;
    background: #f1f5f9;
}
.pd__toc-list a.is-active {
    color: #d90429;
    border-left-color: #d90429;
    background: rgba(217,4,41,.05);
    font-weight: 600;
}
/* Sub-items (h3) thụt vào */
.pd__toc-list .pd__toc-sub {
    padding-left: 14px;
    font-size: 12px;
    color: #64748b;
}

/* ─── CONTENT typography ─── */
.pd__content {
    min-width: 0;
    font-size: 16px;
    color: #334155;
}
.pd__content > *:first-child { margin-top: 0; }
.pd__content > *:last-child { margin-bottom: 0; }

/* Drop-cap optional: uncomment để bật
.pd__content > p:first-of-type::first-letter {
    font-family: "Oswald", serif;
    font-size: 4em;
    line-height: 0.9;
    float: left;
    padding: 4px 12px 0 0;
    color: #d90429;
    font-weight: 600;
}
*/

.pd__content h2,
.pd__content h3,
.pd__content h4 {
    color: #0f172a;
    font-family: "Oswald", "Roboto Condensed", sans-serif;
    font-weight: 600;
    line-height: 1.3;
    scroll-margin-top: 90px;     /* anchor scroll offset cho header fixed */
    position: relative;
}
.pd__content h2 {
    font-size: 26px;
    margin: 36px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}
.pd__content h3 {
    font-size: 20px;
    margin: 28px 0 10px;
}
.pd__content h4 {
    font-size: 17px;
    margin: 22px 0 8px;
}
/* Anchor link icon hover */
.pd__content h2 .pd-anchor,
.pd__content h3 .pd-anchor {
    margin-left: 8px;
    color: #cbd5e1;
    opacity: 0;
    text-decoration: none;
    font-weight: 400;
    transition: opacity .15s, color .15s;
}
.pd__content h2:hover .pd-anchor,
.pd__content h3:hover .pd-anchor { opacity: 1; }
.pd__content h2 .pd-anchor:hover,
.pd__content h3 .pd-anchor:hover { color: #d90429; }

.pd__content p {
    margin: 0 0 16px;
}
.pd__content a {
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(3,105,161,.4);
    transition: color .15s, text-decoration-color .15s;
}
.pd__content a:hover {
    color: #d90429;
    text-decoration-color: #d90429;
}
.pd__content strong, .pd__content b { color: #0f172a; font-weight: 700; }

.pd__content ul,
.pd__content ol {
    margin: 0 0 16px;
    padding-left: 24px;
}
.pd__content li { margin-bottom: 6px; }
.pd__content ul li::marker { color: #d90429; }

.pd__content blockquote {
    margin: 20px 0;
    padding: 14px 20px;
    background: #f8fafc;
    border-left: 4px solid #d90429;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #475569;
}
.pd__content blockquote p:last-child { margin-bottom: 0; }

.pd__content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.pd__content th {
    background: #f1f5f9;
    color: #0f172a;
    text-align: left;
    padding: 10px 14px;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
}
.pd__content td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.pd__content tr:last-child td { border-bottom: 0; }

.pd__content hr {
    margin: 32px 0;
    border: 0;
    border-top: 1px solid #e2e8f0;
}

.pd__content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* Highlight currently-targeted section */
.pd__content :target {
    animation: pdTargetFlash 1.6s ease-out;
}
@keyframes pdTargetFlash {
    0% { background: rgba(217,4,41,.12); }
    100% { background: transparent; }
}

/* ─── Back to top button ─── */
.pd-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #d90429;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    z-index: 100;
    transition: transform .2s, box-shadow .2s, opacity .2s;
}
.pd-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.pd-top[hidden] { display: none; }

/* ─── MOBILE ─── */
@media (max-width: 991px) {
    .pd { padding: 12px 8px 32px; }
    .pd__head {
        padding: 22px 20px 18px;
        margin-bottom: 20px;
    }
    .pd__layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .pd__toc {
        position: static;
        max-height: none;
        margin-bottom: 24px;
        padding: 14px 16px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #f8fafc;
    }
    .pd__content { font-size: 15px; }
    .pd__content h2 { font-size: 22px; margin-top: 28px; }
    .pd__content h3 { font-size: 18px; }
    .pd-top { bottom: 16px; right: 16px; width: 40px; height: 40px; }
}

/* ─── PRINT ─── */
@media print {
    .pd__toc, .pd-top, .pd__crumb { display: none !important; }
    .pd__layout { display: block; }
    .pd__content { font-size: 12pt; color: #000; }
    .pd__content a { color: #000; text-decoration: underline; }
}
