/* ==========================================================================
   Legal Pages Styling (Modern Minimalist Redesign)
   ========================================================================== */

.legal-layout {
    max-width: 95% !important;
    margin: 0 auto;
    padding-bottom: var(--sw-space-4xl);
    margin-top: 0;
}

@media (max-width: 1200px) {
    .legal-layout {
        max-width: 92% !important;
    }
}

@media (max-width: 768px) {
    .legal-layout {
        max-width: 100% !important;
        padding-inline: 16px;
        padding-top: var(--sw-space-xl);
    }

    .legal-simple-header {
        padding-top: 90px;
    }

    .legal-layout .legal-simple-header {
        padding-top: 10px;
    }

    .legal-simple-header.has-bg {
        padding-top: 130px;
        padding-bottom: 50px;
    }
}

/* --- SIMPLE HEADER --- */
.legal-simple-header {
    position: relative;
    padding-top: 42px;
    /* Clears the desktop sticky header */
    margin-bottom: var(--sw-space-3xl);
    padding-bottom: var(--sw-space-xl);
    border-bottom: 1px solid var(--sw-border);
    overflow-wrap: anywhere;
}

/* Override when simple header is nested inside layout block */
.legal-layout .legal-simple-header {
    padding-top: 20px;
}

/* Background image hero styles for blog post banner */
.legal-simple-header.has-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: none;
}

/* Overlay for text readability on background images */
.legal-simple-header.has-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(10, 10, 12, 0.75) 0%,
            rgba(10, 10, 12, 0.4) 50%,
            rgba(10, 10, 12, 0.9) 100%);
    z-index: 1;
}

.legal-simple-header.has-bg .header-inner {
    position: relative;
    z-index: 2;
}

.legal-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--sw-accent);
    background: rgba(var(--sw-accent-rgb), 0.1);
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.legal-title {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.15;
    color: var(--sw-heading);
    letter-spacing: -0.02em;
}

.legal-date {
    color: var(--sw-text-dim);
    font-size: 16px;
    margin: 0;
}

/* --- BODY GRID --- */
.legal-body-grid {
    display: grid;
    grid-template-columns: 332px 1fr;
    gap: 9px;
    align-items: start;
}

@media (max-width: 992px) {
    .legal-body-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* --- SIDEBAR & MAIN PANELS (Shared Styles) --- */
.legal-sidebar,
.legal-document {
    background: var(--sw-bg-elevated);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* --- SIDEBAR & TOC --- */
.legal-sidebar {
    position: sticky;
    top: 100px;
    height: auto;
    /* max-height: calc(100vh - 120px); */
    overflow-y: auto;
    padding: 10px;
}

/* Hide scrollbar for cleaner look */
.legal-sidebar::-webkit-scrollbar {
    width: 4px;
}

.legal-sidebar::-webkit-scrollbar-thumb {
    background: var(--sw-border);
    border-radius: 4px;
}

.toc-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sw-heading);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sw-border);
}

.toc-list {
    list-style: none;
    padding: 10px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toc-list li {
    margin: 0;
    padding: 0;
}

.toc-list a {
    color: var(--sw-text-dim);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    display: block;
    overflow-wrap: anywhere;
    transition: color 0.2s ease, transform 0.2s ease;
}

.toc-list a:hover {
    color: var(--sw-heading);
    transform: translateX(4px);
}

.toc-list a.active {
    color: var(--sw-accent);
    font-weight: 600;
}

@media (max-width: 992px) {
    .legal-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        padding: 20px;
    }

    .toc-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 18px;
    }

    .toc-list a:hover {
        transform: none;
    }
}

/* --- MAIN DOCUMENT CONTENT --- */
.legal-document {
    padding: 50px;
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .legal-document {
        padding: 30px 20px;
    }
}

.legal-section {
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scroll-margin-top: 100px;
    /* So sticky header doesn't cover title when anchored */
}

.legal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.legal-section h2 {
    font-size: 28px;
    color: var(--sw-heading);
    margin: 0 0 25px;
    font-weight: 700;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.legal-section h3 {
    font-size: 20px;
    color: var(--sw-heading);
    margin: 40px 0 15px;
    font-weight: 600;
}

.legal-section h4 {
    font-size: 16px;
    color: var(--sw-heading);
    margin: 30px 0 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0;
}

.legal-section p,
.legal-section li {
    font-size: 14px;
    line-height: 1.8;
    color: var(--sw-text);
    margin-bottom: 1em;
    overflow-wrap: anywhere;
}

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

.legal-section strong {
    color: var(--sw-heading);
    font-weight: 600;
}

.legal-section ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.legal-section li {
    margin-bottom: 10px;
}

/* Inner Box for subsections (e.g. Free vs Premium License) */
.legal-subsection-box {
    background: var(--sw-bg-card);
    border: 1px solid var(--sw-border);
    padding: 30px;
    border-radius: var(--sw-radius-md);
    margin: 30px 0;
    overflow-wrap: anywhere;
}

.legal-subsection-box h4 {
    margin-top: 0;
    color: var(--sw-accent);
}

.legal-subsection-box ul {
    margin-bottom: 0;
}

.legal-subsection-box li:last-child {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .legal-layout {
        padding-inline: 12px;
    }

    .legal-simple-header {
        padding-top: 85px;
        margin-bottom: 28px;
        padding-bottom: 22px;
    }

    .legal-layout .legal-simple-header {
        padding-top: 10px;
    }

    .legal-simple-header.has-bg {
        padding-top: 120px;
        padding-bottom: 40px;
    }

    .legal-tag {
        font-size: 10px;
        letter-spacing: 1px;
        margin-bottom: 12px;
    }

    .legal-title {
        font-size: 24px;
        line-height: 1.15;
    }

    .legal-date {
        font-size: 13px;
    }

    .legal-body-grid {
        gap: 18px;
    }

    .legal-sidebar {
        padding: 16px;
    }

    .toc-title {
        margin-bottom: 14px;
    }

    .toc-list {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .toc-list a {
        font-size: 13px;
        line-height: 1.45;
    }

    .legal-document {
        padding: 22px 16px;
    }

    .legal-section {
        margin-bottom: 38px;
        padding-bottom: 30px;
        scroll-margin-top: 86px;
    }

    .legal-section h2 {
        font-size: 22px;
        margin-bottom: 18px;
    }

    .legal-section h3 {
        font-size: 17px;
        margin: 28px 0 12px;
    }

    .legal-section h4 {
        font-size: 14px;
        margin: 24px 0 12px;
        letter-spacing: 0;
    }

    .legal-section p,
    .legal-section li {
        font-size: 13px;
        line-height: 1.75;
    }

    .legal-section ul {
        padding-left: 16px;
    }

    .legal-subsection-box {
        padding: 18px;
        margin: 22px 0;
    }
}

/* ==========================================================================
   Blog Single Post (single-post.php)
   ========================================================================== */
.sw-single-container {
    width: 95%;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .sw-single-container {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .sw-single-container {
        width: 92%;
    }
}

.entry-content {
    font-family: var(--sw-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: var(--sw-text, #e4e4e7);
    max-width: none !important;
}

.entry-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 3.5rem 0 1.25rem 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scroll-margin-top: 100px;
}

.entry-content h3 {
    font-size: 19px;
    font-weight: 600;
    color: #fff;
    margin: 2.5rem 0 1rem 0;
}

.entry-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 2rem 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entry-content p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--sw-text-dim, #a3a3a3);
    margin-bottom: 1.5rem;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.entry-content li {
    font-size: 14px;
    line-height: 1.8;
    color: var(--sw-text-dim, #a3a3a3);
    margin-bottom: 0.5rem;
}

.entry-content strong {
    color: #fff;
    font-weight: 600;
}

.entry-content a {
    color: #31a8ff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.entry-content a:hover {
    color: #50b7ff;
    text-decoration: underline;
}

.entry-content pre {
    background: #111111;
    border: 1px solid var(--sw-border, rgba(255, 255, 255, 0.06));
    border-radius: var(--sw-radius-md, 8px);
    padding: 1.5rem;
    overflow-x: auto;
    font-family: var(--sw-font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace);
    font-size: 13.5px;
    line-height: 1.6;
    color: #e4e4e7;
    margin: 2rem 0;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a #121212;
}

.entry-content pre::-webkit-scrollbar,
.entry-content code::-webkit-scrollbar,
.entry-content blockquote::-webkit-scrollbar,
.entry-content .wp-block-preformatted::-webkit-scrollbar,
.entry-content .wp-block-code::-webkit-scrollbar {
    height: 6px !important;
    width: 6px !important;
}

.entry-content pre::-webkit-scrollbar-track,
.entry-content code::-webkit-scrollbar-track,
.entry-content blockquote::-webkit-scrollbar-track,
.entry-content .wp-block-preformatted::-webkit-scrollbar-track,
.entry-content .wp-block-code::-webkit-scrollbar-track {
    background: #121212 !important;
    border-radius: 3px !important;
}

.entry-content pre::-webkit-scrollbar-thumb,
.entry-content code::-webkit-scrollbar-thumb,
.entry-content blockquote::-webkit-scrollbar-thumb,
.entry-content .wp-block-preformatted::-webkit-scrollbar-thumb,
.entry-content .wp-block-code::-webkit-scrollbar-thumb {
    background: #2a2a2a !important;
    border-radius: 3px !important;
    border: 1px solid #181818 !important;
}

.entry-content pre::-webkit-scrollbar-thumb:hover,
.entry-content code::-webkit-scrollbar-thumb:hover,
.entry-content blockquote::-webkit-scrollbar-thumb:hover,
.entry-content .wp-block-preformatted::-webkit-scrollbar-thumb:hover,
.entry-content .wp-block-code::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a !important;
}

.entry-content pre.wp-block-preformatted {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.entry-content code {
    font-family: var(--sw-font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace);
    font-size: 13px;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.entry-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: inherit;
}

.entry-content img,
.entry-content figure {
    max-width: 100%;
    height: auto;
    border-radius: var(--sw-radius-md, 8px);
    border: 1px solid var(--sw-border, rgba(255, 255, 255, 0.06));
    margin: 2rem auto;
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.entry-content figure img {
    margin: 0;
    border: none;
    box-shadow: none;
}

.entry-content figure figcaption {
    font-size: 12px;
    color: var(--sw-text-dim, #71717a);
    text-align: center;
    margin-top: 10px;
}

.sw-blog-grid.view-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.sw-blog-grid.view-grid .sw-blog-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    overflow: hidden;
    height: 100%;
    transition: all 0.3s ease;
}

.sw-blog-grid.view-grid .sw-blog-card:hover {
    transform: translateY(-4px);
    border-color: rgba(49, 168, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.sw-blog-grid.view-grid .sw-blog-card-img-wrap {
    aspect-ratio: 16/10;
    position: relative;
    overflow: hidden;
    background: #18181b;
}

.sw-blog-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.sw-blog-card:hover .sw-blog-card-img {
    transform: scale(1.05);
}

.sw-blog-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sw-blog-card-meta {
    font-size: 11px;
    color: #71717a;
    margin-bottom: 0.6rem;
    display: flex;
    gap: 12px;
}

.sw-blog-card-meta a {
    color: #71717a;
    text-decoration: none;
}

.sw-blog-card-body h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 0.6rem;
    line-height: 1.35;
}

.sw-blog-card-body h2 a {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sw-blog-card:hover .sw-blog-card-body h2 a {
    color: var(--sw-accent, #31a8ff);
}

.sw-blog-card-excerpt {
    font-size: 13px;
    color: #a3a3a3;
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
}

.sw-blog-card-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--sw-accent, #31a8ff);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    transition: color 0.2s ease;
}

.sw-blog-card-link:hover {
    color: var(--sw-accent-hover, #50b7ff);
}

.sw-blog-card-link iconify-icon {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.sw-blog-card-link:hover iconify-icon {
    transform: translateX(2px);
}

@media (max-width: 1024px) {
    .sw-blog-grid.view-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .sw-blog-grid.view-grid {
        grid-template-columns: 1fr;
    }
}

.legal-popular-articles {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.popular-item {
    display: flex;
    flex-direction: row !important;
    gap: 12px;
    align-items: flex-start;
}

.popular-item-thumb-wrapper {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #111;
}

.popular-item-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f1f1f 0%, #111 100%);
    color: rgba(255, 255, 255, 0.15);
}

.popular-item-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
    min-width: 0;
}

.popular-item-link {
    color: var(--sw-text-dim, #a3a3a3);
    text-decoration: none;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.4;
    transition: color 0.2s ease;
    margin: 0;
}

.popular-item-link:hover {
    color: var(--sw-accent, #31a8ff);
}

.popular-item-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
}