/**
 * Public Frontend Styles
 * Color scheme inspired by kristian.gavran.ch
 */

/* CSS Variables */
:root {
    --bg-color: #f0f0f0;
    --text-color: #232333;
    --accent-color: #e77a18;
    --border-color: rgb(53, 33, 73);
    --code-bg: #ece6ce;
    --code-inline-bg: #f1f1f1;
    --meta-color: rgb(148, 143, 143);
    --blockquote-color: #737373;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Header */
header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: relative;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.site-title a {
    color: var(--text-color);
    text-decoration: none;
}

/* Nav toggle button (burger) */
.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    gap: 0.25rem;
    z-index: 10;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    transition: all 0.2s;
    border-radius: 2px;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--accent-color);
    transition: background-color 0.2s;
}

.main-nav a:hover {
    background-color: #000;
    color: #fff;
}

/* Main content */
main {
    padding: 1rem 0;
}

/* Post list */
.post-list {
    list-style: none;
    margin-top: 1rem;
}

.post-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .8rem;
    margin-bottom: 0.9rem;
}

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

.post-item h2 a {
    color: var(--text-color);
    text-decoration: none;
}

.post-item h2 a:hover {
    color: var(--accent-color);
}

.post-meta {
    color: var(--meta-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-excerpt {
    color: var(--text-color);
    line-height: 1.7;
}

.post-excerpt p {
    margin-bottom: 1rem;
}

.read-more {
    color: var(--text-color) !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--accent-color);
    transition: background-color 0.2s;
}

.read-more:hover {
    background-color: #000;
    color: #fff !important;
}

/* Single post */
.single-post {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.single-post h1 {
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.single-post .post-meta {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px dotted var(--border-color);
}

.single-post .content {
    line-height: 1.8;
}

.single-post .content h1,
.single-post .content h2,
.single-post .content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.single-post .content h1 { font-size: 1.75rem; }
.single-post .content h2 { font-size: 1.5rem; }
.single-post .content h3 { font-size: 1.25rem; }

.single-post .content p {
    margin-bottom: 1.25rem;
}

.single-post .content ul,
.single-post .content ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

.single-post .content li {
    margin-bottom: 0.1rem;
    margin-left: 1.5rem;
}

.single-post .content code {
    background: var(--code-inline-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.single-post .content pre {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #888;
}

.single-post .content pre code {
    background: transparent;
    padding: 0;
}

.single-post .content blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--blockquote-color);
}

.single-post .content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 3px solid #ececec;
}

.single-post .content a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1.9px solid var(--accent-color);
}

.single-post .content a:hover {
    background-color: #000;
    color: #fff;
}

/* Selection */
::selection {
    background: var(--accent-color);
    color: #fff;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--meta-color);
}

/* Footer */
footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--meta-color);
}

.footer-separator {
    margin: 0 0.75rem;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 1.0rem;
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1.5px solid var(--accent-color);
}

.back-link:hover {
    background-color: #000;
    color: #fff;
}

/* Back to top link */
.back-to-top {
    display: block;
    text-align: right;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1.5px solid var(--accent-color);
    width: fit-content;
    margin-left: auto;
    margin-top: 0.5rem;

    color: var(--text-color) !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--accent-color);
    transition: background-color 0.2s;
}

.back-to-top:hover {
    background-color: #000;
    color: #fff !important;
}

/* To top link */
.to-top {
    color: var(--meta-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.to-top:hover {
    color: var(--accent-color);
}

/* HR */
hr {
    border: 0;
    border-top: 2px dotted #000;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* Mobile navigation */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .main-nav.active {
        max-height: 400px;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .main-nav li {
        border-bottom: 1px solid #f0ede9;
    }

    .main-nav li:last-child {
        border-bottom: none;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem 1.5rem;
        border-bottom: none;
    }
}

/* ============================================================================
   TAG PILLS
   ============================================================================ */

/* Tag pills container */
.tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 0.75rem;
}

/* Individual tag pill */
.tag-pill {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.17rem 0.4rem; 
    border-radius: 15px;
    font-weight: 400;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Hover effect */
.tag-pill:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Active/pressed state */
.tag-pill:active {
    transform: translateY(0);
}

/* Fallback if inline style is missing */
.tag-pill:not([style*="background-color"]) {
    background-color: var(--accent-color);
}

/* Tag pills in post excerpts (slightly smaller) */
.post-item .tag-pills {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
}

.post-item .tag-pill {
    font-size: 0.7rem;
    padding: 0.17rem 0.4rem;
}

/* Tag list page (when showing all tags) */
.tag-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.tag-list-item {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #ffffff;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tag-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.tag-list-item .tag-pill {
    align-self: flex-start;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    padding: 0.4rem 1rem;
}

.tag-list-item .tag-count {
    color: var(--meta-color);
    font-size: 0.9rem;
}

.tag-list-item .tag-description {
    margin-top: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Tag filter header */
.tag-filter-header {
    padding-bottom: 1rem;
}

.tag-filter-header h2 {
    margin-bottom: 0.5rem;
}

.tag-filter-header .tag-pill {
    font-size: 1rem;
    padding: 0.28rem 0.7rem; /* 30% reduction: 0.4 * 0.7 = 0.28, 1.0 * 0.7 = 0.7 */
    margin-right: 0.5rem;
    vertical-align: middle;
}

.tag-filter-links {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 8px;
}

.tag-filter-clear {
    color: var(--text-color) !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--accent-color);
    transition: background-color 0.2s;
}

.tag-filter-clear:visited {
    color: var(--accent-color);
}

.tag-filter-clear:hover {
    background-color: #000;
    color: #fff !important;    
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tag-list {
        grid-template-columns: 1fr;
    }
    
    .tag-pills {
        gap: 0.4rem;
    }
    
    .tag-pill {
        font-size: 0.8rem;
        padding: 0.21rem 0.525rem; /* 30% reduction: 0.3 * 0.7 = 0.21, 0.75 * 0.7 = 0.525 */
    }
    
    .tag-filter-links {
        gap: 0.5rem;
    }
}

