/* === Root variables for light and dark themes === */
:root {
  --bg-color: #ffffff;
  --text-color: #222222;
  --primary-color: #6c63ff;
  --highlight-color: #6c63ff;
  --link-color: #4a3fff;
  --border-color: #e0e0e0;
  --button-bg: #6c63ff;
  --button-color: #fff;
}

[data-theme='dark'] {
  --bg-color: #121212;
  --text-color: #f0f0f0;
  --primary-color: #a89cff;
  --highlight-color: #a89cff;
  --link-color: #a89cff;
  --border-color: #333333;
  --button-bg: #a89cff;
  --button-color: #121212;
}

/* === Global base styles and reset === */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  font-size: 1rem;
}

/* Headings styles */
h1, h2, h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
  margin-top: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1rem;
}

/* Paragraph styling */
p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* Link styles with focus and hover for accessibility */
a {
  color: var(--link-color);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  color: var(--highlight-color);
  outline: none;
}

/* Remove default list styling */
ul {
  list-style-type: none;
  padding-left: 0;
}

li {
  margin-bottom: 0.5rem;
}

/* Container max-width and center */
main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* === Header and Navigation styles === */
header nav {
  background-color: var(--bg-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

header nav h1 {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* Navigation links container */
#nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

#nav-links li a {
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Active, hover and focus styles for nav links */
#nav-links li a.active,
#nav-links li a:hover,
#nav-links li a:focus-visible {
  background-color: var(--primary-color);
  color: var(--button-color);
  outline: none;
}

/* === Button styles === */
button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

button:hover,
button:focus-visible {
  background-color: var(--border-color);
  outline: none;
}

/* === Hero Section styles === */
.hero {
  text-align: center;
  margin-top: 4rem;
}

.highlight {
  color: var(--highlight-color);
  font-weight: 700;
}

.contact-info {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-color);
}

.contact-info li {
  margin: 0.3rem 0;
}

/* === Education timeline styles === */
.timeline {
  border-left: 3px solid var(--primary-color);
  margin-left: 1rem;
  padding-left: 1rem;
}

.timeline li {
  margin-bottom: 1.5rem;
}

/* === Skills Section styles === */
.skill-item {
  margin-bottom: 1.5rem;
}

/* === Projects Section styles === */
.projects ul {
  padding-left: 1rem;
  list-style-type: disc;
}

/* === Contact Form styles === */
form {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
}

input, textarea {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background-color: var(--bg-color);
  color: var(--text-color);
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Focus styles for form inputs for accessibility */
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-color: var(--primary-color);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Placeholder text styling to ensure readability */
::placeholder {
  color: var(--text-color);
  opacity: 0.7;
}

/* Submit button styles */
button[type="submit"] {
  background-color: var(--button-bg);
  color: var(--button-color);
  font-weight: 600;
  padding: 0.75rem;
  border-radius: 4px;
  border: none;
  transition: background-color 0.3s ease;
}

button[type="submit"]:hover,
button[type="submit"]:focus-visible {
  background-color: var(--highlight-color);
  outline: none;
}

/* === Footer styles === */
footer {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* === Back to top button styles === */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: none;
  background-color: var(--button-bg);
  color: var(--button-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

#back-to-top:hover,
#back-to-top:focus-visible {
  background-color: var(--highlight-color);
  outline: none;
}

/* === Responsive styles for mobile menu === */
@media (max-width: 768px) {
  #nav-links {
    display: none;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--bg-color);
    position: absolute;
    top: 60px;
    right: 0;
    width: 200px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    transition: opacity 0.3s ease;
  }

  #nav-links.show {
    display: flex;
  }

  body {
    font-size: 1.1rem;
  }
}

/* === Visually Hidden Utility for Accessibility === */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}