/* Portfolio Amycie Nicolaÿ — V3, base Crème Studio
   - Fond crème chaud, images bord à bord, titres « léger + appuyé » (Table d'appoint **Reverso**), bouton menu rond.
   - Accueil : hero crème avec son nom manuscrit qui s'écrit, puis blocs pleine hauteur sans espace (Francesc Rifé).
   - Menu plein écran : sommaire à gauche + grille d'images à droite (Bernard Dubois).
   - Pages projet : défilement horizontal sur ordinateur (Crème), vertical image d'abord sur mobile (Rifé).
   DA de son book : orange RVB 232/74/32, Avenir (installée sur Mac / iPhone ; Nunito Sans ailleurs). */

:root {
  --cream: #f3efe9;
  --ink: #231f20;
  --orange: #e84a20;
  --muted: #8a7f78;
  --line: #e2dbd3;
  /* Avenir en premier (Light 300 / Book 400 / Medium 500, comme son brief) : Avenir Next en 300 tombe en Ultra Light sur Mac */
  --sans: "Avenir", "Avenir Next", "Nunito Sans", "Helvetica Neue", Arial, sans-serif;
  --gutter: 20px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--sans); font-weight: 300; font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
b { font-weight: 500; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tracés manuscrits : s'écrivent trait par trait ---------- */
.hand { display: block; height: auto; overflow: visible; }
.js .hand .s { clip-path: inset(0 100% 0 0); }
.js .hand .s-v { clip-path: inset(0 0 100% 0); }
.js .hand.draw .s { animation: hand-draw .36s cubic-bezier(.55, .1, .35, 1) forwards; animation-delay: calc(var(--i) * var(--step, .09s) + var(--d, 0s)); }
@keyframes hand-draw { to { clip-path: inset(0 0 0 0); } }

/* ---------- Bouton menu rond + langue (fixes) ---------- */
.menu-btn {
  position: fixed; z-index: 80; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); display: grid; place-content: center; gap: 5px; transition: background .25s;
}
.menu-btn i { display: block; width: 15px; height: 1.5px; background: var(--cream); transition: transform .3s ease; }
.menu-btn:hover { background: var(--orange); }
.menu-btn[aria-expanded="true"] { background: var(--orange); }
.menu-btn[aria-expanded="true"] i:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-btn[aria-expanded="true"] i:last-child { transform: translateY(-3.25px) rotate(-45deg); }
.lang-top {
  position: fixed; z-index: 60; top: calc(20px + env(safe-area-inset-top, 0px)); right: 16px;
  font-size: 12px; font-weight: 500; letter-spacing: .1em; padding: 5px 11px 4px; border-radius: 999px;
  background: rgba(243, 239, 233, .88); color: var(--ink);
}
.lang-top:hover { color: var(--orange); }
/* Logo (son nom manuscrit) dans le header, à droite du bouton menu, sur toutes les pages.
   Sur l'accueil, c'est la cible du grand nom du hero : il n'apparaît qu'une fois la transition arrivée. */
.head-logo { position: fixed; z-index: 80; left: 66px; top: calc(21px + env(safe-area-inset-top, 0px)); display: block; line-height: 0; }
.head-logo .hand { height: 26px; width: auto; }
.head-logo .hand { --step: .075s; }
.head-logo.is-proxy { opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.head-logo.is-proxy.on { opacity: 1; pointer-events: auto; }

/* ---------- Menu plein écran : sommaire + grille (Bernard Dubois) ---------- */
.menu { position: fixed; inset: 0; z-index: 70; background: var(--ink); color: var(--cream); display: grid; animation: menu-in .35s ease; }
.menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; } to { opacity: 1; } }
.menu-side { display: flex; flex-direction: column; gap: 28px; padding: 92px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.menu-home { font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.menu-list { display: grid; gap: 26px; }
.m-head { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 8px; }
.m-head .hand { height: 32px; width: auto; }
.m-head span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
.m-cat ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.m-cat a { display: inline-block; font-size: clamp(22px, 2.1vw, 30px); line-height: 1.25; transition: color .2s, transform .3s ease; }
.m-cat a:hover, .m-cat a.is-on { color: var(--orange); transform: translateX(8px); }
.menu-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.menu-foot a:hover { color: var(--cream); }
.menu-foot .lang { color: var(--orange); font-weight: 500; }
.menu-grid { display: none; }

/* =====================================================================
   ACCUEIL
   ===================================================================== */
.intro {
  /* Hauteur réduite pour laisser voir le haut des premiers projets ; le contenu est centré sur la fenêtre,
     pas sur le hero : la marge du haut vaut la partie des projets visible en bas (100vh - hauteur du hero). */
  --hero: 80vh;
  height: var(--hero); min-height: 420px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  padding: calc(100vh - var(--hero)) var(--gutter) 0; text-align: center;
}
@supports (height: 100svh) { .intro { --hero: 80svh; padding-top: calc(100svh - var(--hero)); } }
.intro-name { margin: 0; width: min(90vw, 980px); }
/* Le tracé du nom passe en position fixe (script) pour rejoindre le header, comme le bouton menu */
.hand--name.is-fixed { position: fixed; z-index: 75; margin: 0; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.hand--name.is-fixed.docked { opacity: 0; }   /* relais pris par le logo du header, à la même place */
.menu-open .hand--name.is-fixed { opacity: 0; }
.intro-name .hand { width: 100%; --d: .25s; --step: .085s; }
.intro-tag { margin: 0; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.js .intro-tag { opacity: 0; animation: rise .8s ease 2.6s forwards; }
@keyframes rise { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }

/* Projets : cartes bord à bord (mobile : empilées ; ordinateur : rangées pleine hauteur) */
.work { display: grid; }
.row { display: contents; }
@media (max-width: 1023px) {
  .home-h, .home-h .h-sticky, .home-h .h-track { display: contents; }
  .home-h .intro { grid-column: 1 / -1; }
  /* Mobile / tablette : images immobiles, sans aucun effet */
  .card-media { top: 0; bottom: 0; transform: none !important; }
  .card-media img, .card:hover .card-media img { transform: none !important; transition: none; }
  .more { display: none; }
}
.card { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 5; max-width: 100%; background: #d9d1c8; isolation: isolate; }
.card-media { position: absolute; left: 0; right: 0; top: -10%; bottom: -10%; will-change: transform; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-media img { transform: scale(1.04); }
.card::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(30, 20, 15, .58), rgba(30, 20, 15, 0) 48%); pointer-events: none; }
.card-num { display: block; margin-bottom: 6px; }
.card-num .hand { height: 30px; width: auto; fill: #fff; }
.card-title { position: absolute; z-index: 2; left: var(--gutter); right: var(--gutter); bottom: 24px; color: #fff; display: grid; gap: 6px; }
.card-title .lab { font-weight: 300; font-size: 25px; line-height: 1.1; }
.card-title em { font-style: normal; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }

/* ---------- Pied de page sombre et discret ---------- */
.foot { background: var(--ink); color: var(--cream); padding: 52px var(--gutter) calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 36px; }
.foot-name { width: min(280px, 70vw); }
.hand--foot { width: 100%; --step: .05s; }
.foot-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.foot-links li { display: grid; gap: 2px; }
.foot-links span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.foot-links a { font-size: 15px; overflow-wrap: anywhere; }
.foot-links a:hover, .foot-legal a:hover { color: var(--orange); }
.foot-legal { margin: 0; padding-top: 18px; border-top: 1px solid rgba(243, 239, 233, .16); display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }

/* =====================================================================
   PAGES PROJET
   Mobile / tablette : vertical, image d'abord (Rifé mobile), images bord à bord.
   Ordinateur (classe .is-h posée par le script) : défilement horizontal (Crème).
   ===================================================================== */
.h-track { display: flex; flex-direction: column; gap: 4px; }
.panel { margin: 0; }
.panel-img img { width: 100%; }
.panel-img.is-hero { order: -1; }
.panel-title { padding: 30px var(--gutter) 8px; }
.p-cat { display: inline-flex; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.p-cat .hand { height: 30px; width: auto; }
.p-cat span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
.p-cat:hover span { color: var(--orange); }
.panel-title h1 { margin: 0; font-weight: 300; font-size: clamp(36px, 10vw, 60px); line-height: 1.02; letter-spacing: -.005em; text-wrap: balance; }
.panel-title h1 span { display: block; }
.pills { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { border: 1px solid var(--ink); border-radius: 999px; padding: 3px 12px 2px; font-size: 12px; }
.h-hint { display: none; }
.panel-text { padding: 18px var(--gutter) 30px; }
.p-text p { margin: 0 0 1.1em; font-size: 15px; line-height: 1.7; max-width: 38em; color: var(--ink); font-weight: 400; }
.p-text .soon { color: var(--muted); font-style: italic; }
.fiches-btn {
  appearance: none; cursor: pointer; margin-top: 8px;
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--cream);
  font: 500 12px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; transition: background .2s;
}
.fiches-btn span { font-size: 16px; font-weight: 300; line-height: 0; }
.fiches-btn:hover { background: var(--orange); }

/* Mosaïques diagonales (façon Rifé) : grandes images qui remplissent la case sur une diagonale,
   petites images posées avec une marge sur le fond crème sur l'autre. Mobile : carrés 2 x 2. */
.mosaic { display: grid; grid-template-columns: 1fr 1fr; }
.mosaic--one { grid-template-columns: 1fr; }
.m-cell { position: relative; margin: 0; min-width: 0; min-height: 0; overflow: hidden; aspect-ratio: 1 / 1; }
.mosaic--one .m-cell { aspect-ratio: 4 / 3; }
.m-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-cell.small img { top: 10%; left: 10%; width: 80%; height: 80%; object-fit: contain; }
.panel-next { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 5; margin-top: 4px; color: #fff; isolation: isolate; }
.panel-next img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.panel-next::after { content: ""; position: absolute; inset: 0; background: rgba(28, 22, 20, .62); transition: background .4s ease; }
.panel-next:hover::after { background: rgba(28, 22, 20, .48); }
.panel-next:hover img { transform: scale(1.04); }
.pn-txt { position: absolute; z-index: 1; left: var(--gutter); right: var(--gutter); top: 50%; transform: translateY(-50%); display: grid; gap: 10px; justify-items: start; }
.pn-label { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--cream); border: 1px solid rgba(243, 239, 233, .7); border-radius: 999px; padding: 5px 12px 4px; }
.pn-txt .lab { font-weight: 300; font-size: 28px; line-height: 1.1; }
.pn-arrow { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--orange); font-size: 20px; margin-top: 6px; transition: transform .3s ease; }
.panel-next:hover .pn-arrow { transform: translateX(6px); }
.h-progress { display: none; }

/* Fiches techniques : panneau plein écran */
.fiches { position: fixed; inset: 0; z-index: 90; background: var(--cream); overflow-y: auto; overscroll-behavior: contain; }
.fiches[hidden] { display: none; }
.fiches-bar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px var(--gutter); background: rgba(243, 239, 233, .95); border-bottom: 1px solid var(--line); }
.fiches-bar p { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.fiches-bar p span { color: var(--muted); font-weight: 300; }
.fiches-close { appearance: none; border: 0; background: var(--ink); color: var(--cream); border-radius: 999px; cursor: pointer; padding: 9px 16px; font: 500 12px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; display: inline-flex; gap: 8px; align-items: center; }
.fiches-close:hover { background: var(--orange); }
.fiches-close span { font-size: 18px; font-weight: 300; line-height: 0; }
.fiches-body { padding: 20px var(--gutter) 48px; display: grid; gap: 14px; }
.g-row { display: grid; gap: 14px; }
.g-row figure { margin: 0; min-width: 0; }
.g-row img { width: 100%; height: auto; }

/* =====================================================================
   TABLETTE
   ===================================================================== */
@media (min-width: 768px) {
  :root { --gutter: 4vw; }
  .menu-btn { top: 22px; left: 22px; width: 46px; height: 46px; }
  .menu-btn i { width: 18px; }
  .lang-top { top: 32px; right: 24px; }
  .head-logo { left: 88px; top: 21px; }
  .head-logo .hand { height: 48px; }
  .work { grid-template-columns: 1fr 1fr; }
  .card { aspect-ratio: 3 / 4; }
  .card-title .lab { font-size: 28px; }
  .foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: end; column-gap: 6vw; padding-top: 72px; }
  .foot-links { grid-template-columns: 1fr 1fr; gap: 18px 4vw; }
  .foot-legal { grid-column: 1 / -1; }
  .panel-title h1 { font-size: clamp(48px, 7vw, 80px); }
  .fiches-body { gap: 24px; padding-top: 32px; }
  .g-row { display: flex; gap: 24px; align-items: center; }
  .g-row--half figure { flex: 0 0 calc(50% - 12px) !important; }
  .g-row--wide figure { flex: 1 1 100% !important; }
  .panel-next { aspect-ratio: 16 / 9; }
}

/* =====================================================================
   ORDINATEUR
   ===================================================================== */
@media (min-width: 1024px) {
  /* Menu : sommaire à gauche, grille d'images à droite */
  /* Grille 4 x 4 de carrés collés : sa largeur = la hauteur de l'écran, pour finir pile en bas */
  .menu { grid-template-columns: minmax(320px, 1fr) min(100vh, 68vw); }
  .menu-side { padding: 100px 3.5vw 32px; }
  .menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; height: 100vh; overflow: hidden; }
  /* Carré fixe (padding-top) : évite que les cases se chevauchent dans Safari ; image centrée et recadrée dedans */
  .tile { position: relative; display: block; overflow: hidden; min-width: 0; min-height: 0; background: #3a3332; transition: opacity .35s ease; }
  .tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; transition: transform 1s cubic-bezier(.2, .7, .2, 1); }
  .tile:hover img { transform: scale(1.05); }
  .menu-grid.dim .tile { opacity: 0; }
  .menu-grid.dim .tile.on { opacity: 1; }

  /* Accueil : 4 projets en défilement horizontal (façon Crème), puis 4 en grille 2 x 2, puis le pied de page */
  .intro { --hero: 86vh; }
  @supports (height: 100svh) { .intro { --hero: 86svh; } }
  .work { display: block; }
  .home-h .h-track { display: grid; grid-template-columns: 1fr 1fr; }          /* sans animation : simple grille */
  .home-h .card { aspect-ratio: auto; height: 92vh; min-height: 520px; }
  .home-h .intro { grid-column: 1 / -1; }
  .row--grid .card { aspect-ratio: 4 / 5; height: auto; }                    /* plus hautes que larges */
  /* Hero dans le défilement horizontal : un peu moins large que l'écran pour laisser voir le premier projet ;
     la marge de gauche garde le nom centré sur l'écran */
  .is-h .home-h .intro { flex: none; width: 88vw; height: 100%; min-height: 0; padding: 0 0 0 12vw; }
  .is-h .home-h .h-track { display: flex; }
  .is-h .home-h .card { width: 44vw; height: 100%; min-height: 0; }
  .row--grid { display: grid; grid-template-columns: 1fr 1fr; }
  .more { display: none; }
  .is-h .more { display: flex; align-items: center; width: 50vw; padding: 0 6vw; background: var(--ink); color: var(--cream); }
  .more p { margin: 0; font-weight: 300; font-size: clamp(26px, 2.5vw, 42px); line-height: 1.3; text-wrap: balance; max-width: 18em; }
  .more-label { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
  .more strong { font-weight: 300; font-size: clamp(40px, 4.4vw, 76px); line-height: 1; }
  .more ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: clamp(18px, 1.5vw, 24px); }
  .more ul b { color: var(--orange); font-weight: 500; }
  .more-arrow { display: grid; place-items: center; width: 52px; height: 52px; margin-top: 14px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 22px; transition: transform .3s ease; }
  .more:hover .more-arrow { transform: translateY(6px); }
  .card-num .hand { height: 40px; }
  .card-title { left: 2.6vw; right: 2.6vw; bottom: 40px; }
  .card-title .lab { font-size: clamp(28px, 2.6vw, 44px); }

  /* Page projet : défilement horizontal */
  .is-h .h-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; }
  .is-h .h-track { flex-direction: row; align-items: stretch; gap: 0; height: 100%; width: max-content; will-change: transform; }
  .is-h .panel { flex: none; height: 100%; }
  .is-h .panel-img { display: flex; width: auto; }
  .is-h .panel-img img { height: 100%; width: auto; max-width: none; }
  .is-h .panel-img.is-hero { order: 0; }
  .is-h .panel-img.tall { height: 84%; align-self: flex-start; margin: 0 3vw; }
  .is-h .panel-img.mid { height: 58%; margin: 0 3.5vw; }
  .is-h .panel-img.mid.bottom { align-self: flex-end; margin-bottom: 9vh; }
  .is-h .panel-img.mid.top { align-self: flex-start; margin-top: 11vh; }
  .is-h .mosaic { --cell: 68vh; grid-template-columns: repeat(2, var(--cell)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .is-h .mosaic--half { grid-template-columns: var(--cell); }
  .is-h .mosaic--one { grid-template-rows: minmax(0, 1fr); --cell: 80vh; }
  .is-h .m-cell { aspect-ratio: auto; }
  .is-h .m-cell.small img { top: 11%; left: 12%; width: 76%; height: 78%; }
  .is-h .mosaic--one .m-cell.small img { top: 20%; left: 8%; width: 84%; height: 60%; }
  .is-h .panel-title { width: clamp(440px, 36vw, 640px); padding: 108px 3.6vw 48px; display: flex; flex-direction: column; justify-content: flex-start; }
  .is-h .p-cat { margin-bottom: 28px; }
  .is-h .panel-title h1 { font-size: clamp(48px, 4.6vw, 86px); }
  .is-h .h-hint { display: flex; gap: 10px; margin: auto 0 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .is-h .h-hint span { color: var(--orange); animation: nudge 1.6s ease-in-out infinite; }
  .is-h .panel-text { width: clamp(380px, 30vw, 520px); padding: 0 3.6vw; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
  .is-h .p-text p { font-size: clamp(15px, 1.05vw, 16.5px); }
  .is-h .panel-next { width: clamp(300px, 26vw, 440px); aspect-ratio: auto; margin: 0 0 0 4vw; }
  .is-h .pn-txt { left: 2.4vw; right: 2.4vw; }
  .is-h .pn-txt .lab { font-size: clamp(26px, 2.2vw, 38px); }
  .is-h .h-progress { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(35, 31, 32, .08); }
  .is-h .h-progress i { display: block; height: 100%; width: 100%; background: var(--orange); transform-origin: left; transform: scaleX(0); }
  @keyframes nudge { 50% { translate: 6px 0; } }
}

@media (prefers-reduced-motion: reduce) {
  .js .hand .s { clip-path: none !important; animation: none !important; }
  .js .intro-tag { opacity: 1; animation: none; }
  .menu { animation: none; }
  .card-media img, .tile img, .panel-next img { transition: none; }
  .is-h .h-hint span { animation: none; }
}
