/* Correctif visuel: lisibilité sans contour blanc et fond Matrix visible. */
:root {
  --ly-page-bg: #010401;
  --ly-panel-bg: rgba(0, 0, 0, .72);
  --ly-panel-border: rgba(114, 255, 141, .58);
  --ly-text: #f3fff5;
  --ly-muted: #d7ffdc;
  --ly-accent: #00ff41;
  --ly-accent-strong: #72ff8d;
  --ly-control-bg: rgba(0, 0, 0, .9);
  --ly-control-text: #ffffff;
  --ly-focus: #ffffff;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --ly-page-bg: #ffffff;
    --ly-panel-bg: rgba(255, 255, 255, .96);
    --ly-panel-border: rgba(11, 111, 53, .24);
    --ly-text: #102217;
    --ly-muted: #385341;
    --ly-accent: #0b6f35;
    --ly-accent-strong: #075528;
    --ly-control-bg: #ffffff;
    --ly-control-text: #102217;
    --ly-focus: #001f0a;
  }
}

:root[data-theme="light"] {
  --ly-page-bg: #ffffff;
  --ly-panel-bg: rgba(255, 255, 255, .94);
  --ly-panel-border: rgba(7, 85, 40, .30);
  --ly-text: #102217;
  --ly-muted: #385341;
  --ly-accent: #0b6f35;
  --ly-accent-strong: #075528;
  --ly-control-bg: #ffffff;
  --ly-control-text: #102217;
  --ly-focus: #001f0a;
}

:root[data-theme="dark"] {
  --ly-page-bg: #010401;
  --ly-panel-bg: rgba(0, 0, 0, .72);
  --ly-panel-border: rgba(114, 255, 141, .58);
  --ly-text: #f3fff5;
  --ly-muted: #d7ffdc;
  --ly-accent: #00ff41;
  --ly-accent-strong: #72ff8d;
  --ly-control-bg: rgba(0, 0, 0, .9);
  --ly-control-text: #ffffff;
  --ly-focus: #ffffff;
}

html {
  background: var(--ly-page-bg) !important;
}

body {
  background: var(--ly-page-bg) !important;
  color: var(--ly-text) !important;
}

#root,
.app {
  position: relative;
  z-index: 1;
}

#root {
  width: min(1180px, calc(100% - 24px)) !important;
  max-width: 1180px !important;
  margin: 18px auto !important;
  padding: clamp(12px, 2.4vw, 28px) !important;
}

.app {
  min-height: calc(100vh - 36px);
  display: flex !important;
  flex-direction: column !important;
  gap: clamp(18px, 3vw, 34px);
}

.app > main {
  display: block !important;
  flex: 1 0 auto !important;
}

.matrix-background {
  z-index: 0 !important;
  opacity: 1;
}

:root[data-theme="light"] .matrix-background {
  /* En thème clair, le canvas dessine le fond blanc et l'ombre
     directement autour des lettres pour éviter un voile gris global. */
  opacity: 1;
  filter: none;
}

:root[data-theme="dark"] .matrix-background {
  opacity: 1;
  filter: saturate(1.2) contrast(1.1);
}

.header,
.contact,
.projets,
.home .projects .preview-card,
.authentication {
  background: var(--ly-panel-bg) !important;
  border: 1px solid var(--ly-panel-border) !important;
  color: var(--ly-text) !important;
  backdrop-filter: blur(1px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .26) !important;
}

.header {
  width: 100%;
  margin: 0 auto !important;
  border-radius: 12px !important;
}

.header .header-content {
  gap: 18px !important;
  padding: clamp(14px, 2.6vw, 28px) !important;
}

.header .header-content nav ul {
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 10px 16px !important;
  padding-left: 0 !important;
}

.header .header-content nav ul li a.nav-label--stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  max-width: 230px;
  line-height: 1.18;
  text-align: center;
}

.header .header-content nav ul li a.nav-label--stack .nav-line {
  display: block;
}

.header__logo {
  width: clamp(96px, 14vw, 150px) !important;
  height: clamp(96px, 12vw, 128px) !important;
  margin: 8px !important;
}

.home {
  width: 100%;
  padding: clamp(18px, 3vw, 34px) 0 !important;
}

.home h1 {
  margin-bottom: 16px !important;
  text-align: center;
}

.home > p {
  max-width: 760px;
  text-align: center;
}

.home .filters {
  width: min(900px, 100%);
  margin: 12px auto 0;
}

.home .filters select,
.home .filters button {
  min-height: 40px;
}

.home .projects {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(1040px, 100%);
  gap: clamp(16px, 2.4vw, 24px) !important;
  margin: clamp(24px, 4vw, 42px) auto 0 !important;
}

.home .projects .preview-card {
  width: 100% !important;
  max-width: 330px;
  min-width: 0;
  margin: 0 auto !important;
  border-radius: 8px !important;
}

.home .projects .preview-card.ly-project-hidden {
  display: none !important;
}

.ly-projects-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: 18px auto 0;
  padding: 10px 18px;
  border: 2px solid lime;
  border-radius: 8px;
  background-color: #000;
  color: #ffffffd9;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background-color .3s, box-shadow .3s, color .3s;
}

.ly-projects-toggle:hover {
  background-color: #6f6;
  color: #000;
  box-shadow: 0 0 15px #0f0, 0 0 30px #0f0;
}

.ly-projects-toggle[hidden] {
  display: none !important;
}

.preview-card__image {
  width: 100% !important;
  aspect-ratio: 16 / 10;
  max-height: 190px;
  object-fit: contain !important;
  display: block;
}

.preview-card__details {
  padding: 12px !important;
}

.preview-card__title {
  margin: 0 0 6px !important;
  font-size: 1rem !important;
  line-height: 1.25 !important;
}

.preview-card__role {
  margin: 0 !important;
}

.footer {
  width: 100%;
  margin: 0 auto !important;
  background: var(--ly-panel-bg) !important;
  border: 1px solid var(--ly-panel-border) !important;
  border-radius: 8px;
  color: var(--ly-text) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18) !important;
}

:root[data-theme="light"] .footer {
  box-shadow: 0 10px 28px rgba(11, 111, 53, .10) !important;
}

.header,
.header h1,
.header h2,
.header a,
.header button,
.home h1,
.home p,
.contact,
.contact h2,
.footer,
.footer a,
.projets,
.authentication {
  color: var(--ly-text) !important;
  text-shadow: none !important;
}

:root[data-theme="dark"] .header h1,
:root[data-theme="dark"] .home h1,
:root[data-theme="dark"] .footer a {
  color: var(--ly-accent) !important;
  text-shadow: 0 0 8px rgba(0, 255, 65, .42) !important;
}

.home p,
.contact__textarea textarea::placeholder,
.contact__textarea input::placeholder,
.contact__form textarea::placeholder,
.contact__form input::placeholder,
.projets form input::placeholder,
.projets form textarea::placeholder {
  color: var(--ly-muted) !important;
  opacity: 1;
}

.home .filters select,
.home .filters button,
.contact__buttons .contact__button,
.contact__send,
.contact__textarea textarea,
.contact__textarea input,
.contact__textarea select,
.contact__form textarea,
.contact__form input,
.contact__form select,
.projets form input,
.projets form textarea,
.projets form select,
.projets form button,
.authentication form input,
.authentication form button {
  background: var(--ly-control-bg) !important;
  color: var(--ly-control-text) !important;
  border-color: var(--ly-accent-strong) !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ly-focus) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(0, 255, 65, .65) !important;
}

.theme-toggle {
  background: var(--ly-control-bg) !important;
  color: var(--ly-control-text) !important;
  border-color: var(--ly-accent-strong) !important;
  min-width: 138px;
  text-align: center;
}

.theme-toggle:hover {
  background: var(--ly-accent-strong) !important;
  color: #000000 !important;
}

@media (max-width: 920px) {
  .home .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(700px, 100%);
  }
}

@media (max-width: 760px) {
  #root {
    width: min(100% - 16px, 680px) !important;
    margin: 8px auto !important;
    padding: 10px !important;
  }

  .app {
    gap: 18px;
  }

  .header {
    align-items: stretch !important;
  }

  .header .header-content {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 16px !important;
  }

  .header .header-content .header-left {
    align-items: center !important;
    text-align: center;
  }

  .header .header-content nav ul {
    justify-content: center !important;
    align-items: center !important;
    gap: 8px 12px !important;
  }

  .home .projects {
    grid-template-columns: 1fr;
    width: min(360px, 100%);
  }

  .home .projects .preview-card {
    max-width: 100%;
  }

  .footer {
    padding: 16px !important;
  }
}

@media (max-width: 480px) {
  .header .header-content nav ul {
    flex-direction: row !important;
  }

  .header .header-content nav ul li a,
  .header .header-content nav ul li .header__logout {
    display: inline-flex;
    padding: 6px 8px;
    font-size: .92rem !important;
  }

  .home .filters {
    align-items: stretch;
  }

  .home .filters select,
  .home .filters button {
    width: 100% !important;
  }
}
