/* === Theme Variables === */
:root {
    --bg-color: #334155;
    --text-color: #f1f5f9;
    --text-dim: #94a3b8;
    --accent: #7dd3fc;       /* sky-300 — neon cyan accent */
    --surface: #1e293b;
    --toggle-bg: #475569;
    --toggle-hover: #64748b;
    --border: #475569;
    --scanline-opacity: 0.04;
}

[data-theme="light"] {
    --bg-color: #c7d2fe;
    --text-color: #1e293b;
    --text-dim: #475569;
    --accent: #6366f1;       /* indigo-500 */
    --surface: #e0e7ff;
    --toggle-bg: #a5b4fc;
    --toggle-hover: #8b5cf6;
    --border: #a5b4fc;
    --scanline-opacity: 0.03;
}

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

/* === Scanline overlay — CRT monitor effect === */
.scanlines {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, var(--scanline-opacity)) 2px,
        rgba(0, 0, 0, var(--scanline-opacity)) 4px
    );
}

/* === Base === */
body {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 48px;
}

.header-left {
    min-width: 0;
    overflow: hidden;
}

.site-title {
    font-size: 0.95rem;
    font-weight: normal;
    letter-spacing: 0.05em;
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-title .prompt {
    color: var(--accent);
    margin-right: 0.4em;
}

.site-title .cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--accent);
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.header-tag {
    display: block;
    font-size: 0.7rem;
    color: var(--accent);
    margin-top: 4px;
    letter-spacing: 0.05em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-emoticon {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 0;
    font-family: inherit;
}

.theme-toggle {
    background: var(--toggle-bg);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--toggle-hover);
    transform: scale(1.1);
}

.theme-toggle:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* === Post List === */
.content {
    flex: 1;
}

.post-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-entry {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-left: 2px solid transparent;
}

.post-entry:hover {
    background-color: var(--surface);
    border-left-color: var(--accent);
}

.post-date {
    font-size: 0.75rem;
    color: var(--text-dim);
    flex-shrink: 0;
    letter-spacing: 0.05em;
}

.post-separator {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.post-title {
    font-size: 0.9rem;
    color: var(--text-color);
    transition: color 0.15s ease;
}

.post-entry:hover .post-title {
    color: var(--accent);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 50%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(12px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-title {
    font-size: 1rem;
    font-weight: normal;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.modal-date {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 24px;
    letter-spacing: 0.05em;
}

.modal-body {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-color);
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body strong {
    font-weight: bold;
    color: var(--accent);
}

.modal-body em {
    font-style: italic;
}

.modal-body blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-dim);
    font-style: italic;
}

.modal-body code {
    background: var(--bg-color);
    padding: 2px 6px;
    font-size: 0.8rem;
    font-family: 'Courier New', Courier, monospace;
}

.modal-body pre {
    background: var(--bg-color);
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    border-left: 2px solid var(--accent);
}

.modal-body pre code {
    background: none;
    padding: 0;
}

.modal-body h1, .modal-body h2, .modal-body h3 {
    margin: 24px 0 12px;
    letter-spacing: 0.05em;
}

.modal-body ul, .modal-body ol {
    margin: 12px 0;
    padding-left: 24px;
}

.modal-body li {
    margin-bottom: 6px;
}

.modal-body a {
    color: var(--accent);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* === Redacted === */
.redacted {
    display: inline-block;
    background-color: #111;
    color: transparent;
    height: 0.95em;
    vertical-align: text-bottom;
    min-width: 3ch;
    border-radius: 1px;
    cursor: not-allowed;
    user-select: none;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
    transition: opacity 0.15s ease;
}

.redacted::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.02) 3px,
        rgba(255, 255, 255, 0.02) 4px
    );
}

.redacted:hover::after {
    content: 'REDACTED';
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    font-size: 0.45rem;
    letter-spacing: 0.18em;
    color: rgba(220, 50, 50, 0.75);
    font-family: 'Courier New', monospace;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
}

.redacted-block {
    display: block;
    background-color: #111;
    height: 1em;
    width: 100%;
    margin: 6px 0;
    border-radius: 1px;
    user-select: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* === Responsive === */
@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .site-header {
        flex-direction: column;
        gap: 12px;
    }

    .header-right {
        align-self: flex-end;
    }

    .modal {
        width: 90%;
        padding: 24px;
    }
}
