/* ==========================================================
   Blog: home preview cards + /blog archive
   ========================================================== */

/* ---------- Home: 3-card preview ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.blog-card-img {
    aspect-ratio: 16 / 9;
    background: var(--grad-soft);
}

.blog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px 24px 26px;
}

.blog-meta {
    color: var(--text-soft);
    font-size: 14px;
}

.blog-card h3 {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.blog-card p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-faint);
    font-size: 15px;
    line-height: 1.7;
}

.blog-more {
    margin-top: 36px;
    text-align: center;
}

.blog-more a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.blog-more a:hover {
    text-decoration: underline;
}

/* ---------- /blog archive page ---------- */
body.blog-page {
    background:
        radial-gradient(ellipse 70% 320px at 50% 0, rgba(6, 182, 212, 0.14), transparent 70%),
        var(--bg);
    background-repeat: no-repeat;
}

.blog-hero {
    padding: 48px 0 40px;
    text-align: center;
}

.blog-hero .eyebrow {
    margin-bottom: 18px;
}

.blog-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 800;
}

.blog-hero p {
    margin-top: 12px;
    color: var(--text-soft);
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 920px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.blog-row {
    display: grid;
    grid-template-columns: 190px 1fr 44px;
    align-items: center;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.blog-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.blog-row-img {
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    background: var(--grad-soft);
}

.blog-row-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-row time {
    display: block;
    margin-bottom: 6px;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 700;
}

.blog-row h2 {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.blog-row p {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.7;
}

.blog-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--grad-soft);
    color: var(--primary);
}

.blog-arrow svg {
    width: 18px;
    height: 18px;
}

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

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

    .blog-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .blog-arrow { display: none; }
}

/* ---------- Single article page ---------- */
.post {
    max-width: 920px;
    margin: 40px auto 80px;
    padding: 40px 44px 44px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.post-back {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.post-back:hover { text-decoration: underline; }

/* Category chip */
.post-chip {
    display: inline-block;
    margin-bottom: 16px;
    padding: 4px 12px;
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
}

.post-head h1 {
    font-size: clamp(1.9rem, 4.6vw, 2.6rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.025em;
}

/* "Last updated · Reading time" line */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 13.5px;
}

.post-meta time { display: inline; margin: 0; font-weight: 500; }

.post-cover {
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin: 26px 0 28px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--grad-soft);
    box-shadow: var(--shadow-sm);
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Intro text under the cover */
.post-intro p {
    margin: 0 0 16px;
    color: var(--text-soft);
    font-size: 1.02rem;
    line-height: 1.85;
}

/* ---------- Table of contents (scrollable box) ---------- */
.toc {
    margin: 28px 0 8px;
    padding: 0 22px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.06);
}

.toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.toc-title::-webkit-details-marker { display: none; }

.toc-title::after {
    content: "";
    width: 9px;
    height: 9px;
    margin-right: 4px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .2s ease;
}

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

.toc-list {
    max-height: 260px;
    margin: 0 0 12px;
    padding: 0 12px 0 0;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.45) transparent;
}

.toc-list::-webkit-scrollbar { width: 8px; }
.toc-list::-webkit-scrollbar-track { background: rgba(99, 102, 241, 0.08); border-radius: 8px; }
.toc-list::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.45); border-radius: 8px; }

.toc-list li { margin: 0; }

.toc-list a {
    display: block;
    padding: 7px 0;
    color: var(--primary);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
}

.toc-list a:hover { text-decoration: underline; }

.toc-list a.is-active { color: var(--text); }

/* ---------- Article body ---------- */
.post-body h2 {
    margin: 44px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    scroll-margin-top: 90px;
}

.post-body h3 {
    margin: 28px 0 10px;
    font-size: 1.12rem;
    font-weight: 800;
    scroll-margin-top: 90px;
}

.post-body p,
.post-body li {
    color: var(--text-soft);
    font-size: 1.02rem;
    line-height: 1.85;
}

.post-body p { margin: 0 0 16px; }

.post-body ul,
.post-body ol {
    margin: 0 0 18px;
    padding-left: 22px;
}

.post-body li { margin-bottom: 8px; }

.post-body strong { color: var(--text); }

.post-body a {
    color: var(--primary);
    font-weight: 600;
}

/* Tables */
.table-wrap {
    margin: 20px 0 24px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.post-body table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 14.5px;
}

.post-body th,
.post-body td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    text-align: left;
    vertical-align: top;
    line-height: 1.6;
}

.post-body tr:last-child th,
.post-body tr:last-child td { border-bottom: 0; }

.post-body thead th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text);
    font-weight: 800;
}

.post-body tbody th {
    width: 32%;
    background: rgba(99, 102, 241, 0.05);
    color: var(--text);
    font-weight: 700;
}

/* Callout / note box */
.post-note {
    margin: 22px 0;
    padding: 16px 18px;
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    background: rgba(99, 102, 241, 0.07);
}

.post-note p { margin: 0; }

/* Tool review card (use inside .post-body for each reviewed tool) */
.tool-card {
    margin: 20px 0 28px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.tool-card h3 { margin-top: 0; }

.tool-card .tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.tool-card .tool-tags li {
    margin: 0;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.7;
}

.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 6px;
}

.pros-cons h4 {
    margin: 0 0 6px;
    font-size: .95rem;
    font-weight: 800;
}

.pros-cons .pros h4 { color: var(--ok); }
.pros-cons .cons h4 { color: var(--bad); }
.pros-cons ul { margin: 0; padding-left: 20px; }

.post-cta {
    margin-top: 44px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--grad-soft);
    text-align: center;
}

.post-cta h3 { margin: 0 0 8px; font-size: 1.2rem; font-weight: 800; }
.post-cta p { margin: 0 0 16px; color: var(--text-soft); }

.post-cta a {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 12px;
    background: var(--grad);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.post-more {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.post-more h3 { margin: 0 0 12px; font-size: 1.1rem; font-weight: 800; }
.post-more ul { margin: 0; padding-left: 20px; }
.post-more a { color: var(--primary); font-weight: 600; text-decoration: none; }
.post-more a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .post { margin: 20px auto 48px; padding: 24px 18px 28px; border-radius: 14px; }
    .post-body h2 { font-size: 1.25rem; margin-top: 36px; }
    .pros-cons { grid-template-columns: 1fr; }
    .toc { padding: 0 16px; }
}

/* ---------- Notices & error screens (page.php) ---------- */
.page-note {
    max-width: 840px;
    margin: 24px auto 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    font-size: 14px;
}

.center-msg {
    text-align: center;
    padding: 90px 20px 110px;
}

.center-msg h1 {
    font-size: clamp(56px,10vw,96px);
    font-weight: 800;
    letter-spacing: -.04em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.center-msg p {
    color: var(--text-soft);
    margin: 12px 0 26px;
    font-size: 18px;
}

.center-msg a.btn-go {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 12px;
    background: var(--grad);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

/* ==========================================================
   Advertisement slots (configured in admin → Advertisement)
   ========================================================== */
.ad-slot {
    max-width: 970px;
    margin: 28px auto;
    text-align: center;
    clear: both;
}

.ad-wrap {
    padding-top: 0;
    padding-bottom: 0;
}

.ad-slot .ad-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.ad-slot .ad-body {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-align: center;
}

.ad-slot .ad-body ins,
.ad-slot .ad-body iframe,
.ad-slot .ad-body img {
    max-width: 100%;
}

/* Admin-only preview boxes (visitors never see these) */
.ad-ph {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 90px;
    padding: 14px;
    border: 2px dashed var(--text-faint);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 14px;
}

.ad-ph b { color: var(--text); }
.ad-ph span { font-size: 12.5px; }

/* Sticky bottom bar */
.ad-sticky {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    max-height: 110px;
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.ad-sticky .ad-label { margin-bottom: 2px; }
.ad-sticky .ad-ph { min-height: 50px; padding: 6px; }

.ad-sticky-x {
    position: absolute;
    top: -26px;
    right: 10px;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

body.has-ad-sticky { padding-bottom: 70px; }

/* Show on: desktop only / mobile only */
@media (max-width: 720px) {
    .ad-only-desktop { display: none !important; }
}

@media (min-width: 721px) {
    .ad-only-mobile { display: none !important; }
}
