/* ============================================================
   PrivateBox blog theme.
   Part 1: blog-only styles (content, cards, newsletter).
   Part 2: chrome (navbar/footer/search) - VERBATIM COPY of the
   main site's assets/css/pb-chrome.css. Keep the two in sync:
   any change there must be pasted here as well.
   ============================================================ */

/* Design tokens (mirrors the main site's tokens.css) */
:root {
    --black: #000;
    --white: #fefefe;
    --canvas: #ffffff;
    --canvas-warm: #fefefe;
    --ink: #111111;
    --text-dark: #111111;
    --navy: #0f172a;
    --ink-muted: #4b5563;
    --ink-subtle: #6b7280;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #3b82f6;
    --gray-mid: #686868;
    --gray-light: #f6f6f6;
    --surface: #faf9f6;
    --line: rgba(0, 0, 0, 0.05);
    --line-strong: rgba(0, 0, 0, 0.08);
    --blue-tint: rgba(37, 99, 235, 0.06);
    --shell: 1120px;
    --shell-wide: 1240px;
    --nav-height: 64px;
    --gutter: 2.5rem;
    --gutter-mobile: 1.25rem;
    --radius-btn: 8px;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-card: 24px;
    --radius-hero: 28px;
    --radius-pill: 999px;
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.015);
    --shadow-card-hover: 0 16px 40px rgba(0, 0, 0, 0.04);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 0.2s;
    --dur-med: 0.4s;
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Re-point daisyUI theme colors at the PrivateBox palette */
    --color-base-100: #fefefe;
    --color-base-200: #faf9f6;
    --color-base-300: #f0efeb;
    --color-base-content: #111111;
    --color-primary: #2563eb;
    --color-primary-content: #ffffff;
    --color-neutral: #111111;
    --color-neutral-content: #fefefe;
}

/* Blog base */
body.pb-blog {
    background: var(--canvas-warm);
    color: var(--text-dark);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-variation-settings: normal;
}

.pb-blog ::selection {
    background: rgba(37, 99, 235, 0.18);
    color: var(--text-dark);
}

.pb-blog a:focus-visible,
.pb-blog button:focus-visible,
.pb-blog [tabindex]:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .pb-blog *, .pb-blog *::before, .pb-blog *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.pb-blog h1, .pb-blog h2, .pb-blog h3, .pb-blog h4 {
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* Content shell: match the main site's 1120px column */
.pb-blog .wrapper {
    max-width: var(--shell);
}

.pb-main {
    padding-top: calc(var(--nav-height) + 1rem);
    padding-bottom: 6rem;
    min-height: 60vh;
}

/* Blog landing hero */
.pb-blog .hero-header {
    margin-top: 2.5rem;
    padding-bottom: 1.5rem;
}

.pb-blog .hero-header h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.pb-blog .hero-header p {
    color: var(--ink-muted);
}

/* Buttons */
.pb-blog .btn {
    border-radius: var(--radius-btn);
    font-family: var(--font);
    font-weight: 500;
    box-shadow: none;
}

.pb-blog .btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.pb-blog .btn-primary:hover {
    background: var(--blue-light);
    border-color: var(--blue-light);
}

/* Post cards */
.pb-blog .posts article .rounded-xl,
.pb-blog .posts article img {
    border-radius: var(--radius-sm);
}

.pb-blog .breadcrumbs {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: none;
}

.pb-blog time,
.pb-blog .opacity-70,
.pb-blog .opacity-80 {
    color: var(--ink-muted);
}

/* Reading progress bar sits at the very bottom of the fixed nav */
.pb-navbar #progress-bar-container {
    bottom: 0;
}

.pb-navbar #progress-bar {
    background: var(--blue);
}

/* Newsletter CTA (blog only) */
.pb-newsletter {
    padding: 0 var(--gutter) 5rem;
}

.pb-newsletter-card {
    max-width: var(--shell);
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    padding: clamp(2.5rem, 5vw, 4rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pb-newsletter-card h2 {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.pb-newsletter-desc {
    color: var(--ink-muted);
    max-width: 48ch;
}

.pb-newsletter-form {
    margin-top: 1.25rem;
    width: 100%;
    max-width: 560px;
}

.pb-newsletter-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.pb-newsletter-input {
    flex: 1;
    height: 3rem;
    padding: 0 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-btn);
    background: #fff;
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--ink);
}

.pb-newsletter-input:focus {
    outline: 2px solid var(--blue);
    outline-offset: 0;
    border-color: transparent;
}

.pb-newsletter-btn {
    height: 3rem;
    padding: 0 1.4rem;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.pb-newsletter-btn:hover {
    background: var(--blue-light);
    transform: translateY(-1px);
}

.pb-newsletter-disclaimer {
    font-size: 0.8rem;
    color: var(--ink-subtle);
    margin-top: 0.5rem;
}

@media (max-width: 640px) {
    .pb-newsletter { padding: 0 var(--gutter-mobile) 4rem; }
    .pb-newsletter-row { flex-direction: column; }
    .pb-newsletter-input, .pb-newsletter-btn { width: 100%; }
}

/* ============================================================
   Chrome (navbar / footer / search)
   VERBATIM from main site assets/css/pb-chrome.css
   ============================================================ */

/* Scoped reset: neutralise both browsers' defaults and the blog's
   Tailwind preflight inside the chrome. */
.pb-navbar, .pb-navbar *,
.pb-footer, .pb-footer *,
.pb-search-overlay, .pb-search-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    font-family: var(--font);
}

.pb-navbar button, .pb-search-overlay button {
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.pb-desktop-only { display: flex !important; }
.pb-mobile-only { display: none !important; }
@media (max-width: 1024px) {
    .pb-desktop-only { display: none !important; }
    .pb-mobile-only { display: block !important; }
}

/* ------------------------------------------------------------
   Navbar
   ------------------------------------------------------------ */
.pb-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    height: 64px;
    min-height: 64px;
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    background: transparent;
    transition: background 0.4s ease;
}

/* Glass state: scrolled, menu open, inner pages, and the blog */
.pb-navbar.scrolled,
.detail-page .pb-navbar,
.pb-blog .pb-navbar {
    background: rgba(254, 254, 254, 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pb-navbar.menu-open {
    background: rgba(254, 254, 254, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.pb-nav-inner {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Wordmark with corner brackets */
.pb-nav-logo {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    position: relative;
    padding: 2px 6px;
}

.pb-nav-logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    border-top: 2px solid #000;
    border-left: 2px solid #000;
}

.pb-nav-logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #000;
    border-right: 2px solid #000;
}

.pb-logo-private {
    color: var(--blue);
    font-weight: 800;
}

.pb-logo-box {
    color: #000;
    font-weight: 800;
    margin-left: 0.3em;
}

.pb-nav-links {
    display: flex;
    align-items: center;
    gap: clamp(0.8rem, 1.6vw, 1.5rem);
    flex-wrap: nowrap;
}

.pb-nav-links a {
    color: var(--gray-mid);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: normal;
    transition: color 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.pb-nav-links > a:not(.pb-nav-cta) {
    position: relative;
    padding: 0.35rem 0;
}

.pb-nav-links > a:not(.pb-nav-cta) + a:not(.pb-nav-cta) {
    padding-left: clamp(1rem, 1.8vw, 1.4rem);
}

.pb-nav-links > a:not(.pb-nav-cta) + a:not(.pb-nav-cta)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 1.05rem;
    background: rgba(17, 17, 17, 0.12);
    transform: translateY(-50%);
}

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

.pb-nav-links a[aria-current="page"],
.pb-mobile-menu a[aria-current="page"] {
    color: var(--text-dark);
}

.pb-nav-links .pb-nav-cta {
    background: var(--blue);
    color: #fff;
    padding: 0.45rem 1.1rem;
    border-radius: 8px;
    margin-left: clamp(0.6rem, 1.2vw, 1rem);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.2;
    transition: background 0.2s, transform 0.15s;
}

.pb-nav-links .pb-nav-cta:hover {
    background: var(--blue-light);
    color: #fff;
    transform: translateY(-1px);
}

/* Search trigger */
.pb-nav-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: 2rem;
    border-radius: 8px;
    color: var(--gray-mid);
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.pb-nav-search:hover {
    color: var(--text-dark);
    background: var(--gray-light);
}

.pb-nav-search svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Mobile menu toggle (hamburger) */
.pb-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    background: transparent;
    z-index: 1001;
}

@media (max-width: 1024px) {
    .pb-menu-toggle { display: flex !important; }
}

.pb-menu-toggle .bar {
    width: 100%;
    height: 2.5px;
    background: #000;
    transition: all 0.3s ease;
    border-radius: 999px;
}

.pb-menu-toggle.active .top {
    transform: translateY(9px) rotate(45deg);
}

.pb-menu-toggle.active .mid {
    opacity: 0;
}

.pb-menu-toggle.active .bot {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile menu overlay */
.pb-mobile-menu {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.06), transparent 28%),
        rgba(254, 254, 254, 0.98);
    z-index: 1000;
    padding: 6.5rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.25rem;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* The generic pb-mobile-only utility forces display:block; the menu itself
   must stay a column flexbox, and its links block-level. */
@media (max-width: 1024px) {
    .pb-mobile-menu.pb-mobile-only { display: flex !important; }
}

.pb-mobile-menu a {
    display: block;
}

.pb-mobile-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.pb-mobile-menu::before {
    content: 'Navigation';
    width: min(100%, 420px);
    margin: 0 auto 1rem;
    color: rgba(17, 17, 17, 0.45);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.pb-mobile-menu a {
    width: min(100%, 420px);
    margin: 0 auto;
    font-size: clamp(1.15rem, 3vw, 1.3rem);
    font-weight: 600;
    line-height: 1.3;
    color: #111;
    text-decoration: none;
    letter-spacing: -0.02em;
    padding: 0.95rem 0.2rem;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.pb-mobile-menu a:not(.pb-nav-cta) {
    border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}

.pb-mobile-menu .pb-mobile-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.pb-mobile-menu .pb-mobile-search svg {
    width: 20px;
    height: 20px;
}

.pb-mobile-menu .pb-nav-cta {
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--blue) 0%, #1d4ed8 100%);
    color: #fff;
    padding: 1.05rem 1.2rem;
    border-radius: 16px;
    text-align: center;
    font-size: 1.05rem;
    border: none;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.18);
}

@media (max-width: 640px) {
    .pb-navbar { padding: 0 1.25rem; }
}

/* ------------------------------------------------------------
   Search dialog
   ------------------------------------------------------------ */
.pb-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(17, 17, 17, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(4rem, 14vh, 9rem) 1.25rem 2rem;
}

.pb-search-overlay[hidden] {
    display: none;
}

.pb-search-box {
    width: min(100%, 640px);
    background: var(--canvas-warm);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.pb-search-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--line);
}

.pb-search-glass {
    width: 18px;
    height: 18px;
    color: var(--ink-subtle);
    flex-shrink: 0;
}

.pb-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
}

.pb-search-input::placeholder {
    color: var(--ink-subtle);
}

.pb-search-close {
    color: var(--ink-subtle);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
}

.pb-search-close:hover {
    color: var(--ink);
    background: var(--gray-light);
}

.pb-search-results {
    max-height: min(48vh, 420px);
    overflow-y: auto;
    padding: 0.5rem;
}

.pb-search-hint {
    color: var(--ink-subtle);
    font-size: 0.88rem;
    line-height: 1.5;
    padding: 0.75rem 0.8rem;
}

.pb-search-result {
    display: block;
    text-decoration: none;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
}

.pb-search-result:hover,
.pb-search-result:focus-visible {
    background: var(--blue-tint);
}

.pb-search-result-page {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 0.15rem;
}

.pb-search-result-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--ink);
}

.pb-search-result-snippet {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--ink-muted);
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pb-search-blog {
    border-top: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
    margin-top: 0.25rem;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.pb-footer {
    position: relative;
    z-index: 3;
    background: #050505;
    color: rgba(255, 255, 255, 0.9);
    padding: 3.75rem 2.5rem 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 1rem;
    line-height: 1.5;
}

.pb-footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
}

.pb-footer-top {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(540px, 1.85fr);
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(3rem, 8vw, 7rem);
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pb-footer-brand {
    max-width: 320px;
}

.pb-footer-logo {
    width: min(100%, 250px);
    height: auto;
    display: block;
    margin: 0 0 1rem;
    border: 0;
}

.pb-footer-brand p {
    max-width: 32ch;
    color: rgba(255, 255, 255, 0.68);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
}

.pb-footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: clamp(2rem, 4vw, 3.25rem);
    width: 100%;
}

.pb-footer-col h4 {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: none;
    color: #fff;
    margin: 0 0 0.9rem;
    text-align: left;
}

.pb-footer-col a {
    display: block;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.96rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 0.32rem 0;
    text-align: left;
    transition: color 0.2s ease;
}

.pb-footer-col a:hover {
    color: #fff;
}

.pb-footer-bottom {
    padding-top: 1.25rem;
    border-top: 0;
}

.pb-footer-bottom p {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
}

@media (max-width: 900px) {
    .pb-footer-top {
        grid-template-columns: minmax(210px, 0.9fr) minmax(420px, 1.6fr);
        gap: 2.5rem;
    }

    .pb-footer-logo {
        width: min(100%, 220px);
    }

    .pb-footer-links-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 720px) {
    .pb-footer {
        padding: 2.75rem 1.25rem 2rem;
    }

    .pb-footer-top {
        grid-template-columns: 1fr;
    }

    .pb-footer-links-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .pb-footer-links-grid {
        grid-template-columns: 1fr;
    }
}
