/* ============================================================
   Portfolio Tony Sanchez. Pixel premium, thème sombre verrouillé,
   accent unique orange foncé (famille Mistral AI).
   Coins crantés 8px partout, aucun arrondi, aucun curseur custom.
   ============================================================ */

:root {
  --bg: #14110c;
  --surface: #1c1812;
  --surface-2: #262017;
  --ink: #f2e9dc;
  --muted: #a89d8a;
  --orange: #ff7a00;
  --orange-deep: #cc5c00;
  --line: #3a332a;
  --font-pixel: "Press Start 2P", monospace;
  --font-body: "Satoshi", system-ui, sans-serif;
  /* coins crantés 8px : le "rayon pixel" du site */
  --notch: polygon(
    0 8px, 8px 8px, 8px 0,
    calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px)
  );
  /* variante : crantage bas uniquement (nav suspendue au bord haut) */
  --notch-bottom: polygon(
    0 0, 100% 0,
    100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px)
  );
}

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

html, body { overflow-x: clip; }

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(242, 233, 220, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 233, 220, 0.022) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul { margin: 0; }
a { color: inherit; }

::selection { background: var(--orange); color: var(--bg); }

/* ---------- Boutons pixel ---------- */

.pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.95rem 1.6rem;
  color: var(--bg);
  background: var(--orange);
  clip-path: var(--notch);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
}
.pbtn:hover { background: var(--orange-deep); transform: translate(0, -2px); }
.pbtn:active { transform: translate(0, 2px); }

.pbtn--ghost {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 3px var(--line);
}
.pbtn--ghost:hover { background: var(--line); }

.pbtn--sm { padding: 0.6rem 1.1rem; font-size: 0.9rem; }

/* ---------- Navigation : suspendue au bord haut, centrée ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.8rem 1rem 0.8rem 1.5rem;
  background: rgba(28, 24, 18, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  clip-path: var(--notch-bottom);
  box-shadow: inset 0 -3px 0 0 var(--line), inset 3px 0 0 0 var(--line), inset -3px 0 0 0 var(--line);
}

.nav__logo {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.nav__logo span { color: var(--orange); }

.nav__links { display: flex; gap: 1.6rem; }
.nav__links a {
  font-size: 0.98rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav__links a:hover { color: var(--ink); }

@media (max-width: 720px) {
  /* barre pleine largeur : logo à gauche, contact à droite */
  .nav {
    left: 0;
    right: 0;
    transform: none;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem max(1rem, env(safe-area-inset-right)) 0.7rem max(1.1rem, env(safe-area-inset-left));
    clip-path: none;
    box-shadow: inset 0 -3px 0 0 var(--line);
  }
  .nav__links { display: none; }
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 6rem clamp(1.25rem, 4vw, 3rem) 3rem;
}

.hero__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.hero__role {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--orange);
  margin-bottom: 1.75rem;
}

.hero__title {
  font-family: var(--font-pixel);
  font-size: clamp(2.1rem, 6.5vw, 4.3rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-shadow: 5px 5px 0 rgba(204, 92, 0, 0.55);
}

.hero__sub {
  margin-top: 1.75rem;
  max-width: 32rem;
  font-size: 1.15rem;
  color: var(--muted);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.25rem;
}

/* Portrait pixel (généré par script.js) */

.hero__art {
  display: grid;
  --tile: clamp(7px, 0.9vw, 10px);
  grid-template-columns: repeat(36, var(--tile));
  grid-auto-rows: var(--tile);
  gap: 1px;
  justify-content: center;
}

.hero__art .px {
  background: var(--c, var(--surface-2));
  transition: filter 0.5s ease, transform 0.5s ease;
}
.hero__art .px.lit {
  filter: brightness(1.7) saturate(1.15);
  transform: scale(1.25);
}

/* révélation : chaque pixel apparaît en vague diagonale (--d posé par le JS) */
.hero__art.px-anim .px {
  opacity: 0;
  transform: scale(0.2);
}
.hero__art.px-in .px {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s),
    filter 0.5s ease;
}

@media (max-width: 860px) {
  .hero {
    min-height: auto;
    padding-top: 7rem;
    padding-bottom: 4rem;
  }
  .hero__inner { grid-template-columns: 1fr; }
  /* tablette : le portrait passe sous le texte */
  .hero__art {
    --tile: 9px;
    justify-content: start;
    margin-top: 2.75rem;
  }
}

@media (max-width: 560px) {
  .hero { padding-top: 6.5rem; padding-bottom: 3.5rem; }
  /* téléphone : portrait adapté à la largeur de l'écran */
  .hero__art {
    --tile: min(9px, calc((100vw - 2.5rem - 35px) / 36));
    margin-top: 2.25rem;
  }
  .hero__role { font-size: 0.62rem; margin-bottom: 1.4rem; }
  .hero__title {
    font-size: clamp(1.9rem, 9.5vw, 2.4rem);
    text-shadow: 4px 4px 0 rgba(204, 92, 0, 0.55);
  }
  .hero__sub { font-size: 1.05rem; margin-top: 1.4rem; }
  .hero__cta { margin-top: 2rem; }
  .hero__cta .pbtn { width: 100%; }
}

/* ---------- Sections génériques ---------- */

.section-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.15rem, 3.2vw, 1.9rem);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 1rem;
}
/* puce : petit escalier de 3 pixels orange */
.section-title::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--orange);
  box-shadow: 8px -8px 0 0 var(--orange-deep), 16px -16px 0 0 rgba(204, 92, 0, 0.45);
  margin-top: 16px;
}

.section-body {
  margin-top: 1.25rem;
  max-width: 36rem;
  font-size: 1.12rem;
  color: var(--muted);
}

.skills, .path, .certs, .contact {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(4.5rem, 11vh, 8rem) clamp(1.25rem, 4vw, 3rem);
}

/* ---------- Compétences : trois domaines ---------- */

.skills__grid {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.domain {
  background: var(--surface);
  clip-path: var(--notch);
  box-shadow: inset 0 0 0 3px var(--line);
  padding: 2.25rem 2rem;
}

.domain__px {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--orange);
  box-shadow: 14px 0 0 0 var(--orange-deep), 28px 0 0 0 rgba(204, 92, 0, 0.4);
  margin-bottom: 1.75rem;
}

.domain h3 {
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  line-height: 1.6;
}

.domain p {
  margin-top: 0.9rem;
  font-size: 1.02rem;
  color: var(--muted);
}

.chips {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chips li {
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--line);
}

/* carte accent : l'orange en pleine surface */
.domain--accent {
  background: linear-gradient(160deg, var(--orange), var(--orange-deep));
  box-shadow: none;
  color: var(--bg);
}
.domain--accent .domain__px {
  background: var(--bg);
  box-shadow: 14px 0 0 0 rgba(20, 17, 12, 0.6), 28px 0 0 0 rgba(20, 17, 12, 0.3);
}
.domain--accent p { color: rgba(20, 17, 12, 0.78); }
.domain--accent .chips li {
  background: rgba(20, 17, 12, 0.16);
  box-shadow: inset 0 0 0 2px rgba(20, 17, 12, 0.32);
  color: var(--bg);
}

@media (max-width: 960px) {
  .skills__grid { grid-template-columns: 1fr; }
}

/* ---------- Parcours : lignes datées ---------- */

.path__list {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
}

.step {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  padding: 2.25rem 0;
  border-top: 3px solid var(--line);
}
.path__list .step:last-child { border-bottom: 3px solid var(--line); }

.step__when {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.step__date {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: var(--orange);
}
.step__until {
  font-size: 0.95rem;
  color: var(--muted);
}

.step__what h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.step__what p {
  margin-top: 0.7rem;
  max-width: 42rem;
  color: var(--muted);
}

.step--next .step__what h3::after {
  content: "en préparation";
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--orange);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--orange-deep);
  padding: 0.45rem 0.6rem;
  margin-left: 0.9rem;
  vertical-align: middle;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .step { grid-template-columns: 1fr; gap: 0.9rem; padding: 1.75rem 0; }
  .step__when { flex-direction: row; align-items: baseline; gap: 0.75rem; }
}

/* ---------- Certifications ---------- */

.certs__grid {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.cert {
  position: relative;
  background: var(--surface);
  clip-path: var(--notch);
  box-shadow: inset 0 0 0 3px var(--line);
  padding: 1.9rem 1.75rem 1.7rem;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}
.cert:hover {
  transform: translate(0, -4px);
  box-shadow: inset 0 0 0 3px var(--orange-deep);
}

.cert::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: var(--orange);
  margin-bottom: 1.25rem;
}

.cert h3 {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
}
.cert p {
  margin-top: 0.5rem;
  font-size: 0.98rem;
  color: var(--muted);
}

.cert--next { background: transparent; }
.cert--next::before { background: var(--muted); }
.cert__tag {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--orange);
}

@media (max-width: 960px) {
  .certs__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .certs__grid { grid-template-columns: 1fr; }
}

/* ---------- Contact ---------- */

.contact__title {
  font-family: var(--font-pixel);
  font-size: clamp(1.8rem, 6.5vw, 4rem);
  line-height: 1.3;
  color: var(--orange);
  text-shadow: 6px 6px 0 rgba(204, 92, 0, 0.3);
}

.contact__body {
  margin-top: 1.75rem;
  max-width: 34rem;
  font-size: 1.15rem;
  color: var(--muted);
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.5rem;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 3px solid var(--line);
  padding: 2rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  color: var(--muted);
}
.footer__sub { margin-top: 0.3rem; font-size: 0.92rem; opacity: 0.75; }

/* ---------- Ajustements téléphone ---------- */

@media (max-width: 640px) {
  body { font-size: 1rem; }

  .skills, .path, .certs, .contact {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
  .skills__grid, .certs__grid, .path__list { margin-top: 2.25rem; }
  .section-body { font-size: 1.04rem; margin-top: 1rem; }

  .domain { padding: 1.75rem 1.4rem; }
  .domain__px { margin-bottom: 1.4rem; }
  .cert { padding: 1.5rem 1.3rem 1.4rem; }

  .step { padding: 1.5rem 0; }
  .step__what h3 { font-size: 1.18rem; }
  /* le badge passe sous le titre au lieu de déborder à droite */
  .step--next .step__what h3::after {
    display: block;
    width: fit-content;
    margin: 0.7rem 0 0;
  }

  .contact__title { text-shadow: 4px 4px 0 rgba(204, 92, 0, 0.3); }
  .contact__body { margin-top: 1.4rem; }
  .contact__actions { margin-top: 2rem; }
  .contact__actions .pbtn { width: 100%; }

  .footer {
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }
}

/* ---------- Révélations au scroll ---------- */

@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
  html.js .reveal.on {
    opacity: 1;
    transform: translateY(0);
  }
}
