/* General style */
:root {
    --nav-height: 64px;
    --bg: #f7f9fb;
    --card: #ffffff;
    --text: #222222;
    --muted: #6b7280;
    --accent: #0078d4;
    --border: rgba(0,0,0,0.06);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --nav-bg: #ffffff;
    --hover: #e3e8ee;
    --thumb-bg: #eef2f6;
    --link: #0078d4;
}

.theme-dark {
    --bg: #0f172a;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #60a5fa;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 6px 20px rgba(0,0,0,0.35);
    --nav-bg: #0b1220;
    --hover: rgba(255,255,255,0.08);
    --thumb-bg: #1f2937;
    --link: #93c5fd;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    overflow-x: hidden;
    opacity: 1;
    transition: background 0.2s ease, color 0.2s ease;
}

header {
    margin: 0;
    padding: 0;
}

body.page-fade {
    opacity: 0;
    transition: opacity 180ms ease;
}

/* Soft fade when switching theme */
body.theme-fade {
    opacity: 0.6;
    transition: opacity 180ms ease, background 0.2s ease, color 0.2s ease;
}

.main-nav-list {
    display: grid;
    grid-template-columns: auto 1fr auto;
    width: 100vw; /* full-bleed across viewport */
    height: var(--nav-height);
    background: var(--nav-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 0 5vw;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    align-items: center;
    transition: top 0.3s ease-in-out;
}

.brand-slot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.site-brand {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
    padding: 0; /* no button-like padding */
    border-radius: 0; /* remove rounded corners */
    transition: color 0.2s ease;
    white-space: nowrap;
}

.site-brand:hover {
    color: var(--accent);
    text-decoration: none;
}

.main-nav-list.hide {
    top: -60px;
    opacity: 0;
}

.main-nav-list ul {
    display: flex;
    justify-content: center;
    gap: 2vw;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav-list nav {
    justify-self: center;
}

.main-nav-list .theme-toggle {
    justify-self: end;
    margin-left: 12px;
}

.main-nav-list a:not(.site-brand) {
    display: block;
    padding: 10px 18px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.main-nav-list a:not(.site-brand):hover {
    background: var(--hover);
    color: var(--accent);
}


button {
    padding: 8px 16px;
    border: none;
    background: var(--hover);
    color: var(--text);
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
}

button:hover {
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

main {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 2vw;
    padding-bottom: 40px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 32px 0 16px 0;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (max-width: 700px) {
    .main-nav-list {
        grid-template-columns: 1fr;
        padding: 0 4vw;
        row-gap: 8px;
    }
    .brand-slot {
        width: 100%;
        justify-content: flex-start;
    }
    .main-nav-list nav {
        justify-self: start;
        width: 100%;
    }
    .main-nav-list ul {
        flex-direction: column;
        gap: 0.5em;
        align-items: flex-start;
    }
    main {
        margin: 20px 0;
        padding: 0 1vw;
    }
}

/* Projects list styling */
.projects-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.projects-list li {
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    transition: transform 180ms ease, box-shadow 180ms ease;
    will-change: transform;
}

.projects-list li:hover {
    transform: translateX(6px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.projects-list a {
    font-weight: 600;
    color: var(--link);
}

.muted {
    margin: 6px 0 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.lead {
    color: var(--muted);
    margin-top: 0;
}

.main-nav-list a:not(.site-brand)[aria-current="page"] {
    background: var(--hover);
    color: var(--accent);
}

/* Small helper for contact icon */
#DiscordLogoContact:hover {
    cursor: pointer;
}

/* Blog grid */
.blog-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    justify-items: center; /* center cards in each cell */
}

.blog-card {
    width: 100%;
    max-width: 320px;
    text-align: left;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px;
    transition: transform 180ms ease, box-shadow 180ms ease;
    will-change: transform;
}

.blog-card a {
    text-decoration: none;
    color: inherit;
}

.post-desc { 
    display: -webkit-box; 
    line-clamp: 2;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.blog-card .thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--thumb-bg);
    box-shadow: var(--shadow);
}

.blog-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card h3 {
    margin: 12px 0 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--link);
}

.blog-card a:hover h3 {
    text-decoration: underline;
}

.post-date {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.post-desc {
    display: block;
    margin-top: 6px;
    font-size: 0.95rem;
    color: var(--muted);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.14);
}

/* Blog post page */
.post-shell {
    max-width: 860px;
}

.post-content {
    padding: 28px 24px 36px 24px;
}

.post-header {
    margin-bottom: 28px;
}

.post-back {
    display: inline-block;
    margin-bottom: 12px;
    font-weight: 600;
}

.post-summary {
    color: var(--muted);
    margin: 8px 0 0 0;
    font-size: 1.05rem;
}

.post-cover {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 14px;
    margin-top: 18px;
    box-shadow: var(--shadow);
}

.post-content-body {
    font-size: 1.02rem;
}

.post-content-body > :first-child {
    margin-top: 0;
}

.post-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.post-content-body pre {
    overflow-x: auto;
    padding: 16px;
    border-radius: 12px;
    background: var(--thumb-bg);
    border: 1px solid var(--border);
}

.post-content-body code {
    padding: 0.15em 0.35em;
    border-radius: 6px;
    background: var(--thumb-bg);
    font-size: 0.95em;
}

.post-content-body pre code {
    padding: 0;
    background: transparent;
    font-size: 0.95rem;
}

.post-content-body blockquote {
    margin: 18px 0;
    padding: 4px 16px;
    border-left: 4px solid var(--accent);
    background: rgba(0, 120, 212, 0.05);
    border-radius: 0 10px 10px 0;
}

.post-content-body ul,
.post-content-body ol {
    padding-left: 1.5rem;
}

.post-content-body hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

/* Theme toggle button */
.theme-toggle {
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--hover);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--accent);
    color: #fff;
}