/* ===========================
   Terres & Fondues — Design System
   Apple Card aesthetic · Inter 300–700
   Single source of truth for all pages
   =========================== */

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* TOKENS */
:root {
    --white: #ffffff;
    --bg: #f5f5f7;
    --bg-alt: #f5f5f7;
    --card: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --border: #e5e5ea;
    --accent: #0071e3;
    --accent-hover: #0077ed;

    /* Verdict palette */
    --green: #34c759;
    --green-bg: #e8f5e9;
    --red: #ff3b30;
    --red-bg: #fce4ec;
    --orange: #ff9500;
    --orange-bg: #fff3e0;
    --blue: #007aff;
    --blue-bg: #e3f2fd;
    --purple: #af52de;
    --purple-bg: #f3e5f5;

    /* Pastel category backgrounds */
    --pastel-1: #e8f5e9;
    --pastel-2: #fce4ec;
    --pastel-3: #e3f2fd;
    --pastel-4: #fff3e0;
    --pastel-5: #f3e5f5;
    --pastel-6: #fce4ec;
    --pastel-7: #e0f2f1;
    --pastel-8: #fff8e1;

    /* Hero gradient (Apple Card-inspired: lavender → peach → gold → mint) */
    --gradient-card: linear-gradient(135deg, #d4c5f9 0%, #f5c6aa 30%, #fceabb 60%, #b8e6c8 100%);

    /* Elevation */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 2px 20px rgba(0,0,0,0.04), 0 0 1px rgba(0,0,0,0.06);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06);
    --shadow-card: 0 4px 24px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.04);

    /* Corners */
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-pill: 100px;
}

/* BODY */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* CONTAINER */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===========================
   NAVIGATION
   =========================== */
.primary-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(245,245,247,0.85);
    position: sticky;
    top: 0;
    z-index: 100;
}
.primary-nav .brand {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
}
.primary-nav .nav-links {
    display: flex;
    gap: 0.35rem;
    list-style: none;
}
.primary-nav .nav-links a {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-pill);
    transition: all 0.2s;
}
.primary-nav .nav-links a:hover {
    color: var(--text);
    background: rgba(0,0,0,0.04);
}
.primary-nav .nav-links a.active {
    color: var(--white);
    background: var(--text);
    font-weight: 500;
}

/* ===========================
   HERO
   =========================== */
.hero {
    padding: 3rem 0 2.5rem;
    text-align: center;
}
.hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}
.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}
.hero .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

/* ===========================
   SCORECARD (index, resultats)
   =========================== */
.scorecard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.scorecard-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.scorecard-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.scorecard-item .label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.65rem;
}
.scorecard-item .verdict {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill);
    display: inline-block;
}

/* VERDICT COLORS */
.verdict-confirmed { background: var(--green-bg); color: var(--green); }
.verdict-partial { background: var(--orange-bg); color: var(--orange); }
.verdict-contradicted { background: var(--red-bg); color: var(--red); }
.verdict-unverifiable { background: var(--bg-alt); color: var(--text-secondary); }
.verdict-pending { background: var(--bg-alt); color: var(--text-secondary); }

/* ===========================
   KPI GRID (resultats, projection)
   =========================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.kpi-card {
    padding: 1.5rem;
    border-radius: var(--radius);
    background: var(--card);
    text-align: center;
    box-shadow: var(--shadow);
}
.kpi-card .kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.kpi-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-top: 0.25rem;
}
.kpi-card .kpi-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.kpi-positive { color: var(--green); }
.kpi-negative { color: var(--red); }
.kpi-neutral { color: var(--text); }

/* ===========================
   SECTIONS (methodologie, resultats, projection)
   =========================== */
.section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 1.25rem;
}
.section:last-of-type { margin-bottom: 2rem; }
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.section-number {
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--text);
    color: white;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.section-verdict {
    margin-left: auto;
}

/* ===========================
   TUFTE TABLES (base)
   =========================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 1.5px solid var(--text);
}
tbody td {
    padding: 0.6rem 1rem;
    border-bottom: 0.5px solid var(--border);
    vertical-align: top;
}
tbody td:first-child {
    font-weight: 500;
    color: var(--text);
}

/* ===========================
   CONFIDENCE DOTS
   =========================== */
.confidence {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.dot-filled { background: var(--text); }
.dot-empty { background: var(--border); }

/* ===========================
   VERDICT TAGS (inline)
   =========================== */
.tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    display: inline-block;
}
.tag-confirmed { background: var(--green-bg); color: var(--green); }
.tag-partial { background: var(--orange-bg); color: var(--orange); }
.tag-contradicted { background: var(--red-bg); color: var(--red); }
.tag-unverifiable { background: var(--bg-alt); color: var(--text-secondary); border: 1px solid var(--border); }
.tag-pending { background: var(--bg-alt); color: var(--text-secondary); border: 1px solid var(--border); }

/* ===========================
   FOOTER
   =========================== */
footer {
    text-align: center;
    padding: 2.5rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===========================
   PRINT
   =========================== */
@media print {
    .primary-nav { display: none; }
    body { font-size: 11px; background: white; }
    .hero { padding: 1rem 0; }
    .hero h1 { font-size: 24px; }
    .section { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
    .scorecard-item, .kpi-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .primary-nav { flex-direction: column; gap: 0.5rem; padding: 0.75rem 1rem; }
    .primary-nav .nav-links { gap: 0.25rem; flex-wrap: wrap; justify-content: center; }
    .container { padding: 0 1rem; }
    .hero h1 { font-size: 2rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .scorecard { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 1.5rem; }
    .section-header { flex-wrap: wrap; }
    .section-verdict { margin-left: 0; margin-top: 0.5rem; }
}
