/* =============================================================
   LumiCode — Frontend Code Block v1.5.1
   Cr8v Stacks · cr8vstacks.com
   ============================================================= */

/* ── Block wrapper ───────────────────────────────────────── */
.lc-pw {
    position: relative;
    margin: 1.8em 0 3.8em 0;   /* extra bottom space below each block */
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #2a2d3a;
    box-shadow:
        0 0 0 0.5px rgba(255,255,255,0.04) inset,
        0 16px 48px rgba(0,0,0,0.5),
        0 4px 12px rgba(0,0,0,0.3);
    transition: border-color 0.2s;
    font-family: 'JetBrains Mono','Fira Code','Menlo','Monaco',ui-monospace,monospace;
}
.lc-pw-is-light {
    border-color: rgba(0,0,0,0.12);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.07), 0 12px 32px rgba(0,0,0,0.05);
}

/* ── Titlebar ────────────────────────────────────────────── */
.lc-pw-titlebar {
    height: 44px; display: flex; align-items: center;
    padding: 0 16px; gap: 8px;
    background: #1c1e28; border-bottom: 1px solid #2a2d3a;
    position: relative; user-select: none; -webkit-user-select: none; flex-shrink: 0;
}
.lc-pw-is-light .lc-pw-titlebar { background: #f0f1f7; border-bottom-color: rgba(0,0,0,0.09); }

/* Traffic-light dots */
.lc-pw-dots { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.lc-pw-dot  { display: block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; cursor: default; }
.lc-pw-dot--red    { background: #ff5f57; box-shadow: 0 0 0 0.5px rgba(255,95,87,0.35); }
.lc-pw-dot--yellow { background: #febc2e; box-shadow: 0 0 0 0.5px rgba(254,188,46,0.35); }
.lc-pw-dot--green  { background: #28c840; box-shadow: 0 0 0 0.5px rgba(40,200,64,0.35); }

/* Filename / lang badge */
.lc-pw-filename {
    position: absolute; left: 50%; transform: translateX(-50%);
    top: 0; height: 100%;
    display: flex; align-items: center; gap: 6px;
    font-family: 'Sora',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 13px; font-weight: 400; color: #6c7086; letter-spacing: 0.01em;
    pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 40%;
}
.lc-pw-is-light .lc-pw-filename { color: rgba(0,0,0,0.42); }

.lc-pw-dot-indicator {
    display: block; width: 6px; height: 6px; border-radius: 50%;
    background: #febc2e; opacity: 0.8; flex-shrink: 0;
}

/* ── Copy button ─────────────────────────────────────────── */
.lc-pw-copybtn {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    background: none;
    border: 1px solid #6c7086 !important;
    border-radius: 5px;
    color: #6c7086 !important;
    font-family: 'Sora',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 11px !important; font-weight: 400; letter-spacing: 0.04em;
    cursor: pointer; line-height: 1; white-space: nowrap;
    transition: all 0.15s; flex-shrink: 0; position: relative; z-index: 1;
}
.lc-pw-copybtn:hover { background: rgba(255,255,255,0.08); color: #cdd6f4 !important; border-color: rgba(255,255,255,0.3) !important; }
.lc-pw-copybtn:active { transform: scale(0.95); }
.lc-pw-is-light .lc-pw-copybtn { border-color: rgba(0,0,0,0.28) !important; color: rgba(0,0,0,0.48) !important; }
.lc-pw-is-light .lc-pw-copybtn:hover { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.75) !important; border-color: rgba(0,0,0,0.45) !important; }

/* ── Code area ───────────────────────────────────────────── */
/*
 * <pre> has NO padding — all padding lives on <code>.
 * This ensures line-numbers gutter can align exactly to code lines.
 * background on <pre> is only a fallback; hljs theme sets it on code.hljs.
 * :has(code.hljs) clears the pre background once hljs has loaded.
 */
.lc-pw-code { overflow-x: auto; }

.lc-pw-code pre {
    margin: 0;
    border: none; border-radius: 0; box-shadow: none;
    background: #161820;   /* fallback before hljs loads */
    font-family: 'JetBrains Mono','Fira Code',ui-monospace,monospace;
    font-size: 13px;
    line-height: 1.6;      /* relative — critical for line-number alignment */
    overflow: visible; overflow-x: visible;
    display: block;
}
.lc-pw-is-light .lc-pw-code pre { background: #f7f7fb; }
.lc-pw-code pre:has(code.hljs)  { background: transparent !important; }

/* All padding on code, NOT pre — so gutter lines up */
.lc-pw-code pre code {
    font-family: inherit; font-size: inherit; line-height: inherit;
    display: block; white-space: pre; min-width: max-content;
    padding: 24px 24px !important;
    border-radius: 0 !important;
    /* NO background override — hljs theme sets it on code.hljs */
}

/* ── Status bar ──────────────────────────────────────────── */
.lc-pw-statusbar {
    height: 30px; display: flex; align-items: center;
    padding: 0 16px; gap: 20px;
    background: #1c1e28; border-top: 1px solid #2a2d3a;
    user-select: none; -webkit-user-select: none; flex-shrink: 0;
}
.lc-pw-is-light .lc-pw-statusbar { background: #f0f1f7; border-top-color: rgba(0,0,0,0.09); }

.lc-pw-status-left { display: flex; gap: 20px; }
.lc-pw-status-left span, .lc-pw-status-right {
    font-family: 'Sora',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 11px; color: #6c7086; letter-spacing: 0.03em; line-height: 1;
}
.lc-pw-status-right { margin-left: auto; color: #cba6f7; font-weight: 500; }
.lc-pw-is-light .lc-pw-status-left span { color: rgba(0,0,0,0.38); }
.lc-pw-is-light .lc-pw-status-right     { color: #7c3aed; }

/* ═══════════════════════════════════════════════════════════
   COLLAPSE SYSTEM — inline overlay design
   ─────────────────────────────────────────────────────────
   Structure (collapsed):
     .lc-pw-body.is-collapsed     ← clips to --lc-clip-h
       .lc-pw-lined | .lc-pw-code ← actual code content
       .lc-expand-overlay         ← absolute, gradient + button
   
   Structure (expanded):
     .lc-pw-body                  ← no height limit
       .lc-pw-lined | .lc-pw-code
       (overlay hidden)
     .lc-collapse-bar.is-visible  ← slides in below body
   ═══════════════════════════════════════════════════════════ */

.lc-pw-body { position: relative; overflow: hidden; }
.lc-pw-body.is-collapsed { max-height: var(--lc-clip-h, 400px); }

/* Gradient overlay */
.lc-expand-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 136px;
    display: flex; align-items: flex-end; justify-content: center;
    padding-bottom: 22px;
    background: linear-gradient(
        to bottom,
        rgba(22,24,32,0.00)  0%,
        rgba(22,24,32,0.50) 28%,
        rgba(22,24,32,0.88) 60%,
        rgba(22,24,32,0.98) 100%
    );
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: all; z-index: 2;
}
.lc-pw-is-light .lc-expand-overlay {
    background: linear-gradient(
        to bottom,
        rgba(247,247,251,0.00)  0%,
        rgba(247,247,251,0.55) 28%,
        rgba(247,247,251,0.92) 60%,
        rgba(247,247,251,1.00) 100%
    );
}

/* Expand pill button */
.lc-expand-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 16px;
    background: rgba(22,24,32,0.82);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 20px;
    color: #cdd6f4;
    font-family: 'Sora',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
    cursor: pointer; white-space: nowrap; line-height: 1;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: background 0.15s, border-color 0.15s;
}
.lc-expand-btn:hover { background: rgba(40,42,58,0.95); border-color: rgba(255,255,255,0.25); }
.lc-pw-is-light .lc-expand-btn { background: rgba(255,255,255,0.92); border-color: rgba(0,0,0,0.13); color: #1e1e2e; }
.lc-pw-is-light .lc-expand-btn:hover { background: #fff; border-color: rgba(0,0,0,0.22); }

/* "N lines hidden" badge */
.lc-expand-count {
    font-size: 10.5px;
    background: rgba(167,139,250,0.18); color: #a78bfa;
    border-radius: 20px; padding: 2px 8px;
    font-weight: 600; letter-spacing: 0.02em;
}
.lc-pw-is-light .lc-expand-count { background: rgba(124,58,237,0.10); color: #7c3aed; }

/* Chevron */
.lc-expand-chevron {
    display: inline-flex; align-items: center;
    color: #a78bfa; flex-shrink: 0;
    transition: transform 0.2s ease;
}
.lc-pw-is-light .lc-expand-chevron { color: #7c3aed; }

/* Collapse bar — slides in after expanding */
.lc-collapse-bar {
    display: flex; align-items: center; justify-content: center;
    background: #1a1c26; border-top: 1px solid #2a2d3a;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.25s ease;
}
.lc-collapse-bar.is-visible { max-height: 44px; opacity: 1; }
.lc-pw-is-light .lc-collapse-bar { background: #eeeef8; border-top-color: rgba(0,0,0,0.09); }

.lc-collapse-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 20px; width: 100%; justify-content: center;
    background: none; border: none; color: #6c7086;
    font-family: 'Sora',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
    cursor: pointer; transition: color 0.15s;
}
.lc-collapse-btn:hover { color: #cdd6f4; }
.lc-pw-is-light .lc-collapse-btn { color: rgba(0,0,0,0.42); }
.lc-pw-is-light .lc-collapse-btn:hover { color: rgba(0,0,0,0.75); }

/* ── Line numbers ────────────────────────────────────────── */
/*
 * padding-top/bottom MUST match code padding (24px).
 * line-height MUST match pre line-height (1.6).
 * align-self:stretch ensures gutter reaches full code height.
 */
.lc-pw-lined { display: flex; overflow-x: auto; }

.lc-pw-line-numbers {
    display: flex; flex-direction: column;
    padding: 24px 14px;          /* match code padding exactly */
    min-width: 48px; text-align: right;
    user-select: none; -webkit-user-select: none;
    color: #45475a;
    font-size: 13px;
    line-height: 1.6;            /* MUST match pre line-height */
    flex-shrink: 0;
    border-right: 1px solid #2a2d3a;
    background: #161820;
    font-family: 'JetBrains Mono',ui-monospace,monospace;
    font-weight: 300;
    align-self: stretch;         /* stretch to full code height */
}
.lc-pw-is-light .lc-pw-line-numbers {
    color: rgba(0,0,0,0.28); border-right-color: rgba(0,0,0,0.09); background: #eeeef6;
}

.lc-pw-line-numbers span { display: block; line-height: 1.6; }

.lc-pw-lined .lc-pw-code { flex: 1; min-width: 0; overflow-x: visible; }
.lc-pw-lined .lc-pw-code pre { overflow-x: visible; }

/* ── Per-line highlights ─────────────────────────────────── */
.lc-pw-line { display: block; }
.lc-pw-line--highlighted {
    background: rgba(255,255,255,0.04);
    margin-left: -24px; padding-left: 24px;
    margin-right: -24px; padding-right: 24px;
    display: block;
}

/* ── Scrollbars ──────────────────────────────────────────── */
.lc-pw-code::-webkit-scrollbar       { height: 6px; width: 5px; }
.lc-pw-code::-webkit-scrollbar-track { background: #161820; }
.lc-pw-code::-webkit-scrollbar-thumb { background: #2a2d3a; border-radius: 3px; }
.lc-pw-code::-webkit-scrollbar-thumb:hover { background: #45475a; }
.lc-pw-is-light .lc-pw-code::-webkit-scrollbar-track { background: #f0f1f7; }
.lc-pw-is-light .lc-pw-code::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); }
