/* -----------------------------------------------
   Variables
----------------------------------------------- */
:root {
    --bg: #f7f7f5;
    --bg-card: #ffffff;
    --text: #1a1a18;
    --text-muted: #6b6b67;
    --border: #e4e4e0;
    --border-hover: #c8c8c2;
    --blue: #185FA5;
    --blue-light: #E6F1FB;
    --teal: #0F6E56;
    --teal-light: #E1F5EE;
    --red: #A32D2D;
    --red-light: #FCEBEB;
    --amber: #854F0B;
    --amber-light: #FAEEDA;
    --radius: 8px;
    --radius-lg: 12px;
}

/* -----------------------------------------------
   Reset & base
----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* -----------------------------------------------
   Nav
----------------------------------------------- */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 0.5px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.15s;
}

.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); font-weight: 500; }

/* -----------------------------------------------
   Hero
----------------------------------------------- */
.hero {
    text-align: center;
    padding: 4rem 2rem 2.5rem;
}

.hero-eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.hero-title {
    font-size: 32px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.hero-sub {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* -----------------------------------------------
   Cards grid (accueil)
----------------------------------------------- */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    cursor: pointer;
    transition: border-color 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card:hover { border-color: var(--border-hover); }

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card-icon-blue { background: var(--blue-light); color: var(--blue); }
.card-icon-teal { background: var(--teal-light); color: var(--teal); }

.card-title {
    font-size: 17px;
    font-weight: 500;
    color: var(--text);
}

.card-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 0.5px solid var(--border);
    color: var(--text-muted);
}

.card-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-top: auto;
}

.cta-blue { color: var(--blue); }
.cta-teal { color: var(--teal); }

/* -----------------------------------------------
   Stats bar (accueil)
----------------------------------------------- */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem 2rem 3rem;
    border-top: 0.5px solid var(--border);
    max-width: 900px;
    margin: 0 auto;
}

.stat { text-align: center; }

.stat-num {
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* -----------------------------------------------
   Page header (observatoire, simulateur)
----------------------------------------------- */
.page-header {
    padding: 2.5rem 2rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.page-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.page-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* -----------------------------------------------
   Themes grid (observatoire)
----------------------------------------------- */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 0 2rem 2.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.theme-card {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s;
    display: block;
}

.theme-card:hover { border-color: var(--border-hover); }

.theme-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 0.75rem;
}

.theme-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.theme-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* -----------------------------------------------
   Normes list (page thème)
----------------------------------------------- */
.normes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.normes-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.normes-count {
    font-size: 13px;
    color: var(--text-muted);
}

.normes-list {
    padding: 0 2rem 3rem;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.norme-row {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
    text-decoration: none;
    color: inherit;
}

.norme-row:hover { border-color: var(--border-hover); }

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: 500;
}

.badge-high { background: var(--red-light); color: var(--red); }
.badge-med { background: var(--amber-light); color: var(--amber); }
.badge-low { background: var(--teal-light); color: var(--teal); }

.norme-name {
    font-size: 14px;
    color: var(--text);
    flex: 1;
}

.norme-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.norme-meta-item {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.norme-arrow {
    font-size: 14px;
    color: var(--text-muted);
}

/* -----------------------------------------------
   Fiche norme détail
----------------------------------------------- */
.fiche-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fiche-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fiche-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.fiche-breadcrumb a:hover { color: var(--text); }

.fiche-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
}

.fiche-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.fiche-section {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fiche-section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.fiche-section-body {
    font-size: 14px;
    color: var(--text);
    line-height: 1.7;
}

.fiche-costs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cost-item {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cost-label {
    font-size: 12px;
    color: var(--text-muted);
}

.cost-value {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
}

/* -----------------------------------------------
   Simulateur
----------------------------------------------- */
.simulateur-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}

.simulateur-form {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.sim-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sim-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sim-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sim-group input,
.sim-group select {
    padding: 9px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.sim-group input:focus,
.sim-group select:focus { border-color: var(--blue); background: var(--bg-card); }

.sim-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sim-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.sim-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sim-submit:hover { opacity: 0.9; }

/* -----------------------------------------------
   Résultats simulateur
----------------------------------------------- */
.sim-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sim-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.sim-results-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.sim-share {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--blue);
    cursor: pointer;
    background: var(--blue-light);
    border: none;
    border-radius: var(--radius);
    padding: 6px 12px;
    transition: opacity 0.15s;
}

.sim-share:hover { opacity: 0.8; }

/* -----------------------------------------------
   Search bar
----------------------------------------------- */
.search-wrap {
    position: relative;
    flex: 1;
}

.search-wrap i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.search-wrap input:focus { border-color: var(--blue); }

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* -----------------------------------------------
   Footer
----------------------------------------------- */
.footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 0.5px solid var(--border);
}

.footer a:hover { color: var(--text); }

/* -----------------------------------------------
   404
----------------------------------------------- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 1rem;
    text-align: center;
}

.error-page h1 {
    font-size: 72px;
    font-weight: 500;
    color: var(--border);
}

.error-page p { color: var(--text-muted); }

.error-page a {
    font-size: 13px;
    color: var(--blue);
    border: 0.5px solid var(--blue-light);
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--blue-light);
    transition: opacity 0.15s;
}

.error-page a:hover { opacity: 0.8; }

/* -----------------------------------------------
   Responsive
----------------------------------------------- */
@media (max-width: 768px) {
    .cards-grid { grid-template-columns: 1fr; padding: 1rem; }
    .themes-grid { grid-template-columns: repeat(2, 1fr); padding: 0 1rem 2rem; }
    .stats-bar { gap: 1.5rem; flex-wrap: wrap; }
    .nav { padding: 1rem; }
    .hero { padding: 2rem 1rem 1.5rem; }
    .hero-title { font-size: 24px; }
    .page-header { padding: 1.5rem 1rem 1rem; }
    .normes-list, .normes-header { padding-left: 1rem; padding-right: 1rem; }
    .fiche-wrap { padding: 1rem; }
    .simulateur-wrap { padding: 0 1rem 2rem; }
    .sim-row { grid-template-columns: 1fr; }
    .fiche-costs { grid-template-columns: 1fr; }
}