/* =========================================================================
   pierredopa.com — feuille de style principale
   Design handoff haute fidélité intégré dans la structure du repo.
   Esprit : fond blanc, Poppins/Mulish, marques dessinées, projets alternés,
   canvas « chaos ». Complété par des styles pour les pages intérieures
   (articles, projets listing, outils).
   ========================================================================= */

/* =========================================================================
   1. Design tokens
   ========================================================================= */
:root {
  --ink:   #14181f;
  --gray:  #8b9099;
  --bg:    #ffffff;
  --line:  #ececef;

  --blue:  #8bc1f2;   /* lasso hero */
  --red:   #fb8181;   /* gribouillis hero */
  --mint:  #34c2a8;   /* tampon "ennuyeux" */

  --btn:       #f1f2f4;
  --btn-hover: #e6e8eb;

  --maxw: 1280px;
  --pad:  clamp(20px, 5vw, 64px);

  --font-display: "Poppins", system-ui, sans-serif;
  --font-body:    "Mulish",  system-ui, sans-serif;
  --font-hand:    "Caveat",  cursive;
}

/* =========================================================================
   2. Reset minimal
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.1; }
p   { margin: 0; }

/* =========================================================================
   3. Structure partagée
   ========================================================================= */
/* Le contenu passe au-dessus du canvas de gribouillage (home) */
#contentContainer { position: relative; z-index: 2; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

/* =========================================================================
   4. Nav — home (chaos toggle) et pages intérieures (via layout.js)
   ========================================================================= */
.nav { padding-top: clamp(24px, 4vh, 40px); }
.nav-inner {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.brand {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(22px, 2.4vw, 29px); letter-spacing: -.01em;
}

/* Nav pages intérieures */
.site-nav-links { display: flex; gap: clamp(20px, 3vw, 36px); align-items: center; }
.site-nav-links a {
  font-family: var(--font-display); font-weight: 500;
  font-size: 15px; color: var(--gray);
  transition: color .18s;
}
.site-nav-links a:hover,
.site-nav-links a[aria-current="page"] { color: var(--ink); }

/* =========================================================================
   5. Hero
   ========================================================================= */
.hero {
  min-height: 80vh; display: flex; align-items: center;
  padding: clamp(40px, 8vh, 80px) 0;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 5vw, 60px); align-items: center; width: 100%;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-headline {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(20px, 2.2vw, 30px); line-height: 1.55;
  letter-spacing: -.015em;
}

/* Marques dessinées */
.mark { position: relative; white-space: nowrap; display: inline; }
.mark svg { position: absolute; pointer-events: none; overflow: visible; }
.mark-lasso { margin-right: .35em; }
.mark-lasso svg { left: -14px; right: -14px; top: -8px; bottom: -8px; width: calc(100% + 28px); height: calc(100% + 16px); }
.mark-squiggle svg { left: 0; right: 0; bottom: -14px; width: 100%; height: 16px; }
.lasso-path   { stroke: var(--blue); stroke-width: 3;   fill: none; stroke-linecap: round; }
.squiggle-path { stroke: var(--red);  stroke-width: 3.4; fill: none; stroke-linecap: round; }

.hero-desc {
  margin-top: clamp(32px, 5vh, 52px); font-size: clamp(18px, 1.6vw, 22px);
  color: var(--gray); line-height: 1.65;
}
.hero-desc a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: color .18s; }
.hero-desc a:hover   { color: var(--blue); }
.hero-desc a.tw:hover { color: var(--mint); }

.hero-art { display: flex; justify-content: flex-end; align-items: center; }
.hero-art img { width: 100%; max-width: 100%; object-fit: contain; }
img:not([src]), img[src=""] { background: #f1f2f4; }

/* ---- Mobile ---- */
@media (max-width: 860px) {
  /* Titre centré et plus grand */
  .nav { padding-top: 20px; padding-bottom: 4px; }
  .nav-inner { justify-content: center; }
  .brand { font-size: 26px; }

  /* Moins d'écart entre titre et image */
  .hero { padding: 14px 0 40px; min-height: unset; }

  /* Image en premier, +20% */
  .hero-art  { order: -1; justify-content: center; }
  .hero-text { order:  0; }
  .hero-art img { max-width: 370px; }

  /* Headline et description pleine largeur */
  .hero-headline { font-size: clamp(22px, 6vw, 29px); }
  .hero-desc     { font-size: 18px; }
}

/* =========================================================================
   6. Sections génériques
   ========================================================================= */
.section { padding: clamp(28px, 5vh, 52px) 0; }
section[id], div[id].section { scroll-margin-top: 30px; }

/* =========================================================================
   7. Projets — cartes alternées (home)
   ========================================================================= */
/* ---- Section outils ---- */
.tools-section {
  padding: clamp(40px, 7vh, 72px) 0 clamp(16px, 3vh, 28px);
}
.section-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.015em;
  margin-bottom: clamp(20px, 3vh, 32px);
}
.tools-grid {
  display: flex;
  gap: clamp(10px, 2.5vw, 18px);
  max-width: 440px;
  margin: 0 auto;
}
.tools-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.5vw, 18px);
}
.tools-col--offset { padding-top: clamp(24px, 4vw, 40px); }

.tool-card {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: #f1f2f4;
  text-decoration: none;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s;
}
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 16px 40px -10px rgba(20,24,31,.18); }
.tool-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tool-card-ph { width: 100%; height: 100%; }

/* ---- Titre partagé projets/outils ---- */
.projects-title { /* déjà défini inline dans renderProjects */ }

/* ---- Section projets : carrousel unique ---- */
.projects {
  padding: clamp(32px, 6vh, 64px) 0;
}

/* Carrousel centré, portrait 4:5, max 440px */
.projects-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.015em;
  margin-bottom: clamp(18px, 3vh, 28px);
  padding-inline: var(--pad);
}

.carousel {
  position: relative;
  width: 90%;
  max-width: 396px;
  margin: 0 auto;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 18px;
  cursor: grab;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track.is-dragging { cursor: grabbing; }

.carousel-slide {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  overflow: hidden;
  background: #f1f2f4;
  display: block;
  text-decoration: none;
}
.carousel-slide img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.carousel-placeholder {
  width: 100%; height: 100%;
}

/* Flèches — desktop uniquement */
.carousel-arrow {
  display: none;
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px;
  background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 50%; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--ink); z-index: 2;
  align-items: center; justify-content: center; padding: 0;
  box-shadow: 0 2px 10px rgba(20,24,31,.14);
  transition: opacity .18s, box-shadow .18s;
}
.carousel-arrow:hover { opacity: 1; box-shadow: 0 4px 16px rgba(20,24,31,.2); }
.carousel-arrow.prev { left: -50px; }
.carousel-arrow.next { right: -50px; }
@media (min-width: 620px) { .carousel-arrow { display: flex; opacity: .7; } }

/* Dots */
.carousel-dots {
  display: flex; justify-content: center; gap: 7px; margin-top: 14px;
}
.carousel-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); cursor: pointer;
  transition: background .2s, transform .2s;
}
.carousel-dot.active { background: var(--ink); transform: scale(1.3); }

/* Bouton pilule */
.btn {
  margin-top: 6px; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 500; font-size: 16px;
  background: var(--btn); color: var(--ink);
  padding: 13px 26px; border-radius: 999px; border: 0; cursor: pointer;
  text-decoration: none;
  transition: background .18s, transform .18s;
}
.btn:hover { background: var(--btn-hover); transform: translateY(-2px); }
.btn.inactive { color: var(--gray); cursor: default; }
.btn.inactive:hover { background: var(--btn); transform: none; }

/* =========================================================================
   8. À propos
   ========================================================================= */
.about-head { position: relative; display: inline-block; margin-bottom: 40px; }
.about-head h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -.015em; }
.about-stamp {
  position: absolute; top: -28px; left: calc(100% - 6px);
  font-family: var(--font-hand); color: var(--mint);
  font-size: 40px; font-weight: 700; transform: rotate(-9deg); white-space: nowrap;
}
.about-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 5vw, 70px); }
@media (max-width: 720px) { .about-cols { grid-template-columns: 1fr; gap: 22px; } }
.about-cols p { font-size: clamp(17px, 1.4vw, 20px); color: var(--gray); line-height: 1.6; }
.about-cols a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================================
   9. Contact
   ========================================================================= */
.contact { padding: clamp(16px, 3vh, 36px) 0; }
.contact h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.015em; }
.contact a { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; transition: color .18s; }
.contact a:hover { color: var(--blue); }

/* =========================================================================
   10. Footer
   ========================================================================= */
.footer { padding: clamp(30px, 5vh, 60px) 0 clamp(24px, 4vh, 40px); }
.footer p { font-size: 15px; color: var(--gray); line-height: 1.6; }
.footer a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* =========================================================================
   11. Pages intérieures — articles, outils, listing projets
   ========================================================================= */

/* En-tête et pied de page injectés par layout.js sur les pages intérieures */
#site-header { border-bottom: 1px solid var(--line); }
#site-footer  { border-top:    1px solid var(--line); }

/* Zone de contenu principale des pages intérieures (outils, listing) */
.inner-main {
  padding-block: clamp(40px, 8vh, 80px);
  min-height: 60vh;
}

/* ---- Page article ---- */
.art-page {
  max-width: 900px;
  margin: 0 auto;
  padding-inline: clamp(22px, 5vw, 56px);
}

/* Nav article */
.art-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(24px, 4vh, 40px) 0 0;
}
.art-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 15px;
  font-weight: 600; color: var(--gray); transition: color .18s;
}
.art-back:hover { color: var(--ink); }
.art-back:hover .art-arr { transform: translateX(-3px); }
.art-arr { display: inline-block; transition: transform .18s; }
.art-brand {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
}

/* Header article */
.art-head { padding: clamp(32px, 5vh, 56px) 0 clamp(20px, 3vh, 34px); }
.art-kicker {
  display: inline-block; font-family: var(--font-display);
  font-weight: 600; font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--red); margin-bottom: 16px;
}
.art-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(27px, 4vw, 44px); line-height: 1.1;
  letter-spacing: -.02em;
}
.art-meta {
  display: flex; gap: 14px; align-items: center;
  margin-top: 16px; font-size: 14px; color: var(--gray);
  font-family: var(--font-display);
}
.art-dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--line); flex: none;
}

/* Corps de l'article */
.art-body { padding-bottom: 70px; }

.art-intro {
  font-size: clamp(18px, 1.6vw, 21px); line-height: 1.72; color: var(--ink);
  padding: 26px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
}

.art-body h2 {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.1vw, 24px); font-weight: 600; line-height: 1.25;
  margin: 52px 0 18px; clear: both;
}
.art-body h3 {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  margin: 28px 0 10px;
}
.art-body p { font-size: 18px; line-height: 1.75; color: var(--ink); margin-bottom: 22px; }
.art-body em { font-style: italic; }
.art-body strong { font-weight: 700; }
.art-body ul, .art-body ol {
  padding-left: 1.4em; font-size: 18px; line-height: 1.75;
  color: var(--ink); margin-bottom: 22px;
}
.art-body li { margin-bottom: 6px; }
.art-body a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .18s; }
.art-body a:hover { color: var(--blue); }
.art-body blockquote {
  margin: 28px 0; padding-left: 20px;
  border-left: 2px solid var(--line); color: var(--gray); font-style: italic;
}
.art-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; background: #f4f5f7; padding: .15em .35em; border-radius: 4px;
}
.art-body pre {
  background: #f4f5f7; padding: 18px 20px; border-radius: 8px;
  overflow-x: auto; margin-bottom: 22px;
}
.art-body pre code { background: none; padding: 0; }

/* Footer article */
.art-foot { padding: 48px 0 72px; border-top: 1px solid var(--line); }
.art-foot-cta {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(22px, 3vw, 30px); letter-spacing: -.01em;
}
.art-foot-cta a {
  text-decoration: underline; text-underline-offset: 5px;
  text-decoration-thickness: 2px; transition: color .18s;
}
.art-foot-cta a:hover { color: var(--blue); }

/* Liste de projets — page /projets/ */
.project-list-simple {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 16px;
}
.project-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 20px 24px; border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .2s;
}
.project-item:hover { border-color: #c8ccd4; }
.project-item__title {
  font-family: var(--font-display); font-weight: 600; font-size: 18px;
}
.project-item__title a { transition: color .18s; }
.project-item__title a:hover { color: var(--blue); }
.project-item__desc { color: var(--gray); font-size: 16px; margin-top: 4px; }
.project-item__meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.status-tag {
  font-family: var(--font-display); font-size: 13px; font-weight: 500;
  color: var(--gray); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 14px; white-space: nowrap;
}
.type-tag {
  font-family: var(--font-display); font-size: 12px; font-weight: 500;
  color: var(--gray); opacity: .7;
}

/* Titre de section pages intérieures */
.inner-title {
  font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.02em;
  margin-bottom: clamp(8px, 2vh, 14px);
}
.inner-lead { color: var(--gray); font-size: clamp(16px, 1.4vw, 18px); margin-bottom: clamp(28px, 5vh, 48px); }

/* =========================================================================
   13. Responsive commun
   ========================================================================= */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 520px) {
  #paintBoard { left: 16px; bottom: 16px; gap: 11px; }
  .about-stamp { left: calc(100% - 4px); font-size: 32px; top: -22px; }
}
