/*
 * Responsive layer – 2026 refresh
 * Kept separate from main.css so the original design remains easy to compare.
 */

html {
  scroll-padding-top: 1rem;
}

body {
  overflow-x: hidden;
  overflow-x: clip;
}

:focus-visible {
  outline: 3px solid #eef1f7;
  outline-offset: 4px;
}

/* Project cards: keep the original markup and palette, with a clearer
   hierarchy and consistent proportions for website screenshots. */
.gallery__cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(30rem, 100%), 1fr));
  gap: 2.4rem;
  align-items: stretch;
}

.gallery__card {
  isolation: isolate;
  min-width: 0;
  padding: 1.2rem;
  grid-template-rows: auto 1fr;
  gap: 1.4rem;
  border-color: rgba(159, 170, 249, 0.72);
  border-radius: 1.4rem;
  background: linear-gradient(
    145deg,
    rgba(26, 30, 40, 0.96),
    rgba(11, 12, 19, 0.96)
  );
  box-shadow: 0 1.2rem 2.8rem rgba(5, 7, 18, 0.24);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.gallery__card::before {
  content: "";
  position: absolute;
  inset: 0 1.2rem auto;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6979f2, #eef1f7, #3dd6c6);
  opacity: 0.8;
}

.gallery__card figure {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.gallery__card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(207, 213, 252, 0.5);
  border-radius: 0.9rem;
  background-color: #0b0c13;
  object-fit: cover;
  object-position: top center;
}

.gallery__title {
  margin: 1.5rem 0.4rem 0;
  font-size: clamp(1.8rem, 1.8vw, 2.1rem);
  line-height: 1.25;
}

.gallery__tags {
  margin-top: 0.8rem;
  padding: 0 0.4rem;
  gap: 0.6rem;
  opacity: 1;
}

.gallery__tags li {
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(159, 170, 249, 0.42);
  background: rgba(73, 94, 244, 0.28);
  font-size: 1.05rem;
  line-height: 1.4;
}

.gallery__card-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.gallery__card-description {
  flex: 1;
  margin: 0;
  padding: 1.2rem 1.3rem;
  grid-row: auto;
  border-color: rgba(207, 213, 252, 0.82);
  border-radius: 0.9rem;
  font-size: 1.3rem;
  line-height: 1.55;
}

.gallery__card-url {
  width: fit-content;
  max-width: 100%;
  height: auto;
  min-height: 3.4rem;
  margin: auto 0 0;
  padding: 0.65rem 1.15rem;
  grid-row: auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(159, 170, 249, 0.5);
  background: rgba(73, 94, 244, 0.26);
  color: #eef1f7;
  line-height: 1.35;
}

.gallery__card:hover,
.gallery__card:focus-within {
  transform: translateY(-4px);
  border-color: #cfd5fc;
  box-shadow: 0 1.6rem 3.6rem rgba(5, 7, 18, 0.34);
}

.gallery__card-url[aria-disabled="true"] {
  cursor: default;
}

.gallery__card--link {
  display: flex;
  cursor: pointer;
}

.gallery__card-link {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.4rem;
  border-radius: 0.8rem;
  color: inherit;
  text-decoration: none;
}

.gallery__card--link .gallery__card-url {
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.gallery__card--link:hover .gallery__card-url,
.gallery__card--link:focus-within .gallery__card-url {
  background-color: #eef1f7;
  color: #1a1e28;
  transform: translateX(0.25rem);
}

.form__message {
  min-height: 2.4rem;
  margin-top: 1rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.form__message.is-success {
  color: #176b32;
}

.form__message.is-error {
  color: #a31621;
}

.form__message.is-pending {
  color: #293769;
}

.btn--form:disabled {
  cursor: wait;
  opacity: 0.7;
}

/* Keep the right-hand desktop panel flexible on short screens. */
.header {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.header__main-title {
  height: auto;
  min-height: 0;
  padding: clamp(3rem, 7vh, 8rem) 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heading-primary {
  margin-bottom: 0;
}

.header__link-container {
  height: auto;
  min-height: 0;
  padding: 1.5rem 1rem;
  flex-wrap: wrap;
}

.portfolio-links {
  position: relative;
  overflow: hidden;
}

/* Keep every navigation bubble circular: the two-word "À propos" label
   must not wrap and override the 1 / 1 aspect ratio on intermediate widths. */
.link-circle {
  width: clamp(14rem, 12vw, 16rem);
  height: clamp(14rem, 12vw, 16rem);
  white-space: nowrap;
}

.portfolio-links__grid-container,
#canvas {
  inset: 0;
  width: 100%;
  height: 100%;
}

.section-display {
  display: flow-root;
  overflow: visible;
}

/* The sidebar becomes narrow well before tablet mode. A 2x2 icon grid
   avoids squeezing four links into a tall 30% panel. */
@media only screen and (min-width: 48.01em) and (max-width: 95.81em) {
  .header__link-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(4rem, 5rem));
    justify-content: center;
    gap: 1rem;
  }
}

@media only screen and (min-width: 48.01em) and (max-width: 64em) {
  .heading-primary {
    font-size: 3.2rem;
  }

  .heading-primary--main-name {
    letter-spacing: 0.4rem;
  }

  .heading-primary--main-first-name {
    font-size: 2.8rem;
  }

  .heading-primary--sub-job-title1,
  .heading-primary--sub-job-title2 {
    font-size: 1.8rem;
  }

  .header__main-title {
    padding-inline: 1rem;
  }

  .link-circle--is-about,
  .link-circle--is-contact,
  .link-circle--is-projet {
    width: 13rem;
    height: 13rem;
  }
}

/* Short laptop screens: prevent the fixed right panel from overflowing. */
@media only screen and (min-width: 48.01em) and (max-height: 760px) {
  .header__main-title {
    padding-block: 2rem;
  }

  .heading-primary {
    font-size: 3.6rem;
  }

  .heading-primary--sub-job-title1,
  .heading-primary--sub-job-title2 {
    font-size: 1.9rem;
  }

  .header__link-container {
    display: grid;
    grid-template-columns: repeat(2, 4.2rem);
    gap: 0.8rem;
    padding: 1rem;
  }

  .logo-cv,
  .logo-github,
  .LinkedIn-container,
  .contact-link {
    width: 4rem;
    height: 4rem;
  }
}

/* Tablet + mobile: the header goes back into the document flow instead of
   covering the hero. Keep this layout through portrait-tablet widths. */
@media only screen and (max-width: 56.25em) {
  .header {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: auto;
    grid-template-columns: minmax(0, 1fr) 10rem;
    grid-template-rows: auto;
  }

  .header__main-title {
    width: auto;
    height: auto;
    min-width: 0;
    padding: 1.2rem 1.4rem;
    justify-content: flex-start;
    text-align: left;
    border-right: 0;
  }

  .heading-primary {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.6rem;
    row-gap: 0.25rem;
    align-items: baseline;
    font-size: clamp(2.4rem, 7vw, 3.2rem);
    line-height: 1.05;
  }

  .heading-primary--main-name,
  .heading-primary--main-first-name {
    display: inline;
    font-size: inherit;
    font-weight: 700;
    letter-spacing: 0;
  }

  .header .u-margin-bottom-medium {
    display: none;
  }

  .job-title {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
  }

  .job-title .span {
    display: none;
  }

  .heading-primary--sub-job-title1,
  .heading-primary--sub-job-title2 {
    display: inline;
    font-size: clamp(1.2rem, 3.6vw, 1.55rem);
    font-weight: 400;
    line-height: 1.3;
  }

  .heading-primary--sub-job-title1::after {
    content: " ·";
  }

  .header__link-container {
    width: 10rem;
    height: auto;
    padding: 0.9rem 0.7rem;
    display: grid;
    grid-template-columns: repeat(2, 3.7rem);
    place-content: center;
    gap: 0.65rem;
    border-left: 1px solid #eef1f7;
  }

  .logo-cv,
  .logo-github,
  .LinkedIn-container,
  .contact-link {
    width: 3.7rem;
    height: 3.7rem;
  }

  .contact-link {
    font-size: 0.85rem;
    border-width: 2px;
  }

  .portfolio-links {
    width: 100%;
    min-height: clamp(54rem, 86svh, 72rem);
    height: auto;
  }

  .portfolio-links__grid-container {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(6, 1fr);
  }

  #canvas {
    width: 100%;
    height: 100%;
  }

  .link-circle {
    width: clamp(8.75rem, 27vw, 11rem);
    height: clamp(8.75rem, 27vw, 11rem);
    padding: 1rem;
    font-size: clamp(1.6rem, 5vw, 2rem);
    box-shadow: 0 0 0 1rem rgba(159, 170, 249, 0.1);
  }

  .link-circle--is-contact {
    width: clamp(8.75rem, 27vw, 11rem);
    grid-column: 1 / 4;
    grid-row: 2 / 4;
  }

  .link-circle--is-about {
    width: clamp(8.75rem, 27vw, 11rem);
    grid-column: 6 / 9;
    grid-row: 2 / 4;
  }

  .link-circle--is-projet {
    width: clamp(8.75rem, 27vw, 11rem);
    grid-column: 4 / 7;
    grid-row: 4 / 6;
  }

  .link-circle-logo {
    width: 2rem;
  }

  .section-display {
    width: 100%;
    min-height: 0;
    padding-bottom: 5rem;
  }

  #projet,
  #about,
  #contact {
    margin-top: 5rem;
    scroll-margin-top: 1rem;
  }

  .link-circle-title {
    width: 9.5rem;
    margin-inline: 1.5rem;
    padding: 1.4rem;
  }

  .link-circle-title-text {
    margin-bottom: 0;
    font-size: 1.8rem;
  }

  .gallery,
  .section-display__content {
    padding-inline: 1.5rem;
  }

  .gallery__toolbar {
    gap: 1rem;
  }

  .gallery__filters {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .gallery__btn-group {
    width: 100%;
    gap: 0.65rem;
  }

  .btn--gallery {
    min-height: 4rem;
    padding: 0.45rem 0.9rem;
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .gallery__search,
  #search {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  #search {
    min-height: 4.4rem;
    font-size: 1.4rem;
  }

  .gallery__cards-grid {
    gap: 1.8rem;
  }

  .gallery__card {
    padding: 1.2rem;
    grid-template-rows: auto;
  }

  .gallery__card-content {
    min-height: 0;
    display: flex;
    gap: 1rem;
  }

  .gallery__card-description,
  .gallery__card-url {
    grid-row: auto;
  }

  .gallery__card-description {
    margin: 0;
    font-size: 1.35rem;
  }

  .gallery__card-url {
    height: auto;
    min-height: 3.6rem;
    margin: auto 0 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    line-height: 1.3;
  }

  .gallery__title {
    margin: 1.3rem 0.4rem 0;
    font-size: 1.8rem;
  }

  .gallery__tags {
    padding: 0 0.4rem;
  }

  .portfolio-presentation {
    margin-inline: 0;
    font-size: clamp(1.55rem, 4vw, 1.75rem);
    line-height: 1.65;
    text-align: left;
  }

  .portfolio-presentation p + p {
    margin-top: 1.6rem;
  }

  .text-blue1 {
    font-size: inherit;
  }

  .download {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
  }

  .download .portfolio-presentation {
    width: auto;
  }

  .logo-container {
    width: 4.4rem;
    height: 4.4rem;
    margin-right: 0;
  }

  .row {
    width: 100%;
    margin: 0;
    padding-inline: 1.5rem;
  }

  .contact {
    width: 100%;
    margin-inline: 0;
    border-radius: 8px;
    background-image: linear-gradient(105deg, rgba(207, 213, 252, 0.94) 0%, rgba(207, 213, 252, 0.94) 100%);
  }

  .contact__form {
    width: 100%;
    padding: 2rem 1.5rem 2.5rem;
  }

  .form__input {
    width: 100%;
    min-height: 4.6rem;
  }

  textarea.form__input {
    min-height: 12rem;
    resize: vertical;
  }

  .btn--form {
    min-height: 4.4rem;
    padding-inline: 1.5rem;
  }

  .footer {
    width: 100%;
    height: auto;
    min-height: 5.5rem;
    padding: 1.2rem 1.5rem;
  }
}

@media only screen and (max-width: 33.18em) {
  .header {
    grid-template-columns: minmax(0, 1fr) 9rem;
  }

  .header__link-container {
    width: 9rem;
    grid-template-columns: repeat(2, 3.4rem);
    gap: 0.55rem;
  }

  .logo-cv,
  .logo-github,
  .LinkedIn-container,
  .contact-link {
    width: 3.4rem;
    height: 3.4rem;
  }

  .portfolio-links {
    min-height: clamp(52rem, 86svh, 72rem);
  }

  /* Reduce decorative density on very small screens. */
  .particles-display__particle--five,
  .particles-display__particle--eight,
  .particles-display__particle--eleven,
  .particles-display__particle--fourteen {
    display: none;
  }

  .link-circle--is-contact {
    grid-column: 1 / 4;
    grid-row: 2 / 4;
  }

  .link-circle--is-about {
    grid-column: 6 / 9;
    grid-row: 2 / 4;
  }

  .link-circle--is-projet {
    grid-column: 4 / 7;
    grid-row: 4 / 6;
  }

  .gallery,
  .section-display__content,
  .row {
    padding-inline: 1rem;
  }

  .gallery__card {
    padding: 1rem;
  }

  .gallery__card::before {
    inset-inline: 1rem;
  }

  .btn--gallery {
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #canvas {
    display: none;
  }
}
