:root {
  --dark-bg: #1e1e1e;
  --light-text: #d4d4d4;
  --green-accent: #00ff00;
  --blue-accent: #1e90ff;
  --dark-text: #1e1e1e; /* For light theme */
  --light-bg: #f0f0f0; /* For light theme */
  --error-red: #ff4d4d;

  --current-bg: var(--dark-bg);
  --current-text: var(--light-text);
  --current-accent1: var(--green-accent);
  --current-accent2: var(--blue-accent);
  --current-border: var(--green-accent);
  --current-error: var(--error-red);

  --animation-speed-fast: 0.2s;
  --animation-speed-normal: 0.3s;
}

body.light-theme {
  --current-bg: var(--light-bg);
  --current-text: var(--dark-text);
  --current-accent1: #008000; /* Darker green for light theme */
  --current-accent2: #0000cd; /* Medium blue for light theme */
  --current-border: #008000;
  --current-error: #d90000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Consolas", "Courier New", Courier, monospace;
  background-color: var(--current-bg);
  color: var(--current-text);
  line-height: 1.6;
  transition: background-color var(--animation-speed-normal),
    color var(--animation-speed-normal);
  overflow-x: hidden;
}

.container {
  width: 90%;
  max-width: 1000px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid transparent;
  box-shadow: 0 0 10px transparent;
  transition: border-color var(--animation-speed-normal) ease-out,
    box-shadow var(--animation-speed-normal) ease-out,
    opacity var(--animation-speed-fast) ease-out;
}

.container.loaded {
  border-color: var(--current-border);
  box-shadow: 0 0 10px var(--current-border);
  opacity: 1 !important;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--current-accent2);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.prompt {
  color: var(--current-accent1);
  margin-right: 5px;
  white-space: nowrap;
  display: inline-block;
}

header nav {
  display: flex;
  flex-wrap: wrap;
}

header nav a {
  color: var(--current-text);
  text-decoration: none;
  margin-left: 15px;
  transition: color var(--animation-speed-fast),
    opacity var(--animation-speed-fast), transform var(--animation-speed-fast);
}
header nav a:first-child {
  margin-left: 0;
}

header nav a:hover,
header nav a:focus {
  color: var(--current-accent2);
  text-decoration: underline;
}

.theme-switcher {
  position: relative;
  display: inline-block;
  transition: opacity var(--animation-speed-fast),
    transform var(--animation-speed-fast);
}

.toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--current-text);
}

.toggle-label input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  background-color: #555;
  border-radius: 20px;
  transition: background-color var(--animation-speed-fast);
}
.slider:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--light-text);
  top: 2px;
  left: 2px;
  transition: transform var(--animation-speed-fast),
    background-color var(--animation-speed-fast);
}
input:checked + .slider {
  background-color: var(--current-accent1);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
body.light-theme .slider:before {
  background-color: var(--light-bg);
}
body.light-theme input:checked + .slider:before {
  background-color: var(--light-text);
}

main section {
  padding: 15px 0;
  margin-bottom: 15px;
}

.section-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 10px;
}

.section-header .prompt {
  min-width: 10ch;
}

h2.section-title {
  color: var(--current-accent2);
  border-bottom: 1px solid var(--current-accent2);
  padding-bottom: 3px;
  display: inline-block;
  margin-left: 5px;
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out;
}

h3 {
  color: var(--current-text);
  margin-bottom: 5px;
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out;
}
h4 {
  color: var(--current-accent1);
  margin-bottom: 5px;
}

.section-divider {
  border: 0;
  height: 1px;
  background-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0),
    var(--current-accent1),
    rgba(0, 0, 0, 0)
  );
  margin: 20px 0;
  transition: opacity var(--animation-speed-fast) ease-out;
}
body.light-theme .section-divider {
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0),
    var(--current-accent1),
    rgba(255, 255, 255, 0)
  );
}

.hidden-initially {
  opacity: 0;
  transform: translateY(10px);
}

.visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
  transition: opacity var(--animation-speed-normal) ease-out,
    transform var(--animation-speed-normal) ease-out;
}

#pageHeader.visible,
#pageFooter.visible,
.theme-switcher.visible,
nav a.nav-item.visible,
.section-header .prompt.visible,
.section-title.visible,
.section-content.visible,
.section-content > p.visible,
.social-links a.visible,
.button.visible,
.timeline-item.visible,
.education-item.visible,
.project-item.visible,
.project-subsection > h3.visible,
#formStatus.visible,
hr.section-divider.visible,
.skills-category-title.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--animation-speed-normal) ease-out,
    transform var(--animation-speed-normal) ease-out;
}

#home .section-content p {
  font-size: 1.2em;
  margin-bottom: 20px;
}
.social-links a {
  color: var(--current-text);
  text-decoration: none;
  margin-right: 15px;
  transition: color var(--animation-speed-fast),
    opacity var(--animation-speed-fast), transform var(--animation-speed-fast);
  font-weight: bold;
  display: inline-block;
}
.social-links a:hover,
.social-links a:focus {
  color: var(--current-accent1);
}
.button {
  display: inline-block;
  padding: 8px 15px;
  background-color: var(--current-accent1);
  color: var(--dark-bg);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color var(--animation-speed-fast),
    color var(--animation-speed-fast), opacity var(--animation-speed-fast),
    transform var(--animation-speed-fast);
  font-family: "Consolas", "Courier New", Courier, monospace;
}
.download-button {
  text-decoration: underline !important;
}
.button:hover,
.button:focus {
  background-color: var(--current-accent2);
  color: var(--light-text);
}
body.light-theme .button {
  background-color: var(--current-accent1);
  color: var(--light-bg);
}
body.light-theme .button:hover,
body.light-theme .button:focus {
  background-color: var(--current-accent2);
  color: var(--light-bg);
}

#skills .skills-grid {
  display: flex;
  flex-direction: column;
  gap: 20px; 
  margin-top: 10px;
  padding-left: 0;
}

.skills-category-title {
  color: var(--current-accent2);
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 4px; 
  border-bottom: 1px dashed var(--current-accent1);
}

.skill-items-container {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(110px, 1fr)
  ); 
  gap: 8px;
}

.skill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 6px; 
  border: 1px dashed transparent;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out,
    border-color var(--animation-speed-fast);
}
.skill-item.visible {
  opacity: 1;
  transform: translateY(0);
  border-color: var(--current-accent2);
}
.skill-logo {
  font-size: 1.2em;
  margin-bottom: 4px;
  color: var(--current-accent1);
  min-height: 1.2em; 
  font-weight: bold;
}
.skill-name {
  font-size: 0.8em;
  color: var(--current-text);
  word-break: break-word;
  line-height: 1.3;
}
.skill-status {
  font-size: 0.6em;
  color: var(--current-accent1);
  min-height: 0.8em; 
  margin-top: 3px;
  display: inline-block;
}

.timeline,
.education-item,
.project-item {
  margin-bottom: 20px;
  padding-left: 20px;
  border-left: 2px solid var(--current-accent1);
  position: relative;
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out;
}
.project-subsection h3 {
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out;
}

.timeline-item {
  margin-bottom: 20px;
  padding-left: 20px;
  border-left: 2px solid var(--current-accent1);
  position: relative;
  transition: opacity var(--animation-speed-fast) ease-out,
    transform var(--animation-speed-fast) ease-out;
}

.timeline-item:before,
.education-item:before,
.project-item:before {
  content: ">";
  position: absolute;
  left: -12px;
  top: 0;
  color: var(--current-accent1);
  font-weight: bold;
}
.timeline-item h3,
.education-item h3,
.project-item h4 {
  margin-bottom: 3px;
}
.company-duration,
.education-item p,
.project-item p {
  font-size: 0.9em;
  color: var(--current-text);
  opacity: 0.8;
  margin-bottom: 8px;
}

.project-item p:last-child {
  margin-bottom: 0;
}
.project-item p em {
  font-style: italic;
  opacity: 0.7;
}

.timeline-item ul {
  list-style: none;
  padding-left: 15px;
}
.timeline-item ul li {
  margin-bottom: 5px;
  position: relative;
}
.timeline-item ul li::before {
  content: "- ";
  color: var(--current-text);
  position: absolute;
  left: -15px;
}

.project-subsection {
  margin-bottom: 20px;
}
.project-subsection h3 {
  color: var(--current-accent1);
  font-size: 1.1em;
  margin-top: 15px;
  margin-bottom: 10px;
}
.project-item .technologies span {
  font-weight: bold;
  color: var(--current-accent2);
}
.project-item a {
  color: var(--current-accent1);
  text-decoration: none;
}
.project-item a:hover {
  text-decoration: underline;
}

#contactForm .form-group {
  margin-bottom: 10px;
}
#contactForm label {
  display: block;
  margin-bottom: 3px;
  color: var(--current-text);
}
#contactForm input[type="text"],
#contactForm input[type="email"],
#contactForm textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--current-accent2);
  background-color: var(--current-bg);
  color: var(--current-text);
  font-family: "Consolas", "Courier New", Courier, monospace;
}
#contactForm input[type="text"]:focus,
#contactForm input[type="email"]:focus,
#contactForm textarea:focus {
  outline: none;
  border-color: var(--current-accent1);
  box-shadow: 0 0 5px var(--current-accent1);
}
.error-message {
  color: var(--current-error);
  font-size: 0.8em;
  min-height: 1em;
  margin-top: 2px;
}
#formStatus {
  margin-top: 15px;
  font-weight: bold;
  min-height: 1.2em;
  transition: opacity var(--animation-speed-fast),
    transform var(--animation-speed-fast);
}

footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px dashed var(--current-accent2);
  margin-top: 30px;
  font-size: 0.9em;
  transition: opacity var(--animation-speed-fast),
    transform var(--animation-speed-fast);
}

@media (max-width: 768px) {
  .container {
    width: 95%;
    padding: 15px;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  header nav {
    margin-top: 10px;
    margin-left: 0;
  }
  header nav a {
    margin-left: 0;
    margin-right: 10px;
    margin-bottom: 5px;
  }
  .theme-switcher {
    margin-top: 10px;
    align-self: flex-start;
  }
  .prompt {
    font-size: 0.9em;
  }
  .section-header .prompt {
    min-width: auto;
  }

  .skills-category-title {
    font-size: 1em;
  }
  .skill-items-container {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    gap: 8px;
  }
  .skill-logo {
    font-size: 1.1em; 
  }
  .skill-name {
    font-size: 0.75em; 
  }
}
@media (max-width: 480px) {
  h2.section-title {
    font-size: 1.3em;
  }
  #home .section-content p {
    font-size: 1em;
  }
  .social-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .social-links a {
    margin-bottom: 10px;
    margin-right: 0;
  }
  .button {
    width: 100%;
    text-align: center;
    margin-top: 5px;
  }
  .social-links .button {
    width: auto;
    padding: 8px 15px;
  }
  #contactForm button.button {
    width: auto;
  }

  .skills-category-title {
    font-size: 0.95em;
  }
  .skill-items-container {
    grid-template-columns: repeat(
      auto-fit,
      minmax(85px, 1fr)
    );
    gap: 6px;
  }
  .skill-item {
    padding: 6px 4px;
  }
  .skill-logo {
    font-size: 1em;
  }
  .skill-name {
    font-size: 0.7em;
  }
  .skill-status {
    font-size: 0.55em;
  }
}
