:root {
    --bg: #0f172a;
    --panel: #162033;
    --panel-2: #1e293b;
    --line: #334155;
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-2: #f472b6;
    --ok: #34d399;
    --danger: #fb7185;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 23, 42, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.nav-shell,
.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.nav-shell {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-weight: 800;
    letter-spacing: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-weight: 600;
}

.nav-links a:hover,
.nav-links button:hover {
    color: var(--accent);
}

.nav-links form {
    margin: 0;
}

button,
.button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    font: inherit;
    font-weight: 700;
}

.button.primary,
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #082f49;
}

.page-shell {
    padding: 54px 0 80px;
}

.hero {
    min-height: 430px;
    display: grid;
    align-content: center;
    border-bottom: 1px solid var(--line);
}

.portfolio-hero {
    min-height: 520px;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) 360px;
    gap: 36px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 64px 0;
}

.hero-content h1 {
    font-size: clamp(2.6rem, 7vw, 5.4rem);
    line-height: 1.02;
    margin-bottom: 20px;
}

.hero-panel {
    background: linear-gradient(145deg, rgba(30, 41, 59, .95), rgba(2, 6, 23, .95));
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 18px;
    padding: 28px;
}

.avatar-mark {
    width: 94px;
    height: 94px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #020617;
    font-size: 2rem;
    font-weight: 900;
}

.hero-panel strong {
    display: block;
    font-size: 1.35rem;
}

.hero-panel span {
    color: var(--muted);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.hero-stats span {
    background: rgba(15, 23, 42, .8);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.hero-stats strong {
    color: var(--text);
    font-size: 1.5rem;
}

.highlight-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.highlight-strip a {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 20px;
}

.highlight-strip span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(56, 189, 248, .14);
    color: var(--accent);
}

.highlight-strip span.pink {
    background: rgba(244, 114, 182, .14);
    color: var(--accent-2);
}

.highlight-strip small {
    color: var(--muted);
}

.eyebrow {
    color: var(--accent);
    font-size: .85rem;
    font-weight: 800;
    margin: 0 0 10px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.hero h1,
.page-heading h1,
.article h1,
.admin-head h1 {
    font-size: clamp(2.3rem, 6vw, 4.8rem);
    line-height: 1.03;
    margin-bottom: 20px;
}

.hero-copy {
    color: var(--muted);
    font-size: 1.2rem;
    max-width: 760px;
}

.hero-actions,
.row-actions,
.socials {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.section {
    margin-top: 76px;
}

.section-title,
.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.section-title.compact {
    margin-bottom: 14px;
}

.section-title h2,
.admin-head h1 {
    margin-bottom: 0;
}

.section-title a {
    color: var(--accent);
    font-weight: 700;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.card,
.post-row,
.auth-panel,
.contact-band,
.metric,
.side-panel,
.empty {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.card {
    padding: 24px;
}

.project-card {
    min-height: 100%;
}

.card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 18px;
}

.card p,
.post-row p,
.article header p {
    color: var(--muted);
}

.post-list {
    display: grid;
    gap: 14px;
}

.post-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 22px;
}

.social-row .eyebrow {
    color: var(--accent-2);
}

.split-latest {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.post-row img {
    width: 170px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 6px;
}

.post-row h2,
.post-row h3 {
    margin-bottom: 8px;
}

.post-row time,
.article time {
    color: var(--muted);
    white-space: nowrap;
}

.contact-band {
    margin-top: 76px;
    padding: 36px;
    text-align: center;
}

.contact-band > a {
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 800;
}

.socials {
    justify-content: center;
    margin-top: 18px;
    color: var(--muted);
}

.page-heading {
    margin-bottom: 34px;
}

.article {
    max-width: 820px;
    margin: 0 auto;
}

.article-cover {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    margin: 28px 0;
}

.article-body {
    color: #dbeafe;
    font-size: 1.05rem;
}

.article-body h2,
.article-body h3 {
    margin-top: 34px;
}

.article-body pre,
.article-body code {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.article-body code {
    padding: 2px 6px;
}

.article-body pre {
    overflow: auto;
    padding: 18px;
}

.tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.tags span {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    padding: 5px 12px;
}

.auth-panel {
    max-width: 460px;
    margin: 36px auto;
    padding: 30px;
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #020617;
    color: var(--text);
    font: inherit;
    padding: 11px 12px;
}

textarea {
    resize: vertical;
}

.alert {
    border: 1px solid var(--danger);
    color: #fecdd3;
    background: rgba(251, 113, 133, .12);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.metric {
    padding: 20px;
}

.metric strong {
    display: block;
    font-size: 2rem;
}

.metric span {
    color: var(--muted);
}

.admin-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 24px 0 36px;
}

.admin-nav a {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    padding: 8px 13px;
}

.table-like {
    display: grid;
    gap: 10px;
}

.table-like > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 16px;
    align-items: center;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.table-like small,
.table-like span:nth-child(n+2) {
    color: var(--muted);
}

.table-like form {
    margin: 0;
}

.table-like button {
    min-height: 34px;
    color: #fecdd3;
}

.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.markdown-editor {
    gap: 10px;
}

.editor-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-tabs button {
    min-width: 38px;
    min-height: 36px;
    border-radius: 8px;
    padding: 0 10px;
}

.editor-tabs button {
    color: var(--muted);
}

.editor-tabs button.active {
    border-color: var(--accent);
    color: var(--text);
}

.markdown-preview {
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #020617;
    color: var(--text);
    padding: 18px;
}

.EasyMDEContainer {
    color: var(--text);
}

.EasyMDEContainer .CodeMirror,
.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side {
    border-color: var(--line);
    background: #020617;
    color: var(--text);
}

.EasyMDEContainer .editor-toolbar {
    display: block;
    border-color: var(--line);
    background: var(--panel-2);
    opacity: 1;
}

.EasyMDEContainer .editor-toolbar button {
    color: var(--muted) !important;
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
    border-color: var(--accent);
    background: rgba(56, 189, 248, .12);
    color: var(--text) !important;
}

.EasyMDEContainer .CodeMirror-cursor {
    border-left-color: var(--text);
}

.EasyMDEContainer .CodeMirror-selected {
    background: rgba(56, 189, 248, .22);
}

.EasyMDEContainer .editor-statusbar {
    color: var(--muted);
}

.markdown-preview img,
.article-body img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 18px 0;
}

.content-table {
    overflow-x: auto;
    margin: 18px 0;
}

.content-table table {
    width: 100%;
    border-collapse: collapse;
}

.content-table th,
.content-table td {
    border: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
}

.content-table th {
    background: var(--panel-2);
    color: var(--text);
}

.side-panel,
.narrow-form {
    padding: 20px;
}

.narrow-form {
    max-width: 760px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    margin-bottom: 22px;
}

.category-form,
.category-row {
    display: grid;
    grid-template-columns: 1fr 140px 1.4fr 1.3fr 150px auto;
    gap: 10px;
    margin-bottom: 12px;
}

.category-meta {
    display: flex !important;
    justify-content: space-between;
    grid-template-columns: none !important;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check input {
    width: auto;
}

.thumb {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.empty {
    color: var(--muted);
    padding: 22px;
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 28px 16px;
    text-align: center;
}

.blog-design {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 0 40px;
    font-family: "Fira Code", "Segoe UI", monospace;
}

.tech-blog-header {
    text-align: center;
    margin-bottom: 72px;
}

.tech-blog-header h1 {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    margin-bottom: 14px;
}

.tech-blog-header h1 span {
    color: var(--accent);
}

.tech-blog-header p {
    color: var(--muted);
    font-size: 1.1rem;
}

.terminal-loader {
    display: inline-block;
    margin-top: 20px;
    background: #000;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 20px;
}

.terminal-loader span:first-child {
    color: #4ade80;
}

.cursor {
    border-left: 8px solid var(--accent);
    animation: blink 1s infinite;
    margin-left: 5px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.tech-post-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 30px;
    padding: 35px;
    transition: .3s;
}

.tech-post-card:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(56, 189, 248, .2);
}

.post-meta {
    color: var(--accent);
    font-size: .85rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.tech-post-card h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.tech-post-card p {
    color: var(--muted);
}

.post-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.post-tag {
    background: #0f172a;
    border-radius: 4px;
    color: var(--muted);
    font-size: .75rem;
    padding: 4px 10px;
}

.read-more {
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.read-more:hover {
    color: var(--accent);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 28px;
}

.pager a,
.pager span {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    min-width: 76px;
    padding: 8px 12px;
    text-align: center;
}

.pager a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.social-hero {
    min-height: 60vh;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-top: -54px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    border-bottom: 2px solid var(--accent-2);
    padding: 80px 20px;
}

.social-hero h1 {
    color: white;
    font-size: clamp(2.4rem, 7vw, 4rem);
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}

.social-hero p {
    color: #e2e8f0;
    font-size: 1.35rem;
    max-width: 680px;
}

.social-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 0 20px;
}

.intro-text {
    text-align: center;
    margin-bottom: 60px;
}

.intro-text h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
}

.intro-text p {
    color: var(--muted);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.cat-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    transition: .4s;
}

.cat-card:hover {
    border-color: var(--accent-2);
    box-shadow: 0 10px 30px rgba(244, 114, 182, .3);
    transform: translateY(-10px);
}

.cat-img {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #334155;
    background-size: cover;
    background-position: center;
}

.cat-img i {
    color: white;
    font-size: 3rem;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, .5);
}

.cat-content {
    padding: 25px;
}

.cat-content h3 {
    color: var(--accent-2);
    margin-bottom: 10px;
}

.cat-content p {
    color: var(--muted);
    font-size: .95rem;
}

.social-latest {
    margin-top: 70px;
}

.social-article .eyebrow {
    color: var(--accent-2);
}

@media (max-width: 820px) {
    .nav-shell,
    .section-title,
    .admin-head,
    .post-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-shell {
        padding: 14px 0;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
    }

    .post-row,
    .table-like > div,
    .editor-grid,
    .inline-form,
    .category-form,
    .category-row,
    .portfolio-hero,
    .highlight-strip,
    .split-latest {
        grid-template-columns: 1fr;
    }

    .post-row img {
        width: 100%;
    }
}
