/* Reset & base */
html {
  scroll-behavior: smooth;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
  background-color: #f9fafb;
  color: #222;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Gradient animated background */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 50%, #6a11cb 100%);
  background-size: 300% 300%;
  animation: gradientShift 40s ease infinite;
  opacity: 0.25;
  z-index: -2;
  pointer-events: none;
}

/* Dot grid overlay */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

/* Keyframes for gradient */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Variables */
:root {
  --bg-color: #f9fafb;
  --text-color: #222;
  --primary-color: #007acc;
  --secondary-color: #555;
  --skill-bg: #e2e8f0;
  --skill-fill: #007acc;
  --header-bg: #1a202c;
  --header-text: #edf2f7;
  --footer-bg: #1a202c;
  --footer-text: #edf2f7;
  --button-bg: #007acc;
  --button-hover-bg: #005fa3;
  --input-border: #cbd5e0;
  --section-shadow: rgba(0,0,0,0.12);
  --section-shadow-dark: rgba(255,255,255,0.1);
}

/* Dark mode */
[data-theme='dark'] {
  --bg-color: #181a1f;
  --text-color: #e2e8f0;
  --primary-color: #3399ff;
  --secondary-color: #ccc;
  --skill-bg: #242933;
  --skill-fill: #3399ff;
  --header-bg: #0d1117;
  --header-text: #cbd5e0;
  --footer-bg: #0d1117;
  --footer-text: #cbd5e0;
  --button-bg: #3399ff;
  --button-hover-bg: #1c6cd9;
  --input-border: #444c56;
  --section-shadow: rgba(0,0,0,0.3);
  --section-shadow-dark: rgba(255,255,255,0.15);
}

/* Body base styles */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Hero section */
.hero {
  background: var(--header-bg);
  color: var(--header-text);
  text-align: center;
  padding: 5rem 1rem 4rem;
  user-select: none;
  transition: background-color 0.5s ease, color 0.5s ease;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.hero-subtitle {
  font-weight: 400;
  font-size: 1.25rem;
  opacity: 0.85;
}

/* Dark Mode Toggle Button */
#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--header-text);
  transition: transform 0.3s ease;
  z-index: 999;
}

#theme-toggle:hover,
#theme-toggle:focus {
  transform: rotate(20deg);
  outline: none;
}

/* Sections */
.content-section {
  max-width: 800px;
  background: var(--bg-color);
  margin: 2rem auto;
  padding: 2.5rem 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 30px var(--section-shadow);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out, background-color 0.3s ease, box-shadow 0.3s ease;
  color: var(--text-color);
}

[data-theme='dark'] .content-section {
  box-shadow: 0 8px 30px var(--section-shadow-dark);
}

.content-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.content-section h2 {
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 0.3rem;
  margin-top: 0;
  font-weight: 700;
  color: var(--primary-color);
}

/* Projects */
.project-list {
  list-style: none;
  padding-left: 0;
}

.project-list li {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.project-list a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.3s ease;
}

.project-list a:hover,
.project-list a:focus {
  filter: brightness(1.1);
  text-decoration: underline;
}

/* Skills */
.skills-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 700px;
}

.skills-list li {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 1.5rem;
}

/* Skill name container with logo and text stacked */
.skill-name-container {
  display: flex;
  flex-direction: column;
  width: 180px;
  flex-shrink: 0;
  gap: 6px;
  white-space: normal;
  line-height: 1.3;
}

/* Skill logos */
.skill-name-container .skill-name.html-icon,
.skill-name-container .skill-name.css-icon,
.skill-name-container .skill-name.javascript-icon,
.skill-name-container .skill-name.python-icon,
.skill-name-container .skill-name.linux-icon {
  width: 28px;
  height: 28px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

/* Specific logos */
.skill-name.html-icon {
  background-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/html5/html5-original.svg');
}
.skill-name.css-icon {
  background-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/css3/css3-original.svg');
}
.skill-name.javascript-icon {
  background-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/javascript/javascript-original.svg');
}
.skill-name.python-icon {
  background-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/python/python-original.svg');
}
.skill-name.linux-icon {
  background-image: url('https://cdn.jsdelivr.net/gh/devicons/devicon/icons/linux/linux-original.svg');
}

/* Skill name text */
.skill-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--secondary-color);
  word-wrap: break-word;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Skill bar */
.skill-bar {
  flex-grow: 1;
  height: 18px;
  max-width: 550px;
  background: var(--skill-bg);
  border-radius: 18px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: background-color 0.3s ease;
}

/* Skill bar fill */
.skill-level {
  height: 100%;
  background-color: var(--skill-fill);
  border-radius: 18px 0 0 18px;
  width: 0;
  transition: width 1.5s ease-in-out;
}

/* Contact form */
.contact-form {
  max-width: 500px;
  margin-top: 1rem;
}

.contact-form label {
  font-weight: 600;
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: var(--bg-color);
  color: var(--text-color);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.contact-form button {
  background-color: var(--button-bg);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1rem;
  transition: background-color 0.3s ease, filter 0.3s ease;
}

.contact-form button:hover,
.contact-form button:focus {
  background-color: var(--button-hover-bg);
  filter: brightness(1.1);
  outline: none;
}

/* Social links */
.social-links {
  margin-top: 1rem;
  text-align: center;
  font-size: 1rem;
}

.social-links a {
  color: var(--primary-color);
  font-weight: 600;
  margin: 0 0.5rem;
  text-decoration: none;
  transition: filter 0.3s ease;
}

.social-links a:hover,
.social-links a:focus {
  filter: brightness(1.1);
  text-decoration: underline;
}

/* Footer */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  font-weight: 400;
  user-select: none;
}

/* Responsive */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }

  .content-section {
    margin: 1rem;
    padding: 1.5rem 1rem;
  }

  .skills-list {
    max-width: 100%;
  }

  .skill-bar {
    max-width: 100%;
  }
}

/* Scroll-to-top button */
#scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.6rem 1rem;
  font-size: 1.5rem;
  border: none;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

#scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

#scroll-top-btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}
