/* === CSS Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === CSS Variables for Retro Frog Theme === */
:root {
    --bg-color: #0a0f0a;
    --bg-secondary: #0d1a0d;
    --text-color: #b8d4b8;
    --text-muted: #5a7a5a;
    --link-color: #4ae04a;
    --link-hover: #7fff7f;
    --accent: #32cd32;
    --border-color: #1a3a1a;
    --max-width: 700px;
    --spacing: 2rem;
}

/* === Base Styles === */
html {
    font-size: 18px;
    line-height: 1.7;
}

body {
    font-family: "IBM Plex Mono", "SF Mono", "Consolas", "Monaco", monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Typography === */
h1, h2, h3 {
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--link-color);
    text-shadow: 0 0 10px rgba(74, 224, 74, 0.3);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
}

a:hover {
    color: var(--link-hover);
    text-shadow: 0 0 8px rgba(74, 224, 74, 0.5);
    text-decoration: none;
}

/* === Header === */
header {
    margin-bottom: var(--spacing);
}

.site-header-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.site-header-link:hover {
    text-decoration: none;
}

.site-logo {
    display: block;
    width: 100%;
    max-width: 700px;
    height: auto;
    margin: 0;
}

.site-logo-small {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--link-color);
    text-shadow: 0 0 15px rgba(74, 224, 74, 0.4);
    letter-spacing: 0.05em;
    text-decoration: none;
}

.site-title:hover {
    color: var(--link-hover);
    text-shadow: 0 0 20px rgba(74, 224, 74, 0.6);
    text-decoration: none;
}

.site-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-style: italic;
}

/* === Main Content === */
main {
    flex: 1;
}

/* === Post List (Homepage) === */
.post-list {
    list-style: none;
}

.post-list li {
    margin-bottom: 2rem;
}

.post-list h2 {
    margin-bottom: 0.5rem;
}

.post-list h2 a:first-child::before {
    content: "> ";
    color: var(--text-muted);
}

.post-list time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.post-list time::before {
    content: "[";
}

.post-list time::after {
    content: "]";
}

.post-list .excerpt {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Tags === */
.tag {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    border-radius: 2px;
    text-transform: lowercase;
    font-weight: normal;
    text-shadow: none;
}

.tag-math {
    background: #1a1a3a;
    color: #7a7aff;
    border: 1px solid #3a3a6a;
}

.tag-comp {
    background: #3a1a1a;
    color: #ff7a7a;
    border: 1px solid #6a3a3a;
}

a.tag {
    cursor: pointer;
}

a.tag:hover {
    text-decoration: none;
}

a.tag.tag-math:hover {
    background: #2a2a4a;
    color: #9a9aff;
}

a.tag.tag-comp:hover {
    background: #4a2a2a;
    color: #ff9a9a;
}

.filter-notice {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing);
}

/* === Individual Post === */
.post-header {
    margin-bottom: var(--spacing);
}

.post-header h1 {
    margin-bottom: 0.5rem;
}

.post-header h1::before {
    content: "> ";
    color: var(--text-muted);
}

.post-header time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.post-header time::before {
    content: "// ";
}

.post-content {
    margin-bottom: var(--spacing);
    text-align: justify;
    word-spacing: -0.1em;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    text-align: left;
    word-spacing: normal;
}

/* After an <hr>, switch to left-aligned for math-heavy content */
.post-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing) 0;
}

.post-content hr ~ * {
    text-align: left;
    word-spacing: normal;
}

.post-content a {
    color: #4ae0e0;
    text-shadow: 0 0 8px rgba(74, 224, 224, 0.3);
}

.post-content a:hover {
    color: #7fffff;
    text-shadow: 0 0 12px rgba(74, 224, 224, 0.5);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
}

.post-content pre {
    background: var(--bg-secondary);
    padding: 1rem;
    overflow-x: auto;
    border-radius: 0;
    border-left: 3px solid var(--accent);
    margin-bottom: 1rem;
}

.post-content code {
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--link-hover);
}

.post-content pre code {
    color: var(--text-color);
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin-left: 0;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-secondary);
}

.post-content strong {
    color: var(--link-color);
    text-shadow: 0 0 8px rgba(74, 224, 74, 0.4);
}

.post-content mark {
    display: block;
    background: var(--bg-secondary);
    color: var(--text-color);
    padding: 1rem;
    margin: 0 0 1.5rem 0;
    border-left: 3px solid var(--accent);
}

.post-content ul,
.post-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content li::marker {
    color: var(--accent);
}

.post-footer {
    margin-top: var(--spacing);
}

.post-footer a::before {
    content: "< ";
}

/* === Footer === */
footer {
    margin-top: auto;
    padding-top: var(--spacing);
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 2px solid var(--border-color);
}

/* === Selection === */
::selection {
    background: var(--accent);
    color: var(--bg-color);
}

/* === Responsive === */
@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    body {
        padding: 1rem;
    }

    h1 { font-size: 1.75rem; }

    .site-title {
        font-size: 1.4rem;
    }
}

/* === Tables === */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
}

.post-content th,
.post-content td {
    border: 1px solid var(--accent);
    padding: 0.35rem 0.75rem;
    text-align: left;
}

.post-content th {
    background-color: var(--bg-secondary);
    color: var(--accent);
}

.post-content tr:nth-child(even) td {
    background-color: var(--bg-secondary);
}

/* === Inline notes === */
.ref-note {
    color: var(--text-muted);
    font-style: italic;
}
