/*
 * About photo as an annotated Figma frame (from the "sobre:sessão" mockup):
 * the portrait is "selected" with a blue outline, square handles, a layer
 * name and a size tag; three orange comment notes point at it, and a
 * multiplayer cursor labelled "Gei" drifts beside it.
 */

.about-photo-stage {
  --fig-blue: #0d99ff;
  --fig-orange: #f24e1e;
  --fig-note-border: #f9c6b6;
  --fig-cursor: #6f55d6;
  --fig-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --fig-w: 18.75rem;
  --fig-h: 25rem;
  --fig-note-w: 10.5rem;

  position: relative;
  flex: 0 0 34rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 31rem;
}

.about-fig {
  position: relative;
  width: var(--fig-w);
  height: var(--fig-h);
  margin: 0;
}

.about-fig__img {
  position: absolute;
  inset: 0;
  border-radius: 2.5rem;
  overflow: hidden;
  box-shadow: 0 1.5rem 3rem -1rem rgba(20, 30, 35, 0.35);
}

.about-fig__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}

/* Selection: square outline + handles, like a selected layer in Figma */
.about-fig__sel {
  position: absolute;
  inset: -0.0625rem;
  border: 0.09375rem solid var(--fig-blue);
  pointer-events: none;
}

.about-fig__handle {
  position: absolute;
  width: 0.5625rem;
  height: 0.5625rem;
  border: 0.09375rem solid var(--fig-blue);
  background: #ffffff;
}

.about-fig__handle--tl { left: -0.3125rem; top: -0.3125rem; }
.about-fig__handle--tr { right: -0.3125rem; top: -0.3125rem; }
.about-fig__handle--bl { left: -0.3125rem; bottom: -0.3125rem; }
.about-fig__handle--br { right: -0.3125rem; bottom: -0.3125rem; }

.about-fig__layer {
  position: absolute;
  left: 0;
  top: -1.625rem;
  color: var(--fig-blue);
  font: 500 0.75rem/1 var(--fig-mono);
  white-space: nowrap;
}

.about-fig__dim {
  position: absolute;
  left: 50%;
  bottom: -1.875rem;
  padding: 0.1875rem 0.375rem;
  border-radius: 0.1875rem;
  background: var(--fig-blue);
  color: #ffffff;
  font: 500 0.6875rem/1.3 var(--fig-mono);
  white-space: nowrap;
  transform: translateX(-50%);
}

/* Comment notes */

.about-fig__notes {
  display: contents;
}

.about-fig__note {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  margin: 0;
}

/* Notes on the left read right-to-left: label, then the line into the photo. */
.about-fig__note--1,
.about-fig__note--3 {
  flex-direction: row-reverse;
}

.about-fig__note--1 {
  right: calc(100% - 4.5rem);
  top: 3.5rem;
}

.about-fig__note--2 {
  left: calc(100% - 4rem);
  top: 10.5rem;
}

.about-fig__note--3 {
  right: calc(100% - 4.5rem);
  bottom: 3.5rem;
}

.about-fig__line {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 0.0625rem;
  background: var(--fig-orange);
}

/* Dot at the end that touches the photo */
.about-fig__line::after {
  content: "";
  position: absolute;
  top: -0.1875rem;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--fig-orange);
}

.about-fig__note--1 .about-fig__line::after,
.about-fig__note--3 .about-fig__line::after {
  right: -0.1875rem;
}

.about-fig__note--2 .about-fig__line::after {
  left: -0.1875rem;
}

.about-fig__label {
  /* A fixed width: an absolutely positioned note would otherwise shrink to the
     few pixels left between its anchor and the frame's edge. */
  flex: none;
  width: var(--fig-note-w);
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  border: 0.0625rem solid var(--fig-note-border);
  border-radius: 0.625rem;
  background: #ffffff;
  box-shadow: 0 0.5rem 1.25rem -0.625rem rgba(0, 0, 0, 0.2);
  color: #1d1d1d;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.about-fig__label small {
  display: block;
  margin-bottom: 0.1875rem;
  color: var(--fig-orange);
  font: 500 0.625rem/1.2 var(--fig-mono);
  letter-spacing: 0.04em;
}

/* Multiplayer cursor */

.about-fig__cursor {
  position: absolute;
  z-index: 3;
  right: -2.5rem;
  bottom: 2.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.125rem;
  pointer-events: none;
  animation: about-fig-wander 7s ease-in-out infinite;
}

.about-fig__cursor svg {
  display: block;
  flex: none;
}

.about-fig__cursor span {
  margin-top: 0.875rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 0 0.5rem 0.5rem 0.5rem;
  background: var(--fig-cursor);
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1.3;
}

@keyframes about-fig-wander {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-1.875rem, 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .about-fig__cursor {
    animation: none;
  }
}

/* Medium screens: smaller frame and notes so they fit beside the copy */
@media (max-width: 75rem) {
  .about-photo-stage {
    --fig-w: 16.5rem;
    --fig-h: 22rem;
    --fig-note-w: 9.25rem;

    flex-basis: 29rem;
    min-height: 27rem;
  }

  .about-fig__note--2 {
    top: 9rem;
  }

  .about-fig__label {
    font-size: 0.75rem;
  }
}

/* Stacked layout: the frame sits under the copy, centered */
@media (max-width: 56.25rem) {
  .about-photo-stage {
    --fig-w: 18rem;
    --fig-h: 24rem;
    --fig-note-w: 10rem;

    flex-basis: auto;
    width: 100%;
    min-height: 0;
    padding: 2.5rem 0 3rem;
  }
}

/* Phones: notes overlap the photo more so nothing runs off the screen */
@media (max-width: 30rem) {
  .about-photo-stage {
    --fig-w: min(14rem, 60vw);
    --fig-h: calc(var(--fig-w) * 1.33);
    --fig-note-w: 8.25rem;
  }

  .about-fig__note--1,
  .about-fig__note--3 {
    right: calc(100% - 5.25rem);
  }

  .about-fig__note--1 {
    top: 2rem;
  }

  .about-fig__note--2 {
    left: calc(100% - 5.25rem);
    top: 45%;
  }

  .about-fig__note--3 {
    bottom: 2.5rem;
  }

  .about-fig__line {
    width: 1.5rem;
  }

  .about-fig__label {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
  }

  .about-fig__cursor {
    right: -1.25rem;
    bottom: 1rem;
  }
}

/*
 * Grid alignment (two-column layout only): the photo's right edge sits on the
 * grid's right edge (same line as the project card and companies card) and its
 * top lines up with the "About me" eyebrow. With no room left on the right,
 * every note hangs to the left, staggered, and the cursor moves onto the photo.
 */
@media (min-width: 56.3125rem) {
  .about-me .about-layout {
    align-items: flex-start;
  }

  .about-photo-stage {
    justify-content: flex-end;
    align-items: flex-start;
    min-height: 0;
  }

  .about-fig__note--2 {
    left: auto;
    right: calc(100% - 2.5rem);
    flex-direction: row-reverse;
  }

  .about-fig__note--2 .about-fig__line::after {
    left: auto;
    right: -0.1875rem;
  }

  .about-fig__cursor {
    right: 1.25rem;
    bottom: 3.5rem;
  }
}
