/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f8f9fa;
}
a { color: #1a56db; text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin-bottom: 1rem; }
h1, h2, h3 { line-height: 1.3; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }

/* === Header === */
.site-header {
    background: #0f172a;
    color: white;
    padding: 0 1.5rem;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}
.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}
.logo:hover { text-decoration: none; color: #93c5fd; }
.nav-links a {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-left: 1.5rem;
}
.nav-links a:hover { color: white; text-decoration: none; }

/* === Content area === */
.content { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.site-footer {
    text-align: center;
    padding: 2rem 1.5rem 3rem;
    color: #64748b;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8f0;
}
.footer-links { margin-top: 0.5rem; }
.footer-links a { color: #64748b; }

/* === Hero === */
.hero { text-align: center; padding: 2rem 0 2.5rem; }
.hero h1 { font-size: 2.5rem; color: #0f172a; letter-spacing: -0.8px; margin-bottom: 0.5rem; }
.hero-subtitle { color: #64748b; font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* === Topic Grid (Homepage) === */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}
.topic-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.15s, border-color 0.15s;
    color: inherit;
}
.topic-card:hover {
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    border-color: #cbd5e1;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.category-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}
.card-stale { font-size: 0.8rem; color: #64748b; display: flex; align-items: center; gap: 4px; }
.card-title { font-size: 1.15rem; color: #0f172a; margin-bottom: 0.5rem; }
.card-excerpt { font-size: 0.9rem; color: #475569; line-height: 1.5; margin: 0; }

/* === Staleness dots === */
.stale-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stale-green .stale-dot, .stale-dot.stale-green { background: #10b981; }
.stale-yellow .stale-dot, .stale-dot.stale-yellow { background: #f59e0b; }
.stale-red .stale-dot, .stale-dot.stale-red { background: #ef4444; }

/* === Staleness bar (topic detail) === */
.staleness-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    color: white;
    font-weight: 500;
}
.staleness-bar.stale-green { background: #10b981; }
.staleness-bar.stale-yellow { background: #d97706; }
.staleness-bar.stale-red { background: #dc2626; }
.staleness-bar .stale-dot { width: 10px; height: 10px; background: white; }

/* === Archive banner === */
.archive-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* === Detail page columns === */
.topic-title { font-size: 2rem; color: #0f172a; margin-bottom: 0.75rem; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2.5rem; }
.col-narrative, .col-reality {
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.col-narrative { background: #f8fafc; border-color: #e2e8f0; }
.col-narrative h2 { color: #64748b; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.col-reality { background: white; border-color: #10b981; box-shadow: 0 0 0 1px #10b981; }
.col-reality h2 { color: #059669; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }

/* === Evidence section === */
.evidence-section { margin-bottom: 2rem; }
.evidence-section h2 { font-size: 1.3rem; margin-bottom: 1rem; color: #0f172a; }
.evidence-list { list-style-position: inside; padding: 0; }
.evidence-list li { margin-bottom: 0.75rem; }
.evidence-list li::marker { font-weight: 700; color: #64748b; }
.evidence-item { display: inline; }
.evidence-item a { font-weight: 500; }
.evidence-desc { font-size: 0.85rem; color: #64748b; margin: 0.25rem 0 0 0; }

/* === Source badges === */
.source-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}
.badge-paper { background: #dbeafe; color: #1e40af; }
.badge-report { background: #e0e7ff; color: #4338ca; }
.badge-regulatory { background: #fef3c7; color: #92400e; }
.badge-benchmark { background: #d1fae5; color: #065f46; }
.badge-company_filing { background: #e5e7eb; color: #374151; }
.badge-dataset { background: #fce7f3; color: #9d174d; }
.badge-other { background: #f1f5f9; color: #475569; }

/* === History page === */
.history-page { max-width: 780px; }
.back-link { margin-bottom: 1rem; }
.history-page h1 { margin-bottom: 1.5rem; }
.history-timeline { border-left: 2px solid #e2e8f0; padding-left: 1.5rem; }
.timeline-entry { margin-bottom: 2rem; position: relative; }
.timeline-entry::before {
    content: "";
    position: absolute;
    width: 10px; height: 10px;
    background: #1a56db;
    border-radius: 50%;
    left: -1.6rem;
    top: 0.4rem;
}
.timeline-date strong { font-size: 1rem; }
.timeline-relative { font-size: 0.8rem; color: #64748b; margin-left: 8px; }
.timeline-by { font-size: 0.85rem; color: #64748b; margin: 2px 0 6px; }
.timeline-change-note {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.timeline-snapshot { margin-top: 0.5rem; }
.timeline-snapshot summary {
    font-size: 0.85rem;
    color: #1a56db;
    cursor: pointer;
}
.snapshot-content {
    margin-top: 0.5rem;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 0.85rem;
}
.snapshot-content h4 { font-size: 0.8rem; color: #64748b; text-transform: uppercase; margin-bottom: 4px; }

/* === History link footer === */
.history-link {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

/* === About page === */
.about-page { max-width: 720px; }
.about-page h1 { margin-bottom: 1.5rem; }
.about-page section { margin-bottom: 2rem; }
.about-page h2 { font-size: 1.2rem; color: #0f172a; margin-bottom: 0.5rem; }

/* === Admin page === */
.admin-page h1 { margin-bottom: 0.25rem; }
.admin-subtitle { color: #64748b; font-size: 0.9rem; margin-bottom: 1.5rem; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.9rem;
}
.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
}
.admin-table td { border-bottom: 1px solid #f1f5f9; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafbfc; }
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.status-0 { background: #fef3c7; color: #92400e; }
.status-1 { background: #d1fae5; color: #065f46; }
.status-2 { background: #e5e7eb; color: #374151; }

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}

/* === Suggest page (form) === */
.suggest-page { max-width: 680px; margin: 0 auto; }

.suggest-hero {
    text-align: center;
    padding: 1.5rem 0 2.5rem;
}
.suggest-hero h1 {
    font-size: 2rem;
    color: #0f172a;
    letter-spacing: -0.6px;
    margin-bottom: 0.6rem;
}
.suggest-hero-text {
    color: #64748b;
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Card container for the form */
.suggest-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.suggest-card-section { padding: 1.75rem; }
.suggest-card-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0 1.75rem;
}

/* Form layout */
.suggest-form .form-group { margin-bottom: 1.25rem; }
.suggest-form .form-group:last-child { margin-bottom: 0; }

.form-row-cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-row-cols-2 .form-group { margin-bottom: 0; }

.suggest-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.4rem;
    letter-spacing: -0.2px;
}
.label-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.8rem;
    letter-spacing: 0;
}

.form-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    color: #1a1a2e;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.form-input::placeholder { color: #adb5bd; }
.form-textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.form-select { appearance: auto; }

.field-hint { display: block; font-size: 0.8rem; color: #64748b; margin-top: 4px; }
.field-error { display: block; font-size: 0.8rem; color: #dc2626; margin-top: 4px; }

/* Honeypot — invisible to visual users */
.honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}
.honeypot label, .honeypot input { display: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.925rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    line-height: 1.4;
}
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-primary { background: #1a56db; color: white; }
.btn-primary:hover { background: #1e40af; text-decoration: none; }
.btn-secondary { background: #e2e8f0; color: #1a1a2e; }
.btn-secondary:hover { background: #cbd5e1; text-decoration: none; }
.btn-outline { background: transparent; color: #1a56db; border: 1px solid #1a56db; }
.btn-outline:hover { background: #eff6ff; text-decoration: none; }

/* Submit area */
.suggest-actions {
    text-align: center;
    padding: 1.75rem 0 0;
}
.suggest-note {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0.75rem 0 0;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* Confirmation */
.confirmation-box { text-align: center; padding: 3rem 0; }
.confirmation-box h1 { margin-bottom: 1rem; }
.confirmation-box p { color: #475569; max-width: 500px; margin: 0 auto 1rem; }
.confirmation-links { margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: center; }

/* Admin alert */
.admin-alert {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 700px) {
    .topic-grid { grid-template-columns: 1fr; }
    .columns { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.8rem; }
    .topic-title { font-size: 1.5rem; }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
}
