/**
 * LinkGuard — Blog Checklist Styles
 *
 * Loaded only by the post-checklist.html template (i.e. articles in the
 * Checklists category with non-null checklist_data). Reuses tokens from
 * blog/styles.css (--clip-card, --clip-block, --neon-cyan, --bg-card etc.)
 * so we keep one cyberpunk visual language.
 *
 * Sections:
 *   1.  Container + sticky progress bar
 *   2.  Tier filter / show-only-undone toggle / tool buttons
 *   3.  Category accordion
 *   4.  Item rows: brand clip-path checkbox + tier badge + why + how
 *   5.  Reduced-motion + print
 *   6.  Mobile reflow
 */

/* ===== 1. Container + progress bar ====================================== */

.lg-checklist {
    margin: 48px 0;
    padding: 24px;
    background: rgba(0, 245, 212, 0.025);
    border: 1px solid rgba(0, 245, 212, 0.18);
    border-left: 3px solid var(--neon-cyan);
    clip-path: var(--clip-card);
}

.lg-checklist-bar {
    position: sticky;
    top: 64px;
    z-index: 4;
    margin: -24px -24px 24px;
    padding: 16px 24px;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0, 245, 212, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lg-checklist-progress {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lg-checklist-progress-track {
    flex: 1 1 auto;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    clip-path: var(--clip-block);
}

.lg-checklist-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-blue, #4cc9f0));
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.lg-checklist-progress-text {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ===== 2. Tools row (tier filter + toggles + buttons) =================== */

.lg-checklist-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    font-size: 13px;
}

.lg-tier-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: none;
    padding: 0;
    margin: 0;
}

.lg-tier-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.lg-tier-filter input[type="checkbox"] {
    accent-color: var(--neon-cyan);
}

.lg-undone-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted, #9ba0b4);
}

.lg-undone-toggle input[type="checkbox"] {
    accent-color: var(--neon-cyan);
}

.lg-tool-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(0, 245, 212, 0.3);
    padding: 6px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    clip-path: var(--clip-block);
    transition: background 0.15s;
}

.lg-tool-btn:hover {
    background: rgba(0, 245, 212, 0.08);
}

.lg-tool-btn--danger {
    border-color: rgba(247, 37, 133, 0.35);
    color: #ffb3c8;
}

.lg-tool-btn--danger:hover {
    background: rgba(247, 37, 133, 0.08);
}

.lg-tool-btn--danger[data-armed="true"] {
    background: rgba(247, 37, 133, 0.18);
    border-color: rgba(247, 37, 133, 0.9);
    color: #ffd1de;
}

/* ===== 3. Category accordion ============================================ */

.lg-checklist-category {
    margin: 28px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
}

.lg-checklist-category:first-of-type {
    border-top: none;
    padding-top: 0;
}

.lg-checklist-collapse {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    text-align: left;
}

.lg-chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan);
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.lg-checklist-collapse[aria-expanded="false"] .lg-chevron {
    transform: rotate(-45deg);
}

.lg-checklist-category-title {
    flex: 1 1 auto;
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-primary);
}

.lg-checklist-category-count {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted, #9ba0b4);
}

.lg-checklist-category-desc {
    margin: 6px 0 16px 24px;
    color: var(--text-muted, #9ba0b4);
    font-size: 14px;
    line-height: 1.5;
}

.lg-checklist-items {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

/* Category collapse — the collapse <button> is nested inside <header>, so
   the items <ol> is a sibling of the <header>, not the button. CSS combinators
   can't cross the <header> boundary directly — use :has() on the wrapping
   header to flip both the description and the items list. */
.lg-checklist-category-header:has(.lg-checklist-collapse[aria-expanded="false"]) .lg-checklist-category-desc,
.lg-checklist-category-header:has(.lg-checklist-collapse[aria-expanded="false"]) + .lg-checklist-items,
.lg-checklist-category-header:has(.lg-checklist-collapse[aria-expanded="false"]) ~ .lg-checklist-items {
    display: none;
}

/* ===== 4. Item rows ===================================================== */

.lg-checklist-item {
    margin: 0;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.lg-checklist-item:hover {
    background: rgba(0, 245, 212, 0.025);
}

.lg-checklist-item.is-done .lg-checklist-item-title {
    color: var(--text-muted, #9ba0b4);
    text-decoration: line-through;
    text-decoration-color: rgba(0, 245, 212, 0.5);
}

.lg-checklist-item.is-hidden {
    display: none;
}

.lg-checklist-item-label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
}

/* Hide the native checkbox; the visible state is .lg-checklist-box */
.lg-checklist-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.lg-checklist-box {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    background: transparent;
    border: 2px solid rgba(0, 245, 212, 0.5);
    clip-path: var(--clip-block);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.lg-checklist-box svg {
    width: 16px;
    height: 16px;
    color: inherit;
    transform: scale(0);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lg-checklist-checkbox:checked + .lg-checklist-box {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    color: #0a0a14;
}

.lg-checklist-checkbox:checked + .lg-checklist-box svg {
    transform: scale(1);
}

.lg-checklist-checkbox:focus-visible + .lg-checklist-box {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 3px;
}

.lg-checklist-item-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.lg-checklist-item-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.lg-checklist-item-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.lg-checklist-item-why {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted, #b6bbd0);
}

.tier-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    clip-path: var(--clip-block);
    border: 1px solid currentColor;
}

.tier-pill::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: currentColor;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%); /* triangle */
}

.tier-pill--critical { color: #ff5a6e; }
.tier-pill--important { color: #fee440; }
.tier-pill--nice { color: #50dc8c; }

.lg-checklist-how {
    margin-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.lg-checklist-how summary {
    cursor: pointer;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lg-checklist-how-body {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted, #b6bbd0);
}

.lg-checklist-how-body code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 245, 212, 0.2);
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--neon-cyan);
}

/* Block code inside how_html. Without these rules the <pre> breaches the
   viewport horizontally on mobile (real layout-blocker on /blog/*-checklist
   articles), because the .article-body pre rule in blog/styles.css doesn't
   apply inside the .lg-checklist scope. */
.lg-checklist-how-body pre {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 245, 212, 0.18);
    border-left: 3px solid var(--neon-cyan);
    overflow-x: auto;
    max-width: 100%;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.lg-checklist-how-body pre code {
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    white-space: pre;
}

.lg-checklist-how-body a {
    color: var(--neon-cyan);
}

.lg-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid rgba(0, 245, 212, 0.3);
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    text-decoration: none;
    clip-path: var(--clip-block);
}

.lg-tool-chip:hover {
    background: rgba(0, 245, 212, 0.14);
}

.lg-tool-chip svg {
    width: 14px;
    height: 14px;
}

/* ===== Footer ========================================================== */

.lg-checklist-foot {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lg-checklist-foot-note {
    margin: 0;
    color: var(--text-muted, #9ba0b4);
    font-size: 12px;
    font-style: italic;
}

/* ===== TOC count ======================================================= */

.lg-toc-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted, #9ba0b4);
}

/* ===== sr-only ========================================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== 5. Reduced motion + print ======================================== */

@media (prefers-reduced-motion: reduce) {
    .lg-checklist-progress-fill,
    .lg-checklist-box,
    .lg-checklist-box svg,
    .lg-chevron {
        transition: none !important;
    }
}

@media print {
    .lg-checklist-bar,
    .lg-checklist-tools,
    .article-sidebar,
    .article-navigation,
    .related-articles,
    .reading-progress,
    .preview-banner {
        display: none !important;
    }
    .lg-checklist {
        border: none;
        background: white;
        color: #000;
        clip-path: none;
        margin: 0;
        padding: 0;
    }
    .lg-checklist-category-title,
    .lg-checklist-item-title,
    .lg-checklist-item-why {
        color: #000 !important;
    }
    .lg-checklist-box {
        border-color: #555 !important;
        background: transparent !important;
        color: #000 !important;
    }
    .lg-checklist-checkbox:checked + .lg-checklist-box {
        background: #000 !important;
        color: #fff !important;
    }
    .lg-checklist-item {
        page-break-inside: avoid;
    }
    .lg-checklist-how {
        display: none;
    }
    /* Force all categories open on print */
    .lg-checklist-collapse[aria-expanded="false"] + .lg-checklist-category-desc,
    .lg-checklist-collapse[aria-expanded="false"] ~ .lg-checklist-items {
        display: block !important;
    }
}

/* ===== 6. Mobile reflow ================================================= */

@media (max-width: 768px) {
    .lg-checklist {
        padding: 16px;
    }
    .lg-checklist-bar {
        position: static;
        margin: -16px -16px 16px;
        padding: 12px 16px;
        backdrop-filter: none;
    }
    .lg-checklist-tools {
        font-size: 12px;
    }
    .lg-checklist-category-title {
        font-size: 18px;
    }
    .lg-checklist-item-head {
        flex-direction: column;
        gap: 4px;
    }
    .lg-tool-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ==========================================================================
   Cluster-wide closing CTA — sits between the checklist and the author bio
   on every blog-checklist article. Bridges the warmed reader to LinkGuard.
   ========================================================================== */

.lg-checklist-cta {
    margin: 48px 0;
    padding: 32px;
    background: linear-gradient(
        135deg,
        rgba(0, 245, 212, 0.06) 0%,
        rgba(123, 44, 191, 0.06) 100%
    );
    border: 1px solid rgba(0, 245, 212, 0.25);
    clip-path: var(--clip-card);
    text-align: center;
}

.lg-checklist-cta-head {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    margin: 0 0 16px;
}

.lg-checklist-cta-body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    max-width: 640px;
    margin: 0 auto 16px;
}

.lg-checklist-cta-meta {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 24px;
}

.lg-checklist-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    color: var(--bg-deep);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lg-checklist-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--glow-cyan);
    color: var(--bg-deep);
}

.lg-checklist-cta-button svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 600px) {
    .lg-checklist-cta {
        padding: 24px 16px;
    }
    .lg-checklist-cta-body {
        font-size: 15px;
    }
    .lg-checklist-cta-button {
        padding: 12px 22px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Hero "Jump to checklist" CTA — full-width strip below the author block,
   inside <header class="article-header">. Two neon rails along the top
   and bottom borders: top edge animates left→right, bottom edge animates
   right→left, they pass each other through the middle of the strip
   forever. Center of the button has NO animation — only the borders glow.
   prefers-reduced-motion kills the animation but keeps a static rail.
   ========================================================================== */

.lg-checklist-hero-cta {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding: 18px 24px;
    width: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 245, 212, 0.04) 0%,
        rgba(10, 10, 20, 0.55) 100%
    );
    clip-path: var(--clip-block);
    color: var(--neon-cyan);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: 0.4px;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    z-index: 0;
    /* Crisp static frame — solid hairline so the strip has structure even
       when both rails are off-screen for a beat. */
    box-shadow: inset 0 0 0 1px rgba(0, 245, 212, 0.32);
    overflow: hidden;
}

/* Top rail — bright cyan band travels LEFT → RIGHT continuously. */
.lg-checklist-hero-cta::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 245, 212, 0.0) 30%,
        rgba(0, 245, 212, 0.95) 50%,
        rgba(0, 245, 212, 0.0) 70%,
        transparent 100%
    );
    background-size: 35% 100%;
    background-repeat: no-repeat;
    background-position: -35% 0;
    animation: lg-hero-rail-ltr 3.6s linear infinite;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(0, 245, 212, 0.55);
    z-index: 1;
}

/* Bottom rail — bright cyan band travels RIGHT → LEFT continuously. */
.lg-checklist-hero-cta::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 245, 212, 0.0) 30%,
        rgba(0, 245, 212, 0.95) 50%,
        rgba(0, 245, 212, 0.0) 70%,
        transparent 100%
    );
    background-size: 35% 100%;
    background-repeat: no-repeat;
    background-position: 135% 0;
    animation: lg-hero-rail-rtl 3.6s linear infinite;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(0, 245, 212, 0.55);
    z-index: 1;
}

@keyframes lg-hero-rail-ltr {
    from { background-position: -35% 0; }
    to   { background-position: 135% 0; }
}

@keyframes lg-hero-rail-rtl {
    from { background-position: 135% 0; }
    to   { background-position: -35% 0; }
}

.lg-checklist-hero-cta:hover,
.lg-checklist-hero-cta:focus-visible {
    transform: translateY(-1px);
    color: var(--neon-cyan);
    outline: none;
    box-shadow: inset 0 0 0 1px var(--neon-cyan),
                0 8px 32px rgba(0, 245, 212, 0.22);
}

.lg-checklist-hero-cta:hover::before,
.lg-checklist-hero-cta:hover::after,
.lg-checklist-hero-cta:focus-visible::before,
.lg-checklist-hero-cta:focus-visible::after {
    animation-duration: 2.4s;
}

.lg-checklist-hero-cta-label {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.2;
}

.lg-checklist-hero-cta-count {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lg-checklist-hero-cta-arrow {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    animation: lg-hero-cta-arrow 2s ease-in-out infinite;
}

@keyframes lg-hero-cta-arrow {
    0%, 100% { transform: translateY(0); opacity: 0.85; }
    50%      { transform: translateY(3px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-checklist-hero-cta::before,
    .lg-checklist-hero-cta::after {
        animation: none;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(0, 245, 212, 0.55) 50%,
            transparent 100%
        );
        background-size: 100% 100%;
        background-position: 0 0;
        box-shadow: none;
    }
    .lg-checklist-hero-cta-arrow {
        animation: none;
    }
}

@media (max-width: 600px) {
    .lg-checklist-hero-cta {
        margin-top: 20px;
        padding: 14px 16px;
        gap: 12px;
        font-size: 13px;
    }
    .lg-checklist-hero-cta-arrow {
        width: 16px;
        height: 16px;
    }
}

@media print {
    .lg-checklist-hero-cta {
        display: none !important;
    }
}
