/* MAIN (scopé) */
.home * { margin:0; padding:0; box-sizing:border-box; }

/* Base page reset and background to avoid white edges while scrolling */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-main);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

/* Styles targeting the body when it has the .home class */
body.home {
  font-family: var(--font-main);
  color: var(--color-main);
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: visible;
}

/* Canvas + overlay */
.home #webgl-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.home .hud-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 10;
}
.home .hud-overlay > * { pointer-events: all; }

/* Top bar (aligne sur --header-h global) */
.home .top-logo-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; align-items: center; justify-content: center;
  z-index: 101;
}
.home .logo-text {
  font-size: 1.5rem; font-weight: 700; letter-spacing: 0.3em;
  color: var(--color-main);
  text-shadow: 0 0 20px var(--color-main);
}

/* Side menu (aligne top/height sur --header-h) */
.home .side-menu {
  position: fixed;
  top: var(--header-h);
  left: -280px;
  width: 280px;
  height: calc(100dvh - var(--header-h));
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; overflow-y: auto;
}
.home .side-menu.open { left: 0; }

.home .menu-nav { flex: 1; padding: 1rem 0; }
.home .menu-item {
  width: 100%; display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem;
  background: transparent; border: none; border-left: 3px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer; transition: all 0.2s;
  font: inherit; font-size: 0.95rem; text-align: left;
}
.home .menu-item:hover {
  color: white; background: rgba(255, 255, 255, 0.05); border-left-color: white;
}
.home .menu-item.active {
  color: white; background: rgba(255, 255, 255, 0.1); border-left-color: white;
}
.home .menu-icon { font-size: 1.3rem; width: 24px; text-align: center; }
.home .menu-label { flex: 1; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.home .menu-arrow { font-size: 1.5rem; transition: transform 0.2s; }
.home .menu-item.active .menu-arrow { transform: rotate(90deg); }

.home .submenu {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.5);
}
.home .submenu.open { max-height: 500px; }
.home .submenu-header {
  padding: 0.8rem 1.5rem; font-size: 0.7rem; letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.home .submenu-items { max-height: 400px; overflow-y: auto; }
.home .submenu-item {
  display: block; width: 100%;
  padding: 0.8rem 1.5rem 0.8rem 3.5rem;
  background: transparent; border: none; border-left: 3px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer; transition: all 0.2s;
  font: inherit; font-size: 0.85rem; text-align: left; text-decoration: none;
}
.home .submenu-item:hover {
  color: white; background: rgba(255, 255, 255, 0.05);
  border-left-color: rgba(255, 255, 255, 0.5);
}
.home .menu-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem 1rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to top, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0));
}
.home .menu-stat {
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}
.home .menu-stat:first-child {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}
.home .menu-stat:nth-child(2):last-child {
  grid-column: 1 / -1;
}
.home .stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home .stat-value {
  font-size: 1.05rem;
  font-weight: 750;
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-title);
  letter-spacing: 0.04em;
}
.home .menu-stat:not(:first-child) .stat-value{
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home .menu-stat:first-child .stat-value {
  font-size: 1.85rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Burger — utilise les variables globales (reste carré et calé) */
.home .menu-toggle {
  position: fixed;
  left: 1rem;
  top: calc((var(--header-h) - var(--burger-size)) / 2);
  width: var(--burger-size);
  height: var(--burger-size);
  aspect-ratio: 1 / 1;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--color-btn-border);
  border-radius: 6px;
  cursor: pointer;
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.2s;
}
.home .menu-toggle:hover { background: rgba(255, 255, 255, 0.1); border-color: white; }
.home .menu-toggle span {
  width: calc(var(--burger-size) * 0.64);
  height: 3px; background: white; border-radius: 2px; display: block; transition: all 0.2s;
}
.home .menu-toggle.active span:nth-child(1) { transform: translateY(11px) rotate(45deg); }
.home .menu-toggle.active span:nth-child(2) { opacity: 0; }
.home .menu-toggle.active span:nth-child(3) { transform: translateY(-11px) rotate(-45deg); }

/* Hero */
.home .hud-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; z-index: 10; max-width: 90%;
}
.home .main-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700; line-height: 1.2; margin: 0 0 1.5rem 0;
  color: #ffffff; opacity: 0.95;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.home .title-line { display: block; letter-spacing: 0.05em; color: white; text-shadow: 0 0 20px rgba(255,255,255,0.3); }
.home .title-line.highlight { color: rgba(255, 255, 255, 0.6); font-weight: 400; font-size: 0.9em; }
.home .main-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em; margin: 0;
}

/* Scanlines (une seule définition) */
.home .scanlines {
  position: fixed; inset: 0;
  background: var(--scanlines);
  pointer-events: none; z-index: 999; opacity: 0.2;
  animation: home-scanlines 8s linear infinite;
}
@keyframes home-scanlines {
  0% { transform: translateY(0); } 100% { transform: translateY(10px); }
}

/* Cards */
.home .project-card {
  position: relative; background: var(--color-card);
  border: 1px solid var(--color-card-border);
  backdrop-filter: blur(10px);
  overflow: hidden; transition: all 0.4s ease; cursor: pointer;
}
.home .project-card::before {
  content: ''; position: absolute; top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.6s ease;
}
.home .project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}
.home .project-card:hover::before { left: 100%; }
.home .card-image { position: relative; width: 100%; height: 200px; overflow: hidden; }
.home .card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; opacity: 0.85; }
.home .project-card:hover .card-image img { transform: scale(1.05); opacity: 1; }
.home .card-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 14, 20, 0.7), transparent); }
.home .card-content { padding: 1.5rem; }
.home .card-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.8rem; color: var(--color-main); letter-spacing: 0.03em; }
.home .card-description { font-size: 0.9rem; color: rgba(255, 255, 255, 0.5); margin-bottom: 1rem; line-height: 1.6; }
.home .card-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.home .card-tag { padding: 0.3rem 0.7rem; background: var(--color-btn-hover); border: 1px solid var(--color-btn-border); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--color-dim); }
.home .card-button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.3rem; background: transparent; border: 1px solid var(--color-btn-border);
  color: var(--color-dim); text-decoration: none; font-weight: 500; letter-spacing: 0.08em; font-size: 0.85rem; transition: all 0.3s ease;
}
.home .card-button:hover { background: var(--color-btn-hover); border-color: var(--color-accent); transform: translateX(5px); }
.home .card-button .arrow { transition: transform 0.3s ease; }
.home .card-button:hover .arrow { transform: translateX(5px); }

/* Bottom nav */
.home .hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.5rem 2.5rem;
  background: linear-gradient(to top, rgba(10, 14, 20, 0.7), transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.home .nav-items { display: flex; justify-content: center; gap: 1.5rem; }
.home .nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.8rem 1.5rem; background: transparent;
  border: 1px solid var(--color-btn-border);
  color: var(--color-dim); cursor: pointer; transition: all 0.3s ease;
  font: inherit; font-size: 0.75rem; letter-spacing: 0.15em;
}
.home .nav-item:hover, .home .nav-item.active {
  border-color: var(--color-accent); color: var(--color-main); background: var(--color-btn-hover);
}
.home .nav-icon { font-size: 1.3rem; opacity: 0.8; }

/* Responsive */
@media (max-width: 768px) {
  .home .menu-toggle span { width: calc(var(--burger-size) * 0.5); height: 3px; margin: 0 auto; }
  .home .hud-center { max-width: 85%; }
  .home .main-title { font-size: clamp(2rem, 10vw, 3rem); }
  .home .main-subtitle { font-size: 0.85rem; }
}
