/*
  posts.css — Blog Posts Styles
*/

/* Breadcrumb */
.breadcrumb {
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg) 94%, transparent);
}

.breadcrumb .container {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    color: var(--muted);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Posts Hero */
.posts-hero {
    padding: 48px 0 32px;
    text-align: center;
}

.posts-hero h1 {
    font-size: clamp(32px, 5vw, 48px);
    margin: 0 0 12px;
}

.posts-hero .lead {
    color: var(--muted);
    font-size: 18px;
    margin: 0;
    max-width: 600px;
    margin-inline: auto;
}

.posts-hero.category-hero,
.posts-hero.tag-hero {
    background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 5%, transparent), transparent);
}

.hero-label {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent);
    color: #020617;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.post-count {
    color: var(--muted);
    font-size: 14px;
    margin-top: 8px;
}

/* Posts Main Layout */
.posts-main {
    padding: 32px 0 64px;
}

.posts-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

@media (min-width: 960px) {
    .posts-layout {
        grid-template-columns: 260px 1fr;
    }
}

/* Sidebar */
.posts-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (max-width: 959px) {
    .posts-sidebar {
        display: none; /* Hide on mobile, show filters inline instead */
    }
}

.sidebar-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.sidebar-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 0 0 16px;
}

.sidebar-hint {
    font-size: 12px;
    color: var(--muted);
    margin: -8px 0 12px;
    opacity: 0.8;
}

/* Search Form */
.search-form {
    display: flex;
    gap: 8px;
}

.search-form input {
    flex: 1;
    min-width: 0;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-form button {
    background: var(--accent);
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    color: #020617;
    cursor: pointer;
    display: grid;
    place-items: center;
}

/* Filter List */
.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-list li {
    margin-bottom: 4px;
}

.filter-list a {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-list a:hover {
    background: var(--bg);
}

.filter-list a.active {
    background: color-mix(in oklab, var(--accent) 15%, transparent);
    color: var(--accent);
}

.filter-list .count {
    color: var(--muted);
    font-size: 13px;
}

.filter-list.archives .year-header {
    font-weight: 600;
    padding: 12px 12px 4px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags-cloud .tag {
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.tags-cloud .tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tags-cloud .tag.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #020617;
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.active-filters > span:first-child {
    color: var(--muted);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: color-mix(in oklab, var(--accent) 15%, transparent);
    border-radius: 20px;
    color: var(--accent);
    font-size: 13px;
}

.filter-tag .remove-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: inherit;
    text-decoration: none;
    opacity: 0.7;
    border-radius: 50%;
    transition: all 0.2s;
}

.filter-tag .remove-filter:hover {
    opacity: 1;
    background: color-mix(in oklab, var(--accent) 30%, transparent);
}

.filter-tag .remove-filter svg {
    width: 12px;
    height: 12px;
}

.clear-all {
    margin-left: auto;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

.clear-all:hover {
    color: var(--accent);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 640px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1100px) {
    .posts-grid:not(.small) {
        grid-template-columns: repeat(2, 1fr);
    }
}

.posts-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Post Card */
.post-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(76,194,255,0.1), var(--shadow);
}

.post-card-image {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.post-category {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.post-category:hover {
    text-decoration: underline;
}

.post-card-title {
    font-size: 20px;
    margin: 0 0 8px;
    line-height: 1.3;
}

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

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

.post-card-excerpt {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

.tag-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.tag-link:hover,
.tag-link.active {
    color: var(--accent);
}

/* No Posts */
.no-posts {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
}

.no-posts svg {
    opacity: 0.5;
    margin-bottom: 16px;
}

.no-posts h3 {
    font-size: 20px;
    color: var(--text);
    margin: 0 0 8px;
}

.no-posts p {
    margin: 0 0 20px;
}

/* Single Post */
.single-post {
    padding-bottom: 64px;
}

.post-hero {
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.post-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, var(--bg) 100%);
}

.post-header {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 0 32px;
    text-align: center;
}

.post-hero + .container .post-header {
    margin-top: -120px;
    position: relative;
}

.post-meta {
    margin-bottom: 16px;
}

.post-category-link {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent);
    color: #020617;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s;
}

.post-category-link:hover {
    transform: scale(1.05);
}

.post-header h1 {
    font-size: clamp(28px, 5vw, 42px);
    margin: 0 0 20px;
    line-height: 1.2;
}

.post-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: var(--muted);
    font-size: 14px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.post-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.post-dates time,
.edited-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Post Content */
.post-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 17px;
    line-height: 1.8;
    color: color-mix(in oklab, var(--text) 90%, var(--muted));
}

.post-content p {
    margin: 0 0 1.5em;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    color: var(--text);
    line-height: 1.25;
}

.post-content h1 {
    font-size: 34px;
    margin: 2.2em 0 0.6em;
}

.post-content h2 {
    font-size: 28px;
    margin: 2em 0 0.5em;
}

.post-content h3 {
    font-size: 22px;
    margin: 1.5em 0 0.5em;
}

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

.post-content ul,
.post-content ol {
    margin: 0 0 1.5em;
    padding-left: 1.5em;
}

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

.post-content pre {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    margin: 0 0 1.5em;
}

.post-content code {
    background: var(--bg-elev);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

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

.post-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 0 0 1.5em;
    padding: 16px 20px;
    background: color-mix(in oklab, var(--accent) 5%, transparent);
    border-radius: 0 10px 10px 0;
    font-style: italic;
}

.post-content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}

/* Post Gallery */
.post-gallery {
    max-width: 1000px;
    margin: 48px auto;
    padding: 0 20px;
}

.post-gallery h2 {
    font-size: 24px;
    margin: 0 0 20px;
    text-align: center;
}

.post-gallery .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.post-gallery .gallery-item {
    aspect-ratio: 4/3;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.post-gallery .gallery-item:hover {
    transform: scale(1.02);
}

.post-gallery .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Post Footer */
.post-footer {
    max-width: 800px;
    margin: 48px auto 0;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.post-tags span {
    color: var(--muted);
    font-size: 14px;
}

.post-tags .tag {
    padding: 6px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.post-tags .tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Related Posts */
.related-posts {
    padding: 48px 0;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
}

.related-posts h2 {
    font-size: 24px;
    margin: 0 0 24px;
    text-align: center;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: 24px;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
}

/* Homepage Posts Section */
.posts-section {
    padding: 64px 0;
}

.posts-section h2 {
    font-size: clamp(22px, 2.8vw, 34px);
    margin: 0 0 12px;
}

.posts-section .section-lead {
    color: var(--muted);
    margin: 4px 0 24px;
}

.posts-section .posts-grid {
    margin-bottom: 24px;
}

.posts-section .view-all {
    display: block;
    text-align: center;
}
