/* ==========================================================================
   Polaris — polaris-cyber.fr
   Une seule feuille, écrite à la main, sans dépendance.
   Direction artistique et source de chaque valeur : DA.md
   ========================================================================== */

/* 1. Police auto-hébergée — Roboto, SIL OFL 1.1 (fonts/LICENCE-Roboto.txt) */

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/roboto-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/roboto-latin-700.woff2") format("woff2");
}

/* 2. Jetons */

:root {
  color-scheme: dark light;

  /* Thème sombre : celui de NetArmor, par défaut */
  --noir: #000;
  --fond: #121212;
  --surface: #1a1a1a;
  --texte: #e8e8e8;
  --texte-2: #a0a0a0;
  --accent: #25d366;
  --sur-accent: #000;
  --filet: rgba(255, 255, 255, 0.12);
  --halo: rgba(0, 255, 0, 0.3);

  --sans: "Roboto", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  /* Espacements : pas de 8 px */
  --e1: 4px;
  --e2: 8px;
  --e3: 16px;
  --e4: 24px;
  --e5: 32px;
  --e6: 48px;
  --e7: 64px;
  --e8: 96px;

  --colonne: 760px;
  --large: 1120px;
  --marge: 16px;

  --rayon: 4px;
  --rayon-carte: 8px;
  --court: 150ms;
}

@media (min-width: 600px) {
  :root {
    --marge: 32px;
  }
}

/* Thème clair : le corps de la page s'éclaircit, l'accent s'assombrit pour rester lisible */
@media (prefers-color-scheme: light) {
  :root {
    --fond: #f4f6f5;
    --surface: #fff;
    --texte: #121212;
    --texte-2: #4d5650;
    --accent: #0b6b34;
    --sur-accent: #fff;
    --filet: rgba(0, 0, 0, 0.14);
    --halo: rgba(11, 107, 52, 0.22);
  }
}

/* Les bandes « nuit » (en-tête, ouverture, pied) restent noires dans les deux thèmes */
.nuit {
  color-scheme: dark;
  --texte: #e8e8e8;
  --texte-2: #a0a0a0;
  --accent: #25d366;
  --sur-accent: #000;
  --filet: rgba(255, 255, 255, 0.12);
  --halo: rgba(0, 255, 0, 0.3);
  background: var(--noir);
  color: var(--texte);
}

/* 3. Base */

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

html {
  font-size: 112.5%; /* 18 px */
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

h1,
h2,
h3 {
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--texte);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cadre {
  width: 100%;
  max-width: calc(var(--large) + 2 * var(--marge));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--marge);
  padding-right: var(--marge);
}

.evitement {
  position: absolute;
  top: -100px;
  left: var(--marge);
  z-index: 10;
  padding: var(--e2) var(--e3);
  border-radius: var(--rayon);
  background: var(--accent);
  color: var(--sur-accent);
  font-weight: 700;
  text-decoration: none;
}

.evitement:focus {
  top: var(--e2);
  color: var(--sur-accent);
}

/* 4. En-tête */

.entete__ligne {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: var(--e2);
  padding-bottom: var(--e1);
}

.marque {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--texte);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.3rem;
  text-decoration: none;
  text-transform: uppercase;
}

.marque:hover {
  color: var(--accent);
}

.marque__etoile {
  flex: none;
  margin-right: 12px;
  color: var(--accent);
}

.menu ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu li {
  margin-right: 0.8rem;
}

.menu li:last-child {
  margin-right: 0;
}

.menu a {
  display: inline-block;
  padding: 12px 0;
  color: var(--texte);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color var(--court) ease;
}

.menu a:hover,
.menu a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

@media (min-width: 720px) {
  .entete__ligne {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--e3);
    padding-bottom: var(--e3);
  }

  .menu li {
    margin-right: 1.5rem;
  }

  .menu a {
    font-size: 0.85rem;
  }
}

/* 5. Ouverture : le nom, le chapeau, le bouton, et le réseau animé derrière */

.ouverture {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--filet);
}

.ouverture__texte {
  position: relative;
  z-index: 1;
  padding-top: var(--e5);
  padding-bottom: 88px;
}

.ouverture__nom {
  position: relative;
  display: inline-block;
  margin: 0 0 var(--e2);
  font-family: var(--mono);
  font-size: 2.6rem;
  font-size: clamp(2.6rem, 9vw, 4.75rem);
  line-height: 1.1;
  letter-spacing: 0.04em;
}

.ouverture__nom span {
  display: inline-block;
}

/* Le curseur de saisie : reste affiché, plein, après la frappe */
.ouverture__nom::after {
  content: "";
  position: absolute;
  bottom: 0.14em;
  left: 100%;
  width: 0.3ch;
  height: 0.86em;
  margin-left: 0.08em;
  background: var(--accent);
}

.ouverture__titre {
  max-width: var(--colonne);
  margin: 0 0 var(--e4);
  font-size: 1.3rem;
  font-size: clamp(1.3rem, 3.4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
}

.ouverture__chapeau {
  max-width: 640px;
  margin: 0 0 var(--e5);
}

.ouverture__action {
  margin: 0;
}

.fond {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  background: url("/fond.svg") 62% 0 / cover no-repeat;
}

/* Un voile derrière le texte : le réseau ne gêne jamais la lecture */
.fond::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0, rgba(0, 0, 0, 0.55) 30%, rgba(0, 0, 0, 0.55) 100%);
}

@media (min-width: 900px) {
  .ouverture__texte {
    padding-top: var(--e7);
  }

  .fond::after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.82) 0, rgba(0, 0, 0, 0.66) 44%, rgba(0, 0, 0, 0) 74%);
  }
}

/* « Figer l'animation » : une case à cocher, sans script */
.fige__case {
  position: absolute;
  right: var(--marge);
  bottom: var(--e3);
  z-index: 2;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.fige__nom {
  position: absolute;
  right: var(--marge);
  bottom: var(--e2);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--texte-2);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.fige__nom::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: var(--e2);
  border: 1px solid var(--texte-2);
  border-radius: 2px;
}

.fige__nom:hover {
  color: var(--texte);
}

.fige__case:checked + .fige__nom::before {
  border-color: var(--accent);
  background: var(--accent);
}

.fige__case:focus-visible + .fige__nom {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.fige__case:checked ~ .fond {
  background-image: url("/fond-fixe.svg");
}

/* 6. Bouton principal : plein, texte noir sur vert (thème sombre) */

.bouton {
  display: inline-block;
  min-height: 48px;
  padding: 11px 24px;
  border: 1px solid var(--accent);
  border-radius: var(--rayon);
  background: var(--accent);
  color: var(--sur-accent);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow var(--court) ease, transform var(--court) ease;
}

.bouton:hover {
  color: var(--sur-accent);
  box-shadow: 0 4px 10px var(--halo);
}

.bouton:active {
  transform: translateY(1px);
}

/* 7. Parties : titre numéroté à gauche, colonne de lecture à droite */

main {
  counter-reset: partie;
}

.partie {
  padding-top: var(--e7);
  padding-bottom: var(--e7);
  scroll-margin-top: var(--e3);
  counter-increment: partie;
}

.partie + .partie {
  border-top: 1px solid var(--filet);
}

.partie__corps {
  max-width: var(--colonne);
}

.partie__titre {
  margin: 0 0 var(--e5);
  font-size: 1.6rem;
  line-height: 1.25;
}

.partie__titre::before {
  content: counter(partie, decimal-leading-zero);
  display: block;
  margin-bottom: var(--e2);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.partie__corps > p {
  margin: 0 0 var(--e4);
}

.partie__corps > p:last-child {
  margin-bottom: 0;
}

@media (min-width: 1100px) {
  .partie__cadre {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--colonne));
    column-gap: var(--e6);
    align-items: start;
  }

  .partie__titre {
    position: sticky;
    top: var(--e5);
  }
}

/* 8. Cartes de service */

.carte {
  padding: var(--e4);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-carte);
  background: var(--surface);
  transition: border-color var(--court) ease, box-shadow var(--court) ease;
}

.carte + .carte {
  margin-top: var(--e4);
}

.carte:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 10px var(--halo);
}

.carte h3 {
  margin: 0 0 var(--e3);
  font-size: 1.2rem;
  line-height: 1.3;
}

.carte p {
  margin: 0;
}

/* 9. Méthode : principes numérotés */

.methode {
  counter-reset: principe;
}

.methode > p {
  position: relative;
  padding-left: 44px;
  counter-increment: principe;
}

.methode > p::before {
  content: counter(principe, decimal-leading-zero);
  position: absolute;
  top: 0.4em;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  line-height: 1.6;
}

/* 10. Références */

.references > .reference {
  margin: 0;
  padding: var(--e4) 0;
  border-top: 1px solid var(--filet);
}

.references > .reference:first-child {
  padding-top: 0;
  border-top: 0;
}

.reference strong {
  display: block;
  margin-bottom: var(--e2);
}

.references > .reference + .mention {
  padding-top: var(--e4);
  border-top: 1px solid var(--filet);
}

.mention,
.petit {
  color: var(--texte-2);
  font-size: 0.85rem;
}

/* 11. Contact */

.coordonnees a {
  white-space: nowrap;
}

/* 12. Pied de page */

.pied {
  padding-top: var(--e5);
  padding-bottom: var(--e5);
  border-top: 1px solid var(--filet);
  color: var(--texte-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.7;
}

.pied p {
  margin: 0 0 var(--e2);
}

.pied p:last-child {
  margin-bottom: 0;
}

.pied a {
  display: inline-block;
  padding: 6px 0;
  color: var(--texte);
}

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

/* 13. Pages de texte (mentions légales, page introuvable) */

.page {
  padding-top: var(--e6);
  padding-bottom: var(--e7);
}

.page__corps {
  max-width: var(--colonne);
}

.page h1 {
  margin: 0 0 var(--e5);
  font-family: var(--mono);
  font-size: 2rem;
  line-height: 1.2;
}

.page h2 {
  margin: var(--e6) 0 var(--e3);
  padding-top: var(--e4);
  border-top: 1px solid var(--filet);
  font-size: 1.2rem;
  line-height: 1.3;
}

.page p {
  margin: 0 0 var(--e3);
}

/* 14. Mouvement : court, une seule fois, coupé si le visiteur le demande */

@keyframes frappe {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes curseur-avance {
  from {
    left: 0;
  }

  to {
    left: 100%;
  }
}

@keyframes curseur-clignote {
  50% {
    opacity: 0;
  }
}

@keyframes apparition {
  from {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ouverture__nom span {
    animation: frappe 0.7s steps(7, end) 0.15s both;
  }

  .ouverture__nom::after {
    animation: curseur-avance 0.7s steps(7, end) 0.15s both, curseur-clignote 1s steps(1, end) 0.85s 4;
  }

  .ouverture__titre {
    animation: apparition 0.5s ease-out 0.35s both;
  }

  .ouverture__chapeau {
    animation: apparition 0.5s ease-out 0.5s both;
  }

  .ouverture__action {
    animation: apparition 0.5s ease-out 0.65s both;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .fond {
    background-image: url("/fond-fixe.svg");
  }

  .fige__case,
  .fige__nom {
    display: none;
  }
}

/* 15. Impression : en clair, sans navigation, liens en toutes lettres */

@media print {
  :root,
  .nuit {
    --noir: #fff;
    --fond: #fff;
    --surface: #fff;
    --texte: #000;
    --texte-2: #333;
    --accent: #000;
    --sur-accent: #fff;
    --filet: #999;
    --halo: transparent;
  }

  .evitement,
  .menu,
  .fond,
  .fige__case,
  .fige__nom,
  .bouton {
    display: none;
  }

  .ouverture__texte {
    padding-bottom: var(--e4);
  }

  .partie {
    padding-top: var(--e4);
    padding-bottom: var(--e4);
  }

  .carte {
    break-inside: avoid;
  }

  a {
    text-decoration: none;
  }

  a[href^="https://"]::after {
    content: " (" attr(href) ")";
  }

  a[href^="/mentions"]::after {
    content: " (polaris-cyber.fr" attr(href) ")";
  }
}
