/* ═══════════════════════════════════════════════════════
   Luminous Photonics Blog Theme
   ═══════════════════════════════════════════════════════ */

:root {
    --t-fast: 220ms;
    --t-med: 320ms;
    --ease-ui: cubic-bezier(.2, .8, .2, 1);

    --ff-heading: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ff-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="light"] {
    --page-bg: #F7F8FA;
    --section-bg: #EEF2F6;
    --surface: #FFFFFF;
    --surface-2: #F5F7FB;
    --border: #D7DEE8;
    --heading: #0B1220;
    --text: #243041;
    --muted: #5B677A;
    --accent: #D4AF37;
    --accent-hover: #B68B1E;
    --elev-shadow: 0 10px 32px rgba(11, 18, 32, 0.08);
    --shadow-elevated: 0 4px 12px rgba(11, 18, 32, 0.08);
}

html[data-theme="dark"] {
    --page-bg: #0B0F14;
    --section-bg: #101826;
    --surface: #141C27;
    --surface-2: #182232;
    --border: #263244;
    --heading: #F7FAFF;
    --text: #E8EDF4;
    --muted: #A7B2C3;
    --accent: #D4AF37;
    --accent-hover: #B68B1E;
    --elev-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    background: var(--page-bg);
    color: var(--text);
}

body {
    font-family: var(--ff-body);
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.65;
    transition: background-color var(--t-med) var(--ease-ui), color var(--t-fast) var(--ease-ui);
}

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

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

.blog-topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-bottom: 1px solid var(--border);
}

.blog-topbar__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.blog-brand {
    font-family: var(--ff-heading);
    font-weight: 700;
    color: var(--heading);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.blog-topbar__links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.blog-topbar__links a {
    color: var(--muted);
    font-size: 0.92rem;
    transition: color var(--t-fast) var(--ease-ui);
}

.blog-topbar__links a:hover,
.blog-topbar__links a[aria-current="page"] {
    color: var(--heading);
}

.blog-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.5rem 1rem 4rem;
}

.blog-hero {
    margin-bottom: 2rem;
}

.blog-hero h1 {
    margin: 0 0 0.7rem;
    font-family: var(--ff-heading);
    color: var(--heading);
    line-height: 1.12;
    font-size: clamp(2rem, 4.4vw, 3rem);
}

.blog-hero p {
    margin: 0;
    color: var(--muted);
    max-width: 76ch;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}

.blog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--elev-shadow);
    transition: transform var(--t-med) var(--ease-ui), border-color var(--t-med) var(--ease-ui), box-shadow var(--t-med) var(--ease-ui);
}

.blog-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.blog-card__thumb {
    display: block;
    background: var(--surface-2);
}

.blog-card__thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.blog-card__body {
    padding: 1rem 1rem 1.1rem;
}

.blog-card__title {
    margin: 0 0 0.5rem;
    font-family: var(--ff-heading);
    color: var(--heading);
    font-size: 1.18rem;
    line-height: 1.3;
}

.blog-card__desc {
    margin: 0 0 0.85rem;
    color: var(--text);
    font-size: 0.95rem;
}

.blog-card__meta {
    margin: 0 0 0.9rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.blog-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--heading);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.42rem 0.68rem;
    transition: border-color var(--t-med) var(--ease-ui), color var(--t-fast) var(--ease-ui), background-color var(--t-med) var(--ease-ui);
}

.blog-card__cta:hover {
    border-color: var(--accent);
    color: var(--heading);
}

.post {
    max-width: 860px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--elev-shadow);
    padding: 1.3rem 1.3rem 1.8rem;
}

.post-back {
    display: inline-flex;
    margin-bottom: 0.85rem;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color var(--t-fast) var(--ease-ui);
}

.post-back:hover {
    color: var(--heading);
}

.post h1 {
    margin: 0;
    font-family: var(--ff-heading);
    font-size: clamp(1.7rem, 3.2vw, 2.35rem);
    line-height: 1.2;
    color: var(--heading);
}

.post .sub {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.post .meta {
    margin: 0.9rem 0 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.post .dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--accent);
}

.post-hero {
    margin: 0.1rem 0 1.2rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.post-hero img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

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

.prose h2,
.prose h3 {
    margin-top: 1.45em;
    margin-bottom: 0.45em;
    color: var(--heading);
    font-family: var(--ff-heading);
    line-height: 1.26;
}

.prose p,
.prose li {
    margin: 0.65em 0;
}

.prose ul {
    margin: 0.4em 0 0.95em 1.2em;
    padding: 0;
}

.prose strong {
    color: var(--heading);
}

.tags {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tag {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.78rem;
    padding: 0.25rem 0.55rem;
}

.foot-nav {
    margin-top: 1.2rem;
}

.foot-nav a {
    color: var(--heading);
    font-weight: 600;
    font-size: 0.92rem;
}

.foot-nav a:hover {
    color: var(--accent-hover);
}

/* Theme toggle widget (shared with homepage) */
.theme-toggle {
    position: fixed;
    left: 18px;
    bottom: 18px;
    width: 120px;
    height: 200px;
    z-index: 9999;
    pointer-events: auto;
    opacity: 0.92;
    --on: 1;
    --bg: hsl(calc(200 - (var(--on) * 160)), calc((20 + (var(--on) * 50)) * 1%), calc((20 + (var(--on) * 60)) * 1%));
    --cord: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
    --stroke: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
    --shine: hsla(0, 0%, 100%, calc(0.75 - (var(--on) * 0.5)));
    --cap: hsl(0, 0%, calc((40 + (var(--on) * 30)) * 1%));
    --filament: hsl(45, calc(var(--on) * 80%), calc((25 + (var(--on) * 75)) * 1%));
}

.theme-toggle:hover {
    opacity: 1;
}

.theme-toggle * {
    box-sizing: border-box;
}

.theme-toggle .toggle-scene {
    width: 100%;
    height: 100%;
    overflow: visible !important;
    position: absolute;
}

.theme-toggle .toggle-scene__cord {
    stroke: var(--cord);
    cursor: move;
    display: none;
}

.theme-toggle .toggle-scene__cord-end {
    stroke: var(--cord);
    fill: var(--cord);
}

.theme-toggle .toggle-scene__dummy-cord {
    stroke-width: 6;
    stroke: var(--cord);
}

.theme-toggle .bulb__filament {
    stroke: var(--filament);
}

.theme-toggle .bulb__shine {
    stroke: var(--shine);
}

.theme-toggle .bulb__flash {
    stroke: hsl(45, 80%, 80%);
    display: none;
}

.theme-toggle .bulb__bulb {
    stroke: var(--stroke);
    fill: hsla(calc(180 - (95 * var(--on))), 80%, 80%, calc(0.1 + (0.4 * var(--on))));
}

.theme-toggle .bulb__cap {
    fill: var(--cap);
}

.theme-toggle .bulb__cap-shine {
    fill: var(--shine);
}

.theme-toggle .bulb__cap-outline {
    stroke: var(--stroke);
}

.theme-toggle__hint {
    position: absolute;
    bottom: 0;
    left: 41px;
    transform: translateX(-50%);
    font-family: var(--ff-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    opacity: 0.85;
    pointer-events: none;
    white-space: nowrap;
    animation: blog-gentle-bounce 2s ease-in-out infinite;
}

@keyframes blog-gentle-bounce {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, 3.5px);
    }
}

.mobile-theme-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 64px;
    height: 34px;
    border-radius: 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    z-index: 9999;
    padding: 0;
    box-shadow: var(--shadow-elevated);
    align-items: center;
    justify-content: space-between;
}

.mobile-theme-toggle__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    z-index: 2;
    transition: transform var(--t-med) var(--ease-ui);
    box-shadow: 0 1px 3px rgba(11, 18, 32, 0.2);
}

html[data-theme="dark"] .mobile-theme-toggle__knob {
    transform: translateX(30px);
}

.mobile-theme-toggle__icon {
    position: relative;
    z-index: 1;
    width: 50%;
    text-align: center;
    color: var(--muted);
}

.mobile-theme-toggle__icon--light {
    margin-left: 8px;
}

.mobile-theme-toggle__icon--dark {
    margin-right: 8px;
}

html[data-theme="light"] .mobile-theme-toggle__icon--light,
html[data-theme="dark"] .mobile-theme-toggle__icon--dark {
    color: var(--surface);
    z-index: 3;
}

@media (max-width: 900px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .theme-toggle {
        display: none !important;
    }

    .mobile-theme-toggle {
        display: flex;
    }

    .blog-topbar__inner {
        flex-wrap: wrap;
        justify-content: center;
    }

    .blog-container {
        padding-top: 1.6rem;
    }

    .post {
        padding: 1rem 0.9rem 1.3rem;
    }
}
