/* Retro Pixel Art Theme Variables & Font */
@font-face {
  font-family: 'Press Start 2P';
  src: url('../fonts/PressStart2P-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap; /* Use swap for better perceived performance */
}

:root {
  --font-family-pixel: 'Press Start 2P', cursive; /* Fallback to cursive */
  --font-family-base: sans-serif; /* Keep a readable fallback */

  /* Basic Retro Color Palette (Example) */
  --color-background: #030520;
  --color-page-background: #01010e;
  --color-text: #ffffff;
  --color-primary: #00ffff;
  --color-accent: #fffb00;
  --color-border: #ffffff;

  /* Expanded Retro Colors */
  --color-magenta: #ff00ff;
  --color-green: #00ff00;
  --color-red: #ff0000;
  --color-orange: #ff9900;

  --border-pixel: 2px solid var(--color-border);

}

html {
  font-size: 16px; /* Base for rem unit calculations */
}
body {
  font-family: var(--font-family-pixel); /* Use pixel font for body text */
  background-color: var(--color-page-background); /* Different color outside the box */
  color: var(--color-text);
  margin: 0;
  padding: 0;
  line-height: 1.6; /* Improve readability */
}

/* --- Screen Wrapper for Box Effect --- */
#screen-wrapper {
  position: absolute;
  top: 350px;
  left: 735px;
  transform: translate(-50%, -50%);
  width: 900px;
  height: 580px; 
  background-color: var(--color-background);
  overflow: hidden;
}



/* --- Full Screen Section Visibility (New Approach) --- */
/* Sections are now controlled by position:absolute and visibility/opacity */

/* --- Main Layout, Header & Navigation Styling --- */

/* Wrapper for header and main content area */
#main-content-wrapper {
    display: flex;
    flex-direction: column; /* Stack header and main vertically */
    height: 100%; /* Ensure it fills its container (#screen-content) */
    position: relative; /* Needed for absolute positioning of sections inside 'main' */
}

header {
  position: relative; /* Position relative to main-content-wrapper */
  top: 10px; /* Align to top of wrapper */
  width: 100%; /* Full width of wrapper */
  padding: 10px 10px;
  text-align: center;
  z-index: 850; /* Keep above sections */
  box-sizing: border-box; /* Include padding in width */
  pointer-events: none; /* Keep this if header shouldn't intercept clicks */
  flex-shrink: 0; /* Prevent header from shrinking */
}

header h1 {
  margin: 0;
  font-size: 1.8em;
}

header h1 a {
  font-family: var(--font-family-pixel);
  color: var(--color-primary);
  text-decoration: none;
  text-transform: uppercase; /* Common in retro games */
}

header h1 a:hover {
  color: var(--color-accent);
}


/* --- Main Content Area (holds sections) --- */
main {
    flex-grow: 1; /* Allow main to take up remaining vertical space */
    position: relative; /* Crucial for the absolutely positioned sections inside it */
    overflow: hidden; /* Prevent content spillover, sections handle their own scroll */
}

/* --- Full Screen Section Styling --- */
main > section {
  position: absolute; /* Position relative to main */
  top: 0;
  left: 0;
  width: 100%; /* Full width of main */
  height: 100%; /* Full height of main */
  /* Removed fixed top padding, using flex layout now */
  padding: 5px 40px 40px 40px; /* Consistent padding (adjust as needed) */
  box-sizing: border-box; /* Include padding in width/height */
  overflow-y: auto; /* Allow scrolling within section */
  z-index: 500; /* Default z-index for inactive sections */

  /* Initial state & transition */
  visibility: hidden;
}

main > section.active-section {
  visibility: visible;
  z-index: 700; 
}

main h2 {
  font-family: var(--font-family-pixel);
  color: var(--color-primary);
  text-transform: uppercase;
  border-bottom: var(--border-pixel);
  padding-bottom: 5px;
  margin-bottom: 15px;
  font-size: 1.4em;
  display: none;
}

main p {
  font-family: var(--font-family-pixel); /* Use pixel font for paragraphs */
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: 15px;
}

/* Basic styling for links within content */
main a {
    color: var(--color-primary);
}
main a:hover {
    color: var(--color-accent);
}

/* Call-to-Action Button Styling */

.hidden {
  visibility: hidden !important; /* Ensure it overrides */
  opacity: 0 !important;
  pointer-events: none !important; /* Prevent interaction when hidden */
}

/* --- Intro Screen Styles --- */
#intro-screen {
    position: absolute; /* Position relative to screen-wrapper */
    top: 0;
    left: 0;
    width: 100%; /* Full width of wrapper */
    height: 100%; /* Full height of wrapper */
    z-index: 1000; /* Ensure it's on top */
    display: flex;
    flex-direction: column; /* Stack visual and text if needed */
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer; /* Indicate it's clickable */
}

#intro-screen p {
    font-family: var(--font-family-pixel);
    color: var(--color-primary); /* Or var(--color-text) */
    font-size: 1.2em; /* Adjust as needed */
    padding: 20px;
}

/* --- New Intro Prompt Styling --- */
#intro-prompt {
    /* Specific styles */
    padding: 15px 30px; /* Keep specific padding */
    font-size: 1.1em;   /* Keep specific font size */
    opacity: 0;         /* Keep initial state */
    visibility: hidden; /* Keep initial state */
}

#intro-prompt:hover {
    color: var(--color-accent); /* Keep text color change on hover */
}

#intro-prompt p {
    margin: 0; /* Remove default paragraph margin */
    padding: 0;
    font-size: inherit; /* Inherit font size from parent */
    color: inherit; /* Inherit color from parent */
    font-family: inherit; /* Inherit font family */
}



/* --- Footer Styling --- */

footer {
  position: absolute; /* Position relative to screen-wrapper */
  bottom: 0;
  left: 0;
  width: 100%; /* Full width of wrapper */
  text-align: center;
  padding: 10px 20px;
  font-size: 0.8em;
  color: var(--color-text);
  z-index: 10; /* Low z-index */
  /* Initially hidden, shown by JS potentially */
  visibility: hidden;
  opacity: 0;
}

footer.visible {
    visibility: visible;
    opacity: 1;
}

footer p {
  margin: 0;
}
/* === Retro Enhancements === */

.scanlines {
  position: absolute; /* Position relative to screen-wrapper */
  top: 0;
  left: 0;
  width: 100%; /* Full width of wrapper */
  height: 100%; /* Full height of wrapper */
  pointer-events: none; /* Allow clicks through */
  z-index: 800; /* Adjusted Z-Index: Effects above sections/menu */
  overflow: hidden; /* Hide the overflowing pseudo-element */
}

.scanlines::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200%; /* Double height for seamless looping */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.053) 3px,
    transparent 6px,
    transparent 9px
  );
  /* Animate using transform for better performance */
  /* Use downward tilty animation */
  animation: scanlineDownTilty 15s linear infinite; /* Use linear for consistent speed */
}

@keyframes scanlineDownTilty {
  0% { transform: translateY(-50%); }
  100% { transform: translateY(0); }
}

.pixel-border {
  border: 4px solid var(--color-border);
  image-rendering: pixelated;
}

.glow {
  /* Original glow + subtle chromatic aberration */
  animation: glowPulse 2s infinite ease-in-out; /* Keep pulsing */
  color: var(--color-primary);
  text-transform: uppercase;
  border-bottom: var(--border-pixel);
  padding-bottom: 10px;
}

.cta-button:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  box-shadow: 0 0 5px var(--color-primary);
}


#intro-screen.fade-out {
  opacity: 0;
}


/* === Animated Glow Effect (More Intense) === */
@keyframes glowPulse {
  0%, 100% {
    /* Base state with chromatic aberration */
    text-shadow:
      0 0 5px var(--color-primary),
      0 0 10px var(--color-primary),
      1px 1px 1px var(--color-red),
      -1px -1px 1px var(--color-green);
  }
  50% {
    /* Pulsed state with larger glow and aberration */
    text-shadow:
      0 0 15px var(--color-primary), /* Larger glow */
      0 0 25px var(--color-primary), /* Larger glow */
      2px 2px 2px var(--color-red),   /* More offset */
      -2px -2px 2px var(--color-green); /* More offset */
  }
}

/* === Animated Glow Effect (Title) === */
@keyframes glowPulseTitle {
  0%, 100% {
    /* Base state with chromatic aberration */
    text-shadow:
      0 0 5px var(--color-accent),
      0 0 10px var(--color-accent),
      1px 1px 1px var(--color-red),
      -1px -1px 1px var(--color-green);
  }
  50% {
    /* Pulsed state with larger glow and aberration */
    text-shadow:
      0 0 10px var(--color-accent), /* Larger glow */
      0 0 15px var(--color-accent), /* Larger glow */
      2px 2px 2px var(--color-red),   /* More offset */
      -2px -2px 2px var(--color-green); /* More offset */
  }
}

/* === CRT Flicker Overlay (Refined) === */
.crt-flicker {
  position: absolute; /* Position relative to screen-wrapper */
  top: 0;
  left: 0;
  width: 100%; /* Full width of wrapper */
  height: 100%; /* Full height of wrapper */
  pointer-events: none; /* Allow clicks through */
  z-index: 800; /* Adjusted Z-Index: Effects above sections/menu */
  background-color: var(--color-background);
  opacity: 0.1; /* More visible base for testing */
  animation: flicker 0.5s infinite; /* Slower for testing */
}

/* Flicker animation (More Intense) */
@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 0.1; /* Higher base opacity */
  }
  20%, 22%, 24%, 55% {
    opacity: 0.3; /* Much higher peaks */
  }
}

/* === Noise Overlay === */
.noise-overlay {
  position: absolute; /* Position relative to screen-wrapper */
  top: 0;
  left: 0;
  width: 100%; /* Full width of wrapper */
  height: 100%; /* Full height of wrapper */
  pointer-events: none; /* Allow clicks through */
  z-index: 100; /* Adjusted Z-Index: Effects above sections/menu */
  opacity: 0.15; /* Very subtle noise */
  background-image: repeating-linear-gradient(transparent, rgb(41, 41, 41) 4px),
                    repeating-linear-gradient(90deg, var(--color-background), rgb(36, 36, 36) 6px);
  background-size: 20px 20px; /* Small pixel noise */
}

/* === Base Retro Button Style === */
.retro-button {
    display: inline-block; /* Good default for buttons/links */
    padding: 15px 25px; /* Base padding */
    font-family: var(--font-family-pixel);
    color: var(--color-text);
    background-color: transparent;
    border: none; /* Default to no border */
    text-decoration: none; /* For 'a' tags used as buttons */
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s; /* Base hover transition */
    font-size: 1.4em; /* Base font size */
}

.retro-button:hover {
    color: var(--color-accent); /* Default hover effect */
}

/* === Full Screen Menu & Back Button Styles === */

#main-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  visibility: visible;
  opacity: 1;
  min-height: 250px; /* Ensure minimum height even on small screens */
}

#main-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: center;
  width: 100%;
  justify-content: center;
}

#main-menu li {
  margin-bottom: max(5px, min(10px, 2vh)); /* Responsive margins */
  flex-shrink: 0; /* Prevent items from shrinking too much */
}

#main-menu a.retro-button {
  padding: max(px, min(15px, 2vh)) max(10px, min(30px, 4vw));
  font-size: max(0.7em, min(1.2em, 2.5vh));
}

.back-button.retro-button {
    /* Specific styles */
    position: absolute;
    top: auto;
    bottom: 25px;
    right: 40px;
    z-index: 900;
    padding: 8px 15px; /* Override base padding */
    font-size: 1.3em;   /* Specific font size */
}

/* === Enhanced CRT Effects === */
.scanline-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 5%;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.045) 0px,
    rgba(255,255,255,0.045) 1px,
    transparent 1px,
    transparent 1px
  );
  animation: scanline-move 10s linear infinite;
  z-index: 800;
}

@keyframes scanline-move {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(20000%); }
}

h1, h2, h3, p, .crt-flicker-text, button {
  /* Removed !important to allow other button animations like button-active */
  animation: textShadow 3s infinite;
}


@keyframes textShadow {
	0% {
		text-shadow: 0.4389924193300864px 0 1px rgba(0, 30, 255, 0.5),
			-0.4389924193300864px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	5% {
		text-shadow: 2.7928974010788217px 0 1px rgba(0, 30, 255, 0.5),
			-2.7928974010788217px 0 2px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	10% {
		text-shadow: 0.02956275843481219px 0 1px rgba(0, 30, 255, 0.5),
			-0.02956275843481219px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	15% {
		text-shadow: 0.40218538552878136px 0 1px rgba(0, 30, 255, 0.5),
			-0.40218538552878136px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	20% {
		text-shadow: 3.4794037899852017px 0 1px rgba(0, 30, 255, 0.5),
			-3.4794037899852017px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	25% {
		text-shadow: 1.6125630401149584px 0 1px rgba(0, 30, 255, 0.5),
			-1.6125630401149584px 0 2px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	30% {
		text-shadow: 0.7015590085143956px 0 1px rgba(0, 30, 255, 0.5),
			-0.7015590085143956px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	35% {
		text-shadow: 3.896914047650351px 0 1px rgba(0, 30, 255, 0.5),
			-3.896914047650351px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	40% {
		text-shadow: 3.870905614848819px 0 1px rgba(0, 30, 255, 0.5),
			-3.870905614848819px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	45% {
		text-shadow: 2.231056963361899px 0 1px rgba(0, 30, 255, 0.5),
			-2.231056963361899px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	50% {
		text-shadow: 0.08084290417898504px 0 1px rgba(0, 30, 255, 0.5),
			-0.08084290417898504px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	55% {
		text-shadow: 2.3758461067427543px 0 1px rgba(0, 30, 255, 0.5),
			-2.3758461067427543px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	60% {
		text-shadow: 2.202193051050636px 0 1px rgba(0, 30, 255, 0.5),
			-2.202193051050636px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	65% {
		text-shadow: 2.8638780614874975px 0 1px rgba(0, 30, 255, 0.5),
			-2.8638780614874975px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	70% {
		text-shadow: 0.48874025155497314px 0 1px rgba(0, 30, 255, 0.5),
			-0.48874025155497314px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	75% {
		text-shadow: 1.8948491305757957px 0 1px rgba(0, 30, 255, 0.5),
			-1.8948491305757957px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	80% {
		text-shadow: 0.0833037308038857px 0 1px rgba(0, 30, 255, 0.5),
			-0.0833037308038857px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	85% {
		text-shadow: 0.09769827255241735px 0 1px rgba(0, 30, 255, 0.5),
			-0.09769827255241735px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	90% {
		text-shadow: 3.443339761481782px 0 1px rgba(0, 30, 255, 0.5),
			-3.443339761481782px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	95% {
		text-shadow: 2.1841838852799786px 0 1px rgba(0, 30, 255, 0.5),
			-2.1841838852799786px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
	100% {
		text-shadow: 2.6208764473832513px 0 1px rgba(0, 30, 255, 0.5),
			-2.6208764473832513px 0 1px rgba(255, 0, 80, 0.3),
			0 0 3px;
	}
}

.crt-frame {
  position:fixed;
  top: 400px;
  left: 900px;
  transform: translate(-50%, -50%);  /* Centers the image */
  width: 1800px;
  height: 1100px;
  z-index: 8000;
  opacity: 1;
  pointer-events: none;
  overflow: hidden;
}

/* === Vignette Overlay === */
.vignette-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 50% ,rgba(0,0,0,0.3) 75%, rgba(0,0,0,0.5) 100%);
}

/* === Screen Content Container === */
#screen-content {
  width: 100%;
  height: 100%;
  position: relative; /* For potential absolute children if needed */
  transform-origin: center; /* Apply transform origin here */
  background-color: var(--color-background);
}

/* === Power Off Effect === */
@keyframes powerOff {
  0% {
    transform: scale(1, 1);
    filter: brightness(1);
    opacity: 1;
  }
  60% {
    /* Collapse vertically, stretch horizontally slightly, increase brightness */
    transform: scale(1.1, 0.005); /* Adjusted horizontal scale */
    filter: brightness(10);
    opacity: 1; /* Keep opaque until the end */
  }
  100% {
    /* Collapse completely, very bright */
    transform: scale(0, 0);
    filter: brightness(50);
    opacity: 0; /* Fade out at the very end */
  }
}

#screen-wrapper.powering-off #screen-content { /* Target inner div */
  animation: powerOff 0.75s cubic-bezier(0.230, 1.000, 0.320, 1.000) forwards; /* Apply animation with ease-out quint */
}

/* === Overlay Fade-Out Effect === */
@keyframes fadeOutOverlays {
  from { opacity: 1; } /* Start fully visible */
  to   { opacity: 0; } /* End fully transparent */
}

@keyframes fadeOutBrightness {
  from { filter: brightness(1); }
  to   { filter: brightness(0.45); }
}

/* Apply fade-out to overlays *after* content collapse */
#screen-wrapper.powering-off .vignette-overlay,
#screen-wrapper.powering-off {
  animation: fadeOutOverlays 0.15s linear forwards;
  animation-delay: 0.45s; /* Start after powerOff animation finishes */
  /* Ensure overlays stay on top during fade */
  z-index: 850; /* Example: Higher than content, adjust if needed */
}

.crt-frame.powering-off {
  animation: fadeOutBrightness 0.25s linear forwards;
  animation-delay: 0.55s;
}

/* === Power On Effect === */
#screen-wrapper.powering-on #screen-content { /* Target inner div */
  transform: scale(0, 0);
  filter: brightness(50);
  opacity: 0; /* Fade out at the very end */
  animation: powerOff 0.75s cubic-bezier(0.230, 1.000, 0.320, 1.000) forwards; /* Apply animation with ease-out quint */
  animation-direction: reverse;
}

/* Apply fade-out to overlays *after* content collapse */
#screen-wrapper.powering-on .vignette-overlay,
#screen-wrapper.powering-on {
  animation: fadeOutOverlays 0.15s linear forwards;
  opacity: 0;
  animation-delay: 0.45s; /* Start after powerOff animation finishes */
  animation-direction: reverse;
  z-index: 850; /* Example: Higher than content, adjust if needed */
}

.crt-frame.powering-on {
  animation: fadeOutBrightness 0.25s linear forwards;
  filter: brightness(0.45);
  animation-delay: 0.55s;
  animation-direction: reverse;
}

/* === Button Active State (Color Cycling) === */
@keyframes textColorCycle {
  0%, 100% { color: var(--color-text); } /* Flash to white */
  50%      { color: var(--color-accent); } /* Flash to yellow */
}

.button-active {
  /* Apply the animation when the class is added */
  animation: textColorCycle 0.3s linear infinite !important;
  transform: scale(1.1);
}

/* --- Project Section Styles --- */

#projects-section {
    /* Ensure it fills the space if needed, but main section styles handle this */
    position: relative; /* Needed for absolute positioning of children like video view */
}

#project-select-view {
    display: flex; /* Use flexbox for layout */
    flex-wrap: wrap; /* Allow items to wrap */
    justify-content: center; /* Center items */
}

#project-select-view > * {
  /* Two items per row */
  /* width: calc(50% - 20px); */
  width: 100%;
  margin: 5px; /* Add margin around each item */
  box-sizing: border-box; /* Include padding and border in width calculation */
}

.project-select-button.retro-button {
    font-size: 1.2em;              /* Specific font size */
    transition: color 0.2s, border-color 0.2s; /* Add border transition */
    padding: 10px 10px;           /* Specific padding */
}

/* Extend base hover */
.project-select-button.retro-button:hover {
    color: var(--color-accent); /* Add border color change */
}

#project-detail-view h3 {
    font-family: var(--font-family-pixel);
    color: var(--color-accent); /* Use accent for detail title */
    margin-bottom: 15px;
    font-size: 1.4em;
    text-transform: uppercase;
}

#project-detail-view p {
    margin-bottom: 25px;
}

.project-detail-buttons {
    text-align: center; /* Center the play button */
    margin-top: 20px;
}

#project-video-view {
    position: absolute; /* Cover the project section area */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 1); /* Dark overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* Above section content and header */
    padding: 25px 1px; /* Generous padding around the video */
    box-sizing: border-box;
}

#project-close-video-button.retro-button {
    position: absolute;
    top: 40px; /* Keep specific positioning */
    right: 20px;
    z-index: 1110;
    font-size: 2em; /* Keep specific font size */
    padding: 5px 10px; /* Keep specific padding */
    line-height: 1; /* Keep specific line height */
}

#youtube-player iframe {
    display: block; /* Remove extra space below iframe */
    width: 100%;
    height: 100%;
    border: none; /* Remove iframe border */
}

/* Ensure .hidden works as expected */
/* Overwrite previous definition if necessary */
.hidden {
  display: none !important; /* Use display none for layout changes */
}

.empty {
  text-transform: uppercase;
  border-bottom: var(--border-pixel);
  padding-bottom: 10px;
  opacity: 0;
}

#power-on-button {
  position: absolute;
  z-index: 10000; /* Keep specific z-index */
  font-size: 1.5em; /* Keep specific font size */
}

/* --- Project Detail View Pagination Styles --- */

#project-detail-view {
    display: flex; /* Use flexbox to manage layout */
    flex-direction: column; /* Stack pages container and nav footer */
    height: 100%; /* Ensure it fills the section height */
    box-sizing: border-box;
}

.project-pages-container {
    flex-grow: 1; /* Allow page content to take available space */
    position: relative; /* Needed for absolute positioning if pages used it (they don't here) */
    overflow-y: auto; /* Allow scrolling within the page content area if needed */
    padding: 10px 20px; /* Padding for page content */
}

.project-page {
    display: none; /* Hide pages by default */
    /* Removed fadeIn animation */
}

.project-page.active-page {
    display: block; /* Show the active page */
}

.project-page h2,
.project-page h3 {
    font-family: var(--font-family-pixel);
    color: var(--color-primary);
    text-transform: uppercase;
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: 1.5em;
    animation: glowPulseTitle 2s infinite ease-in-out;
}
.project-page h2 {
    font-size: 1.5em; /* Increased base size */
    margin-top: 0; /* No top margin for the main title */
}


.project-page p {
    font-family: var(--font-family-pixel);
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: 12px; /* Increased margin */
    font-size: 1em; /* Increased base size */
}

.project-page p span { /* Style the spans holding the data */
    color: var(--color-accent); /* Highlight the data */
}

/* Style the links container and links */
#project-detail-links {
    margin-top: 20px;
}

#project-detail-links a.retro-button.external-link {
    display: block; /* Display links as block elements */
    margin-bottom: 12px; /* Increased space between links */
    padding: 12px 18px; /* Increased padding for links */
    font-size: 1.1em; /* Increased base font size */
    text-align: left; /* Align text left */
}

#project-detail-links a.retro-button.external-link:hover {
    color: var(--color-accent);
}


/* Navigation Footer */
#project-page-nav {
    position: absolute; /* Position at the bottom of the section */
    bottom: 5px;
    width: 90%; /* Full width of the section */
    padding: 0px 0px;
    border-top: var(--border-pixel);
    display: flex;
    align-items: center;
    margin-top: auto; /* Push to bottom if content is short */
    justify-content: space-between; /* Space out buttons */
    
}

#project-page-nav .retro-button {
    padding: 0px 10px; /* Increased padding for nav buttons */
}

#page-indicator {
    font-size: 1.3em; /* Increased base font size */
    color: var(--color-text);
}

/* Disabled button state */
.retro-button:disabled {
    color: #555; /* Greyed out text */
    cursor: default; /* Default cursor */
    opacity: 0.6;
}
.retro-button:disabled:hover {
    color: #555; /* Ensure hover doesn't change color */
    background-color: transparent; /* Ensure hover doesn't change background */
}

#page-nav-buttons {
    display: flex;
}

#page-nav-buttons .retro-button {
  position: relative;
  top: auto;
  bottom: 4px;
  padding: 0px 10px;
  font-size: 1.8em;
}

#project-page-nav .back-button.retro-button {
  /* Specific styles */
  position: relative;
  top: auto;
  bottom: 4px;
  right: 7px;
  padding: 0px 0px; /* Override base padding */
}
/* --- Settings Section Variables (Defaults) --- */
:root { /* Define defaults on root, can be overridden in media query */
    --settings-padding: 20px;
    --settings-group-margin-bottom: 25px; /* Reduced */
    --settings-group-padding-bottom: 10px; /* Reduced */
    --settings-h3-font-size: 1.1em;
    --settings-h3-margin-bottom: 10px; /* Reduced */
    --settings-item-margin-bottom: 10px; /* Reduced */
    --settings-label-basis: 140px; /* Slightly reduced */
    --settings-label-margin-right: 10px; /* Reduced */
    --settings-control-margin-right: 10px; /* Reduced */
    --settings-value-min-width: 45px; /* Slightly reduced */
    --settings-select-padding: 4px 6px; /* Reduced */
    --settings-slider-height: 6px; /* Reduced */
    --settings-slider-thumb-size: 14px; /* Reduced */
    --settings-system-button-gap: 15px; /* Reduced */
}

.settings-group {
    margin-bottom: var(--settings-group-margin-bottom);
    padding-bottom: var(--settings-group-padding-bottom);
}

.settings-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-group h3 {
    margin-bottom: var(--settings-h3-margin-bottom);
    color: #00ff00; /* Or your primary text color */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: var(--settings-h3-font-size);
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--settings-item-margin-bottom);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* System Buttons */
.system-buttons {
    justify-content: center; /* Center buttons */
    gap: var(--settings-system-button-gap); /* Space between buttons */
}

.system-buttons .retro-button {
    flex-grow: 0; /* Don't let buttons grow */
    font-size: 1.2em; /* Slightly smaller system buttons */
    padding: 0px 8px; /* Adjust padding */
}

/* --- Settings Section Tabs & Views --- */
.settings-nav {
  padding-top: 5px;
    display: flex;
    justify-content: center; /* Center the tabs */
    margin-bottom: var(--settings-group-margin-bottom); /* Use variable for spacing */
    border-bottom: 2px dashed rgba(255, 255, 255, 0.7); /* Separator line */
    padding-bottom: var(--settings-group-padding-bottom);
}

.settings-nav .retro-button {
    margin: 0 10px; /* Space between tabs */
    padding-bottom: 5px; /* Add padding to align text with border */
}

.settings-nav .retro-button.active-tab {
    color: var(--color-accent);
    position: relative;
    top: 1px;
}

#settings-view-container {
    padding: var(--settings-padding); /* Use variable */
    margin-bottom: var(--settings-group-margin-bottom); /* Space before system buttons */
    min-height: 150px; /* Ensure container has some height */
}

.settings-view {
    display: none; /* Hide views by default */
}

.settings-view.active-settings-view {
    display: block; /* Show the active view */
}

/* Adjust system buttons margin */
#settings .system-buttons {
    margin-top: var(--settings-group-margin-bottom); /* Add space above system buttons */
    padding-top: var(--settings-group-padding-bottom);
}

/* --- Settings Page Navigation Footer --- */
#settings-page-nav {
    position: absolute; /* Position at the bottom of the section */
    bottom: 5px;
    width: 90%; /* Match project nav width */
    padding: 0px 0px; /* Match project nav padding */
    border-top: var(--border-pixel);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out buttons */
    margin-top: auto; /* Push to bottom if content is short */
}

/* Specific styling for the back button within settings nav */
#settings-page-nav .retro-button {
    position: relative; /* Override absolute positioning */
    top: auto;
    bottom: 4px; /* Match project nav back button alignment */
    right: 7px; /* Match project nav back button alignment */
    padding: 25px 0px; /* Match project nav back button padding */
    font-size: 1.3em; /* Match project nav button size */
}
/* --- New Settings Control Styles --- */
.setting-control {
    display: flex;
    align-items: center;
    justify-content: center; /* Group items centrally */
    flex-grow: 1; /* Allow it to take space */
    margin-left: 0px; /* Space after label */
}

.setting-value-display {
    text-align: center;
    color: var(--color-accent); /* Use accent color for value */
    margin: 0 10px; /* Space around the value */
    flex-shrink: 0; /* Prevent shrinking */
}

.setting-button {
    padding: 15px 50px; /* Smaller padding */
    font-size: 1.5em; /* Adjust size */
    line-height: 1;
    text-transform: none; /* Keep < and > as is */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Ensure setting items still align correctly */
.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--settings-item-margin-bottom);
    flex-wrap: wrap; /* Allow wrapping if needed */
}

.setting-item label {
    margin-right: var(--settings-label-margin-right);
    color: #eee;
    flex-shrink: 0;
    width: 200px; /* Add fixed width */
    text-align: left; /* Align text to the right */
}

/* Optional: Adjust hover/active for new buttons if needed */
.setting-button:hover {
    color: var(--color-primary); /* Example hover */
}

.setting-button:active {
    transform: scale(0.95); /* Example active press */
}
/* --- Social Links in About Section --- */
.social-links {
  display: flex; /* Arrange buttons horizontally */
  justify-content: center; /* Center the buttons within the div */
  gap: 20px; /* Add space between buttons */
  margin-top: 25px; /* Add space above the buttons */
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

.social-links .retro-button {
  padding: 5px 10px; /* Slightly smaller padding than default */
  font-size: 1em; /* Slightly smaller font size */
}

.skills-categories h3 {
  font-size: 1.2em; /* Adjusted size for category headers */
  margin-bottom: 2px; /* Space below category headers */
  color: var(--color-accent); /* Use accent color for category headers */
}

#page-details p{
  margin-bottom: 10px; /* Space below project details */
}

/* --- Responsive Styles --- */

/* Tablet and Smaller (max-width: 1024px) */
@media (max-width: 1024px) {
  .crt-frame {
    display: none;
  }

  #screen-wrapper {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
    /* Ensure position is fixed or absolute if it needs to cover the whole viewport */
    position: fixed; /* Or absolute, depending on body/html setup */
  }

  /* General Text */
  p {
    font-size: clamp(0.7rem, 2.5vmin + 0.1rem, 1.05rem); /* Adjusted for more dynamic scaling */
    line-height: 1.5;
    margin-bottom: 0.8rem;
  }

  /* Header */
  header h1 {
    font-size: clamp(1.3rem, 4vmin + 0.4rem, 2.1rem); /* Adjusted */
    padding-bottom: 0.4rem;
  }

  /* Main Menu */
  #main-menu a.retro-button {
    font-size: clamp(0.85rem, 3vmin + 0.25rem, 1.4rem); /* Adjusted */
    padding: 0.7rem 0.9rem;
  }

  #main-menu li {
    margin-bottom: 0.7rem;
  }

  /* Sections */
  main > section {
    padding: 0.8rem 1.2rem; /* Adjusted */
  }

  main h2 { /* Section titles */
    font-size: clamp(1rem, 3.5vmin + 0.25rem, 1.9rem); /* Adjusted */
    padding-bottom: 0.2rem;
    margin-bottom: 0.8rem;
  }

  /* Intro Prompt */
  #intro-prompt {
    font-size: clamp(0.85rem, 2.8vmin + 0.15rem, 1.25rem); /* Adjusted */
    padding: 0.9rem 1.1rem;
  }

  /* Project Selection */
  #project-select-view {
    padding: 0.4rem 0;
  }

  .project-select-button.retro-button {
    font-size: clamp(0.75rem, 2.6vmin + 0.15rem, 1.15rem); /* Adjusted */
    padding: 0.7rem 0.9rem;
    min-width: auto;
    width: calc(50% - 0.8rem); /* Adjusted gap */
    margin: 0.4rem;
  }

  /* Project Detail Pagination */
  .project-page h2 { /* Main title on page 1 */
    font-size: clamp(0.9rem, 3.8vmin + 0.1rem, 1.6rem); /* More aggressive vmin scaling */
  }

  .project-page h3 { /* Subheadings on pages 2 & 3 */
    font-size: clamp(0.8rem, 3.5vmin + 0.1rem, 1.45rem); /* More aggressive vmin scaling */
  }

  .project-page p { /* Text within pages */
    font-size: clamp(0.65rem, 3vmin + 0.05rem, 1.05rem); /* More aggressive vmin scaling, smaller min */
    line-height: 1.4;
  }

  #project-detail-links a.retro-button.external-link {
    font-size: clamp(0.7rem, 2.8vmin + 0.05rem, 1rem);
    padding: 0.6rem 0.8rem;
  }
  
  /* Styles for specific prev/next buttons if they are directly inside #page-nav-buttons */
  #page-nav-buttons .retro-button {
    font-size: clamp(1.2rem, 3.7vmin + 0.15rem, 1.5rem); /* Increased size */
  }
  
  /* Back button specifically within project page navigation */
  #project-page-nav > .retro-button {
    font-size: clamp(0.8rem, 3vmin + 0.1rem, 1.3rem);
  }

  #page-indicator {
    font-size: clamp(0.85rem, 3vmin + 0.1rem, 1.2rem); /* Increased size */
  }

  /* Video Close Button */
  #project-close-video-button.retro-button {
    font-size: clamp(0.9rem, 3.8vmin + 0.15rem, 1.6rem);
  }

  .back-button.retro-button { /* General Back Buttons (not in #project-page-nav) - Larger */
    font-size: clamp(1.2rem, 3.8vmin + 0.2rem, 1.7rem); /* Significantly larger */
    padding: 0.8rem 1.2rem;
    bottom: 1rem;
    right: 1rem;
  }

  /* Settings Nav & View Container */
  .settings-nav .retro-button {
    font-size: clamp(1.35rem, 2vmin + 0.05rem, 1.4rem);
    padding: 0.15rem 0.35rem;
  }

  #settings-view-container {
    padding: 0.9rem;
    margin-bottom: 0.9rem;
  }

  #settings .system-buttons {
    margin-top: 0.9rem;
    padding-top: 0.4rem;
  }
  
  /* Settings specific items */
  .setting-item label {
    width: auto;
    flex-basis: 110px; /* Slightly adjusted */
    margin-right: 0.4rem;
    font-size: clamp(0.7rem, 2.2vmin + 0.05rem, 0.95rem); /* Adjusted */
  }
  .setting-control {
    margin-left: 0;
  }
  .setting-button { /* +/- buttons for settings */
    padding: 0.4rem 0.9rem; /* Adjusted */
    font-size: clamp(0.75rem, 2.2vmin + 0.15rem, 1.05rem); /* Adjusted */
  }
  .setting-value-display {
     font-size: clamp(0.75rem, 2.2vmin + 0.1rem, 1.05rem); /* Adjusted */
  }

  /* Footer */
  footer p {
    font-size: clamp(0.65rem, 2vmin + 0.05rem, 0.85rem); /* Adjusted */
  }
  footer {
    padding: 0.4rem 0.9rem;
  }

  /* Skills Section */
  .skills-categories h3 {
    font-size: clamp(0.85rem, 2.8vmin + 0.15rem, 1.35rem); /* Adjusted */
    margin-bottom: 0.2rem;
  }
  .skills-categories span {
    font-size: clamp(0.7rem, 2.2vmin + 0.05rem, 0.95rem); /* Adjusted */
    line-height: 1.35;
  }

  /* Social Links */
  .social-links {
    gap: 10px; /* Adjusted space between buttons */
    margin-top: 40px; /* Adjusted space above the buttons */
  }
  .social-links .retro-button {
    font-size: clamp(0.9rem, 2.4vmin + 0.05rem, 1.2rem); /* Adjusted */
  }
  .social-links p {
    margin: 0px; /* Space below project details */
    padding: 0px 0px; /* Space below project details */
  }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
  p {
    font-size: clamp(0.65rem, 3vmin + 0.05rem, 0.95rem); /* Further refined for smaller screens */
    margin-bottom: 0.6rem;
  }

  header h1 {
    font-size: clamp(1.1rem, 5vmin + 0.2rem, 1.8rem); /* Further refined */
  }

  #main-menu a.retro-button {
    font-size: clamp(0.75rem, 3.5vmin + 0.15rem, 1.2rem); /* Further refined */
    padding: 0.5rem 0.7rem;
  }
  #main-menu li {
    margin-bottom: 0.5rem;
  }

  main > section {
    padding: 0.6rem 0.8rem; /* Further refined */
  }

  main h2 { /* Section titles */
    font-size: clamp(0.9rem, 4vmin + 0.15rem, 1.7rem); /* Further refined */
  }

  #intro-prompt {
    font-size: clamp(0.75rem, 3.2vmin + 0.1rem, 1.15rem); /* Further refined */
    padding: 0.6rem 0.9rem;
  }

  .project-select-button.retro-button {
    width: calc(100% - 0.8rem);
    margin: 0.4rem;
    font-size: clamp(0.7rem, 3vmin + 0.1rem, 1.05rem); /* Further refined */
  }

  /* Project Detail View on Mobile */
  .project-page h2 {
    font-size: clamp(0.8rem, 3.8vmin + 0.1rem, 1.4rem); /* More aggressive vmin */
  }
  .project-page h3 {
    font-size: clamp(0.7rem, 3.5vmin + 0.1rem, 1.25rem); /* More aggressive vmin */
  }
  .project-page p {
    font-size: clamp(0.6rem, 3vmin + 0.05rem, 0.95rem); /* More aggressive vmin, smaller min */
    line-height: 1.35;
  }
  #project-detail-links a.retro-button.external-link {
    font-size: clamp(0.65rem, 3vmin + 0.05rem, 0.9rem);
  }

  #page-nav-buttons .retro-button {
    font-size: clamp(1.0rem, 3.7vmin + 0.1rem, 1.5rem); /* Increased size */
  }
  
  /* Back button specifically within project page navigation */
  #project-page-nav > .retro-button {
    font-size: clamp(0.7rem, 3.2vmin + 0.1rem, 1.2rem);
  }

  #page-indicator {
    font-size: clamp(0.85rem, 3.1vmin + 0.05rem, 1.2rem); /* Increased size */
  }
  #project-close-video-button.retro-button {
    font-size: clamp(0.8rem, 4.2vmin + 0.1rem, 1.45rem);
  }

  .back-button.retro-button { /* General Back Buttons (not in #project-page-nav) - Larger */
    font-size: clamp(1.1rem, 3.5vmin + 0.15rem, 1.5rem); /* Further increased */
    padding: 0.65rem 0.9rem;
    bottom: 0.7rem;
    right: 0.7rem;
  }

  /* Settings Page Specific Button Sizes - Kept small as requested */
  .settings-nav .retro-button {
    font-size: clamp(1.15rem, 2.8vmin + 0.05rem, 1.2rem);
    padding: 0.15rem 0.35rem;
  }
  #settings-view-container {
    padding: 0.6rem;
  }
  .setting-item label {
    flex-basis: 90px;
    font-size: clamp(0.85rem, 2.7vmin + 0.05rem, 1.1rem);
  }
  .setting-button {
    padding: 0.25rem 0.5rem;
    font-size: clamp(0.95rem, 3vmin + 0.05rem, 1.25rem);
  }
  .setting-value-display {
     font-size: clamp(0.85rem, 2.6vmin + 0.05rem, 1.1rem);
  }
  
  #settings-page-nav {
    gap: 0.2rem;
  }
  #settings-page-nav .retro-button {
    font-size: clamp(0.85rem, 2.75vmin + 0.05rem, 1.1rem);
    padding: 0.35rem 0.5rem;
    position: relative;
    bottom: auto;
    right: auto;
    flex-grow: 1;
    text-align: center;
  }

  .social-links .retro-button {
    font-size: clamp(0.85rem, 2.7vmin + 0.05rem, 1.1rem);
  }
}
/* Optional: Specific adjustments for short, wide screens */
@media (max-height: 700px) and (orientation: landscape) and (min-width: 768px) {
  main > section {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
  }

  #main-menu a.retro-button {
    font-size: clamp(0.7rem, 3vmin + 0.05rem, 1rem); /* Adjusted for height constraint */
    padding: 0.3rem 0.5rem;
  }
   #main-menu li {
    margin-bottom: 0.3rem;
  }

  p {
    font-size: clamp(0.55rem, 2.5vmin + 0.05rem, 0.8rem); /* Even more aggressive for short height */
    line-height: 1.3;
  }
  main h2 {
    font-size: clamp(0.75rem, 3.2vmin + 0.1rem, 1.35rem);
  }
  header h1 {
     font-size: clamp(0.9rem, 4vmin + 0.15rem, 1.7rem);
  }

  /* Project Detail View in landscape height constraint */
  .project-page h2 {
    font-size: clamp(0.8rem, 3.5vmin + 0.1rem, 1.4rem);
  }
  .project-page h3 {
    font-size: clamp(0.7rem, 3.2vmin + 0.05rem, 1.2rem);
  }
  .project-page p {
    font-size: clamp(0.55rem, 2.6vmin + 0.05rem, 0.85rem);
    line-height: 1.25;
  }
  
  #page-indicator { /* Added #page-indicator for landscape short height */
    font-size: clamp(0.7rem, 2.8vmin + 0.05rem, 1rem); /* Increased size */
  }
  
  #page-nav-buttons .retro-button {
    font-size: clamp(0.9rem, 3.1vmin + 0.05rem, 1.2rem); /* Increased size */
  }
  #project-page-nav > .back-button.retro-button {
     font-size: clamp(0.9rem, 3vmin + 0.1rem, 1.2rem);
     padding: 0.4rem 0.6rem;
  }


  .back-button.retro-button { /* General back buttons */
    font-size: clamp(1rem, 3vmin + 0.15rem, 1.3rem);
    padding: 0.5rem 0.75rem;
  }

  #settings-page-nav .retro-button {
    font-size: clamp(1.65rem, 2.8vmin + 0.05rem, 0.85rem);
    padding: 0.25rem 0.45rem;
  }
}