/* === Greg PDF v1.0.0 — Download button scale.com style === */

/* Container — centered, same width as content */
.greg-pdf-wrapper {
    max-width: 860px;
    margin: 0 auto 1.75rem auto;
    display: flex;
    justify-content: flex-end;
}

/* Button — border style like scale.com Download PDF */
.greg-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-accent, #4ECDC4);
    background: transparent;
    border: 1px solid var(--color-border-strong, #374151);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-user-select: none;
    user-select: none;
}

.greg-pdf-button:hover,
.greg-pdf-button:focus-visible {
    background: var(--color-accent, #4ECDC4) !important;
    color: #030712 !important;
    border-color: var(--color-accent, #4ECDC4) !important;
    transform: scale(1.03);
}

.greg-pdf-button:active {
    transform: scale(0.98);
}

/* Icon — CSS mask with base64 SVG (bulletproof, no encoding issues) */
.greg-pdf-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-color: currentColor;
    mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ii8+PHBvbHlsaW5lIHBvaW50cz0iNyAxMCAxMiAxNSAxNyAxMCIvPjxsaW5lIHgxPSIxMiIgeTE9IjE1IiB4Mj0iMTIiIHkyPSIzIi8+PC9zdmc+");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ii8+PHBvbHlsaW5lIHBvaW50cz0iNyAxMCAxMiAxNSAxNyAxMCIvPjxsaW5lIHgxPSIxMiIgeTE9IjE1IiB4Mj0iMTIiIHkyPSIzIi8+PC9zdmc+");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.greg-pdf-button:hover .greg-pdf-icon {
    transform: translateY(-2px);
}

/* Spinner for loading state (JS) */
.greg-pdf-button.greg-pdf-loading {
    pointer-events: none;
    opacity: 0.7;
}

.greg-pdf-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: greg-pdf-spin 0.6s linear infinite;
}

.greg-pdf-button.greg-pdf-loading .greg-pdf-icon { display: none; }
.greg-pdf-button.greg-pdf-loading .greg-pdf-spinner { display: block; }

@keyframes greg-pdf-spin {
    to { transform: rotate(360deg); }
}

/* ===== PRINT STYLESHEET (on greg_pdf=ID pages only) ===== */
body.greg-pdf-print {
    background: #ffffff !important;
    color: #1a1a1a !important;
    font-family: Georgia, 'Times New Roman', serif !important;
    font-size: 13pt !important;
    line-height: 1.8 !important;
}

body.greg-pdf-print * {
    color: #1a1a1a !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.greg-pdf-print .greg-pdf-print-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #1a1a1a;
}

body.greg-pdf-print .greg-pdf-print-header h1 {
    font-size: 20pt;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    font-family: Georgia, serif;
}

body.greg-pdf-print .greg-pdf-print-meta {
    font-size: 12pt;
    opacity: 0.7;
}

body.greg-pdf-print .greg-pdf-print-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ccc;
    text-align: center;
    font-size: 12pt;
    opacity: 0.6;
}

body.greg-pdf-print img {
    max-width: 100% !important;
    height: auto !important;
}

body.greg-pdf-print a {
    color: #1a1a1a !important;
    text-decoration: underline;
}

body.greg-pdf-print .greg-pdf-print-button,
body.greg-pdf-print nav,
body.greg-pdf-print header,
body.greg-pdf-print footer:not(.greg-pdf-print-footer),
body.greg-pdf-print .sidebar,
body.greg-pdf-print .greg-toc-wrapper,
body.greg-pdf-print .affiliate-cta,
body.greg-pdf-print .ad-inserter,
body.greg-pdf-print #reading-progress,
body.greg-pdf-print script,
body.greg-pdf-print style {
    display: none !important;
}

@media print {
    body.greg-pdf-print {
        margin: 0;
        padding: 1.5cm;
    }
    body.greg-pdf-print .greg-pdf-print-button { display: none !important; }
    @page { margin: 2cm; }
}