@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Poppins:wght@600;700&display=swap");

:root {
  --primary-color: #2563eb;
  --secondary-color: #7c3aed;
  --text-color: #1f2937;
  --bg-color: #f3f4f6;
  --spacing: 1.5rem;
  --main-font: "Inter", sans-serif;
  --heading-font: "Poppins", serif;
}

/* dark theme overrides */
:root[data-theme="dark"] {
  --primary-color: #60a5fa;
  --secondary-color: #a855f7;
  --text-color: #e5e7eb;
  --bg-color: #020617;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--main-font, sans-serif);
  line-height: 1.6;
  color: var(--text-color, #333);
  background-color: var(--bg-color, #f3f4f6);
  min-height: 100dvh;
  view-transition-name: page;
}

h1 {
  font-family: var(--heading-font, serif);
  font-size: clamp(2rem, 5dvw, 3rem);
  color: var(--primary-color, blue);
  margin-bottom: var(--spacing, 1.5rem);
}

h2 {
  font-family: var(--heading-font, serif);
  font-size: 2em;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-family: var(--heading-font, serif);
  font-size: 1.5em;
  color: var(--primary-color, blue);
}

p {
  margin-bottom: 1rem;
}

header {
  background: linear-gradient(
    135deg,
    var(--primary-color, blue),
    var(--secondary-color, purple)
  );
  color: white;
  padding: var(--spacing, 1.5rem);
  position: sticky;
  top: 0;
  z-index: 100;

  & h1 {
    color: white;
    margin: 0;
  }

  & nav {
    margin-top: 1rem;

    & ul {
      list-style: none;
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;

      & li a {
        color: white;
        text-decoration: none;
        padding: 0.5em 1em;
        border-radius: 8px;
        transition: all 0.3s ease;
        display: block;

        &:hover {
          background: rgba(255, 255, 255, 0.2);
          transform: translateY(-2px);
        }

        &[aria-current="page"] {
          background: rgba(255, 255, 255, 0.3);
        }
      }
    }
  }
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 70dvh;
  display: grid;
  gap: 2rem;
}

section {
  background: var(--bg-color, lightgray);
  padding: var(--spacing, 1.5rem);
  border-radius: 8px;
  animation: fadeIn 0.6s ease;

  &:hover {
    transform: translateY(-4px);
    transition: transform 0.3s;
  }
}

section:has(form) {
  background: linear-gradient(
    135deg,
    var(--bg-color, lightgray),
    rgba(37, 99, 235, 0.1)
  );
  border: 2px solid var(--primary-color, blue);
}

section:has(picture) {
  background: linear-gradient(135deg, white, var(--bg-color, lightgray));
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

article {
  background: white;
  padding: var(--spacing, 1.5rem);
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  margin-bottom: 1rem;
  transition: transform 0.3s;

  &:hover {
    transform: scale(1.02);
  }
}

article:has(time) {
  border-left-width: 6px;
  border-left-color: var(--secondary-color, purple);
}

experience-item,
project-card {
  display: block;
  background: white;
  padding: var(--spacing, 1.5rem);
  border-radius: 8px;
  margin-bottom: 1rem;

  & h3 {
    margin-bottom: 0.5rem;
  }

  & time {
    color: #6b7280;
    font-size: 0.9em;
  }

  & dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin: 1rem 0;

    & dt {
      font-weight: 600;
      color: var(--primary-color, blue);
    }
  }

  & ul,
  & ol {
    margin-left: 1.5rem;
    margin-top: 1rem;
  }
}

form {
  & fieldset {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: var(--spacing, 1.5rem);

    & legend {
      font-weight: 700;
      color: var(--primary-color, blue);
      padding: 0 0.5rem;
    }
  }

  & label {
    display: block;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
  }

  & input,
  & textarea {
    width: 100%;
    padding: 0.75em;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: var(--main-font, sans-serif);
    transition: border-color 0.3s;

    &:focus {
      outline: none;
      border-color: var(--primary-color, blue);
    }
  }

  & button {
    margin-top: 1rem;
    padding: 0.75em 2em;
    background: var(--primary-color, blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;

    &:hover {
      transform: translateY(-2px);
    }
  }
}

picture {
  display: block;
  margin: 1rem 0;

  & img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s;

    &:hover {
      transform: scale(1.05);
    }
  }
}

progress {
  width: 100%;
  height: 1.5rem;
  border-radius: 8px;
  appearance: none;

  &::-webkit-progress-bar {
    background: #e5e7eb;
    border-radius: 8px;
  }

  &::-webkit-progress-value {
    background: linear-gradient(
      90deg,
      var(--primary-color, blue),
      var(--secondary-color, purple)
    );
    border-radius: 8px;
  }
}

dialog {
  border: none;
  border-radius: 8px;
  padding: 2rem;
  max-width: 90dvw;

  & button {
    margin-top: 1rem;
    padding: 0.5em 1.5em;
    background: var(--primary-color, blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;

    &:hover {
      opacity: 0.9;
    }
  }
}

footer {
  background: var(--text-color, #333);
  color: white;
  padding: 2rem;
  text-align: center;
  margin-top: auto;
}

a {
  color: var(--primary-color, blue);
  transition: color 0.3s;

  &:hover {
    color: var(--secondary-color, purple);
  }
}

picture img {
  object-fit: cover;
  object-position: center;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

audio,
video {
  max-width: 100%;
  border-radius: 8px;
  margin: 1rem 0;
}

canvas {
  max-width: 100%;
  border-radius: 8px;
}

iframe {
  max-width: 100%;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
}

.menu-toggle {
  display: none;
}

#menu-checkbox {
  display: none;
}

.menu-icon {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .menu-icon {
    display: block;
  }

  header nav ul {
    flex-direction: column;
    gap: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  #menu-checkbox:checked ~ nav ul {
    max-height: 500px;
  }

  #menu-checkbox:checked ~ .menu-icon::before {
    content: "✕";
  }

  .menu-icon::before {
    content: "☰";
  }

  header nav ul li a {
    padding: 0.75rem 1rem;
    width: 100%;
  }

  main {
    padding: 1rem;
    gap: 1.5rem;
  }

  section {
    padding: 1rem;
  }

  h2 {
    font-size: 1.5em;
  }

  h3 {
    font-size: 1.25em;
  }

  experience-item,
  project-card {
    padding: 1rem;

    & picture img {
      width: 100%;
      height: auto;
    }
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.9rem;
  }

  h1 {
    font-size: clamp(1.5rem, 8dvw, 2rem);
  }

  header {
    padding: 1rem;
  }

  main {
    padding: 0.75rem;
  }

  section {
    padding: 0.75rem;
  }

  form fieldset {
    padding: 1rem;
  }

  dialog {
    padding: 1rem;
    max-width: 95dvw;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  main {
    padding: 1.5rem;
  }

  header nav ul {
    gap: 0.75rem;
  }
}

@media (min-width: 1200px) {
  main {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }

  section:has(form) {
    grid-column: 1 / -1;
  }
}

@media print {
  header,
  footer,
  nav {
    display: none;
  }

  main {
    padding: 0;
    max-width: 100%;
  }

  section {
    page-break-inside: avoid;
    box-shadow: none;
  }
}
