/* Compoatlas : une colonne de lecture, une marge pour les sources. */

@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2113, U+A720-A7FF;
}

:root {
  --paper: #f6f8f7;
  --label: #ffffff;
  --ink: #16343c;
  --ink-soft: #3e5960;
  --margin-ink: #536a70;
  --rule: #d3dcda;
  --wash: #e9efed;
  --prohibited: #7b2d4e;
  --restricted: #8a5d0b;
  --allowed: #1f6f68;
  --none: #677175;
  --focus: #1d5fd1;
  /* Atlas : bleus de profondeur, une famille de teintes distincte de celle des statuts */
  --atlas: #17406b;
  --atlas-ink: #f3f7fb;
  --link: #1f5f9e;
  --zone: #17406b;
  --zone-wash: #e8eff6;
  --bg-prohibited: #f5e8ee;
  --bg-restricted: #f6eedd;
  --bg-allowed: #e2f1ef;
  --bg-none: #eceff0;
  --serif: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson", "Segoe UI", system-ui, sans-serif;
  --measure: 66ch;
  --margin: 21rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1b1d;
    --label: #162427;
    --ink: #e3ebe9;
    --ink-soft: #b8c7c4;
    --margin-ink: #9db0ad;
    --rule: #2c3d40;
    --wash: #172729;
    --prohibited: #e08aac;
    --restricted: #e0b45c;
    --allowed: #6fcabf;
    --none: #a3adb0;
    --focus: #8ab4ff;
    --atlas: #143352;
    --atlas-ink: #e6eef7;
    --link: #8fbcef;
    --zone: #8fbcef;
    --zone-wash: #15283a;
    --bg-prohibited: #2f1a24;
    --bg-restricted: #2d2414;
    --bg-allowed: #12302d;
    --bg-none: #1e2a2d;
    color-scheme: dark;
  }
}
/* Zones de l'atlas : cosmétiques (indigo), compléments (océan), autres pays (ardoise) */
[data-zone="cosm"] { --zone: #4a47a3; --zone-wash: #eeedf8; }
[data-zone="supp"] { --zone: #1d6fa6; --zone-wash: #e5f1f9; }
[data-zone="world"] { --zone: #5a6a92; --zone-wash: #edf0f6; }
@media (prefers-color-scheme: dark) {
  [data-zone="cosm"] { --zone: #a9a6f0; --zone-wash: #1d1f3a; }
  [data-zone="supp"] { --zone: #7fc0ea; --zone-wash: #11283a; }
  [data-zone="world"] { --zone: #aebbdc; --zone-wash: #1c2436; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.62 var(--serif);
  font-optical-sizing: auto;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
i, em, .latin { font-style: italic; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--label); padding: 0.5rem 0.75rem; z-index: 10; }

/* En-tête : un bandeau bleu atlas, le seul aplat de couleur du site */
.masthead { background: var(--atlas); color: var(--atlas-ink); }
.masthead-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem;
  max-width: 76rem; margin: 0 auto; padding: 1rem 1.25rem;
  font-family: var(--sans);
}
.brand { font: 650 1.2rem/1.2 var(--serif); text-decoration: none; letter-spacing: -0.01em; color: inherit; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.masthead nav a { text-decoration: none; color: inherit; opacity: 0.82; }
.masthead nav a.lang { font-weight: 600; opacity: 1; }
.masthead nav a:hover, .masthead nav a[aria-current] { opacity: 1; text-decoration: underline; text-decoration-thickness: 2px; }
.masthead :focus-visible { outline-color: #ffd166; }
.masthead form { margin-left: auto; display: flex; }
.masthead input[type=search] { width: 15rem; max-width: 60vw; border-color: transparent; color: var(--ink); }

input, textarea, button, select { font: inherit; color: inherit; }
input[type=search], input[type=text] {
  font-family: var(--sans); font-size: 0.95rem;
  padding: 0.45rem 0.6rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--label);
}
button, .button {
  font-family: var(--sans); font-weight: 600; font-size: 0.98rem;
  padding: 0.6rem 1.1rem; border: 0; border-radius: 4px; cursor: pointer;
  background: var(--ink); color: var(--paper); text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--ink-soft); }

/* Mise en page : colonne de lecture + marge des sources */
main { max-width: 76rem; margin: 0 auto; padding: 0.5rem 1.25rem 4rem; }
.lead-block { max-width: var(--measure); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.18; letter-spacing: -0.012em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.7rem); font-weight: 600; margin: 1.6rem 0 0.5rem; max-width: 24ch; }
h1::after { content: ""; display: block; width: 3.2rem; height: 4px; margin-top: 0.55rem; background: var(--zone); border-radius: 2px; }
h2 { font-size: 1.45rem; font-weight: 600; margin: 2.6rem 0 0.6rem; }
h3 { font-size: 1.12rem; font-weight: 600; margin: 1.6rem 0 0.4rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
.subtitle { font-family: var(--sans); color: var(--margin-ink); font-size: 0.95rem; margin-bottom: 1.4rem; }
.answer { font-size: 1.2rem; line-height: 1.55; max-width: 60ch; }
h1 + .answer, .lead-block h1 + .answer { margin-top: 1rem; }

.fact {
  display: grid; grid-template-columns: minmax(0, var(--measure)) var(--margin); gap: 0 2.75rem;
  align-items: start; margin: 0 0 1.5rem;
}
.fact > .src {
  font-family: var(--sans); font-size: 0.84rem; line-height: 1.5; color: var(--margin-ink);
  border-left: 2px solid var(--rule); padding-left: 0.9rem;
}
.fact > .src p { font-size: inherit; margin-bottom: 0.4rem; }
@media (max-width: 62rem) {
  .fact { grid-template-columns: minmax(0, 1fr); }
  .fact > .src { margin-top: 0.6rem; }
}

/* Statuts : forme + libellé, la couleur n'est jamais seule ; un fond pâle de la même teinte */
.st { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; display: inline-flex; gap: 0.4rem; align-items: baseline;
      padding: 0.12rem 0.55rem 0.14rem; border-radius: 0.5rem; background: var(--bg-none); }
.st-prohibited { background: var(--bg-prohibited); }
.st-restricted, .st-over_limit, .st-check { background: var(--bg-restricted); }
.st-allowed, .st-conditions { background: var(--bg-allowed); }
.st::before { content: ""; width: 0.7em; height: 0.7em; display: inline-block; flex: none; transform: translateY(0.05em); }
.st-prohibited { color: var(--prohibited); }
.st-prohibited::before { background: currentColor; }
.st-restricted, .st-over_limit, .st-check { color: var(--restricted); }
.st-restricted::before, .st-over_limit::before, .st-check::before { background: currentColor; transform: translateY(0.05em) rotate(45deg) scale(0.85); }
.st-allowed, .st-conditions { color: var(--allowed); }
.st-allowed::before, .st-conditions::before { background: currentColor; border-radius: 50%; }
.st-none, .st-info, .st-mentioned { color: var(--none); }
.st-none::before, .st-info::before, .st-mentioned::before { border: 2px solid currentColor; border-radius: 50%; }
/* nom non reconnu : un trait, pour ne pas le confondre avec « pas de règle particulière » (cercle vide) */
.st-unknown { color: var(--none); }
.st-unknown::before { height: 2px; background: currentColor; transform: translateY(-0.25em); }
.st-prohibited.level::before { border-radius: 0; }
.statuses { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: 0.35rem; }

/* Étiquette : l'outil d'analyse se présente comme le dos d'un emballage */
.label {
  background: var(--label); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1.25rem 1.35rem 1.1rem; max-width: 52rem; margin: 1.5rem 0 1rem;
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -28px rgba(22, 52, 60, 0.45);
}
.label h2 { margin: 0 0 0.2rem; font-size: 1.05rem; font-family: var(--sans); letter-spacing: 0; }
.label .hint { font-family: var(--sans); font-size: 0.88rem; color: var(--margin-ink); margin-bottom: 0.6rem; }
.label textarea {
  width: 100%; min-height: 8.5rem; resize: vertical; border: 0; border-top: 1px dashed var(--rule);
  padding: 0.8rem 0 0.4rem; background: transparent;
  font: 500 0.98rem/1.55 var(--sans); letter-spacing: 0.01em;
}
.label textarea:focus-visible { outline-offset: 4px; }
.label .actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; justify-content: space-between; }
.label .actions small { font-family: var(--sans); color: var(--margin-ink); }

/* Liste annotée : chaque ingrédient souligné selon son statut */
.inci { font: 500 1.02rem/2.1 var(--sans); max-width: 52rem; }
.inci a, .inci span.tok { text-decoration: none; border-bottom: 3px solid var(--rule); padding-bottom: 1px; }
.inci .tok-prohibited { border-bottom-color: var(--prohibited) !important; }
.inci .tok-restricted { border-bottom-color: var(--restricted) !important; }
.inci .tok-allowed { border-bottom-color: var(--allowed) !important; }
.inci .tok-unknown { border-bottom-style: dotted !important; color: var(--margin-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0.6rem 0 1.5rem; }

/* Tableaux */
.table-wrap { overflow-x: auto; max-width: 100%; margin: 0 0 1.5rem; }
table { border-collapse: collapse; font-family: var(--sans); font-size: 0.92rem; line-height: 1.45; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.8rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--ink-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-family: var(--serif); font-size: 1rem; padding-bottom: 0.4rem; color: var(--ink-soft); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.2rem; font-family: var(--sans); font-size: 0.95rem; margin: 0 0 1.2rem; max-width: var(--measure); }
.kv dt { color: var(--margin-ink); }
.kv dd { margin: 0; }

details { margin: 0.4rem 0 1rem; max-width: var(--measure); }
summary { cursor: pointer; font-family: var(--sans); font-size: 0.92rem; color: var(--ink-soft); }
blockquote { max-width: var(--measure); margin: 0.5rem 0 0.8rem; padding: 0.2rem 0 0.2rem 0.9rem; border-left: 2px solid var(--rule); font-size: 0.95rem; color: var(--ink-soft); }

/* Signaux d'un complément */
.signals { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.9rem; max-width: var(--measure); }
.signals li { padding: 0.75rem 0.9rem; background: var(--wash); border-radius: 6px; }
.signals .st { margin-bottom: 0.2rem; }
.signals p { margin: 0.2rem 0 0; }
.signals .why { font-family: var(--sans); font-size: 0.84rem; color: var(--margin-ink); }

/* Listes d'entrées et pagination */
.entries { list-style: none; padding: 0; margin: 0 0 1.5rem; columns: 2 18rem; column-gap: 2.5rem; font-family: var(--sans); font-size: 0.95rem; }
.entries li { break-inside: avoid; padding: 0.22rem 0; }
.entries .count { color: var(--margin-ink); font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 1rem; font-family: var(--sans); margin: 1rem 0 2rem; }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2rem 2.75rem; margin-top: 2.5rem; }
.hub h2 { margin-top: 0; font-size: 1.2rem; }
.hub ul { padding-left: 1.1rem; margin: 0; }
.hub li { margin: 0.3rem 0; }

/* Fiche produit : la photo de l'emballage à côté des informations */
.product-head { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 0 2rem; align-items: start; }
.product-head > .fact { margin-bottom: 1.5rem; }
.product-photo { margin: 0 0 1.5rem; }
.product-photo img { display: block; max-width: 100%; max-height: 22rem; height: auto; border-radius: 8px;
                     background: var(--label); border: 1px solid var(--rule); }
.product-photo figcaption { font-family: var(--sans); font-size: 0.8rem; color: var(--margin-ink); margin-top: 0.4rem; }
.label-photo { max-width: 34rem; }
.label-photo img { max-height: 28rem; }
.links { font-family: var(--sans); font-size: 0.95rem; padding-left: 1.1rem; margin: 0.4rem 0 1rem; max-width: var(--measure); }
.links li { margin: 0.25rem 0; }
@media (max-width: 62rem) { .product-head { grid-template-columns: minmax(0, 1fr); } .product-photo img { max-height: 16rem; } }

/* Partie « En clair » : un encart teinté de la couleur de la zone */
.plain { background: var(--zone-wash); border-left: 4px solid var(--zone); border-radius: 0 8px 8px 0;
         padding: 0.3rem 1.25rem 0.6rem; margin: 1.8rem 0 2rem; }
.plain > h2 { margin-top: 1rem; color: var(--zone); }
.plain .fact > .src { border-left-color: color-mix(in srgb, var(--zone) 35%, transparent); }
.hub h2 { color: var(--link); }
.note { font-family: var(--sans); font-size: 0.88rem; color: var(--margin-ink); max-width: var(--measure); }
.notice { border-left: 3px solid var(--restricted); padding: 0.6rem 0.9rem; background: var(--wash); max-width: var(--measure); margin: 1rem 0 1.5rem; }

footer.site {
  max-width: 76rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 0.88rem; color: var(--margin-ink);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
}
footer.site p { margin: 0; flex-basis: 100%; }

@media (max-width: 40rem) {
  .masthead form { margin-left: 0; width: 100%; }
  .masthead input[type=search] { width: 100%; max-width: none; flex: 1; }
  .label { padding: 1rem; }
  th, td { padding-right: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .masthead nav, .masthead form, footer.site { display: none; }
  .fact { grid-template-columns: 1fr; }
}
