/* =========================================================
   PORTFOLIO
   PIXEL CURSOR + FINAL HEX BACKGROUND
   ========================================================= */


/* =========================================================
   PAGE BASE
   ========================================================= */

:root {
  --portfolio-bg: #09090b;
  --portfolio-accent: #b983a9;
  --portfolio-accent-bright: #f0b6db;

  /*
   * Responsive UI sizing.
   *
   * Using both vw and vh keeps the portfolio from feeling huge
   * on a smaller laptop while preserving the larger desktop scale.
   */
  --portfolio-side-padding:
    clamp(24px, 3.2vw, 52px);

  --portfolio-row-gap:
    clamp(18px, 2vw, 32px);

  --portfolio-row-top:
    clamp(42px, 7.5vh, 84px);

  --portfolio-tile-size:
    clamp(
      230px,
      min(29vw, 39vh),
      380px
    );

  --portfolio-tile-border:
    clamp(
      10px,
      min(1vw, 1.7vh),
      16px
    );

  --portfolio-tile-radius:
    clamp(20px, 2vw, 28px);

  --portfolio-info-gap:
    clamp(10px, 1.5vh, 16px);

  --portfolio-game-title-size:
    clamp(
      1.55rem,
      min(2.3vw, 3.3vh),
      2.3rem
    );

  --portfolio-game-tagline-size:
    clamp(
      1.2rem,
      min(1.95vw, 2.65vh),
      1.95rem
    );

  --portfolio-nav-width:
    clamp(58px, 5vw, 84px);

  --portfolio-nav-height:
    clamp(92px, 13vh, 132px);

  --portfolio-nav-chevron-width:
    clamp(26px, 2.4vw, 38px);

  --portfolio-nav-chevron-height:
    clamp(6px, 0.55vw, 9px);
}

html,
body {
  background: var(--portfolio-bg);
  width: 100%;
  height: 100%;

  overflow-y: hidden;
  overflow-x: hidden;
}

body {
  margin: 0;
}


/* =========================================================
   BACKGROUND ROOT
   ========================================================= */

#portfolio-background {
  position: fixed;
  inset: 0;

  width: 100vw;
  height: 100vh;

  overflow: hidden;

  pointer-events: none;
  user-select: none;

  z-index: 0;

  background: var(--portfolio-bg);

  opacity: 0.15;
}


/* =========================================================
   HEXAGON LAYER
   ========================================================= */

#portfolio-hex-background {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: visible;
}

#portfolio-hex-grid {
  transform: translate3d(-42px, -24px, 0);
  animation: portfolio-hex-scroll 6s linear infinite;
  will-change: transform;
}

.portfolio-hex {
  fill: none;

  stroke: var(--portfolio-accent);
  stroke-opacity: 0.30;
  stroke-width: 2.5;

  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;

  transition:
    stroke-opacity 90ms steps(2),
    stroke-width 90ms steps(2);
}


/* Hexes close to the cursor */
.portfolio-hex.is-near {
  stroke-opacity: 0.52;
}


/* Hex directly under / closest to the cursor */
.portfolio-hex.is-hot {
  stroke: var(--portfolio-accent-bright);
  stroke-opacity: 0.95;
  stroke-width: 3.5;
}


/*
 * Game-background mode hides complete hexagons only.
 * This avoids a hard clip slicing through the polygon grid.
 */
.portfolio-hex.is-game-hidden {
  opacity: 0;
}


/* =========================================================
   DITHERED ACCENT GRADIENT
   ========================================================= */

#portfolio-dither-background {
  position: absolute;
  inset: 0;

  z-index: 2;

  /*
   * Two offset dot fields make the dither much more obvious
   * than the previous version.
   */
  background-image:
    radial-gradient(
      circle,
      rgba(185, 131, 169, 0.48) 0 1px,
      transparent 1.25px
    ),
    radial-gradient(
      circle,
      rgba(185, 131, 169, 0.22) 0 1px,
      transparent 1.25px
    );

  background-size:
    6px 6px,
    6px 6px;

  background-position:
    0 0,
    3px 3px;

  /*
   * The dots are dense at the top and fade out toward the
   * lower half of the page.
   */
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      #000 0%,
      rgba(0, 0, 0, 0.92) 15%,
      rgba(0, 0, 0, 0.64) 32%,
      rgba(0, 0, 0, 0.28) 50%,
      transparent 72%
    );

  mask-image:
    linear-gradient(
      to bottom,
      #000 0%,
      rgba(0, 0, 0, 0.92) 15%,
      rgba(0, 0, 0, 0.64) 32%,
      rgba(0, 0, 0, 0.28) 50%,
      transparent 72%
    );

  opacity: 0.68;

  animation: portfolio-dither-drift 10s steps(20) infinite;
}


/* =========================================================
   PIXEL CURSOR GLOW
   ========================================================= */

#portfolio-cursor-glow {
  position: absolute;

  width: 180px;
  height: 180px;

  left: 0;
  top: 0;

  z-index: 1;

  pointer-events: none;

  /*
   * This is deliberately quantized with hard stops rather
   * than a soft modern blur.
   */
  background:
    radial-gradient(
      circle,
      rgba(185, 131, 169, 0.14) 0 18%,
      rgba(185, 131, 169, 0.08) 18% 32%,
      rgba(185, 131, 169, 0.035) 32% 48%,
      transparent 48%
    );

  opacity: 0;

  transform: translate3d(-999px, -999px, 0);

  transition: opacity 100ms steps(2);

  image-rendering: pixelated;
}


/* =========================================================
   KEEP WEBFLOW CONTENT ABOVE BACKGROUND
   ========================================================= */

body > *:not(#portfolio-background):not(#portfolio-pixel-cursor) {
  position: relative;
  z-index: 1;
}




/* =========================================================
   ACTIVE GAME BACKGROUND
   ========================================================= */

#portfolio-game-background {
  position: absolute;

  left: 0;
  top: 0;

  width: 100vw;
  height: var(--game-bg-height, 58vh);

  z-index: 1;

  pointer-events: none;
  user-select: none;

  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;

  opacity: 0;

  transform:
    translate3d(0, -8px, 0)
    scale(1.01);

  transition:
    opacity 220ms ease,
    transform 300ms ease;

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      #000 0%,
      #000 72%,
      rgba(0, 0, 0, 0.82) 86%,
      transparent 100%
    );

  mask-image:
    linear-gradient(
      to bottom,
      #000 0%,
      #000 72%,
      rgba(0, 0, 0, 0.82) 86%,
      transparent 100%
    );

  filter:
    brightness(0.78)
    saturate(0.96);
}

#portfolio-game-background.is-visible {
  opacity: 1;

  transform:
    translate3d(0, 0, 0)
    scale(1);
}



/* =========================================================
   BACKGROUND ANIMATIONS
   ========================================================= */

@keyframes portfolio-hex-scroll {
  from {
    transform: translate3d(-42px, -24px, 0);
  }

  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes portfolio-dither-drift {
  from {
    background-position:
      0 0,
      3px 3px;
  }

  to {
    background-position:
      12px 6px,
      15px 9px;
  }
}


/* =========================================================
   PIXEL CURSOR
   ========================================================= */

html,
body,
body * {
  cursor: none !important;
}

#portfolio-pixel-cursor {
  position: fixed;
  top: 0;
  left: 0;

  width: 16px;
  height: 23px;

  display: block;

  pointer-events: none;
  user-select: none;

  z-index: 2147483647;

  image-rendering: pixelated;
  image-rendering: crisp-edges;

  transform: translate3d(-100px, -100px, 0);

  will-change: transform;
}


/* =========================================================
   TOUCH / REDUCED MOTION
   ========================================================= */

@media (hover: none), (pointer: coarse) {
  html,
  body,
  body * {
    cursor: auto !important;
  }

  #portfolio-pixel-cursor {
    display: none !important;
  }

  #portfolio-cursor-glow {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #portfolio-hex-grid,
  #portfolio-dither-background {
    animation: none;
  }
}/* =========================================================
   NAME JUICE
   ========================================================= */

.portfolio-name {
  position: relative;

  display: block;
  width: fit-content;

  /* Layout */
  margin-top: clamp(44px, 7.5vh, 84px);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0;

  color: #f5f5f5;

  letter-spacing: 0.12em;

  cursor: none !important;

  transform-origin: center;

  /*
   * Permanent darker accent outline.
   * This is the resting state.
   */
  text-shadow:
    3px 0 #9c357d,
    -3px 0 #9c357d,
    0 3px #9c357d,
    0 -3px #9c357d,

    3px 3px #9c357d,
    -3px 3px #9c357d,
    3px -3px #9c357d,
    -3px -3px #9c357d;

  transition:
    transform 90ms steps(2),
    text-shadow 90ms steps(2);

  user-select: none;
  overflow: visible;
}


/* ---------------------------------------------------------
   LETTERS
   --------------------------------------------------------- */

.portfolio-name-letter {
  display: inline-block;

  color: inherit;

  transition:
    color 70ms steps(2),
    text-shadow 70ms steps(2);
}


/* ---------------------------------------------------------
   HOVER

   Lift the whole title and brighten the outline.
   --------------------------------------------------------- */

.portfolio-name.is-hovering {
  transform: translate3d(2px, -3px, 0);

  text-shadow:
    4px 0 #F2B8D7,
    -4px 0 #F2B8D7,
    0 4px #F2B8D7,
    0 -4px #F2B8D7,

    4px 4px #F2B8D7,
    -4px 4px #F2B8D7,
    4px -4px #F2B8D7,
    -4px -4px #F2B8D7;
}


/* ---------------------------------------------------------
   CLEAN LETTER SHINE

   No bouncing.
   No movement.
   The shine travels letter-by-letter.
   --------------------------------------------------------- */

.portfolio-name-letter.is-shining {
  color: #F2B8D7;
}


/* ---------------------------------------------------------
   CLICK / PRESS

   Only squeeze.
   No color or outline change.
   --------------------------------------------------------- */

.portfolio-name.is-pressed {
  transform:
    translate3d(2px, 2px, 0)
    scaleX(1.05)
    scaleY(0.88);
}


/* ---------------------------------------------------------
   RANDOM SCORE POP
   --------------------------------------------------------- */

.portfolio-score-pop {
  position: absolute;

  left: 50%;
  top: 5%;

  pointer-events: none;

  color: #f0b6db;

  font-size: 0.28em;
  line-height: 1;

  white-space: nowrap;

  z-index: 20;

  text-shadow:
    1px 0 #7f4f70,
    -1px 0 #7f4f70,
    0 1px #7f4f70,
    0 -1px #7f4f70;

  transform: translate(-50%, 0);

  animation:
    portfolio-score-pop 520ms steps(6) forwards;
}

@keyframes portfolio-score-pop {
  0% {
    opacity: 0;

    transform:
      translate(-50%, 0)
      scale(0.8);
  }

  15% {
    opacity: 1;

    transform:
      translate(-50%, -4px)
      scale(1);
  }

  100% {
    opacity: 0;

    transform:
      translate(-50%, -24px)
      scale(1);
  }
}


/* ---------------------------------------------------------
   PIXEL PARTICLES
   --------------------------------------------------------- */

.portfolio-name-particle {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 4px;
  height: 4px;

  background: #b983a9;

  pointer-events: none;

  z-index: 15;

  image-rendering: pixelated;

  animation:
    portfolio-name-particle 480ms steps(6) forwards;
}

@keyframes portfolio-name-particle {
  from {
    opacity: 1;

    transform:
      translate(0, 0)
      scale(1);
  }

  to {
    opacity: 0;

    transform:
      translate(
        var(--particle-x),
        var(--particle-y)
      )
      scale(0.5);
  }
}


/* ---------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .portfolio-name,
  .portfolio-name-letter {
    animation: none !important;
    transition: none !important;
  }

  .portfolio-score-pop,
  .portfolio-name-particle {
    display: none !important;
  }
}

/* =========================================================
   GAME TILES
   ========================================================= */

.portfolio-games {
  width: 100%;

  margin-top: var(--portfolio-row-top);
  margin-left: 0;
  margin-right: 0;

  padding:
    clamp(18px, 2.5vh, 28px)
    var(--portfolio-side-padding)
    clamp(28px, 4vh, 42px);

  box-sizing: border-box;

  display: flex;

  gap: var(--portfolio-row-gap);

  align-items: flex-start;

  overflow-x: auto;
  overflow-y: hidden;

  scrollbar-width: none;

  -webkit-overflow-scrolling: touch;

  scroll-behavior: smooth;
  scroll-snap-type: x proximity;

  overscroll-behavior-x: contain;
}

.portfolio-games::-webkit-scrollbar {
  display: none;
}



.portfolio-game-item {
  width:
    var(--portfolio-tile-size);

  display: flex;
  flex-direction: column;

  align-items: center;

  min-width: 0;
}

.portfolio-games.is-centered {
  justify-content: center;
}

.portfolio-game-tile {
  --tile-x: 0px;
  --tile-y: 0px;

  position: relative;

  flex:
    0 0
    var(--portfolio-tile-size);

  width: 100%;

  aspect-ratio: 1 / 1;

  box-sizing: border-box;

  overflow: visible;

  border:
    var(--portfolio-tile-border) solid
    #29292f;

  border-radius: var(--portfolio-tile-radius);

  background:
    #101014;

  scroll-snap-align: center;

  outline: none;

  transform:
    translate3d(
      var(--tile-x),
      var(--tile-y),
      0
    );

  transform-origin: center;

  transition:
    transform 120ms steps(3),
    border-color 120ms steps(3),
    box-shadow 120ms steps(3),
    opacity 120ms steps(3);

  will-change: transform;

  user-select: none;
}


/* ---------------------------------------------------------
   TILE IMAGE
   --------------------------------------------------------- */

.portfolio-game-image {
  position: absolute;

  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  border-radius:
    calc(
      var(--portfolio-tile-radius) -
      var(--portfolio-tile-border)
    );

  pointer-events: none;

  user-select: none;

  transition:
    filter 160ms steps(4);
}


/* ---------------------------------------------------------
   GAME NAME + ONE-LINER
   --------------------------------------------------------- */

.portfolio-game-info {
  width:
    min(
      calc(100% + 24px),
      420px
    );

  margin-top: var(--portfolio-info-gap);

  box-sizing: border-box;

  text-align: center;

  pointer-events: none;

  opacity: 0;

  transform:
    translateY(-6px);

  transition:
    opacity 140ms steps(3),
    transform 140ms steps(3);
}

.portfolio-game-name {
  color: #f6edf3;

  font-size: var(--portfolio-game-title-size);
  line-height: 1.1;

  letter-spacing: 0.04em;

  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.72);
}

.portfolio-game-tagline {
  margin-top: 6px;

  color:
    rgba(
      246,
      237,
      243,
      0.78
    );

  font-size: var(--portfolio-game-tagline-size);
  line-height: 1.25;

  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.72);
}

.portfolio-game-name,
.portfolio-game-tagline {
  font-family: "Pixel Sans", sans-serif;
}

.portfolio-game-item:has(
  .portfolio-game-tile.is-selected
)
.portfolio-game-info {
  opacity: 1;

  transform:
    translateY(0);
}


/* ---------------------------------------------------------
   HOVER / SELECTED / FOCUS

   Only .is-selected gets the full "active game" treatment.
   Hover can still select a tile through JS, but a tile that
   merely remains under the pointer after wheel scrolling
   cannot visually compete with the actual selection.
   --------------------------------------------------------- */

.portfolio-game-tile.is-selected {
  border-color: transparent;

  background:
    linear-gradient(
      #101014,
      #101014
    )
    padding-box,

    conic-gradient(
      from var(--tile-border-angle),
      var(--portfolio-accent) 0deg,
      var(--portfolio-accent) 300deg,
      #cf9abb 324deg,
      #e8bad6 336deg,
      #cf9abb 348deg,
      var(--portfolio-accent) 360deg
    )
    border-box;

  box-shadow:
    0 12px 0 rgba(0, 0, 0, 0.34),
    0 0 14px rgba(185, 131, 169, 0.22);

  transform:
    translate3d(
      var(--tile-x),
      calc(var(--tile-y) - 6px),
      0
    )
    scale(clamp(1.018, 1.5vw, 1.035));

  z-index: 3;

  animation:
    portfolio-tile-border-travel
    2.35s linear infinite;
}

.portfolio-game-tile.is-selected
.portfolio-game-image {
  filter: brightness(1.06);
}


@property --tile-border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes portfolio-tile-border-travel {
  from {
    --tile-border-angle: 0deg;
  }

  to {
    --tile-border-angle: 360deg;
  }
}







/* A tiny pointer response without looking "selected". */
.portfolio-game-tile.is-hovering:not(.is-selected) {
  border-color: #36363e;
}

.portfolio-games.is-scrolling
.portfolio-game-tile.is-hovering:not(.is-selected) {
  border-color: #29292f;
}




/* Keyboard focus is navigation/accessibility only, not selection. */
.portfolio-game-tile:focus-visible:not(.is-selected) {
  outline:
    3px solid
    rgba(240, 182, 219, 0.35);

  outline-offset: 4px;
}

/* ---------------------------------------------------------
   PRESS
   --------------------------------------------------------- */

.portfolio-game-tile.is-pressed,
.portfolio-game-tile:active {
  transform:
    translate3d(
      var(--tile-x),
      calc(var(--tile-y) + 5px),
      0
    )
    scale(0.985);

  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.25);
}


/* =========================================================
   GAME CAROUSEL EDGE CONTROLS
   ========================================================= */

.portfolio-game-nav {
  position: fixed;

  top: var(--game-nav-center-y, 50vh);

  width: var(--portfolio-nav-width);
  height: var(--portfolio-nav-height);

  padding: 0;

  border:
    5px solid
    var(--portfolio-accent-bright);

  background:
    rgba(9, 9, 11, 0.94);

  opacity: 0;

  pointer-events: none;

  transform:
    translateY(-50%);

  transition:
    opacity 110ms steps(3),
    background 110ms steps(3),
    transform 110ms steps(3),
    box-shadow 110ms steps(3);

  z-index: 1000;

  appearance: none;

  cursor: none !important;

  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.42),
    0 0 0 3px rgba(9, 9, 11, 0.72);
}

.portfolio-game-nav.has-overflow {
  opacity: 0.96;
  pointer-events: auto;
}

.portfolio-game-nav.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.portfolio-game-nav-left {
  left: 12px;

  border-radius:
    0 24px 24px 0;
}

.portfolio-game-nav-right {
  right: 12px;

  border-radius:
    24px 0 0 24px;
}


/* ---------------------------------------------------------
   BIG PIXEL-STYLE CHEVRONS
   --------------------------------------------------------- */

.portfolio-game-nav::before,
.portfolio-game-nav::after {
  content: "";

  position: absolute;

  left: 50%;
  top: 50%;

  width: var(--portfolio-nav-chevron-width);
  height: var(--portfolio-nav-chevron-height);

  background:
    #ffffff;

  box-shadow:
    0 0 0 3px #9c357d;

  image-rendering: pixelated;

  transform-origin: center;

  opacity: 1;
}

.portfolio-game-nav-left::before {
  transform:
    translate(-62%, calc(var(--portfolio-nav-chevron-width) * -0.34))
    rotate(-45deg);
}

.portfolio-game-nav-left::after {
  transform:
    translate(-62%, calc(var(--portfolio-nav-chevron-width) * 0.34))
    rotate(45deg);
}

.portfolio-game-nav-right::before {
  transform:
    translate(-38%, calc(var(--portfolio-nav-chevron-width) * -0.34))
    rotate(45deg);
}

.portfolio-game-nav-right::after {
  transform:
    translate(-38%, calc(var(--portfolio-nav-chevron-width) * 0.34))
    rotate(-45deg);
}


/* ---------------------------------------------------------
   NAV HOVER / PRESS
   --------------------------------------------------------- */

.portfolio-game-nav:hover {
  opacity: 1;

  background:
    #15151b;

  box-shadow:
    0 12px 0 rgba(0, 0, 0, 0.48),
    0 0 0 4px rgba(240, 182, 219, 0.20);
}

.portfolio-game-nav-left:hover {
  transform:
    translateY(-50%)
    translateX(6px)
    scale(1.06);
}

.portfolio-game-nav-right:hover {
  transform:
    translateY(-50%)
    translateX(-6px)
    scale(1.06);
}

.portfolio-game-nav:active {
  opacity: 1;
}

.portfolio-game-nav-left:active {
  transform:
    translateY(-50%)
    translateX(2px)
    scale(0.94);
}

.portfolio-game-nav-right:active {
  transform:
    translateY(-50%)
    translateX(-2px)
    scale(0.94);
}


/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 767px) {
  :root {
    --portfolio-side-padding: 20px;

    --portfolio-row-gap:
      clamp(14px, 4vw, 18px);

    --portfolio-row-top:
      clamp(32px, 5vh, 44px);

    --portfolio-tile-size:
      min(74vw, 250px);

    --portfolio-tile-border:
      clamp(7px, 2vw, 9px);

    --portfolio-tile-radius:
      clamp(18px, 5vw, 24px);

    --portfolio-game-title-size:
      clamp(0.9rem, 4.2vw, 1.15rem);

    --portfolio-game-tagline-size:
      clamp(0.72rem, 3.3vw, 0.9rem);
  }

  .portfolio-games {
    width: 100%;

    padding:
      18px
      var(--portfolio-side-padding)
      30px;

    scroll-snap-type: x mandatory;
  }

  .portfolio-game-info {
    width:
      min(
        calc(100% + 12px),
        280px
      );
  }

  .portfolio-game-nav {
    display: none;
  }
}


/* ---------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .portfolio-games {
    scroll-behavior: auto;
  }

  .portfolio-game-tile,
  .portfolio-game-image,
  .portfolio-game-nav,
  .portfolio-game-nav::before,
  .portfolio-game-nav::after {
    transition: none !important;
  }

  .portfolio-game-tile {
    transform: none !important;
  }
}



@media (prefers-reduced-motion: reduce) {
  #portfolio-game-background {
    transition: none !important;
  }
}


@media (prefers-reduced-motion: reduce) {
  .portfolio-game-tile.is-selected {
    animation: none !important;

    --tile-border-angle: 320deg;
  }
}
