/* ============================================================
   SUBPAGE LAYOUT — Shared across about, blog, post, wall, admin
   Append to your CSS or link as css/pages.css
   ============================================================ */

/* --- Single-column page wrapper (replaces the 2-col .wrap on subpages) --- */
.page-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 8px;
    position: relative;
    z-index: 10;
}

.page-back {
    margin-bottom: 10px;
    font-size: 13px;
}

.page-back a {
    color: var(--dim);
    transition: color 0.2s;
}

.page-back a:hover {
    color: var(--accent);
}

.page-footer {
    text-align: center;
    font-size: 14px;
    color: var(--dim);
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* --- Wall Grid (full-width gallery on /wall) --- */
.wall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.wall-item {
    border: 1px solid var(--border);
    padding: 4px;
    background: var(--bg2);
    cursor: pointer;
    transition: border-color 0.2s;
    overflow: hidden;
}

.wall-item:hover {
    border-color: var(--accent);
}

.wall-item img {
    width: 100%;
    height: auto;
    display: block;
    filter: grayscale(20%) contrast(110%);
    transition: filter 0.3s;
}

.wall-item:hover img {
    filter: grayscale(0%) contrast(120%);
}

/* --- Lightbox --- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border: 1px solid var(--border-hi);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 32px;
    color: var(--dim);
    cursor: pointer;
    font-family: 'VT323', monospace;
    transition: color 0.2s;
    z-index: 100000;
}

.lightbox-close:hover {
    color: var(--body);
}

/* --- Mobile --- */
@media (max-width: 680px) {
    .page-wrap {
        padding: 6px;
    }
    .wall-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* ============================================================
   ARTICLE / POST READABILITY
   Applied to blog posts and wiki nodes on /blog/{slug}
   ============================================================ */

.post-body {
    font-size: 15px;
    line-height: 1.75;
    color: var(--mid);
}

.post-body h1 {
    font-family: 'Pixelated MS Sans Serif', sans-serif;
    font-size: 22px;
    color: var(--bright);
    margin-top: 28px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.post-body h2 {
    font-family: 'Pixelated MS Sans Serif', sans-serif;
    font-size: 19px;
    color: var(--accent);
    margin-top: 24px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border);
}

.post-body h3 {
    font-family: 'Pixelated MS Sans Serif', sans-serif;
    font-size: 16px;
    color: var(--bright);
    margin-top: 20px;
    margin-bottom: 8px;
}

.post-body h4, .post-body h5, .post-body h6 {
    font-family: 'Pixelated MS Sans Serif', sans-serif;
    font-size: 15px;
    color: var(--accent2);
    margin-top: 16px;
    margin-bottom: 6px;
}

.post-body p {
    margin-bottom: 14px;
}

.post-body strong {
    color: var(--bright);
    font-weight: bold;
}

.post-body em {
    color: var(--mid);
    font-style: italic;
}

.post-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent2);
    transition: color 0.2s, border-color 0.2s;
}

.post-body a:hover {
    color: var(--link-h);
    border-color: var(--link-h);
}

/* Lists */
.post-body ul, .post-body ol {
    margin: 10px 0 14px 0;
    padding-left: 20px;
}

.post-body ul {
    list-style: none;
}

.post-body ul > li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 8px;
}

.post-body ul > li::before {
    content: '•';
    color: var(--accent2);
    position: absolute;
    left: 0;
}

/* Nested lists */
.post-body ul ul > li::before {
    content: '◦';
    color: var(--dim);
}

.post-body ol > li {
    margin-bottom: 8px;
}

/* Blockquotes */
.post-body blockquote {
    border-left: 2px solid var(--accent2);
    padding: 8px 14px;
    margin: 14px 0;
    color: var(--dim);
    font-style: italic;
    background: var(--bg2);
}

/* Horizontal rules */
.post-body hr {
    border: none;
    border-top: 1px dashed var(--border-hi);
    margin: 24px 0;
}

/* Inline code */
.post-body code:not([class*="language-"]) {
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 2px;
    font-size: 13px;
    color: var(--accent);
    font-family: 'VT323', monospace;
}

/* Code blocks */
.post-body pre {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 12px;
    margin: 14px 0;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}

/* Tables */
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 14px;
}

.post-body th {
    background: var(--bg2);
    color: var(--accent);
    text-align: left;
    padding: 8px 10px;
    border: 1px solid var(--border);
    font-family: 'Pixelated MS Sans Serif', sans-serif;
}

.post-body td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    color: var(--mid);
}

.post-body tr:hover td {
    background: var(--bg2);
}

/* Images */
.post-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    margin: 12px 0;
    display: block;
}

/* KaTeX overrides for readability */
.post-body .katex-display {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow-x: auto;
}

/* --- Search Box --- */
.search-box {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--body);
    font-family: 'VT323', monospace;
    font-size: 15px;
    padding: 8px 10px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.search-box:focus {
    border-color: var(--accent);
}

.search-box::placeholder {
    color: var(--dim);
}

/* --- Font Toggle --- */
.font-toggle {
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--dim);
    font-family: 'VT323', monospace;
    font-size: 13px;
    padding: 3px 10px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    float: right;
    margin-top: -2px;
}

.font-toggle:hover {
    border-color: var(--accent);
    color: var(--mid);
}

.font-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Clean font mode — overrides pixel fonts */
.clean-font .bb,
.clean-font .post-body,
.clean-font .be,
.clean-font .be a,
.clean-font .bd,
.clean-font .px,
.clean-font p,
.clean-font li,
.clean-font td,
.clean-font th,
.clean-font blockquote,
.clean-font .search-box {
    font-family: 'Lora', Georgia, serif !important;
    -webkit-font-smoothing: auto !important;
    font-smooth: auto !important;
}

.clean-font .post-body {
    font-size: 16px;
    line-height: 1.85;
}

.clean-font .post-body h1 {
    font-family: 'Lora', Georgia, serif !important;
    font-size: 26px;
}

.clean-font .post-body h2 {
    font-family: 'Lora', Georgia, serif !important;
    font-size: 21px;
}

.clean-font .post-body h3 {
    font-family: 'Lora', Georgia, serif !important;
    font-size: 18px;
}

.clean-font .bb {
    font-size: 15px;
    line-height: 1.7;
}

.clean-font .be a {
    font-size: 16px;
}

.clean-font .search-box {
    font-size: 16px;
}