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

:root {
  --bg: #111111;
  --bg2: #1a1a1a;
  --accent: #e03131;
  --text: #ededed;
  --muted: #888888;
  --border: #2a2a2a;
  --radius: 10px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  overflow: hidden;
}

/* ── PAGE SYSTEM ── */
.page {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  transition: transform 0.6s cubic-bezier(0.77, 0, 0.18, 1);
  background: var(--bg);
  will-change: transform;
}
.page::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.page-active  { transform: translate(0, 0); }
.page-right   { transform: translateX(100%); }
.page-left    { transform: translateX(-100%); }
.page-below   { transform: translateY(100%); }
.page-above   { transform: translateY(-100%); }

/* NAV */
nav {
  position: sticky;
  top: 0;
  width: 100%;
  background: rgba(17,17,17,0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 64px;
}
.nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 0.45rem 1.2rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
}
.nav-links a:hover {
  color: var(--text);
  border-color: var(--border);
}
.nav-links a.nav-active {
  color: #ff6b6b;
  border-color: rgba(224,49,49,0.3);
  text-shadow: 0 0 10px rgba(224,49,49,0.5), 0 0 20px rgba(224,49,49,0.2);
}

/* SECTIONS */
section { padding: 100px 2rem; max-width: 900px; margin: 0 auto; }

/* HERO */
#hero {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.hero-btns { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* HERO CANVAS */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#page-hero { position: relative; }
#hero { position: relative; z-index: 1; }
#about, #contact {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
}
.hero-tag { color: var(--accent); font-size: 0.9rem; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 1rem; }
#hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 700; line-height: 1.1; margin-bottom: 1.2rem; }
#hero h1 span { color: var(--accent); }
#hero p { color: var(--muted); font-size: 1.15rem; max-width: 520px; margin-bottom: 2rem; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;
  border: none;
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-left: 0.8rem;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ABOUT / CONTACT HEADINGS */
#about h2, #contact h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: 0.4rem; }
.section-line { width: 40px; height: 3px; background: var(--accent); border-radius: 2px; margin-bottom: 2rem; }
#about p { color: var(--muted); font-size: 1.05rem; max-width: 620px; margin-bottom: 2rem; }
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}
.skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  width: 130px;
  text-decoration: none;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
}
.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(224, 49, 49, 0.15);
}
.skill-card img {
  width: 56px;
  height: 56px;
}
.skill-card span {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  transition: color 0.25s;
}
.skill-card:hover span {
  color: var(--text);
}

/* PROJECTS PAGE */
#projects { padding-top: 80px; }
.projects-header { margin-bottom: 2rem; }
.projects-header h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: 0.4rem; }

.back-btn {
  background: var(--bg2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: background 0.2s, color 0.2s;
  display: inline-block;
}
.back-btn:hover { background: var(--accent); color: #fff; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}

/* Card */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  min-height: 220px;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }

/* GIF layer */
.card-gif {
  position: absolute;
  inset: 0;
  z-index: 2;
  transition: opacity 0.35s ease;
}
.card-gif img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Dark gradient at bottom of GIF so title is readable */
.card-gif::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  pointer-events: none;
}

/* Title always visible on top of GIF */
.card-gif-title {
  position: absolute;
  bottom: 0.9rem;
  left: 1rem;
  z-index: 3;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Info layer */
.card-info {
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.35s ease;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card:hover .card-gif { opacity: 0; pointer-events: none; }
.card:hover .card-info { opacity: 1; }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.8rem; }
.card-icon { font-size: 1.4rem; }
.card-links { display: flex; gap: 0.6rem; }
.card-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  transition: color 0.2s, border-color 0.2s;
}
.card-links a:hover { color: var(--accent); border-color: var(--accent); }
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-info p { color: var(--muted); font-size: 0.88rem; margin-bottom: 1rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.card-tags span {
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(224,49,49,0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

/* GitHub card icon */
.card-github {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 10;
  color: #fff;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  transition: filter 0.2s, transform 0.2s, color 0.2s, opacity 0.2s;
}
.card:hover .card-github {
  opacity: 1;
}
.card-github svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.card-github:hover {
  color: #ff6b6b;
  filter: drop-shadow(0 0 5px rgba(224,49,49,0.9)) drop-shadow(0 0 12px rgba(224,49,49,0.5));
  transform: scale(1.2);
}

/* CONTACT */
#contact > p { color: var(--muted); font-size: 1.05rem; max-width: 500px; margin-bottom: 2rem; }
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2rem;
}
.contact-email:hover { text-decoration: underline; }
.socials { display: flex; gap: 1rem; }
.socials a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  transition: color 0.2s, border-color 0.2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }

/* FOOTER */
footer { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--border); }

/* FADE ANIMATIONS */
.fade { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade.visible { opacity: 1; transform: none; }
.fade-right { opacity: 0; transform: translateX(40px); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-right.visible { opacity: 1; transform: none; }

@media (max-width: 600px) {
  .nav-links { gap: 1.2rem; }
  #hero h1 { font-size: 2.2rem; }
}