/* =========================================================
   Sahil K George — Portfolio Styles
   Modern, minimal, tech-focused. Dark/light theme via CSS vars.
   ========================================================= */

/* ---------- THEME VARIABLES ---------- */
:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --surface: #1c2128;
  --text: #e6edf3;
  --text-muted: #9aa7b4;
  --accent: #4cc9f0;
  --accent-2: #7b61ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* Light theme overrides */
body.light {
  --bg: #f6f8fa;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --text: #1c2128;
  --text-muted: #57606a;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* ---------- RESET & BASE ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth; /* smooth scrolling */
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Animated background canvas sits behind everything */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(1100px, 90%);
  margin: 0 auto;
}

/* ---------- NAVBAR (sticky) ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  width: min(1100px, 92%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
}
.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  list-style: none;
}

.nav-link {
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  transition: color 0.25s ease;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: var(--gradient);
  transition: width 0.25s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid; place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { transform: rotate(15deg); border-color: var(--accent); }

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  width: 26px; height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.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); }

/* ---------- HERO ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1rem 4rem;
}
.hero-content { max-width: 760px; }

.hero-greeting {
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}
.hero-name {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-role {
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  color: var(--text-muted);
  margin: 0.5rem 0 1.2rem;
  min-height: 2.2rem;
}
.cursor {
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { opacity: 0; } }

.hero-intro {
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 2rem;
  font-size: 1.05rem;
}
.hero-intro strong { color: var(--text); }

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 20px rgba(76, 201, 240, 0.3);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(76, 201, 240, 0.45); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; transform: translateY(-3px); }

/* ---------- SECTIONS ---------- */
.section { padding: 6rem 0; }
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px; height: 4px;
  margin: 0.8rem auto 0;
  background: var(--gradient);
  border-radius: 4px;
}

/* ---------- ABOUT ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 3rem;
  align-items: center;
}
.about-img img {
  width: 100%;
  border-radius: 16px;
  box-shadow: var(--shadow);
  object-fit: cover;
  aspect-ratio: 4 / 5;
}
.img-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  text-align: center;
}
.img-note code {
  background: var(--surface);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-size: 0.78rem;
}
.about-text p { color: var(--text-muted); margin-bottom: 1rem; }
.about-text strong { color: var(--text); }

.highlights { list-style: none; margin-top: 1.5rem; display: grid; gap: 0.8rem; }
.highlights li {
  background: var(--surface);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.7rem;
}
.hl-icon { font-size: 1.2rem; }

/* ---------- SKILLS ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
  text-align: center;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.skill-card:hover { transform: translateY(-6px); border-color: var(--accent); }
.skill-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  animation: float 3s ease-in-out infinite;
}
/* Devicon tech logos share the same size/alignment as the emojis */
.skill-icon i[class*="devicon-"] {
  font-size: 2.2rem;
  line-height: 1;
  display: inline-block;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.skill-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }

.progress {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0; /* animated by JS */
  background: var(--gradient);
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- PROJECTS ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.8rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover { transform: translateY(-8px); box-shadow: var(--shadow); }
.project-img img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.project-card:hover .project-img img { transform: scale(1.07); }
.project-body { padding: 1.4rem; }
.project-body h3 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.project-body p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1rem; }

.tech-stack { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tech-stack span {
  font-size: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  color: var(--text-muted);
}
.project-links { display: flex; gap: 1rem; }
.link-placeholder {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}
.link-placeholder:hover { opacity: 0.7; }

/* ---------- EXPERIENCE / TIMELINE ---------- */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-dot {
  position: absolute;
  left: -2.42rem; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline-year {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.timeline-content h3 { font-size: 1.2rem; margin: 0.3rem 0; }
.timeline-content p { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- CONTACT ---------- */
.contact-sub { text-align: center; color: var(--text-muted); margin-bottom: 3rem; }
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
}
.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  display: grid;
  gap: 1.2rem;
}
.form-group { display: grid; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); }
.form-group input,
.form-group textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-status { font-size: 0.9rem; color: var(--accent); min-height: 1.2rem; }

.contact-info h3 { margin-bottom: 1rem; }
.contact-info p { color: var(--text-muted); margin-bottom: 0.7rem; display: flex; align-items: center; gap: 0.5rem; }
.social-links { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1rem; }
.social-links a {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.social-links a:hover { transform: translateY(-3px); border-color: var(--accent); }

/* ---------- FOOTER ---------- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- SCROLL REVEAL ANIMATION ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%; right: 0;
    flex-direction: column;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 0 0 14px 14px;
    padding: 1.5rem 2rem;
    gap: 1.2rem;
    width: 220px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateX(0); }

  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .section { padding: 4rem 0; }
  .hero-cta { flex-direction: column; }
  .btn { width: 100%; text-align: center; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}