/* ============================================================
   Thème « Marché » (enfant du thème arfooo)
   Les formes des sites de petites annonces (en-tête sur deux lignes : inscription, recherche, liens à
   pictogramme, puis les catégories ; coins de 16 px, cartes sans cadre) et les couleurs du logo d'Arfooo,
   en version vive. Chargé après css/style.css du thème parent et avant les réglages d'Apparence, qui gardent
   le dernier mot (couleur d'accent, police, arrondis, logo, illustrations).

   Couleurs :
     - le bleu franc porte la marque : bandeau de l'accueil, liens, boutons de travail, carte de France ;
     - l'orange soleil est réservé à l'action : « Inscrire mon site », les boutons principaux, la recherche
       (variables --action, --action-strong, --on-action). Il porte du texte bleu nuit, jamais du blanc ;
     - le vert dit qu'une fiche est validée ;
     - les cinq couleurs du logo (--petal-1 à 5) reviennent en petites touches : marqueurs de catégories,
       image des fiches sans capture d'écran (images/default-site.svg).
   Fonds blancs, encarts bleu très clair : pas de gris.
   ============================================================ */

/* Police : Nunito Sans, servie par l'annuaire (licence OFL, voir fonts/LICENCE.txt) */
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0f1e3d;
  --ink-2: #3b4a66;
  --paper: #ffffff;
  --paper-2: #f3f7ff;
  --paper-3: #eaf2ff;
  --line: #dbe5f6;
  --line-strong: #a6b5d0;
  --accent: #1463e6;
  --accent-strong: #0f51c2;
  --accent-link: #1259d1;
  --accent-soft: #eaf2ff;
  --accent-vivid: #2f80ff;
  --on-accent: #ffffff;
  --action: #ffb41f;
  --action-strong: #ffa600;
  --on-action: #0f1e3d;
  --valid: #0a7d45;
  --valid-soft: #dcf5e7;
  --petal-1: #ff5247;
  --petal-2: #ffa600;
  --petal-3: #1fc16b;
  --petal-4: #2f80ff;
  --petal-5: #8b5cf6;
  --hero-bg: #1463e6;
  --hero-shape: #1b6cf0;
  --color-primary-light: #cfe1ff;
  --color-text-muted: #5b6880;

  --font-family: "Nunito Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(20, 60, 140, 0.16);
  --shadow-md: 0 6px 18px rgba(20, 60, 140, 0.16);
  --shadow-lg: 0 16px 40px rgba(20, 60, 140, 0.24);
  --shadow-card: none;
  --wrap: 1240px;
}

[data-theme="dark"] {
  --ink: #f5f8ff;
  --ink-2: #c9d5ee;
  --paper: #0b1530;
  --paper-2: #101d3d;
  --paper-3: #14244a;
  --line: #233560;
  --line-strong: #5f77a8;
  --accent: #6ea8ff;
  --accent-strong: #9cc2ff;
  --accent-link: #9cc2ff;
  --accent-soft: #132a57;
  --accent-vivid: #4d94ff;
  --on-accent: #06143a;
  --action: #ffc233;
  --action-strong: #ffd466;
  --on-action: #1a1400;
  --valid: #5fdc9b;
  --valid-soft: #123a2a;
  --hero-bg: #1b46b0;
  --hero-shape: #2251c2;
  --color-primary-light: #1f4b9c;
  --color-text-muted: #9fb0d0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.5);
}

/* ---------- Ce que le navigateur dessine lui-même ---------- */
::selection {
  background: var(--color-primary-light);
  color: var(--ink);
}

html {
  scrollbar-color: var(--line-strong) transparent;
}

input,
textarea {
  caret-color: var(--accent-vivid);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}

a {
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* ---------- En-tête ---------- */
#top1.site-header {
  border-bottom: 1px solid var(--line);
}

.brand-name {
  font-size: 23px;
  font-weight: 600;
}

.brand-name b {
  font-weight: 900;
}

.head-cta,
.head-cta:link,
.head-cta:visited {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px 0 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--transition);
}

.head-cta:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
  text-decoration: none;
}

.head-cta svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.head-search {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 0 6px 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--paper-3);
  transition: background-color var(--transition), border-color var(--transition);
}

.head-search:hover {
  border-color: var(--line-strong);
}

.head-search:focus-within {
  border-color: var(--ink);
  background: var(--paper);
}

.head-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.head-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 12px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.head-search-input::placeholder {
  font-weight: 500;
  color: var(--color-text-muted);
}

.head-search-input::-webkit-search-cancel-button {
  display: none;
}

/* Mode sombre : la règle générale des champs (thème de base) leur donne un fond et, au clic, un halo. Ici la
   pastille entière est le champ : ses deux zones de saisie restent transparentes, seul le trait qui les sépare
   se voit. Le sélecteur est doublé pour passer devant la règle générale, plus précise que celle du thème. */
[data-theme="dark"] form.head-search input.head-search-input.head-search-input[name],
[data-theme="dark"] form.head-search input.head-search-input.head-search-input[name]:focus {
  background-color: transparent;
  border-color: var(--line-strong);
  box-shadow: none;
}

.head-search-where {
  flex: 0 1 38%;
  padding-left: 16px;
  border-left: 1px solid var(--line-strong);
}

.head-search-go {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

.head-search-go:hover {
  background: var(--accent-strong);
}

.head-search-go:active {
  transform: scale(0.94);
}

.head-search-go svg {
  width: 18px;
  height: 18px;
}

/* Liens à pictogramme : le dessin au-dessus, le mot en dessous */
.head-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.head-link,
.head-link:link,
.head-link:visited {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 68px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

.head-link:hover {
  background: var(--paper-3);
  color: var(--ink);
  text-decoration: none;
}

.head-link svg {
  width: 22px;
  height: 22px;
}

/* Seconde ligne : les catégories principales, séparées par un point */
.head-cats-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  height: 44px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.head-cats-list li {
  display: flex;
  align-items: center;
  height: 44px;
  margin: 0;
}

.head-cats-list li + li::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.head-cats-list a,
.head-cats-list a:link,
.head-cats-list a:visited {
  padding: 4px 9px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}

.head-cats-list a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent-vivid);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.head-cats-all a,
.head-cats-all a:link,
.head-cats-all a:visited {
  font-weight: 800;
}

.theme-toggle-btn {
  border-color: var(--line-strong);
}

/* La grande recherche est celle de l'accueil ; sur les autres pages, celle de l'en-tête suffit */
.page-home .head-search {
  visibility: hidden;
}

body:not(.page-home) #top3 {
  display: none;
}

@media (min-width: 1025px) {
  :root {
    --header-h: 121px;
  }

  .header-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand cta search links tools"
      "cats cats cats cats cats";
    align-items: center;
    gap: 0 16px;
    height: auto;
  }

  .brand {
    grid-area: brand;
    height: 76px;
    margin-right: 4px;
  }

  .head-cta {
    grid-area: cta;
  }

  .head-search {
    grid-area: search;
    max-width: 640px;
    justify-self: center;
  }

  .head-links {
    grid-area: links;
  }

  .header-tools {
    grid-area: tools;
  }

  .head-cats {
    grid-area: cats;
    border-top: 1px solid var(--line);
  }

  /* Le menu habituel est repris par les pictogrammes et la ligne de catégories */
  #top2.header-nav {
    display: none;
  }
}

/* Sur un écran d'ordinateur portable, la recherche de l'en-tête garde un seul champ pour rester lisible */
@media (min-width: 1025px) and (max-width: 1519px) {
  .head-search-where {
    display: none;
  }
}

@media (min-width: 1025px) and (max-width: 1240px) {
  .head-link,
  .head-link:link,
  .head-link:visited {
    min-width: 56px;
  }
}

@media (max-width: 1024px) {
  .header-row {
    flex-wrap: wrap;
    gap: 10px;
    height: auto;
    min-height: var(--header-h);
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .brand {
    margin-right: auto;
  }

  .head-cta,
  .head-cta:link,
  .head-cta:visited {
    order: 2;
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .head-cta span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  /* Sur téléphone, les liens et les catégories sont dans le tiroir du menu */
  .head-links,
  .head-cats {
    display: none;
  }

  .header-tools {
    order: 3;
  }

  .head-search {
    order: 4;
    flex: 1 0 100%;
    height: 44px;
  }

  .page-home .head-search,
  .head-search-where {
    display: none;
  }
}

/* ---------- Boutons ---------- */
.btn {
  border-radius: var(--radius);
  font-weight: 800;
}

/* Réponse au clic : le bouton s'enfonce à peine, tout de suite */
.btn,
.head-cta,
.search-submit {
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), transform 0.16s cubic-bezier(0.23, 1, 0.32, 1);
}

.btn:active,
.head-cta:active,
.search-submit:active {
  transform: scale(0.97);
}

.btn-ghost,
.btn-ghost:link,
.btn-ghost:visited {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Accueil : bandeau bleu plein, texte blanc, un soleil dans le coin ---------- */
.home-hero,
.page-home .home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: var(--hero-bg);
}

/* Deux disques : un soleil qui dépasse en haut à droite, un bleu un peu plus clair en bas. Ils restent sous le
   texte et loin de lui : le blanc garde son contraste. */
.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.home-hero::before {
  top: -90px;
  right: -70px;
  width: 260px;
  height: 260px;
  background: var(--hero-sun, var(--action));
}

.home-hero::after {
  right: 22%;
  bottom: -190px;
  width: 380px;
  height: 380px;
  background: var(--hero-shape);
}

/* Sur une colonne, le titre occupe toute la largeur : le soleil descend dans le coin du bas, sous l'encart blanc */
@media (max-width: 1024px) {
  .home-hero::before {
    top: auto;
    right: -80px;
    bottom: -90px;
    width: 220px;
    height: 220px;
  }

  .home-hero::after {
    right: auto;
    left: -160px;
    bottom: 22%;
  }
}

.home-hero h1,
.page-home .home-hero h1 {
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.home-hero-lead {
  color: #eef3fe;
}

.home-hero-facts {
  color: #ffffff;
}

.home-hero-facts li {
  font-weight: 700;
}

.home-hero-facts svg {
  color: var(--hero-mark, #ffd24d);
}

/* Quand l'annuairiste choisit sa couleur d'accent, le bandeau la prend (--hero-bg) et son bouton principal passe
   en blanc (--hero-action) : les réglages d'Apparence fournissent ces variables. */
.home-hero .btn-primary,
.home-hero .btn-primary:link,
.home-hero .btn-primary:visited {
  background: var(--hero-action, var(--action));
  color: var(--on-hero-action, var(--on-action));
}

.home-hero .btn-primary:hover {
  background: var(--hero-action-strong, var(--action-strong));
  color: var(--on-hero-action, var(--on-action));
}

.home-hero .btn-ghost,
.home-hero .btn-ghost:link,
.home-hero .btn-ghost:visited {
  border-color: #ffffff;
  color: #ffffff;
}

.home-hero .btn-ghost:hover {
  background: #ffffff;
  color: #1259d1;
}

.home-hero :focus-visible {
  outline-color: #ffffff;
}

.ladder {
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-md);
}

#top3,
.page-home #top3 {
  border-bottom: 0;
}

.search-bar {
  min-height: 64px;
  border-color: var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}

.search-bar:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow-md);
}

.search-field-label {
  font-weight: 800;
}

.search-submit {
  border-radius: 14px;
  font-weight: 800;
}

#search {
  border-radius: 24px;
}

/* ---------- Fiche d'un site ---------- */
.hero-visit-btn,
.hero-vote-btn {
  border-radius: var(--radius);
  font-weight: 800;
}

/* ---------- Titres de section ---------- */
.section-head h2 {
  font-weight: 900;
}

.section-link,
.section-link:link,
.section-link:visited {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.section-link:hover {
  color: var(--accent-link);
}

/* ---------- Cartes des derniers sites : l'image d'abord, pas de cadre ---------- */
.latest-grid {
  gap: 28px 20px;
}

.latest-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.latest-card:hover {
  box-shadow: none;
  transform: none;
}

.latest-thumb {
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper-3);
}

.latest-thumb img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Le zoom de l'image ne joue qu'avec une souris : au doigt, un survol reste collé après le toucher */
@media (hover: hover) and (pointer: fine) {
  .latest-card:hover .latest-thumb img {
    transform: scale(1.04);
  }
}

.latest-body {
  gap: 4px;
  padding: 12px 2px 0;
}

.latest-cat {
  order: 3;
  font-weight: 600;
}

.latest-title {
  font-size: 17px;
  font-weight: 800;
}

.latest-card:hover .latest-title a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.latest-desc {
  -webkit-line-clamp: 2;
}

.latest-meta {
  order: 4;
  margin-top: 0;
  padding-top: 2px;
}

/* ---------- Catégories : les cinq couleurs du logo, en pastilles rondes ---------- */
.cat-block-title {
  font-weight: 800;
}

.cat-block-title::before {
  border-radius: 50%;
}

.cat-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--paper-3);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}

/* ---------- Colonne : des encarts gris bleuté ---------- */
#right .menuright,
#right .menuleft,
#left .menuright,
#left .menuleft {
  margin: 0 0 16px;
  padding: 6px 20px 10px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper-3);
}

#right .menuright li.header,
#right .menuleft li.header,
#left .menuright li.header,
#left .menuleft li.header {
  padding: 14px 0 8px;
  border: 0;
  font-size: 17px;
  font-weight: 900;
}

#right .menuright li,
#right .menuleft li,
#left .menuright li,
#left .menuleft li {
  border-color: var(--line);
}

#right .menuright li a:hover,
#right .menuleft li a:hover {
  color: var(--accent-link);
}

/* ---------- Pied de page clair ---------- */
#bottom {
  background: var(--paper-2);
  color: var(--ink-2);
}

.footer-grid {
  border-bottom-color: var(--line-strong);
}

.footer-brand .brand-name,
.footer-title {
  color: var(--ink);
}

.footer-pitch,
.footer-copy {
  color: var(--ink-2);
}

#bottom a,
#bottom a:link,
#bottom a:visited {
  color: var(--ink-2);
}

#bottom a:hover {
  color: var(--ink);
}

/* ---------- L'orange soleil : l'inscription, les boutons principaux, la recherche ---------- */
.head-cta,
.head-cta:link,
.head-cta:visited,
.btn-primary,
.btn-primary:link,
.btn-primary:visited,
.search-submit,
.head-search-go {
  background: var(--action);
  color: var(--on-action);
}

.head-cta:hover,
.btn-primary:hover,
.search-submit:hover,
.head-search-go:hover {
  background: var(--action-strong);
  color: var(--on-action);
}

/* ---------- Graphique du bandeau : trois bleus, puis le soleil sur la dernière marche ---------- */
.ladder-step:nth-child(2) .ladder-bar,
[data-theme="dark"] .ladder-step:nth-child(2) .ladder-bar {
  background: color-mix(in srgb, var(--accent-vivid) 38%, var(--paper));
}

.ladder-step:nth-child(3) .ladder-bar,
[data-theme="dark"] .ladder-step:nth-child(3) .ladder-bar {
  background: var(--accent-vivid);
}

.ladder-step:nth-child(4) .ladder-bar {
  background: var(--action);
}

/* ---------- Carte de France : bleu franc, zone survolée en orange soleil ---------- */
.france-map {
  --map-fill: #2f80ff;
  --map-fill-strong: #1463e6;
  --map-line: #0d3c94;
  --map-hover: #ffa600;
}

[data-theme="dark"] .france-map {
  --map-fill: #3d7fe6;
  --map-fill-strong: #7fb0ff;
  --map-line: var(--paper);
  --map-hover: #ffc233;
}

/* Sur téléphone, les deux champs de la grande recherche s'empilent */
@media (max-width: 640px) {
  .search-submit {
    min-height: 48px;
    margin: 8px 12px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .latest-thumb img,
  .head-search-go {
    transition: none;
  }
}
