/* ============================================================
   Anvar Said — personal blog (v2)
   Minimal light theme. Single :root theme — no dark mode by design.
   Inspired by azimjon.com / otabek.io: content-first, lots of air.
   ============================================================ */

:root {
    --bg:           #ffffff;
    --surface:      #f6f6f5;
    --text:         #1c1c1c;
    --text-muted:   #6e6e6e;
    --text-soft:    #9a9a9a;
    --accent:       #2b6cb0;
    --accent-hover: #1f4f82;
    --border:       #ececec;
    --radius:       10px;
    --maxw:         720px;
    --font:         "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                    Roboto, Helvetica, Arial, sans-serif;
    --mono:         "SF Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

a {
    text-decoration: none;
    color: var(--accent);
    transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
.content {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 24px 20px 18px;
    border-bottom: 1px solid var(--border);
}
.site-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.site-title:hover { color: var(--text); }
.nav-right {
    display: flex;
    align-items: center;
    gap: 22px;
}
.nav-link {
    font-size: 15px;
    color: var(--text-muted);
}
.nav-link:hover { color: var(--text); }
.nav-cta {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.nav-cta:hover {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

/* ---------- Section heading ---------- */
.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 48px 0 4px;
}

/* ---------- Home: profile card ---------- */
.home-section { margin-top: 24px; }
.home-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}
.profile-pict {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.home-text h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}
.home-text p {
    margin: 4px 0 10px;
    font-size: 15px;
    color: var(--text-muted);
}
.social-icons { display: flex; gap: 14px; }
.social-icons a { display: inline-flex; }
.social-icons img {
    width: 20px;
    height: 20px;
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.social-icons img:hover { opacity: 1; transform: translateY(-2px); }

/* ---------- Post list (home + category) ---------- */
.posts-grid,
.category-posts {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}
.post-card,
.category-post-card {
    display: block;
    padding: 22px 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
}
.post-card:hover,
.category-post-card:hover { color: inherit; }
.post-card:hover .post-title,
.category-post-card:hover .post-title { color: var(--accent); }

.post-info .post-title,
.home-wrapper .post-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
    transition: color 0.15s ease;
}
.post-excerpt {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}
.post-date-sm {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-soft);
}
.empty-note {
    color: var(--text-muted);
    padding: 24px 0;
}

/* ---------- Category page layout ---------- */
.category-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-top: 8px;
}
.category-posts { flex: 1; min-width: 0; }
.category-sidebar {
    width: 180px;
    flex-shrink: 0;
    padding-top: 22px;
}
.sidebar-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
    margin: 0 0 12px;
}
.sidebar-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-section li { margin-bottom: 8px; }
.sidebar-section a {
    color: var(--text-muted);
    font-size: 15px;
}
.sidebar-section a:hover { color: var(--accent); }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 36px 0;
}
.page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-muted);
}
.page-btn:hover {
    border-color: var(--text-soft);
    color: var(--text);
}
.page-current {
    font-size: 14px;
    color: var(--text-soft);
}

/* ---------- Post detail ---------- */
.post-container {
    max-width: var(--maxw);
    margin: 40px auto 0;
}
.post-cover {
    width: 100%;
    height: 340px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 28px;
}
.post-container .post-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    text-align: left;
}
.post-date {
    margin: 0 0 36px;
    font-size: 14px;
    color: var(--text-soft);
    text-align: left;
}

/* ---------- Post body (rendered markdown) ---------- */
.post-body {
    font-size: 16px;
    line-height: 1.8;
    color: #2a2a2a;
}
.post-body h1,
.post-body h2,
.post-body h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 1.8em 0 0.6em;
}
.post-body h1 { font-size: 26px; }
.post-body h2 { font-size: 22px; }
.post-body h3 { font-size: 18px; }
.post-body p { margin: 0 0 1.2em; }
.post-body a {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.post-body ul,
.post-body ol {
    padding-left: 1.4em;
    margin: 0 0 1.2em;
}
.post-body li { margin-bottom: 0.4em; }
.post-body img {
    border-radius: var(--radius);
    margin: 1em 0;
}
.post-body blockquote {
    margin: 1.4em 0;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--border);
    color: var(--text-muted);
}
.post-body code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.88em;
    font-family: var(--mono);
}
.post-body pre,
.post-body .codehilite {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 1.4em 0;
    line-height: 1.5;
}
.post-body .codehilite pre {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
}
.post-body pre code {
    background: none;
    padding: 0;
    font-size: 13.5px;
}
.post-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 14.5px;
}
.post-body th,
.post-body td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.post-body th { background: var(--surface); }

/* ---------- Post nav (prev / next) ---------- */
.post-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.nav-btn {
    font-size: 14px;
    color: var(--text-muted);
    padding: 6px 0;
}
.nav-btn:hover { color: var(--accent); }
.see-more-btn { color: var(--text-soft); }
.invisible { visibility: hidden; }

/* ---------- About me ---------- */
.aboutme-section { margin-top: 24px; }
.aboutme-profile {
    display: flex;
    flex-direction: column;
}
.profile-pic {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 28px;
}
.aboutme-text h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 16px;
}
.aboutme-text p {
    font-size: 16px;
    line-height: 1.8;
    color: #2a2a2a;
    margin: 0 0 18px;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 48px 20px;
    margin-top: 64px;
    color: var(--text-soft);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   Mobile (max 700px)
   ============================================================ */
@media (max-width: 700px) {
    .content { padding: 0 16px; }

    /* Navbar — allow nav-right to wrap if links don't fit on one line. */
    .navbar { padding: 18px 16px 14px; flex-wrap: wrap; gap: 10px 14px; }
    .site-title { font-size: 17px; }
    .nav-right { gap: 14px; flex-wrap: wrap; row-gap: 8px; }
    .nav-link { font-size: 14px; }
    .nav-cta { font-size: 13px; padding: 5px 12px; }

    .home-profile { gap: 16px; }
    .profile-pict { width: 72px; height: 72px; }
    .home-text h1 { font-size: 21px; }
    .home-text p { font-size: 14.5px; }

    .page-title { font-size: 20px; margin-top: 40px; }

    .posts-grid, .category-posts { margin-top: 4px; }
    .post-card, .category-post-card { padding: 18px 0; }
    .post-info .post-title,
    .home-wrapper .post-title { font-size: 17px; }
    .post-excerpt { font-size: 14.5px; }

    .category-wrapper { flex-direction: column; gap: 0; }
    .category-sidebar {
        width: 100%;
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid var(--border);
    }

    .post-container { margin-top: 24px; }
    .post-cover { height: auto; max-height: 240px; }
    .post-container .post-title { font-size: 24px; }
    .post-date { margin-bottom: 28px; font-size: 13px; }
    .post-body { font-size: 15.5px; line-height: 1.75; }
    .post-body h1 { font-size: 22px; }
    .post-body h2 { font-size: 19px; }
    .post-body h3 { font-size: 17px; }
    .post-body pre,
    .post-body .codehilite { padding: 12px 14px; font-size: 13px; }
    .post-body pre code { font-size: 13px; }
    /* Tables can blow up the layout on narrow screens — let them scroll. */
    .post-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .post-nav { font-size: 13px; gap: 8px; }
    .nav-btn { padding: 4px 0; }

    .aboutme-section { margin-top: 16px; }
    .profile-pic { height: 220px; margin-bottom: 22px; }
    .aboutme-text h1 { font-size: 22px; }
    .aboutme-text p { font-size: 15px; line-height: 1.75; }

    .footer { margin-top: 48px; padding: 36px 16px; }
}

/* ============================================================
   Small phones (max 400px) — tighter spacing for narrow viewports.
   ============================================================ */
@media (max-width: 400px) {
    .content { padding: 0 14px; }
    .navbar { padding: 16px 14px 12px; }
    .site-title { font-size: 16px; }
    .nav-link { font-size: 13.5px; }
    .nav-cta { font-size: 12.5px; padding: 4px 10px; }

    .home-profile { gap: 14px; }
    .profile-pict { width: 64px; height: 64px; }
    .home-text h1 { font-size: 19px; }

    .post-container .post-title { font-size: 22px; }
    .post-body { font-size: 15px; }
    .post-cover { max-height: 200px; }

    .profile-pic { height: 180px; }
}
