/* ==========================================================
   Luc Bron Architecte Sàrl — design éditorial suisse
   Palette : papier chaud / encre / vert sapin / argile
   ========================================================== */

:root {
  --paper: #f6f4ee;
  --paper-deep: #efece3;
  --ink: #1c1c18;
  --ink-soft: #55554c;
  --green: #33502f;
  --green-deep: #24391f;
  --clay: #b99873;
  --line: rgba(28, 28, 24, 0.16);
  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-reveal: cubic-bezier(0.65, 0.05, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

img { display: block; width: 100%; height: 100%; object-fit: cover; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--green); color: var(--paper); }

h1, h2, h3 {
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
}

/* Masques de ligne (typo révélée) */
.line { display: block; overflow: hidden; }
.line-inner { display: block; will-change: transform; }

/* ---------- Intro ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: var(--green-deep);
  color: var(--paper);
  /* Filet de sécurité : si le JS ne prend pas la main, l'intro s'efface seule */
  animation: loader-failsafe 0.6s ease 2.4s forwards;
}

@keyframes loader-failsafe {
  to { opacity: 0; visibility: hidden; }
}

.loader-inner { text-align: center; }

.loader-name {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.loader-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--clay);
  margin-top: 0.6rem;
}

.loader-line {
  width: min(16rem, 50vw);
  height: 1px;
  margin: 1.8rem auto 0;
  background: color-mix(in srgb, var(--paper) 20%, transparent);
}

.loader-line span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Grain papier ---------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Curseur ---------- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out);
}

.anim .cursor { display: flex; }
@media (hover: none), (pointer: coarse) { .anim .cursor { display: none; } }

.cursor .cursor-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cursor.cursor--link { width: 40px; height: 40px; }

.cursor.cursor--view { width: 88px; height: 88px; }
.cursor.cursor--view .cursor-label { opacity: 1; }

/* ---------- 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);
}

/* Le flou est porté par un pseudo-élément : un backdrop-filter posé
   directement sur le header ferait de lui le containing block du
   menu mobile en position fixed. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.site-header.is-scrolled::before { opacity: 1; }

.wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark-name {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
}
.wordmark-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.site-nav {
  display: flex;
  gap: 2.2rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.site-nav a {
  position: relative;
  padding: 0.2rem 0;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.site-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.site-nav .nav-contact {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.35rem 1.05rem;
  transition: background 0.25s ease, color 0.25s ease;
}
.site-nav .nav-contact::after { display: none; }
.site-nav .nav-contact:hover { background: var(--ink); color: var(--paper); }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: var(--gutter);
  align-items: end;
  min-height: 100svh;
  padding: clamp(6rem, 14vh, 9rem) var(--gutter) clamp(2rem, 5vh, 4rem);
}

.kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 1.4rem;
}

.hero-title {
  font-size: clamp(2.7rem, 6.2vw, 5.4rem);
  margin-bottom: 1.6rem;
}

.hero-title em {
  font-style: normal;
  color: var(--green);
}

.hero-lede {
  max-width: 30rem;
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--ink-soft);
  margin-bottom: 2.2rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.25rem;
  transition: color 0.25s ease, border-color 0.25s ease, gap 0.25s ease;
}
.hero-cta:hover { color: var(--green); border-color: var(--green); gap: 0.9rem; }

.hero-figure {
  position: relative;
  height: min(72svh, 44rem);
  overflow: hidden;
}

.hero-figure figcaption,
.studio-figure figcaption {
  position: absolute;
  left: 0; bottom: 0;
  z-index: 2;
  background: var(--paper);
  padding: 0.55rem 1rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* États initiaux de l'intro — uniquement quand GSAP pilote (.anim) */
.anim .hero .kicker,
.anim .hero-lede,
.anim .hero-cta,
.anim .hero-figure figcaption,
.anim .site-header { opacity: 0; }
.anim .hero-title .line-inner,
.anim .loader .line-inner { transform: translateY(112%); }
.anim .hero-figure { clip-path: inset(100% 0 0 0); }

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding: 1.1rem 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 36s linear infinite;
}

/* Deux séquences identiques et auto-contenues (gap inclus dans la
   largeur via padding-right) : la boucle à -50% est parfaitement propre */
.marquee-seq {
  display: flex;
  align-items: center;
  gap: 2.6rem;
  padding-right: 2.6rem;
}

.marquee span {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

.marquee i {
  font-style: normal;
  color: var(--clay);
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Manifeste ---------- */

.manifest {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(4rem, 9vw, 7rem) var(--gutter);
}

.manifest p {
  max-width: 56rem;
  margin: 0 auto;
  font-size: clamp(1.5rem, 3.1vw, 2.6rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  font-weight: 450;
  text-align: center;
  text-wrap: balance;
}

.manifest .w { display: inline-block; }

/* ---------- Sections communes ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-no {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--clay);
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
}

/* ---------- Approche ---------- */

.approach {
  padding: clamp(4rem, 8vw, 7rem) var(--gutter);
}

.approach-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
}

.approach-item {
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}

.approach-no {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--green);
  border-radius: 999px;
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.3rem;
}

.approach-item h3 {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}

.approach-item p {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---------- Projets ---------- */

.projects {
  padding: clamp(2rem, 4vw, 4rem) var(--gutter) clamp(4rem, 8vw, 7rem);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
}

/* Les cartes sont des <button> : reset complet */
.project {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.project:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.p-wide { grid-column: span 4; }
.p-tall { grid-column: span 2; }

.project figure {
  overflow: hidden;
  aspect-ratio: 3 / 2;
}
.p-tall figure { aspect-ratio: 3 / 4; }

.project img {
  filter: saturate(0.92);
  transform: scale(var(--s, 1));
  transition: transform 1.1s var(--ease-out), filter 0.6s ease;
}
.project:hover figure { --s: 1.045; }
.project:hover img { filter: saturate(1.05); }

/* Révélation d'image au scroll : rideau + dé-zoom */
.anim .img-reveal {
  clip-path: inset(100% 0 0 0);
  --s: 1.14;
}

.anim .img-reveal.is-visible {
  clip-path: inset(0 0 0 0);
  --s: 1;
  transition: clip-path 1.1s var(--ease-reveal);
}

.anim .project:hover .img-reveal.is-visible { --s: 1.045; }

.project-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
}

.project-name {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.project-idx {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--clay);
}

.project-meta h3 {
  font-size: 1.02rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.project-meta p {
  font-size: 0.8rem;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.p-tall .project-meta {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

/* ---------- Détail projet ---------- */

.project-detail {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: var(--paper);
}

.project-detail.is-open { display: block; }

.detail-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 1.1rem 0;
  background: linear-gradient(to bottom, var(--paper) 60%, transparent);
}

.detail-close {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.35rem 1.05rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.detail-close:hover { background: var(--ink); color: var(--paper); }

.detail-hero {
  aspect-ratio: 16 / 9;
  max-height: 62vh;
  overflow: hidden;
}

.detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.6rem, 3vw, 2.4rem) 0 1.2rem;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.detail-head p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.detail-desc {
  max-width: 46rem;
  color: var(--ink-soft);
  padding: 1.6rem 0 clamp(2rem, 4vw, 3rem);
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
}

.detail-gallery figure {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.detail-gallery figure:nth-child(3n) {
  grid-column: 1 / -1;
  aspect-ratio: 21 / 10;
}

/* ---------- Atelier ---------- */

.studio {
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(4rem, 8vw, 7rem) var(--gutter);
}

.studio .section-head { border-color: rgba(28, 28, 24, 0.2); }

.studio-grid {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
}

.studio-figure {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 38rem;
}

.studio-figure figcaption { background: var(--paper-deep); }

.studio-text h3 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  margin-bottom: 1.4rem;
}

.studio-text p {
  color: var(--ink-soft);
  max-width: 34rem;
  margin-bottom: 1.2rem;
}

.studio-list {
  list-style: none;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.studio-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.studio-list li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--green);
  flex-shrink: 0;
}

/* ---------- Contact ---------- */

.contact {
  background: var(--green-deep);
  color: var(--paper);
  padding: clamp(4.5rem, 9vw, 8rem) var(--gutter) 0;
  overflow: hidden;
}

.contact-main {
  display: grid;
  grid-template-columns: 7fr 4fr;
  gap: clamp(2.5rem, 5vw, 6rem);
  align-items: start;
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.contact-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--clay);
  margin-bottom: 1.2rem;
}

.contact-title {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  margin-bottom: 2.4rem;
}

.contact-mail-cta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.8rem;
  max-width: 100%;
  font-size: clamp(1.15rem, 2.6vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 45%, transparent);
  padding-bottom: 0.35rem;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.contact-mail-cta .cta-text {
  overflow-wrap: anywhere;
}

.contact-mail-cta .cta-arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease-out);
}

.contact-mail-cta:hover { color: #fff; border-color: var(--paper); }
.contact-mail-cta:hover .cta-arrow { transform: translate(0.25rem, -0.25rem); }

.contact-right {
  display: grid;
  gap: 1.8rem;
  border-left: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
  padding-left: clamp(1.5rem, 3vw, 3rem);
}

.contact-right span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: color-mix(in srgb, var(--paper) 60%, transparent);
  margin-bottom: 0.4rem;
}

.contact-right p { font-size: 0.98rem; line-height: 1.55; }
.contact-right a:hover { text-decoration: underline; }

.contact-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.3rem 0 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--paper) 65%, transparent);
}

.contact-bottom a:hover { color: var(--paper); }

/* ---------- Reveal (scroll) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(1.6rem);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .project img, .hero-figure img { transition: none; }
  .marquee-track { animation: none; }
  .loader { display: none; }
  .grain { display: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
    padding-top: 7rem;
  }

  .hero-figure { height: auto; aspect-ratio: 4 / 3; }

  .approach-grid { grid-template-columns: 1fr; gap: 2.2rem; }

  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .p-wide { grid-column: span 2; }
  .p-tall { grid-column: span 1; }

  .studio-grid { grid-template-columns: 1fr; }
  .studio-figure { max-width: 28rem; }

  .detail-head { flex-direction: column; gap: 0.4rem; }
  .detail-hero { aspect-ratio: 4 / 3; }

  .contact-main { grid-template-columns: 1fr; }
  .contact-right {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
    padding-top: 1.8rem;
  }

  .contact-bottom { flex-wrap: wrap; }

  /* Menu mobile */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 2.6rem;
    height: 2.6rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 120;
  }

  .nav-toggle span {
    display: block;
    width: 1.5rem;
    height: 1.5px;
    background: var(--ink);
    margin: 0 auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

  .site-nav {
    position: fixed;
    inset: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    font-size: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .site-nav.is-open { opacity: 1; pointer-events: auto; }
}

@media (max-width: 520px) {
  .project-grid { grid-template-columns: 1fr; }
  .p-wide, .p-tall { grid-column: span 1; }
  .p-tall figure { aspect-ratio: 3 / 4; }
  .project-meta { flex-direction: column; gap: 0.15rem; }
  .project-meta p { white-space: normal; }

  .detail-gallery { grid-template-columns: 1fr; }
  .detail-gallery figure:nth-child(3n) { aspect-ratio: 4 / 3; }

  .contact-mail-cta { font-size: 1.05rem; }
}
