/* ===========================================
   Note Detail Page (/notes/<id>)
   =========================================== */

:root {
    /* defensive fallbacks if showcase.css isn't loaded */
    --bg-deep:    #020409;
    --bg-dark:    #0a0e14;
    --bg-card:    #0d1117;
    --bg-soft:    #161b22;
    --border:     #1f2933;
    --border-hot: #30363d;
    --text:       #c9d1d9;
    --text-dim:   #8b949e;
    --text-mute:  #5b6168;
    --neon-cyan:  #58a6ff;
    --neon-green: #2ee59d;
    --neon-amber: #f0b429;
    --neon-purple:#a371f7;
    --neon-red:   #ff5c5c;
}

.note-detail-page {
    background: #020409;
    color: var(--text);
}

.matrix-bg.detail-bg { opacity: 0.25; }
.scanlines.detail-bg,
.vignette.detail-bg { z-index: 1; }

.detail-card {
    max-width: 1280px;
    min-height: auto;
}

/* two-column layout with left rail */
.content-grid.detail-grid {
    grid-template-columns: 280px 1fr;
}

/* detail rail inherits most styles from showcase.css .rail,
   but we fine-tune here */
.detail-grid .rail {
    border-right: 1px solid var(--border-hot);
    background: var(--bg-rail);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}
.detail-grid .rail .profile-panel {
    border-bottom: 1px dashed var(--border);
    padding-bottom: 0.5rem;
}

.article-wrap {
    padding: 1.5rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

/* ---------- Article head ---------- */
.article-head { padding-bottom: 1rem; border-bottom: 1px dashed var(--border); }

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.article-meta a.tag {
    text-decoration: none;
}
.meta-date { display: inline-flex; align-items: center; gap: 0.3rem; }
.meta-id {
    margin-left: auto;
    color: var(--neon-purple);
    letter-spacing: 0.5px;
}

.article-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.3rem 0 0.6rem;
    letter-spacing: -0.5px;
    line-height: 1.25;
}
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* ---------- Article body ---------- */
.article-body {
    font-family: 'Noto Sans SC', 'Inter', system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 0.98rem;
    line-height: 1.8;
    color: #d0d7de;
    max-width: 100%;
}
.article-body.md-body h1 { font-size: 1.6rem; }
.article-body.md-body h2 {
    font-size: 1.35rem;
    margin: 1.6rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}
.article-body.md-body h3 { font-size: 1.15rem; margin: 1.3rem 0 0.4rem; }
.article-body.md-body h4 { font-size: 1.02rem; }
.article-body.md-body p { margin: 0.7rem 0; }
.article-body.md-body li { margin: 0.25rem 0; }

/* tables in article */
.article-body.md-body table {
    font-size: 0.88rem;
}
.article-body.md-body th,
.article-body.md-body td {
    padding: 0.55rem 0.85rem;
}

/* code blocks */
.article-body.md-body pre {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 6px;
    position: relative;
    margin: 1rem 0;
    padding: 0.9rem 1.1rem;
}
.article-body.md-body pre.code-block {
    padding-top: 2.4rem;
}
.article-body.md-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.85rem;
}

/* inline code */
.article-body.md-body code {
    font-size: 0.88em;
    background: rgba(88, 166, 255, 0.12);
}

/* blockquote */
.article-body.md-body blockquote {
    font-style: normal;
    background: rgba(240, 180, 41, 0.06);
}

/* links */
.article-body.md-body a {
    border-bottom: 1px dashed currentColor;
}

/* hover-translate override: keep cursor pointer in code blocks */
.article-body.md-body pre,
.article-body.md-body pre * { cursor: text; }
.article-body.md-body code { cursor: text; }

/* ---------- Code block toolbar ---------- */
.code-block { position: relative; }
.code-bar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}
.code-lang {
    user-select: none;
    text-transform: uppercase;
    color: var(--neon-cyan);
}
.code-copy {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.code-copy:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 6px rgba(88, 166, 255, 0.3);
}
.code-copy.ok {
    color: var(--neon-green);
    border-color: var(--neon-green);
}

/* ---------- Article footer ---------- */
.article-foot {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.foot-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.15s;
}
.foot-link:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
}

.foot-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.nav-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.nav-card:hover {
    border-color: var(--neon-cyan);
    background: rgba(88, 166, 255, 0.05);
    color: var(--text);
}
.nav-next { text-align: right; }
.nav-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-mute);
    letter-spacing: 1.5px;
}
.nav-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--neon-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .content-grid.detail-grid { grid-template-columns: 1fr; }
    .detail-grid .rail {
        border-right: none;
        border-bottom: 1px solid var(--border-hot);
        max-height: 50vh;
    }
}
@media (max-width: 720px) {
    .article-wrap { padding: 1.25rem; }
    .article-title { font-size: 1.4rem; }
    .article-body.md-body { font-size: 0.95rem; }
    .foot-nav { grid-template-columns: 1fr; }
    .nav-next { text-align: left; }
}
