:root {
    --bg: #f6f8fc;
    --text: #1d2636;
    --muted: #5f6e85;
    --border: #c8d4e8;
    --bar-bg: #e8eef8;
    --accent: #2a62d9;
    --danger: #c0525f;
    --header-text: #f8fbff;
    --shadow: #0c1424;
    --preview-bg: #fff;
}

:root[data-theme='dark'] {
    --bg: #070f20;
    --text: #f5f9ff;
    --muted: #c2d1ea;
    --border: #304a78;
    --bar-bg: #0e1c37;
    --accent: #7ec0ff;
    --danger: #ff9ca8;
    --header-text: #ffffff;
    --shadow: #040916;
    --preview-bg: #0b1730;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    user-select: text;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

/* ─── TMUX LAYOUT ─── */
.tmux-root {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    border: 1px solid var(--border);
}

.pane {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-left {
    width: 100%;
}

.pane-left.split {
    width: 50%;
}

.pane-right {
    width: 0%;
    overflow: hidden;
    border-left: none;
    
}

.pane-right.open {
    width: 50%;
    border-left: 1px solid var(--border);
}

/* ─── PANE TITLE BAR (tmux status line style) ─── */
.pane-bar {
    height: 22px;
    background: var(--bar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 16px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
}

.pane-bar .bar-title {
    color: var(--accent);
    font-weight: bold;
}

.pane-bar .bar-close {
    margin-left: auto;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

.pane-bar .bar-close:hover {
    color: var(--danger);
}

.theme-toggle {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bar-bg);
}

/* ─── LEFT PANE: SCROLLABLE CONTENT ─── */
.pane-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.pane-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* ─── PLASMA HEADER (canvas layer + ASCII overlay) ─── */
.plasma-header {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#plasma-bg canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.ascii-name {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    /* font-size set dynamically by scaleAsciiArt() */
    line-height: 1;
    white-space: pre;
    color: var(--header-text);
    text-shadow:
        3px 3px 0 var(--shadow), -1px -1px 0 var(--shadow),
        1px -1px 0 var(--shadow), -1px 1px 0 var(--shadow),
        1px 1px 0 var(--shadow);
    /* prevent any overflow from ever showing */
    max-width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

/* ─── TERMINAL BODY (plaintext layout) ─── */
.term-body {
    padding: 20px 24px;
    color: var(--text);
}

/* prompt line */
.prompt {
    color: var(--accent);
    margin-bottom: 4px;
}

.prompt .path {
    color: var(--accent);
}

.prompt .dollar {
    color: var(--text);
}

/* section header */
.section-label {
    color: var(--accent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 28px 0 6px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 3px;
    font-weight: bold;
}

.section-label:first-of-type {
    margin-top: 18px;
}

/* nav items — the interactive links */
.nav-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 5px 8px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 2px;
    outline: none;
}

.nav-item:hover,
.nav-item.focused {
    background: var(--bar-bg);
}

.nav-item .nav-idx {
    color: var(--muted);
    font-size: 11px;
    min-width: 22px;
    text-align: right;
}

.nav-item .nav-label {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nav-item .nav-desc {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.nav-item:hover .nav-label,
.nav-item.focused .nav-label {
    color: var(--accent);
}

/* inline text blocks */
.info-line {
    color: var(--muted);
    padding: 3px 8px;
    font-size: 13px;
}

.info-line a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.info-line a:hover {
    color: var(--accent);
}

.media-block {
    margin: 12px 8px 6px;
    display: grid;
    gap: 6px;
}

.img-placeholder {
    height: 140px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: linear-gradient(135deg, var(--bar-bg), var(--bg));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.img-caption {
    font-size: 11px;
    color: var(--muted);
}

/* ─── RIGHT PANE: PREVIEW (iframe of raw HTML) ─── */
.preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--preview-bg);
}

/* ─── MOBILE: stack vertically ─── */
@media (max-width: 700px) {
    .tmux-root {
        flex-direction: column;
    }

    .pane-left {
        width: 100%;
        height: 100%;
    }

    .pane-left.split {
        width: 100%;
        height: 20%;
    }

    .pane-right {
        width: 100%;
        height: 0%;
        border-left: none;
        border-top: none;
    }

    .pane-right.open {
        width: 100%;
        height: 80%;
        border-top: 1px solid var(--border);
    }

    .plasma-header {
        height: 100px;
    }

    .ascii-name {
        font-size: 5px;
    }
}
