/* ============================================================
   BLOG CODE CARD  –  matches the editor-style design
   Drop this into your blog-detail.css (or a separate file)
   ============================================================ */

/* ---------- card shell ---------- */
.blog-code-card {
    background: #ffffff;
    border: 1px solid #e8e8ed;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin: 2rem 0;
    font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'Menlo', 'Monaco', monospace;
}

/* ---------- top bar ---------- */
.blog-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f7f7f9;
    border-bottom: 1px solid #e8e8ed;
    min-height: 44px;
}

/* traffic-light dots */
.blog-code-header::before {
    content: '';
    display: inline-flex;
    width: 52px;
    height: 12px;
    background:
        radial-gradient(circle 6px at 6px 6px,  #ff5f57 100%, transparent 0),
        radial-gradient(circle 6px at 26px 6px, #febc2e 100%, transparent 0),
        radial-gradient(circle 6px at 46px 6px, #28c840 100%, transparent 0);
    flex-shrink: 0;
}

.blog-code-label {
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
    letter-spacing: 0.01em;
}

.blog-code-language {
    background: #ebebf0;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #444;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ---------- action buttons (copy / fullscreen) ---------- */
.blog-code-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.blog-code-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid #dde1e7;
    border-radius: 7px;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.blog-code-action:hover {
    background: #ebebf0;
    color: #111;
    border-color: #c8cdd5;
}

.blog-code-action .icon {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
}

/* copied state */
.blog-code-action[data-code-copy].is-copied {
    color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

/* ---------- code frame (scrollable) ---------- */
.blog-code-frame {
    overflow-x: auto;
    padding: 20px 0;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

/* ---------- pre / code inside ---------- */
.blog-code-frame pre {
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: 0.875rem;       /* 14px */
    line-height: 1.75;
    color: #1e1e2e;
    counter-reset: line;
}

.blog-code-frame pre code {
    display: block;
    background: transparent;
    padding: 0;
    border: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ---------- line-number gutter ----------
   Works when each line is wrapped in a <span class="line"> element.
   Most syntax highlighters (highlight.js, Prism) can do this.
   If your content is plain <pre><code>, see the JS approach below.  */
.blog-code-frame .line {
    display: flex;
    padding: 0 20px 0 0;
    min-height: 1.75em;
}

.blog-code-frame .line::before {
    counter-increment: line;
    content: counter(line);
    display: inline-block;
    width: 2.8em;
    padding-right: 1.2em;
    text-align: right;
    color: #c0c4cc;
    font-size: 0.8em;
    user-select: none;
    flex-shrink: 0;
    line-height: 1.75;
}

/* ---------- syntax colours (matches screenshot palette) ---------- */

/* keywords: export, import, const, new, from */
.blog-code-frame .hljs-keyword,
.blog-code-frame .token.keyword {
    color: #e06c75;   /* pink-red */
}

/* strings: 'untitled', 'Design' */
.blog-code-frame .hljs-string,
.blog-code-frame .token.string {
    color: #98c379;   /* green */
}

/* built-ins / classes: Schema, String */
.blog-code-frame .hljs-title,
.blog-code-frame .hljs-title.class_,
.blog-code-frame .token.class-name {
    color: #61afef;   /* blue */
}

/* property names */
.blog-code-frame .hljs-attr,
.blog-code-frame .token.property {
    color: #61afef;
}

/* booleans / literals: true */
.blog-code-frame .hljs-literal,
.blog-code-frame .token.boolean {
    color: #d19a66;   /* orange */
}

/* comments: // Imports, // Schema … */
.blog-code-frame .hljs-comment,
.blog-code-frame .token.comment {
    color: #5c6370;
    font-style: italic;
}

/* functions */
.blog-code-frame .hljs-title.function_,
.blog-code-frame .token.function {
    color: #61afef;
}

/* punctuation */
.blog-code-frame .hljs-punctuation,
.blog-code-frame .token.punctuation {
    color: #abb2bf;
}

/* ---------- fullscreen overlay ---------- */
.blog-code-fullscreen-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.blog-code-fullscreen-overlay.is-open {
    display: flex;
}

.blog-code-fullscreen-inner {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

.blog-code-fullscreen-inner .blog-code-frame {
    flex: 1;
    overflow: auto;
}

/* close button inside fullscreen */
.blog-code-fullscreen-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-code-fullscreen-close:hover {
    background: rgba(255,255,255,0.25);
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
    .blog-code-frame pre {
        font-size: 0.8rem;
    }

    .blog-code-header::before {
        display: none;  /* hide dots on mobile to save space */
    }
}