/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --bg: #f9fafb;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ── Canvas Background ── */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Nav ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 60px;
  background: rgba(249, 250, 251, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.3px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 36px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.nav-resume-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  color: var(--accent) !important;
  font-weight: 600;
  transition: background 0.2s, color 0.2s !important;
}

.nav-resume-btn:hover {
  background: var(--accent);
  color: #fff !important;
}

/* ── Sections ── */
section {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 40px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ── Hero ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 60px;
}

.hero-content { max-width: 640px; }

.hero-greeting {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.hero-content h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 36px;
}

.hero-btns { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }

.btn-secondary {
  display: inline-block;
  padding: 12px 28px;
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid var(--accent);
  transition: background 0.2s, transform 0.15s;
}

.btn-secondary:hover { background: var(--accent-light); transform: translateY(-1px); }

/* ── About ── */
#about {
  padding: 100px 0;
  background: #fff;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 16px;
  font-size: 0.97rem;
}

.about-text p strong { color: var(--text); }

.about-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.about-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, transform 0.2s;
}

.about-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Projects ── */
#projects { padding: 100px 0; }

.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

.project-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.project-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 2px solid var(--accent);
  padding: 5px 14px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s;
}

.project-link:hover { background: var(--accent); color: #fff; }

.project-type {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.project-type.in-progress {
  color: #d97706;
  background: #fffbeb;
  border-color: #fde68a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d97706;
  flex-shrink: 0;
  animation: pulse-ring 1.6s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(1.35); }
}

.project-type.freelance {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

/* ── Project Gallery ── */
.project-gallery { display: flex; flex-direction: column; gap: 8px; }

.gallery-main {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.gallery-main:hover img { transform: scale(1.02); }

.gallery-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  letter-spacing: 0.3px;
}

.gallery-main:hover .gallery-hint { opacity: 1; }
.gallery-main { cursor: pointer; }

.gallery-thumbs {
  display: flex;
  gap: 6px;
}

.gallery-thumbs .thumb {
  width: 25%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.6;
}

.gallery-thumbs .thumb:hover { opacity: 1; }
.gallery-thumbs .thumb.active { border-color: var(--accent); opacity: 1; }

/* ── Skills ── */
#skills {
  padding: 100px 0;
  background: #fff;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.skill-group h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tags span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 8px;
  transition: border-color 0.2s, color 0.2s;
}

.skill-tags span:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Contact ── */
#contact {
  padding: 100px 0;
  text-align: center;
}

.contact-info {
  display: inline-flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 36px;
  text-align: left;
}

.contact-info-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.contact-info-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-info-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.contact-info-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.contact-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 36px;
}

.contact-number {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 28px;
}

.contact-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-whatsapp {
  display: inline-block;
  padding: 12px 28px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.15s;
}

.btn-whatsapp:hover { background: #1ebe5d; transform: translateY(-1px); }

/* ── Footer ── */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ── Conway preview canvas ── */
.conway-preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.3s;
}

.conway-preview-wrap:hover canvas { transform: scale(1.02); }

/* ── Play Game button (button element reset) ── */
button.project-link {
  font-family: inherit;
  cursor: pointer;
  background: none;
}

/* ── Game Modal ── */
#game-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#game-modal.open { display: flex; }

.game-inner {
  background: #0f172a;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 900px;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.game-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
}

.game-hint {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
}

.game-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}

.game-close-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

#game-canvas {
  border-radius: 8px;
  display: block;
  max-width: 100%;
  cursor: crosshair;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.game-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.game-ctrl-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.game-ctrl-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.28); }

.game-ctrl-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.game-ctrl-btn.primary:hover { background: #1d4ed8; }

.game-ctrl-label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  white-space: nowrap;
}

#game-speed-slider { width: 90px; accent-color: var(--accent); }

.game-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.game-preset-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  font-size: 0.77rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.game-preset-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
  color: #bfdbfe;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
}

#lightbox.open { display: flex; }

#lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#lightbox-close {
  position: absolute;
  top: 20px; right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#lightbox-close:hover { opacity: 1; }

#lightbox-prev, #lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.8rem;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

#lightbox-prev { left: 20px; }
#lightbox-next { right: 20px; }
#lightbox-prev:hover, #lightbox-next:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ── */
@media (max-width: 768px) {
  nav { padding: 16px 24px; }
  .nav-links { gap: 20px; }
  #hero { padding: 0 24px; }
  .container { padding: 0 24px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
}
