/* FrontierAlpha — Financial Times inspired design */

:root {
    --ft-bg: #FFF1E5;
    --ft-paper: #FFFFFF;
    --ft-ink: #33302E;
    --ft-ink-light: #66605C;
    --ft-ink-muted: #9E9893;
    --ft-accent: #0D7680;
    --ft-accent-dark: #095A62;
    --ft-claret: #9E2F50;
    --ft-oxford: #0F5499;
    --ft-slate: #262A33;
    --ft-wheat: #F2DFCE;
    --ft-line: #E6D9CE;
    --ft-line-light: #F0E4DA;
    --ft-positive: #09854C;
    --ft-negative: #CC0000;
    --ft-tag-emerging: #E8F5E9;
    --ft-tag-emerging-text: #1B5E20;
    --ft-tag-breakout: #E3F2FD;
    --ft-tag-breakout-text: #0D47A1;
    --ft-tag-declining: #FFEBEE;
    --ft-tag-declining-text: #B71C1C;
    --ft-tag-experimental: #FFF8E1;
    --ft-tag-experimental-text: #F57F17;
    --ft-serif: Georgia, 'Times New Roman', serif;
    --ft-sans: 'MetricWeb', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--ft-bg);
    color: var(--ft-ink);
    font-family: var(--ft-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Masthead ────────────────────────────────────────────────────────────── */

.masthead {
    background: var(--ft-slate);
    border-bottom: 4px solid var(--ft-accent);
    padding: 0;
}

.masthead-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.masthead h1 {
    font-family: var(--ft-serif);
    font-size: 24px;
    font-weight: 700;
    color: #FFF;
    letter-spacing: -0.5px;
}

.masthead h1 span {
    color: var(--ft-accent);
    font-weight: 400;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */

.nav {
    background: var(--ft-paper);
    border-bottom: 1px solid var(--ft-line);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 0;
}

.nav a {
    display: block;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ft-ink-light);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.15s;
}

.nav a:hover {
    color: var(--ft-ink);
    background: var(--ft-bg);
}

.nav a.active {
    color: var(--ft-ink);
    border-bottom-color: var(--ft-accent);
}

.nav-sep {
    width: 1px;
    background: var(--ft-line);
    margin: 8px 4px;
}

.nav-audience {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav a.nav-audience.active {
    border-bottom-color: var(--ft-claret);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-title {
    font-family: var(--ft-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--ft-ink);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--ft-ink-muted);
    margin-bottom: 24px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--ft-paper);
    border: 1px solid var(--ft-line);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card-title {
    font-family: var(--ft-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--ft-ink);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ft-line-light);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

/* ── Stat pills ──────────────────────────────────────────────────────────── */

.stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.stat {
    background: var(--ft-paper);
    border: 1px solid var(--ft-line);
    padding: 12px 20px;
    min-width: 100px;
    text-align: center;
}

.stat-value {
    font-family: var(--ft-serif);
    font-size: 28px;
    font-weight: 700;
    color: var(--ft-ink);
    line-height: 1.1;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ft-ink-muted);
    margin-top: 2px;
}

/* ── Filters ─────────────────────────────────────────────────────────────── */

.filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--ft-paper);
    border: 1px solid var(--ft-line);
}

.filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ft-ink-muted);
    margin-bottom: 4px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 6px 10px;
    border: 1px solid var(--ft-line);
    background: var(--ft-bg);
    color: var(--ft-ink);
    font-size: 13px;
    font-family: var(--ft-sans);
    outline: none;
    min-width: 140px;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--ft-accent);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ft-ink-muted);
    border-bottom: 2px solid var(--ft-ink);
    white-space: nowrap;
}

tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--ft-line-light);
    color: var(--ft-ink);
    vertical-align: top;
}

tbody tr:hover {
    background: var(--ft-bg);
}

td a {
    color: var(--ft-accent);
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Charts ──────────────────────────────────────────────────────────────── */

.chart-container {
    position: relative;
    height: 360px;
    width: 100%;
}

/* ── Tags / Badges ───────────────────────────────────────────────────────── */

.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 2px;
}

.tag-emerging     { background: var(--ft-tag-emerging); color: var(--ft-tag-emerging-text); }
.tag-breakout     { background: var(--ft-tag-breakout); color: var(--ft-tag-breakout-text); }
.tag-established  { background: var(--ft-wheat); color: var(--ft-ink-light); }
.tag-declining    { background: var(--ft-tag-declining); color: var(--ft-tag-declining-text); }
.tag-stable       { background: #F5F5F5; color: #666; }

.positive { color: var(--ft-positive); }
.negative { color: var(--ft-negative); }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.text-muted { color: var(--ft-ink-muted); }
.text-small { font-size: 12px; }
.text-serif { font-family: var(--ft-serif); }
.mt-0 { margin-top: 0; }
.mb-16 { margin-bottom: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 4px;
    font-size: 13px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--ft-line);
    color: var(--ft-accent);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--ft-bg);
}

.pagination .current {
    background: var(--ft-slate);
    color: #FFF;
    border-color: var(--ft-slate);
}

/* ── Sortable columns ────────────────────────────────────────────────────── */

th.sortable:hover {
    color: var(--ft-ink);
    background: var(--ft-bg);
}

th.sort-asc::after { content: ' \25B2'; font-size: 9px; }
th.sort-desc::after { content: ' \25BC'; font-size: 9px; }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--ft-ink-muted);
    font-size: 14px;
}

/* ── Audience badge pills ────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-frontier  { background: #E8EAF6; color: #283593; }
.badge-big-tech  { background: #E3F2FD; color: #0D47A1; }
.badge-scaleup   { background: #E8F5E9; color: #1B5E20; }
.badge-startup   { background: #FFF8E1; color: #F57F17; }
.badge-robotics  { background: #FCE4EC; color: #880E4F; }
.badge-other     { background: #F5F5F5; color: #666; }

.badge-early-signal  { background: #E8F5E9; color: #1B5E20; }
.badge-mainstream    { background: #E3F2FD; color: #0D47A1; }
.badge-commoditised  { background: var(--ft-wheat); color: var(--ft-ink-light); }
.badge-niche         { background: #F5F5F5; color: #666; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: var(--ft-ink-muted);
    border-top: 1px solid var(--ft-line);
    margin-top: 40px;
}
