:root {
    /* Light Mode (Pastel) */
    --bg-color: #fdfbf7;
    --text-color: #4a4a4a;
    --primary: #a8d5e2;
    --secondary: #f9a8d4;
    --link-color: #6d9dc5;
    --nav-bg: #f4efea;
    --border-color: #e5e0db;
    --code-bg: #f0ebe6;
}

[data-theme="dark"] {
    /* Dark Mode (Pastel) */
    --bg-color: #2b2a33;
    --text-color: #e8e6e3;
    --primary: #7a9ea8;
    --secondary: #b57a9b;
    --link-color: #8eb1ce;
    --nav-bg: #222129;
    --border-color: #403e4a;
    --code-bg: #1e1d24;
}

@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/Open-Sans-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('/fonts/IBM-Plex-Mono-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    /* Resolution-independent paper texture */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

pre, code {
    font-family: 'IBM Plex Mono', monospace;
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* Header & Nav */
header {
    background-color: var(--nav-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
.logo-img { height: 40px; }
nav { display: flex; gap: 1.3rem; align-items: center; }
nav a {
    color: var(--text-color);
    font-weight: bold;
    position: relative;
    padding-bottom: 5px;
}
nav a::after {
    content: '';
    position: absolute;
    width: 0; height: 2px;
    bottom: 0; left: 0;
    background-color: var(--primary);
    transition: width 0.3s;
}
nav a:hover::after { width: 100%; }

button#theme-toggle {
    background: var(--nav-bg);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
}

/* Main Layout */
main { flex: 1; padding: 2rem; max-width: 800px; margin: 0 auto; width: 100%; }



/* Articles & Search Lists */

article{
   text-align: justify;
}

article img{
    width: 100%;
    height: auto;
}

.item-list { list-style: none; padding: 0; text-align: justify; }
.item-list li {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}
.item-list li:hover { background-color: var(--nav-bg); }
.item-list h2 { margin: 0 0 0.5rem 0; font-size: 1.25rem; }
.item-list p { margin: 0; color: inherit; opacity: 0.8; font-size: 0.95rem; }
.item-list p:after { content: " ..."; }

/* Search Elements */
#search-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--nav-bg);
    color: var(--text-color);
    margin-bottom: 1rem;
}
.search-instructions {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    margin-top: 2rem;
    font-size: .8rem;
}

.pagination div{
    margin: .8rem 0;
}

.pagination button {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    width: 6.5rem;
    
}

#articles-pagination-prev{
    margin-right: 1rem;
}

#articles-pagination-next{
    margin-left: 1rem;
}

.pagination button:not(:disabled):hover{ 
   filter: invert(20%);
}

.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Footer */
footer {
    background-color: var(--nav-bg);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.footer-links { margin-bottom: 0.5rem; }
.footer-links a { color: var(--text-color); }
