/* ==========================================================================
   MAQUIN.FR — "Carbone & Chrono"
   Dark carbon base, chrono-green accent, telemetry-inspired details.
   ========================================================================== */

:root {
  /* Base */
  --bg:            #0A0C10;
  --bg-alt:        #14181F;
  --surface:       #1D232D;
  --line:          #2A313C;
  /* Text */
  --txt:           #EDF0F4;
  --txt-2:         #9BA5B2;
  --txt-3:         #5A6472;
  /* Accents */
  --chrono:        #005ACE;
  --chrono-dim:    rgba(0, 90, 206, 0.14);
  --hyperpole:     #ffffff;
  --amber:         #FFB020;
  /* Type */
  --font-display:  "Saira Condensed", "Arial Narrow", sans-serif;
  --font-mono:     "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  --font-body:     "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Layout */
  --gutter:        clamp(1.25rem, 5vw, 5rem);
  --section-pad:   clamp(4.5rem, 10vw, 8.5rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

::selection { background: var(--chrono); color: var(--bg); }

a { color: inherit; }

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

/* ==========================================================================
   HEADER
   ========================================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--gutter);
  transition: background 0.35s ease, padding 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}

.site-header.is-stuck {
  padding: 0.6rem var(--gutter);
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--chrono);
  color: var(--chrono);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

/* Le nom complet « MAQUIN-ENGINEERING.com » doit tenir sur UNE ligne,
   même sur petit écran : on réduit la taille et l'espacement des lettres */
@media (max-width: 640px) {
  .brand-name { font-size: 0.82rem; letter-spacing: 0.07em; }
  .brand-mark { width: 1.7rem; height: 1.7rem; font-size: 1rem; }
  .brand { gap: 0.45rem; }
}

.brand-tld { color: var(--txt-3); font-weight: 500; }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.8rem);
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--txt-2);
  transition: color 0.2s ease;
}

.site-nav a:hover { color: var(--chrono); }

.site-nav .nav-cta {
  color: var(--bg);
  background: var(--chrono);
  padding: 0.45rem 0.9rem;
  font-weight: 700;
}

.site-nav .nav-cta:hover { color: var(--bg); filter: brightness(1.1); }

@media (max-width: 720px) {
  .site-nav a:not(.nav-cta) { display: none; }
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 7rem var(--gutter) 5rem;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 78% 18%, rgba(198, 241, 53, 0.07), transparent 60%),
    radial-gradient(900px 700px at 15% 85%, rgba(181, 123, 255, 0.05), transparent 60%),
    var(--bg);
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  opacity: 0.75;
  filter: grayscale(0.6) contrast(1.1);
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(10, 12, 16, 0.55) 0%,
    rgba(10, 12, 16, 0.25) 45%,
    var(--bg) 100%);
}

/* Telemetry grid overlay */
.hero-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.16;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 62rem;
  /* flex item: allow shrinking below the KPI grid's min-content width */
  min-width: 0;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--txt-2);
  margin-bottom: 1.6rem;
}

.hero-eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chrono);
  box-shadow: 0 0 12px var(--chrono);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.8rem, 13vw, 10.5rem);
  line-height: 0.88;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.hero-role {
  margin-top: 1.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.4vw, 1.6rem);
  letter-spacing: 0.16em;
  color: var(--chrono);
}

.hero-role .sep { color: var(--txt-3); margin: 0 0.3rem; }

.hero-sub {
  margin-top: 1.1rem;
  max-width: 34rem;
  color: var(--txt-2);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
}

.hero-sub strong { color: var(--txt); font-weight: 600; }

.hero-kpis {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  margin-top: 3rem;
  max-width: 46rem;
  background: var(--line);
  border: 1px solid var(--line);
}

.hero-kpis li {
  background: var(--bg);
  padding: 1.1rem 1.2rem;
}

.kpi-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1;
  color: var(--txt);
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.6rem;
  color: var(--txt-3);
  letter-spacing: 0.16em;
}

/* ==========================================================================
   RACING LINE DIVIDER
   ========================================================================== */

.racing-line {
  height: 120px;
  margin-top: -60px;
  position: relative;
  z-index: 3;
  pointer-events: none;
}

.racing-line svg { width: 100%; height: 100%; }

.line-path {
  fill: none;
  stroke: var(--chrono);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  opacity: 0.8;
  transition: stroke-dashoffset 2.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.racing-line.is-visible .line-path { stroke-dashoffset: 0; }

/* ==========================================================================
   SECTIONS — shared
   ========================================================================== */

.section {
  padding: var(--section-pad) var(--gutter);
  position: relative;
}

.section-alt { background: var(--bg-alt); }

.section-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }

.section-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--chrono);
  letter-spacing: 0.22em;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--chrono-dim);
  background: var(--chrono-dim);
  margin-bottom: 1.2rem;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.accent { color: var(--chrono); }

.section-sub {
  margin-top: 1.2rem;
  max-width: 38rem;
  color: var(--txt-2);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   TRACK RECORD
   ========================================================================== */

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.record-card {
  position: relative;
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.record-card:hover {
  transform: translateY(-4px);
  border-color: var(--chrono);
}

.record-hero {
  grid-row: span 1;
  background:
    linear-gradient(145deg, rgba(0, 90, 206, 0.08), transparent 55%),
    var(--bg-alt);
  border-color: rgba(0, 90, 206, 0.35);
}

.record-year {
  font-size: 0.7rem;
  color: var(--txt-3);
}

.record-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  text-transform: uppercase;
  margin-top: 0.4rem;
  line-height: 1.05;
}

.record-detail {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--txt-2);
}

.record-result {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  padding: 0.35rem 0.65rem;
}

.record-result.win {
  color: var(--bg);
  background: var(--chrono);
  font-weight: 700;
}

.record-result.podium {
  color: var(--hyperpole);
  border: 1px solid var(--hyperpole);
}

/* ==========================================================================
   CAREER TIMELINE
   ========================================================================== */

.timeline {
  list-style: none;
  position: relative;
  max-width: 52rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--chrono), var(--line) 30%);
}

.stint {
  position: relative;
  padding: 0 0 3rem 2.4rem;
}

.stint:last-child { padding-bottom: 0; }

.stint-marker {
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--txt-3);
}

.stint.current .stint-marker {
  border-color: var(--chrono);
  background: var(--chrono);
  box-shadow: 0 0 14px rgba(198, 241, 53, 0.55);
}

.stint-time {
  font-size: 0.7rem;
  color: var(--chrono);
  letter-spacing: 0.18em;
  margin-bottom: 0.5rem;
}

.stint-body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
  line-height: 1.1;
}

.stint-org {
  margin: 0.3rem 0 0.6rem;
  color: var(--txt-2);
  font-size: 0.9rem;
}

.stint-org .mono { font-size: 0.7rem; color: var(--txt-3); }

.stint-body p:last-child {
  color: var(--txt-2);
  font-size: 0.95rem;
  max-width: 40rem;
}

.stint-body strong { color: var(--txt); }

/* ==========================================================================
   EXPERTISE
   ========================================================================== */

#expertise {
  position: relative;
  overflow: hidden;
}

/* Grille télémétrie qui glisse en parallaxe derrière la section */
.exp-parallax {
  position: absolute;
  inset: -40% 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--chrono) 1px, transparent 1px),
    linear-gradient(90deg, var(--chrono) 1px, transparent 1px);
  background-size: 88px 88px;
  opacity: 0.05;
  mask-image: radial-gradient(ellipse 100% 90% at 50% 45%, black 35%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse 100% 90% at 50% 45%, black 35%, transparent 82%);
  will-change: transform;
}

#expertise .section-head,
#expertise .expertise-grid {
  position: relative;
  z-index: 1;
}

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.exp-card {
  position: relative;
  padding: 1.8rem 1.6rem 4.2rem;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.exp-card:hover {
  transform: translateY(-4px);
  border-color: var(--chrono);
}

.exp-step {
  font-size: 0.66rem;
  color: var(--chrono);
  letter-spacing: 0.2em;
}

.exp-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  text-transform: uppercase;
  margin: 0.5rem 0 1rem;
}

.exp-card ul {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.exp-card li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--txt-2);
  font-size: 0.9rem;
}

.exp-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5rem;
  height: 2px;
  background: var(--chrono);
}

.exp-spark {
  position: absolute;
  bottom: 1.1rem;
  left: 1.6rem;
  right: 1.6rem;
  width: calc(100% - 3.2rem);
  height: 32px;
  opacity: 0.4;
  transition: opacity 0.25s ease;
}

.exp-card:hover .exp-spark { opacity: 1; }

.exp-spark polyline {
  fill: none;
  stroke: var(--chrono);
  stroke-width: 1.5;
}

/* ==========================================================================
   MARQUES
   ========================================================================== */

.marques {
  padding: clamp(3rem, 7vw, 5rem) var(--gutter);
  text-align: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.marques-intro {
  font-size: 0.64rem;
  color: var(--txt-3);
  letter-spacing: 0.26em;
}

.marques-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.4rem, 5vw, 3.6rem);
  margin: 1.6rem 0 1.4rem;
}

.marques-list li {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 3.2vw, 2.1rem);
  letter-spacing: 0.14em;
  color: var(--txt-2);
  transition: color 0.25s ease;
}

.marques-list li:hover { color: var(--txt); }

.marques-teams {
  font-size: 0.68rem;
  color: var(--txt-3);
  letter-spacing: 0.2em;
}

/* ==========================================================================
   ABOUT
   ========================================================================== */

.about {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
}

.about-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, var(--surface), var(--bg-alt));
  overflow: hidden;
}

.about-media::after {
  content: "";
  position: absolute;
  inset: 0.8rem;
  border: 1px dashed var(--line);
  pointer-events: none;
}

.about-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}

.about-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--txt-3);
  line-height: 2;
}

.about-media.has-photo .about-placeholder { display: none; }

.about-body p {
  color: var(--txt-2);
  max-width: 38rem;
  margin-bottom: 1.1rem;
}

.about-body strong { color: var(--txt); }

/* ==========================================================================
   CONTACT
   ========================================================================== */

.contact {
  padding: var(--section-pad) var(--gutter);
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(198, 241, 53, 0.06), transparent 70%),
    var(--bg-alt);
  border-top: 1px solid var(--line);
  text-align: center;
}

.contact-inner { max-width: 42rem; margin-inline: auto; }

.contact h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.95;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

.contact p { color: var(--txt-2); }

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.2rem;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  padding: 0.95rem 1.7rem;
  transition: transform 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--chrono);
  color: var(--bg);
  font-weight: 700;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--txt);
}

.btn-ghost:hover { border-color: var(--chrono); color: var(--chrono); }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer { border-top: 1px solid var(--line); }

.footer-checker {
  height: 14px;
  background:
    conic-gradient(var(--line) 90deg, transparent 90deg 180deg, var(--line) 180deg 270deg, transparent 270deg);
  background-size: 14px 14px;
  opacity: 0.5;
  mask-image: linear-gradient(90deg, transparent, black 30% 70%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 30% 70%, transparent);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  padding: 1.6rem var(--gutter) 2rem;
  font-size: 0.62rem;
  color: var(--txt-3);
  letter-spacing: 0.18em;
}

/* ==========================================================================
   SCROLL RACE — progress bar + fixed HUD
   The whole page is a 24-hour race: scrolling advances the race clock.
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--chrono);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

.race-hud {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 90;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  border: 1px solid var(--line);
  background: rgba(10, 12, 16, 0.82);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.hud-flag {
  align-self: center;
  width: 14px;
  height: 10px;
  background:
    conic-gradient(var(--txt-3) 90deg, transparent 90deg 180deg, var(--txt-3) 180deg 270deg, transparent 270deg);
  background-size: 7px 5px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.race-hud.is-finished .hud-flag {
  opacity: 1;
  background:
    conic-gradient(var(--txt) 90deg, transparent 90deg 180deg, var(--txt) 180deg 270deg, transparent 270deg);
  background-size: 7px 5px;
}

.hud-label { color: var(--txt-3); }

.hud-value {
  color: var(--chrono);
  font-weight: 700;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.hud-total { color: var(--txt-3); }

/* Mobile : le HUD quitte le coin bas-droit et vient se docker à droite,
   juste sous la barre de progression — drapeau damier + chrono compacts */
@media (max-width: 560px) {
  .race-hud {
    top: 3px;
    right: 0;
    bottom: auto;
    z-index: 150;
    padding: 0.28rem 0.65rem;
    gap: 0.45rem;
    border: none;
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(10, 12, 16, 0.92);
  }

  .race-hud .hud-label,
  .race-hud .hud-total { display: none; }

  .race-hud .hud-value { font-size: 0.68rem; }

  .race-hud .hud-flag { opacity: 0.75; }

  /* le header descend un peu pour laisser la place au chrono —
     y compris en version compactée au scroll (le chrono fait ~31px
     de haut avec la barre de progression) */
  .site-header { padding-top: 2.2rem; }
  .site-header.is-stuck { padding-top: 2.4rem; }
}

/* ==========================================================================
   SCROLL ANIMATIONS — staggering & draw-ins
   ========================================================================== */

/* Cards cascade in with a small per-column delay */
.record-grid .record-card:nth-child(3n + 2),
.expertise-grid .exp-card:nth-child(2) { transition-delay: 0.12s; }

.record-grid .record-card:nth-child(3n),
.expertise-grid .exp-card:nth-child(3) { transition-delay: 0.24s; }

/* Telemetry sparklines draw themselves once their card is revealed */
.exp-spark polyline {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.5s;
}

.exp-card.is-visible .exp-spark polyline { stroke-dashoffset: 0; }

/* Career timeline: the pit-lane line grows as the section enters */
.timeline::before {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 2s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline.is-visible::before { transform: scaleY(1); }

/* ==========================================================================
   ACCESSIBILITY — reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .line-path { stroke-dashoffset: 0; }
  .exp-spark polyline { stroke-dashoffset: 0; }
  .timeline::before { transform: none; }
  .exp-parallax { transform: none !important; }
}
