:root {
  --gutter: max(clamp(1rem, 5vw, 4rem), calc((100% - 72rem) / 2));
  --spruce: #1F3A34;
  --spruce-deep: #152A25;
  --glacier: #DCE6EA;
  --snow: #F4F7F8;
  --slate: #4A5A63;
  --larch: #C39A3E;
  --ink: #1B2326;
  --measure: 36rem;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--snow);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--larch); outline-offset: 3px; border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  background: linear-gradient(180deg, var(--spruce-deep) 0%, var(--spruce) 70%);
  color: var(--snow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hero nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.75rem;
  padding: 1.5rem var(--gutter);
  font-size: 0.95rem;
}
.hero nav a { text-decoration: none; opacity: 0.8; }
.hero nav a:hover { opacity: 1; }
.hero nav { flex-wrap: wrap; align-items: center; }
.lang { display: flex; gap: 0.6rem; padding-left: 1.25rem; border-left: 1px solid rgba(220, 230, 234, 0.35); }
.lang a { font-size: 0.85rem; letter-spacing: 0.05em; }
.hero nav .lang a[aria-current="page"] { opacity: 1; font-weight: 600; text-decoration: none; color: var(--larch); }
.hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter) 22vh;
}
.hero h1 {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.015em;
}
.hero h1 .hyphen { color: var(--larch); }
.hero p {
  margin-top: 1.5rem;
  max-width: 34rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--glacier);
}
.hero-link { margin-top: 2rem; align-self: flex-start; padding: 0.7rem 1.3rem; border: 1px solid var(--larch); border-radius: 4px; color: var(--snow); text-decoration: none; font-weight: 500; position: relative; z-index: 1; }
.hero-link:hover { background: var(--larch); color: var(--spruce-deep); }
.ridge {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: 34vh;
  min-height: 180px;
}
.ridge .line {
  fill: none;
  stroke: var(--larch);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: draw 2.8s ease-out 0.3s forwards;
}
.ridge .fill { fill: var(--snow); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ridge .line { animation: none; stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}

/* ---------- Sections ---------- */
main { padding: 0 clamp(1rem, 5vw, 4rem); }
section {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 7rem) 0;
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr);
  gap: 2rem 4rem;
  border-top: 1px solid var(--glacier);
}
section:first-child { border-top: 0; }
section h2 {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  color: var(--spruce);
}
.copy { max-width: var(--measure); }
.copy p + p { margin-top: 1rem; }
.copy .lead {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--spruce);
  margin-bottom: 1.25rem;
}

.facts {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.5rem 2rem;
}
.facts dt { font-weight: 600; color: var(--spruce); }
.facts dd { color: var(--slate); font-size: 0.98rem; }

.skills {
  list-style: none;
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skills li {
  padding: 0.35rem 0.8rem;
  border: 1px solid #B9C9CF;
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--slate);
  background: #fff;
}


/* ---------- Profil ---------- */
.profile-head { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.profile-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: center 20%; border: 3px solid #fff; box-shadow: 0 0 0 1px #B9C9CF; flex: none; }
.profile-head .lead { margin: 0; }
h3 { font-family: "Figtree", sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--spruce); margin: 2.75rem 0 1rem; }
.timeline { list-style: none; border-left: 2px solid var(--glacier); padding-left: 1.5rem; }
.timeline li { position: relative; padding-bottom: 1.25rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.5rem - 6px); top: 0.55rem; width: 10px; height: 10px; border-radius: 50%; background: var(--snow); border: 2px solid var(--spruce); }
.timeline li.now::before { background: var(--larch); border-color: var(--larch); }
.timeline .years { display: block; font-size: 0.9rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.timeline .role { font-weight: 600; }
.timeline .org { color: var(--slate); }
.awards { list-style: none; display: grid; gap: 0.6rem; }
.awards li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; }
.awards .yr { font-family: "Young Serif", Georgia, serif; color: var(--larch); font-variant-numeric: tabular-nums; }
details { margin-top: 1rem; border-top: 1px solid var(--glacier); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; color: var(--spruce); }
summary:focus-visible { outline: 2px solid var(--larch); outline-offset: 3px; }
.certs { margin-top: 1rem; columns: 2 16rem; column-gap: 2rem; list-style: none; font-size: 0.95rem; color: var(--slate); }
.certs li { break-inside: avoid; padding: 0.2rem 0; }

/* ---------- Projets ---------- */
.projects { list-style: none; margin-top: 2rem; display: grid; gap: 1.25rem; }
.project { background: #fff; border: 1px solid #D3DEE2; border-radius: 6px; padding: 1.5rem; }
.project h3 { margin: 0; font-family: "Young Serif", Georgia, serif; font-weight: 400; font-size: 1.35rem; }
.project h3 a { text-decoration: none; }
.project h3 a:hover { text-decoration: underline; text-decoration-color: var(--larch); text-underline-offset: 4px; }
.project .meta { margin-top: 0.15rem; font-size: 0.9rem; color: var(--slate); }
.project p { margin-top: 0.85rem; }
.project .skills { margin-top: 1rem; }
.project .skills li { background: var(--snow); font-size: 0.85rem; padding: 0.25rem 0.7rem; }
.project .repo { display: inline-block; margin-top: 1.1rem; font-weight: 500; color: var(--spruce); text-decoration-color: var(--larch); text-underline-offset: 4px; }
.note { margin-top: 1.5rem; font-size: 0.92rem; color: var(--slate); }

/* ---------- Contact ---------- */
.contact-links { margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 1rem; }
.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.15s;
}
.btn-primary { background: var(--spruce); color: var(--snow); }
.btn-primary:hover { background: var(--spruce-deep); }
.btn-ghost { border: 1px solid var(--spruce); color: var(--spruce); }
.btn-ghost:hover { background: var(--glacier); }

footer {
  background: var(--spruce-deep);
  color: var(--glacier);
  padding: 2rem clamp(1rem, 5vw, 4rem);
  font-size: 0.9rem;
}
footer div { max-width: 72rem; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

@media (max-width: 720px) {
  section { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero nav { justify-content: flex-start; gap: 1.25rem; }
  .hero-body { padding-bottom: 26vh; }
}

/* ---------- Page projets ---------- */
.hero-small { min-height: auto; }
.hero-small .hero-body { padding-top: clamp(2rem, 6vw, 4rem); padding-bottom: clamp(4rem, 10vw, 7rem); }
.hero-small h1 { font-size: clamp(2.4rem, 7vw, 4.5rem); }
.hero nav a[aria-current="page"] { opacity: 1; text-decoration: underline; text-decoration-color: var(--larch); text-underline-offset: 6px; }

/* Haut de page réseau */
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: 2rem 3rem; align-items: center; }
.hero .kicker { margin: 0 0 0.75rem; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--larch); font-weight: 600; }
.topology { width: 100%; height: auto; overflow: visible; }
.topology .links path { fill: none; stroke: var(--glacier); stroke-opacity: 0.35; stroke-width: 1.5; }
.topology .packets path { fill: none; stroke: var(--larch); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 4 200; animation: packet 2.4s linear infinite; }
.topology .packets path:nth-child(2) { animation-delay: 0.8s; }
.topology .packets path:nth-child(3) { animation-delay: 1.6s; }
.topology .waves path { fill: none; stroke: var(--larch); stroke-width: 2; stroke-linecap: round; opacity: 0.15; animation: wave 2.4s ease-out infinite; }
.topology .waves path:nth-child(2) { animation-delay: 0.3s; }
.topology .waves path:nth-child(3) { animation-delay: 0.6s; }
.topology .waves g:nth-child(2) path { animation-delay: 0.8s; }
.topology .waves g:nth-child(2) path:nth-child(2) { animation-delay: 1.1s; }
.topology .waves g:nth-child(2) path:nth-child(3) { animation-delay: 1.4s; }
.topology .waves g:nth-child(3) path { animation-delay: 1.6s; }
.topology .waves g:nth-child(3) path:nth-child(2) { animation-delay: 1.9s; }
.topology .waves g:nth-child(3) path:nth-child(3) { animation-delay: 2.2s; }
.topology .aps ellipse { fill: var(--snow); stroke: var(--larch); stroke-width: 1.5; }
.topology .switch > rect { fill: var(--spruce-deep); stroke: var(--glacier); stroke-opacity: 0.5; stroke-width: 1.5; }
.topology .ports rect { fill: var(--glacier); opacity: 0.55; }
.topology .ports .uplink { fill: var(--larch); opacity: 1; }
@keyframes packet { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -204; } }
@keyframes wave { 0% { opacity: 0.15; } 25% { opacity: 1; } 70%, 100% { opacity: 0.15; } }
@media (prefers-reduced-motion: reduce) {
  .topology .packets { display: none; }
  .topology .waves path { animation: none; opacity: 0.8; }
}

/* Sections et fiches de la page projets */
.section-tag { margin-top: 0.5rem; font-size: 0.9rem; color: var(--slate); }
.projects:first-child { margin-top: 0; }
.project-head { display: flex; gap: 1rem; align-items: center; }
.project .icon { flex: none; width: 3rem; height: 3rem; padding: 0.6rem; border-radius: 10px; background: var(--spruce); fill: none; stroke: var(--glacier); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.project .icon circle { fill: var(--larch); stroke: none; }
.project .icon circle[r="8"] { fill: none; stroke: var(--glacier); }
.project-head .meta { margin-top: 0.1rem; }

@media (max-width: 720px) {
  .hero-split { grid-template-columns: 1fr; }
  .topology { max-width: 20rem; justify-self: center; }
}

/* Fiches projets détaillées */
.project { padding: 0; overflow: hidden; }
.project-body { padding: 1.5rem; }
.shot { margin: 0; border-bottom: 1px solid #D3DEE2; background: var(--spruce-deep); }
.shot img { display: block; width: 100%; height: auto; }
.project .logo { flex: none; width: 3rem; height: 3rem; border-radius: 10px; }
.features { margin-top: 1rem; padding-left: 1.1rem; display: grid; gap: 0.4rem; font-size: 0.97rem; }
.features li::marker { color: var(--larch); }
.project-links { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.93rem; }
.btn .ver { margin-left: 0.3rem; font-variant-numeric: tabular-nums; opacity: 0.85; }
.project .release-date { margin-top: 0.6rem; font-size: 0.85rem; color: var(--slate); }

/* Ticket FetchPass */
.ticket-shot { display: flex; justify-content: center; padding: 2rem 1rem 2.25rem; background: linear-gradient(180deg, var(--spruce-deep), var(--spruce)); }
.ticket { width: 15rem; padding: 1.1rem 1.25rem 1.4rem; background: #fff; color: var(--ink); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; transform: rotate(-2deg); filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
  --teeth: linear-gradient(#000 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from 135deg at top, #000 90deg, transparent 0) bottom / 12px 6px repeat-x;
  -webkit-mask: var(--teeth); mask: var(--teeth); }
.project .ticket p { margin: 0; }
.ticket .t-head { text-align: center; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding-bottom: 0.6rem; border-bottom: 1px dashed #9AA7AD; }
.ticket dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.8rem; margin: 0.8rem 0; }
.ticket dt { color: #5B6870; }
.ticket dd { font-weight: 700; text-align: right; }
.ticket .t-foot { text-align: center; padding-top: 0.6rem; border-top: 1px dashed #9AA7AD; color: #5B6870; }

/* Colonne plus large pour les fiches projets */
.copy.wide { max-width: 48rem; }

/* Cartes Home Assistant */
.ha-shot { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1rem; padding: 2rem 1rem; background: linear-gradient(180deg, var(--spruce-deep), var(--spruce)); }
.ha-card { width: 14.5rem; padding: 0.9rem 1rem; border-radius: 12px; background: #fff; color: #212121; font-family: system-ui, "Segoe UI", Roboto, sans-serif; font-size: 0.85rem; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }
.ha-tracker { margin-top: 1.5rem; }
.ha-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding-bottom: 0.6rem; margin-bottom: 0.6rem; border-bottom: 1px solid #E5E8EA; }
.ha-title { font-weight: 600; }
.ha-badge { padding: 0.1rem 0.55rem; border-radius: 999px; background: #E3F4E6; color: #1E7B34; font-size: 0.75rem; font-weight: 600; }
.ha-rows { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.8rem; margin: 0; }
.ha-rows dt { color: #6F7A80; }
.ha-rows dd { text-align: right; font-weight: 500; }
