/* =========================
   Elsass3D - Style (Dark Pro)
   ========================= */

:root{
  --bg: #0b0c10;
  --card: rgba(20, 22, 28, 0.72);
  --card2: rgba(20, 22, 28, 0.50);
  --text: #e6e7ea;
  --muted: #b7bcc6;
  --accent: #8faac4;
  --accent2: #a6c0da;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 12px 40px rgba(0,0,0,0.45);
  --radius: 18px;
  --radius2: 26px;
}

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

html, body{ height: 100%; }

body{
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: url("/assets/img/background_elsass3d.png") no-repeat center center fixed;
  background-size: cover;

  /* Anti “décalage à droite” */
  overflow-x: hidden;
}

.overlay{
  min-height: 100vh;
  backdrop-filter: blur(5px);
  background: radial-gradient(1200px 600px at 50% 10%, rgba(10,12,16,0.35), rgba(10,12,16,0.75));
  display: flex;
  flex-direction: column;
}

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

.skip-link{
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(20,22,28,0.9);
  color: var(--text);
  z-index: 9999;
}
.skip-link:focus{ left: 14px; }

.container{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

header{
  padding: 18px 0 10px;
}

.brand{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-left{
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}

.brand img{
  width: 170px;
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,0.55));
}

.nav{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a{
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: rgba(20,22,28,0.35);
  border-radius: 999px;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
  font-weight: 650;
  color: var(--muted);
}

.nav a:hover,
.nav a[aria-current="page"]{
  background: rgba(20,22,28,0.65);
  border-color: rgba(143,170,196,0.35);
  transform: translateY(-1px);
  color: var(--text);
}

.hero{
  margin-top: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  border-radius: var(--radius2);
  overflow: hidden;

  /* Anti overflow */
  max-width: 100%;
}

.hero-inner{
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  padding: 18px;
}

/* ✅ Fix principal : autorise la réduction des colonnes grid */
.hero-inner > *{
  min-width: 0;
}

@media (max-width: 960px){
  .hero-inner{ grid-template-columns: 1fr; }
  .nav{ justify-content: flex-start; }
  .brand{ align-items: flex-start; flex-direction: column; }
}

.hero-left{
  display: flex;
  flex-direction: column;
  gap: 14px;

  /* Anti overflow */
  min-width: 0;
}

.title{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;

  /* Anti overflow */
  min-width: 0;
}

.title h1{
  font-size: 1.65rem;
  color: var(--accent);
  letter-spacing: 0.2px;

  /* Anti overflow texte */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge{
  font-size: 0.95rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  padding: 8px 12px;
  border-radius: 999px;

  /* Anti overflow badge */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lead{
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);

  /* Anti overflow */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.links-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 760px){
  .links-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px){
  .links-grid{ grid-template-columns: 1fr; }
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(20,22,28,0.45);
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
  font-weight: 650;
  color: var(--text);
  user-select: none;

  /* Anti overflow en grid */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.btn:hover{
  transform: translateY(-1px);
  background: rgba(20,22,28,0.70);
  border-color: rgba(143,170,196,0.35);
}

.btn .icon{
  width: 18px;
  height: 18px;
  display: inline-block;
  opacity: 0.9;
}

.hero-right{
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;

  /* Anti overflow */
  min-width: 0;
}

.portrait{
  width: min(360px, 100%);


  /* Anti overflow */
  max-width: 100%;
}

.portrait img{
  width: 100%;
  height: 100%;
  display: block;
}

.gallery{
  width: 100%;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 220px;

  /* Anti overflow */
  max-width: 100%;
}

.gallery img{
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 900ms ease;
}

.gallery img.is-visible{
  opacity: 1;
}

.section{
  margin-top: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(20,22,28,0.62), rgba(20,22,28,0.35));
  box-shadow: 0 10px 28px rgba(0,0,0,0.30);
  border-radius: var(--radius2);
  padding: 18px;

  /* Anti overflow */
  max-width: 100%;
}

.section h2{
  color: var(--accent);
  margin-bottom: 10px;
  font-size: 1.25rem;
}

.section h3{
  color: var(--accent2);
  margin: 14px 0 8px;
  font-size: 1.05rem;
}

.section p{
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 10px;

  /* Anti overflow */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kpis{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 760px){
  .kpis{ grid-template-columns: 1fr; }
}

.kpi{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(0,0,0,0.14);

  /* Anti overflow */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kpi strong{
  display: block;
  color: var(--accent2);
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.kpi span{
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.footer{
  margin-top: auto;
  padding: 18px 12px 26px;
  text-align: center;
  color: rgba(230,231,234,0.70);
  font-size: 0.95rem;
}

.small-muted{ color: var(--muted); }

.hr{
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  color: rgba(230,231,234,0.9);

  /* Anti overflow pour code long */
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* FIX: empêche les blocs image (galerie/portrait) de dépasser */
.gallery,
.portrait,
.gallery img,
.portrait img{
  max-width: 100%;
}

.gallery{
  width: 100%;
  overflow: hidden;
}

/* Si un overflow persiste, c’est souvent un arrondi: */
.hero,
.section{
  overflow: hidden;
}

/* =========================
   Projets - grille responsive 3 colonnes
   ========================= */

.projects-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}

/* Tablette */
@media (max-width: 480px){
  .projects-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 480px){
  .projects-grid{
    grid-template-columns: 1fr;
  }
}

.project-card{
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(20,22,28,0.62), rgba(20,22,28,0.35));
  border-radius: var(--radius2);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,0.30);
  transition: transform .15s ease, box-shadow .2s ease;
  min-width: 0;
}

.project-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.45);
}

.project-thumb{
  display: block;
  width: 100%;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}

.project-thumb img{
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

.project-body{
  padding: 16px;
}

.project-title{
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.project-desc{
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.project-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* Empêche les images de forcer la largeur des colonnes */
.project-thumb img{
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Autorise les cartes à rétrécir dans la grille */
.project-card{
  min-width: 0;
}

/* Autorise la grille à vraiment fonctionner */
.projects-grid{
  min-width: 0;
}

.btn .icon img{
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
.about-grid{
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 24px;
  align-items: center;
}

.about-photo img{
  width: 100%;
  height: auto;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

/* Mobile */
@media (max-width: 900px){
  .about-grid{
    grid-template-columns: 1fr;
  }
}
