/* =========================================
   Daily Brief — stylesheet
   ========================================= */
:root {
    --brand: #1a56db;
    --brand-dark: #14439f;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f9fafb;
    --card: #ffffff;
    --danger: #dc2626;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.brand-mark {
    background: var(--brand); color: #fff; border-radius: 8px;
    width: 36px; height: 36px; display: inline-flex; align-items: center;
    justify-content: center; font-weight: 800;
}
.brand-text { font-size: 18px; letter-spacing: -.2px; }

.main-nav { flex: 1; }
.main-nav ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.main-nav a { color: var(--ink); font-weight: 500; font-size: 15px; }
.main-nav a:hover { color: var(--brand); text-decoration: none; }

.auth-area { display: flex; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar { border-radius: 50%; object-fit: cover; }
.user-name { font-size: 14px; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px;
    border: 1px solid transparent; font-weight: 600; font-size: 14px;
    cursor: pointer; background: var(--brand); color: #fff; text-align: center;
}
.btn:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--bg); }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--brand); }
.btn-google {
    background: #fff; color: #444; border: 1px solid var(--line);
    font-size: 15px; padding: 12px 16px; box-shadow: var(--shadow);
}
.btn-google:hover { background: #f7f7f7; color: #222; }

/* Layout */
.main { padding: 28px 20px 48px; min-height: 60vh; }
.layout-two-col { display: grid; grid-template-columns: 1fr 320px; gap: 32px; margin-top: 24px; }
.col-side { display: flex; flex-direction: column; gap: 20px; }

/* Hero / headings */
.home-hero { text-align: left; padding: 12px 0; }
.home-hero h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -.5px; }
.lead { color: var(--muted); font-size: 17px; margin: 0; }
.section-title { font-size: 20px; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--brand); }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; }

/* Breadcrumb */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 13px; color: var(--muted); margin: 4px 0 18px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.breadcrumb a { color: var(--brand); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .bc-sep { color: #b6bcc6; }
.breadcrumb .bc-current { font-weight: 600; color: var(--ink); }


/* Cards */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 16px; overflow: hidden;
}
.card-body { padding: 18px 20px; }
.card h2 { font-size: 20px; margin: 8px 0 8px; }
.card h3 { font-size: 17px; margin: 6px 0 6px; }
.card p { margin: 6px 0; }

.featured-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 8px; }
.featured-card { margin: 0; }
.featured-first { grid-column: span 2; }

/* Thumbnails */
.thumb-link { display: block; overflow: hidden; background: #eef2f7; }
.thumb {
    display: block; width: 100%; object-fit: cover;
    transition: transform .4s ease;
}
.thumb-link:hover .thumb { transform: scale(1.03); }
.thumb-featured { height: 240px; }
.featured-first .thumb-featured { height: 340px; }
.thumb-list { height: 170px; }
.thumb-list-link { flex-shrink: 0; }
.list-card { display: flex; }
.list-card .card-body { flex: 1; }
@media (max-width: 640px) {
    .list-card { flex-direction: column; }
    .thumb-list { height: 200px; }
    .thumb-featured, .featured-first .thumb-featured { height: 220px; }
}

.list-card h3 a { color: var(--ink); }
.list-card h3 a:hover { color: var(--brand); }

.tag {
    display: inline-block; background: #eef2ff; color: var(--brand);
    font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: .4px;
}
.tag:hover { background: #e0e7ff; text-decoration: none; }

.meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.summary { color: var(--muted); }

/* Aside */
.category-list, .popular-list { list-style: none; padding: 0; margin: 0; }
.category-list li { border-bottom: 1px solid var(--line); }
.category-list a { display: flex; justify-content: space-between; padding: 10px 0; color: var(--ink); }
.category-list a:hover { color: var(--brand); text-decoration: none; }
.count { color: var(--muted); font-weight: 600; font-size: 13px; }
.popular-list { counter-reset: pop; list-style: none; padding: 0; margin: 0; }
.popular-list li { counter-increment: pop; padding: 8px 0 8px 8px; border-bottom: 1px solid var(--line); }
.popular-list li::before { content: counter(pop); font-weight: 800; color: var(--brand); margin-right: 8px; }
.popular-list a { color: var(--ink); }
.popular-list a:hover { color: var(--brand); }

/* Article */
.article-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 20px; }
.article-head h1 { font-size: 32px; line-height: 1.25; margin: 12px 0 10px; letter-spacing: -.4px; }
.article-body { font-size: 17px; }
.article-body p { margin: 0 0 18px; }

/* Article in-body image & figure layout */
.article-hero { margin: 0 0 26px; border-radius: 12px; overflow: hidden; background: #eef2f7; }
.article-hero img { display: block; width: 100%; height: auto; max-height: 480px; object-fit: cover; }
.article-body img { max-width: 100%; height: auto; border-radius: 10px; }
.article-body figure { margin: 26px 0; text-align: center; }
.article-body figure img { width: 100%; display: block; border-radius: 10px; box-shadow: var(--shadow); }
.article-body figure figcaption {
    margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.4;
}
.article-body .figure-left { float: left; margin: 8px 22px 12px 0; max-width: 45%; }
.article-body .figure-right { float: right; margin: 8px 0 12px 22px; max-width: 45%; }
.article-body blockquote {
    border-left: 4px solid var(--brand); margin: 24px 0; padding: 10px 20px;
    background: #f3f6ff; color: #374151; font-style: italic; border-radius: 0 8px 8px 0;
}
.article-body h2, .article-body h3 { margin: 28px 0 12px; }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 640px) {
    .article-body .figure-left, .article-body .figure-right { float: none; max-width: 100%; margin: 20px 0; }
}

/* Comments */
.comments { margin-top: 40px; }
.comment-form textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line);
    border-radius: 8px; font-family: inherit; font-size: 15px; resize: vertical;
}
.comment-form .btn { margin-top: 10px; }
.comment-as { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.comment-login-prompt { background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: 20px; }
.comment-login-prompt p { margin: 0; }
.comment-login-prompt .btn { margin: 12px 0 0; }
.comment-list { margin-top: 24px; }
.comment { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author { font-weight: 600; font-size: 14px; }
.comment-date { color: var(--muted); font-size: 12px; }
.comment-delete { margin-left: auto; color: var(--danger); font-size: 12px; }
.comment-body { font-size: 15px; color: var(--ink); white-space: pre-wrap; }

/* Comment foot: votes + reply */
.comment-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.vote-group { display: inline-flex; align-items: center; gap: 4px; }
.vote-btn {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
    border: 1px solid var(--line); background: #fff; border-radius: 16px;
    font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s;
}
.vote-btn:hover { border-color: var(--brand); color: var(--brand); background: #f3f6ff; }
.vote-btn.active.vote-up { background: #e8f0ff; border-color: var(--brand); color: var(--brand); }
.vote-btn.active.vote-down { background: #fee; border-color: #f5a3a3; color: var(--danger); }
.vote-count.up { min-width: 14px; }
.vote-count.down { min-width: 14px; }
.reply-btn {
    background: none; border: none; color: var(--brand); font-weight: 600;
    font-size: 13px; cursor: pointer; padding: 4px 6px;
}
.reply-btn:hover { text-decoration: underline; }

/* Nested replies */
.comment-replies { margin: 12px 0 0 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.comment-replies .comment { background: #fbfcfe; }

/* Inline reply form */
.reply-form-wrap { margin: 10px 0 0 8px; }
.reply-form {
    background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.reply-form textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-family: inherit; font-size: 14px; resize: vertical;
}
.reply-form .reply-actions { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.reply-cancel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.reply-cancel:hover { color: var(--ink); }
.reply-form .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.flash-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: var(--brand); border: 1px solid #bfdbfe; }

/* Auth */
.auth-page { display: flex; justify-content: center; padding-top: 40px; }
.auth-card { max-width: 460px; width: 100%; text-align: center; }
.auth-card h1 { font-size: 24px; margin: 0 0 8px; }
.auth-note { font-size: 13px; color: var(--muted); }
.hp-field { position: absolute; left: -9999px; }

/* Auth form */
.auth-form { text-align: left; margin: 18px 0 10px; }
.auth-form .form-field { margin-bottom: 14px; }
.auth-form .form-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--ink); }
.auth-form .form-field input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-family: inherit; font-size: 15px;
}
.auth-form .form-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(26,86,219,.15); }
.auth-form .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 24px 0; text-align: center; color: var(--muted); font-size: 14px; }
.site-footer p { margin: 4px 0; }

/* Related */
.related { margin-top: 48px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Responsive */
@media (max-width: 820px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 12px; }
    .main-nav { order: 3; width: 100%; }
    .layout-two-col { grid-template-columns: 1fr; }
    .featured-grid { grid-template-columns: 1fr; }
    .featured-first { grid-column: span 1; }
    .related-grid { grid-template-columns: 1fr 1fr; }
}
