:root {
    --bg: #0f0f14;
    --fg: #f2f2f2;
    --muted: #9aa0a6;
    --accent: #ff6ec7;
    --card: #17171f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--fg);
    background: radial-gradient(1200px 800px at 10% 10%, #1c1c25, var(--bg));
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #232333;
    position: sticky;
    top: 0;
    background: rgba(15,15,20,0.8);
    backdrop-filter: blur(6px);
}

.site-header h1 { margin: 0; font-size: 20px; }
.site-header nav a {
    color: var(--fg);
    text-decoration: none;
    margin-left: 16px;
    padding: 6px 10px;
    border-radius: 8px;
}
.site-header nav a:hover { background: #232333; }

.container { max-width: 900px; margin: 32px auto; padding: 0 20px; }

h2 { font-size: 22px; margin: 20px 0 8px; }
p { color: var(--muted); line-height: 1.6; }

.card-grid {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 16px;
}

.site-footer {
    padding: 24px 20px;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid #232333;
}

a { color: var(--accent); }
a:hover { opacity: 0.9; }

/* Blog Post List Styles */
.posts-list {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flexbox to shrink if needed */
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.post-link {
    display: flex;
    flex-direction: column;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-height: 100%;
}

.post-link h3 {
    margin: 0 0 8px 0;
    padding: 0;
    font-size: 18px;
    color: var(--fg);
    line-height: 1.3;
}

.post-link:hover h3 {
    color: var(--accent);
}

.post-meta-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
    line-height: 1.5;
    margin-top: auto; /* Push to bottom if parent is flex */
}

.post-date {
    display: inline-block;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: var(--muted);
    line-height: inherit;
    vertical-align: baseline;
}

.post-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
    margin: 0;
    padding: 0;
    line-height: inherit;
    vertical-align: baseline;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 110, 199, 0.08);
    border: 1px solid rgba(255, 110, 199, 0.2);
    border-radius: 4px;
    font-size: 11px;
    text-decoration: none;
    color: var(--accent);
    transition: background 0.2s, border-color 0.2s;
    opacity: 0.8;
    vertical-align: baseline;
    line-height: 1.4;
    margin: 0;
}

.tag:hover {
    background: rgba(255, 110, 199, 0.15);
    border-color: rgba(255, 110, 199, 0.4);
    opacity: 1;
}

/* Sort and Filter Controls */
.sort-controls {
    margin: 20px 0;
    padding: 16px;
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
}

.sort-controls label {
    margin-right: 12px;
    color: var(--fg);
}

.sort-select {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid #232333;
    border-radius: 8px;
    color: var(--fg);
    font-size: 14px;
    cursor: pointer;
}

.sort-select:hover {
    border-color: var(--accent);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

.tags-filter {
    margin: 16px 0;
    padding: 16px;
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-label {
    color: var(--muted);
    font-size: 14px;
    margin-right: 8px;
}

.tag-filter-item {
    padding: 6px 12px;
    background: rgba(255, 110, 199, 0.1);
    border: 1px solid rgba(255, 110, 199, 0.3);
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: var(--accent);
    transition: all 0.2s;
}

.tag-filter-item:hover {
    background: rgba(255, 110, 199, 0.2);
    border-color: var(--accent);
}

.tag-filter-item.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.no-posts {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

/* Post Page Styles */
.post-back {
    margin-bottom: 20px;
}

.back-button {
    display: inline-block;
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.back-button:hover {
    background: #232333;
    border-color: var(--accent);
    color: var(--accent);
}

.post-article {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
}

.post-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #232333;
}

.post-header h1 {
    margin: 0 0 12px 0;
    font-size: 28px;
    color: var(--fg);
}

.post-meta {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--muted);
}

.post-body {
    line-height: 1.8;
    color: var(--fg);
}

.post-body p {
    margin: 16px 0;
    color: var(--fg);
}

.post-body a {
    color: var(--accent);
    text-decoration: underline;
}

.post-body a:hover {
    opacity: 0.8;
}

.post-body strong,
.post-body b {
    font-weight: 600;
}

.post-body em,
.post-body i {
    font-style: italic;
}

.post-body ul,
.post-body ol {
    margin: 16px 0;
    padding-left: 24px;
    color: var(--fg);
}

.post-body li {
    margin: 8px 0;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    margin: 24px 0 12px 0;
    color: var(--fg);
    font-weight: 600;
}

.post-body h1 { font-size: 24px; }
.post-body h2 { font-size: 22px; }
.post-body h3 { font-size: 20px; }
.post-body h4 { font-size: 18px; }
.post-body h5 { font-size: 16px; }
.post-body h6 { font-size: 14px; }

.post-body img,
.post-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-body img {
    /* Ensure all images in post body are styled */
    display: block;
}

.post-body iframe,
.post-body video {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

.post-video {
    width: 100%;
    max-width: 100%;
    height: auto;
}

.post-body blockquote {
    margin: 20px 0;
    padding: 16px 20px;
    border-left: 3px solid var(--accent);
    background: rgba(255, 110, 199, 0.05);
    border-radius: 4px;
    font-style: italic;
    color: var(--fg);
}

.post-body a {
    color: var(--accent);
    text-decoration: underline;
}

.post-body a:hover {
    opacity: 0.8;
}

.quote-source {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
    font-style: normal;
}

/* Comments Styles */
.post-comments {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
}

.post-comments h2 {
    margin: 0 0 24px 0;
    font-size: 22px;
    color: var(--fg);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid #232333;
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.comment-author:hover {
    opacity: 0.8;
}

.comment-date {
    font-size: 12px;
    color: var(--muted);
}

.comment-text {
    color: var(--fg);
    line-height: 1.6;
    font-size: 14px;
}

.no-comments {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}

/* Contact Form Styles */
.contact-section {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
}

.contact-section h2 {
    margin: 0 0 24px 0;
    font-size: 22px;
    color: var(--fg);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    background: var(--bg);
    border: 1px solid #232333;
    border-radius: 8px;
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-submit {
    padding: 12px 24px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    align-self: flex-start;
}

.btn-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Portfolio Styles */
.portfolio-grid {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.project-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid #232333;
    transition: transform 0.2s, border-color 0.2s;
}

.project-banner:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.project-banner-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-banner-image {
    width: 100%;
    aspect-ratio: 4 / 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.project-banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4), transparent);
    padding: 24px 20px;
    display: flex;
    align-items: flex-end;
}

.project-banner-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--fg);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Project Page Styles */
.project-article {
    background: var(--card);
    border: 1px solid #232333;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
}

.project-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #232333;
}

.project-header h1 {
    margin: 0 0 12px 0;
    font-size: 32px;
    color: var(--fg);
}

.project-timeframe {
    margin: 0;
    font-size: 16px;
    color: var(--muted);
    font-weight: 500;
}

.project-body {
    line-height: 1.8;
    color: var(--fg);
}

.project-description {
    margin-bottom: 32px;
}

.project-description p {
    margin: 16px 0;
    color: var(--fg);
}

.project-involvement {
    margin-bottom: 32px;
    padding: 20px;
    background: rgba(255, 110, 199, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
}

.project-involvement h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: var(--fg);
}

.project-involvement p {
    margin: 0;
    color: var(--fg);
}

.project-links {
    margin-bottom: 32px;
}

.project-links h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    color: var(--fg);
}

.project-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 110, 199, 0.1);
    border: 1px solid rgba(255, 110, 199, 0.3);
    border-radius: 8px;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
}

.project-link:hover {
    background: rgba(255, 110, 199, 0.2);
    border-color: var(--accent);
    transform: translateX(4px);
}

.external-icon {
    font-size: 14px;
    opacity: 0.7;
}

/* Project Gallery Styles */
.project-gallery {
    margin-bottom: 32px;
}

.project-gallery h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--fg);
}

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

.gallery-item {
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 8px;
    overflow: hidden;
    background: var(--card);
    border: 1px solid #232333;
}

.gallery-item:hover {
    transform: scale(1.02);
    border-color: var(--accent);
}

.gallery-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.gallery-caption {
    padding: 12px;
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-container {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-caption {
    margin: 16px 0 0 0;
    padding: 12px;
    color: var(--fg);
    text-align: center;
    font-size: 16px;
    max-width: 800px;
}

.lightbox-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--fg);
    border-radius: 20px;
    font-size: 14px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: var(--fg);
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* 3D Viewer Styles */
.project-3d-viewer {
    margin-bottom: 32px;
}

.project-3d-viewer h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--fg);
}

.viewer-container {
    background: var(--bg);
    border: 1px solid #232333;
    border-radius: 12px;
    overflow: hidden;
    min-height: 500px;
}

.no-projects {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-article,
    .post-comments,
    .contact-section,
    .project-article {
        padding: 20px;
    }
    
    .post-header h1,
    .project-header h1 {
        font-size: 24px;
    }
    
    .tag-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .comment {
        flex-direction: column;
    }
    
    .comment-avatar {
        align-self: flex-start;
    }
    
    .project-banner-title {
        font-size: 20px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .viewer-container {
        min-height: 300px;
    }
}


