:root {
  --purple: #6d35e8;
  --purple-dark: #4320a8;
  --lilac: #c9b5ff;
  --cream: #fff9e9;
  --ink: #21143c;
  --yellow: #f6f05d;
  --coral: #ff765e;
  --mint: #8ff0c7;
  --line: 3px solid var(--ink);
  --shadow: 0 3px 0 var(--ink), 5px 7px 0 var(--ink), 9px 12px 18px rgba(25, 10, 54, .24);
  --shadow-lg: 0 4px 0 var(--ink), 10px 12px 0 var(--ink), 16px 22px 28px rgba(24, 8, 54, .30);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--purple);
  color: var(--ink);
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 650;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; }
.wrap { max-width: 1180px; margin: auto; padding: 24px; }

/* ---------- Header ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 8px 0 28px; color: var(--cream);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 950; letter-spacing: -.04em; }
.mark {
  width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 12px;
  object-fit: cover; box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-7deg); transition: transform .4s var(--pop);
}
.brand:hover .mark { transform: rotate(353deg) scale(1.1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 21px; border: var(--line); border-radius: 18px; font-weight: 900; color: var(--ink);
  box-shadow: 0 4px 0 var(--ink), 7px 9px 0 var(--ink), 10px 14px 18px rgba(20, 8, 45, .28);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translate(4px, 5px); box-shadow: 0 2px 0 var(--ink), 3px 4px 0 var(--ink), 5px 7px 10px rgba(20, 8, 45, .25); }
.btn-small { padding: 10px 16px; border-radius: 14px; }
.btn-yellow { background: var(--yellow); }
.btn-light { background: var(--cream); }

/* ---------- Hero artboard ---------- */
.artboard {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(380px, 52vw, 600px);
  border: var(--line); border-radius: 42px;
  background: var(--lilac);
  box-shadow: var(--shadow-lg);
  display: grid; place-items: center;
}
.blob {
  position: absolute; z-index: -1;
  width: 42%; aspect-ratio: 1; left: 6%; top: 9%;
  background: var(--coral); border: var(--line);
  border-radius: 47% 53% 38% 62% / 45% 38% 62% 55%;
  animation: morph 9s ease-in-out infinite;
}
@keyframes morph {
  0%, 100% { border-radius: 47% 53% 38% 62% / 45% 38% 62% 55%; transform: rotate(-18deg); }
  50% { border-radius: 60% 40% 55% 45% / 38% 58% 42% 62%; transform: rotate(-6deg) scale(1.05); }
}
.star {
  position: absolute; right: 30px; top: 6px; z-index: -1;
  font-size: clamp(4rem, 9vw, 7rem); line-height: 1;
  color: var(--yellow); -webkit-text-stroke: 2px var(--ink);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.squiggle {
  position: absolute; left: 22px; bottom: 18px; z-index: -1;
  font-size: 4.5rem; line-height: 1; transform: rotate(-15deg);
  animation: wiggle 2.4s ease-in-out infinite;
}
@keyframes wiggle { 50% { transform: rotate(-5deg) translateX(8px); } }
.orb {
  position: absolute; right: 42px; bottom: 40px; z-index: 0;
  width: clamp(70px, 9vw, 105px); aspect-ratio: 1; border: var(--line); border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 3px 0 var(--ink), 6px 8px 0 var(--ink), 10px 14px 18px rgba(24, 8, 54, .25), inset -7px -8px 0 rgba(67, 32, 168, .12);
  display: flex; justify-content: center; align-items: center; gap: 14%;
  animation: bob 3s ease-in-out infinite;
}
.eye {
  width: 21%; aspect-ratio: 1; border-radius: 50%; background: var(--ink);
  transform: translate(var(--ex, 0), var(--ey, 0));
  transition: transform .12s linear;
}
@keyframes bob { 50% { translate: 0 -8px; } }

/* Thumbnail stack */
.stack {
  position: relative; z-index: 1;
  width: min(78%, 760px); aspect-ratio: 16 / 9;
  cursor: pointer; outline: none;
}
.stack:focus-visible .card[data-depth="0"] { outline: 4px dashed var(--ink); outline-offset: 8px; }
.card {
  position: absolute; inset: 0;
  border: var(--line); border-radius: 24px; overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow-lg);
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0deg)) scale(var(--sc, 1));
  transition: transform .6s var(--pop), opacity .35s, filter .4s;
}
.card img { height: 100%; object-fit: cover; }
.stack.is-shuffling .card[data-depth="0"] {
  transform: translate(60%, -40%) rotate(22deg) scale(.9);
  opacity: 0;
}

/* ---------- Thumbnail ticker ---------- */
.ticker {
  background: var(--yellow);
  border-block: var(--line);
  overflow: hidden;
  transform: rotate(-1.5deg) scale(1.03);
  margin: 40px 0 70px;
}
.ticker-track {
  display: flex; gap: 18px; width: max-content;
  padding: 16px 9px;
  animation: marquee 40s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track img {
  width: 220px; aspect-ratio: 16 / 9; object-fit: cover;
  border: var(--line); border-radius: 14px;
  box-shadow: 4px 5px 0 var(--ink);
}
.ticker-track img:nth-child(odd) { transform: rotate(-2deg); }
.ticker-track img:nth-child(even) { transform: rotate(2deg); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Thumbnail grid ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
}
.project {
  grid-column: span 2;
  padding: 13px; border: var(--line); border-radius: 28px;
  background: var(--cream); box-shadow: var(--shadow);
  cursor: pointer; font: inherit; text-align: left;
  opacity: 0; transform: translateY(40px) rotate(var(--r, 0deg)) scale(.92);
  transition: transform .55s var(--pop), opacity .4s, box-shadow .2s;
  transition-delay: calc(var(--d, 0) * 80ms);
}
.project.in { opacity: 1; transform: rotate(var(--r, 0deg)); }
.project.in:hover, .project.in:focus-visible {
  transform: translate(-2px, -7px) rotate(calc(var(--r, 0deg) - 1deg));
  box-shadow: 0 4px 0 var(--ink), 7px 10px 0 var(--ink), 13px 18px 22px rgba(24, 8, 54, .28);
  transition-delay: 0s;
  outline: none;
}
.project:nth-child(1) { grid-column: span 4; grid-row: span 2; }
.project:nth-child(2), .project:nth-child(3) { grid-column: span 2; }
.project:nth-child(3n + 1) { --r: -.6deg; }
.project:nth-child(3n + 2) { --r: .8deg; }
.project:nth-child(1) { --bg: var(--lilac); }
.project:nth-child(2) { --bg: var(--yellow); }
.project:nth-child(3) { --bg: var(--coral); }
.project:nth-child(4) { --bg: var(--mint); }
.project:nth-child(5) { --bg: var(--lilac); }

.thumb {
  position: relative; height: 100%;
  border: var(--line); border-radius: 19px; overflow: hidden;
  background: var(--bg, var(--lilac));
}
.thumb img {
  height: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  transition: transform .5s var(--pop);
}
.project:hover .thumb img { transform: scale(1.06) rotate(-1deg); }
.thumb::after {
  content: "↗";
  position: absolute; right: 12px; top: 12px;
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--yellow); border: var(--line); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink); font-size: 1.2rem; font-weight: 900;
  transform: scale(0) rotate(-45deg);
  transition: transform .35s var(--pop);
}
.project:hover .thumb::after, .project:focus-visible .thumb::after { transform: scale(1) rotate(0); }

/* ---------- Sections ---------- */
.section { margin-bottom: 74px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-bottom: 26px; color: var(--cream);
}
.section-head h2 {
  margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); line-height: .95; letter-spacing: -.07em; font-weight: 1000;
  text-shadow: 3px 3px 0 var(--ink);
}
.mods-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.mod {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 16px 16px 20px; border: var(--line); border-radius: 28px;
  background: var(--cream); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(40px) scale(.92);
  transition: transform .55s var(--pop), opacity .4s, box-shadow .2s;
  transition-delay: calc(var(--d, 0) * 80ms);
}
.mod.in { opacity: 1; transform: none; }
.mod.in:hover, .mod.in:focus-visible {
  transform: translate(-2px, -7px) rotate(-1deg);
  box-shadow: 0 4px 0 var(--ink), 7px 10px 0 var(--ink), 13px 18px 22px rgba(24, 8, 54, .28);
  transition-delay: 0s; outline: none;
}
.mod-icon {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: var(--line); border-radius: 22px;
  transition: transform .5s var(--pop);
}
.mod:hover .mod-icon { transform: rotate(-3deg) scale(1.03); }
.mod-name { font-size: 1.25rem; font-weight: 950; letter-spacing: -.04em; line-height: 1.1; }
.mod-type {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  background: var(--purple); color: #fff; padding: 7px 10px; border-radius: 99px;
}
.mod-type.is-plugin { background: var(--coral); color: var(--ink); }
.mod-type.is-game { background: var(--mint); color: var(--ink); }
@media (max-width: 760px) {
  .mods-grid { grid-template-columns: 1fr; gap: 18px; }
  .mod { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .mod-icon { width: 84px; border-radius: 16px; }
  .mod-name { flex: 1; }
}

/* ---------- Portfolio categories ----------
   /portfolio/<category> shows only that category's section. */
.cats { display: flex; flex-wrap: wrap; gap: 12px; margin: -6px 0 30px; }
.cats a[aria-current="page"] { background: var(--yellow); }
html[data-cat="thumbnails"] [data-section]:not([data-section="thumbnails"]),
html[data-cat="minecraft"] [data-section]:not([data-section="minecraft"]),
html[data-cat="roblox"] [data-section]:not([data-section="roblox"]) { display: none; }
html:not([data-cat="all"]) .cats { margin-bottom: 40px; }

/* ---------- Roblox projects ---------- */
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.game { grid-column: span 2; }
.game.is-single { grid-column: span 1; }
.game.is-single .game-shots { grid-template-columns: 1fr; }
.game {
  padding: 16px 16px 18px; border: var(--line); border-radius: 28px;
  background: var(--cream); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(40px) scale(.92);
  transition: transform .55s var(--pop), opacity .4s;
  transition-delay: calc(var(--d, 0) * 80ms);
}
.game.in { opacity: 1; transform: rotate(-.4deg); }
.game-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 6px 16px; }
.game-name { margin: 0; font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 1000; letter-spacing: -.05em; line-height: 1.05; }
.game-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.shot {
  position: relative; padding: 0; cursor: pointer;
  border: var(--line); border-radius: 19px; overflow: hidden; background: var(--lilac);
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform .35s var(--pop), box-shadow .2s;
}
.shot img { aspect-ratio: 3 / 2; height: auto; object-fit: cover; transition: transform .5s var(--pop); }
.shot:hover, .shot:focus-visible { transform: translate(-2px, -5px) rotate(-1deg); box-shadow: 7px 9px 0 var(--ink); outline: none; }
.shot:hover img { transform: scale(1.05); }
.shot:nth-child(even):hover { transform: translate(-2px, -5px) rotate(1deg); }

/* ---------- Landing ---------- */
.hero-inner {
  position: relative; z-index: 1;
  display: grid; justify-items: center; gap: clamp(22px, 4vw, 40px);
  padding: 40px 16px;
}
.wordmark {
  margin: 0; display: flex;
  font-size: clamp(3rem, 12.5vw, 9.5rem); font-weight: 1000; line-height: .9; letter-spacing: -.06em;
  color: var(--cream); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 5px 6px 0 var(--ink);
  transform: rotate(-3deg);
}
.wordmark span { display: inline-block; animation: drop .7s var(--pop) backwards; animation-delay: calc(var(--i) * 60ms + 150ms); }
.wordmark span:nth-child(odd) { rotate: -3deg; }
.wordmark span:nth-child(even) { rotate: 3deg; translate: 0 4px; }
.wordmark span:nth-child(3n) { color: var(--yellow); }
@keyframes drop { from { transform: translateY(-70px) scale(.5); opacity: 0; } }

.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.cat-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 13px 13px 18px; border: var(--line); border-radius: 28px;
  background: var(--cream); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(40px) scale(.92);
  transition: transform .55s var(--pop), opacity .4s, box-shadow .2s;
  transition-delay: calc(var(--d, 0) * 80ms);
}
.cat-card.in { opacity: 1; transform: rotate(var(--r, 0deg)); }
.cat-card:nth-child(3n + 1) { --r: -.6deg; }
.cat-card:nth-child(3n + 2) { --r: .8deg; }
.cat-card.in:hover, .cat-card.in:focus-visible {
  transform: translate(-2px, -7px) rotate(calc(var(--r, 0deg) - 1deg));
  box-shadow: 0 4px 0 var(--ink), 7px 10px 0 var(--ink), 13px 18px 22px rgba(24, 8, 54, .28);
  transition-delay: 0s; outline: none;
}
.cat-media {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border: var(--line); border-radius: 19px; overflow: hidden;
  background: var(--bg, var(--lilac));
}
.cat-media > img { height: 100%; object-fit: cover; transition: transform .5s var(--pop); }
.cat-card:hover .cat-media > img { transform: scale(1.06) rotate(-1deg); }
.cat-media::after {
  content: "↗";
  position: absolute; right: 12px; top: 12px;
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--yellow); border: var(--line); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink); font-size: 1.2rem; font-weight: 900;
  transform: scale(0) rotate(-45deg);
  transition: transform .35s var(--pop);
}
.cat-card:hover .cat-media::after, .cat-card:focus-visible .cat-media::after { transform: scale(1) rotate(0); }
.cat-icons { display: flex; align-items: center; justify-content: center; gap: 5%; }
.cat-icons img {
  width: 26%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: var(--line); border-radius: 16px; box-shadow: 3px 4px 0 var(--ink);
  transition: transform .5s var(--pop);
}
.cat-icons img:nth-child(1) { rotate: -8deg; }
.cat-icons img:nth-child(2) { rotate: 4deg; translate: 0 -8%; }
.cat-icons img:nth-child(3) { rotate: 10deg; }
.cat-card:hover .cat-icons img { transform: translateY(-6%) scale(1.06); }
.cat-clicker { display: grid; place-items: center; }
.cat-clicker .role {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 9px 13px; border: 2px solid var(--ink); border-radius: 99px;
  background: #2b2d31; color: #dbdee1; font-size: 1.1rem; font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink); transform: rotate(-4deg);
  transition: transform .45s var(--pop);
}
.cat-clicker .role::before {
  content: ""; width: 12px; height: 12px; background: #2dc770;
  transform: rotate(45deg); border-radius: 2px;
}
.cat-card:hover .cat-clicker .role { transform: rotate(4deg) scale(1.08); }
.cat-name { font-size: 1.25rem; font-weight: 950; letter-spacing: -.04em; line-height: 1.1; padding: 0 4px; }
.cat-card .mod-type { margin-left: 4px; }

/* ---------- Email pop-up ---------- */
.mail-pop {
  position: fixed; z-index: 110; left: 50%; bottom: 24px;
  width: min(440px, calc(100% - 32px));
  display: grid; gap: 6px;
  padding: 20px 22px 22px; border: var(--line); border-radius: 26px;
  background: var(--cream); box-shadow: var(--shadow-lg);
  transform: translate(-50%, 140%) rotate(-3deg);
  transition: transform .45s var(--pop);
}
.mail-pop[hidden] { display: none; }
.mail-pop.open { transform: translate(-50%, 0) rotate(-1deg); }
.mail-msg { font-size: 1.3rem; font-weight: 1000; letter-spacing: -.04em; }
.mail-addr { font-weight: 600; word-break: break-all; user-select: all; }
.mail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.mail-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--yellow); color: var(--ink); font: inherit; font-weight: 900; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

/* ---------- Footer ---------- */
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 15px;
  color: var(--cream); font-size: .85rem; padding: 5px 0 30px;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 24px;
  background: rgba(67, 32, 168, .9);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lb-frame {
  justify-self: center; width: min(100%, 1100px);
  padding: 14px; background: var(--cream);
  border: var(--line); border-radius: 32px; box-shadow: var(--shadow-lg);
}
.lb-frame img { aspect-ratio: var(--ratio, 16 / 9); object-fit: cover; border: var(--line); border-radius: 20px; }
.lb-btn {
  width: 54px; height: 54px; border: var(--line); border-radius: 18px;
  background: var(--yellow); color: var(--ink); font-family: inherit; font-size: 1.4rem; font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink), 6px 7px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.lb-btn:hover { transform: translate(3px, 4px); box-shadow: 0 2px 0 var(--ink), 2px 3px 0 var(--ink); }
.lb-close { position: absolute; top: 20px; right: 20px; background: var(--cream); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .wrap { padding: 17px; }
  .artboard { border-radius: 30px; }
  .stack { width: 86%; }
  .card { border-radius: 16px; }
  .orb { right: 18px; bottom: 18px; }
  .projects { grid-template-columns: 1fr; gap: 18px; }
  .cat-grid { grid-template-columns: 1fr; gap: 18px; }
  .cats { gap: 6px; }
  .cats .btn-small { padding: 9px 10px; font-size: .82rem; border-radius: 12px; }
  .games { grid-template-columns: 1fr; }
  .game, .game.is-single { grid-column: auto; }
  .game-shots { grid-template-columns: 1fr; }
  .wordmark { -webkit-text-stroke-width: 2px; text-shadow: 3px 4px 0 var(--ink); }
  .project, .project:nth-child(n) { grid-column: auto; grid-row: auto; }
  .ticker-track img { width: 150px; }
  .lightbox { grid-template-columns: 1fr 1fr; padding: 80px 14px 24px; }
  .lb-frame { grid-column: 1 / -1; grid-row: 1; padding: 8px; border-radius: 22px; }
  .lb-frame img { border-radius: 14px; }
  .lb-prev { justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  html { scroll-behavior: auto; }
}
