/* ===== Custom properties ===== */
:root {
  /* colours */
  --bg: #0D0D0D;
  --bg-section: #111111;
  --bg-about: #0F0A1A;
  --purple: #7C3AED;
  --purple-light: #A855F7;
  --grey: #6B7280;
  --white: #FFFFFF;
  --black: #0D0D0D;
  /* theme-aware tokens */
  --text: #FFFFFF;
  --nav-scrolled-bg: rgba(13, 13, 13, 0.95);
  --card-bg: #111111;
  --card-inner: #0D0D0D;
  --divider: rgba(255, 255, 255, 0.04);
  --social-border: rgba(255, 255, 255, 0.12);
  /* layout */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 72px;
  --pad: 128px;
  --max-w: 1200px;
  --gutter: 48px;
}

/* ===== Light mode overrides ===== */
body.light {
  --bg: #FAFAFA;
  --bg-section: #F3F4F6;
  --bg-about: #F0EBFF;
  --text: #0D0D0D;
  --nav-scrolled-bg: rgba(250, 250, 250, 0.96);
  --card-bg: #FFFFFF;
  --card-inner: #EBEBEB;
  --divider: rgba(0, 0, 0, 0.07);
  --social-border: rgba(0, 0, 0, 0.12);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
  transition: background-color 0.4s ease, color 0.4s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
ul { list-style: none; }

/* ===== Custom cursor ===== */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  background: var(--purple);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.18s var(--ease), height 0.18s var(--ease),
              background 0.18s ease, border 0.18s ease;
}
.cursor.hovered {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1.5px solid var(--purple);
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Nav ===== */
#nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 500;
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, border-color 0.35s ease;
}
#nav.scrolled {
  background: var(--nav-scrolled-bg);
  border-color: rgba(124, 58, 237, 0.2);
  backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: calc(var(--max-w) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Logo */
.nav-logo { text-decoration: none; display: flex; align-items: center; flex-shrink: 0; }
.logo-mark { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.logo-jj {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.625rem;
  color: var(--text);
  letter-spacing: -0.03em;
  display: block;
  transition: color 0.4s ease;
}
.logo-studios {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.425rem;
  letter-spacing: 0.42em;
  color: var(--text);
  text-transform: uppercase;
  display: block;
  padding-left: 0.42em;
  transition: color 0.4s ease;
}
.logo-mark--sm .logo-jj      { font-size: 1.1rem; }
.logo-mark--sm .logo-studios  { font-size: 0.3rem; letter-spacing: 0.32em; padding-left: 0.32em; }

/* Nav links */
.nav-links { display: flex; align-items: center; gap: 40px; }
.nav-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.2s;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 0; height: 1px;
  background: var(--purple);
  transition: width 0.25s var(--ease);
}
.nav-links a:hover            { color: var(--text); }
.nav-links a:hover::after     { width: 100%; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  cursor: none;
  transition: color 0.2s, transform 0.3s var(--ease);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); transform: rotate(12deg); }

.icon-sun, .icon-moon {
  width: 18px; height: 18px;
  display: block;
}
/* dark mode: show sun (click → go light) */
.icon-sun  { display: block; }
.icon-moon { display: none; }
/* light mode: show moon (click → go dark) */
body.light .icon-sun  { display: none; }
body.light .icon-moon { display: block; }

/* ===== Hero ===== */
#hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
  transition: filter 0.4s ease;
}
.hero-bg svg { width: 100%; height: 100%; }

/* Invert grid lines for light mode */
body.light .hero-bg svg { filter: invert(1); }

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 var(--gutter);
  max-width: calc(var(--max-w) + var(--gutter) * 2);
}

/* Word stagger animation */
.hero-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(4.5rem, 13vw, 11rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 28px;
  display: block;
  transition: color 0.4s ease;
}
.hero-title .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 0.9s var(--ease) forwards;
}
.hero-title .w:first-child { animation-delay: 0.05s; }
.hero-title .w:last-child  { animation-delay: 0.22s; }

.hero-sub {
  font-size: clamp(0.75rem, 1.5vw, 0.9375rem);
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey);
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.9s var(--ease) 0.42s forwards;
  display: block;
  margin-bottom: 24px;
}

.hero-sep {
  width: 48px;
  height: 1px;
  background: var(--purple);
  opacity: 0;
  animation: fadeIn 0.6s ease 0.72s forwards;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  to { opacity: 1; }
}

.scroll-cue {
  position: absolute;
  bottom: 48px;
  left: var(--gutter);
  z-index: 2;
}
.scroll-cue-line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--purple));
  animation: scrollPulse 2.2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.25; transform: scaleY(0.65); transform-origin: top; }
  50%       { opacity: 1;    transform: scaleY(1);    transform-origin: top; }
}

/* ===== Sections shared ===== */
section { padding: var(--pad) 0; }

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 40px;
  display: block;
}

/* ===== Games ===== */
#games {
  background: var(--bg-section);
  border-top: 1px solid var(--divider);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.game-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  min-height: 380px;
  overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.4s ease,
              background-color 0.4s ease;
}

/* Vertical accent bar */
.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 32%;
  background: var(--purple);
  z-index: 2;
  transition: height 0.55s var(--ease);
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 58, 237, 0.45);
}
.game-card:hover::before { height: 100%; }

.card-info {
  padding: 52px 40px 52px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey);
  border: 1px solid rgba(107, 114, 128, 0.25);
  padding: 5px 12px;
  margin-bottom: 20px;
  align-self: flex-start;
}

.card-info h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 16px;
  transition: color 0.4s ease;
}
.card-info p {
  font-size: 1rem;
  color: var(--grey);
  line-height: 1.65;
  max-width: 30ch;
}

.card-features {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}
.card-features li {
  font-size: 0.8125rem;
  color: var(--grey);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.card-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 1px;
  background: var(--purple);
}

.card-visual {
  position: relative;
  background: var(--card-inner);
  border-left: 1px solid var(--divider);
  overflow: hidden;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
/* Carousel */
.carousel {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.55s var(--ease);
}

.carousel-track img {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  cursor: none;
  z-index: 3;
  opacity: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.25s ease;
}
.carousel:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover {
  background: var(--purple);
  border-color: var(--purple);
  color: var(--white);
}
.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}

.carousel-dot {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: none;
  transition: background 0.25s, width 0.3s var(--ease);
}
.carousel-dot.active {
  width: 18px;
  background: var(--purple);
}

/* Inner shadow — left edge fade into card background */
.card-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(17,17,17,0.82) 0%, rgba(17,17,17,0) 40%);
  pointer-events: none;
  z-index: 1;
}
body.light .card-visual::after {
  background: linear-gradient(to right, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0) 40%);
}

/* ===== About ===== */
#about {
  background: var(--bg-about);
  color: var(--text);
  position: relative;
  overflow: hidden;
  padding: 180px 0;
  text-align: center;
  transition: background-color 0.4s ease;
}

.about-deco {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  max-width: 720px;
  aspect-ratio: 3 / 2;
  pointer-events: none;
}

.about-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.about-inner .section-label { text-align: center; }

.about-statement {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--text);
  text-align: center;
  transition: color 0.4s ease;
}

/* ===== Contact ===== */
#contact {
  background: var(--bg);
  border-top: 1px solid var(--divider);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.contact-wrap { text-align: center; }
.contact-wrap .section-label { display: block; }

#contact h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 52px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.contact-email {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.4s ease;
}
.contact-email::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 1px;
  background: var(--purple);
  transition: width 0.3s var(--ease);
}
.contact-email:hover::after { width: 100%; }

.social-links { display: flex; gap: 16px; }
.social-link {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--social-border);
  color: var(--grey);
  text-decoration: none;
  transition: border-color 0.25s, color 0.25s;
}
.social-link:hover { border-color: var(--purple); color: var(--purple); }

/* ===== Footer ===== */
footer {
  padding: 28px 0;
  border-top: 1px solid var(--divider);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-copy {
  font-size: 0.8125rem;
  color: var(--grey);
  letter-spacing: 0.04em;
}

/* ===== Focus ===== */
:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  :root { --gutter: 32px; }
  .game-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .card-visual {
    min-height: 260px;
    border-left: none;
    border-top: 1px solid var(--divider);
  }
  /* Shadow on top edge when stacked */
  .card-visual::after {
    background: linear-gradient(to bottom, rgba(17,17,17,0.82) 0%, rgba(17,17,17,0) 40%);
  }
  body.light .card-visual::after {
    background: linear-gradient(to bottom, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0) 40%);
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 20px;
    --pad: 80px;
    --nav-h: 60px;
  }
  #about { padding: 120px 0; }
  .about-deco { width: 90%; }
  .hero-content { text-align: center; }
  .hero-sep { margin: 0 auto; }
  .scroll-cue { left: 50%; transform: translateX(-50%); }
  .nav-links { gap: 20px; }
  .nav-links a { font-size: 0.75rem; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  body { cursor: auto; }
  .cursor { display: none; }
}
