/* ==========================================================================
   Portfolio de Paul Dumiot — feuille de style unique, mobile d'abord.
   Une seule famille de police (Mona Sans) dont on fait varier la largeur :
   très large pour les titres, normale pour le texte.
   L'élément signature est l'éventail-nuancier du haut de page : tout le reste
   reste calme pour laisser parler les exemples.
   ========================================================================== */

@layer tokens, base, layout, components, pages;

/* --- Valeurs de référence : couleurs, typographie, espacements ----------- */
@layer tokens {
  :root {
    --white: #ffffff;
    --mist: #eef1f5;        /* fond des sections alternées */
    --line: #d3d9e3;        /* filets et bordures */
    --ink: #172033;         /* texte, bleu encre */
    --ink-soft: #4a5368;    /* texte secondaire */
    --blue: #2a37d1;        /* outremer : boutons, liens, numéros */
    --blue-deep: #1c2699;   /* outremer au survol */
    --on-blue-soft: #d9ddff;
    --footer-text: #c9d0dc;
    --todo: #fff0a6;        /* surlignage des [À COMPLÉTER] */

    --font: "Mona Sans", "Segoe UI", system-ui, sans-serif;
    --wide: 125%;
    --semi-wide: 112%;
    --narrow: 88%;

    --step--1: 0.875rem;
    --step-0: 1.0625rem;
    --step-1: 1.25rem;
    --step-2: clamp(1.5rem, 1.25rem + 1.1vw, 2rem);
    --step-3: clamp(1.875rem, 1.35rem + 2.4vw, 3.125rem);
    --step-4: clamp(2.6rem, 1.5rem + 5.4vw, 5.75rem);

    --gutter: 1rem;
    --wrap: 76rem;
    --section: clamp(4rem, 3rem + 5vw, 7.5rem);

    --radius-phone: 1.15rem;
    --radius-panel: 0.75rem;
    --shadow-strip: 0 1px 0 rgb(23 32 51 / 0.06), 0 14px 28px -16px rgb(23 32 51 / 0.45);
    --ease-out: cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  @media (min-width: 48rem) {
    :root { --gutter: 2rem; }
  }
}

/* --- Bases ------------------------------------------------------------- */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

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

  body {
    margin: 0;
    background: var(--white);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--step-0);
    font-weight: 430;
    line-height: 1.6;
    font-stretch: 100%;
  }

  h1, h2, h3 {
    margin: 0;
    line-height: 1.05;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--step-4);
    font-stretch: var(--wide);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 0.98;
  }

  h2 {
    font-size: var(--step-3);
    font-stretch: var(--semi-wide);
    font-weight: 760;
    letter-spacing: -0.02em;
  }

  h3 {
    font-size: var(--step-1);
    font-stretch: var(--semi-wide);
    font-weight: 700;
    letter-spacing: -0.01em;
  }

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

  a { color: var(--blue); text-underline-offset: 0.18em; }
  a:hover { color: var(--blue-deep); }

  img { display: block; max-width: 100%; height: auto; }

  ul[role="list"] { list-style: none; margin: 0; padding: 0; }

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

  [id] { scroll-margin-top: 5rem; }

  .todo {
    background: var(--todo);
    color: var(--ink);
    padding: 0.05em 0.3em;
    border-radius: 0.2em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }

  .skip-link {
    position: absolute;
    left: var(--gutter);
    top: -4rem;
    z-index: 20;
    padding: 0.6rem 1rem;
    background: var(--ink);
    color: var(--white);
    border-radius: 0.4rem;
  }
  .skip-link:focus { top: 0.75rem; color: var(--white); }

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

/* --- Mise en page ------------------------------------------------------- */
@layer layout {
  .wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  /* En-tête : le nom à gauche, le bouton de contact toujours visible */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgb(255 255 255 / 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
  }

  .brand {
    color: var(--ink);
    text-decoration: none;
    font-stretch: var(--wide);
    font-weight: 800;
    font-size: var(--step-1);
    letter-spacing: -0.02em;
  }
  .brand:hover { color: var(--ink); }

  .nav-list {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .nav-list a:not(.button) {
    color: var(--ink);
    text-decoration: none;
    font-weight: 560;
  }
  .nav-list a:not(.button):hover { text-decoration: underline; }

  .nav-optional { display: none; }
  @media (min-width: 52rem) {
    .nav-optional { display: list-item; }
  }

  /* Pied de page */
  .site-footer {
    background: var(--ink);
    color: var(--footer-text);
    padding-block: 3rem;
    font-size: var(--step--1);
  }

  .footer-inner { display: grid; gap: 1rem; }

  .footer-brand {
    color: var(--white);
    font-stretch: var(--semi-wide);
    font-weight: 650;
    font-size: var(--step-0);
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .site-footer a { color: var(--white); }
  .site-footer :focus-visible { outline-color: var(--white); }
}

/* --- Composants --------------------------------------------------------- */
@layer components {
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.75rem 1.4rem;
    border-radius: 999px;
    background: var(--blue);
    color: var(--white);
    font-stretch: var(--semi-wide);
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background-color 160ms ease;
  }
  .button:hover { background: var(--blue-deep); color: var(--white); }

  .button-ghost {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 2px var(--ink);
  }
  .button-ghost:hover { background: var(--ink); color: var(--white); }

  .button-small {
    min-height: 2.75rem;
    padding: 0.5rem 1.1rem;
    font-size: 0.9375rem;
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .section-intro {
    max-width: 40rem;
    margin-top: 1rem;
    color: var(--ink-soft);
    font-size: var(--step-1);
    line-height: 1.5;
  }

  /* L'éventail-nuancier : des lames qui pivotent autour d'un même axe */
  .fan {
    --strip-w: 3.3rem;
    --strip-h: 13rem;
    --pivot: 1.35rem;  /* distance de l'axe au bas de la lame */
    position: relative;
    height: calc(var(--strip-h) + 1.75rem);
    margin-top: 2.5rem;
  }

  .fan-strip {
    position: absolute;
    left: calc(50% - var(--strip-w) / 2);
    bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    width: var(--strip-w);
    height: var(--strip-h);
    overflow: hidden;
    border-radius: 0.45rem;
    background: var(--white);
    box-shadow: var(--shadow-strip), inset 0 0 0 1px rgb(23 32 51 / 0.08);
    transform-origin: 50% calc(100% - var(--pivot));
    transform: rotate(var(--a));
    animation: fan-open 1100ms var(--ease-out) both;
    animation-delay: calc(250ms + var(--i) * 55ms);
  }

  .fan-chip { flex: 1 1 0; }

  .fan-foot {
    flex: 0 0 calc(var(--pivot) * 2);
    background: var(--white);
  }

  .fan-pin {
    position: absolute;
    left: 50%;
    bottom: calc(0.75rem + var(--pivot));
    width: 0.8rem;
    height: 0.8rem;
    translate: -50% 50%;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 0 0 3px var(--white), 0 0 0 4px var(--line);
  }

  @keyframes fan-open {
    from { transform: rotate(0deg); }
  }

  /* Animations réduites : l'éventail s'affiche directement ouvert */
  @media (prefers-reduced-motion: reduce) {
    .fan-strip { animation: none; }
  }

  /* Petites pastilles de couleur d'un exemple */
  .swatches {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
  }

  .swatches span {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgb(23 32 51 / 0.18);
  }

  /* Rangée d'exemples : une rangée par style, qui défile horizontalement.
     Elle démarre au bord du texte et déborde à droite pour montrer qu'il y a une suite. */
  .cards-scroller {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-soft) transparent;
  }

  .cards {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 42vw;
    gap: 1rem;
    width: max-content;
    margin: 0;
    padding: 0.25rem max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter))) 1.25rem;
  }

  @media (min-width: 40rem) {
    .cards { grid-auto-columns: 26vw; gap: 1.25rem; }
  }

  @media (min-width: 64rem) {
    .cards-scroller { scroll-snap-type: none; }
    .cards { grid-auto-columns: 11.5rem; gap: 1.5rem; }
  }

  .card { scroll-snap-align: start; }

  .card-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
  }

  .card-screen {
    display: block;
    overflow: hidden;
    aspect-ratio: 780 / 1688;
    border-radius: var(--radius-phone);
    background: var(--mist);
    box-shadow: 0 0 0 1px var(--line);
    transition: box-shadow 160ms ease;
  }

  .card-screen img { width: 100%; }

  .card-link:hover .card-screen { box-shadow: 0 0 0 2px var(--ink); }
  .card-link:hover .card-name { text-decoration: underline; }

  .card-name {
    display: block;
    margin-top: 0.75rem;
    font-stretch: var(--semi-wide);
    font-weight: 680;
    line-height: 1.25;
  }

  .card-trade {
    display: block;
    color: var(--ink-soft);
    font-size: var(--step--1);
  }

  /* Liste à coches (tarifs) */
  .check-list {
    display: grid;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .check-list li {
    position: relative;
    padding-left: 1.75rem;
  }

  .check-list li::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 0.42em;
    width: 0.45rem;
    height: 0.8rem;
    border: solid var(--blue);
    border-width: 0 3px 3px 0;
    rotate: 40deg;
  }
}

/* --- Pages -------------------------------------------------------------- */
@layer pages {
  /* Haut de page */
  .hero { padding-block: clamp(2.5rem, 1.5rem + 5vw, 6rem) clamp(2rem, 1rem + 4vw, 5rem); }

  .hero-text { max-width: 40rem; }

  .lead {
    margin-top: 1.5rem;
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--ink-soft);
  }

  .hero-promise {
    margin-top: 1rem;
    font-stretch: var(--semi-wide);
    font-weight: 700;
    font-size: var(--step-1);
  }

  .hero .actions { margin-top: 2rem; }

  @media (min-width: 40rem) {
    .hero .fan { --strip-w: 4rem; --strip-h: 17rem; }
  }

  @media (min-width: 60rem) {
    .hero-grid {
      display: grid;
      grid-template-columns: 1.1fr 1fr;
      align-items: center;
      gap: 2rem;
    }
    .hero .fan {
      --strip-w: 4.6rem;
      --strip-h: 21rem;
      margin-top: 0;
    }
  }

  /* Les styles */
  .styles {
    padding-block: var(--section);
    background: var(--mist);
  }

  .style-index ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
  }

  .style-index a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: var(--white);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink);
    font-weight: 600;
    font-stretch: var(--semi-wide);
    text-decoration: none;
  }
  .style-index a:hover { box-shadow: inset 0 0 0 2px var(--ink); }

  .family { margin-top: clamp(3rem, 2rem + 3vw, 5rem); }

  .family-head {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
  }

  .family-head h3 {
    padding-top: 1.25rem;
    border-top: 2px solid var(--ink);
    font-size: var(--step-2);
    font-stretch: var(--wide);
    font-weight: 780;
  }

  .family-head p { max-width: 38rem; color: var(--ink-soft); }

  .trades {
    display: grid;
    gap: 0.5rem;
    margin-top: clamp(3rem, 2rem + 3vw, 5rem);
    max-width: var(--wrap);
  }

  .trades p { max-width: 46rem; }

  /* Comment ça se passe : une vraie suite d'étapes, donc numérotée */
  .steps { padding-block: var(--section); }

  .step-list {
    display: grid;
    gap: 2.25rem;
    margin: 2.5rem 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
  }

  .step-list li {
    counter-increment: step;
    display: grid;
    gap: 0.5rem;
    align-content: start;
  }

  .step-list li::before {
    content: counter(step);
    color: var(--blue);
    font-size: var(--step-3);
    font-stretch: var(--wide);
    font-weight: 800;
    line-height: 1;
  }

  .step-list p { color: var(--ink-soft); }

  @media (min-width: 48rem) {
    .step-list { grid-template-columns: repeat(2, 1fr); gap: 2.5rem 3rem; }
  }
  @media (min-width: 72rem) {
    .step-list { grid-template-columns: repeat(4, 1fr); }
  }

  /* Tarifs */
  .pricing {
    padding-block: var(--section);
    background: var(--mist);
  }

  .plans {
    display: grid;
    gap: 1.25rem;
    margin-top: 2.5rem;
  }

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

  .plan {
    display: grid;
    align-content: start;
    gap: 0.75rem;
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
    border-radius: var(--radius-panel);
    background: var(--white);
    box-shadow: 0 0 0 1px var(--line);
  }

  .plan h3 { font-size: var(--step-1); }

  .plan-price {
    font-size: var(--step-4);
    font-stretch: var(--wide);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
  }

  .plan-summary {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
  }

  .pricing-details {
    display: grid;
    gap: 2.5rem;
    margin-top: 3rem;
  }

  @media (min-width: 48rem) {
    .pricing-details { grid-template-columns: repeat(2, 1fr); gap: 3rem; }
  }

  .pricing-details h3 { margin-bottom: 1rem; }

  .option-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line);
  }

  .option-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--line);
  }

  .option-price {
    flex: none;
    font-stretch: var(--semi-wide);
    font-weight: 700;
  }

  .fine-print {
    display: grid;
    gap: 0.4rem;
    max-width: 48rem;
    margin-top: 2.5rem;
    color: var(--ink-soft);
    font-size: var(--step--1);
  }

  /* Qui je suis */
  .about { padding-block: var(--section); }

  .about-grid {
    display: grid;
    gap: 2rem;
    align-items: start;
  }

  @media (min-width: 48rem) {
    .about-grid { grid-template-columns: auto 1fr; gap: 3rem; }
  }

  .monogram {
    display: grid;
    place-items: center;
    width: 7rem;
    aspect-ratio: 1;
    border-radius: 1.75rem;
    background: var(--blue);
    color: var(--white);
    font-size: 2.6rem;
    font-stretch: var(--wide);
    font-weight: 800;
    letter-spacing: -0.04em;
  }

  .about-text { display: grid; gap: 1rem; max-width: 40rem; }
  .about-text h2 { margin-bottom: 0.5rem; }
  .about-text p { color: var(--ink-soft); }
  .about-text h2 + p {
    color: var(--ink);
    font-size: var(--step-1);
    line-height: 1.5;
  }
  .about-link { font-weight: 600; }

  /* Contact */
  .contact {
    padding-block: var(--section);
    background: var(--blue);
    color: var(--white);
  }

  .contact :focus-visible { outline-color: var(--white); }

  .contact-intro {
    max-width: 36rem;
    margin-top: 1rem;
    color: var(--on-blue-soft);
    font-size: var(--step-1);
  }

  .contact-email {
    margin-top: 2rem;
    font-size: var(--step-2);
    font-stretch: var(--semi-wide);
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .contact-email a { color: var(--white); }

  /* Page d'un exemple */
  .example { padding-block: 2rem var(--section); }

  .back a { font-weight: 600; }

  .example-head { display: grid; gap: 1.25rem; }
  .example-head h1 { margin-top: 0.5rem; }

  .example-facts {
    display: grid;
    gap: 0.6rem;
    margin: 0.5rem 0 0;
  }

  .example-facts > div {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
  }

  .example-facts dt { color: var(--ink-soft); }
  .example-facts dd { margin: 0; font-weight: 600; }

  .palette-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-weight: 450;
  }

  .palette-list li { display: inline-flex; align-items: center; gap: 0.4rem; }

  .palette-chip {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgb(23 32 51 / 0.2);
  }

  .example-note {
    max-width: 44rem;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--blue);
    background: var(--mist);
    border-radius: 0 0.4rem 0.4rem 0;
  }

  .example-views {
    display: grid;
    gap: 2rem;
    margin-top: 2.5rem;
    align-items: start;
  }

  .view { margin: 0; }

  .view figcaption {
    margin-bottom: 0.75rem;
    font-stretch: var(--semi-wide);
    font-weight: 700;
  }

  .frame {
    overflow: hidden;
    background: var(--mist);
    box-shadow: 0 0 0 1px var(--line), 0 24px 48px -32px rgb(23 32 51 / 0.5);
  }

  .frame img { width: 100%; }

  .frame-phone {
    max-width: 24.375rem;
    border-radius: 1.5rem;
  }

  .frame-desktop { border-radius: 0.6rem; }

  .only-wide { display: none; }

  .view-details summary {
    display: inline-flex;
    align-items: center;
    min-height: 3rem;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    box-shadow: inset 0 0 0 2px var(--ink);
    font-stretch: var(--semi-wide);
    font-weight: 650;
    cursor: pointer;
  }

  .view-details[open] summary { margin-bottom: 1rem; }

  @media (min-width: 64rem) {
    .example-views {
      grid-template-columns: minmax(18rem, 22rem) 1fr;
      gap: 3rem;
    }
    .only-wide { display: block; }
    .only-narrow { display: none; }
  }

  .example-cta {
    display: grid;
    gap: 1rem;
    margin-top: 3rem;
  }

  .example-cta-text {
    font-size: var(--step-2);
    font-stretch: var(--wide);
    font-weight: 780;
  }

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

  .related h2 {
    margin-bottom: 2rem;
    font-size: var(--step-2);
  }

  /* Pages légales et 404 */
  .legal,
  .not-found {
    max-width: 46rem;
    padding-block: 3rem var(--section);
  }

  .legal h2 {
    margin: 2.5rem 0 0.75rem;
    font-size: var(--step-1);
  }

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

  .not-found { display: grid; gap: 1.5rem; }

  /* Image de partage (1200 × 630), capturée par outils/capturer.mjs */
  .share-page { background: var(--white); }

  .share-card {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    width: 1200px;
    height: 630px;
    padding: 0 40px 0 80px;
    overflow: hidden;
  }

  .share-title {
    font-size: 84px;
    font-stretch: var(--wide);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 0.98;
  }

  .share-sub {
    margin-top: 32px;
    font-size: 30px;
    font-stretch: var(--semi-wide);
    font-weight: 650;
    line-height: 1.3;
  }

  .share-meta {
    margin-top: 20px;
    color: var(--ink-soft);
    font-size: 24px;
  }

  .share-card .fan {
    --strip-w: 74px;
    --strip-h: 360px;
    margin-top: 0;
  }

  .share-card .fan-strip { animation: none; }
}
