@import url("./base.css");

/* ==========================================================
   Page d'accueil
   ========================================================== */

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

.hero {
  position: relative;
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding: 5rem 0 4.5rem;
}
/* Empêche tout débordement horizontal (cause du dézoom sur mobile) */
main { overflow-x: clip; }

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  z-index: -1;
  background-image: radial-gradient(var(--grid-dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 70%, transparent);
}
.hero h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(4rem, 16vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  margin: 0;
}

.topo {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  color: var(--line-strong);
  overflow: visible;
}
.topo line { stroke: currentColor; stroke-width: 1.5; }
.topo line.hot {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 6 10;
  animation: flux 1.2s linear infinite;
}
.topo circle.node {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
}
.topo circle.hot {
  fill: var(--accent);
  stroke: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes flux { to { stroke-dashoffset: -32; } }
@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 8px var(--accent)); }
}

@media (min-width: 52rem) {
  .hero {
    grid-template-columns: auto 1fr;
    gap: 4rem;
    padding: 7rem 0 6rem;
  }
  .topo { justify-self: end; }
}

/* ---------- Sections (grille suisse : titre à gauche, contenu à droite) ---------- */

section {
  padding: 4rem 0;
  border-top: 1px solid var(--line);
}
section[id] { scroll-margin-top: 5.5rem; }

section h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
}
section p { margin: 0 0 1.1rem; max-width: 40rem; }
#a-propos p { font-size: 1.125rem; color: var(--ink); }

@media (min-width: 60rem) {
  section:not(#contact) {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    column-gap: 3rem;
    align-items: start;
  }
  section:not(#contact) > h2 {
    grid-column: 1;
    grid-row: 1 / span 10;
    position: sticky;
    top: 6.5rem;
  }
  section:not(#contact) > :not(h2) { grid-column: 2; }
}

/* ---------- Cadres (cartes) ---------- */

.cadre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0 0 1.5rem;
}
.cadre:last-child { margin-bottom: 0; }
.cadre > h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.cadre > h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

@media (min-width: 40rem) {
  .cadre { padding: 2rem; }
}

/* ---------- Parcours (frise chronologique) ---------- */

.parcours {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.parcours li {
  position: relative;
  display: grid;
  gap: 0.2rem;
  padding: 0 0 1.75rem 1.75rem;
}
.parcours li:last-child { padding-bottom: 0; }
.parcours li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.parcours li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 25px;
  bottom: -1px;
  width: 2px;
  background: var(--line);
}
.parcours li:last-child::after { display: none; }

.parcours .periode {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.parcours .intitule {
  display: block;
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.4;
}
.parcours .lieu {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

@media (min-width: 44rem) {
  .parcours li {
    grid-template-columns: 11rem 1fr;
    column-gap: 1.5rem;
  }
}

/* ---------- Groupes de connaissances / compétences ---------- */

.cadre .groupe {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.cadre > h3 + .groupe { border-top: none; padding-top: 0; }
.cadre .groupe:last-child { padding-bottom: 0; }

.groupe .nom {
  font-weight: 600;
  font-size: 1.08rem;
  margin: 0 0 0.25rem;
}
.groupe .desc {
  color: var(--muted);
  font-size: 0.97rem;
  margin: 0 0 0.85rem;
}
.groupe .desc:last-child { margin-bottom: 0; }

@media (min-width: 48rem) {
  .cadre:has(.groupe) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .cadre:has(.groupe) > h3 { grid-column: 1 / -1; }
  .cadre .groupe,
  .cadre > h3 + .groupe {
    padding: 1.25rem 1.5rem 1.25rem 0;
    border-top: 1px solid var(--line);
  }
  .cadre .groupe:nth-of-type(odd) { padding-left: 0; }
  .cadre .groupe:nth-of-type(even) {
    padding-left: 1.5rem;
    padding-right: 0;
    border-left: 1px solid var(--line);
  }
  .cadre > h3 + .groupe,
  .cadre > h3 + .groupe + .groupe { border-top: none; padding-top: 0; }
  .cadre .groupe:last-child { padding-bottom: 1.25rem; }
  .cadre .groupe:nth-last-of-type(-n + 2) { padding-bottom: 0; }
}

.tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tags li {
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--ink);
}

/* ---------- Articles ---------- */

.articles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.articles a {
  position: relative;
  display: grid;
  gap: 0.35rem;
  padding: 1.4rem 3.5rem 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.articles a::after {
  content: "";
  position: absolute;
  right: 1.5rem;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: -0.55rem;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.articles a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.articles a:hover::after {
  background: var(--accent);
  transform: translate(2px, -2px);
}
.articles time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.articles .title {
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.35;
  transition: color 0.2s var(--ease);
}
.articles a:hover .title { color: var(--accent); }
.articles .summary { color: var(--muted); font-size: 0.97rem; }

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

#contact {
  display: flex;
  justify-content: center;
  padding: 4rem 0 6rem;
}
#contact .btn {
  min-height: 3.5rem;
  padding: 1rem 2.25rem;
  font-size: 1.08rem;
}

/* ---------- Apparition au défilement ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js .reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .topo line.hot, .topo circle.hot { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
}
