/* Basic Reset & Root Variables */
:root {
  --bg-color: #181a1b;
  --text-color: #e0e0e0;
  --accent-color: #9d7cbf; 
  --card-bg-color: #242628;
  --border-color: #3a3d40;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  --link-hover-color: #b79ad9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  margin-bottom: 0.75em;
  margin-top: 0.5em;
  color: var(--text-color);
  line-height: 1.3;
}
h1 { margin-bottom: 0.5em }
h1 { margin-bottom: 0.25em }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }

/* Links */
a {
  color: var(--accent-color);
  text-decoration: none;
}
a:hover, a:focus {
  text-decoration: underline;
  color: var(--link-hover-color);
}
a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Logo */
.header-logo {
  max-width: 80px;
  margin: 0 auto 0.5rem auto;
}

/* Header / Hero Section */
.hero-section {
  text-align: center;
  padding: 1.5rem 1rem 1rem 1rem; 
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}
.hero-section h1 {
  margin-top: 0;
  color: var(--accent-color);
}
.tagline {
  font-size: 1.05rem;
  color: var(--text-color);
  margin-bottom: 1rem;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

/* Navigation Bar */
.main-nav {
  margin-bottom: 0rem; 
  padding-bottom: 0.5rem;
}
.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  padding: 0;
}
.main-nav ul li {
  margin: 0.25rem 0.75rem;
}
.main-nav ul li a {
  color: var(--text-color);
  padding-bottom: 0.25rem;
  transition: color 0.2s ease, border-bottom 0.2s ease;
  border-bottom: 2px solid transparent;
}
.main-nav ul li a:hover,
.main-nav ul li a:focus,
.main-nav ul li a.active,
.main-nav ul li a[aria-current="page"] {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom-color: var(--accent-color);
}

/* Main Content Containers */
main {
  max-width: 1000px;
  margin: 0 auto 2rem auto;
  padding: 0 0.5rem;
  flex-grow: 1;
}
.about-container, .games-container, .projects-container {
  /* No specific padding needed here if main handles it */
}

/* Extra spacing for homepage cards */
#main-content {
  margin-top: 2rem;
}

/* Card Grids (Homepage, Games, Projects) */
.card-grid, .games-grid, .projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  border-radius: 4px;
}
.card h2, .card h3 {
  margin-top: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}
.card p {
  font-size: 0.9rem;
  flex-grow: 1;
  color: #bdbdbd;
}
a.home-link, a.game-link, a.project-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}
a.home-link:hover .card, a.home-link:focus .card,
a.game-link:hover .card, a.game-link:focus .card,
a.project-link:hover .card, a.project-link:focus .card {
  border-color: var(--accent-color);
  background-color: #2c2e30;
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Card Images (Games, Projects) */
.card-image {
  width: 100%;
  height: 180px;
  background-color: #333;
  margin-bottom: 1rem;
  overflow: hidden;
  position: relative;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.static-image {
  transition: opacity 0.3s ease-in-out;
}
.hover-gif {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.card:hover .static-image, .card:focus-within .static-image {
  opacity: 0;
}
.card:hover .hover-gif, .card:focus-within .hover-gif {
  opacity: 1;
}

/* About Page */
.about-container {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 1rem;
}
.about-container p, .about-container ul {
  margin-bottom: 1em;
}
.profile-photo {
  margin: 1.5rem auto;
}
.profile-photo img {
  max-width: 150px;
  border-radius: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.about-container .personal-interests-list {
  list-style: disc;
  padding-left: 25px;
}
.about-container .personal-interests-list li {
    margin-bottom: 0.5em;
}

/* Footer */
footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.footer-left, .footer-right {
  flex-basis: 100%;
  margin-bottom: 1rem;
}
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.social-links {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1rem;
  justify-content: center;
}
.social-icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  background-color: var(--text-color);
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  transition: background-color 0.2s ease;
}
.social-icon:hover, .social-icon:focus {
  background-color: var(--accent-color);
}
.github-icon { mask-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/github/github-original.svg'); }
.email-icon { mask-image: url('data:image/svg+xml;utf8,<svg fill="%23000" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><path d="M467 61H45C20.188 61 0 81.188 0 106v300c0 24.812 20.188 45 45 45h422c24.812 0 45-20.188 45-45V106c0-24.812-20.188-45-45-45zM45 91h422c8.269 0 15 6.731 15 15v18.797L256 266 30 124.797V106c0-8.269 6.731-15 15-15zm422 330H45c-8.269 0-15-6.731-15-15V164.203L245.386 287.97c.148.092.307.167.456.257.239.139.48.272.728.392.219.104.441.188.665.277.214.084.428.172.647.246.252.084.507.148.763.211.183.045.362.102.548.137.34.066.686.102 1.032.132.184.017.366.047.55.058a6.693 6.693 0 001.578 0c.184-.011.366-.041.55-.058.346-.03.692-.066 1.032-.132.186-.035.365-.092.548-.137.256-.063.511-.127.763-.211.219-.074.433-.162.647-.246.224-.089.446-.173.665-.277.248-.12.489-.253.728-.392.149-.09.308-.165.456-.257L482 164.203V406c0 8.269-6.731 15-15 15z"/></svg>'); }

.back-to-top {
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 0.4em 0.8em;
  transition: background-color 0.2s ease, color 0.2s ease;
  border-radius: 4px;
}
.back-to-top:hover, .back-to-top:focus {
  background-color: var(--accent-color);
  color: var(--bg-color);
  text-decoration: none;
}

/* Responsive Adjustments */
@media (min-width: 600px) {
  .footer-left, .footer-right {
    flex-basis: auto;
    margin-bottom: 0;
  }
  .social-links {
    justify-content: flex-start;
  }
  .footer-right {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 0.8rem;
  }
}

@media (max-width: 768px) {
  body { padding: 0.5rem; }
  main { padding: 0 0.25rem; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.3rem; }

  .main-nav ul { gap: 0.25rem 0.5rem; }
  .main-nav ul li { margin: 0.1rem 0.25rem; }

  .card-grid, .games-grid, .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero-section { padding: 1rem 0.5rem 1.5rem 0.5rem; }
  
  /* Improve touch targets on mobile */
  .main-nav ul li a {
    padding: 0.5rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  .back-to-top {
    padding: 0.6em 1em;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Project Tags/Badges */
.project-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  border: 1px solid;
}

.project-tag.for-me {
  background-color: rgba(157, 124, 191, 0.15);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.project-tag.for-you {
  background-color: rgba(100, 200, 150, 0.15);
  border-color: #64c896;
  color: #64c896;
}

/* Coming Soon Card Styling */
.coming-soon-card {
  text-align: center;
  opacity: 0.8;
}

.coming-soon-card h3 {
  color: var(--accent-color);
}
