/* Bidfoil Articles - Magazine-grade typography + engagement bar */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&family=Playfair+Display:wght@600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; }
:root {
    --bg: #fffefb;
    --fg: #1a1a1a;
    --muted: #5b5b5b;
    --subtle: #8a8a8a;
    --accent: #0b2545;
    --accent-soft: #133a6b;
    --gold: #c9a227;
    --gold-soft: #f4ecd0;
    --border: #ebe7df;
    --card-bg: #faf8f4;
    --code-bg: #f4f1ec;
    --max-width: 720px;
    --like: #16a34a;
    --dislike: #dc2626;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15171a;
        --fg: #e8e6e2;
        --muted: #9a978f;
        --subtle: #6e6c66;
        --accent: #7eb6ff;
        --accent-soft: #a5cdff;
        --gold: #d4b34a;
        --gold-soft: #2a2616;
        --border: #2a2c30;
        --card-bg: #1c1f23;
        --code-bg: #1f2226;
        --like: #4ade80;
        --dislike: #f87171;
    }
}

html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.7;
    font-size: 19px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold); }

/* ---------- Site header ---------- */
.site-header {
    background: var(--accent);
    color: #fff;
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-header .brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.site-header .brand-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    font-size: 1.7rem;
    letter-spacing: 0.01em;
    line-height: 1;
}
.site-header .brand:hover .brand-name { color: var(--gold); }
.site-header nav a {
    font-family: 'Inter', sans-serif;
    color: #fff;
    margin-left: 24px;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    opacity: 0.85;
    letter-spacing: 0.02em;
}
.site-header nav a:hover { opacity: 1; color: var(--gold); }

.container { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }

/* ---------- Homepage hero ---------- */
.hero {
    text-align: center;
    padding: 56px 0 60px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}
.hero h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2.2rem, 5.5vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--accent);
    margin: 0 0 14px;
    line-height: 1.05;
}
.hero .tagline {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    color: var(--muted);
    font-size: 1.18rem;
    margin: 0;
}

/* ---------- Post grid ---------- */
.post-grid {
    display: grid;
    gap: 36px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0,0,0,.07);
}
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { text-decoration: none; color: inherit; }
.card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--accent);
}
.card-image img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.post-card:hover .card-image img { transform: scale(1.04); }
.card-body { padding: 22px 22px 26px; }
.card-body h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
    margin: 10px 0 12px;
    line-height: 1.25;
    color: var(--fg);
    letter-spacing: -0.005em;
}
.card-body p {
    color: var(--muted);
    margin: 0 0 16px;
    font-size: 1rem;
    line-height: 1.55;
}
.category {
    font-family: 'Inter', sans-serif;
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gold);
    font-weight: 700;
}
.card-body .date {
    font-family: 'Inter', sans-serif;
    color: var(--subtle);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* ---------- Pagination ---------- */
.pagination {
    text-align: center;
    margin: 56px 0 20px;
    font-family: 'Inter', sans-serif;
}
.pagination a, .pagination .current {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid var(--border);
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9rem;
}
.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---------- Single post ---------- */
.single-post { max-width: var(--max-width); margin: 0 auto; }
.post-header { margin-bottom: 36px; text-align: center; }
.post-header .category { margin-bottom: 14px; display: block; }
.post-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin: 14px 0 18px;
    color: var(--accent);
}
.post-header .meta {
    font-family: 'Inter', sans-serif;
    color: var(--subtle);
    font-size: 0.88rem;
    letter-spacing: 0.02em;
}
.post-header .meta #view-count { font-weight: 600; color: var(--muted); }

.featured {
    margin: 40px -40px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--card-bg);
}
@media (max-width: 800px) {
    .featured { margin: 32px -24px; }
}
.featured img { width: 100%; height: auto; display: block; }

/* ---------- Article content ---------- */
.content { font-size: 1.08rem; line-height: 1.8; }
.content > p:first-of-type::first-letter {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 4em;
    font-weight: 800;
    float: left;
    line-height: 0.85;
    margin: 0.05em 0.1em 0 0;
    color: var(--accent);
}
.content h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 700;
    margin: 2.2em 0 0.6em;
    color: var(--accent);
    letter-spacing: -0.005em;
    line-height: 1.25;
}
.content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.8em 0 0.5em;
    color: var(--fg);
}
.content h4 {
    font-family: 'Inter', sans-serif;
    font-size: 1.02rem;
    font-weight: 600;
    margin: 1.5em 0 0.4em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.content p { margin: 1.1em 0; }
.content ul, .content ol { padding-left: 1.6em; margin: 1.2em 0; }
.content li { margin: 0.55em 0; line-height: 1.7; }
.content li::marker { color: var(--gold); }
.content blockquote {
    border-left: 3px solid var(--gold);
    padding: 8px 24px;
    margin: 2em 0;
    color: var(--muted);
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.6;
}
.content blockquote p { margin: 0.5em 0; }
.content a {
    color: var(--accent-soft);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(11, 37, 69, 0.3);
}
.content a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}
.content th, .content td {
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    text-align: left;
}
.content th {
    background: var(--card-bg);
    font-weight: 600;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}
.content tr:hover td { background: var(--card-bg); }
.content img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
    display: block;
    margin: 1em auto;
}
.content code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.92em;
    color: var(--accent);
}
.content pre {
    font-family: 'JetBrains Mono', monospace;
    background: var(--code-bg);
    border-left: 3px solid var(--accent);
    padding: 18px 22px;
    border-radius: 2px;
    overflow-x: auto;
    margin: 1.8em 0;
    font-size: 0.92rem;
    line-height: 1.6;
}
.content pre code { background: none; padding: 0; color: var(--fg); font-size: inherit; }
.content strong { color: var(--accent); font-weight: 600; }
.content figure.inline-image { margin: 2.4em 0; text-align: center; }
.content figure.inline-image img {
    max-width: 100%; height: auto; border-radius: 3px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.content figure.inline-image figcaption {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--subtle);
    margin-top: 10px;
    font-style: italic;
}

/* ---------- Engagement bar (likes + share) ---------- */
.engagement-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 48px 0 0;
    padding: 22px 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
}
.reactions { display: flex; gap: 12px; align-items: center; }
.react-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.react-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}
.react-btn.active.react-like {
    background: var(--like);
    color: #fff;
    border-color: var(--like);
}
.react-btn.active.react-dislike {
    background: var(--dislike);
    color: #fff;
    border-color: var(--dislike);
}
.react-btn .count { font-weight: 600; min-width: 1ch; }

.share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-label {
    font-size: 0.85rem;
    color: var(--subtle);
    margin-right: 4px;
    letter-spacing: 0.02em;
}
.share-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}
.share-x       { background: #000;    }
.share-fb      { background: #1877f2; }
.share-wa      { background: #25d366; }
.share-li      { background: #0a66c2; }
.share-copy    { background: #6b7280; }
.share-copy.copied { background: var(--like); }

@media (max-width: 540px) {
    .engagement-bar { padding: 16px; flex-direction: column; align-items: stretch; }
    .reactions { justify-content: center; }
    .share { justify-content: center; }
}

/* ---------- Post footer ---------- */
.post-footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding-top: 28px;
    font-family: 'Inter', sans-serif;
}
.disclosure {
    color: var(--muted);
    font-size: 0.88em;
    line-height: 1.6;
    background: var(--gold-soft);
    padding: 14px 18px;
    border-radius: 3px;
}
.tags { margin-top: 24px; }
.tag {
    display: inline-block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    margin: 0 6px 6px 0;
    color: var(--muted);
    text-decoration: none;
}

.preview-banner {
    background: #fff7d6;
    color: #5c4400;
    border: 1px solid #f3dc81;
    padding: 12px 18px;
    border-radius: 3px;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}

.site-footer {
    text-align: center;
    padding: 40px 24px 32px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 80px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    line-height: 1.7;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 80px 0;
    font-style: italic;
}

.error-page { text-align: center; padding: 80px 24px; }
.error-page h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3rem;
    color: var(--accent);
    font-weight: 800;
}

@media (max-width: 600px) {
    body { font-size: 18px; }
    .container { padding: 20px 18px 60px; }
    .content { font-size: 1.02rem; }
    .content > p:first-of-type::first-letter { font-size: 3.4em; }
    .post-header h1 { font-size: 1.95rem; }
    .site-header { padding: 14px 18px; }
    .site-header .brand-name { font-size: 1.4rem; }
}
