/* ── Reset & Base ──────────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-accent: #4a6cf7;
  --color-accent-hover: #3b5de7;
  --color-border: #e0e0e0;

  --card-bg: #1e1e1e;
  --card-border: #2a2a2a;
  --card-title: #f0f0f0;
  --card-description: #a0a0a0;
  --card-link: #6b8cff;
  --card-link-hover: #93aeff;
  --card-separator: #777;
  --card-tag-color: #6b8cff;
  --card-tag-bg: rgba(107, 140, 255, 0.12);
  --card-shadow: rgba(0, 0, 0, 0.3);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --max-width: 1100px;

  /* 0 = top (expanded), 1 = scrolled (compact); set by JS */
  --nav-progress: 0;
  /* 92px expanded, 60px compact; multiplication form parses reliably */
  --nav-height: calc(92px - var(--nav-progress) * 32px);
}

/* Dark mode: dark page + elevated dark cards (common app / Material-style pattern) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121212;
    --color-surface: #1e1e1e;
    --color-text: #e8e8e8;
    --color-text-muted: #a3a3a3;
    --color-accent: #8ab4ff;
    --color-accent-hover: #aecbfa;
    --color-border: #333333;

    /* Slightly lighter than surface so cards read as elevated */
    --card-bg: #252525;
    --card-border: #3a3a3a;
    --card-title: #ececec;
    --card-description: #a8a8a8;
    --card-link: #8ab4ff;
    --card-link-hover: #aecbfa;
    --card-separator: #737373;
    --card-tag-color: #8ab4ff;
    --card-tag-bg: rgba(138, 180, 255, 0.12);
    --card-shadow: rgba(0, 0, 0, 0.45);
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Navigation ───────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo:link,
.nav-logo:visited,
.nav-logo:hover,
.nav-logo:active {
  color: var(--color-text);
  text-decoration: none;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-text);
  text-decoration: none;
}

.nav-logo img {
  height: calc(48px - var(--nav-progress) * 12px);
  width: auto;
  flex-shrink: 0;
}

.nav-brand {
  font-size: calc(2.375rem - var(--nav-progress) * 1.125rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}

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

.nav-links a {
  color: var(--color-text-muted);
  font-size: calc(0.95rem - var(--nav-progress) * 0.075rem);
  font-weight: 500;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-icon {
  width: calc(19px - var(--nav-progress) * 2px);
  height: calc(19px - var(--nav-progress) * 2px);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon.icon-fill {
  fill: currentColor;
  stroke: none;
}

.nav-links a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--color-accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

/* Hamburger animation */
.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Main Content ─────────────────────────────────────────── */

.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

/* ── Game Card Grid ───────────────────────────────────────── */

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.75rem 0;
  transition: box-shadow 0.2s, transform 0.2s;
}

.game-card:hover {
  box-shadow: 0 8px 24px var(--card-shadow);
  transform: translateY(-2px);
}

.game-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
}

.game-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.game-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--card-title);
}

.game-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-card-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--card-link);
}

.game-card-links a:hover {
  color: var(--card-link-hover);
}

.game-card-links .separator {
  color: var(--card-separator);
  font-size: 0.85rem;
}

.game-card-description {
  font-size: 0.9rem;
  color: var(--card-description);
  line-height: 1.5;
  flex: 1;
}

.game-card-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.platform-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--card-tag-color);
  background: var(--card-tag-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: lowercase;
}

/* ── Profile Page ─────────────────────────────────────────── */

.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 560px;
  margin: 2rem auto 0;
}

.profile-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.profile-name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.profile-bio {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

/* ── Responsive: Tablet ───────────────────────────────────── */

@media (max-width: 899px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Responsive: Mobile ───────────────────────────────────── */

@media (max-width: 599px) {
  :root {
    --nav-height: calc(76px - var(--nav-progress) * 16px);
  }

  .nav-brand {
    font-size: calc(1.625rem - var(--nav-progress) * 0.5rem);
  }

  .nav-logo {
    gap: 0.75rem;
    min-width: 0;
  }

  .nav-logo img {
    height: calc(42px - var(--nav-progress) * 6px);
  }

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

  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  }

  .nav-links.open {
    display: flex;
  }

  .page-title {
    font-size: 1.4rem;
  }
}
