/* The card: placement, 3D tilt and flip, and the content on its back.
   !important appears only where Figma's runtime or an inline style would win. */

@property --tilt-x {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@property --tilt-y {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@property --card-flip {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* ---------- Placement ----------
   Center the card vertically. The page only grows taller than the viewport
   when the card plus its margins does not fit. Matched on the card artwork so
   it applies before the scripts run. */
#container [data-breakpoint-id]:has(> div > div > div > div > img[alt="background-image"][src$=".svg"]) {
  --content-min-height: max(var(--100dvh, 100dvh), 720px);
}
#container [data-breakpoint-id] > div:has(> div > div > div > img[alt="background-image"][src$=".svg"]) {
  top: 50%;
  /* Replaces Figma's transform, so the scale below stays centered. */
  transform: none;
  translate: -50% -50%;
}
@media (max-width: 799px) {
  #container [data-breakpoint-id]:has(> div > div > div > div > img[alt="background-image"][src$=".svg"]) {
    --content-min-width: 100%;
    --content-min-height: max(var(--100dvh, 100dvh), 638px);
  }
  /* Front and back shrink together on narrow screens, leaving 34px on each side
     for the tabs. tan(atan2()) divides the two lengths into a plain number. */
  #container [data-breakpoint-id] > div:has(> div > div > div > img[alt="background-image"][src$=".svg"]) {
    scale: min(1, tan(atan2(100vw - 68px, 330px)));
  }
}

/* Original Figma elements that the card replaces. */
#container .css-paq0kv:has(> p.css-h1pwez),
#container .original-about-navigation {
  display: none !important;
}

/* ---------- Tilt and flip ---------- */
.cursor-tilt-card {
  --card-flip: 0deg;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform: perspective(1200px) rotateX(var(--tilt-x)) rotateY(calc(var(--tilt-y) + var(--card-flip))) !important;
  transform-origin: center;
  transform-style: preserve-3d;
  overflow: visible !important;
  cursor: pointer;
  transition: --card-flip 700ms cubic-bezier(0.22, 0.75, 0.18, 1), --tilt-x 240ms ease-out, --tilt-y 240ms ease-out;
}
.cursor-tilt-card.is-flipped { --card-flip: 180deg; }
.cursor-tilt-card:not(.is-flipped) { user-select: none; }
#container .cursor-tilt-card:focus,
#container .cursor-tilt-card:focus-visible { outline: none; }
.cursor-tilt-card > *,
.cursor-tilt-card::before,
.cursor-tilt-card::after {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* 3D planes must not intercept the interactive content. */
  pointer-events: none;
}
.cursor-tilt-card:not(.is-flipped) :is(a, button, [role="link"], [role="button"]) {
  pointer-events: auto;
}

/* Meet in the middle of the gap between the social icons, so the mouse cursor
   does not change while crossing it. */
.cursor-tilt-card :is(a, [role="link"]):has(> div > img[alt="social-media-icon"])::after {
  content: '';
  position: absolute;
  inset: -4px;
}

/* Back face: gray frame, inset panel, and the cutout cloned from the front. */
.cursor-tilt-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: var(--frame);
  border: 1px solid var(--frame-border);
  transform: rotateY(180deg) translateZ(1px);
}
.cursor-tilt-card::before {
  content: '';
  position: absolute;
  inset: var(--back-panel-top, 45px) var(--back-panel-right, 5px) var(--back-panel-bottom, 5px) var(--back-panel-left, 5px);
  border-radius: var(--back-panel-radius, 20px);
  background: var(--panel);
  transform: rotateY(180deg) translateZ(2px);
}
.cursor-tilt-card > .card-back-cutout {
  transform: translateX(-50%) rotateY(180deg) translateZ(3px) !important;
  pointer-events: none;
}

/* ---------- Back content ---------- */
.cursor-tilt-card > .card-projects {
  position: absolute;
  inset: var(--back-panel-top, 45px) var(--back-panel-right, 5px) var(--back-panel-bottom, 5px) var(--back-panel-left, 5px);
  display: flex;
  flex-direction: column;
  padding: 30px 28px;
  border-radius: var(--back-panel-radius, 20px);
  transform: rotateY(180deg) translateZ(3px);
  color: var(--text);
  font-family: "Inter:Regular", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}
.cursor-tilt-card.is-flipped :is(.card-projects, .back-email, .back-avatar, .back-about-link) { pointer-events: auto; }
.card-projects > * { flex-shrink: 0; }
.card-projects .back-heading {
  font-family: "Inter:Regular", sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 10px;
}
.card-projects .back-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  /* Avoids a single word on the last line. */
  text-wrap: pretty;
}

/* About */
.card-projects .back-avatar {
  position: absolute;
  right: 28px;
  bottom: 28px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  cursor: pointer;
  transition: scale 220ms cubic-bezier(.34, 1.56, .64, 1);
}
.card-projects .back-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: inherit;
  object-fit: cover;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card-projects .back-avatar:hover { scale: 1.12; }
}

/* Video message: a sheet over the panel, below the heading */
.card-projects .card-video {
  position: absolute;
  inset: 62px 0 0;
  z-index: 5;
  border-radius: 20px 20px var(--back-panel-radius, 20px) var(--back-panel-radius, 20px);
  overflow: hidden;
  background: #111;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .1);
}
.card-video-handle {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 32px;
  translate: -50% 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.card-video-handle span {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, .35);
  opacity: .8;
  transition: opacity 150ms ease, width 200ms ease;
}
.card-video-handle:hover span { width: 52px; opacity: 1; }
.card-video-toggle {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.card-video-toggle video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
.card-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.card-video.is-paused .card-video-play { opacity: 1; }
/* While closing, only the video itself shrinks back into the profile image. */
.card-video[inert] .card-video-play { display: none; }
.card-projects:has(> .card-video) .back-avatar img { visibility: hidden; }
.card-projects :is(.card-video-handle, .card-video-toggle, .back-avatar):focus-visible {
  outline: 2px solid #7356df;
  outline-offset: -3px;
}
.card-projects .back-about-link {
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}
.card-projects .back-about-link:hover { color: var(--link-hover); }
/* The arrow appears on hover. Its space is reserved, so the text never moves. */
.card-projects .back-about-link svg {
  display: inline-block;
  margin-left: 4px;
  vertical-align: -2px;
  opacity: 0;
  translate: -4px 0;
  transition: opacity 180ms ease, translate 180ms ease;
}
.card-projects .back-about-link:is(:hover, :focus-visible) svg { opacity: 1; translate: 0 0; }

/* Hovering the Logitech logo or name turns both around to Streamlabs. Each face
   hides halfway, when it is edge-on. */
.card-projects .project-brand-flip { cursor: default; }
.card-projects .flip-faces { display: grid; perspective: 400px; }
.card-projects .flip-faces > * {
  grid-area: 1 / 1;
  transition: transform 520ms cubic-bezier(.45, .05, .25, 1), opacity 0s linear 200ms;
}
.card-projects .flip-faces > :last-child { opacity: 0; transform: rotateY(-180deg); }
.card-projects .project-name.flip-faces > * { justify-self: start; }
.card-projects .project-name.flip-faces > :last-child { transform: rotateX(-180deg); }
.card-projects .project-brand-flip.is-turned .flip-faces > :first-child { opacity: 0; transform: rotateY(180deg); }
.card-projects .project-brand-flip.is-turned .project-name.flip-faces > :first-child { transform: rotateX(180deg); }
.card-projects .project-brand-flip.is-turned .flip-faces > :last-child { opacity: 1; transform: none; }
@media (hover: hover) {
  .card-projects .project-brand-flip:hover .flip-faces > :first-child { opacity: 0; transform: rotateY(180deg); }
  .card-projects .project-brand-flip:hover .project-name.flip-faces > :first-child { transform: rotateX(180deg); }
  .card-projects .project-brand-flip:hover .flip-faces > :last-child { opacity: 1; transform: none; }
}

/* Email copy button */
.card-projects .back-email {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease;
}
.card-projects .back-email:hover { color: var(--text); }
.card-projects :is(.back-email, .back-about-link):focus-visible {
  outline: 2px solid #7356df;
  outline-offset: 4px;
}
.email-copy-symbol { position: relative; display: block; width: 16px; height: 16px; flex-shrink: 0; }
.email-copy-symbol svg {
  position: absolute;
  inset: 0;
  flex-shrink: 0;
  transition: opacity 180ms ease, transform 260ms cubic-bezier(.2, 1.4, .4, 1);
}
.email-copy-check { opacity: 0; transform: rotate(-25deg) scale(.5); }
.is-copied .email-copy-icon { opacity: 0; transform: translateY(-3px) scale(.6); }
.is-copied .email-copy-check { opacity: 1; transform: rotate(0) scale(1); }
.card-projects .email-copy-feedback {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--tooltip);
  color: var(--tooltip-text);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 3px 9px rgba(0, 0, 0, .1);
  pointer-events: none;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity 160ms ease, transform 200ms ease;
}
.show-copy-feedback .email-copy-feedback { opacity: 1; transform: translate(0, -50%); }

/* Tab panels, anchored to the bottom */
.card-projects .back-panel {
  margin-top: auto;
  padding-top: 24px;
}
.card-projects .back-project + .back-project { margin-top: 30px; }
.card-projects .project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-projects .project-brand { display: flex; align-items: center; gap: 9px; }
.card-projects .project-name {
  margin: 0;
  font-family: "Figtree:SemiBold", sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
}
.card-projects .project-years {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-projects :is(.project-table-mark, .project-logitech-mark, .project-streamlabs-mark, .project-type-mark) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
}
.card-projects .project-table-mark { background: #9277fd; }
.card-projects .project-table-mark img { width: 16px; height: 16px; }
.card-projects .project-logitech-mark { background: #00b8fc; }
.card-projects .project-streamlabs-mark { background: #80f5d2; }
.card-projects :is(.project-logitech-mark, .project-streamlabs-mark) img { width: 20px; height: 20px; }
.card-projects .project-type-mark img { width: 100%; height: 100%; }
.card-projects .project-exit {
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--badge);
  color: var(--link);
  font-size: 13px;
  line-height: 1.4;
}

/* Infos: skills in the middle of the free space, email at the bottom */
.card-projects .back-infos {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}
.card-projects .back-skills { margin-block: auto; }
.card-projects .back-subheading {
  margin: 0 0 10px;
  font-family: "Inter:Regular", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}
.card-projects .back-skills ul {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.card-projects .back-skills li + li { margin-top: 6px; }

/* The card itself is smaller below 800px. */
@media (max-width: 799px) {
  .cursor-tilt-card > .card-projects { padding: 18px; }
  .card-projects .back-heading { font-size: 16px; margin-bottom: 8px; }
  .card-projects .back-avatar { right: 18px; bottom: 18px; width: 32px; height: 32px; border-radius: 8px; }
  .card-projects .back-description { font-size: 12px; line-height: 1.5; letter-spacing: -.005em; }
  .card-projects .card-video { top: 46px; }
  .card-projects .back-subheading { margin-bottom: 8px; font-size: 14px; }
  .card-projects .back-skills ul { font-size: 13px; line-height: 1.45; }
  .card-projects .back-email { margin-top: 14px; font-size: 12px; gap: 4px; }
  .email-copy-symbol,
  .email-copy-symbol svg { width: 14px; height: 14px; }
  .card-projects .back-panel { padding-top: 18px; }
  .card-projects .back-project + .back-project { margin-top: 20px; }
  .card-projects .project-row { margin-bottom: 7px; }
  .card-projects .project-name { font-size: 16px; }
  .card-projects .project-brand { gap: 8px; }
  .card-projects :is(.project-table-mark, .project-logitech-mark, .project-streamlabs-mark, .project-type-mark) { width: 26px; height: 26px; }
  .card-projects .project-table-mark img { width: 13px; height: 13px; }
  .card-projects :is(.project-logitech-mark, .project-streamlabs-mark) img { width: 17px; height: 17px; }
  .card-projects .project-years { font-size: 12px; }
  .card-projects .project-exit { font-size: 11px; padding: 2px 7px; }
}

/* ---------- "flip" cursor ----------
   The pointer tip is the hotspot; the label sits just below and to its right. */
.card-click-cursor {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100000;
  pointer-events: none;
  user-select: none;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(22, 22, 22, .88);
  color: #fff;
  font: 400 14px/1 "Inter:Regular", sans-serif;
  letter-spacing: 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
  transform: translate(calc(var(--cursor-x, -100px) + 10px), calc(var(--cursor-y, -100px) + 12px));
  opacity: 0;
}
.card-click-cursor .click-cursor-pointer {
  position: absolute;
  left: -11px;
  top: -13px;
  width: 20px;
  height: 22px;
  color: #161616;
  overflow: visible;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, .55));
}
@media (hover: hover) and (pointer: fine) {
  .card-click-cursor { display: block; }
  .card-click-cursor.is-visible { opacity: 1; transition: opacity 100ms ease; }
  #container .cursor-tilt-card:not(.is-flipped),
  #container .cursor-tilt-card:not(.is-flipped) * { cursor: none !important; }
  #container .cursor-tilt-card:not(.is-flipped) :is(a, button, [role="link"]),
  #container .cursor-tilt-card:not(.is-flipped) :is(a, button, [role="link"]) * { cursor: pointer !important; }
  /* A normal arrow on the photos and social links. */
  #container .cursor-tilt-card:not(.is-flipped) .profile-stack .stack-control,
  #container .cursor-tilt-card:not(.is-flipped) :is(a, [role="link"]):has(> div > img[alt="social-media-icon"]),
  #container .cursor-tilt-card:not(.is-flipped) :is(a, [role="link"]):has(> div > img[alt="social-media-icon"]) * { cursor: default !important; }
  /* Keep the headline's arrow and the URL's heart cursor. */
  #container .cursor-tilt-card:not(.is-flipped) .headline-hover,
  #container .cursor-tilt-card:not(.is-flipped) .headline-hover * { cursor: default !important; }
  #container .cursor-tilt-card:not(.is-flipped) .customCursor,
  #container .cursor-tilt-card:not(.is-flipped) .customCursor * { cursor: none !important; }
}

/* ---------- Touch: no double-tap zoom, and larger tap areas ---------- */
.cursor-tilt-card { touch-action: manipulation; }
@media (pointer: coarse) {
  .card-projects .back-about-link { position: relative; }
  .card-projects :is(.back-email, .back-about-link, .back-avatar)::after {
    content: '';
    position: absolute;
    inset: -13px -8px;
  }
  .card-projects .back-avatar::after { inset: -8px; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-tilt-card,
  .card-projects .back-about-link svg,
  .card-projects .flip-faces > *,
  .email-copy-symbol svg,
  .card-projects .email-copy-feedback,
  .card-click-cursor.is-visible { transition: none; }
}
