@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* Variables globales du site */
:root{
  --font-main: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --h1-size: 42px;
  --h2-size: 30px;
  --h3-size: 20px;
  --p-size: 0.9rem;

  --h-weight: 700;
  --p-weight: 300;

  --line: 1.2;
  --line-p: 1.6;

  --violet-fonce:#1C1A35;
  --violet-clair:#4F5487;
  --vert:#CBD27A;
  --blanc:#f4f4f4;

  --footer-height: 40px;
  --sidebar-width: 90px;
  --topbar-offset: 124px;
  --section-pad-x: 10%;
  --content-pad-left: calc(var(--sidebar-width) + var(--section-pad-x));
  --section-safe-bottom: calc(var(--footer-height) + 24px);
  --section-height: 100dvh;
  --project-section-top-pad: calc(var(--topbar-offset) + 10px);
  --project-section-bottom-pad: calc(var(--section-safe-bottom) + 10px);
  --project-inner-height: calc(var(--section-height) - var(--project-section-top-pad) - var(--project-section-bottom-pad));
  --project-copy-width: 300px;
  --project-media-width: 760px;
  --project-grid-width: 1160px;
}

/* En-tete fixe partage par toutes les pages */
.topbar{
  position: fixed;
  top: 30px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
}

.topbar-box{
  width: 220px;
  height: 70px;
  background: var(--violet-fonce);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.topbar-link{
  display: inline-flex;
  align-items: center;
}

.topbar-logo{
  width: 60px;
  height: 60px;
}

.topbar-nav{
  width: 120px;
  height: 50px;
  background: var(--blanc);
  border-radius: 12px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 6px;
  padding: 6px;
}

.topbar-nav-link{
  color: var(--violet-fonce);
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.topbar-nav-link span{
  font-size: 10px;
  line-height: 1;
}

.topbar-nav-link img{
  width: 30px;
  height: 30px;
}

/* Navigation laterale par categorie */
.sidenav{
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 90;
  transition: opacity 200ms ease, transform 200ms ease;
}

.menu-toggle,
.menu-overlay{
  display: none;
}

.sidenav-nav{
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidenav-link{
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sidenav-link .sidebar-text{
  position: relative;
  display: inline-block;
  text-transform: uppercase;
  transition: transform 180ms ease, letter-spacing 180ms ease;
}

.sidenav-link .sidebar-text::after{
  content: "";
  position: absolute;
  top: 0;
  right: 40px;
  width: 3px;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: scaleY(0.35);
  transform-origin: center;
  transition: opacity 180ms ease, transform 220ms ease;
}

.sidenav-link .sidebar-icon{
  transition: transform 180ms ease;
}

@keyframes sidenav-pulse-rotated{
  0%{
    transform: rotate(180deg) scale(1);
  }
  50%{
    transform: rotate(180deg) scale(1.08);
  }
  100%{
    transform: rotate(180deg) scale(1);
  }
}

.sidenav-link:is(.is-active, [aria-current="page"]){
  flex-grow: 1.7;
}

.sidenav-link:is(.is-active, [aria-current="page"]) .sidebar-text{
  font-size: 1.8rem;
  letter-spacing: 0.1em;
}

.sidenav.is-hidden,
.contact-links-fixed.is-hidden{
  opacity: 0;
  pointer-events: none;
}

.sidenav.is-hidden{
  transform: translateX(-8px);
}

.sidenav-link:nth-child(1){
  background: var(--vert);
  color: var(--violet-fonce);
}

.sidenav-link:nth-child(2){
  background: var(--violet-fonce);
  color: var(--vert);
}

.sidenav-link:nth-child(3){
  background: var(--vert);
  color: var(--violet-fonce);
}

.sidenav-link:nth-child(4){
  background: var(--violet-clair);
  color: var(--vert);
}

.topbar-logo,
.topbar-nav-link img,
.sidebar-icon{
  object-fit: contain;
}

.sidebar-icon{
  width: 32px;
  height: 32px;
}

.sidebar-text{
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.sidenav-link:is(.is-active, [aria-current="page"]) .sidebar-text::after{
  opacity: 0.9;
  transform: scaleY(1);
}

@media (hover: hover){
  .sidenav-link:hover .sidebar-text{
    animation: sidenav-pulse-rotated 900ms ease-in-out infinite;
  }
}

/* Liens de contact et pied de page */
.home-photo{
  max-width: 100%;
  height: auto;
}

.home-contact-links{
  display: flex;
  gap: 16px;
  padding-top: 10px;
}

.contact-links-fixed{
  display: flex;
  position: fixed;
  top: 30px;
  right: 24px;
  z-index: 140;
  flex-direction: column;
  gap: 12px;
  transition: opacity 200ms ease, transform 200ms ease;
}

.contact-links-fixed.is-hidden{
  transform: translateX(8px);
}

.contact-link{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.contact-link img{
  width: 32px;
  height: auto;
  position: relative;
  z-index: 1;
  transition: transform 180ms ease;
}

@media (hover: hover){
  .contact-link:hover img{
    transform: scale(1.08);
  }
}

.footer-mobile-contacts{
  display: none;
}

footer{
  background-color: var(--violet-fonce);
  color: var(--blanc);
  height: var(--footer-height);
  width: 100vw;
  left: 0;
  right: 0;
  position: fixed;
  bottom: 0;
  z-index: 89;
  text-align: right;
}

footer p{
  margin-top: 10px;
  margin-right: 50px;
  font-weight: 700;
  max-width: 100%;
}

/* Base typographique et elements communs */
body{
  font-family: var(--font-main);
  font-size: var(--p-size);
  font-weight: var(--p-weight);
  line-height: var(--line-p);
  background-color: var(--blanc);
  color: var(--violet-fonce);
  margin: 0;
  overflow-x: hidden;
}

html{
  scroll-behavior: auto;
  scroll-snap-type: y mandatory;
}

html.is-smooth,
body.is-smooth{
  scroll-behavior: smooth;
}

h1, h2, h3{
  font-weight: var(--h-weight);
  line-height: var(--line);
  margin: 0;
}

h1{ font-size: var(--h1-size); }
h2{ font-size: var(--h2-size); }
h3{ font-size: var(--h3-size); }

p{
  font-size: var(--p-size);
  line-height: 1.5;
  max-width: 65ch;
  margin: 0 0 1em;
  letter-spacing: 0.01em;
  word-spacing: 0.02em;
  hyphens: auto;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

p + p{
  margin-top: 0.2em;
}

.btn{
  display: inline-flex;
  text-transform: uppercase;
  margin-left: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 11pt;
  font-weight: 600;
  color: var(--vert);
  background-color: var(--violet-fonce);
  transition: transform 180ms ease, box-shadow 180ms ease, color 180ms ease, background-color 180ms ease;
}

button.btn{
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 10px 10px;
  margin-left: 0;
}

@media (hover: hover){
  .btn:hover{
    transform: scale(1.04);
    box-shadow: 0 8px 18px rgba(28, 26, 53, 0.28);
    background-color: var(--violet-clair);
  }
}

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

/* Ajustements partages sur tablette */
@media (min-width: 1001px) and (max-width: 1500px){
  :root{
    --section-pad-x: 48px;
    --content-pad-left: calc(var(--sidebar-width) + 72px);
  }
}

/* Ajustements communs sur mobile */
@media (max-width: 1000px){
  :root{
    --footer-height: 78px;
    --h1-size: 34px;
    --h2-size: 24px;
    --topbar-offset: 92px;
    --section-pad-x: 24px;
    --section-safe-bottom: calc(var(--footer-height) + 18px);
    --project-section-top-pad: calc(var(--topbar-offset) + 10px);
    --project-section-bottom-pad: calc(var(--section-safe-bottom) + 10px);
    --project-inner-height: calc(var(--section-height) - var(--project-section-top-pad) - var(--project-section-bottom-pad));
  }

  .topbar{
    top: 10px;
    justify-content: flex-end;
    padding-right: 16px;
    padding-left: 16px;
    box-sizing: border-box;
  }

  .topbar-box{
    width: 188px;
    height: 58px;
    border-radius: 13px;
    padding: 7px 9px;
    max-width: calc(100vw - 86px);
  }

  .topbar-logo{
    width: 46px;
    height: 46px;
  }

  .topbar-nav{
    width: 102px;
    height: 42px;
    padding: 4px;
    border-radius: 10px;
  }

  .topbar-nav-link span{
    font-size: 9px;
  }

  .topbar-nav-link img{
    width: 24px;
    height: 24px;
  }

  .menu-toggle{
    display: inline-flex;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 125;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: var(--violet-fonce);
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .menu-toggle-icon,
  .menu-toggle-icon::before,
  .menu-toggle-icon::after{
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: var(--blanc);
    content: "";
    display: block;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .menu-toggle-icon{
    position: relative;
  }

  .menu-toggle-icon::before{
    position: absolute;
    top: -7px;
    left: 0;
  }

  .menu-toggle-icon::after{
    position: absolute;
    top: 7px;
    left: 0;
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon{
    transform: rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::before{
    top: 0;
    transform: rotate(90deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::after{
    opacity: 0;
  }

  .menu-overlay{
    display: block;
    position: fixed;
    inset: 0;
    z-index: 119;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .menu-overlay.is-open{
    opacity: 1;
    pointer-events: auto;
  }

  .sidenav{
    width: min(76vw, 320px);
    height: 100dvh;
    z-index: 120;
    transform: translateX(-100%);
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 12px 35px rgba(0,0,0,0.25);
  }

  .sidenav.is-open{
    transform: translateX(0);
  }

  .sidenav.is-hidden{
    opacity: 1;
    transform: translateX(-100%);
  }

  .sidenav-link{
    flex: 1 1 0;
    flex-direction: row;
    justify-content: flex-start;
    gap: 16px;
    padding: 0 24px;
  }

  .sidenav-link:is(.is-active, [aria-current="page"]){
    flex-grow: 1;
  }

  .sidebar-text{
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 1.3rem;
    letter-spacing: 0.02em;
  }

  .sidenav-link .sidebar-text::after{
    top: auto;
    right: 0;
    bottom: -8px;
    width: 100%;
    height: 3px;
    transform: scaleX(0.35);
    transform-origin: center;
  }

  .sidenav-link:is(.is-active, [aria-current="page"]) .sidebar-text::after{
    transform: scaleX(1);
  }

  .contact-links-fixed{
    display: none;
  }

  .home-contact-links{
    justify-content: flex-start;
  }

  body.menu-open{
    overflow: hidden;
  }

  footer{
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-sizing: border-box;
  }

  .footer-mobile-contacts{
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .footer-mobile-contacts .contact-link img{
    width: 28px;
  }

  footer p{
    margin: 0;
  }

  html{
    -webkit-text-size-adjust: 100%;
  }

  p{
    font-size: 0.75rem;
    line-height: 1.2;
  }
}
