/* ---------- fonts ---------- */
@font-face {
  font-family: 'Array';
  src: url('../fonts/Array/WEB/fonts/Array-Regular.woff2') format('woff2'),
       url('../fonts/Array/WEB/fonts/Array-Regular.woff') format('woff'),
       url('../fonts/Array/WEB/fonts/Array-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Array';
  src: url('../fonts/Array/WEB/fonts/Array-Bold.woff2') format('woff2'),
       url('../fonts/Array/WEB/fonts/Array-Bold.woff') format('woff'),
       url('../fonts/Array/WEB/fonts/Array-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Khand';
  src: url('../fonts/Khand/WEB/fonts/Khand-Regular.woff2') format('woff2'),
       url('../fonts/Khand/WEB/fonts/Khand-Regular.woff') format('woff'),
       url('../fonts/Khand/WEB/fonts/Khand-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Khand';
  src: url('../fonts/Khand/WEB/fonts/Khand-Light.woff2') format('woff2'),
       url('../fonts/Khand/WEB/fonts/Khand-Light.woff') format('woff'),
       url('../fonts/Khand/WEB/fonts/Khand-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Khand';
  src: url('../fonts/Khand/WEB/fonts/Khand-Bold.woff2') format('woff2'),
       url('../fonts/Khand/WEB/fonts/Khand-Bold.woff') format('woff'),
       url('../fonts/Khand/WEB/fonts/Khand-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
  font-style: normal;
}

/* ---------- reset / base ---------- */
:root {
  --ink: #f5f2ea;
  --ink-dim: rgba(245, 242, 234, 0.72);
  --panel: rgba(13, 14, 18, 0.93);
  --panel-border: rgba(255, 255, 255, 0.18);
  --bevel-light: rgba(255, 255, 255, 0.22);
  --bevel-dark: rgba(0, 0, 0, 0.65);
  --selection: rgba(120, 190, 255, 0.28);
  --accent-a: #ffd76a;
  --accent-b: #7fd9ff;
  --accent-c: #ff8ad8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background-color: #17181d;
}

body {
  font-family: 'Khand', Georgia, serif;
  color: var(--ink);
  background: #17181d url('../assets/background.jpg') center / cover no-repeat fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  cursor: url('../cursor/normal.cur') 4 2, auto;
}

a { color: inherit; text-decoration: none; }

a, .desktop-icon, button, .home-link {
  cursor: url('../cursor/link.cur') 4 2, pointer;
}

img { max-width: 100%; display: block; }

/* ---------- animations ---------- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hover-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(3px, -7px) rotate(-1deg); }
  50%      { transform: translate(-4px, 2px) rotate(0.6deg); }
  75%      { transform: translate(3px, 5px) rotate(-0.4deg); }
}

.fade-in {
  opacity: 0;
  animation: fade-in-up 0.8s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { opacity: 1; animation: none; }
  .site-logo { animation: none !important; opacity: 1; }
}

/* ---------- shared header ---------- */
.site-header {
  padding: 3.5rem 2rem 1.25rem;
  text-align: center;
}

.site-logo {
  display: block;
  width: clamp(200px, 32vw, 340px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.55));
  opacity: 0;
  animation: fade-in-up 0.9s ease-out forwards;
}

.home-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-family: 'Khand', Georgia, serif;
  font-size: 0.95rem;
  text-transform: lowercase;
  color: var(--ink-dim);
  border: 1px solid rgba(0, 0, 0, 0.7);
  background: var(--panel);
  padding: 0.35rem 0.9rem;
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark);
  transition: color 0.1s ease;
}
.home-link:hover,
.home-link:focus-visible {
  color: var(--ink);
}
.home-link:active {
  box-shadow: inset -1px -1px 0 var(--bevel-light), inset 1px 1px 0 var(--bevel-dark);
}

/* ---------- homepage desktop icon grid ---------- */
main.desktop {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem 4rem;
}

.icon-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 2.5rem 4rem;
  padding: 1rem;
}

.desktop-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 190px;
  padding: 0.8rem 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

/* marching-ants selection border, classic Windows-style */
.desktop-icon::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, #fff 50%, transparent 50%),
    linear-gradient(90deg, #fff 50%, transparent 50%),
    linear-gradient(0deg, #fff 50%, transparent 50%),
    linear-gradient(0deg, #fff 50%, transparent 50%);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-size: 8px 2px, 8px 2px, 2px 8px, 2px 8px;
  background-position: 0 0, 0 100%, 0 0, 100% 0;
  transition: opacity 0.15s ease;
  animation: marching-ants 0.4s linear infinite paused;
}

.desktop-icon:hover::after,
.desktop-icon:focus-visible::after {
  opacity: 0.85;
  animation-play-state: running;
}

@keyframes marching-ants {
  to { background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .desktop-icon::after { animation: none; }
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  background: var(--selection);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px) scale(1.03);
  outline: none;
}

.desktop-icon:active {
  transform: translateY(0) scale(1);
}

.desktop-icon img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  transition: filter 0.15s ease;
}

.desktop-icon:hover img,
.desktop-icon:focus-visible img {
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 18px rgba(127, 217, 255, 0.55));
}

.desktop-icon.game-tile img {
  image-rendering: auto;
  border-radius: 12px;
}

.desktop-icon span {
  font-family: 'Array', system-ui, sans-serif;
  font-size: 0.95rem;
  text-transform: lowercase;
  color: var(--ink);
  text-align: center;
  padding: 0.15rem 0.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

@media (max-width: 720px) {
  .desktop-icon { width: 130px; }
  .desktop-icon img { width: 100px; height: 100px; }
}

.desktop-icon:hover span,
.desktop-icon:focus-visible span {
  background: rgba(30, 60, 100, 0.55);
  border-radius: 3px;
}

/* ---------- subpage content ---------- */
main.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.page-panel {
  max-width: 640px;
  width: 100%;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark),
              0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 2.5rem 2.25rem;
  text-align: center;
}

.page-panel h2 {
  font-family: 'Array', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin: 0 0 0.75rem;
  letter-spacing: 0.03em;
}

.page-panel p {
  font-family: 'Khand', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
  text-transform: lowercase;
  color: var(--ink-dim);
  margin: 0.5rem 0;
}

.page-panel .placeholder-note {
  margin-top: 1.5rem;
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(245, 242, 234, 0.5);
}

.games-panel {
  max-width: 900px;
}

.projects-panel {
  max-width: 760px;
}

.pub-card {
  text-align: left;
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark);
}

.pub-title {
  font-family: 'Khand', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.4;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.pub-role {
  font-family: 'Khand', Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  text-transform: lowercase;
  color: var(--ink-dim);
  margin: 0 0 1rem;
}

.pub-card .home-link {
  margin-top: 0;
}

.games-panel .icon-grid {
  margin-top: 0.5rem;
  gap: 2rem 2.5rem;
}

.games-panel .desktop-icon {
  width: 170px;
}

.games-panel .desktop-icon img {
  width: 130px;
  height: 130px;
}

/* ---------- about page: photo + wrapped bio ---------- */
.about-panel {
  max-width: 760px;
  text-align: left;
}

.about-bio {
  overflow: hidden;
}

.about-photo {
  float: left;
  width: 180px;
  height: auto;
  margin: 0 1.5rem 1rem 0;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark);
}

.about-panel h2 {
  margin-top: 0;
  text-align: left;
}

.about-panel p {
  text-align: left;
}

.about-social {
  clear: both;
  display: flex;
  gap: 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.about-social img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  transition: filter 0.15s ease, transform 0.15s ease;
}

.about-social a:hover img,
.about-social a:focus-visible img {
  transform: translateY(-2px);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 14px rgba(127, 217, 255, 0.55));
}

@media (max-width: 560px) {
  .about-photo {
    float: none;
    display: block;
    margin: 0 auto 1.25rem;
  }
  .about-panel h2,
  .about-panel p {
    text-align: center;
  }
  .about-social {
    justify-content: center;
  }
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-family: 'Khand', Georgia, serif;
  font-size: 0.8rem;
  text-transform: lowercase;
  color: rgba(245, 242, 234, 0.45);
  letter-spacing: 0.03em;
}

/* ---------- CRT scanlines + grain overlay ---------- */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

body::before {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 2px,
    transparent 3px
  ),
  radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
  mix-blend-mode: multiply;
  opacity: 0.4;
}

body::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.05;
}

/* ---------- cursor sparkle trail ---------- */
.cursor-sparkle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 200;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px 2px currentColor;
  animation: sparkle-pop 0.65s ease-out forwards;
}

@keyframes sparkle-pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-16px) scale(0.2); }
}
