/* ============================================
   negativesphere.dev — handdrawn portfolio CSS
   ============================================ */

/* --- VARIABLES --- */
:root {
  --paper: #fffef2;
  --ink: #1a1a1a;
  --accent: #f5a623;
  --accent2: #e84855;
  --accent3: #4ecdc4;
  --shadow: rgba(0,0,0,0.12);
  --font-hand: 'Caveat', cursive;
  --font-marker: 'Permanent Marker', cursive;
  --font-kalam: 'Kalam', cursive;
}

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 1.1rem;
  line-height: 1.6;
  cursor: none; /* hide default cursor */
  overflow-x: hidden;
}

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

/* --- PAPER TEXTURE OVERLAY --- */
.paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* --- CUSTOM CURSOR --- */
.cursor {
  position: fixed;
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, width 0.2s ease, height 0.2s ease, background 0.2s ease;
}

.cursor-trail {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: left 0.08s ease, top 0.08s ease;
  opacity: 0.7;
}

body:has(a:hover) .cursor,
body:has(.game-card:hover) .cursor {
  width: 40px;
  height: 40px;
  background: rgba(245, 166, 35, 0.15);
  border-color: var(--accent);
}

/* --- NAV --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  background: var(--paper);
  border-bottom: 2.5px solid var(--ink);
  /* Wobbly bottom border via box-shadow trick */
  box-shadow: 0 3px 0 var(--ink);
}

.nav-logo a {
  display: block;
}

.logo-svg {
  width: 180px;
  height: 40px;
}

.logo-text {
  font-family: var(--font-marker);
  font-size: 18px;
  fill: var(--ink);
  letter-spacing: -1px;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-link {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  font-weight: 700;
  position: relative;
  transition: color 0.2s;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* --- HERO --- */
.hero {
  min-height: 100vh;
  padding: 8rem 4rem 6rem;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.doodle {
  position: absolute;
  pointer-events: none;
}

.doodle-stars {
  top: 5rem;
  left: 1rem;
  width: 220px;
  opacity: 0.6;
  animation: float 6s ease-in-out infinite;
}

.doodle-right {
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 130px;
  opacity: 0.55;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

.doodle-right {
  animation: floatRight 8s ease-in-out infinite reverse;
}

@keyframes floatRight {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(calc(-50% - 12px)) rotate(-2deg); }
}

.hero-content {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 2;
  animation: slideUp 0.8s ease both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Speech bubble */
.hero-speech-bubble {
  position: relative;
  display: inline-block;
}

.bubble-bg {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.12));
}

.bubble-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  text-align: center;
  width: 85%;
}

.hero-name {
  font-family: var(--font-marker);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -1px;
}

.hero-title {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  font-weight: 600;
  color: #555;
  margin-top: 0.2rem;
}

.hero-bio {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #333;
  padding-left: 0.5rem;
  border-left: 4px solid var(--accent);
}

/* Doodle buttons */
.hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.doodle-btn {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.5rem 1.4rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 3px 3px 0 var(--ink);
}

.doodle-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--accent);
}

/* --- DIVIDERS --- */
.section-divider {
  line-height: 0;
  margin-bottom: -1px;
}

.section-divider.flip {
  transform: scaleY(-1);
  margin-top: -1px;
  margin-bottom: 0;
}

.section-divider svg {
  display: block;
  width: 100%;
}

/* --- GAMES SECTION --- */
.games-section {
  background: var(--ink);
  color: var(--paper);
  padding: 5rem 3rem 6rem;
}

.section-label {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title-text {
  font-family: var(--font-marker);
  font-size: 28px;
  fill: var(--paper);
}

.underline-svg {
  width: 200px;
  height: 40px;
}

/* --- GAME CARDS GRID --- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.game-card {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--paper);
  border-radius: 4px;
  overflow: hidden;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 6px 6px 0 rgba(255,255,255,0.15);
  /* Slight rotation for handmade feel */
}

.game-card:nth-child(odd) {
  transform: rotate(-1deg);
}

.game-card:nth-child(even) {
  transform: rotate(0.8deg);
}

.game-card:hover {
  transform: rotate(0deg) scale(1.03) translateY(-4px) !important;
  box-shadow: 10px 10px 0 rgba(245, 166, 35, 0.6);
  z-index: 10;
}

/* Card media area */
.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
}

.card-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.game-card:hover .card-video {
  transform: scale(1.05);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245, 166, 35, 0.0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.game-card:hover .card-overlay {
  background: rgba(245, 166, 35, 0.25);
}

.card-cta {
  font-family: var(--font-marker);
  font-size: 1.2rem;
  color: var(--paper);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.game-card:hover .card-cta {
  opacity: 1;
  transform: translateY(0);
}

/* Card info */
.card-info {
  padding: 1rem 1rem 1.2rem;
}

.card-title-svg {
  width: 100%;
  height: 40px;
  margin-bottom: 0.3rem;
}

.card-game-title {
  font-family: var(--font-marker);
  font-size: 20px;
  fill: var(--ink);
}

.card-tags {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: #666;
  font-weight: 600;
}

/* Corner decoration */
.card-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 36px;
  height: 36px;
  pointer-events: none;
}

/* --- FOOTER --- */
.footer {
  background: var(--paper);
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 2.5px solid var(--ink);
}

.footer-text {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: #555;
  margin-bottom: 0.8rem;
}

.footer-squiggle {
  width: 200px;
  height: 20px;
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-hero {
  padding: 9rem 4rem 5rem;
  max-width: 900px;
  margin: 0 auto;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about-photo-frame {
  position: relative;
}

.about-photo {
  width: 100%;
  border: 3px solid var(--ink);
  display: block;
  box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(-2deg);
}

.about-photo-doodle {
  position: absolute;
  bottom: -30px;
  right: -30px;
  width: 90px;
}

.about-text h2 {
  font-family: var(--font-marker);
  font-size: 2rem;
  margin-bottom: 1.2rem;
}

.about-text p {
  font-family: var(--font-hand);
  font-size: 1.15rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: #333;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.skill-tag {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
}

.skill-tag:nth-child(3n+1) { background: #fff3d4; }
.skill-tag:nth-child(3n+2) { background: #d4f5f3; }
.skill-tag:nth-child(3n)   { background: #ffd4d7; }

/* ============================================
   GAME DETAIL PAGE
   ============================================ */
.game-detail {
  padding: 8rem 3rem 5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.game-detail-header {
  margin-bottom: 2.5rem;
}

.game-detail-title {
  font-family: var(--font-marker);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  position: relative;
  display: inline-block;
}

.game-detail-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--accent);
  border-radius: 3px;
  /* Wobbly line via SVG filter */
}

.game-detail-tags {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: #555;
  margin-top: 1rem;
}

.game-detail-video {
  width: 100%;
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  margin-bottom: 3rem;
  border-radius: 2px;
  display: block;
}

/* Section blocks inside game detail */
.detail-section {
  margin-bottom: 3rem;
  padding: 2rem;
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 5px 5px 0 var(--ink);
  background: #fff;
  position: relative;
}

.detail-section-title {
  font-family: var(--font-marker);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section-title::before {
  content: '▶';
  color: var(--accent);
  font-size: 1rem;
}

.detail-section p {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  line-height: 1.8;
  color: #333;
  margin-bottom: 0.8rem;
}

/* Code block */
.code-block {
  background: #1a1a1a;
  color: #e8e8e8;
  padding: 1.2rem 1.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: 1rem 0;
  border: 2px solid #333;
  position: relative;
}

.code-block::before {
  content: 'code';
  font-family: var(--font-hand);
  position: absolute;
  top: -12px;
  left: 10px;
  background: var(--accent);
  color: var(--ink);
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.code-keyword { color: #ff79c6; }
.code-string  { color: #f1fa8c; }
.code-comment { color: #6272a4; font-style: italic; }
.code-type    { color: #8be9fd; }

/* Screenshot gallery */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.screenshot-grid img {
  width: 100%;
  border: 2.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.2s;
}

.screenshot-grid img:hover {
  transform: scale(1.03) rotate(1deg);
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.5rem 1.2rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 2rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.back-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .hero {
    padding: 7rem 1.5rem 4rem;
    flex-direction: column;
  }

  .doodle-right { display: none; }

  .nav {
    padding: 1rem 1.5rem;
  }

  .nav-links {
    gap: 1.2rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .game-detail {
    padding: 7rem 1.5rem 4rem;
  }
}
