/* Public Pixel font - local file */
@font-face {
  font-family: "Public Pixel";
  src: url("./assets/fonts/PublicPixel.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #000000;
  --lemon: #f2ff4a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  overflow: hidden;
}

.app {
  position: fixed;
  inset: 0;
  background: var(--bg);
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.05s ease;
}

.stage.active {
  z-index: 1;
  opacity: 1;
}

.stage-next {
  z-index: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none; /* re-enable on interactive elements */
  z-index: 10; /* Above videos */
}

.enter {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--lemon);
  font-family: "Public Pixel", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 20pt;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  cursor: pointer;
  text-shadow: 0 0 0 transparent;
}

.enter:hover {
  filter: brightness(1.08);
}

.enter:focus-visible {
  outline: 2px solid var(--lemon);
  outline-offset: 6px;
}

.resume {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transform: translateZ(0);
}

.resume img {
  display: block;
  width: min(420px, 70vw);
  height: auto;
  user-select: none;
}

.resume:hover {
  filter: brightness(1.08);
}

.resume:focus-visible {
  outline: 2px solid var(--lemon);
  outline-offset: 10px;
}

.resume-display {
  pointer-events: auto; /* Enable clicks on this container */
  position: absolute;
  inset: 0;
  z-index: 100;
}

.resume-display .resume-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
  pointer-events: none; /* Image doesn't block clicks - they pass through */
}

/* Clickable area - full screen, clicks anywhere on video go to zapping */
.resume-video-click-area {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* Click hint animation in upper right corner */
.click-hint {
  position: absolute;
  top: 80px;
  right: 80px;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.click-hint[hidden] {
  display: none;
}

.click-hint.visible {
  opacity: 1;
}

.click-hint-cursor-wrapper {
  margin-bottom: 10px;
}

.click-hint-cursor {
  width: 50px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.1s ease;
}

.click-hint-cursor.clicking {
  transform: scale(0.85);
}

/* Mobile adjustments for click hint */
@media (max-width: 768px) {
  .click-hint {
    top: 60px;
    right: 40px;
  }
  
  .click-hint-cursor {
    width: 40px;
  }
}

.click-hint-ripple {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: click-ripple 1.2s ease-out infinite;
}

@keyframes click-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@keyframes click-ripple {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Block to prevent clicks on the center where resume is visible */
/* This covers the center portion of the screen where resume content shows */
.resume-display::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 80%;
  pointer-events: auto;
  z-index: 10;
}

.resume-display[hidden] {
  display: none;
}

/* About button on resume page */
.about-button {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  transform: translateZ(0);
}

.about-button img {
  display: block;
  width: min(210px, 35vw);
  height: auto;
  user-select: none;
}

.about-button:hover {
  filter: brightness(1.08);
}

/* Default hidden behavior uses the HTML hidden attribute */
[hidden] {
  display: none !important;
}

/* Zapping instruction screen */
.zap-screen {
  position: absolute;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.zap-screen.visible {
  opacity: 1;
}

.zap-arrows {
  display: flex;
  gap: 40px;
  margin-bottom: 30px;
}

.arrow-key {
  width: 80px;
  height: auto;
}

.zap-text {
  font-family: "Public Pixel", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 15pt;
  color: var(--lemon);
  letter-spacing: 0.02em;
  overflow: hidden;
  white-space: nowrap;
}

/* Click instruction (within zap screen) */
.click-instruction {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.click-instruction.visible {
  opacity: 1;
}

.click-cursor-wrapper {
  margin-bottom: 20px;
}

.click-cursor-anim {
  width: 50px;
  height: auto;
  transition: transform 0.1s ease;
}

.click-cursor-anim.clicking {
  transform: scale(0.85);
}

/* Back to resume button (during zapping) */
.back-to-resume {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  pointer-events: auto !important;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  transform: translateZ(0);
  cursor: pointer;
}

.back-to-resume[hidden] {
  display: none !important;
}

.back-to-resume img {
  display: block;
  width: min(210px, 35vw); /* Half size of original */
  height: auto;
  user-select: none;
}

.back-to-resume:hover {
  filter: brightness(1.08);
}

/* Left-side back to resume button (for About section) */
.back-to-resume-left {
  right: auto;
  left: 20px;
}

.back-to-resume:focus-visible {
  outline: 2px solid var(--lemon);
  outline-offset: 6px;
}

/* Music toggle button */
.music-toggle[hidden] {
  display: none !important;
}

/* Hide system cursor everywhere */
html, body, *, *::before, *::after {
  cursor: none !important;
}

/* Custom cursor element (follows mouse via JS) */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 29px;
  height: 40px;
  background-image: url('./Cursor/PNG_Web/Cursor_normal.png?v=2');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-2px, -2px);
  opacity: 0; /* Hidden initially */
  transition: opacity 0.1s;
}

.custom-cursor.visible {
  opacity: 1;
}

.custom-cursor.clickable {
  width: 34px;
  background-image: url('./Cursor/PNG_Web/Cursor_found_sm.png?v=2');
}

/* Music toggle button */
.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  background: transparent;
  border: none;
  padding: 0;
  pointer-events: auto;
}

.music-toggle img {
  width: 60px;
  height: auto;
}

.music-toggle:hover {
  filter: brightness(1.2);
}

/* Ribbon view */
.ribbon-view {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  pointer-events: auto; /* Ensure ribbon view receives events */
}

.ribbon-scroll-container {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
  touch-action: pan-y; /* Enable vertical touch scrolling */
  overscroll-behavior: contain; /* Prevent parent scroll */
  pointer-events: auto; /* Ensure scroll container receives events */
}

.ribbon-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.ribbon-image {
  width: 100%;
  height: auto;
  display: block;
  /* No pointer-events restriction - scroll events go to container */
}

.ribbon-back {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 160;
}

/* Video with ribbon is clickable */
.stage.has-ribbon {
  pointer-events: auto;
}

/* About section title overlay */
.about-overlay {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.about-overlay.visible {
  opacity: 1;
}

.about-overlay.position-bottom {
  top: auto;
  bottom: 80px;
  align-items: flex-end;
}

.about-title {
  font-family: "Public Pixel", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 40pt;
  color: var(--lemon);
  letter-spacing: 0.02em;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

/* ================================
   MOBILE & TOUCH DEVICE STYLES
   ================================ */

/* Show system cursor on touch devices (custom cursor doesn't work) */
@media (hover: none) and (pointer: coarse) {
  html, body, *, *::before, *::after {
    cursor: auto !important;
  }
  
  .custom-cursor {
    display: none !important;
  }
}

/* Mobile-specific styles */
@media screen and (max-width: 768px) {
  /* Enter button */
  .enter {
    font-size: 14pt;
    padding: 8px 12px;
  }
  
  /* Resume button */
  .resume img {
    width: min(300px, 80vw);
  }
  
  /* About button - make it bigger and easier to tap */
  .about-button {
    bottom: 15px;
    right: 15px;
  }
  
  .about-button img {
    width: min(160px, 40vw);
  }
  
  /* Zapping screen arrows and text */
  .zap-arrows {
    gap: 20px;
    margin-bottom: 20px;
  }
  
  .arrow-key {
    width: 50px;
  }
  
  .zap-text {
    font-size: 11pt;
    text-align: center;
    padding: 0 20px;
    white-space: normal;
    line-height: 1.6;
  }
  
  .click-cursor-anim {
    width: 40px;
  }
  
  /* Back to resume buttons */
  .back-to-resume {
    bottom: 15px;
    right: 15px;
  }
  
  .back-to-resume img {
    width: min(140px, 35vw);
  }
  
  .back-to-resume-left {
    left: 15px;
  }
  
  /* Music toggle */
  .music-toggle {
    top: 15px;
    right: 15px;
  }
  
  .music-toggle img {
    width: 45px;
  }
  
  /* Ribbon view */
  .ribbon-image {
    width: 100vw;
  }
  
  .ribbon-back {
    bottom: 15px;
    right: 15px;
  }
  
  /* About overlay title */
  .about-overlay {
    top: 40px;
  }
  
  .about-overlay.position-bottom {
    bottom: 40px;
  }
  
  .about-title {
    font-size: 20pt;
    padding: 0 15px;
    white-space: normal;
    line-height: 1.4;
  }
}

/* Extra small screens (phones in portrait) */
@media screen and (max-width: 480px) {
  .enter {
    font-size: 12pt;
  }
  
  .resume img {
    width: min(260px, 85vw);
  }
  
  .about-button img {
    width: min(130px, 38vw);
  }
  
  .arrow-key {
    width: 40px;
  }
  
  .zap-text {
    font-size: 10pt;
  }
  
  .back-to-resume img {
    width: min(110px, 32vw);
  }
  
  .music-toggle img {
    width: 38px;
  }
  
  .about-title {
    font-size: 16pt;
  }
}

/* Landscape mode on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .zap-arrows {
    margin-bottom: 10px;
  }
  
  .arrow-key {
    width: 40px;
  }
  
  .zap-text {
    font-size: 10pt;
  }
  
  .click-instruction {
    margin-top: 15px;
  }
  
  .about-overlay {
    top: 20px;
  }
  
  .about-overlay.position-bottom {
    bottom: 20px;
  }
  
  .about-title {
    font-size: 18pt;
  }
}

/* ================================
   MOBILE NAVIGATION BUTTONS
   ================================ */

.mobile-nav-btn {
  display: none; /* Hidden on desktop */
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--lemon);
  border-radius: 8px;
  color: var(--lemon);
  font-size: 32px;
  font-weight: bold;
  z-index: 500;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-nav-btn:active {
  background: rgba(242, 255, 74, 0.3);
}

.mobile-nav-left {
  left: 10px;
}

.mobile-nav-right {
  right: 10px;
}

/* Show mobile nav buttons only on touch devices */
@media (hover: none) and (pointer: coarse) {
  .mobile-nav-btn {
    display: flex;
  }
  
  /* Hide arrow keys instruction on mobile (use swipe instead) */
  .zap-arrows {
    display: none;
  }
  
  .zap-text {
    text-align: center;
  }
}
