@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --bg-card: #161616;
    --text: #f0f0f0;
    --text-muted: #888888;
    --accent: #c8ff00;
    --accent-dim: #a3cc00;
    --border: #222222;
    --radius: 12px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 1000;
    width: auto;
    height: auto;
    padding: 12px 20px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    font-size: .9rem;
    border-radius: 8px;
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

/* ===== HEADER / PRIMARY NAV (scoped to header nav so toc/breadcrumbs are unaffected) ===== */
header nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 20px 0;
    width: 100%;
    transition: background .3s, backdrop-filter .3s, padding .3s;
    background: rgba(10,10,10,.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

header nav.scrolled {
    padding: 14px 0;
}

header nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

header .logo span { color: var(--accent); }

header nav .nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
    list-style: none;
}

header nav .nav-links a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color .2s;
}

header nav .nav-links a:hover { color: var(--text); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    font-size: .9rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    font-family: inherit;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(200,255,0,.25);
    color: var(--bg);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 8px 30px rgba(200,255,0,.1);
    background: transparent;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: .3s;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 99;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.mobile-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.8rem;
    cursor: pointer;
}

/* ===== FIXED-NAV COMPENSATION FOR CONTENT PAGES ===== */
body.pbn-blog-page > main {
    padding-top: 96px;
}

/* ===== FOOTER ===== */
footer {
    border-top: 1px solid var(--border);
    padding: 60px 0 40px;
    background: var(--bg);
}

footer .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
    display: inline-block;
}

footer .logo span { color: var(--accent); }

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 60px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: .9rem;
    margin-top: 12px;
    max-width: 320px;
    line-height: 1.6;
}

.footer-partner {
    margin-top: 20px;
    max-width: 320px;
}

.footer-partner a {
    color: var(--text);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(200, 255, 0, 0.35);
    text-underline-offset: 3px;
    transition: color .2s, text-decoration-color .2s;
}

.footer-partner a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.footer-col h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: .95rem;
    color: var(--text);
}

.footer-col ul { list-style: none; }

.footer-col li { margin-bottom: 10px; }

.footer-col a {
    color: var(--text-muted);
    font-size: .9rem;
    transition: color .2s;
}

.footer-col a:hover { color: var(--text); }

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-muted);
}

.footer-socials {
    display: flex;
    gap: 20px;
}

.footer-socials a { transition: color .2s; }
.footer-socials a:hover { color: var(--accent); }

/* ===== ARTICLE / BLOG-POST CONTAINER ===== */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    color: var(--text);
}

.article-container h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    color: var(--text);
}

.article-container .meta {
    color: var(--text-muted);
    font-size: .85rem;
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.article-container .meta a {
    color: var(--accent);
}

.article-container .meta a:hover {
    color: var(--accent-dim);
}

.article-container .featured-image {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 40px;
    background: var(--bg-card);
}

.article-container .featured-image img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 2 / 1;
    object-fit: cover;
}

.article-container .content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #d6d6d6;
}

.article-container .content > * + * {
    margin-top: 1.2em;
}

.article-container .content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-top: 2em;
    color: var(--text);
}

.article-container .content h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.6em;
    color: var(--text);
}

.article-container .content h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.4em;
    color: var(--text);
}

.article-container .content p {
    color: #cfcfcf;
}

.article-container .content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(200, 255, 0, 0.35);
    text-underline-offset: 3px;
    transition: color .2s, text-decoration-color .2s;
}

.article-container .content a:hover {
    color: var(--accent-dim);
    text-decoration-color: var(--accent);
}

.article-container .content ul,
.article-container .content ol {
    padding-left: 1.5em;
    color: #cfcfcf;
}

.article-container .content li + li {
    margin-top: .4em;
}

.article-container .content img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1.6em 0;
}

.article-container .content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 20px;
    margin: 1.4em 0;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(200,255,0,.04);
    border-radius: 0 8px 8px 0;
}

.article-container .content code {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .9em;
    color: var(--accent);
}

.article-container .content pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .9rem;
    line-height: 1.6;
}

.article-container .content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
}

.article-container .content table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    font-size: .95rem;
}

.article-container .content th,
.article-container .content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-container .content th {
    background: var(--bg-elevated);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--text);
}

.article-container .content tr:last-child td { border-bottom: none; }

/* ===== TOC + BREADCRUMBS RESET (so global nav rules don't leak in) ===== */
nav.toc,
nav.breadcrumbs {
    position: static;
    z-index: auto;
    width: auto;
    top: auto;
    left: auto;
    right: auto;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
}

nav.toc {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin: 32px 0 40px;
}

nav.toc h2,
nav.toc .toc-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 12px;
}

nav.toc ol,
nav.toc ul {
    list-style: none;
    padding-left: 0;
    counter-reset: toc;
}

nav.toc li {
    margin: 6px 0;
    padding-left: 24px;
    position: relative;
    counter-increment: toc;
    color: var(--text-muted);
    font-size: .95rem;
}

nav.toc li::before {
    content: counter(toc, decimal-leading-zero);
    position: absolute;
    left: 0;
    color: var(--accent);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: .8rem;
}

nav.toc a {
    color: var(--text);
    transition: color .2s;
}

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

nav.breadcrumbs {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

nav.breadcrumbs ol,
nav.breadcrumbs ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

nav.breadcrumbs li + li::before {
    content: '/';
    color: var(--border);
    margin-right: 8px;
}

nav.breadcrumbs a {
    color: var(--text-muted);
    transition: color .2s;
}

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

nav.breadcrumbs li[aria-current="page"] {
    color: var(--text);
}

/* ===== TAGS ===== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: .8rem;
    color: var(--text-muted);
    transition: border-color .2s, color .2s;
}

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

/* ===== SHARE BUTTONS (bottom inline-row) ===== */
.share-buttons {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 40px 0 0;
}

.share-buttons-label {
    font-size: .85rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform .2s, box-shadow .2s;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.4);
}

.share-btn svg { width: 16px; height: 16px; fill: currentColor; }

.share-btn-x  { background: #000000; }
.share-btn-fb { background: #1877F2; }
.share-btn-li { background: #0A66C2; }
.share-btn-wa { background: #25D366; }
.share-btn-tg { background: #229ED9; }

/* ===== SHARE POPOVER (BBC-style top-of-article share) ===== */
.share-popover-wrap {
    position: relative;
    display: inline-block;
}

.share-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: .85rem;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: border-color .2s, color .2s;
}

.share-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.share-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    z-index: 50;
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.share-popover[hidden] {
    display: none;
}

.share-pop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    font-size: .9rem;
    text-decoration: none;
    transition: background .2s;
}

.share-pop-item:hover {
    background: var(--bg-card);
}

.share-pop-item .share-pop-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.share-pop-item .share-pop-icon svg { width: 12px; height: 12px; fill: currentColor; }

.share-pop-x  .share-pop-icon { background: #000000; }
.share-pop-fb .share-pop-icon { background: #1877F2; }
.share-pop-li .share-pop-icon { background: #0A66C2; }
.share-pop-wa .share-pop-icon { background: #25D366; }
.share-pop-tg .share-pop-icon { background: #229ED9; }

/* ===== RELATED POSTS ===== */
.related-posts {
    margin: 64px 0 0;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.related-posts h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .3s, transform .3s;
}

.related-card:hover {
    border-color: #333;
    transform: translateY(-2px);
}

.related-card a {
    display: block;
    padding: 20px;
    color: var(--text);
}

.related-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.related-card p {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.5;
}

/* ===== BLOG LIST PAGE ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin: 40px 0;
}

@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .3s, box-shadow .3s, border-color .3s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: #333;
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
}

.post-card a {
    color: inherit;
    text-decoration: none;
    display: contents;
}

.post-card-image {
    width: 100%;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    background: var(--bg-elevated);
    position: relative;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-image-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 20px;
    background:
        radial-gradient(circle at 20% 20%, rgba(200,255,0,.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(200,255,0,.05) 0%, transparent 50%),
        linear-gradient(135deg, #161616 0%, #0d0d0d 100%);
    position: relative;
}

.post-card-image-fallback::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(200,255,0,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200,255,0,.04) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.post-card-image-fallback .ph-cat {
    position: relative;
    font-family: 'Space Grotesk', sans-serif;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    z-index: 1;
}

.post-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cat-link {
    font-family: 'Space Grotesk', sans-serif;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-decoration: none;
}

.cat-link:hover { color: var(--accent-dim); }

.post-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
}

.post-card-meta {
    font-size: .8rem;
    color: var(--text-muted);
}

.post-card-excerpt {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== CATEGORY PILLS ===== */
.categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 8px 0 16px;
    margin: 24px 0;
    scrollbar-width: thin;
}

.categories::-webkit-scrollbar { height: 4px; }
.categories::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

@media (min-width: 768px) {
    .categories { flex-wrap: wrap; overflow-x: visible; }
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .85rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .2s, color .2s, background .2s;
}

.cat-chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

.cat-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 48px 0 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color .2s, color .2s, background .2s;
}

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

.pagination .current,
.pagination [aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

@media (max-width: 768px) {
    header nav .nav-links { display: none; }
    .hamburger { display: flex; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
    .related-grid { grid-template-columns: 1fr; }
    .article-container { padding: 32px 20px 64px; }
    .article-container .content { font-size: 1rem; }
    body.pbn-blog-page > main { padding-top: 80px; }
}
