/*
 * Base styles for Karthik's portfolio.
 * Following minimalist design principles: limited palette, ample whitespace,
 * intuitive navigation, and responsive layout.  Variables defined at the
 * top allow easy customization for light and dark themes.
 */

/* Color palette variables */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --card-bg: #ffffff;
  --text-primary: #111111;
  --text-secondary: #444444;
  --accent: #0066cc;
  --link: #0066cc;
  --header-height: 64px;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Dark theme overrides */
.dark {
  --bg: #0d1424;
  --bg-alt: #141c32;
  --card-bg: #192444;
  --text-primary: #f0f2fa;
  --text-secondary: #b8c0d0;
  --accent: #4da3ff;
  --link: #4da3ff;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Reset and global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg);
  box-shadow: var(--box-shadow);
  display: flex;
  align-items: center;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.2rem;
}

nav a {
  color: var(--text-primary);
  font-weight: 500;
  transition: color 0.2s ease;
}
nav a:hover {
  color: var(--accent);
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--accent);
  transition: transform 0.3s ease;
}
#theme-toggle:hover {
  transform: rotate(20deg);
}

/* Sections */
.section {
  padding: 100px 0;
}

.bg-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.section-subtitle {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
  color: var(--text-secondary);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0f2fa;
  text-align: center;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('hero-background.png');
  background-size: cover;
  background-position: center;
  z-index: -2;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

.hero-content {
  max-width: 700px;
  padding: 2rem;
}

.hero-title {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-title .accent {
  color: var(--accent);
}

.hero-tagline {
  font-size: 1.2rem;
  color: #d5e0f0;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--box-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.btn.secondary {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}
.btn.secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* About */
.about-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.about-text p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.contact-info p {
  margin-bottom: 0.5rem;
}

.contact-info a {
  color: var(--accent);
  text-decoration: none;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: transform 0.2s ease;
}
.skill-card:hover {
  transform: translateY(-5px);
}

.skill-card h3 {
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.skill-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Timeline (Experience) */
.timeline {
  position: relative;
  margin-left: 1rem;
  padding-left: 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.timeline-item {
  margin-bottom: 2rem;
  padding-left: 1rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.3rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

timeline-item h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.timeline-item ul {
  list-style: disc inside;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-left: 0.5rem;
}

.timeline-item li {
  margin-bottom: 0.5rem;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: transform 0.2s ease;
}
.project-card:hover {
  transform: translateY(-5px);
}

.project-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
  color: var(--accent);
}

.project-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Blog */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: transform 0.2s ease;
}
.blog-card:hover {
  transform: translateY(-5px);
}

.blog-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.blog-content {
  padding: 1rem;
  flex: 1;
}

.blog-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.blog-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.blog-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.contact-item h3 {
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.contact-item p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  background: var(--bg-alt);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  nav ul {
    display: none;
  }
  /* A simple mobile nav could be added later */
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 2rem;
  }
  .hero-tagline {
    font-size: 1rem;
  }
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  .section {
    padding: 80px 0;
  }
}

/* Reveal animation classes */
.hidden {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile navigation toggle */
#nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--accent);
  margin-left: 1rem;
}

/* Mobile nav list hidden by default on small screens */
@media (max-width: 768px) {
  #nav-toggle {
    display: block;
  }
  nav ul.nav-list {
    display: none;
    flex-direction: column;
    gap: 0.8rem;
    position: absolute;
    top: var(--header-height);
    right: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    z-index: 100;
  }
  nav ul.nav-list.open {
    display: flex;
  }
}
