/* ============================================
   PORTFOLIO — Minimalist Design System
   ============================================ */

:root {
    --ink: #1a1a1a;
    --ink-light: #555;
    --ink-muted: #888;
    --paper: #fafaf9;
    --paper-warm: #f0f4f7;
    --accent: #3a7cbd;
    --accent-light: #e4eef6;
    --accent-mid: #5a9fd4;
    --border: #dce3e8;
    --radius: 6px;
    --font-body: "Source Serif 4", "Georgia", serif;
    --font-display: "DM Sans", "Helvetica Neue", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;
    --max-width: 1080px;
    --transition: 0.25s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.72;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ---- NAVBAR ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 249, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar__logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.navbar__links { display: flex; gap: 2rem; list-style: none; }

.navbar__links a {
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-light);
    letter-spacing: 0.01em;
    position: relative;
    padding-bottom: 2px;
}

.navbar__links a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width var(--transition);
}

.navbar__links a:hover { opacity: 1; color: var(--ink); }
.navbar__links a:hover::after { width: 100%; }
.navbar__links a.active { color: var(--accent); }
.navbar__links a.active::after { width: 100%; }

/* Mobile nav toggle */
.navbar__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    position: relative;
}
.navbar__toggle span,
.navbar__toggle::before,
.navbar__toggle::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background: var(--ink);
    position: absolute;
    left: 0;
    transition: transform var(--transition);
}
.navbar__toggle::before { top: 0; }
.navbar__toggle span { top: 50%; transform: translateY(-50%); }
.navbar__toggle::after { bottom: 0; }

@media (max-width: 768px) {
    .navbar__toggle { display: block; }
    .navbar__links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--paper);
        flex-direction: column;
        padding: 1.5rem 2rem;
        gap: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .navbar__links.open { display: flex; }
}

/* ---- HERO ---- */
.hero {
    padding: 6rem 0 4rem;
    border-bottom: 1px solid var(--border);
}

.hero__grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero__content {
    max-width: 680px;
}

.hero__art {
    display: flex;
    justify-content: center;
    align-items: center;
}
.hero__art-img {
    width: 100%;
    max-width: 380px;
    height: auto;
    opacity: 0.92;
}

@media (max-width: 768px) {
    .hero__grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .hero__art { display: none; }
}

.hero__greeting {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.hero__name {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 1rem;
}
.hero__name-group { white-space: nowrap; }

.hero__title {
    font-size: 1.2rem;
    color: var(--ink-light);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.hero__bio {
    font-size: 1.05rem;
    color: var(--ink-light);
    line-height: 1.8;
    max-width: 580px;
}

.hero__links {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    color: var(--ink);
    background: transparent;
    transition: all var(--transition);
    cursor: pointer;
}

.btn:hover { border-color: var(--ink); opacity: 1; }

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn--primary:hover { background: #2e6aa3; border-color: #2e6aa3; }

/* ---- SECTIONS ---- */
.section {
    padding: 5rem 0;
    border-bottom: 1px solid var(--border);
}

.section:last-child { border-bottom: none; }

.section__header {
    margin-bottom: 3rem;
}

.section__label {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.section__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* ---- PROJECT CARDS ---- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.project-card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--paper-warm);
}

.project-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--ink-muted);
    background: var(--paper-warm);
    height: 200px;
}

.project-card__body { padding: 1.5rem; }

.project-card__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.project-card__summary {
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.65;
    margin-bottom: 1rem;
}

.project-card__techs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 500;
}

/* ---- EXPERIENCE TIMELINE ---- */
.timeline { position: relative; }

.timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: var(--border);
}

.timeline__item {
    position: relative;
    padding: 0 0 3rem 2.5rem;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
    position: absolute;
    left: -4.5px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--paper);
}

.timeline__date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-muted);
    margin-bottom: 0.35rem;
}

.timeline__position {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.15rem;
}

.timeline__company {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.timeline__description {
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.7;
}

.timeline__badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ---- SKILLS — flat list of pills (no tiers) ---- */
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-pill {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 20px;
    background: var(--accent-light);
    color: #0C447C;
    transition: transform 0.2s ease;
}
.skill-pill:hover { transform: translateY(-1px); }
@media (max-width: 600px) {
    .skill-pill { font-size: 0.8rem; padding: 6px 13px; }
}

/* ---- BLOG CARDS ---- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.blog-card__meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 1rem;
}

.blog-card__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.6rem;
    line-height: 1.35;
}

.blog-card__excerpt {
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.65;
    margin-bottom: 1rem;
}

.blog-card__read {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

/* ---- BLOG POST CONTENT ---- */
.post-content {
    max-width: 680px;
    margin: 0 auto;
}

.post-content h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.post-content__meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.post-content__body p { margin-bottom: 1.4rem; }
.post-content__body h2 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
}
.post-content__body h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
}
.post-content__body code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--paper-warm);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}
.post-content__body pre {
    background: var(--ink);
    color: #e0e0e0;
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.6;
}
.post-content__body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    color: var(--ink-light);
    font-style: italic;
    margin: 1.5rem 0;
}

/* ---- PROJECT DETAIL ---- */
.project-detail { max-width: 780px; margin: 0 auto; }

.project-detail__image {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.project-detail__title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.project-detail__meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.project-detail__body {
    font-size: 1.05rem;
    color: var(--ink-light);
    line-height: 1.8;
}

.project-detail__body p { margin-bottom: 1.3rem; }

.project-detail__links {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.pagination a, .pagination span {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    color: var(--ink-light);
}

.pagination a:hover { background: var(--paper-warm); opacity: 1; }

.pagination .current {
    background: var(--accent);
    color: #fff;
}

/* ---- FOOTER ---- */
.footer {
    padding: 3rem 0 2.2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer__identity {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--ink);
}
.footer__name { font-weight: 600; }
.footer__dot {
    display: inline-block;
    margin: 0 0.55rem;
    color: var(--ink-muted);
}
.footer__links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.85rem;
}
.footer__links a {
    font-family: var(--font-display);
    font-size: 0.82rem;
    color: var(--ink-muted);
}
.footer__links a:hover { color: var(--accent); }
.footer__copyright {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--ink-muted);
    opacity: 0.7;
    margin-top: 1.4rem;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ink-muted);
    font-family: var(--font-display);
}

.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state__title { font-size: 1.5rem; font-weight: 600; color: var(--ink); margin-bottom: 0.5rem; }
.empty-state__text { font-size: 1rem; max-width: 32rem; margin: 0 auto; }

/* Inline variant — softer panel, used inside a content section (e.g. home) */
.empty-state--inline {
    padding: 2.5rem 1.5rem;
    background: var(--paper-warm);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.empty-state--inline .empty-state__icon { font-size: 2.25rem; margin-bottom: 0.75rem; }

/* ---- PAGE HEADER ---- */
.page-header {
    padding: 4rem 0 3rem;
    border-bottom: 1px solid var(--border);
}

.page-header__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-header__subtitle {
    font-size: 1.05rem;
    color: var(--ink-light);
    margin-top: 0.5rem;
}

/* ---- BACK LINK ---- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-muted);
    margin-bottom: 2rem;
}

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

/* ---- UTILITIES ---- */
@media (max-width: 600px) {
    .projects-grid,
    .blog-grid { grid-template-columns: 1fr; }
    .hero { padding: 4rem 0 3rem; }
    .section { padding: 3.5rem 0; }
}

/* ---- CHAT WIDGET ---- */
.chat-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(58, 124, 189, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1000;
    transition: all var(--transition);
}
.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(58, 124, 189, 0.45);
}
.chat-toggle svg { width: 26px; height: 26px; fill: currentColor; }

.chat-panel {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-panel__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--paper-warm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.chat-panel__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.chat-panel__info h3 {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}
.chat-panel__info p {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.chat-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 280px;
    max-height: 340px;
}

.chat-msg {
    max-width: 85%;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
}
.chat-msg--bot {
    align-self: flex-start;
    background: var(--paper-warm);
    color: var(--ink);
    border-bottom-left-radius: 4px;
}
.chat-msg--user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg--typing {
    align-self: flex-start;
    background: var(--paper-warm);
    color: var(--ink-muted);
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* Inline markdown rendered inside bot messages */
.chat-msg strong { font-weight: 600; }
.chat-msg em     { font-style: italic; }
.chat-msg code {
    background: rgba(0, 0, 0, 0.07);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}
.chat-msg--user code { background: rgba(255, 255, 255, 0.18); }

.chat-panel__input {
    display: flex;
    border-top: 1px solid var(--border);
    padding: 0.75rem;
    gap: 0.5rem;
    background: #fff;
}
.chat-panel__input input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-family: var(--font-display);
    font-size: 0.88rem;
    outline: none;
    background: var(--paper);
    color: var(--ink);
    transition: border-color var(--transition);
}
.chat-panel__input input:focus { border-color: var(--accent); }
.chat-panel__input input::placeholder { color: var(--ink-muted); }

.chat-panel__input button {
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}
.chat-panel__input button:hover { background: #2e6aa3; }
.chat-panel__input button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
    .chat-panel {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 5.5rem;
        width: auto;
    }
}

.lang-switcher { margin-left: 0.5rem; }
.lang-switcher__form {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
}
.lang-switcher__btn {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    color: var(--ink-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: color var(--transition);
}
.lang-switcher__btn:hover { color: var(--ink); }
.lang-switcher__btn.active { color: var(--accent); border-bottom: 1.5px solid var(--accent); }
.lang-switcher__sep { color: var(--ink-muted); font-size: 0.75rem; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.24s; }
.delay-3 { animation-delay: 0.36s; }
.delay-4 { animation-delay: 0.48s; }

/* ---- ADMIN TOOLBAR (only rendered for staff users) ---- */
.admin-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    z-index: 9999;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1rem;
    font-family: var(--font-display);
    font-size: 0.78rem;
}
.admin-bar__link {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 3px;
    color: #fff;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.admin-bar__link:hover {
    background: var(--accent-mid);
    color: #fff;
    opacity: 1;
}
body.has-admin-bar { padding-top: 36px; }
body.has-admin-bar .navbar { top: 36px; }

.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.admin-edit {
    display: inline-block;
    margin-left: 0.6rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
    text-decoration: none;
    vertical-align: middle;
    transition: color var(--transition);
}
.admin-edit:hover { color: var(--accent); opacity: 1; }

.page-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Admin-bar buttons share link styling */
button.admin-bar__link {
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

/* ---- QUICK-ADD MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-overlay--open { opacity: 1; }

.modal-box {
    background: #fff;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.modal-overlay--open .modal-box { transform: scale(1); }

.modal-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-box__header h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin: 0;
}
.modal-box__close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-muted);
    padding: 0 0.25rem;
}
.modal-box__close:hover { color: var(--ink); }

.modal-box__body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.modal-field { display: flex; flex-direction: column; gap: 0.3rem; }
.modal-field--inline label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}
.modal-field--inline input[type="checkbox"] { width: auto; margin: 0; }

.modal-field label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
}
.modal-box input[type="text"],
.modal-box input[type="date"],
.modal-box textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--ink);
    background: var(--paper);
}
.modal-box textarea {
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.modal-box input:focus,
.modal-box textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.modal-box__footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
.modal-feedback {
    font-size: 0.85rem;
    color: var(--ink-muted);
    min-height: 1.2em;
}
.modal-feedback--ok { color: #2e7d32; }
.modal-feedback--err { color: #c62828; }

/* ---- MARKDOWN CONTENT (blog body) ---- */
.post-content__body h2,
.post-content__body h3 {
    font-family: var(--font-display);
    margin: 2rem 0 1rem;
}
.post-content__body h2 { font-size: 1.5rem; }
.post-content__body h3 { font-size: 1.2rem; }
.post-content__body p { margin: 0 0 1.1rem; }
.post-content__body ul,
.post-content__body ol { margin: 0 0 1.1rem 1.4rem; }
.post-content__body li { margin-bottom: 0.35rem; }
.post-content__body a { color: var(--accent); text-decoration: underline; }
.post-content__body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.25rem 0 0.25rem 1rem;
    margin: 1.25rem 0;
    color: var(--ink-light);
    font-style: italic;
}
.post-content__body code:not(pre code) {
    background: var(--accent-light);
    color: var(--ink);
    padding: 0.12rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}
.post-content__body pre {
    background: #282c34;
    padding: 1.1rem 1.3rem;
    overflow-x: auto;
    line-height: 1.55;
    margin: 0;
    border-radius: 0 0 8px 8px;
}
.post-content__body pre code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    background: transparent;
    padding: 0;
}

/* ---- Code block header (language + copy button) ---- */
.post-content__body .code-block-wrapper {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #282c34;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.post-content__body .code-block-wrapper pre {
    margin: 0;
    border-radius: 0;
}
.post-content__body .code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.9rem;
    background: #21242b;
    color: #a0a8b0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.post-content__body .code-block-lang { text-transform: lowercase; letter-spacing: 0.02em; }
.post-content__body .code-copy-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.post-content__body .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    opacity: 1;
}
.post-content__body .code-copy-btn.copied { color: #4caf50; }
.post-content__body .katex-display {
    margin: 1.6rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}
