/* Le contenu et la composition proviennent des deux pages d’origine. */
@media(max-width:800px) and (orientation:portrait) {
  :root {--gouttiere:clamp(14px,4.5vw,25px);--haut-barre:max(8px,env(safe-area-inset-top));--hauteur-barre:52px}
  #entreprise,#nos-prestations {scroll-margin-top:calc(var(--espace-barre) + 4px)}
  .barre {width:calc(100% - 20px);height:var(--hauteur-barre);padding:3px 7px 3px 10px;gap:6px;border-radius:12px}
  .marque img {width:auto;height:44px}
  .ouvre-menu {width:44px;height:44px}
  .marque {min-width:0;padding:0}
  .marque img {max-width:100%;object-position:left center}
  .contact-haut {gap:clamp(5px,1.7vw,10px)}
  .contact-haut .bouton {font-size:14px;min-height:44px;padding-inline:clamp(8px,2.4vw,14px)}
  .ouvre-menu {flex-shrink:0}
  .accueil {min-height:100svh}
  /* La photo traverse l’accueil. Le voile de lecture suit la hauteur réelle du texte. */
  .hero {overflow:hidden}
  .hero .paysage img {object-position:52% 58%}
  .hero::after {
    background:linear-gradient(to top, #101919cf 0, #101919b8 72px, #10191994 138px, transparent 205px)
  }
  .corps {
    flex:1;display:grid;position:relative;isolation:isolate;align-items:start;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:repeat(5,auto) minmax(12px,1fr) auto;
    margin:clamp(20px,7svh,70px) var(--gouttiere) 0;padding:0
  }
  .corps::before {
    content:"";pointer-events:none;position:absolute;z-index:-1;grid-area:1/1/6/2;
    inset:-35px calc(0px - var(--gouttiere)) -36px;
    background:linear-gradient(90deg,#10191be6 0%,#10191bd1 42%,#10191ba8 78%,#10191b60);
    mask-image:linear-gradient(to bottom,transparent,#000 32px,#000 calc(100% - 32px),transparent)
  }
  .corps > * {grid-column:1}
  .corps .metiers {grid-row:1}
  .corps h1 {grid-row:2}
  .corps .description {grid-row:3}
  .corps .entreprise {grid-row:4}
  .corps .actions {grid-row:5}
  .corps .urgence {grid-row:7}
  .hero h1 {font-size:clamp(34px,9vw,46px);line-height:1.02;margin-top:8px}
  .metiers {font-size:clamp(12px,3.4vw,16px)}
  .description {font-size:clamp(14px,3.9vw,18px);margin-top:10px;line-height:1.31}
  .entreprise {font-size:clamp(12px,3.2vw,15px);margin-top:8px}
  .actions {display:flex;flex-direction:column;align-items:flex-start;gap:7px;margin-top:16px}
  .actions .horaires {display:flex;flex-wrap:wrap;column-gap:.5em;align-items:baseline;text-shadow:0 1px 3px #10191b}
  .actions .horaires br {display:none}
  .actions .devis {min-height:44px;font-size:clamp(13px,3.6vw,17px)}
  .horaires {font-size:clamp(12px,3vw,14px)}
  .urgence {min-height:46px;margin-top:10px;padding:8px 8px 8px 14px}
  .numero {font-size:clamp(14px,4vw,18px)}
  .hero .legende {min-height:34px;align-items:center;margin:2px var(--gouttiere) 4px}
  .prestations {grid-template-columns:repeat(2,minmax(0,1fr));padding:2px 8px}
  .prestation {min-height:46px;gap:6px;padding:4px}
  .prestation svg {width:20px;height:20px}
  .prestation strong {font-size:clamp(13px,3.3vw,16px)}
  .prestation small {font-size:clamp(11px,2.8vw,13px)}
  .page-entreprise .page {width:auto;min-height:0;padding:24px var(--gouttiere) 20px}
  .portrait {flex:none;grid-template-columns:minmax(0,1fr);grid-template-areas:"rubrique" "titre" "figure" "texte" "lien";gap:0 14px;align-content:start;padding:0}
  .cadre {grid-area:figure;width:100%;margin-top:1rem;justify-self:start;align-self:center}
  .cadre .tuiles {display:none}
  .recit {display:contents}
  .rubrique {grid-area:rubrique;align-self:end}
  .recit h2 {grid-area:titre;align-self:start;margin:5px 0 0;font-size:clamp(26px,7vw,42px)}
  .prose {grid-area:texte;font-size:16px;line-height:1.45;margin-top:16px}
  .voir-chantiers {grid-area:lien;min-height:40px;justify-self:start;margin-top:8px}
  .engagements {margin-top:16px;padding:16px 0 0;gap:12px}
  .engagements h2 {font-size:20px}
  .engagement h3 {font-size:15px}
  dialog {max-width:calc(100% - 24px);max-height:82dvh}
  .galerie {grid-template-columns:1fr}
}
@media (max-width:380px) and (max-height:680px) and (orientation:portrait) {
  .corps {margin-top:12px;grid-template-rows:repeat(5,auto) minmax(4px,1fr) auto}
  .description,.entreprise {margin-top:5px}
  .actions {flex-direction:row;align-items:center;gap:8px;margin-top:8px}
  .actions .horaires {flex-direction:column;align-items:start;font-size:11.5px}
  .actions .horaires strong {white-space:nowrap}
  .urgence {margin-top:6px}
  .prestations .prestation {min-height:44px}
  .legende strong,.legende span {font-size:11px}
}
@media(max-width:800px) {
  section[tabindex="-1"]:focus {outline:none}
}
@media(max-width:365px) and (orientation:portrait) {
  
  .actions .devis {padding-inline:8px}
  .actions .horaires {font-size:11.5px}
}
@media(max-width:365px) and (max-height:620px) and (orientation:portrait) {
  .corps {margin-top:8px}
  .hero h1 {margin-top:5px}
  .corps .actions {margin-top:6px}
  .hero .legende {min-height:30px;margin-block:0}
}

/* Sur les téléphones les plus étroits, le numéro dispose de sa propre ligne. */
@media (max-width:319px) and (orientation:portrait) {
  :root {--hauteur-barre:88px}
  .barre {display:grid;grid-template-columns:minmax(0,1fr) auto 44px;grid-template-rows:44px 40px;gap:0 6px;padding:2px 8px}
  .barre .marque {grid-area:1/1;align-self:center}
  .barre .marque img {height:38px}
  .barre .contact-haut {display:contents}
  .barre .contact-haut .bouton {grid-area:1/2}
  .barre .ouvre-menu {grid-area:1/3}
  .barre .tel-haut {grid-area:2/1/3/-1;align-self:stretch;justify-content:center;min-height:0;border-top:1px solid #e7e4de}
}

/* Les liens restent utilisables dans les lecteurs HTML sans JavaScript. */
.panneau-mobile { display: none; }
@media (max-width: 1000px) {
  .panneau-mobile:target {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 12px;
    background: #0b151ab8;
    backdrop-filter: blur(4px);
  }
  .carte-menu-mobile {
    width: min(100%, 680px);
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    border-radius: 16px;
    padding: clamp(20px, 4vw, 38px);
    background: white;
    color: #14201e;
    box-shadow: 0 22px 90px #0005;
  }
  .carte-menu-mobile .fermer { display: grid; place-items: center; }
  [data-contenu] p + .bouton { margin-top: 20px; }
}

/* Points d’arrêt et espace entre les rubriques sur téléphone. */
@media screen and (max-width:600px) and (orientation:portrait),
       screen and (max-width:950px) and (max-height:500px) and (orientation:landscape) {
  :root {
    --retrait-entete: 6px;
    --bas-entete: calc(var(--retrait-entete) + var(--hauteur-barre));
    scroll-padding-top: calc(var(--bas-entete) + 6px);
  }
  body { --espace-barre: 0px; background: #f8f5ef; }
  body > .barre {
    position: fixed;
    top: var(--retrait-entete);
    width: calc(100% - 20px);
    max-width: calc(100% - 2 * max(10px, env(safe-area-inset-left), env(safe-area-inset-right)));
    margin-block: 0;
    border-radius: 12px;
    box-shadow: 0 2px 9px #13202024;
  }
  body > main {
    --espace-entre-rubriques: clamp(80px, 25vmin, 104px);
    --retrait-de-rubrique: 24px;
    background: #faf8f3;
    padding-bottom: env(safe-area-inset-bottom);
  }
  /* Le blanc suit le défilement. Les ancres gardent un retrait court. */
  body > main > .accueil { min-height: 100vh; min-height: 100dvh; }
  .accueil .hero { padding-top: calc(var(--bas-entete) + 12px); }

  #accueil + #entreprise,
  #entreprise + #nos-prestations {
    margin-block-start: calc(var(--espace-entre-rubriques) - var(--retrait-de-rubrique));
  }

  .page-entreprise .page, .atlas .atelier, .page-realisations .portfolio {
    padding-block-start: var(--retrait-de-rubrique);
  }

  .page-entreprise .page { padding-block-end: 0; }

  .atlas .atelier {
    padding-block-end: calc(var(--espace-entre-rubriques) - var(--retrait-de-rubrique));
  }

  .page-entreprise .engagements { padding-block-end: 0; }
}

/* La photo et les six prestations forment le premier écran en portrait. */
@media screen and (max-width: 600px) and (orientation: portrait) {
  .contact-haut .bouton {
    border-block: 4px solid transparent;
    border-radius: 9px;
    background-clip: padding-box;
  }
  body > main > .accueil {
    grid-template-rows: minmax(min-content, 1fr) auto;
  }
  .accueil .hero {
    padding-top: calc(var(--bas-entete) + clamp(24px, 4svh, 42px));
  }
  .hero .paysage img {
    object-fit: cover;
    object-position: 50% 46%;
  }
  .hero::after {
    background: linear-gradient(to bottom, #10191d24, #10191dbd 27%, #10191dc7 64%, #0d161ae6);
  }
  .hero .corps {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    align-items: center;
    margin: 0 var(--gouttiere);
    padding: 0;
    text-align: center;
  }
  .hero .corps::before { content: none; }
  .hero .metiers {
    margin-top: auto;
    gap: .55em;
    font-size: clamp(.875rem, 3.8vw, 1rem);
  }
  .hero h1 {
    margin-top: .8rem;
    font-size: clamp(2rem, 10.05vw, 3rem);
    line-height: 1.04;
    white-space: normal;
    text-wrap: wrap;
  }
  .hero .description {
    max-inline-size: 37ch;
    margin-top: 1.2rem;
    font-size: clamp(1.0625rem, 4.65vw, 1.1875rem);
    line-height: 1.47;
    text-wrap: pretty;
  }
  .hero .entreprise {
    margin-top: .95rem;
    font-size: .9375rem;
    line-height: 1.45;
    text-wrap: balance;
  }
  .hero .corps .actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    width: 100%;
    margin-top: 1.4rem;
    padding-bottom: clamp(24px, 4svh, 38px);
  }
  .hero .actions .devis {
    min-height: 48px;
    padding-inline: 1.5rem;
    font-size: 1.0625rem;
  }
  .hero .actions .horaires {
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    align-items: baseline;
    gap: .15em .5em;
    font-size: .875rem;
    line-height: 1.45;
  }
  .hero .horaires br { display: none; }
  .hero .horaires strong { white-space: nowrap; }
  .hero .urgence {
    margin-top: auto;
    flex-wrap: wrap;
    gap: .35rem .65rem;
    padding: .65rem .75rem .65rem 1rem;
    font-size: .875rem;
    text-align: start;
  }
  .hero .numero { font-size: clamp(1rem, 4.45vw, 1.25rem); }
  .hero .legende {
    align-self: center;
    margin: 0 var(--gouttiere);
    min-height: 44px;
    align-items: center;
  }
  .hero .legende :is(strong, span) { font-size: .8125rem; }
  .accueil .prestations { padding: .2rem var(--gouttiere); }
  .accueil .prestation {
    min-width: 0;
    min-height: 3.25rem;
    gap: .45rem;
    padding: .45rem .35rem .45rem 0;
  }
  .accueil .prestation:nth-child(even) { padding-inline: .5rem 0; }
  .accueil .prestation strong { font-size: 1rem; }
  .accueil .prestation small { font-size: .8125rem; line-height: 1.3; }
}

@media screen and (min-width:320px) and (max-width:359px) and (orientation:portrait) {
  :root { --hauteur-barre: 48px; }
  .barre { gap: 4px; padding: 2px 6px; }
  .barre .marque img { height: 36px; width: auto; }
  .barre .contact-haut { gap: 4px; }
  .barre .tel-haut, .barre .bouton { font-size: .75rem; }
  .barre .tel-haut svg { display: none; }
  .barre .bouton { padding-inline: 6px; }
  .hero .metiers .toit { display: none; }
}
@media screen and (max-width:600px) and (orientation:portrait) and (display-mode:standalone),
       screen and (max-width:600px) and (orientation:portrait) and (display-mode:fullscreen) {
  :root { --retrait-entete: max(6px, env(safe-area-inset-top)); }
}

@media screen and (max-width: 950px) and (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .accueil .hero { align-items: center; padding-bottom: 1rem; }
  .hero .corps { align-items: center; margin-inline: var(--gouttiere); padding: 1.2rem 0; text-align: center; }
  .hero .metiers, .hero .entreprise, .hero .actions .horaires { font-size: .9375rem; }
  .hero h1 { margin-top: .75rem; font-size: clamp(2.3rem, 6vw, 3rem); }
  .hero .description { max-inline-size: 50ch; margin-top: 1rem; font-size: 1.0625rem; line-height: 1.45; }
  .hero .actions { flex-wrap: wrap; justify-content: center; gap: .75rem 1.25rem; }
  .hero .devis { min-height: 44px; font-size: 1rem; }
  .hero .urgence { flex-wrap: wrap; justify-content: center; margin-top: 1.15rem; font-size: .9375rem; }
  .hero .legende { position: static; align-self: center; }
  .hero::after { background: linear-gradient(to bottom, #0d161a99, #0d161acd); }
}
