/*
 * Blog styles.
 *
 * Deliberately token-only: every colour here comes from the custom properties already
 * defined in mrunal-portfolio.css (--bg, --surface, --line, --text, --accent, ...). That is
 * what makes the blog follow the portfolio's light/dark toggle for free, and why this file
 * declares no raw hex values of its own.
 */

/*
 * The portfolio nav is position:fixed at 64px tall, so page content has to start below it.
 * Done once here rather than baked into each page's own padding.
 */
.portfolio-main {
    padding-top: 64px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- header ---------- */

.blog-head {
    border-bottom: 1px solid var(--line);
    padding: 3.5rem 0 2rem;
}

.blog-kicker {
    color: var(--accent);
    letter-spacing: .18em;
    font-size: .72rem;
    margin: 0 0 .5rem;
}

.blog-head h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    line-height: 1.05;
    margin: 0 0 .6rem;
    color: var(--text);
}

.blog-lede {
    color: var(--text-dim);
    max-width: 58ch;
    margin: 0 0 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ---------- search ---------- */

.blog-search {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.blog-search input[type="search"] {
    flex: 1 1 18rem;
    min-width: 0;
    padding: .6rem .85rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.blog-search input[type="search"]:focus-visible,
.blog-tag:focus-visible,
.blog-card-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.blog-search button {
    padding: .6rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.blog-search button:hover {
    filter: brightness(1.08);
}

.blog-clear {
    color: var(--text-dim);
    font-size: .9rem;
    text-decoration: underline;
}

/* ---------- tags ---------- */

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.blog-tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dim);
    font-size: .85rem;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

.blog-tag:hover {
    border-color: var(--accent);
    color: var(--text);
}

.blog-tag.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--text);
    font-weight: 600;
}

.blog-tag-count {
    font-family: var(--font-mono);
    font-size: .72rem;
    opacity: .7;
}

.blog-tag-sm {
    padding: .18rem .55rem;
    font-size: .78rem;
}

/* ---------- list ---------- */

.blog-list {
    padding: 2rem 0 4rem;
}

.blog-count {
    color: var(--text-dim);
    font-size: .82rem;
    margin: 0 0 1.25rem;
}

.blog-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.blog-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 1.25rem 1.4rem;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.blog-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.blog-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1.2;
    margin: .3rem 0 .45rem;
    color: var(--text);
}

.blog-card-link:hover h2 {
    color: var(--accent);
}

.blog-card-desc {
    color: var(--text-dim);
    margin: 0;
    line-height: 1.55;
}

.blog-meta {
    display: flex;
    gap: .5rem;
    align-items: center;
    color: var(--text-dim);
    font-size: .78rem;
    margin: 0;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: .85rem 0 0;
}

.blog-empty {
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-dim);
}

/* ---------- post ---------- */

.blog-post {
    padding: 2.5rem 0 4rem;
    max-width: 46rem;
}

.blog-back,
.blog-post-foot {
    margin: 0 0 1.5rem;
}

.blog-back a,
.blog-post-foot a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: .9rem;
}

.blog-back a:hover,
.blog-post-foot a:hover {
    color: var(--accent);
}

.blog-post-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.blog-post-head h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.1;
    margin: .4rem 0 .6rem;
    color: var(--text);
}

.blog-post-foot {
    border-top: 1px solid var(--line);
    padding-top: 1.5rem;
    margin: 3rem 0 0;
}

/* ---------- rendered markdown ---------- */

.blog-body {
    color: var(--text);
    font-size: 1.04rem;
    line-height: 1.75;
}

.blog-body > * + * {
    margin-top: 1.15rem;
}

.blog-body h2,
.blog-body h3,
.blog-body h4 {
    font-family: var(--font-display);
    line-height: 1.25;
    color: var(--text);
    margin-top: 2.4rem;
}

.blog-body h2 {
    font-size: 1.8rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--line);
}

.blog-body h3 { font-size: 1.35rem; }
.blog-body h4 { font-size: 1.12rem; }

.blog-body a {
    color: var(--accent);
    text-underline-offset: 2px;
}

.blog-body ul,
.blog-body ol {
    padding-left: 1.4rem;
}

.blog-body li + li {
    margin-top: .4rem;
}

.blog-body blockquote {
    margin-left: 0;
    padding: .25rem 0 .25rem 1.1rem;
    border-left: 3px solid var(--accent);
    color: var(--text-dim);
    font-style: italic;
}

.blog-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.blog-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
    display: block;
    overflow-x: auto;   /* wide tables scroll rather than breaking the layout */
}

.blog-body th,
.blog-body td {
    border: 1px solid var(--line);
    padding: .55rem .75rem;
    text-align: left;
    vertical-align: top;
}

.blog-body th {
    background: var(--accent-soft);
    font-weight: 600;
}

.blog-body hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2.5rem 0;
}

/* ---------- code ---------- */

.blog-body code {
    font-family: var(--font-mono);
    font-size: .88em;
    background: var(--accent-soft);
    padding: .12em .38em;
    border-radius: 5px;
}

.blog-body pre {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    overflow-x: auto;   /* long lines scroll; the page itself never does */
    line-height: 1.6;
}

.blog-body pre code {
    background: none;
    padding: 0;
    font-size: .86rem;
}

/*
 * highlight.js theme, written against the portfolio tokens instead of shipping one of the
 * library's own stylesheets. A bundled theme hardcodes its palette, which would look wrong
 * in one of the two themes; these follow the toggle.
 */
.hljs-comment,
.hljs-quote { color: var(--text-dim); font-style: italic; }

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-type { color: var(--accent); font-weight: 600; }

.hljs-string,
.hljs-doctag,
.hljs-regexp,
.hljs-addition { color: var(--good); }

.hljs-title,
.hljs-title.class_,
.hljs-title.function_,
.hljs-section,
.hljs-name { color: var(--text); font-weight: 600; }

.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable { color: var(--text-dim); }

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-meta { color: var(--accent); }

.hljs-deletion { color: var(--text-dim); text-decoration: line-through; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------- footer ---------- */

.blog-footer {
    border-top: 1px solid var(--line);
    padding: 1.5rem 0 2.5rem;
}

.blog-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-dim);
    font-size: .85rem;
}

.blog-footer a {
    color: var(--text-dim);
    text-decoration: none;
}

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

@media (max-width: 640px) {
    .blog-head { padding-top: 2.5rem; }
    .blog-search button { flex: 1 1 auto; }
}
