/* NADIR Architectes — démo d'agence d'architecture (Démesure) */

:root {
  --paper: #f1f0ec;
  --paper-2: #e7e6e0;
  --ink: #111110;
  --ink-2: #6b6a65;
  --line: rgba(17, 17, 16, .14);
  --cobalt: #2a3cff;
  --sans: "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --g: clamp(18px, 3.4vw, 48px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; /* garde-fou iPhone : jamais de défilement horizontal */ }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--cobalt); color: #fff; }
:focus-visible { outline: 1px solid var(--cobalt); outline-offset: 4px; }

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.5; }
.section-label { color: var(--ink-2); display: flex; align-items: center; gap: 14px; }
.section-label::before { content: ""; width: 8px; height: 8px; background: var(--cobalt); }
em { font-style: italic; font-weight: 200; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Intro : la planche du plan, puis la maquette en sort ---------- */
.intro { display: none; }
.intro-on .intro {
  display: block; position: fixed; inset: 0; z-index: 100; cursor: pointer;
  background-color: var(--paper);
  background-image: linear-gradient(rgba(17, 17, 16, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 17, 16, .045) 1px, transparent 1px);
  background-size: 32px 32px; background-position: center;
  transition: opacity 1s cubic-bezier(.5, 0, .2, 1) .1s;
}
.intro-open .intro { opacity: 0; pointer-events: none; }
.intro__sheet { position: absolute; inset: clamp(12px, 2.4vw, 28px); border: 1px solid var(--ink); display: grid; place-items: center; animation: sheet .9s var(--ease) both; }
@keyframes sheet { from { clip-path: inset(0 100% 100% 0); } to { clip-path: inset(0 0 0 0); } }
.intro__corner { position: absolute; top: 14px; left: 16px; color: var(--ink-2); }
.intro__corner b { color: var(--ink); font-weight: 600; letter-spacing: .32em; margin-right: 6px; }
.intro__corner--r { left: auto; right: 16px; }
.plan { width: min(86vw, 860px); height: auto; overflow: visible; transition: transform 1.2s var(--ease); }
.intro-open .plan { transform: scale(1.08); }
.pl-d { fill: none; stroke: var(--ink); stroke-dasharray: 1; stroke-dashoffset: 1; animation: pl-draw 1.1s cubic-bezier(.65, 0, .35, 1) var(--d, 0s) forwards; }
.pl-wall { stroke-width: 3; }
.pl-glass { stroke-width: 1; stroke: var(--cobalt); }
.pl-upper { stroke-width: 1.2; stroke: var(--ink-2); }
.pl-dim .pl-d { stroke-width: .8; }
@keyframes pl-draw { to { stroke-dashoffset: 0; } }
.pl-axis { stroke: var(--cobalt); stroke-width: .8; stroke-dasharray: 14 4 2 4; transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: pl-grow 1s var(--ease) var(--d, 0s) forwards; opacity: .55; }
.pl-axis--h { transform-origin: 0 50%; transform: scaleX(0); }
@keyframes pl-grow { to { transform: none; } }
.pl-bubble { fill: var(--paper); stroke: var(--cobalt); stroke-width: .8; transform-box: fill-box; transform-origin: center; transform: scale(0); animation: pl-pop .5s var(--ease) var(--d, 0s) forwards; }
.pl-txt { font-family: var(--mono); font-size: 10px; fill: var(--cobalt); text-anchor: middle; opacity: 0; animation: pl-fade .4s ease var(--d, 0s) forwards; }
.pl-col { fill: var(--ink); transform-box: fill-box; transform-origin: center; transform: scale(0); animation: pl-pop .45s var(--ease) var(--d, 0s) forwards; }
.pl-well { fill: url(#pl-hatch); stroke: var(--cobalt); stroke-width: 1; opacity: 0; animation: pl-fade .6s ease 1.15s forwards; }
.pl-num { font-family: var(--mono); font-size: 10px; fill: var(--ink); text-anchor: middle; opacity: 0; animation: pl-fade .5s ease 1.4s forwards; }
.pl-north { opacity: 0; animation: pl-fade .6s ease 1.3s forwards; }
.pl-north circle { fill: none; stroke: var(--ink); stroke-width: .8; }
.pl-north path { fill: var(--ink); }
.pl-north text { font-family: var(--mono); font-size: 10px; text-anchor: middle; fill: var(--ink); }
@keyframes pl-pop { to { transform: none; } }
@keyframes pl-fade { to { opacity: 1; } }
.intro__block { position: absolute; right: 0; bottom: 0; display: grid; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); background: var(--paper); opacity: 0; animation: pl-fade .6s ease 1.2s forwards; }
.intro__block p { padding: 7px 14px; color: var(--ink-2); }
.intro__block p + p { border-top: 1px solid var(--line); }
.intro__block b { color: var(--ink); font-weight: 600; }
.intro__pct { margin-left: 14px; color: var(--cobalt); font-variant-numeric: tabular-nums; }

/* Entrée du hero : titre ligne par ligne, mentions latérales */
.story h1 .line { display: block; overflow: hidden; padding: 0 .08em .1em; margin: 0 -.08em -.1em; }
.story h1 .line > span { display: inline-block; }
:is(.intro-on, .hero-quick):not(.hero-in) .story [data-in] { opacity: 0; transform: translateY(20px); }
:is(.intro-on, .hero-quick):not(.hero-in) .story h1 .line > span { transform: translateY(105%); }
.hero-in .story [data-in] { transition: opacity 1s var(--ease) var(--d, 0s), transform 1.2s var(--ease) var(--d, 0s); }
.hero-in .story h1 .line > span { transition: transform 1.4s var(--ease) var(--d, 0s); }
@media (prefers-reduced-motion: reduce) { .intro { display: none !important; } }

/* Bandeau démo */
.demo-bar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 9px var(--g); background: var(--ink); color: rgba(241, 240, 236, .7); font-size: 12.5px; }
.demo-bar a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* Navigation */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  height: 64px; padding: 0 var(--g);
  background: rgba(241, 240, 236, .86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; gap: 10px; }
.brand b { font-weight: 600; letter-spacing: .32em; font-size: 15px; }
.brand span { font-weight: 300; font-size: 14px; color: var(--ink-2); }
.nav__links { display: flex; gap: 34px; font-size: 14px; }
.nav__links a { position: relative; color: var(--ink-2); transition: color .3s; }
.nav__links a:hover { color: var(--ink); }
.nav__links a::before { content: ""; position: absolute; left: -12px; top: 50%; width: 5px; height: 5px; margin-top: -2px; background: var(--cobalt); transform: scale(0); transition: transform .4s var(--ease); }
.nav__links a:hover::before { transform: scale(1); }
.nav__meta { justify-self: end; color: var(--ink-2); }

/* Hero : vue éclatée */
.story { position: relative; height: 320vh; }
.story__sticky { position: sticky; top: 64px; height: calc(100vh - 64px); overflow: hidden; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.story__title { position: absolute; left: var(--g); bottom: var(--g); z-index: 2; pointer-events: none; }
.story__title .mono { color: var(--ink-2); margin-bottom: 18px; }
.story h1 { font-weight: 200; font-size: clamp(56px, 9vw, 160px); line-height: .9; letter-spacing: -.045em; }
.story h1 em { font-weight: 200; color: var(--ink-2); }
.story__side { position: absolute; right: var(--g); top: 30px; z-index: 2; text-align: right; display: flex; flex-direction: column; gap: 30px; color: var(--ink-2); }
.story__scroll { color: var(--cobalt); }
.story__caption { position: absolute; right: var(--g); bottom: var(--g); z-index: 2; max-width: 300px; opacity: 0; transform: translateY(20px); transition: opacity .6s, transform .6s var(--ease); }
.story__caption .mono { color: var(--cobalt); margin-bottom: 8px; }
.story__caption p:last-child { font-size: 15px; color: var(--ink-2); }
.story__caption.is-on { opacity: 1; transform: none; }
.story__progress { position: absolute; left: var(--g); right: var(--g); top: 18px; height: 1px; background: var(--line); z-index: 2; }
.story__progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }
.story__labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.tag {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 10px;
  background: var(--paper); border: 1px solid var(--ink);
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; will-change: transform, opacity;
}
.tag i { width: 7px; height: 7px; background: var(--cobalt); }

/* Projets */
.projects { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.projects__stage { position: sticky; top: 64px; height: calc(100vh - 64px); border-right: 1px solid var(--line); background: var(--stage, var(--paper-2)); }
.projects__stage .scene { cursor: grab; }
.projects__stage .scene:active { cursor: grabbing; }
.projects__card { position: absolute; left: 24px; bottom: 24px; padding: 18px 20px; background: var(--paper); border: 1px solid var(--ink); min-width: 260px; pointer-events: none; }
.projects__card .mono { color: var(--ink-2); }
/* Étude d'ensoleillement */
.sun { position: absolute; left: 24px; top: 22px; z-index: 2; display: grid; grid-template-columns: auto 190px 7ch; align-items: center; gap: 14px; padding: 9px 14px; background: var(--paper); border: 1px solid var(--ink); cursor: pointer; }
.sun .mono { color: var(--ink-2); }
.sun .sun__time { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.sun input { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; cursor: pointer;
  background: linear-gradient(var(--ink), var(--ink)) center / 100% 1px no-repeat, repeating-linear-gradient(90deg, var(--ink-2) 0 1px, transparent 1px calc((100% - 1px) / 14)) center / 100% 7px no-repeat; }
.sun input::-webkit-slider-runnable-track { height: 20px; background: transparent; }
.sun input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--cobalt); box-shadow: 0 0 0 4px var(--paper); }
.sun input::-moz-range-track { height: 20px; background: transparent; }
.sun input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--cobalt); box-shadow: 0 0 0 4px var(--paper); }
.sun input:focus-visible { outline: 1px solid var(--cobalt); outline-offset: 4px; }
.is-night .sun input::-webkit-slider-thumb { background: #ffc06a; }
.is-night .sun input::-moz-range-thumb { background: #ffc06a; }
.projects__name { font-size: 26px; font-weight: 500; letter-spacing: -.02em; margin: 6px 0 4px; }
.projects__list { padding: clamp(60px, 9vw, 120px) var(--g) 60px; }
.projects__list ul { margin-top: 30px; border-top: 1px solid var(--line); }
.project {
  display: grid; grid-template-columns: 40px 1fr auto 52px; align-items: baseline; gap: 16px;
  width: 100%; padding: 26px 0; text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  transition: color .3s, padding .5s var(--ease);
}
.project__name { font-size: clamp(26px, 2.6vw, 40px); font-weight: 300; letter-spacing: -.03em; color: var(--ink-2); transition: color .3s, font-weight .3s; }
.project__type { text-align: right; }
.project:hover, .project.is-on { color: var(--ink); padding-left: 12px; }
.project:hover .project__name, .project.is-on .project__name { color: var(--ink); font-weight: 500; }
.project.is-on .mono:first-child { color: var(--cobalt); }
.projects__help { margin-top: 24px; color: var(--ink-2); }

/* Agence */
.agency { padding: clamp(100px, 13vw, 180px) var(--g); border-top: 1px solid var(--line); }
.agency__text { margin-top: 40px; max-width: 26ch; font-size: clamp(34px, 4.6vw, 76px); font-weight: 300; line-height: 1.04; letter-spacing: -.035em; }
.agency__text em { color: var(--ink-2); }
.agency__facts { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(60px, 8vw, 110px); border-top: 1px solid var(--line); }
.agency__facts li { padding: 26px 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.agency__facts b { font-size: clamp(48px, 6vw, 96px); font-weight: 200; line-height: .9; letter-spacing: -.05em; }
.agency__facts .mono { color: var(--ink-2); }

/* Approche */
.approach { padding: 0 var(--g) clamp(100px, 13vw, 180px); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 40px; border-top: 1px solid var(--ink); }
.steps li { padding: 26px 26px 0 0; position: relative; }
.steps li::before { content: ""; position: absolute; top: -5px; left: 0; width: 9px; height: 9px; background: var(--paper); border: 1px solid var(--ink); }
.steps .mono { color: var(--cobalt); }
.steps h3 { font-size: 30px; font-weight: 400; letter-spacing: -.03em; margin: 16px 0 10px; }
.steps p { font-size: 15px; color: var(--ink-2); max-width: 30ch; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 100px); align-items: end; padding: clamp(100px, 12vw, 160px) var(--g); background: var(--ink); color: var(--paper); }
.contact h2 { font-size: clamp(44px, 6vw, 104px); font-weight: 200; line-height: .95; letter-spacing: -.045em; }
.contact h2 em { color: #9da0ff; }
.contact__form { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.contact__form label { display: flex; flex-direction: column; gap: 8px; }
.contact__form .wide { grid-column: 1 / -1; }
.contact__form .mono { color: rgba(241, 240, 236, .55); }
.contact__form input, .contact__form textarea { border: 0; border-bottom: 1px solid rgba(241, 240, 236, .3); background: transparent; padding: 8px 0 10px; font-size: 18px; color: var(--paper); outline: none; resize: none; transition: border-color .3s; }
.contact__form input:focus, .contact__form textarea:focus { border-bottom-color: #9da0ff; }
.btn { justify-self: start; display: inline-flex; gap: 12px; align-items: center; height: 52px; padding: 0 26px; background: var(--paper); color: var(--ink); font-weight: 500; transition: background-color .3s, color .3s; }
.btn:hover { background: var(--cobalt); color: #fff; }
.contact__ok { grid-column: 1 / -1; color: #9da0ff; min-height: 1.5em; }

/* Pied de page */
.footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 30px var(--g); background: var(--ink); color: rgba(241, 240, 236, .6); border-top: 1px solid rgba(241, 240, 236, .12); font-size: 13px; }
.footer b { color: var(--paper); letter-spacing: .2em; font-weight: 600; }
.dm-sign { display: inline-flex; align-items: center; gap: .6em; font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--paper); opacity: .72; transition: opacity .3s; }
.dm-sign:hover { opacity: 1; }
.dm-sign__dot { width: 6px; height: 6px; border-radius: 50%; background: #ff4a1c; flex: none; }
.dm-sign__w { transition: letter-spacing .6s var(--ease); }
.dm-sign:hover .dm-sign__w { letter-spacing: .32em; }

.no-webgl::after { content: "Maquette 3D indisponible sur cet appareil"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); }

/* Responsive */
@media (max-width: 960px) {
  .nav { grid-template-columns: 1fr auto; }
  .nav__links { display: none; }
  .story { height: 260vh; }
  .story__side { display: none; }
  .story__caption { left: var(--g); right: auto; bottom: auto; top: 40px; }
  .projects { grid-template-columns: 1fr; }
  .projects__stage { position: relative; top: 0; height: 64vh; border-right: 0; }
  .agency__facts, .steps { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .project { grid-template-columns: 30px 1fr 44px; }
  .project__type { display: none; }
  .contact__form { grid-template-columns: 1fr; }
  .projects__card { left: 12px; right: 12px; bottom: 12px; min-width: 0; }
  .sun { left: 12px; right: 12px; top: 12px; grid-template-columns: auto minmax(0, 1fr) 7ch; gap: 10px; padding: 8px 12px; }
  .tag { font-size: 9.5px; padding: 5px 8px; }
}
