:root {
    --pinte-accent: #4f46e5;
    --pinte-accent-2: #06b6d4;
    --pinte-radius: .5rem;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #0b1020;
    --bs-body-bg-rgb: 11, 16, 32;
    --bs-tertiary-bg: #111831;
    --bs-secondary-bg: #161f3b;
    --bs-border-color: #232d4d;
    --bs-primary: #818cf8;
    --bs-primary-rgb: 129, 140, 248;
    --bs-link-color: #a5b4fc;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color: #c7d2fe;
    --bs-link-hover-color-rgb: 199, 210, 254;
}

.btn-primary {
    --bs-btn-bg: var(--pinte-accent);
    --bs-btn-border-color: var(--pinte-accent);
    --bs-btn-hover-bg: #4338ca;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #3730a3;
    --bs-btn-active-border-color: #3730a3;
    --bs-btn-disabled-bg: var(--pinte-accent);
    --bs-btn-disabled-border-color: var(--pinte-accent);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--pinte-accent);
}

.pagination {
    --bs-pagination-active-bg: var(--pinte-accent);
    --bs-pagination-active-border-color: var(--pinte-accent);
}

body {
    -webkit-font-smoothing: antialiased;
}

/* Header & footer */
.site-header {
    backdrop-filter: saturate(180%) blur(12px);
    background-color: rgba(var(--bs-body-bg-rgb), 0.8);
    border-bottom: 1px solid var(--bs-border-color);
}

.site-header .nav-link.active {
    color: var(--bs-primary);
    font-weight: 600;
}

.site-footer {
    border-top: 1px solid var(--bs-border-color);
}

.avatar-sm {
    object-fit: cover;
}

.theme-toggle .theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-icon-dark { display: inline; }
[data-bs-theme="dark"] .theme-toggle .theme-icon-light { display: none; }

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 60vw;
    height: 60vw;
    max-width: 720px;
    max-height: 720px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.12), rgba(6, 182, 212, 0.05) 45%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    max-width: 18ch;
}

.eyebrow {
    font-weight: 600;
    color: var(--bs-primary);
    letter-spacing: 0.02em;
}

.text-gradient {
    color: var(--bs-primary);
}

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
    .text-gradient {
    background: linear-gradient(120deg, var(--pinte-accent), var(--pinte-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    }
}

.hero-avatar {
    position: relative;
    width: min(220px, 70vw);
    aspect-ratio: 1;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pinte-accent), var(--pinte-accent-2));
    box-shadow: 0 24px 48px -24px rgba(79, 70, 229, 0.3);
}

.hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 4px solid var(--bs-body-bg);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

/* Cards */
.post-card {
    background: var(--bs-tertiary-bg);
    border-radius: var(--pinte-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -20px rgba(15, 23, 42, 0.3);
}

.post-card-media {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--bs-secondary-bg);
    overflow: hidden;
}

.post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-media img {
    transform: scale(1.04);
}

.post-card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    color: rgba(var(--bs-primary-rgb), 0.5);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(6, 182, 212, 0.12));
}

.post-card .post-meta {
    position: relative;
    z-index: 2;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    height: 100%;
    padding: 1rem .75rem;
    border-top: 1px solid var(--bs-border-color);
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.topic-card:hover {
    color: var(--bs-primary);
}

.topic-card:hover .topic-card-title {
    color: var(--bs-primary);
}

.topic-card:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.topic-icon {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    margin-top: .15rem;
    color: var(--bs-primary);
    font-size: 1.1rem;
    text-align: center;
}

.topic-card-content {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.topic-card-title {
    color: var(--bs-body-color);
    font-weight: 600;
}

.topic-card-description {
    color: var(--bs-secondary-color);
    font-size: .875rem;
    line-height: 1.5;
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 2.25rem;
    }
}

.search-form {
    min-width: min(320px, 100%);
}

/* Post */
.post-header,
.post-content,
.post-footer {
    max-width: 46rem;
}

.post-cover {
    max-width: 64rem;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1rem 0;
}

.post-content blockquote {
    border-left: 4px solid var(--bs-primary);
    padding: 0.25rem 0 0.25rem 1.25rem;
    color: var(--bs-secondary-color);
    font-style: italic;
}

.post-content pre {
    font-size: 0.9rem;
    border-radius: 0.75rem;
    padding: 0;
    overflow: auto;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
}

.post-content pre code.hljs,
.post-content pre code {
    display: block;
    padding: 1rem 1.25rem;
    background: transparent;
}

.post-content :not(pre) > code {
    padding: 0.15rem 0.4rem;
    border-radius: 0.35rem;
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
}

.post-content .ql-align-center { text-align: center; }
.post-content .ql-align-right { text-align: right; }
.post-content .ql-align-justify { text-align: justify; }

/* Admin */
.admin-nav {
    scrollbar-width: none;
}

.admin-nav .nav-link {
    white-space: nowrap;
}

.stat-card {
    background: var(--bs-tertiary-bg);
    border-radius: var(--pinte-radius);
    border: 1px solid var(--bs-border-color);
}

.vault-tile {
    border-radius: var(--pinte-radius);
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    border-top: 4px solid var(--tile-color, var(--pinte-accent));
}

.vault-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    background: var(--tile-color, var(--pinte-accent));
    flex-shrink: 0;
    overflow: hidden;
}

.vault-logo img {
    width: 24px;
    height: 24px;
}

.drop-zone {
    border: 2px dashed var(--bs-border-color);
    border-radius: var(--pinte-radius);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.drop-zone.dragover {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.06);
}

/* Quill editor */
.editor-shell .ql-toolbar.ql-snow,
.editor-shell .ql-container.ql-snow {
    border-color: var(--bs-border-color);
}

.editor-shell .ql-toolbar.ql-snow {
    border-radius: 0.75rem 0.75rem 0 0;
    background: var(--bs-tertiary-bg);
    position: sticky;
    top: 64px;
    z-index: 5;
}

.editor-shell .ql-container.ql-snow {
    border-radius: 0 0 0.75rem 0.75rem;
    font-size: 1.05rem;
    font-family: inherit;
}

.editor-shell .ql-editor {
    min-height: 420px;
    line-height: 1.7;
}

.editor-shell .ql-editor img {
    max-width: 100%;
    border-radius: 0.5rem;
    cursor: pointer;
}

.editor-shell .ql-editor img.ql-image-selected {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

.validation-summary-valid {
    display: none;
}

[data-bs-theme="dark"] .ql-snow .ql-stroke { stroke: #cbd5e1; }
[data-bs-theme="dark"] .ql-snow .ql-fill { fill: #cbd5e1; }
[data-bs-theme="dark"] .ql-snow .ql-picker { color: #cbd5e1; }
[data-bs-theme="dark"] .ql-snow .ql-picker-options { background: var(--bs-secondary-bg); }
[data-bs-theme="dark"] .ql-editor.ql-blank::before { color: rgba(255, 255, 255, 0.45); }

.image-tile {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
}

.image-tile img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.image-tile.pending-delete img {
    opacity: 0.35;
}

.image-tile .image-actions {
    display: flex;
    gap: 0.25rem;
    padding: 0.35rem;
}
