/* ============================================================
   Surendran CJ - Game Developer Portfolio
   Neutral system palette, one accent, soft depth, calm motion.
   ============================================================ */

:root {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --ink:       #1d1d1f;
  --ink-2:     #515154;
  --ink-3:     #86868b;
  --hairline:  rgba(0, 0, 0, 0.10);
  --accent:    #0071e3;

  --radius:    18px;
  --pill:      980px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.06), 0 24px 56px rgba(0, 0, 0, 0.10);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --nav-h: 108px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: clamp(15px, 0.55vw + 12px, 19px);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Slider shell ---------- */
#slider {
  position: absolute;
  inset: 0 0 var(--nav-h) 0;
  overflow: hidden;
}

#track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.7s var(--ease);
}

.slide {
  flex: 0 0 100vw;
  width: 100vw;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 4vh clamp(24px, 5vw, 88px);
  gap: clamp(28px, 4vw, 72px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Split hero: media left, text right ---------- */
.slide.has-video {
  overflow: hidden;
  padding: 0;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}

.hero-media {
  position: relative;
  flex: 0 0 50%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
}

.hero-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.hero-layer.is-active { opacity: 1; }

/* Stills are wide panoramas: full height, width overflows, then pans across. */
.hero-still {
  --pan-end: calc(50vw - 100%);
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  height: 100%;
  width: auto;
  min-width: 100%;
  max-width: none;
  object-fit: cover;
  will-change: transform;
}

.hero-still.is-active { animation: panRight 8s linear both; }
.hero-still:nth-of-type(even).is-active { animation-name: panLeft; }

@keyframes panRight {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--pan-end)); }
}

@keyframes panLeft {
  from { transform: translateX(var(--pan-end)); }
  to   { transform: translateX(0); }
}

.slide.has-video .center-col {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 620px;
  margin: auto;
  padding: 4vh clamp(28px, 4vw, 72px);
  text-align: left;
}

.center-col {
  width: 100%;
  max-width: 860px;
  text-align: center;
  margin: auto;
  animation: rise 0.8s var(--ease) both;
}

.hero-title {
  font-size: clamp(34px, 3.4vw, 60px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.032em;
  color: var(--ink);
  margin: 0;
}

.hero-sub {
  font-size: clamp(17px, 1.4vw, 22px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink-3);
  margin: 0.5rem 0 0;
}

.intro-text {
  font-size: 1.02em;
  line-height: 1.62;
  color: var(--ink-2);
  margin-top: 1.5em;
  text-align: left;
}

.intro-text a:link, .intro-text a:visited, .intro-text a {
  color: var(--ink);
  text-decoration: none;
}

.intro-text a.name-link,
.intro-text a.name-link:link,
.intro-text a.name-link:visited {
  color: var(--ink);
  font-weight: 600;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1.5px;
  padding-bottom: 1px;
  transition: background-size 0.25s var(--ease), color 0.25s ease;
}

.intro-text a.name-link:hover,
.intro-text a.name-link:focus-visible {
  color: var(--accent);
  background-size: 100% 1px;
}

.contact-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-top: 1.8em;
}

.icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.icon svg { width: 18px; height: 18px; fill: var(--ink); }

.icon:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.space { display: none; }

.scroll-hint {
  font-size: 0.82em;
  color: var(--ink-3);
  margin-top: 2.2em;
}

/* ---------- Legacy media frames ---------- */
.media {
  width: 62%;
  position: relative;
  display: block;
  height: 0;
  padding-top: calc(0.62 * 56.25%);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  animation: rise 0.8s var(--ease) both;
}

.media.square { width: 42%; padding-top: 42%; }

/* ---------- About page ---------- */
.about-avatar {
  flex: 0 0 30%;
  width: 30%;
  max-width: 340px;
  height: auto;
  max-height: 70%;
  object-fit: contain;
  align-self: center;
  animation: rise 0.8s var(--ease) both;
}

.slide-about .description { width: 56%; }

.sub-head {
  font-size: 0.74em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  margin: 2em 0 0.9em;
  padding-top: 1.4em;
  border-top: 1px solid var(--hairline);
}

.slide-about .description p { margin: 0.5em 0; line-height: 1.58; }
.slide-about .description strong { color: var(--ink); font-weight: 600; }

/* ---------- Company tab pages: hero left, copy right ---------- */
.slide-tab {
  align-items: center;
  justify-content: center;
}

.tab-media {
  flex: 0 0 55%;
  max-width: 760px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  animation: rise 0.8s var(--ease) both;
}

.tab-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* stand-in for tabs with no hero artwork: centre the logo, don't crop it */
.tab-media.is-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  box-sizing: border-box;
  background: var(--surface);
}

.tab-media.is-logo img {
  width: auto;
  height: auto;
  max-width: 70%;
  max-height: 70%;
  object-fit: contain;
}

/* three-shot crossfading slideshow, CSS-only */
.tab-slideshow { position: relative; }

.tab-slideshow img {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: tabSlideshow 12s linear infinite;
}

.tab-slideshow img:nth-child(2) { animation-delay: 4s; }
.tab-slideshow img:nth-child(3) { animation-delay: 8s; }

@keyframes tabSlideshow {
  0%     { opacity: 0; }
  5%     { opacity: 1; }
  33.33% { opacity: 1; }
  38.33% { opacity: 0; }
  100%   { opacity: 0; }
}

.slide-tab .description {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: 520px;
  height: auto;
  max-height: 100%;
  align-self: center;
}

/* ---------- Description panel ---------- */
.description {
  width: 34%;
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;
  animation: rise 0.8s var(--ease) 0.06s both;
  scrollbar-width: thin;
}

/* a page can carry more than one mark - keep them on one row */
.tab-logos {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  flex-wrap: nowrap;
}

/* share the row: cap each at half the width so they never wrap */
.tab-logos .tab-logo {
  margin-bottom: 0;
  height: auto;
  max-height: 132px;
  max-width: calc(50% - 0.4rem);
  min-width: 0;
}

.tab-logo {
  display: block;
  height: 132px;
  width: auto;
  max-width: 450px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-1);
}

.title-project {
  font-size: clamp(26px, 2.3vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.08;
  display: block;
  margin-bottom: 0.5rem;
}

.description p { margin: 0.8em 0; line-height: 1.6; color: var(--ink-2); }

.description p.role {
  color: var(--ink-3);
  font-size: 0.92em;
  margin-top: 0;
}

.description p.available {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  padding: 0.95em 1.15em;
  border-radius: 12px;
  font-size: 0.95em;
}

.description ul { padding-left: 0; margin: 1em 0; list-style: none; }

.description li {
  position: relative;
  padding-left: 1.15em;
  margin: 0.55em 0;
  line-height: 1.55;
  color: var(--ink-2);
}

.description li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* ---------- Skill labels: one neutral pill, no rainbow ---------- */
.label {
  display: inline-block;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, 0.055);
  color: var(--ink-2);
  font-size: 0.78em;
  font-weight: 500;
  padding: 0.4em 0.85em;
  margin: 0 0.35em 0.45em 0;
  white-space: nowrap;
  line-height: 1.35;
}

/* ---------- Navigation: floating translucent bar ---------- */
#nav {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 10px 40px rgba(0, 0, 0, 0.12);
  z-index: 20;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #nav { background: rgba(255, 255, 255, 0.96); }
}

#prev, #next {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
}

#prev::before, #next::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-left: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
}

#prev::before { transform: translate(-50%, -50%) rotate(45deg); margin-left: 2px; }
#next::before { transform: translate(-50%, -50%) rotate(-135deg); margin-right: 2px; }

#prev:hover, #next:hover { background: rgba(0, 0, 0, 0.06); }

#thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: calc(100vw - 150px);
  padding: 2px;
  scrollbar-width: none;
}

#thumbs::-webkit-scrollbar { display: none; }

#thumbs button {
  flex: 0 0 auto;
  border: none;
  padding: 9px 15px;
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              background 0.25s var(--ease), color 0.25s var(--ease);
}

#thumbs button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

#thumbs button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.30), 0 8px 20px rgba(0, 113, 227, 0.22);
}

#thumbs button.active:hover { transform: none; }

#counter {
  position: absolute;
  right: 24px;
  bottom: 52px;
  z-index: 21;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

/* ---------- Responsive ---------- */
@media only screen and (max-width: 1100px) {
  .slide-about .description { width: 52%; }
  .tab-media { flex: 0 0 50%; }
  .slide-tab .description { max-width: 440px; }
}

@media only screen and (max-width: 768px) {
  :root { --nav-h: 0px; }
  html, body { overflow: auto; }
  #slider { inset: 0; }
  #track { flex-direction: column; overflow-y: auto; transition: none; }

  .slide {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 100vh;
    flex-direction: column;
    justify-content: center;
    padding: 9vh 6vw 130px;
    gap: 24px;
  }

  .media, .media.square { width: 100%; padding-top: 56.25%; }
  .media.square { padding-top: 100%; max-width: 360px; }

  .about-avatar {
    flex: 0 0 auto;
    width: auto;
    max-width: 200px;
    max-height: none;
    align-self: flex-start;
  }

  .slide-about .description { width: 100%; }

  .slide.has-video { flex-direction: column; padding: 0 0 130px; gap: 0; }
  .hero-media { flex: 0 0 auto; width: 100%; height: 40vh; }
  .hero-still { --pan-end: calc(100vw - 100%); }
  .slide.has-video .center-col { max-width: none; padding: 7vh 6vw 0; margin: 0; }

  .slide-tab { flex-direction: column; justify-content: center; }
  .tab-media { flex: 0 0 auto; width: 100%; max-width: none; }
  .slide-tab .description { max-width: none; }

  .description {
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 0;
  }

  #nav { bottom: 14px; padding: 8px 10px; }
  #thumbs { max-width: calc(100vw - 140px); }
  #thumbs button { padding: 8px 12px; font-size: 10px; }
  .tab-logo { height: 108px; }
  .tab-logos .tab-logo { height: auto; max-height: 108px; }
  #counter { display: none; }
}

/* ---------- Large displays ---------- */
@media only screen and (min-width: 1500px) {
  .tab-media { max-width: 900px; }
  .slide-tab .description { max-width: 620px; }
  .about-avatar { max-width: 400px; }
  .slide-about .description { width: 58%; }
}

@media only screen and (min-width: 1900px) {
  .tab-media { max-width: 1080px; }
  .slide-tab .description { max-width: 700px; }
  .about-avatar { max-width: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  #track { transition: none; }
  .center-col, .media, .description, .tab-media, .about-avatar { animation: none; }
  .hero-layer { transition: none; }
  .hero-still.is-active { animation: none; }
  .tab-slideshow img { animation: none; }
  .tab-slideshow img:first-child { opacity: 1; }
}

/* ============================================================
   Games button + games page
   ============================================================ */

.btn-games {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px 0 13px;
  margin-left: 4px;
  border-radius: var(--pill);
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 55%, #bf5af2 100%);
  box-shadow: 0 1px 2px rgba(10, 132, 255, 0.28), 0 8px 22px rgba(94, 92, 230, 0.30);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.btn-games svg { width: 17px; height: 17px; fill: currentColor; }

/* the shine: a narrow highlight that sweeps across on a loop */
.btn-games::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -75%;
  width: 45%;
  height: 220%;
  z-index: -1;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%);
  transform: rotate(22deg);
  animation: sheen 3.6s ease-in-out infinite;
}

@keyframes sheen {
  0%, 62% { left: -75%; }
  100%    { left: 130%; }
}

.btn-games:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(10, 132, 255, 0.32), 0 12px 30px rgba(94, 92, 230, 0.40);
}

@media (prefers-reduced-motion: reduce) {
  .btn-games::after { animation: none; }
}

/* ---------- games page ----------
   the slider locks html+body to 100% / hidden; this page must scroll, so
   both elements need unlocking, not just body */
html.page-games,
html.page-games body.page-games {
  height: auto;
  min-height: 100%;
  overflow: visible;
}

.games-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(32px, 6vh, 72px) clamp(20px, 5vw, 48px) 96px;
}

.back-link {
  display: inline-block;
  color: var(--ink-3);
  font-size: 0.86em;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s ease;
}

.back-link:hover { color: var(--accent); }

.games-title {
  font-size: clamp(38px, 5vw, 68px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
}

.games-lede {
  color: var(--ink-2);
  font-size: 1.05em;
  max-width: 46ch;
  margin: 0.6rem 0 3rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: clamp(18px, 2.4vw, 32px);
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.game-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 22%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.game-card a:hover img {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-2);
}

.game-name {
  display: block;
  margin-top: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.game-portal {
  display: block;
  color: var(--ink-3);
  font-size: 0.82em;
}
