/* ===== CORE STYLES ===== */
body {
        overflow-x: hidden;
    }

iframe {
    border-radius: 15px;
}


/* Light Theme */
[data-bs-theme="light"] .g-recaptcha {
    filter: none; /* Default appearance for light theme */
}

/* Dark Theme */
[data-bs-theme="dark"] .g-recaptcha {
    filter: invert(1) hue-rotate(180deg)           /* your existing flip   */
            brightness(1.25) contrast(0.85);      /* ↓ lift black / soften */
}


/* ===== LOADER ===== */
.loader {
position: fixed;
top: 30%;
left: 50%;
transform: translate(-50%, -50%);
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid lightgray;
border-bottom: 16px solid lightblue;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
z-index: 1000;
}

@keyframes spin {
0% { transform: translate(-50%, -50%) rotate(0deg); }
100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== OVERLAYS ===== */
.overlay, 
.popup-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
display: none;
}

/* ===== CONTENT CONTAINERS ===== */
.content-container {
position: relative;
z-index: 2;
}

/* ===== ARTICLE CONTENT (LCP TARGET) ===== */
.article-content {
/* Optimized for fast text rendering */
line-height: 1.6;
}

.article-content h1 {
font-size: 2rem;
margin-top: 0;
}

/* ===== CODE BLOCKS ===== */
pre, .katex-display {
background: #f9f9f9;
padding: 1em;
border-radius: 4px;
overflow-x: auto;
max-width: 100%;
}

pre {
white-space: pre;
font-family: monospace;
}

.katex-display {
display: block;
white-space: nowrap;
}

/* ===== BUTTONS ===== */
.btn-scale {
transition: transform 0.3s ease;
}

.btn-scale:hover {
transform: scale(1.1);
}

/* ===== BACKGROUND ELEMENTS ===== */
.background-left,
.background-right {
position: fixed;
top: 0;
bottom: 0;
width: calc((100% - 900px) / 2);
background-size: cover;
background-position: center;
z-index: 1;
}

.background-left { left: 0; }
.background-right { right: 0; }

/* ===== COMMENT SYSTEM ===== */
.comment-container {
opacity: 0;
transition: opacity 0.3s ease-in-out;
}

.comment-container.show {
opacity: 1;
}

/* ===== Transition Effects ===== */

.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.fade-out {
  opacity: 1;
  animation: fadeOut 1s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0.3;
  }
}


/* ==== Common Skeleton Styles ==== */
.skeleton-comment {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    animation: fadeIn 0.2s ease-in-out;
}

.skeleton-avatar,
.skeleton-bubble,
.skeleton-username {
    background: var(--bs-secondary);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}

/* Avatar */
.skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Username */
.skeleton-username {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100px;
    height: 12px;
    margin-bottom: 6px;
    border-radius: 4px;
}

/* Bubbles */
.skeleton-bubble {
    display: block;
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    min-height: 20px;
    padding: 10px;
    border-radius: 5px;
    max-width: 95%;
}

.skeleton-bubble.medium {
    width: 60%;
}

.skeleton-bubble.long {
    width: 100%;
}

.skeleton-bubble.short {
    width: 40%;
}

/* Optional: main input bubble radius */
.skeleton-bubble[style*="height: 50px"] {
    border-radius: 5px;
}

/* ==== Shimmer Keyframes ==== */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ==== Light Theme Gradient ==== */
[data-bs-theme="light"] .skeleton-avatar,
[data-bs-theme="light"] .skeleton-bubble,
[data-bs-theme="light"] .skeleton-username {
    background-image: linear-gradient(
        90deg,
        #e0e0e0 25%,
        #f0f0f0 50%,
        #e0e0e0 75%
    );
}

/* ==== Dark Theme Gradient ==== */
[data-bs-theme="dark"] .skeleton-avatar,
[data-bs-theme="dark"] .skeleton-bubble,
[data-bs-theme="dark"] .skeleton-username {
    background-image: linear-gradient(
        90deg,
        rgba(108, 117, 125, 0.9) 25%,
        rgba(130, 140, 150, 0.6) 50%,
        rgba(108, 117, 125, 0.9) 75%
    );
}


/* Different bubble lengths for variation (optional) */
.skeleton-bubble.short {
    width: 40%;
}
.skeleton-bubble.medium {
    width: 60%;
}
.skeleton-bubble.long {
    width: 100%;
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}


@media (max-width: 600px) {
.hide-on-mobile { display: none; }

.loader {
    width: 80px;
    height: 80px;
    border-width: 10px;
}
.article-body h1 {
    font-size: 1.8rem; /* ~29px */
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.25rem;
}

.article-body h2 {
    font-size: 1.5rem; /* ~24px */
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    border-left: 3px solid #ddd;
    padding-left: 0.5rem;
}

.article-body h3 {
    font-size: 1.25rem; /* ~20px */
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}
}

/* ── method-md-content: Markdown textarea rendering ──────────────────────
   Scoped styles for HTML produced by the method_markdown Jinja filter.
   Applied inside .ms-doc-section-body (public method page),
   .qm-section-body (preview / public.jinja), and .itp-section (ITP page).
   Headings are kept proportional and smaller than the surrounding page
   section headings so the hierarchy is clear without overwhelming body text.
──────────────────────────────────────────────────────────────────────── */
.method-md-content {
    line-height: 1.7;
}
/* h2 inside Markdown content — maps to ## in the AI prompt */
.method-md-content h2 {
    font-size: .95rem;
    font-weight: 700;
    margin: .65rem 0 .25rem;
    color: inherit;
}
/* h3 inside Markdown content — maps to ### (most common heading) */
.method-md-content h3 {
    font-size: .88rem;
    font-weight: 700;
    margin: .55rem 0 .2rem;
    color: inherit;
}
/* h4 inside Markdown content — maps to #### */
.method-md-content h4 {
    font-size: .85rem;
    font-weight: 600;
    margin: .45rem 0 .15rem;
    color: inherit;
}
.method-md-content p {
    margin: 0 0 .4rem;
}
.method-md-content ul,
.method-md-content ol {
    margin: .15rem 0 .4rem;
    padding-left: 1.35rem;
}
.method-md-content li {
    margin-bottom: .2rem;
    line-height: 1.65;
}
/* Remove trailing margin from last child inside the container */
.method-md-content > :last-child,
.method-md-content p:last-child,
.method-md-content ul:last-child,
.method-md-content ol:last-child {
    margin-bottom: 0;
}
/* When the .small modifier is applied (preview / public.jinja) scale down
   slightly so headings stay proportional to the 0.875rem body text */
.method-md-content.small h2 { font-size: .84rem; }
.method-md-content.small h3 { font-size: .80rem; }
.method-md-content.small h4 { font-size: .78rem; }
