/* PlanetPhD design system — token names carried over from the legacy styles.css. */
:root {
    --primary: #4338ca;
    --primary-dark: #312e81;
    --primary-light: #e0e7ff;
    --accent: #059669;
    --text: #1f2937;
    --text-muted: #6b7280;
    --bg: #ffffff;
    --bg-alt: #f9fafb;
    --border: #e5e7eb;
    --danger: #dc2626;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .05);
    --font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
img { max-width: 100%; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--text-muted); }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.nav { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.25rem; }
.brand { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.brand span { color: var(--primary); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
/* :not(.btn) — this rule is more specific than .btn-primary and would otherwise
   repaint the "Get alerts" button's label dark on its dark background. */
.nav-links a:not(.btn) { color: var(--text); font-weight: 500; }

/* Buttons & forms */
.btn { display: inline-block; padding: .6rem 1.2rem; border-radius: var(--radius); border: 1px solid transparent;
       font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .8rem; font-size: .9rem; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius);
                          font: inherit; background: var(--bg); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }
.form-row { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; padding: 4rem 0 3.5rem; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 .75rem; }
.hero p { font-size: 1.15rem; color: var(--primary-light); max-width: 46rem; margin: 0 0 1.5rem; }
.hero .subscribe-inline { display: flex; gap: .6rem; max-width: 30rem; flex-wrap: wrap; }
.hero .subscribe-inline input { flex: 1 1 14rem; border: 0; }
.hero .subscribe-inline .btn { background: var(--accent); color: #fff; }

/* Sections & cards */
.section { padding: 2.5rem 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem;
        box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .4rem; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card .meta { font-size: .88rem; color: var(--text-muted); }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.badge-funding { background: var(--primary-light); color: var(--primary-dark); }
.badge-job { background: #d1fae5; color: #065f46; }
.badge-deadline { background: #fee2e2; color: #991b1b; }
.badge-award { background: #ede9fe; color: #5b21b6; }
.badge-featured { background: #fef3c7; color: #92400e; }
.badge-tag { background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }
a.badge-tag:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .2rem 0 0; }

/* Detail page */
.detail-header { padding: 2.2rem 0 1.2rem; }
.detail-header h1 { margin: .4rem 0; }
.detail-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem;
                background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.detail-facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.detail-facts dd { margin: 0; font-weight: 600; }
.prose { max-width: 46rem; white-space: pre-line; }

/* Tables (admin, deadlines) */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); }
table.data th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }

/* Breadcrumbs */
.breadcrumbs { padding-top: 1.2rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0;
                  font-size: .88rem; color: var(--text-muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span[aria-current] { color: var(--text); font-weight: 500; }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin: 1rem 0; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Pagination */
.pager { display: flex; gap: .8rem; margin: 1.5rem 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.6rem 0; background: var(--bg-alt); }
.footer-inner p { margin: .3rem 0; }

@media (max-width: 640px) {
    .nav { flex-direction: column; gap: .6rem; }
}
