/* ==========================================================================
   index.css — home page. Requires base.css.
   ========================================================================== */

/* ==========================================================================
   Hero title & morphing text
   ========================================================================== */

.hero-title {
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(5 * var(--vw), 110 * var(--u));
  margin-top: calc(5 * var(--vw));
}

.strokes {
  margin-top: calc(-2.9 * var(--vw));
  width: min(4 * var(--vw), 90 * var(--u));
  margin-left: calc(-1.2 * var(--vw));
}

/* The SVG #threshold filter turns the two blurred texts into a liquid morph
   (index.js). The two words are stacked in one grid cell, so the box (and
   the filtered area) is only as wide as the text, not the whole page. */
.morph {
  display: grid;
  place-items: center;
  width: max-content;
  max-width: 100%;
  height: calc(10 * var(--vw));
  margin: auto;
  text-align: center;
  filter: url(#threshold) blur(0.6px);
}

.morph__text {
  grid-area: 1 / 1;
  font-weight: 800;
  font-size: min(6 * var(--vw), 120 * var(--u));
  text-align: center;
  white-space: nowrap;
  user-select: none;
  color: var(--color-accent);
}

/* Touch devices: plain opacity cross-fade, no filter (index.js). */
.morph--lite {
  filter: none;
}

.morph--lite .morph__text {
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.morph--lite .morph__text.is-shown {
  opacity: 1;
}

.morph__filters {
  position: absolute;
  width: 0;
  height: 0;
}

/* ==========================================================================
   Landing page intro
   ========================================================================== */

.txtlandingpage {
  margin-left: auto;
  margin-right: auto;
  color: #000000;
  font-size: clamp(var(--text-min), 1.4 * var(--vw), 35 * var(--u));
  text-align: center;
  width: calc(40 * var(--vw));
  max-width: calc(700 * var(--u));
  font-weight: 300;
}

.imglandingpage {
  display: block;
  width: calc(87 * var(--vw));
  max-width: calc(1700 * var(--u));
  margin: calc(-6 * var(--vw)) auto 0;
}

/* ==========================================================================
   Logos carousel (component in base.css): home page spacing only.
   ========================================================================== */

.logos {
  padding-top: calc(9 * var(--vw));
}

/* Edge fades cover the logo row only (not the top padding, where they would
   show over the white bottom of the landing illustration). */
.logos::before,
.logos::after {
  top: calc(9 * var(--vw)); /* = .logos padding-top */
}

/* ==========================================================================
   Three-column skills section
   ========================================================================== */

.colonnes {
  margin-top: calc(17 * var(--vw));
  display: flex;
}

.colonnes > div {
  flex: 1;
}

.colonne1,
.colonne3 {
  width: calc(29 * var(--vw));
}

/* Phone preview: sticky and vertically centred in the visible area (the
   viewport minus the sticky navbar), whatever the screen size.
   - --phone-width is the design size; the height follows the image ratio.
   - The height is capped so the phone always fits in the visible area
     (with --phone-gap above and below); width follows (width: auto).
   - top = navbar + half of the free space, computed from the real height,
     so the centring is exact rather than tuned for one screen.
   Note: centring applies while the section is on screen; sticky releases the
   phone at the end of its column so it never overlaps the next section. */
.colonne2 {
  --phone-width: min(21 * var(--vw), 390 * var(--u));
  --phone-ratio: calc(964 / 470); /* mockups/phone-app.webp intrinsic height / width */
  --phone-gap: 1rem;
  --visible-height: calc(var(--viewport-height) - var(--nav-height));
  --phone-height: min(
    calc(var(--phone-width) * var(--phone-ratio)),
    calc(var(--visible-height) - 2 * var(--phone-gap))
  );

  width: calc(29 * var(--vw));
  text-align: center;
  position: relative;
}

.colonne2 img {
  position: sticky;
  top: calc(var(--nav-height) + (var(--visible-height) - var(--phone-height)) / 2);
  width: auto;
  height: var(--phone-height);
  filter: drop-shadow(10px 10px 20px rgba(153, 153, 153, 0.562));
}

.SmallTitle,
.SmallTitle2,
.SmallTitle3 {
  font-weight: 600;
  font-size: min(3.2 * var(--vw), 80 * var(--u));
}

.SmallTitle2 {
  margin-top: calc(50 * var(--vw));
}

.SmallTitle3 {
  margin-top: calc(37 * var(--vw));
  margin-left: calc(4 * var(--vw));
}

.UiUxDesign,
.NoCode,
.Graphique {
  font-size: max(var(--text-min), 1.4 * var(--vw));
  margin-top: calc(20 * var(--u));
  font-weight: 300;
  color: var(--color-text-muted);
  max-width: calc(27 * var(--vw));
}

.Graphique {
  margin-left: calc(4 * var(--vw));
}

/* Arrows are sized by their height; the width attribute only gives the ratio. */
.fleche1,
.fleche2,
.fleche3 {
  width: auto;
}

.fleche1 {
  margin-left: calc(16 * var(--vw));
  height: calc(9 * var(--vw));
  transform: rotate(15deg);
}

.fleche2 {
  margin-left: calc(2 * var(--vw));
  margin-top: calc(3 * var(--vw));
  height: calc(6 * var(--vw));
}

.fleche3 {
  margin-top: calc(5 * var(--vw));
  margin-left: calc(13 * var(--vw));
  height: calc(5 * var(--vw));
  transform: rotate(20deg);
}

/* ==========================================================================
   Presentation & portfolio teasers
   ========================================================================== */

.presentation,
.presentation2,
.portfolio {
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(4.5 * var(--vw), 90 * var(--u));
}

.presentation {
  margin-top: calc(8 * var(--vw));
}

.presentation2 {
  margin-top: min(var(--vw), 10 * var(--u));
  color: var(--color-accent);
  text-align: center; /* centres each line when the title wraps */
}

.portfolio {
  margin-top: calc(6 * var(--vw));
}

.Ui,
.anime {
  margin: calc(8 * var(--vw)) auto;
  display: block;
  width: min(80 * var(--vw), 1500 * var(--u));
  height: auto;
  border-radius: var(--radius-media);
}

/* ==========================================================================
   Responsive (≤ 810px)
   ========================================================================== */

@media (max-width: 810px) {
  .hero-title {
    font-size: 8vw;
    margin-top: clamp(1.5rem, 8vw, 3rem);
  }

  .strokes {
    margin-top: -4.8vw;
    width: 5vw;
  }

  .morph__text {
    font-size: 7vw;
  }

  .txtlandingpage {
    font-size: clamp(var(--text-min), 3.8vw, 1.1875rem);
    line-height: 1.5;
    width: auto;
    max-width: 32rem;
  }

  .imglandingpage {
    margin-top: 5vw;
  }

  /* Skills section, mobile reinterpretation of the desktop composition:
     the phone stays sticky and vertically centred (same rule as desktop) in
     a right-hand column, while the three skills scroll past it one at a
     time, in the desktop reading order (Ui/Ux → Design Graphique → No code),
     each with its hand-drawn arrow pointing at the phone.
     - --phone-column: the phone's width, which is also its column's width;
     - --skill-gap: space between skills, relative to the screen height so
       that one skill at a time sits next to the phone while scrolling. */
  .colonnes {
    --phone-column: clamp(6rem, 32vw, 15rem);
    --skill-gap: clamp(3.5rem, 22vh, 10rem);

    margin-top: clamp(3rem, 15vw, 6rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--phone-column);
    column-gap: clamp(1rem, 5vw, 2.5rem);
    align-items: start;
  }

  /* svh: stable while the mobile address bar shows/hides (no layout jump). */
  @supports (height: 1svh) {
    .colonnes {
      --skill-gap: clamp(3.5rem, 22svh, 10rem);
    }
  }

  /* The skill blocks become direct grid items, so they can be reordered. */
  .colonne1,
  .colonne3 {
    display: contents;
  }

  .skill {
    grid-column: 1;
  }

  .skill--uiux { order: 1; }
  .skill--graphic { order: 2; margin-top: var(--skill-gap); }
  .skill--nocode { order: 3; margin-top: var(--skill-gap); }

  /* Spans every skill row so the sticky phone accompanies all of them. */
  .colonne2 {
    --phone-width: var(--phone-column);
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: stretch;
    width: auto;
  }

  /* One title scale for the three skills (they are equals on desktop). */
  .SmallTitle,
  .SmallTitle2,
  .SmallTitle3 {
    margin: 0;
    font-size: clamp(1.375rem, 6.4vw, 2.25rem);
    line-height: 1.15;
  }

  .UiUxDesign,
  .NoCode,
  .Graphique {
    max-width: 34ch;
    margin: 0.875rem 0 0;
    font-size: clamp(0.875rem, 3.9vw, 1.0625rem);
    line-height: 1.55;
  }

  /* Arrows: right-aligned, pointing towards the phone. */
  .fleche1,
  .fleche2,
  .fleche3 {
    display: block;
    width: auto;
    height: clamp(3.25rem, 14vw, 6rem);
    margin: clamp(0.75rem, 4vw, 1.5rem) 0 0 auto;
  }

  .fleche1 {
    transform: rotate(15deg);
  }

  /* Points left on desktop (phone on its left); mirrored to point right. */
  .fleche2 {
    height: clamp(2.5rem, 10vw, 4.5rem);
    transform: scaleX(-1) rotate(-8deg);
  }

  .fleche3 {
    height: clamp(2.5rem, 10vw, 4.5rem);
    transform: rotate(20deg);
  }

  .presentation,
  .presentation2,
  .portfolio {
    font-size: 8vw;
  }

  .presentation {
    margin-top: 20vw;
  }

  .presentation2,
  .portfolio {
    text-align: center;
  }

  .portfolio {
    margin-top: 7vw;
  }

  /* Portfolio previews line up with the page gutter like the rest of the
     content (desktop keeps its narrower 80vw composition). */
  .Ui,
  .anime {
    width: calc(100% - 2 * var(--page-gutter));
    margin: 10vw auto;
  }
}
