/*
Theme Name: NetworkCorp
Theme URI: https://networkcorp.fr
Author: NetworkCorp
Description: Thème bloc pour networkcorp.fr — direction « Cahier d'ingénieur ». Mode sombre natif.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: networkcorp
*/

/* ==========================================================================
   TOKENS — mode clair
   Source : bloc « tokens » de la maquette Claude Design.
   theme.json pointe vers ces variables, c'est ce qui rend le dark mode
   possible : une seule palette WordPress, deux jeux de valeurs.
   ========================================================================== */

:root {
  /* Couleurs */
  --bg:            #F6F3EE;
  --surface:       #FFFDFA;
  --surface-raise: #EFEAE2;
  --border:        #E2DAD0;
  --border-strong: #D9CFC2;
  --text:          #1E1B18;
  --text-soft:     #5B534B;
  --text-mute:     #6E645B; /* 5.0:1 sur --bg, AA à 12px */
  --accent:        #C2410C;
  --accent-hover:  #9A3412;
  --accent-soft:   #FBE9DE;
  --accent-ink:    #7C2D0A;

  /* États */
  --success: #4E7A3A;
  --warning: #B45309;
  --error:   #B4232A;
  --info:    #2F6FA8;

  /* Catégories */
  --cat-systeme:    #2F6FA8;
  --cat-reseau:     #4E7A3A;
  --cat-telephonie: #7A55B5;
  --cat-securite:   #B4232A;

  /* Typographie */
  --font-title: 'Archivo', system-ui, sans-serif;
  --font-body:  'Source Serif 4', Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, monospace;

  --step-h1:    clamp(2.25rem, 1.5rem + 3.2vw, 4rem);
  --step-h2:    clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  --step-h3:    clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --step-body:  clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  --step-small: 0.875rem;

  --lh-title: 1.02;
  --lh-body: 1.72;
  --track-title: -0.04em;
  --measure: 76ch; /* corps d'article */
  --page: min(1520px, 95vw); /* largeur commune : en-tête, sections, pied */

  /* Espace */
  --sp-1: 8px;   --sp-2: 16px;  --sp-3: 24px;
  --sp-4: 32px;  --sp-6: 48px;  --sp-8: 64px;
  --sp-12: 96px; /* rythme vertical de section */

  /* Rayons, traits, ombres */
  --r-sm: 6px;  --r-md: 10px;  --r-full: 999px;
  --ring: 1px solid var(--border);
  --shadow-1: 0 1px 2px rgb(30 27 24 / 0.05);
  --shadow-2: 0 8px 24px -12px rgb(30 27 24 / 0.14);
  /* deux ombres, pas trois : au-delà ça flotte */

  /* Mouvement */
  --t-fast: 120ms;
  --t-base: 180ms;
  --ease: cubic-bezier(.2, .6, .3, 1);

  color-scheme: light;
}

/* ==========================================================================
   TOKENS — mode sombre
   ========================================================================== */

[data-theme="dark"] {
  --bg:            #191614;
  --surface:       #211D1A;
  --surface-raise: #2A251F;
  --border:        #37302A;
  --border-strong: #4A423B;
  --text:          #F2EDE6;
  --text-soft:     #C0B5AB;
  --text-mute:     #A79C91; /* 6.2:1 sur --surface */
  --accent:        #FB8B3C;
  --accent-hover:  #FDA968;
  --accent-soft:   #2B2013;
  --accent-ink:    #F0C79C;

  --success: #8FBF6E;
  --warning: #E8A55C;
  --error:   #E8837E;
  --info:    #7FB0DC;

  --cat-systeme:    #7FB0DC;
  --cat-reseau:     #8FBF6E;
  --cat-telephonie: #B79BE0;
  --cat-securite:   #E8837E;

  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 8px 24px -12px rgb(0 0 0 / 0.6);

  color-scheme: dark;
}

/* ==========================================================================
   BASE
   ========================================================================== */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  line-height: var(--lh-title);
  letter-spacing: var(--track-title);
  font-weight: 700;
  text-wrap: balance;
}

h1 { font-size: var(--step-h1); }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); letter-spacing: -0.02em; }

p { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

code, kbd, pre, samp { font-family: var(--font-mono); }

/* Corps d'article : la mesure ne s'applique qu'au TEXTE.
   Les blocs de code, figures et tableaux prennent toute la colonne —
   c'est ce qui fait respirer une page technique. */
.entry-content > :is(p, ul, ol, dl, blockquote, h1, h2, h3, h4, h5, h6) {
  max-width: var(--measure);
}

/* Pastille de catégorie — la couleur vient du slug du terme,
   posé sur <body> par functions.php */
.nc-cat {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cat-color, var(--text-mute));
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

/* Masquer visuellement sans masquer aux lecteurs d'écran.
   J'utilisais cette classe sans la définir : selon les feuilles chargées
   par WordPress, le libellé du champ de recherche pouvait s'afficher. */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Lien d'évitement : premier élément focusable de la page, il permet
   de sauter la navigation au clavier. Invisible jusqu'au focus. */
.nc-evitement {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #FFFDFA;
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.nc-evitement:focus {
  left: var(--sp-3);
  top: var(--sp-3);
  color: #FFFDFA;
}

:focus-visible {
  outline: 3px solid rgb(194 65 12 / .3);
  outline-offset: 2px;
}
[data-theme="dark"] :focus-visible {
  outline-color: rgb(251 139 60 / .35);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Images : ratio 3:2, voile sépia 4% pour homogénéiser
   les captures de 2016 et de 2026 */
.entry-content img {
  border-radius: var(--r-sm);
  border: var(--ring);
  filter: sepia(0.04);
}
[data-theme="dark"] .entry-content img {
  filter: sepia(0.04) brightness(0.92);
}

/* ==========================================================================
   EN-TÊTE
   ========================================================================== */

.nc-entete {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nc-entete__interieur {
  max-width: var(--page);
  margin-inline: auto;
  padding: 12px var(--sp-4);
}

/* Garde-fou : la mise en page « flow » de WordPress ajoute une marge
   haute aux enfants suivants, ce qui désaligne les éléments d'un flex.
   On la neutralise, même si une copie enregistrée en base réintroduit
   un layout par défaut. */
.nc-entete__interieur > *,
.nc-entete__outils > * {
  margin-block: 0;
}

/* Toutes les hauteurs de contrôle s'alignent sur une même valeur :
   sans ça, recherche et bascule flottent l'une par rapport à l'autre. */
.nc-entete__interieur { --h-controle: 34px; }

/* display:flex indispensable : sans lui, gap et align-items
   sont ignorés et les enfants s'empilent. */
.nc-marque {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  text-decoration: none;
}

.nc-marque__logo {
  display: block;
  width: auto;
  flex: none;
}

.nc-marque--entete .nc-marque__logo { height: 28px; }
.nc-marque--pied .nc-marque__logo { height: 34px; }

/* Une seule des deux images est visible selon le thème actif. */
.nc-marque__logo--sombre { display: none; }
[data-theme="dark"] .nc-marque__logo--clair { display: none; }
[data-theme="dark"] .nc-marque__logo--sombre { display: block; }

.nc-marque__nom {
  font-family: var(--font-title);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-transform: lowercase;
  color: var(--text);
}

.nc-nav { margin-right: auto; }

.nc-nav .wp-block-navigation__container {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nc-nav .wp-block-navigation-item__content { padding-block: 0; }

/* ==========================================================================
   SOUS-MENU
   openSubmenusOnClick transforme les entrées parentes en <button> :
   « Configurations » n'est plus un lien, il n'ouvre que son sous-menu.
   Il faut donc rhabiller ce bouton pour qu'il ressemble aux autres liens.
   ========================================================================== */

.nc-nav .wp-block-navigation-submenu__toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
}

.nc-nav .wp-block-navigation-submenu__toggle:hover,
.nc-nav .wp-block-navigation-submenu__toggle[aria-expanded="true"] {
  color: var(--accent);
}

/* Le chevron suit la couleur du texte et pivote à l'ouverture */
.nc-nav .wp-block-navigation__submenu-icon {
  display: inline-flex;
  transition: transform var(--t-fast) var(--ease);
}

.nc-nav .wp-block-navigation__submenu-icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.nc-nav [aria-expanded="true"] .wp-block-navigation__submenu-icon {
  transform: rotate(180deg);
}

/* Le panneau déroulant reprend les surfaces du thème */
.nc-nav .wp-block-navigation__submenu-container {
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.nc-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-weight: 600;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

.nc-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
  background: var(--surface-raise);
  color: var(--accent);
}

/* Chaque sous-domaine garde sa couleur, comme partout ailleurs */
.nc-nav .wp-block-navigation__submenu-container li:nth-child(1) a:hover { color: var(--cat-systeme); }
.nc-nav .wp-block-navigation__submenu-container li:nth-child(2) a:hover { color: var(--cat-reseau); }
.nc-nav .wp-block-navigation__submenu-container li:nth-child(3) a:hover { color: var(--cat-telephonie); }
.nc-nav .wp-block-navigation__submenu-container li:nth-child(4) a:hover { color: var(--cat-securite); }

.nc-nav a {
  color: var(--text-soft);
  font-weight: 600;
  text-decoration: none;
}

.nc-nav a:hover,
.nc-nav .current-menu-item > a {
  color: var(--accent);
}

.nc-entete__outils { flex: none; }

/* ==========================================================================
   RECHERCHE
   ========================================================================== */

.nc-recherche {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-raise);
  padding-right: 6px;
  transition: border-color var(--t-fast) var(--ease);
}

.nc-recherche:focus-within { border-color: var(--accent); }

.nc-recherche__champ {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.nc-recherche__champ::placeholder { color: var(--text-mute); opacity: 1; }
.nc-recherche__champ:focus { outline: none; }
.nc-recherche__champ::-webkit-search-cancel-button { display: none; }

.nc-recherche__kbd {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
}

.nc-recherche--entete {
  width: 230px;
  height: var(--h-controle, 34px);
}

.nc-recherche--entete .nc-recherche__champ { padding-block: 0; }

.nc-recherche--hero {
  width: 100%;
  max-width: 500px;
  margin-top: var(--sp-3);
  background: var(--surface);
}

.nc-recherche--hero .nc-recherche__champ { padding-block: 11px; font-size: 12.5px; }

.nc-recherche__envoi {
  flex: none;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 4px 6px;
}

/* ==========================================================================
   BASCULE CLAIR / SOMBRE — contrôle segmenté
   ========================================================================== */

.nc-bascule {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: var(--h-controle, 34px);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-raise);
  cursor: pointer;
}

.nc-bascule__opt {
  padding: 4px 11px;
  border-radius: var(--r-full);
  color: var(--text-mute);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

.nc-bascule[aria-pressed="false"] .nc-bascule__opt[data-mode="clair"],
.nc-bascule[aria-pressed="true"]  .nc-bascule__opt[data-mode="sombre"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

@media (max-width: 1100px) {
  .nc-recherche--entete { width: 150px; }
  .nc-recherche--entete .nc-recherche__kbd { display: none; }
}

@media (max-width: 800px) {
  .nc-entete__interieur { flex-wrap: wrap !important; }
  .nc-nav { margin-right: 0; order: 3; width: 100%; }
  .nc-entete__outils { margin-left: auto; }
}

/* ==========================================================================
   PIED DE PAGE — 1.4fr / 1fr / 1fr / 1fr
   ========================================================================== */

.nc-pied {
  margin-top: var(--sp-12);
  padding: var(--sp-8) var(--sp-3) var(--sp-6);
}

.nc-pied__grille {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--sp-6);
  max-width: var(--page);
  margin-inline: auto;
}

.nc-pied__marque .nc-marque { margin-bottom: var(--sp-2); }

.nc-pied__baseline {
  margin: 0 0 var(--sp-2);
  max-width: 42ch;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.nc-pied__promesse {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--success);
}

.nc-pied__titre {
  margin: 0 0 var(--sp-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 500;
}

.nc-pied__liste {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nc-pied__liste li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1);
  font-family: var(--font-title);
  font-size: 0.875rem;
}

.nc-pied__liste a {
  color: var(--text-soft);
  text-decoration: none;
}

.nc-pied__liste a:hover { color: var(--accent); }

.nc-pied__liste--domaines li a { color: var(--cat-color, var(--text-soft)); font-weight: 600; }

.nc-pied__compte {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}

.nc-pied__legal {
  max-width: var(--page);
  margin: var(--sp-8) auto 0;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .nc-pied__grille { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
  .nc-pied__marque { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .nc-pied__grille { grid-template-columns: 1fr; }
}
