/* ===================================================
   PRINCE PATEL — Pixel Mosaic Portfolio
   Palette: Dark Retro Arcade
   Fonts: Press Start 2P, VT323
   =================================================== */

:root {
  --bg: #050510;
  --fg: #e0e0e0;
  --primary: #ff0055;
  --secondary: #00f0ff;
  --tertiary: #ffea00;
  --quaternary: #00ff00;
  --panel-bg: #111122;
  --border-color: var(--fg);

  --ff-pixel: 'Press Start 2P', cursive;
  --ff-term: 'VT323', monospace;

  --gap: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--ff-term);
  font-size: 1.2rem;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  /* Pixel art cursor */
  cursor: crosshair;
}

body.loading {
  overflow: hidden;
}

/* CRT Scanline effect */
.scanlines::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 9999;
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.1s;
}

a:hover {
  color: var(--primary);
}

h1,
h2,
h3,
.pixel-heading,
.tile-header {
  font-family: var(--ff-pixel);
  font-weight: normal;
  line-height: 1.4;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-left: 2px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border: 2px solid var(--border-color);
}

/* The Blocky Border Class */
.blocky-border {
  border: 4px solid var(--border-color);
  background: var(--panel-bg);
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.8);
  position: relative;
}

.blocky-border::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  bottom: -4px;
  left: -4px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.blocky-border:hover {
  box-shadow: 8px 8px 0px var(--primary);
  border-color: var(--primary);
  z-index: 10;
}

/* Mosaic Container Layout */
.mosaic-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

.tile {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.tile-header {
  font-size: 0.7rem;
  background: var(--primary);
  color: #fff;
  display: inline-block;
  padding: 4px 8px;
  margin-bottom: 1rem;
  align-self: flex-start;
  text-transform: uppercase;
}

/* Grid areas for desktop */
.header-tile {
  grid-column: span 4;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.hero-tile {
  grid-column: span 4;
  position: relative;
  overflow: hidden;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.hero-tile::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50vw;
  height: 50vw;
  max-width: 500px;
  max-height: 500px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%23ffffff' d='M111.4 125l-29.8 89.5H35.2v29.8H5.3v143.2h29.8v29.8h29.8v29.8h89.5v-29.8h202.9v29.8h89.5v-29.8h29.8v-29.8h29.8V244.3h-29.8v-29.8h-46.1l-29.8-89.5H111.4zm34.2 29.8h220.7l20 59.7H125.7l19.9-59.7zm-80.5 89.5h89.5v29.8h29.8v29.8H154.6v-29.8h-29.8v29.8h-29.8v-29.8H65.1v-29.8zm292.4 0h29.8v29.8h-29.8v-29.8zm59.7 0h29.8v29.8h-29.8v-29.8zm-59.7 59.7h29.8v29.8h-29.8v-29.8zm59.7 0h29.8v29.8h-29.8v-29.8zM154.6 274.1h29.8v29.8h-29.8v-29.8zm-59.7 29.8h29.8v29.8H94.9v-29.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  opacity: 0.05;
  z-index: 1;
  pointer-events: none;
}


.about-tile {
  grid-column: span 2;
}

.skills-tile {
  grid-column: span 2;
}

.work-tile {
  grid-column: span 1;
  transition: transform 0.1s;
  padding: 0;
}

.work-tile:hover {
  transform: translate(-2px, -2px);
}

.work-tile .work-img {
  height: 180px;
  width: 100%;
  border-bottom: 4px solid var(--border-color);
  overflow: hidden;
  position: relative;
}

.work-tile .work-img iframe {
  width: 400%;
  height: 400%;
  transform: scale(0.25);
  transform-origin: top left;
  border: none;
  pointer-events: none;
  /* Let the entire link remain clickable */
}

.work-tile .work-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.work-tile h3 {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.work-tile p {
  font-size: 1rem;
  margin-bottom: 1rem;
  flex-grow: 1;
  margin-top: 0.5rem;
}

.work-tile .tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.work-tile .tags span {
  font-size: 0.8rem;
  border: 2px solid currentColor;
  padding: 2px 6px;
}


.contact-tile {
  grid-column: span 4;
  position: relative;
  min-height: 500px;
}

.contact-tile h2 {
  margin: 1.5rem 0;
  text-align: left;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 100%;
  margin-top: 1rem;
}

.form-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- GAME STYLES --- */
.game-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 4px dashed var(--border-color);
  padding-left: 2rem;
}

.game-container {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-align: center;
  margin-top: 1rem;
}

.game-title {
  color: var(--primary) !important;
  margin-bottom: 0.5rem !important;
  text-align: center !important;
  font-size: 1.2rem;
}

.game-instructions {
  color: var(--fg);
  font-family: var(--ff-pixel);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.game-controls {
  color: var(--secondary);
  font-family: var(--ff-pixel);
  font-size: 0.5rem;
  margin-bottom: 1rem;
}

.game-hud {
  width: 100%;
  display: flex;
  justify-content: center;
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

#contactGame {
  background-color: #030308;
  border: 4px solid var(--border-color);
  image-rendering: pixelated;
  /* Crisp pixel art look */
  width: 300px;
  height: 300px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.game-overlay {
  position: absolute;
  top: 100px;
  /* Offset to center on canvas roughly */
  left: 0;
  width: 100%;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 8, 0.85);
  z-index: 10;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.game-over-title {
  color: var(--primary);
  font-family: var(--ff-pixel);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#finalScoreText {
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  color: var(--fg);
}

.leaderboard {
  text-align: center;
  margin-top: 1rem;
}

.leaderboard h3 {
  font-size: 0.7rem;
  color: var(--secondary);
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 5px;
  margin-bottom: 10px;
}

#leaderboardList {
  list-style: none;
  font-family: var(--ff-term);
  font-size: 1.2rem;
  color: #aaa;
  padding: 0;
}

#leaderboardList li {
  display: flex;
  justify-content: space-between;
  width: 150px;
  margin: 0 auto 5px;
}

#leaderboardList li span:first-child {
  color: var(--tertiary);
}

.pixel-input {
  font-family: var(--ff-pixel);
  background: #000;
  border: 2px solid var(--border-color);
  color: var(--fg);
  padding: 5px;
  width: 100px;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}

.pixel-input:focus {
  outline: none;
  border-color: var(--secondary);
}

#highScoreInput p {
  color: var(--quaternary);
  font-family: var(--ff-pixel);
  font-size: 0.6rem;
  margin-bottom: 10px;
}

.game-success {
  color: var(--quaternary);
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  margin-top: 1rem;
  animation: blink 2s step-end infinite;
}

/* Form Container Hide Toggle */
.hidden {
  display: none !important;
}

#commFormContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: commsSlideIn 0.5s ease-out forwards;
}

@keyframes commsSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .game-wrapper {
    border-left: none;
    border-top: 4px dashed var(--border-color);
    padding-left: 0;
    padding-top: 2rem;
  }
}

.footer-tile {
  grid-column: span 4;
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .mosaic-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-tile,
  .contact-tile,
  .footer-tile {
    grid-column: span 2;
  }

  .hero-tile {
    grid-column: span 2;
    flex-direction: column;
    align-items: flex-start;
  }

  .about-tile,
  .skills-tile {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .mosaic-container {
    grid-template-columns: 1fr;
  }

  .header-tile,
  .hero-tile,
  .about-tile,
  .skills-tile,
  .work-tile,
  .contact-tile,
  .footer-tile {
    grid-column: span 1;
  }

  .header-tile {
    flex-direction: column;
    gap: 1rem;
  }
}

/* specific elements */
.header__logo {
  font-family: var(--ff-pixel);
  font-size: 1.5rem;
  color: var(--fg);
}

.blink {
  animation: blink 1s step-end infinite;
  color: var(--primary);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.header__nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.header__nav a {
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  color: var(--fg);
  text-decoration: none;
}

.header__nav a:hover {
  color: var(--primary);
  background: var(--fg);
  color: var(--bg);
}

.hero-content {
  z-index: 2;
  position: relative;
}

.sys-msg {
  color: var(--quaternary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.hero-name {
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--primary);
  text-shadow: 4px 4px 0px #000;
  margin: 1rem 0;
}

.hero-title {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--secondary);
}

.hero-desc {
  max-width: 500px;
  font-size: 1.3rem;
  margin-bottom: 2rem;
  color: #aaa;
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

.pixel-btn {
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  padding: 12px 20px;
  border: 4px solid var(--border-color);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s;
  display: inline-block;
  text-align: center;
}

.pixel-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: #fff;
  box-shadow: 4px 4px 0 #000;
}

.pixel-btn.primary:active {
  background: #fff;
  color: var(--primary);
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #000;
}

.pixel-btn.secondary {
  background: transparent;
  color: var(--secondary);
  border-color: var(--secondary);
  box-shadow: 4px 4px 0 #000;
}

.pixel-btn.secondary:active {
  background: var(--secondary);
  color: #000;
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #000;
}

.full-width {
  width: 100%;
  max-width: 400px;
}

.hero-image-placeholder {
  width: 250px;
  height: 250px;
  background: var(--bg);
  border: 4px solid var(--border-color);
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 2rem;
}

.profile-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  /* Since it's a real photo */
  filter: grayscale(15%) contrast(110%);
}


/* Stats */
.about-stats {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.stat-box {
  font-family: var(--ff-pixel);
  font-size: 0.7rem;
  color: var(--secondary);
  line-height: 1.5;
}

.stat-num {
  font-size: 2rem;
  color: var(--fg);
}

/* Skills */
.pixel-text {
  font-size: 1.1rem;
  color: #aaa;
  margin-top: 1rem;
}

.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.skill-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skill-name {
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
}

.skill-bar {
  width: 100%;
  height: 20px;
  border: 4px solid var(--border-color);
  background: #000;
  padding: 2px;
}

.skill-fill {
  height: 100%;
  background: var(--primary);
}

/* Form */
.pixel-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
  width: 100%;
  margin-top: 2rem;
}

.pixel-form input,
.pixel-form textarea {
  font-family: var(--ff-term);
  font-size: 1.2rem;
  padding: 10px;
  background: #000;
  border: 4px solid var(--border-color);
  color: var(--fg);
  outline: none;
}

.pixel-form input:focus,
.pixel-form textarea:focus {
  border-color: var(--primary);
}

/* Footer */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  width: 100%;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.back-top {
  font-family: var(--ff-pixel);
  font-size: 0.8rem;
  border: 2px solid var(--secondary);
  padding: 5px;
  display: inline-block;
  margin-top: 1rem;
  cursor: pointer;
}

.back-top:hover {
  background: var(--secondary);
  color: #000;
}

/* Preloader */
.pixel-preloader {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-family: var(--ff-pixel);
}

.loading-text {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.loading-bar-container {
  width: 300px;
  height: 30px;
  border: 4px solid var(--primary);
  padding: 2px;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 0.1s;
}