/* ── blog.css — QuantumCSS blog styling (adapted from the Starlight example) ── */

:root {
    --blog-accent: #00d4ff;
    --blog-accent-glow: rgba(0, 212, 255, 0.35);
    --blog-muted: rgba(241, 245, 249, 0.45);
}

/* ── Starfield background ── */
.stars-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: 0.6;
    animation: twinkle var(--d) ease-in-out infinite;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ── Navigation ── */
html {
    scroll-behavior: smooth;
    /* Keep anchored headings below the sticky nav when jumping to them */
    scroll-padding-top: 5rem;
}
body {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    margin: 0;
}
.nav-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.06);
}
.nav-header .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--q-text-primary);
}
.text-gradient {
    background: linear-gradient(135deg, var(--q-color-starlight-peach) 0%, var(--q-color-starlight-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.font-bold { font-weight: 700; }
.nav-links { display: none; gap: 1.5rem; align-items: center; }
.nav-links a {
    color: var(--q-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--q-text-primary); }
.theme-toggle {
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsla(0, 0%, 100%, 0.06);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.theme-toggle:hover {
    background: hsla(0, 0%, 100%, 0.1);
    transform: translateY(-1px);
}
.icon-sun, .icon-moon { display: none; }
.theme-toggle .icon-display { display: block; }

/* ── Mobile nav (hamburger + drawer) ── */
.nav-toggle { display: none; }
.nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    order: -1;
}
.nav-hamburger-icon span {
    display: block;
    width: 1.25rem;
    height: 2px;
    border-radius: 2px;
    background: var(--q-text-primary);
}
.nav-drawer {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    position: fixed;
    top: 4.5rem;
    left: 1rem;
    right: 1rem;
    z-index: 9;
    background: hsla(222, 40%, 10%, 0.95);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(12px);
}
.nav-drawer a {
    color: var(--q-text-secondary);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 0;
}
.nav-drawer a:hover { color: var(--q-text-primary); }
.nav-toggle:checked ~ .nav-drawer { display: flex; }
@media (min-width: 1024px) {
    .nav-hamburger { display: none; }
    .nav-drawer { display: none !important; }
    .nav-links { display: flex; }
}

/* ── Article header author block ── */
.author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.author .avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid hsla(0, 0%, 100%, 0.12);
}
.author .avatar-initials {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--q-color-starlight-blue);
    background: hsla(0, 0%, 100%, 0.06);
    border: 1px solid hsla(0, 0%, 100%, 0.12);
}
.author p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--q-text-secondary);
}
.author p:first-child {
    font-weight: 600;
    color: var(--q-text-primary);
}

/* ── Main layout ── */
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 6rem 1.5rem 4rem;
}
main > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: start;
}
@media (min-width: 1024px) {
    main > div {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

/* ── Article ── */
article {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}
article > header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
article > header > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--q-text-secondary);
}
article > header > div:first-child span,
article > header > div:first-child time {
    font-feature-settings: "tnum";
}
article h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
    color: var(--q-text-primary);
}
@media (min-width: 1024px) {
    article h1 { font-size: 3.5rem; }
}

/* ── Content body (prose) ── */
.prose {
    line-height: 1.75;
    color: var(--q-text-secondary);
}
.prose p {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}
.prose p:first-of-type {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--q-text-primary);
}
.prose h2 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 2.5rem 0 1rem;
    position: relative;
    padding-left: 0.75rem;
    color: var(--q-text-primary);
}
.prose h2 .accent-bar {
    position: absolute;
    inset: 0.1em 0 0.1em -0.75rem;
    width: 0.35rem;
    background: linear-gradient(135deg, var(--q-color-starlight-peach) 0%, var(--q-color-starlight-blue) 100%);
    border-radius: 9999px;
}
.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
    color: var(--q-text-primary);
}
.prose a {
    color: var(--q-color-starlight-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.prose a:hover {
    color: var(--q-color-starlight-peach);
    text-shadow: 0 0 8px rgba(255, 179, 138, 0.3);
}
.prose ul, .prose ol {
    margin: 0.75rem 0 1rem 1.5rem;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li {
    margin-bottom: 0.4rem;
}
.prose li > p { margin: 0; }
.prose li > ul, .prose li > ol { margin-top: 0.4rem; }
.prose pre {
    background: hsla(0, 0%, 100%, 0.05);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-radius: 0.75rem;
    padding: 1.5rem;
    font-size: 0.875rem;
    overflow-x: auto;
    margin: 1rem 0;
}
.prose pre code {
    font-family: var(--q-font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--q-text-primary);
}
.prose code {
    font-family: var(--q-font-mono);
    font-size: 0.875em;
    background: hsla(0, 0%, 100%, 0.08);
    padding: 0.15em 0.35em;
    border-radius: 0.25rem;
    color: var(--q-color-starlight-blue);
}
.prose hr {
    border: none;
    border-top: 1px solid hsla(0, 0%, 100%, 0.1);
    margin: 2.5rem 0;
}
.prose blockquote {
    border-left: 3px solid var(--q-color-starlight-blue);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--q-text-secondary);
}

/* ── Badges ── */
.badge-primary, .badge-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    text-decoration: none;
}
.badge-primary {
    background: hsla(0, 0%, 100%, 0.08);
    color: var(--q-color-starlight-blue);
    border: 1px solid hsla(0, 0%, 100%, 0.12);
}
.badge-secondary {
    background: hsla(0, 0%, 100%, 0.05);
    color: var(--q-text-secondary);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
}

/* ── Callout card ── */
.blue-card {
    background: hsla(0, 0%, 100%, 0.04);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-left: 3px solid var(--q-color-starlight-blue);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--q-text-secondary);
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}
.blue-card::before {
    content: "";
    position: absolute;
    inset: 0 0 0 -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.04), transparent);
    animation: shine 6s infinite;
}
@keyframes shine {
    100% { inset: 0 100% 0 -100%; }
}

/* ── Tags ── */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 2rem;
    border-top: 1px solid hsla(0, 0%, 100%, 0.08);
}

/* ── Aside / sidebar ── */
aside {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.card, .glass {
    background: hsla(0, 0%, 100%, 0.04);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}
.card h3, .glass h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--q-text-secondary);
}
.card p, .glass p {
    font-size: 0.875rem;
    color: var(--q-text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem;
}
.recommended a {
    display: block;
    background: hsla(0, 0%, 100%, 0.03);
    border: 1px solid hsla(0, 0%, 100%, 0.06);
    border-radius: 0.75rem;
    padding: 1rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: background 0.3s, border-color 0.3s;
}
.recommended a:hover {
    background: hsla(0, 0%, 100%, 0.05);
    border-color: hsla(0, 0%, 100%, 0.12);
}
.recommended h4 {
    font-weight: 700;
    color: var(--q-text-primary);
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
}
.recommended p {
    font-size: 0.75rem;
    color: var(--q-text-secondary);
    margin: 0;
}

/* ── Footer ── */
footer {
    margin-top: 6rem;
    border-top: 1px solid hsla(0, 0%, 100%, 0.08);
    padding: 3rem 1.5rem;
    background: hsla(0, 0%, 100%, 0.03);
}
footer > div {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}
@media (min-width: 768px) {
    footer > div {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}
footer .left, footer .right {
    color: var(--q-text-muted);
    font-size: 0.875rem;
}
footer .right { display: flex; gap: 1.5rem; }
footer .right a {
    color: var(--q-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s;
}
footer .right a:hover { color: var(--q-color-starlight-blue); }

/* ── Light theme overrides ── */
html[data-theme="light"] .stars-bg { display: none; }
html[data-theme="light"] .nav-header { border-bottom-color: rgba(0, 0, 0, 0.1); }
html[data-theme="light"] .badge-primary { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .badge-secondary { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .blue-card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .card,
html[data-theme="light"] .glass {
    background: #fff;
    border-color: #e2e8f0;
}
html[data-theme="light"] footer {
    background: #f8fafc;
    border-top-color: #e2e8f0;
}
