/* Guide Article Premium v2 — Clean, readable, premium design
   Mobile-first, dark mode support, no text opacity animations */

/* ============================
   1. CSS Custom Properties
   ============================ */
.guide-article {
    --ga-primary: #6366f1;
    --ga-primary-light: #818cf8;
    --ga-accent: #a855f7;
    --ga-pink: #ec4899;
    --ga-text: #1e293b;
    --ga-text-secondary: #374151;
    --ga-text-muted: #6b7280;
    --ga-bg: #ffffff;
    --ga-surface: #f8fafc;
    --ga-surface-alt: #f1f5f9;
    --ga-border: rgba(99, 102, 241, 0.15);
    --ga-border-light: #e5e7eb;
    --ga-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --ga-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --ga-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --ga-shadow-glow: 0 0 30px rgba(99, 102, 241, 0.1);
    --ga-radius: 12px;
    --ga-radius-lg: 20px;
    --ga-ease: cubic-bezier(0.16, 1, 0.3, 1);

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 17px;
    line-height: 1.85;
    color: var(--ga-text);
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Dark mode */
.theme-dark .guide-article {
    --ga-text: #e2e8f0;
    --ga-text-secondary: #cbd5e1;
    --ga-text-muted: #94a3b8;
    --ga-bg: #0f172a;
    --ga-surface: #1e293b;
    --ga-surface-alt: #334155;
    --ga-border: rgba(129, 140, 248, 0.2);
    --ga-border-light: #334155;
}

/* ============================
   2. Typography — ALWAYS READABLE
   ============================ */
.guide-article h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 800;
    line-height: 1.25;
    margin: 2.5em 0 0.8em;
    color: var(--ga-text);
    background: linear-gradient(135deg, var(--ga-primary), var(--ga-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.guide-article h2:first-child {
    margin-top: 0;
}

.guide-article h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.55rem);
    font-weight: 700;
    line-height: 1.35;
    margin: 2.2em 0 0.7em;
    color: var(--ga-text);
    position: relative;
    padding-left: 18px;
}

.guide-article h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--ga-primary), var(--ga-accent));
}

.guide-article h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ga-text);
    margin: 1.8em 0 0.5em;
}

.guide-article p {
    margin: 0 0 1.3em;
    color: var(--ga-text-secondary);
}

.guide-article strong {
    color: var(--ga-text);
    font-weight: 700;
}

.guide-article em {
    font-style: italic;
}

/* ============================
   3. Blockquote — accent card
   ============================ */
.guide-article blockquote {
    position: relative;
    margin: 2em 0;
    padding: 1.5em 1.8em 1.5em 2.2em;
    border-radius: var(--ga-radius);
    border-left: 4px solid var(--ga-primary);
    background: var(--ga-surface);
    font-size: 1.02em;
    box-shadow: var(--ga-shadow-sm);
}

.guide-article blockquote p {
    margin: 0;
    color: var(--ga-text-secondary);
}

.guide-article blockquote p + p {
    margin-top: 0.8em;
}

/* ============================
   4. Lists — clean numbered
   ============================ */
.guide-article ul,
.guide-article ol {
    margin: 1.3em 0;
    padding-left: 0;
    list-style: none;
}

.guide-article ul li,
.guide-article ol li {
    position: relative;
    padding: 0.6em 0 0.6em 2.2em;
    color: var(--ga-text-secondary);
    border-bottom: 1px solid var(--ga-border-light);
}

.guide-article ul li:last-child,
.guide-article ol li:last-child {
    border-bottom: none;
}

.guide-article ul li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 1em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ga-primary);
}

.guide-article ol {
    counter-reset: ol-counter;
}

.guide-article ol li::before {
    counter-increment: ol-counter;
    content: counter(ol-counter);
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ga-primary), var(--ga-accent));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ============================
   5. Tables
   ============================ */
.guide-article table {
    width: 100%;
    margin: 2em 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--ga-radius);
    overflow: hidden;
    box-shadow: var(--ga-shadow-sm);
    border: 1px solid var(--ga-border-light);
    font-size: 15px;
}

.guide-article th {
    background: linear-gradient(135deg, var(--ga-primary), var(--ga-accent));
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
    text-align: left;
}

.guide-article td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ga-border-light);
    color: var(--ga-text-secondary);
}

.guide-article tr:last-child td { border-bottom: none; }
.guide-article tr:nth-child(even) td { background: var(--ga-surface); }

/* ============================
   6. Code
   ============================ */
.guide-article code {
    background: var(--ga-surface-alt);
    color: var(--ga-primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.88em;
    font-weight: 500;
}

.guide-article pre {
    margin: 1.5em 0;
    padding: 1.5em;
    border-radius: var(--ga-radius);
    background: #0f172a;
    color: #e2e8f0;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: var(--ga-shadow-md);
}

.guide-article pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* ============================
   7. Links
   ============================ */
.guide-article a {
    color: var(--ga-primary);
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.3);
    text-underline-offset: 3px;
    font-weight: 500;
    transition: text-decoration-color 0.2s ease;
}

.guide-article a:hover {
    text-decoration-color: var(--ga-primary);
}

/* ============================
   8. HR
   ============================ */
.guide-article hr {
    border: none;
    height: 2px;
    margin: 3em auto;
    max-width: 120px;
    background: linear-gradient(90deg, transparent, var(--ga-primary), var(--ga-accent), transparent);
    border-radius: 1px;
}

/* ============================
   9. Screenshot — premium card
   ============================ */
.guide-screenshot {
    margin: 2em 0;
    position: relative;
}

.guide-screenshot .screenshot-frame {
    position: relative;
    border-radius: var(--ga-radius-lg);
    overflow: hidden;
    box-shadow: var(--ga-shadow-lg);
    border: 1px solid var(--ga-border-light);
    transition: transform 0.4s var(--ga-ease), box-shadow 0.4s var(--ga-ease);
}

.guide-screenshot .screenshot-frame:hover {
    transform: translateY(-3px);
    box-shadow: var(--ga-shadow-lg), var(--ga-shadow-glow);
}

.guide-screenshot .screenshot-frame img {
    width: 100%;
    display: block;
}

.guide-screenshot .screenshot-number {
    position: absolute;
    top: -10px;
    left: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ga-primary), var(--ga-accent));
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
    z-index: 2;
}

.guide-screenshot figcaption,
.guide-screenshot .screenshot-caption {
    text-align: center;
    color: var(--ga-text-muted);
    font-size: 14px;
    margin-top: 10px;
    font-weight: 500;
}

/* ============================
   10. Mascot — larger, better positioned
   ============================ */
.guide-mascot {
    margin: 2.5em auto;
    max-width: 680px;
    text-align: center;
}

.guide-mascot .mascot-frame {
    background: linear-gradient(135deg, #faf5ff, #eef2ff, #fdf4ff);
    border-radius: var(--ga-radius-lg);
    padding: 20px;
    border: 1px solid #e9d5ff;
    overflow: hidden;
    transition: transform 0.4s var(--ga-ease), box-shadow 0.4s var(--ga-ease);
}

.guide-mascot .mascot-frame:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 50px rgba(168, 85, 247, 0.12);
}

.guide-mascot .mascot-frame img {
    width: 100%;
    border-radius: var(--ga-radius);
}

.theme-dark .guide-mascot .mascot-frame {
    background: linear-gradient(135deg, #1e1b4b, #312e81, #1e1b4b);
    border-color: #4338ca;
}

.guide-mascot .mascot-caption {
    color: var(--ga-accent);
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
}

/* ============================
   11. Video
   ============================ */
.guide-video {
    margin: 2.5em 0;
    border-radius: var(--ga-radius-lg);
    overflow: hidden;
    box-shadow: var(--ga-shadow-lg);
    border: 1px solid var(--ga-border-light);
    transition: box-shadow 0.4s var(--ga-ease), transform 0.4s var(--ga-ease);
}

.guide-video:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 50px rgba(99, 102, 241, 0.15);
}

.guide-video video {
    width: 100%;
    display: block;
}

.guide-video .video-caption {
    padding: 12px 20px;
    background: var(--ga-surface);
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-video .video-caption::before {
    content: '▶';
    font-size: 10px;
    color: var(--ga-primary);
}

.guide-video .video-caption p {
    margin: 0;
    color: var(--ga-primary);
    font-size: 14px;
    font-weight: 500;
}

/* ============================
   12. Inline images (non-component)
   ============================ */
.guide-article figure:not(.guide-screenshot) {
    margin: 2em 0;
    text-align: center;
}

.guide-article figure:not(.guide-screenshot) img {
    max-width: 100%;
    border-radius: var(--ga-radius-lg);
    box-shadow: var(--ga-shadow-md);
}

/* Inline img with style (old v1 format) */
.guide-article > figure > img,
.guide-article img[style] {
    border-radius: var(--ga-radius-lg) !important;
    box-shadow: var(--ga-shadow-md);
}

/* ============================
   13. Scroll-reveal (MEDIA ONLY)
   ============================ */
.ga-hidden {
    opacity: 0;
    will-change: opacity, transform;
}

.ga-scale-in {
    transform: scale(0.95);
    transition: opacity 0.6s var(--ga-ease), transform 0.6s var(--ga-ease);
}

.ga-scale-in.ga-visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================
   14. Reading progress bar
   ============================ */
.guide-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--ga-primary), var(--ga-accent), var(--ga-pink));
    z-index: 9999;
    transition: width 0.15s linear;
    border-radius: 0 2px 2px 0;
}

/* ============================
   15. CTA block
   ============================ */
.guide-article .guide-cta {
    margin: 3em 0;
    padding: 2.5em;
    border-radius: var(--ga-radius-lg);
    background: linear-gradient(135deg, var(--ga-primary), var(--ga-accent));
    color: #fff;
    text-align: center;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.25);
    transition: transform 0.3s var(--ga-ease);
}

.guide-article .guide-cta:hover {
    transform: translateY(-3px);
}

.guide-article .guide-cta h3,
.guide-article .guide-cta p {
    color: #fff;
}

.guide-article .guide-cta h3::before { display: none; }

.guide-article .guide-cta a {
    display: inline-block;
    margin-top: 1em;
    padding: 14px 32px;
    background: #fff;
    color: var(--ga-primary);
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-article .guide-cta a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ============================
   16. Reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .ga-hidden { opacity: 1; transform: none; }
    [class*="ga-"] { transition: none !important; animation: none !important; }
    .guide-reading-progress { display: none; }
}

/* ============================
   17. Mobile
   ============================ */
@media (max-width: 768px) {
    .guide-article {
        font-size: 16px;
        line-height: 1.75;
    }
    .guide-article h2 { margin-top: 2em; }
    .guide-article h3 { margin-top: 1.5em; }
    .guide-mascot { max-width: 100%; }
    .guide-mascot .mascot-frame { padding: 12px; }
    .guide-screenshot .screenshot-number {
        width: 26px;
        height: 26px;
        font-size: 12px;
        top: -8px;
        left: 14px;
    }
    .guide-article .guide-cta { padding: 1.5em; }
}

/* ============================
   18. Override parent blog-content colors
   Forces guide-article text to be readable regardless of theme
   ============================ */
.blog-content .guide-article,
.blog-content .guide-article p,
.blog-content .guide-article li,
.blog-content .guide-article td {
    color: var(--ga-text-secondary);
}

.blog-content .guide-article h2,
.blog-content .guide-article h3,
.blog-content .guide-article h4,
.blog-content .guide-article strong {
    color: var(--ga-text);
}

.blog-content .guide-article h2 {
    -webkit-text-fill-color: transparent;
}

/* ============================
   19. ReactBits-inspired: Glare hover on cards
   ============================ */
.guide-screenshot .screenshot-frame::after,
.guide-mascot .mascot-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.08) 55%,
        transparent 60%
    );
    background-size: 200% 200%;
    background-position: -100% -100%;
    transition: background-position 0.6s ease;
    pointer-events: none;
    z-index: 2;
    border-radius: inherit;
}

.guide-screenshot .screenshot-frame:hover::after,
.guide-mascot .mascot-frame:hover::after {
    background-position: 100% 100%;
}

/* ============================
   20. ReactBits-inspired: Star border CTA
   ============================ */
.guide-article .guide-cta {
    position: relative;
    overflow: hidden;
}

.guide-article .guide-cta::before {
    content: '';
    position: absolute;
    width: 300%;
    height: 50%;
    top: -12px;
    left: -250%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.4) 0%, transparent 70%);
    animation: ga-star-top 4s linear infinite alternate;
    pointer-events: none;
}

.guide-article .guide-cta::after {
    content: '';
    position: absolute;
    width: 300%;
    height: 50%;
    bottom: -12px;
    right: -250%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: ga-star-bottom 4s linear infinite alternate;
    pointer-events: none;
}

@keyframes ga-star-top {
    0% { transform: translateX(0); opacity: 0.7; }
    100% { transform: translateX(100%); opacity: 0.2; }
}

@keyframes ga-star-bottom {
    0% { transform: translateX(0); opacity: 0.7; }
    100% { transform: translateX(-100%); opacity: 0.2; }
}

/* ============================
   21. ReactBits-inspired: Gradient shift for h2
   ============================ */
.guide-article h2 {
    background-size: 200% 200%;
    animation: ga-gradient-flow 6s ease infinite;
}

@keyframes ga-gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ============================
   22. Smooth image loading
   ============================ */
.guide-article img {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.guide-article img[loading="lazy"] {
    opacity: 0;
}

.guide-article img[loading="lazy"].loaded,
.guide-article img[loading="lazy"][complete] {
    opacity: 1;
}

/* Fallback: show images after 1s regardless */
@keyframes ga-img-show {
    to { opacity: 1; }
}

.guide-article img[loading="lazy"] {
    animation: ga-img-show 0s 1s forwards;
}
