/* ==========================================================================
   bancel.org
   Palette : indigo « éléphant PHP » + ocre pour le fil qui relie le besoin à l’application.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --paper: #f6f6fb;
  --tint: #ecedf8;
  --ink: #1c1d4a;
  --ink-soft: #4d4f7c;
  --indigo: #3a3e9e;
  --rule: #c9cbee;
  --ochre: #d9952b;
  --panel: #1c1d4a;
  --panel-text: #edeefa;
  --panel-soft: #a3a6d8;
  --panel-rule: rgb(255 255 255 / 0.12);

  --font-sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Échelle typographique : 14 / 17-18 / 21 / 30-36 / 36-60 */
  --step--1: 0.875rem;
  --step-0: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
  --step-1: 1.3125rem;
  --step-3: clamp(1.875rem, 1.4rem + 1.6vw, 2.25rem);
  --step-4: clamp(2.25rem, 1.3rem + 3.6vw, 3.75rem);

  --gutter: clamp(1rem, 4vw, 2rem);
  --section: clamp(4rem, 3rem + 5vw, 7rem);
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12133a;
    --tint: #1a1b47;
    --ink: #e8e9f8;
    --ink-soft: #a9acd9;
    --indigo: #b3b7ff;
    --rule: #34367a;
    --ochre: #e8a84a;
    --panel: #0a0b26;
  }
}

/* Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h2 {
  font-size: var(--step-3);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--step-1);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

p + p {
  margin-top: 1em;
}

a {
  color: var(--indigo);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Sur fond indigo, l'indigo ne se voit plus : on passe à l'ocre */
.needs :focus-visible {
  outline-color: var(--ochre);
}

.container {
  width: 100%;
  max-width: 74rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  top: 1rem;
}

/* En-tête
   ========================================================================== */

.site-header {
  padding-block: 1.25rem;
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Le fil du hero, en miniature */
.wordmark::before {
  content: "";
  width: 1.5rem;
  height: 8px;
  background:
    radial-gradient(circle at 4px 50%, var(--indigo) 3px, transparent 3.5px) no-repeat,
    radial-gradient(circle at calc(100% - 4px) 50%, var(--ochre) 3px, transparent 3.5px) no-repeat,
    linear-gradient(var(--ochre), var(--ochre)) center / calc(100% - 8px) 2px no-repeat;
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--indigo);
  text-decoration: underline;
}

@media (max-width: 30rem) {
  .site-nav ul {
    gap: 1.25rem;
  }
}

/* Hero
   ========================================================================== */

.hero {
  padding-block: clamp(2.5rem, 1.5rem + 5vw, 6rem) var(--section);
}

.hero__grid {
  display: grid;
  gap: 2.5rem;
}

.hero h1 {
  max-width: 30ch;
  font-size: var(--step-4);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.hero h1 span {
  display: block;
}

.hero__lede {
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.5;
}

@media (min-width: 60rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(2.5rem, 5vw, 5rem);
    row-gap: 3.5rem;
    align-items: start;
  }

  .hero h1 {
    grid-column: 1 / -1;
  }

  .hero__intro {
    padding-top: 0.5rem;
  }
}

/* Du besoin à l'application (hero)
   ========================================================================== */

.needs {
  margin: 0;
  padding: clamp(1.25rem, 0.9rem + 1.5vw, 2rem);
  border-radius: 0.875rem;
  background: var(--panel);
  color: var(--panel-text);
}

.needs__legend,
.needs__map > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
}

.needs__legend {
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--panel-rule);
  color: var(--panel-soft);
  font-size: 0.8125rem;
}

.needs__legend span:last-child {
  grid-column: 3;
}

.needs__map {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.needs__map > div {
  align-items: start;
  padding-block: 1rem;
}

.needs__map > div + div {
  border-top: 1px solid var(--panel-rule);
}

.needs__map dt {
  grid-column: 1;
  grid-row: 1;
  color: var(--panel-soft);
}

.needs__map dd {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  font-weight: 600;
}

.needs__project {
  display: block;
  width: fit-content;
  margin-top: 0.25rem;
  color: var(--panel-soft);
  font-size: 0.8125rem;
  font-weight: 400;
}

.needs__project:hover {
  color: var(--panel-text);
}

/* Le fil qui relie le besoin à ce qui a été développé, centré sur la première ligne */
.needs__map > div::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  height: 8px;
  margin: calc(0.7em - 4px) 0.5rem 0;
  background:
    radial-gradient(circle at 4px 50%, var(--panel-soft) 2.5px, transparent 3px) no-repeat,
    radial-gradient(circle at calc(100% - 4px) 50%, var(--ochre) 3px, transparent 3.5px) no-repeat,
    linear-gradient(var(--ochre), var(--ochre)) center / calc(100% - 8px) 1.5px no-repeat;
  transform-origin: left center;
}

.needs figcaption {
  padding-top: 1rem;
  border-top: 1px solid var(--panel-rule);
  color: var(--panel-soft);
  font-size: var(--step--1);
  line-height: 1.5;
}

@media (max-width: 35.99rem) {
  .needs__legend {
    display: none;
  }

  .needs__map > div {
    grid-template-columns: 1.25rem minmax(0, 1fr);
    row-gap: 0.375rem;
  }

  .needs__map > div:first-child {
    padding-top: 0;
  }

  .needs__map dt {
    grid-column: 2;
  }

  .needs__map dd {
    grid-column: 2;
    grid-row: 2;
  }

  /* Le fil devient vertical : du besoin jusqu'à la première ligne de la réponse */
  .needs__map > div::before {
    grid-column: 1;
    justify-self: center;
    align-self: stretch;
    width: 8px;
    height: auto;
    margin: calc(0.7em - 4px) 0 calc(-0.375rem - 0.7em - 4px);
    background:
      radial-gradient(circle at 50% 4px, var(--panel-soft) 2.5px, transparent 3px) no-repeat,
      radial-gradient(circle at 50% calc(100% - 4px), var(--ochre) 3px, transparent 3.5px) no-repeat,
      linear-gradient(var(--ochre), var(--ochre)) center / 1.5px calc(100% - 8px) no-repeat;
    transform-origin: center top;
  }
}

/* Le seul moment animé de la page : les fils se tracent un par un au chargement */
@media (prefers-reduced-motion: no-preference) {
  .needs__map > div::before {
    animation: wire-x 0.55s cubic-bezier(0.3, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 140ms + 250ms);
  }

  .needs__map dd {
    animation: arrive 0.45s ease-out both;
    animation-delay: calc(var(--i, 0) * 140ms + 600ms);
  }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 35.99rem) {
  .needs__map > div::before {
    animation-name: wire-y;
  }
}

@keyframes wire-x {
  from {
    transform: scaleX(0);
  }
}

@keyframes wire-y {
  from {
    transform: scaleY(0);
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateX(-0.5rem);
  }
}

/* Sections
   ========================================================================== */

.section {
  padding-block: var(--section);
}

.section--tinted {
  background: var(--tint);
}

.section__head {
  max-width: 40rem;
  margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
}

.section__head p {
  margin-top: 1rem;
  color: var(--ink-soft);
}

.split {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 60rem) {
  .split {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 4rem;
  }

  .split__aside {
    position: sticky;
    top: 2rem;
    align-self: start;
  }
}

/* Réalisations */

.projects {
  display: grid;
  gap: 3rem 4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project {
  padding-top: 1.5rem;
  border-top: 3px solid var(--indigo);
}

.project__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.project__head a {
  font-size: 0.9375rem;
}

.project > p {
  margin-top: 0.75rem;
}

.project__facts {
  display: grid;
  gap: 0.875rem;
  margin: 1.25rem 0 0;
  font-size: 0.9375rem;
}

.project__facts dt,
.toolbox dt {
  font-weight: 700;
}

.project__facts dd,
.toolbox dd {
  margin: 0.125rem 0 0;
  color: var(--ink-soft);
}

/* À propos */

.about {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 60rem) {
  .about {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 3.5rem;
  }
}

.about__text p {
  max-width: 60ch;
  line-height: 1.65;
}

.toolbox {
  display: grid;
  gap: 1.25rem;
  margin: 0;
}

/* Pied de page
   ========================================================================== */

.site-footer {
  padding-block: 2rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.site-footer a {
  color: inherit;
}

/* Mentions légales
   ========================================================================== */

.legal {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) var(--section);
}

.legal h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.legal h2 {
  margin-top: 3rem;
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.legal p {
  max-width: 65ch;
}

.legal h2 + p {
  margin-top: 0.75rem;
}
