/* Blog: list, post, comments, editor.
   Sits on the translucent grey content panel (.standardLayoutDiv3), so text is dark and accents reuse the navbar cyan.
   Also loaded inside the TinyMCE iframe (body.blog-content) so the editor looks like the published post. */

.blog {
    --blog-accent: #57c7eb;
    --blog-accent-dark: #00b0d9;
    --blog-text: #2b2b2b;
    --blog-muted: #4a4a4a;
    --blog-card: rgba(255, 255, 255, 0.16);
    --blog-card-hover: rgba(255, 255, 255, 0.30);
    --blog-line: rgba(0, 0, 0, 0.12);
    --blog-dark: #202021;
    color: var(--blog-text);
    padding: 8px 4px 10px;
}
.blog p { white-space: normal; }
/* Bootstrap 3 gives some elements (e.g. file inputs) display:block, which beats the hidden attribute */
.blog [hidden] { display: none !important; }

/* ---------- Shared bits ---------- */

.blog-header,
.blog-post-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}
.blog-page-title { margin: 0; font-size: 26px; display: flex; align-items: center; gap: 10px; }
.blog-section-title { font-size: 20px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }

.blog-btn {
    min-width: 0;
    color: #9fa6b3;
    background-color: var(--blog-dark);
    border: 1px solid #6b707a;
    padding: 6px 14px;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
}
.blog-btn:hover, .blog-btn:focus { color: #fff; border-color: #fff; outline: none; }
.blog-btn i { margin-right: 4px; }
.blog-btn-primary { color: var(--blog-accent-dark); background-color: #002025; border-color: #00b0d9d4; }
.blog-btn-primary:hover, .blog-btn-primary:focus { color: #fff; background-color: #007082; border-color: #007082; }
.blog-btn-danger { color: #ff7b7b; background-color: #250000; border-color: #ff505099; }
.blog-btn-danger:hover, .blog-btn-danger:focus { color: #fff; background-color: #8a1c1c; border-color: #8a1c1c; }
.blog-btn[disabled] { opacity: .6; cursor: wait; }

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 13px;
    color: var(--blog-muted);
}
.blog-meta i { margin-right: 3px; opacity: .8; }

.blog-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.blog-tag {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: var(--blog-accent);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.blog-tag:hover { background: #002025; border-color: var(--blog-accent); color: #fff; }
.blog-tag-lg { font-size: 16px; line-height: 24px; padding: 2px 14px; }
.blog-clear-tag { font-size: 18px; color: var(--blog-muted); cursor: pointer; }
.blog-clear-tag:hover { color: #000; }

.blog-badge {
    display: inline-block;
    padding: 0 7px;
    font-size: 11px;
    line-height: 18px;
    border-radius: 3px;
    background: #002025;
    color: var(--blog-accent);
    font-weight: bold;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.blog-badge-draft { background: #3a2a00; color: #ffc94d; }

.blog-count {
    font-size: 13px;
    padding: 0 8px;
    line-height: 22px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .62);
    color: var(--blog-accent);
    font-family: inherit;
}

.blog-hint { color: var(--blog-muted); font-size: 12px; }
.blog-link { cursor: pointer; text-decoration: underline !important; }
.blog-empty { padding: 40px 0; text-align: center; color: var(--blog-muted); font-size: 16px; }

.blog-back { cursor: pointer; color: var(--blog-text); font-weight: bold; }
.blog-back i { transition: transform .15s ease; }
.blog-back:hover i { transform: translateX(-3px); }
.blog-admin-actions { display: flex; gap: 8px; }

/* ---------- Post list ---------- */

.blog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.blog-card {
    display: flex;
    gap: 20px;
    padding: 14px;
    border-radius: 6px;
    background: var(--blog-card);
    border: 1px solid rgba(255, 255, 255, .18);
    cursor: pointer;
    transition: background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.blog-card:hover {
    background: var(--blog-card-hover);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.blog-card-draft { border-style: dashed; border-color: #ffc94d99; }

.blog-thumb {
    flex: 0 0 280px;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    overflow: hidden;
    background: #1a1a1a;
}
.blog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.blog-card:hover .blog-thumb img { transform: scale(1.04); }
.blog-thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #555; font-size: 40px; }

.blog-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.blog-card-title {
    margin: 0;
    font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
    font-weight: bold;
    font-size: 21px;
    line-height: 1.3;
}
/* Same underline sweep as the navbar */
.blog-card-title a { color: #1e1e1e; background: linear-gradient(var(--blog-accent), var(--blog-accent)) no-repeat left bottom / 0 3px; padding-bottom: 2px; transition: background-size .25s ease-out; }
.blog-card:hover .blog-card-title a { background-size: 100% 3px; }
.blog-brief {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card .blog-tags { margin-top: auto; }

.blog-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 22px;
}
.blog-pager-btn {
    cursor: pointer;
    padding: 6px 14px;
    border-radius: .25rem;
    background: var(--blog-dark);
    color: #9fa6b3;
    border: 1px solid #6b707a;
    transition: color .15s ease, border-color .15s ease;
}
.blog-pager-btn:hover { color: #fff; border-color: #fff; }
.blog-pager-btn.disabled { opacity: .35; cursor: default; pointer-events: none; }
.blog-pager-count { color: var(--blog-muted); font-size: 13px; }

/* ---------- Single post ---------- */

.blog-article { max-width: 920px; margin: 0 auto; }
.blog-article-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.blog-article-title { margin: 0; font-size: 34px; line-height: 1.25; color: #1e1e1e; }
.blog-hero {
    /* show the whole image (thumbnails are often screenshots), never crop */
    display: block;
    max-width: 100%;
    max-height: 520px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 6px;
    margin-bottom: 26px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}

/* Post body (also used inside the editor iframe) */
.blog-content {
    font-size: 16px;
    line-height: 1.7;
    color: #222;
    overflow-wrap: break-word;
}
.blog-content p { margin: 0 0 1.1em; white-space: normal; }
.blog-content h2, .blog-content h3, .blog-content h4 {
    font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
    font-weight: bold;
    color: #1e1e1e;
    margin: 1.6em 0 .6em;
    line-height: 1.3;
}
.blog-content h2 { font-size: 25px; padding-bottom: 6px; border-bottom: 2px solid var(--blog-accent, #57c7eb); display: inline-block; }
.blog-content h3 { font-size: 20px; }
.blog-content h4 { font-size: 17px; }
.blog-content a { color: #005d75; text-decoration: underline !important; text-decoration-color: #57c7eb !important; text-underline-offset: 3px; }
.blog-content a:hover { color: #000; }
.blog-content img { max-width: 100%; height: auto; border-radius: 4px; }
.blog-content figure { margin: 1.4em 0; text-align: center; }
.blog-content figure.image { display: table; margin-left: auto; margin-right: auto; }
.blog-content figcaption { font-size: 13px; color: #444; margin-top: 6px; font-style: italic; }
.blog-content ul, .blog-content ol { margin: 0 0 1.1em; padding-left: 1.6em; }
.blog-content li { margin-bottom: .3em; }
.blog-content blockquote {
    margin: 1.4em 0;
    padding: 10px 18px;
    border-left: 4px solid #57c7eb;
    background: rgba(0, 0, 0, .08);
    border-radius: 0 4px 4px 0;
    color: #333;
}
.blog-content hr { border: none !important; height: 2px; background: rgba(0, 0, 0, .15); margin: 2em 0; }
.blog-content code {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    font-size: .9em;
    background: rgba(0, 0, 0, .7);
    color: #8be0ff;
    padding: 1px 6px;
    border-radius: 3px;
}
.blog-content pre {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    background: #1d1f21;
    color: #e0e0e0;
    border: 1px solid #000;
    border-radius: 5px;
    padding: 14px 16px;
    margin: 1.2em 0;
    overflow: auto;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.blog-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.blog-content table { border-collapse: collapse; margin: 1.2em 0; width: auto; max-width: 100%; font-size: 14.5px; }
.blog-content th, .blog-content td { border: 1px solid rgba(0, 0, 0, .25); padding: 6px 12px; text-align: left; }
.blog-content th { background: rgba(0, 0, 0, .7); color: #fff; }
.blog-content tr:nth-child(even) td { background: rgba(255, 255, 255, .15); }
.blog-content iframe, .blog-content video { max-width: 100%; border-radius: 4px; }

/* Editor iframe body: match the grey panel */
body.blog-editor-body {
    background: #a9a9a9;
    margin: 18px 22px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.blog-adjacent {
    max-width: 920px;
    margin: 34px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--blog-line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.blog-adjacent-link {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    max-width: 48%;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--blog-card);
    transition: background-color .2s ease;
}
.blog-adjacent-link:hover { background: var(--blog-card-hover); }
.blog-adjacent-link small { color: var(--blog-muted); }
.blog-adjacent-link span { font-weight: bold; color: #1e1e1e; }
.blog-adjacent-older { text-align: right; margin-left: auto; }

/* ---------- Comments (threaded, Reddit style) ---------- */

.blog-comments { max-width: 920px; margin: 34px auto 0; }
.blog-comment-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.blog-comment-main { flex: 1; min-width: 0; }

.blog-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blog-dark);
    color: #cbc3c3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
    border: 2px solid #6b707a;
}
.blog-avatar-admin { color: var(--blog-accent); border-color: var(--blog-accent); background: #002025; }

/* One comment + its replies */
.bc-thread { display: flex; gap: 10px; transition: opacity .25s ease, transform .25s ease; }
.blog-comment-list > .bc-thread {
    padding: 12px 14px 8px 12px;
    border-radius: 6px;
    background: var(--blog-card);
    border: 1px solid rgba(255, 255, 255, .14);
}
.bc-gutter { flex: 0 0 32px; display: flex; flex-direction: column; align-items: center; }
.bc-thread .blog-avatar { flex: 0 0 32px; width: 32px; height: 32px; font-size: 13px; }
/* The vertical thread line: click to collapse */
.bc-line { flex: 1; width: 16px; margin-top: 4px; cursor: pointer; position: relative; }
.bc-line::before {
    content: '';
    position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 2px;
    border-radius: 1px;
    background: rgba(0, 0, 0, .18);
    transition: background-color .15s ease;
}
.bc-line:hover::before { background: var(--blog-accent-dark); }
.bc-main { flex: 1; min-width: 0; }

.blog-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-height: 32px; align-content: center; }
.blog-comment-user { font-weight: bold; color: #1e1e1e; }
.blog-comment-tag { font-size: 12px; color: var(--blog-muted); font-style: italic; }
.blog-comment-time { font-size: 12px; color: var(--blog-muted); }
.blog-comment-body { white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.bc-muted { color: var(--blog-muted); font-style: italic; font-weight: normal; }

.bc-actions { display: flex; gap: 16px; margin: 4px 0 2px; font-size: 12.5px; font-weight: bold; }
.bc-actions:empty { display: none; }
.bc-actions a { cursor: pointer; color: var(--blog-muted); transition: color .15s ease; }
.bc-actions a:hover { color: #000; }
.bc-actions .bc-delete:hover { color: #8a1c1c; }

.bc-replies { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bc-replies:empty { display: none; }
/* Past the max indent, replies line up with their parent instead of stepping further right */
.bc-replies.bc-flat { margin-left: -42px; }

/* Collapsed thread: just the header row + "[+] n more replies" */
.bc-expand { display: none; }
.bc-collapsed > .bc-main > .bc-collapsible,
.bc-collapsed > .bc-gutter > .bc-line { display: none; }
.bc-collapsed > .bc-main > .blog-comment-head > .bc-expand {
    display: inline;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #005d75;
}
.bc-collapsed > .bc-gutter > .blog-avatar { opacity: .6; }

.bc-reply-form { margin: 8px 0 4px; }
.bc-reply-form textarea { resize: vertical; min-height: 70px; height: auto; }
.bc-reply-buttons { display: flex; gap: 8px; }

.blog-comment-new { animation: slide-up .4s ease; }
.blog-comment-removing { opacity: 0; transform: translateX(20px); }
.blog-no-comments { color: var(--blog-muted); margin: 14px 0 6px; }

.blog-comment-form { display: flex; gap: 12px; margin-top: 4px; }
.blog-comment-form textarea { resize: vertical; min-height: 80px; height: auto; }
.blog-comment-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; }

.blog-signin-prompt {
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .55);
    color: #cbc3c3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ---------- Editor ---------- */

.blog-editor-title { font-size: 22px; }
.blog-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.blog-label { display: block; font-weight: bold; margin: 14px 0 6px; color: #1e1e1e; }
.blog-label small { font-weight: normal; color: var(--blog-muted); }
.blog-editor-main .blog-label:first-child, .blog-panel .blog-label:first-child { margin-top: 0; }
.blog-input-title { font-size: 20px; height: 44px; font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif; font-weight: bold; }
.blog-editor textarea.form-control { height: auto; resize: vertical; }
.blog-editor .tox-tinymce { border-radius: 6px; border-color: #2a2a2a; }

.blog-editor-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 90px; }
.blog-panel {
    padding: 14px;
    border-radius: 6px;
    background: var(--blog-card);
    border: 1px solid rgba(255, 255, 255, .18);
}
.blog-editor-buttons { display: flex; gap: 8px; margin: 14px 0 6px; }
.blog-editor-buttons .blog-btn { flex: 1; }

.blog-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; font-weight: normal; }
.blog-switch input { position: absolute; opacity: 0; pointer-events: none; }
.blog-switch-track {
    width: 42px; height: 22px; border-radius: 999px; background: #555; position: relative; transition: background-color .2s ease;
}
.blog-switch-track::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #ddd;
    transition: transform .2s ease;
}
.blog-switch input:checked + .blog-switch-track { background: #007082; }
.blog-switch input:checked + .blog-switch-track::after { transform: translateX(20px); background: var(--blog-accent); }
.blog-switch input:focus-visible + .blog-switch-track { box-shadow: 0 0 0 2px var(--blog-accent); }
.blog-switch-text::after { content: attr(data-off); font-weight: bold; color: #7a5a00; }
.blog-switch input:checked ~ .blog-switch-text::after { content: attr(data-on); color: #005d75; }

.blog-thumb-picker {
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    overflow: hidden;
    background: #1a1a1a;
    cursor: pointer;
    border: 2px dashed transparent;
    position: relative;
    transition: border-color .15s ease;
}
.blog-thumb-picker:hover, .blog-thumb-picker.blog-drop { border-color: var(--blog-accent); }
.blog-thumb-picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-thumb-placeholder {
    width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    color: #888; font-size: 13px;
}
.blog-thumb-placeholder i { font-size: 30px; }
.blog-uploading::after {
    content: 'Uploading…';
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .65); color: var(--blog-accent); font-weight: bold;
}
.blog-tag-suggest { margin-top: 8px; }
.blog-tag-suggest .blog-tag { font-size: 11px; }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
    .blog-editor-grid { grid-template-columns: 1fr; }
    .blog-editor-side { position: static; }
}
@media (max-width: 700px) {
    .blog-card { flex-direction: column; gap: 12px; }
    .blog-thumb { flex-basis: auto; width: 100%; }
    .blog-article-title { font-size: 26px; }
    .blog-adjacent { flex-direction: column; }
    .blog-adjacent-link { max-width: none; }
    .blog-signin-prompt { flex-direction: column; align-items: stretch; text-align: center; }
}
@media (max-width: 700px) {
    .blog-comment-list > .bc-thread { padding: 10px 8px 6px 6px; }
    .bc-thread { gap: 6px; }
    .bc-gutter { flex-basis: 26px; }
    .bc-thread .blog-avatar { flex-basis: 26px; width: 26px; height: 26px; font-size: 11px; }
    .bc-replies.bc-flat { margin-left: -32px; }
    .blog-comment-form > .blog-avatar { display: none; }
}
