/* ============================================================
   Blog detail page — layout + rich-text typography
   Dark purple theme. The Tailwind Typography plugin is NOT
   compiled into tailwind.min.css, so `.prose` does nothing;
   this file styles the editor-generated article HTML directly.
   ============================================================ */

/* ---- Page shell ---------------------------------------------------------- */
.blog-detail {
    --bd-accent: #a855f7;
    --bd-secondary: #7c3aed;
    --bd-gold: #f59e0b;
    --bd-surface: #1a1530;
    --bd-line: rgba(124, 58, 237, 0.22);
    --bd-text: #cbd2dc;
    --bd-muted: #9ca3af;
}

/* Soft radial glow behind the hero to lift the header off the page */
.blog-hero {
    position: relative;
}

.blog-hero::before {
    content: "";
    position: absolute;
    top: -12%;
    left: 50%;
    width: min(760px, 90%);
    height: 420px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center,
        rgba(124, 58, 237, 0.22),
        rgba(168, 85, 247, 0.08) 45%,
        transparent 70%);
    filter: blur(18px);
    pointer-events: none;
    z-index: 0;
}

.blog-hero > * {
    position: relative;
    z-index: 1;
}

/* Meta row (author · date · reading time) */
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1.25rem;
    color: var(--bd-muted);
    font-size: 0.875rem;
}

.blog-meta .blog-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-meta .blog-meta-item i {
    color: var(--bd-accent);
    font-size: 0.8rem;
}

.blog-meta .blog-meta-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.5);
}

/* Featured image — a touch wider than the text column, framed and glowing */
.blog-cover {
    position: relative;
    border-radius: 1.25rem;
    overflow: hidden;
    border: 1px solid var(--bd-line);
    box-shadow: 0 30px 80px rgba(3, 2, 14, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.blog-cover img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.blog-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(7, 5, 15, 0.35), transparent 40%);
    pointer-events: none;
}

/* ---- Article body typography -------------------------------------------- */
.article-body {
    font-family: "DM Sans", system-ui, -apple-system, sans-serif;
    font-size: 1.075rem;
    line-height: 1.85;
    color: var(--bd-text);
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Kill the top margin of the very first block so it hugs the divider */
.article-body > *:first-child {
    margin-top: 0;
}

.article-body > *:last-child {
    margin-bottom: 0;
}

/* Some editors wrap everything in a single <div> — flatten its spacing */
.article-body > div > *:first-child {
    margin-top: 0;
}

.article-body p {
    margin: 0 0 1.5rem;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    font-family: "Syne", sans-serif;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.25;
    scroll-margin-top: 6rem;
}

.article-body h2 {
    font-size: 1.7rem;
    margin: 2.75rem 0 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--bd-line);
}

.article-body h3 {
    font-size: 1.35rem;
    margin: 2.25rem 0 0.9rem;
    color: #f3e8ff;
}

.article-body h4 {
    font-size: 1.12rem;
    margin: 1.9rem 0 0.75rem;
    color: #f3e8ff;
}

.article-body h5,
.article-body h6 {
    font-size: 1rem;
    margin: 1.6rem 0 0.6rem;
    color: #e9d5ff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.article-body strong,
.article-body b {
    color: #ffffff;
    font-weight: 700;
}

.article-body em {
    color: #e9d5ff;
}

.article-body a {
    color: var(--bd-accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(168, 85, 247, 0.35);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.article-body a:hover {
    color: #c4b5fd;
    border-bottom-color: #c4b5fd;
}

/* Lists — Tailwind's reset strips markers; restore them */
.article-body ul,
.article-body ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin: 0.5rem 0;
    padding-left: 0.35rem;
}

.article-body ul > li {
    list-style: none;
    position: relative;
}

.article-body ul > li::before {
    content: "";
    position: absolute;
    left: -1.15rem;
    top: 0.72em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bd-secondary), var(--bd-accent));
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.article-body ol {
    list-style: decimal;
}

.article-body ol > li::marker {
    color: var(--bd-accent);
    font-weight: 700;
}

.article-body li > ul,
.article-body li > ol {
    margin: 0.5rem 0 0.25rem;
}

/* Blockquote */
.article-body blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid var(--bd-accent);
    border-radius: 0 0.75rem 0.75rem 0;
    background: linear-gradient(145deg,
        rgba(124, 58, 237, 0.12), rgba(168, 85, 247, 0.05));
    color: #e9d5ff;
    font-style: italic;
}

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

/* Inline code + code blocks */
.article-body code {
    font-family: "Space Mono", monospace;
    font-size: 0.9em;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid var(--bd-line);
    color: #e9d5ff;
    padding: 0.15em 0.45em;
    border-radius: 0.4rem;
}

.article-body pre {
    margin: 1.75rem 0;
    padding: 1.25rem 1.4rem;
    background: #100d1f;
    border: 1px solid var(--bd-line);
    border-radius: 0.9rem;
    overflow-x: auto;
    line-height: 1.6;
}

.article-body pre code {
    background: none;
    border: 0;
    padding: 0;
    color: #d6ccf0;
    font-size: 0.875rem;
}

/* Images inside the body */
.article-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.75rem auto;
    border-radius: 1rem;
    border: 1px solid var(--bd-line);
}

/* Horizontal rule — gradient divider */
.article-body hr {
    border: 0;
    height: 1px;
    margin: 2.5rem 0;
    background: linear-gradient(90deg,
        transparent, rgba(168, 85, 247, 0.55), transparent);
}

/* Tables — the editor content includes them; make them readable */
.article-body table {
    width: 100%;
    margin: 1.75rem 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    border: 1px solid var(--bd-line);
    border-radius: 0.9rem;
    overflow: hidden;
}

.article-body thead th,
.article-body table tr:first-child th {
    background: linear-gradient(145deg,
        rgba(124, 58, 237, 0.28), rgba(168, 85, 247, 0.16));
    color: #ffffff;
    font-family: "Syne", sans-serif;
}

.article-body th,
.article-body td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(124, 58, 237, 0.14);
    border-right: 1px solid rgba(124, 58, 237, 0.1);
    vertical-align: top;
}

.article-body th:last-child,
.article-body td:last-child {
    border-right: 0;
}

.article-body tbody tr:last-child td {
    border-bottom: 0;
}

.article-body tbody tr:nth-child(even) td {
    background: rgba(124, 58, 237, 0.05);
}

.article-body tbody tr:hover td {
    background: rgba(168, 85, 247, 0.09);
}

/* On small screens let wide tables scroll instead of breaking the layout */
@media (max-width: 640px) {
    .article-body table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ---- Related posts ------------------------------------------------------- */
.related-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(145deg,
        rgba(124, 58, 237, 0.08), rgba(13, 11, 26, 0.9));
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.35s ease, border-color 0.35s ease,
        box-shadow 0.35s ease;
}

.related-card:hover {
    transform: translateY(-6px);
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 20px 55px rgba(124, 58, 237, 0.22);
}

.related-card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bd-surface);
}

.related-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-card:hover .related-card-thumb img {
    transform: scale(1.06);
}

.related-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.1rem 1.15rem 1.25rem;
    flex: 1 1 auto;
}

.related-card-title {
    font-family: "Syne", sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.35;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.25s ease;
}

.related-card:hover .related-card-title {
    color: #d8b4fe;
}

.related-card-excerpt {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--bd-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-date {
    margin-top: auto;
    font-family: "Space Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: #7c6f9e;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
