@import url('/assets/css/projects.css');

/* =========================================================================
 * Blog — listing, article body, and the local-only editor.
 * Card classes reuse .project-* so the theme sheet styles them for free.
 * ========================================================================= */

.blog-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}

.blog-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1 1 260px;
    max-width: 420px;
    padding: 0.6rem 0.9rem;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #333;
    border-radius: 0.75rem;
}

.blog-search:focus-within {
    border-color: #fcd34d;
}

.blog-search svg {
    width: 1rem;
    height: 1rem;
    flex: none;
    color: #9ca3af;
}

.blog-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: inherit;
    font-family: inherit;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.blog-search input::placeholder {
    color: #6b7280;
}

.blog-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-tag-filter {
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid #333;
    background: rgba(255, 255, 255, 0.04);
    color: #d1d5db;
    font-family: inherit;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.blog-tag-filter:hover,
.blog-tag-filter:focus-visible {
    border-color: #fcd34d;
    color: #ffffff;
    outline: none;
}

.blog-tag-filter.is-active {
    background: #fcd34d;
    border-color: #fcd34d;
    color: #000000;
}

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

.blog-card {
    text-decoration: none;
    cursor: pointer;
}

.blog-card .project-image-wrapper {
    aspect-ratio: 16 / 9;
}

.blog-card .project-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1rem 1.5rem;
    flex: 1;
}

.blog-card-title {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ffffff;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
}

.blog-card-excerpt {
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #cbd5e1;
    margin: 0;
}

.blog-card .project-tags {
    margin-top: auto;
    padding: 0;
}

.draft-badge {
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.5);
    color: #fca5a5;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.blog-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    padding: 3rem 0;
}

/* ---------- article ---------- */

.article-layout {
    display: grid;
    gap: 3rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
    .article-layout.has-toc {
        grid-template-columns: minmax(0, 1fr) 240px;
    }
}

.article-header {
    margin-bottom: 2.5rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 1.25rem;
}

.article-cover {
    width: 100%;
    border: 2px solid #333;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    display: block;
}

.article-toc {
    position: sticky;
    top: 6.5rem;
    align-self: start;
    border-left: 2px solid #333;
    padding-left: 1rem;
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
}

.article-toc h2 {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.85rem;
}

.article-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-toc a {
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
    font-size: 0.85rem;
    color: #9ca3af;
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.article-toc a:hover,
.article-toc a.is-active {
    color: #fcd34d;
}

.article-toc a[data-level="3"] {
    padding-left: 0.85rem;
    font-size: 0.78rem;
}

@media (max-width: 1023px) {
    .article-toc {
        display: none;
    }
}

/* ---------- prose ---------- */

.prose {
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
    font-size: 1.02rem;
    line-height: 1.75;
    color: #d5dae2;
    max-width: 72ch;
}

.prose > *:first-child {
    margin-top: 0;
}

.prose p {
    margin: 0 0 1.35rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    color: #ffffff;
    line-height: 1.45;
    margin: 2.75rem 0 1.1rem;
    scroll-margin-top: 6.5rem;
    position: relative;
}

.prose h1 { font-size: 1.4rem; }
.prose h2 { font-size: 1.1rem; }
.prose h3 { font-size: 0.9rem; }
.prose h4,
.prose h5,
.prose h6 { font-size: 0.8rem; }

.heading-anchor {
    margin-left: 0.5rem;
    color: #fcd34d;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.prose h1:hover .heading-anchor,
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor,
.heading-anchor:focus-visible {
    opacity: 1;
}

.prose a {
    color: #fcd34d;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose a:hover {
    color: #fde68a;
}

.prose strong { color: #ffffff; }

.prose ul,
.prose ol {
    margin: 0 0 1.35rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose li.task-item {
    list-style: none;
    margin-left: -1.25rem;
}

.prose li.task-item input {
    margin-right: 0.5rem;
}

.prose blockquote {
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid #fcd34d;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose .callout-label {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fcd34d;
    margin-bottom: 0.6rem;
}

.prose .callout-warning { border-left-color: #f97316; }
.prose .callout-warning .callout-label { color: #fb923c; }
.prose .callout-danger { border-left-color: #ef4444; }
.prose .callout-danger .callout-label { color: #f87171; }
.prose .callout-tip { border-left-color: #34d399; }
.prose .callout-tip .callout-label { color: #6ee7b7; }

.prose img {
    max-width: 100%;
    height: auto;
    border: 2px solid #333;
    border-radius: 10px;
    display: block;
    margin: 0 auto 1.5rem;
}

.prose hr {
    border: 0;
    border-top: 2px solid #333;
    margin: 2.5rem 0;
}

.prose code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: #fcd34d;
}

.code-block {
    position: relative;
    margin: 0 0 1.5rem;
}

.prose pre {
    margin: 0 0 1.5rem;
    padding: 1.1rem 1.15rem;
    background: #0d0d0d;
    border: 2px solid #333;
    border-radius: 10px;
    overflow-x: auto;
}

.code-block pre { margin-bottom: 0; }

.prose pre code {
    background: none;
    padding: 0;
    color: #e5e7eb;
    font-size: 0.85rem;
    line-height: 1.6;
}

.code-copy {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.3rem 0.6rem;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d1d5db;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
    opacity: 1;
}

.code-copy:hover {
    color: #fcd34d;
    border-color: #fcd34d;
}

.table-scroll {
    overflow-x: auto;
    margin: 0 0 1.5rem;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.prose th,
.prose td {
    border: 1px solid #333;
    padding: 0.6rem 0.85rem;
    text-align: left;
}

.prose th {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.article-footer {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 2px solid #333;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-nav {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.article-nav a {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.15rem;
    border: 2px solid #333;
    border-radius: 10px;
    background: #111;
    text-decoration: none;
    color: #ffffff;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.article-nav a:hover {
    border-color: #fcd34d;
    transform: translateY(-2px);
}

.article-nav span {
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
}

.article-nav strong {
    font-size: 0.75rem;
    line-height: 1.5;
    font-weight: 400;
}

.article-nav a.is-next {
    text-align: right;
    align-items: flex-end;
}

/* ---------- editor links ---------- */

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.editor-button {
    padding: 0.65rem 1.1rem;
    border: 2px solid #333;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.editor-button:hover,
.editor-button:focus-visible {
    background: #ffffff;
    color: #000000;
    border-color: #fcd34d;
    outline: none;
}

.editor-button.primary {
    background: #fcd34d;
    border-color: #fcd34d;
    color: #000000;
}

.editor-button.primary:hover {
    background: #fde68a;
}

.editor-hint {
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #9ca3af;
}

.editor-hint code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    color: #fcd34d;
}
