/* Version: 1.0.8 */
/* 
 * Stylesheet for my personal website ~!!
 * This CSS defines the visual structure, theming (light/dark modes), and responsive design.
 * Key features:
 * - CSS custom properties for theming (light/dark mode)
 * - Responsive layouts using flexbox and grid
 * - Accessibility considerations (contrast, ARIA, focus states)
 */

/* Always show scrollbar to prevent layout shifts */
html {
  overflow-y: scroll;
}

/* Define theme variables for light and dark modes */
:root {
  --bg-color: #ffd1dc; /* Pinker light mode background */
  --text-color: #4a4a4a; 
  --accent-color: #ff6a00;
  --secondary-accent: #ee0979;
  --card-bg: white;
  --content-bg: #f5f5f5; 
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
  --popup-bg: #f5f5f5; /* Popup background (light mode) */
  --tinkering-bg: #ffe8d6; 
  --software-bg: #c9edf2; 
  --contact-bg: #f3e5f5; 
}

/* Dark mode variables */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --card-bg: #2a2a2a;
  --content-bg: #222222;
  --shadow: 0 4px 12px rgba(0,0,0,0.2);
  --popup-bg: #222222; 
  --tinkering-bg: #4a3728; 
  --software-bg: #263544; 
  --contact-bg: #3a2e3f; 
}

/* Base body styles */
body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 2rem;
  transition: background 0.3s, color 0.3s;
}

/* Ensure box-sizing for all elements to avoid width issues */
*, *:before, *:after {
  box-sizing: border-box;
}

/* Header: Flex layout for title and theme toggle */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto 2rem;
}

h1 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(45deg, var(--accent-color), var(--secondary-accent));
  -webkit-background-clip: text;
  color: transparent;
}

#theme-toggle {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
}

/* Main: Flexbox for profile pic and intro */
.container {
  display: flex;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 2rem;
}

.profile-pic {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.info {
  flex: 1;
}

.tagline {
  font-size: 1.2rem;
  color: #666;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.about-box {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-top: 1.5rem;
}

/* Hobbies: Interactive buttons for content toggling */
.hobbies {
  background: var(--content-bg);
  padding: 1.5rem;
  margin-top: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

h2 {
  margin-top: 0;
  color: var(--accent-color);
}

.hobby-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
}

.hobby-btn {
  background: #ffdde1;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s;
  border: none;
  font-family: 'Poppins', sans-serif;
}

.hobby-btn:hover {
  transform: scale(1.05);
}

.hobby-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Content wrappers: Hidden by default, shown via JS */
.content-wrapper {
  max-width: 1000px;
  margin: 2rem auto 0;
  background: var(--content-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content-wrapper.active {
  display: block;
  opacity: 1;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #000;
}

[data-theme="dark"] .content-header {
  border-bottom: 1px solid #333;
}

.content-title-container {
  display: flex;
  flex-direction: column;
}

.content-title {
  font-size: 2rem;
  margin: 0;
  color: var(--accent-color);
}

.content-subtitle {
  font-size: 1rem;
  color: #666;
  margin-top: 0.5rem;
}

[data-theme="dark"] .content-subtitle {
  color: var(--text-color);
}

/* Content: Flexbox for card layouts */
.content-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
}

.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #d3d9de;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 200px;
  min-height: 280px; /* Ensure uniform height */
}

.reptile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #d1e8d8; 
  padding: 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 200px;
  min-height: 280px;
}

.software {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--software-bg);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 200px;
  min-height: 280px;
}

[data-theme="dark"] .game {
  background: #333333;
}

[data-theme="dark"] .reptile {
  background: #2e4e3b;
}

.game img, .reptile img, .software img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.game img:hover, .reptile img:hover, .software img:hover {
  transform: scale(1.1);
}

.game p, .reptile p, .software p {
  margin-top: 1rem;
  color: #666;
  min-height: 80px;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
}

[data-theme="dark"] .game p,
[data-theme="dark"] .reptile p,
[data-theme="dark"] .software p {
  color: var(--text-color);
}

/* Tinkering: Grid layout for projects */
.tinkering-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}

.tinker-project {
  background: var(--tinkering-bg);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.tinker-project:hover {
  transform: translateY(-5px);
}

.tinker-project h3 {
  color: var(--accent-color);
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.project-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.gallery-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-img:hover {
  transform: scale(1.05);
}

.tinker-project p {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  line-height: 1.4;
  flex-grow: 1;
}

.tinker-project a {
  color: var(--accent-color);
  text-decoration: none;
}

.tinker-project a:hover {
  text-decoration: underline;
}

/* Contact: Split layout for form and about me */
.contact-section {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
  background: var(--contact-bg);
  padding: 2rem;
  border-radius: 8px;
}

.contact-form {
  flex: 1;
  min-width: 300px;
  max-width: 380px;
  width: 100%;
  padding: 0.75rem;
  box-sizing: border-box;
  border: 2px solid var(--accent-color);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
}

.form-group input,
.form-group textarea {
  max-width: 300px;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text-color);
}

.form-group textarea {
  resize: vertical;
}

/* reCAPTCHA: Scaled to fit within form */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  transform: scale(0.9);
  transform-origin: 0 0;
}

.g-recaptcha iframe {
  border-radius: 8px;
}

.submit-btn {
  background: var(--accent-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: #e55a00;
}

.form-feedback {
  margin-top: 1rem;
  text-align: center;
  font-size: 1rem;
}

.about-me {
  flex: 1;
  min-width: 250px;
}

.about-me h3 {
  color: var(--accent-color);
  margin-top: 0;
}

.about-me p {
  margin: 0.5rem 0;
  line-height: 1.6;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
}

.about-me .email-icon {
  display: block;
  width: 120px;
  height: auto;
  margin: 1rem auto 0;
}

/* Close buttons: Consistent styling for all close buttons */
.close-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #e55a00;
}

/* Lightbox: Fullscreen image viewer for tinkering galleries */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lightbox.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lightbox img {
  max-width: 90%;
  max-height: 80%;
}

.lightbox-caption {
  color: white;
  font-size: 1rem;
  text-align: center;
}

.close-lightbox-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--accent-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.close-lightbox-btn:hover {
  background: #e55a00;
}

/* Popup: Modal for game, reptile, and software details */
.content-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--popup-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 90%;
  padding: 1.5rem;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content-popup.active {
  display: block;
  opacity: 1;
}

.content-popup h3 {
  color: var(--accent-color);
  margin: 0 0 1rem;
  font-size: 1.5rem;
  text-align: center;
}

.content-popup img {
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.content-popup p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-color);
}

.close-popup-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.close-popup-btn:hover {
  background: #e55a00;
}

/* Footer styles */
footer {
  text-align: center;
  margin-top: 4rem;
  font-size: 0.8rem;
  color: #888;
}

.version {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.5rem;
}

.version-tooltip {
  position: relative;
  cursor: pointer;
}

.version-tooltip:hover::after,
.version-tooltip:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
}

[data-theme="dark"] .version-tooltip:hover::after,
[data-theme="dark"] .version-tooltip:focus::after {
  background: #555;
}

/* Back to Top Button: Hidden by default, shown on mobile */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-color);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: background 0.2s;
}

.back-to-top:hover {
  background: #e55a00;
}

/* Add this class to any element to see a spinning snake!  OwO*/
.slinky-spin {
  display: inline-block;
  animation: spin 2s linear infinite;
  font-size: 1.5rem;
}

/* Keyframes for the spinning animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Want to try it? Add this to the DOM via console: 
   document.querySelector('h1').classList.add('slinky-spin');
   Then add this HTML: <span>🐍</span>
   Watch Slinky spin! .. WASNT THAT COOL? */

/* Responsive Design: Media queries for smaller screens */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-pic {
    width: 200px;
    height: 200px;
  }
  h1 {
    font-size: 2rem;
  }
  .content-title {
    font-size: 1.5rem;
  }
  .contact-section {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .game, .reptile, .software {
    width: 100%;
    max-width: 250px;
    min-height: 260px;
  }
  .game p, .reptile p, .software p {
    min-height: 70px;
  }
  .tinkering-container {
    grid-template-columns: 1fr;
  }
  .hobby-btn {
    width: 100%;
    text-align: left;
  }
  .project-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-img {
    height: 100px;
  }
  .tinker-project {
    min-height: 150px;
  }
  .content-popup {
    width: 95%;
    padding: 1rem;
  }
  .content-popup h3 {
    font-size: 1.3rem;
  }
  .content-popup img {
    max-width: 100%;
  }
  .contact-form,
  .about-me {
    min-width: 100%;
  }
  .g-recaptcha {
    transform: scale(0.85);
    transform-origin: 0 0;
  }
  /* Adjust contact form inputs to fit within orange border */
  .form-group input,
  .form-group textarea {
    max-width: 200px;
  }
  /* Show Back to Top button on mobile */
  .back-to-top {
    display: block;
  }
  /* Adjust lightbox for mobile to match content-popup */
  .lightbox {
    width: 95%;
    max-width: 500px;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--popup-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1rem;
  }
  .lightbox img {
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
  }
  .lightbox-caption {
    color: var(--text-color);
  }
  .close-lightbox-btn {
    top: 10px;
    right: 10px;
  }
}