@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

:root {
  --primary-color: #3f3f3f;
  --secondary-color: #ffd900d3;
  --background-color: #ffffff;
  --text-color: var(--primary-dark, #333);
  --accent-color: #5d5d5d;
  --border-radius: 8px;
  --spacing-unit: 1rem;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-color, #f4f4f4);
  color: var(--text-color);
  margin: 0;
  padding: var(--spacing-unit);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex-grow: 1;
  padding: calc(var(--spacing-unit) * 1.5);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

h1, h2, h3 {
  color: var(--primary-color);
  text-wrap: balance;
  text-align: center;
}

header {
  background: var(--primary-color);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 0 var(--spacing-unit);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;

  nav ul {
    list-style: none;
    display: flex;
    
    padding: 0;
    margin: 0;
    gap: 0.5em;

    li a {
      color: white;
      text-decoration: none;
      padding: 0.5em 1em;
      border-radius: 4px;
      transition: background-color 0.3s ease, transform 0.2s ease;

      &:hover {
        background-color: var(--secondary-color);
        transform: translateY(-2px);
      }
    }
  }
}

footer {
  text-align: center;
  margin-top: calc(var(--spacing-unit) * 2);
  font-size: 0.9rem;
  color: var(--primary-color);
}

#skills ol {
  list-style: none;
  padding: 0;
  width: 80%;
  margin: 0 auto;
}

#skills li {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--spacing-unit);
}

#skills progress {
  width: 100%;
  max-width: 400px; /* Or another max-width you prefer */
}

@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

#experience svg .timeline-line {
  stroke-dasharray: 1000;
  animation: draw-line 2s ease-out forwards;
}

.socials {
  display: flex;
  gap: 1rem;
  font-size: 1.5rem;

  a {
    color: var(--primary-color);
    transition: color 0.3s;

    &:hover {
      color: var(--secondary-color);
    }
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
}

form {
  background-color: color-mix(in srgb, var(--background-color) 80%, white);
  padding: var(--spacing-unit);
  border-radius: var(--border-radius);
  text-align: left;
}

form fieldset {
  border: 1px solid var(--secondary-color);
}

form button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75em 1.5em;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;

  &:hover {
    background-color: var(--primary-color);
  }
}

label:has(+ input:required:invalid) {
  color: #d9534f;
  font-weight: bold;
}

#projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: calc(var(--spacing-unit) * 1.5);
  text-align: left; /* Override centered text from main */
}

#projects article {
  border: 1px solid color-mix(in srgb, var(--secondary-color) 20%, transparent);
  border-radius: var(--border-radius);
  padding: var(--spacing-unit);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: auto;
  max-height: 50vh;
}

#projects article:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#projects h3 {
  text-align: center;
}
.github-link {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  margin-bottom: 1rem;
}

.github-link .fa-github {
  margin-left: 0.5rem;
}

.table-wrapper {
  margin: 1rem 0;
}

.instruction-set-table {
  border-collapse: separate;
  border-spacing: 1rem 0.5rem;
}

.profile-img {
  border-radius: var(--border-radius);
  object-fit: cover;
  width: 300px;
  height: 450px;
}

.project-image {
  width: 100%;
  max-width: 720px;
  height: auto;
  display: block;
  margin: 0.5 auto;
  border-radius: var(--border-radius);
}

.avatar-img {
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--secondary-color);
}


/* Tablet */
@media (max-width: 1024px) {
  header {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  #projects {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Phone */
@media (max-width: 768px) {
  body {
    padding: calc(var(--spacing-unit) / 2);
  }

  header {
    flex-direction: column;
  }

  main {
    padding: var(--spacing-unit);
  }

  form label, form input, form textarea, form button {
    width: 95%;
  }

  #projects {
    grid-template-columns: 1fr;
    margin-left: 2rem;
    margin-right: 2rem;
  }
  .table-wrapper {
    height: 350px;
  }
  .instruction-set-table {
    transform: scale(0.6);
    transform-origin: 0 0;
  }
}

main:has(#about-me),
main:has(form) {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
