/* ==========================================================================
   ia-competences.fr — « carnet de progression »
   Identite : papier + encre, accent vert sapin, titres en serif.
   Rien a voir avec les autres sites du parc (pas de dark tech, pas de laiton).
   Themes clair ET sombre via prefers-color-scheme. Contrastes verifies >= 4.5:1.
   ========================================================================== */

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

:root {
  /* --- theme clair (defaut) --- */
  --bg:            #f8f7f4;
  --surface:       #ffffff;
  --surface-2:     #f1efe9;
  --border:        #ddd9cf;
  --border-strong: #c4bfb2;
  --text:          #1b1d1c;   /* 15.8:1 sur --bg */
  --muted:         #545e58;   /* 6.3:1  sur --bg */
  --accent:        #0f5c47;   /* 7.4:1  sur --bg */
  --accent-strong: #0a4335;
  --accent-ink:    #ffffff;
  --accent-soft:   #e7f0eb;
  --ochre:         #8a4b12;   /* 6.4:1  sur --bg — pieges */
  --ochre-soft:    #f6eee4;
  --danger:        #96271f;   /* 7.5:1  sur --bg */
  --danger-soft:   #f8eae8;
  --shadow:        0 1px 2px rgba(27,29,28,.06), 0 6px 20px rgba(27,29,28,.05);
  --shadow-sm:     0 1px 2px rgba(27,29,28,.08);

  --font:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --serif:  'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --max-w: 1120px;
  --radius: 10px;
  --radius-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #15181a;
    --surface:       #1c2023;
    --surface-2:     #23282b;
    --border:        #343b3e;
    --border-strong: #4a5357;
    --text:          #e9e7e2;   /* 14.4:1 sur --bg */
    --muted:         #a8b1ac;   /* 8.1:1  sur --bg */
    --accent:        #6ecfae;   /* 9.5:1  sur --bg */
    --accent-strong: #8fe0c3;
    --accent-ink:    #0b2a22;
    --accent-soft:   #1a2f29;
    --ochre:         #e0a45f;   /* 8.2:1  sur --bg */
    --ochre-soft:    #2b241a;
    --danger:        #f08d84;   /* 7.5:1  sur --bg */
    --danger-soft:   #2c1c1a;
    --shadow:        0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.30);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  }
}

html { font-size: 16px; scroll-behavior: smooth; }
/* en-tete collant : sinon une ancre place le titre sous le bandeau */
[id] { scroll-margin-top: 88px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; color: var(--text); font-weight: 600; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; font-family: var(--font); font-weight: 700; }
p + p, p + ul, p + ol, ul + p, ol + p { margin-top: .9rem; }
ul, ol { padding-left: 1.15rem; }
li + li { margin-top: .35rem; }
strong { font-weight: 650; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9em;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .08em .35em; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 780px; }

/* ---------- en-tete ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 66px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--serif); font-weight: 700; font-size: 1rem;
}
.logo-text { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; line-height: 1.15; }
.logo-text small { display: block; font-family: var(--font); font-size: .72rem; font-weight: 500;
  color: var(--muted); letter-spacing: .02em; }
.site-nav { margin-left: auto; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: .92rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

/* ---------- fil d'ariane ---------- */
.breadcrumb { font-size: .85rem; color: var(--muted); padding: 1rem 0 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .35rem; }

/* ---------- heros ---------- */
.hero { padding: 3.2rem 0 2.4rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.hero-inner { max-width: 820px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 1.12rem; color: var(--muted); margin-top: 1rem; }
.page-hero { padding: 1.6rem 0 2rem; }
.eyebrow {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--border); border-radius: 99px; padding: .28rem .7rem; margin-bottom: .9rem;
}

/* ---------- sections ---------- */
.section { padding: 2.6rem 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: 0; }
.section > h2 { margin-bottom: .4rem; }
.section-intro { color: var(--muted); margin-bottom: 1.4rem; max-width: 70ch; }

/* ---------- cartes / grilles ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm);
}
a.card { display: block; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
a.card h3 { font-size: 1.05rem; }
.card-go { display: inline-block; margin-top: .7rem; font-size: .85rem; font-weight: 600; color: var(--accent); }
a.card:hover .card-go { text-decoration: underline; }
.card--soon { background: transparent; border-style: dashed; box-shadow: none; }
.card--soon h3 { color: var(--muted); font-weight: 500; }
.card p { font-size: .88rem; color: var(--muted); margin-top: .4rem; }
.card-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--muted); }
.cat-title { font-size: 1.05rem; font-family: var(--font); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .85rem; }

/* ---------- resume « l'essentiel » ---------- */
.summary {
  background: var(--accent-soft); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.summary h2 { font-size: 1.05rem; font-family: var(--font); font-weight: 700; margin-bottom: .5rem; }
.summary ul { margin: 0; padding-left: 1.1rem; }

/* ---------- sommaire ---------- */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin-top: 1.6rem; }
.toc h2 { font-size: .8rem; font-family: var(--font); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: .93rem; }

/* ---------- etapes / competences ---------- */
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; box-shadow: var(--shadow-sm); }
.step + .step { margin-top: 1rem; }
.step-head { display: flex; align-items: baseline; gap: .8rem; }
.step-num {
  flex: 0 0 auto; font-family: var(--serif); font-weight: 700; font-size: .95rem;
  color: var(--accent-ink); background: var(--accent);
  border-radius: 6px; padding: .05rem .5rem;
}
.step h3 { margin: 0; }
.step-body { margin-top: .9rem; }
.field { margin-top: .8rem; }
.field-label {
  display: block; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .2rem;
}
.field--trap .field-label { color: var(--ochre); }

/* ---------- encarts ---------- */
.callout { border: 1px solid var(--border); border-left: 4px solid var(--accent);
  background: var(--surface); border-radius: var(--radius); padding: 1rem 1.15rem; margin: 1.2rem 0; }
.callout h3 { font-family: var(--font); font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.callout--trap { border-left-color: var(--ochre); background: var(--ochre-soft); }
.callout--trap h3 { color: var(--ochre); }
.callout--stop { border-left-color: var(--danger); background: var(--danger-soft); }
.callout--stop h3 { color: var(--danger); }

/* ---------- listes marquees ---------- */
.list-plain { list-style: none; padding-left: 0; }
.list-plain > li { position: relative; padding-left: 1.5rem; }
.list-plain > li::before {
  content: ""; position: absolute; left: .25rem; top: .75rem;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.list-no { list-style: none; padding-left: 0; }
.list-no > li { position: relative; padding-left: 1.5rem; }
.list-no > li::before { content: "\00d7"; position: absolute; left: .3rem; top: 0;
  color: var(--danger); font-weight: 700; }

/* ---------- auto-evaluation ---------- */
.selfcheck { list-style: none; padding-left: 0; }
.selfcheck li { display: flex; gap: .7rem; align-items: flex-start;
  border-bottom: 1px dashed var(--border); padding: .7rem 0; }
.selfcheck li:last-child { border-bottom: 0; }
.selfcheck input[type="checkbox"] { margin-top: .45rem; width: 1.05rem; height: 1.05rem;
  accent-color: var(--accent); flex: 0 0 auto; }
.selfcheck label { cursor: pointer; }
.score-key { margin-top: 1rem; font-size: .93rem; color: var(--muted); }

/* ---------- ressources / affiliation ---------- */
.resource { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.resource + .resource { margin-top: .9rem; }
.resource h3 { font-family: var(--font); font-size: 1rem; font-weight: 700; }
.resource p { color: var(--muted); font-size: .95rem; margin-top: .3rem; }
.btn-amazon {
  display: inline-block; margin-top: .75rem; padding: .5rem .95rem;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px;
  font-size: .9rem; font-weight: 600; border: 1px solid var(--accent-strong);
}
.btn-amazon:hover { background: var(--accent-strong); color: var(--accent-ink); text-decoration: none; }
.affiliate-note { font-size: .84rem; color: var(--muted); margin-top: 1rem; }

/* ---------- tableau ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--font); font-weight: 700; background: var(--surface-2); }

/* ---------- pied de page ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border);
  margin-top: 3rem; padding: 2.6rem 0 1.6rem; }
.footer-grid { display: grid; gap: 1.8rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer-grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .6rem; }
.footer-grid ul { list-style: none; padding-left: 0; font-size: .92rem; }
.footer-grid li + li { margin-top: .4rem; }
/* La colonne des fiches liste TOUS les metiers publies (maillage) : deux colonnes
   pour qu'elle ne fasse pas trois ecrans de haut. */
.footer-fiches { grid-column: span 2; }
.footer-fiches ul { columns: 2; column-gap: 1.6rem; }
.footer-fiches li { break-inside: avoid; }
@media (max-width: 560px) { .footer-fiches { grid-column: auto; } .footer-fiches ul { columns: 1; } }
.footer-grid p { font-size: .92rem; color: var(--muted); }
.footer-grid a { color: var(--text); }
.footer-grid a:hover { color: var(--accent); }
.network li span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.footer-legal { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1.2rem;
  justify-content: space-between; }
.footer-amazon { margin-top: 1.4rem; padding: .85rem 1rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; color: var(--muted); }

/* ---------- divers ---------- */
.legal h2 { margin-top: 2rem; margin-bottom: .5rem; }
.legal h2:first-of-type { margin-top: 1rem; }
.updated { font-size: .85rem; color: var(--muted); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: .6rem; z-index: 60; background: var(--surface);
  border: 1px solid var(--accent); border-radius: 6px; padding: .5rem .8rem; }

@media (max-width: 640px) {
  .site-nav { gap: .9rem; margin-left: 0; width: 100%; padding-bottom: .7rem; }
  .header-inner { min-height: 0; padding-top: .7rem; }
  .hero { padding: 2.2rem 0 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.card:hover { transform: none; }
}

/* Rappel de portee sur les fiches de metiers reglementes. */
.disclaimer {
  margin-top: 1.4rem; padding: .85rem 1rem;
  border: 1px dashed var(--border-strong); border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
  font-size: .88rem; line-height: 1.6;
}
.disclaimer strong { color: var(--text); }
