/* ===== CSS VARIABLES ===== */
:root {
  --primary-bg: #0a192f;
  --primary-text: #f8fafc;
  --accent: #64ffda;
  --link-hover: #64ffda;
  --border-color: #475569;
  --card-bg: #1e293b;
  --muted-text: #cbd5e1;
}

[data-theme="light"] {
  --primary-bg: #ffffff;
  --primary-text: #0f172a;
  --accent: #0ea5e9;
  --link-hover: #0369a1;
  --border-color: #cbd5e1;
  --card-bg: #f8fafc;
  --muted-text: #475569;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Gill Sans', sans-serif;
  background: var(--primary-bg);
  color: var(--primary-text);
  transition: background 0.2s, color 0.2s;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.5rem;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--accent);
  color: var(--primary-bg);
  padding: 8px 16px;
  z-index: 1000;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 0 0 4px 4px;
  transform: translateY(-100%);
  transition: transform 0.2s;
  text-decoration: none;

  &:focus {
    transform: translateY(0);
    outline: 2px solid var(--accent);
  }
}

/* ===== HEADER ===== */
.header {
  width: 100%;
  background: var(--primary-bg);
  min-height: 48px;
  display: flex;
  align-items: center;

  .header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
  }

  .logo {
    font-size: 1.05rem;
    color: var(--primary-text);
    letter-spacing: 0.5px;
    text-decoration: none;
    margin-right: 1.5rem;
    transition: color 0.2s;

    &:hover, &:focus {
      color: var(--link-hover);
    }
  }

  .header-nav {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: end;
  }

  .header-center {
    display: flex;
    gap: 1.5rem;
    font-weight: 100;

    a {
      color: var(--primary-text);
      text-decoration: none;
      letter-spacing: 0.2px;
      transition: color 0.2s;
      padding: 2px 0;

      &:hover, &:focus {
        color: var(--link-hover);
      }
    }
  }

  .header-right.icon-links {
    display: flex;
    align-items: center;
    gap: 1rem;

    .icon-link {
      color: var(--primary-text);
      display: flex;
      align-items: center;
      transition: color 0.2s;
      font-size: 1rem;
      padding: 2px;

      &:focus, &:hover {
        color: var(--link-hover);
      }

      svg {
        width: 1.15em;
        height: 1.15em;
        display: block;
      }
    }

    #theme-toggle {
      background: none;
      border: none;
      font-size: 1rem;
      padding: 2px;
      cursor: pointer;
      color: var(--primary-text);
      transition: color 0.2s;

      &:focus {
        outline: 2px solid var(--accent);
      }
    }
  }
}

/* ===== HERO BANNER ===== */
.hero-banner {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 90vh;
  min-height: 400px;
  width: 100%;
  overflow: hidden;

  #particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  .banner-content {
    position: relative;
    z-index: 2;
    padding: 0 1.5rem;
    max-width: 700px;

    h1 {
      font-size: 2.5rem;
      color: var(--primary-text);
      margin-bottom: 1rem;
      text-align: center;
      min-height: 4rem;

      &.typing-done::after {
        content: '|';
        display: inline-block;
        animation: blink 0.75s infinite;
        color: var(--accent);
        font-weight: 100;
        margin-left: 0.2rem;
      }
    }

    .bio {
      font-size: 1.5rem;
      color: var(--primary-text);
      line-height: 1.6;
      font-weight: 100;
      text-align: justify;
    }
  }
}

/* ===== ANIMATIONS ===== */
@keyframes blink {
  50% { opacity: 0; }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;

  &.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
  }
}

.skeleton {
  background: var(--border-color);
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}

.skeleton-image {
  width: 100%;
  height: 300px;
  border-radius: 8px;
}

/* ===== PAGE LOADING ===== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;

  &.hidden {
    opacity: 0;
    pointer-events: none;
  }

  .loader-content {
    text-align: center;
    color: var(--accent);
    
    .loader-spinner {
      width: 40px;
      height: 40px;
      border: 3px solid var(--border-color);
      border-top: 3px solid var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin: 0 auto 1rem;
    }
    
    .loader-text {
      font-size: 1.1rem;
      font-weight: 100;
    }
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== SECTIONS ===== */
.about-section,
.experience-section,
.projects-section {
  padding: 4rem 0;

  h2 {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 2rem;
  }
}

/* ===== ABOUT SECTION ===== */
.about-section {
  .about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: flex-start;
  }

  .about-text {
    .about-content {
      p, ul {
        font-weight: 100;
        font-size: 1.1rem;
        line-height: 1.7;
        color: var(--primary-text);
        margin-bottom: 1rem;
      }

      ul {
        list-style: none;
        padding: 0;

        li::before {
          content: '▹';
          color: var(--accent);
          margin-right: 0.7rem;
          font-weight: bold;
        }
      }
    }
  }

  .about-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;

    &:hover {
      transform: scale(1.05);
    }
  }
}

/* ===== EXPERIENCE SECTION ===== */
.experience-section {
  .experience-tabs {
    display: flex;
    gap: 2rem;
  }

  .tab-list {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
  }

  .tab-button {
    background: none;
    border: none;
    border-left: 2px solid var(--border-color);
    color: var(--primary-text);
    padding: 10px 15px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 100;
    transition: all 0.2s;
    white-space: nowrap;

    &.active {
      color: var(--accent);
      border-left-color: var(--accent);
      background: var(--card-bg);
    }

    &:hover:not(.active), &:focus:not(.active) {
      background: var(--card-bg);
      color: var(--accent);
    }
  }

  .tab-panels {
    .tab-panel {
      display: none;

      &.active {
        display: block;
      }

      h3 {
        font-size: 1.4rem;
        font-weight: 100;
        color: var(--primary-text);
        margin-bottom: 0.25rem;

        span {
          color: var(--accent);
          font-weight: bold;
        }
      }

      .job-duration {
        font-size: 0.9rem;
        font-weight: 100;
        color: var(--muted-text);
        margin-bottom: 1rem;
      }

      ul {
        list-style: none;
        padding: 0;
        font-weight: 100;

        li {
          font-size: 1.1rem;
          line-height: 1.7;
          margin-bottom: 0.5rem;

          &::before {
            content: '▹';
            color: var(--accent);
            margin-right: 0.7rem;
            font-weight: bold;
          }
        }
      }
    }
  }
}

/* ===== PROJECTS SECTION ===== */
.projects-section {
  .project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
  }

  .project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

      .project-card-link h3 {
        color: var(--accent);
      }
    }

    .project-card-link {
      text-decoration: none;
      display: flex;
      flex-direction: column;
      flex-grow: 1;

      h3 {
        color: var(--primary-text);
        font-size: 1.2rem;
        font-weight: bold;
        margin: 0 0 0.5rem 0;
        transition: color 0.2s;
      }

      p {
        color: var(--primary-text);
        font-weight: 100;
        font-size: 1rem;
        line-height: 1.5;
        margin: 0.5rem 0 1rem 0;
        flex-grow: 1;
      }
    }

    .github-link {
      position: absolute;
      top: 1.5rem;
      right: 1.5rem;
      color: var(--primary-text);
      transition: color 0.2s;

      &:hover, &:focus {
        color: var(--accent);
      }
    }

    .tech-list {
      list-style: none;
      padding: 0;
      margin: 0;
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      font-size: 0.9rem;
      font-weight: 100;

      li {
        background: var(--border-color);
        color: var(--primary-text);
        padding: 0.25rem 0.75rem;
        border-radius: 999px;
        font-weight: 500;
      }
    }
  }

  .other-projects-heading {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin: 3rem 0 1.5rem 0;
  }

  .other-websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }

  .website-link {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 4px;
    color: var(--primary-text);
    text-decoration: none;
    text-align: center;
    font-weight: 100;
    transition: background 0.2s, color 0.2s;

    &:hover, &:focus {
      background: var(--accent);
      color: var(--primary-bg);
    }
  }
}

/* ===== FOOTER ===== */
.footer {
  padding: 2rem 0;
  text-align: center;
  margin-top: 2rem;

  p {
    margin: 0.5rem 0;
    font-weight: 100;
    color: var(--primary-text);
    font-size: 1rem;

    strong {
      color: var(--accent);
      font-weight: bold;
    }
  }
}

/* ===== GO TO TOP BUTTON ===== */
.go-to-top {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 45px;
  height: 45px;
  background: var(--accent);
  color: var(--primary-bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

  &:hover, &:focus {
    background: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }

  &.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  svg {
    width: 18px;
    height: 18px;
  }
}

/* ===== ERROR PAGE ===== */
.nf-main {
	display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  padding: 0 16px;
  min-height: 70vh;
}

.nf-main .letter-grid {
	display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.5%;
  list-style: none;
  margin: 24px 0;
  width: 100%;
}

.nf-main .letter-grid li {
	background: rgba(71, 85, 105, 0.3);
  color: var(--primary-text);
	margin-right: 0.5%;
	margin-bottom: 0.5%;
  padding: 0;
  display: block;
  text-align: center;
  text-transform: uppercase;
  overflow: hidden;
  font-size: 1.6vw;
  font-weight: 300;
}

.nf-main .letter-grid li.highlight {
	background: var(--accent);
  color: var(--primary-bg);
	font-weight: 700;
}

.error-section {
  padding: 6rem 0;
  display: flex;
  align-items: center;
}

.error-content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;

  h1 {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent);
    margin: 0;
    line-height: 1;
  }

  p {
    font-size: 1rem;
    color: var(--muted-text);
    margin-bottom: 2rem;
    line-height: 1.6;
  }
}

.error-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  border: 2px solid transparent;
  width: 100%;
  max-width: 200px;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary-bg);

  &:hover, &:focus {
    background: var(--link-hover);
    transform: translateY(-2px);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
  .about-section .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;

    .about-image {
      max-width: 300px;
      margin: 0 auto 2rem auto;
    }
  }
}

@media (max-width: 768px) {
  .experience-section .experience-tabs {
    flex-direction: column;
    gap: 1.5rem;

    .tab-list {
      flex-direction: row;
      overflow-x: auto;
      border-bottom: 1px solid var(--border-color);
    }

    .tab-button {
      border-left: none;
      border-bottom: 2px solid transparent;

      &.active {
        border-bottom-color: var(--accent);
      }
    }
  }

  .nf-main {
    grid-template-columns: 1fr;
  }

  .nf-main .letter-grid-container {
    padding-top: 3rem;
  }

  .nf-main .error-section {
    padding-bottom: 0;
    padding-top: 3rem;
  }
}

@media (max-width: 700px) {
  .container {
    padding: 0 0.5rem;
  }

  .header {
    min-height: 40px;

    .header-flex {
      flex-direction: row;
      gap: 0;
      min-height: 40px;
    }

    .logo,
    .header-center {
      display: none !important;
    }

    .header-right.icon-links {
      justify-content: flex-end;
      width: 100%;
    }
  }

  .hero-banner {
    .banner-content {
      h1 {
        font-size: 1.8rem;
        min-height: 3rem;
      }

      .bio {
        font-size: 1rem;
      }
    }
  }

  /* Reduce spacing between sections on mobile */
  .about-section,
  .experience-section,
  .projects-section {
    padding: 2rem 0;
  }

  .footer {
    padding: 2rem 0;
  }

  .go-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;

    svg {
      width: 18px;
      height: 18px;
    }
  }

  .error-content {
    h1 {
      font-size: 6rem;
    }

    h2 {
      font-size: 2rem;
    }

    p {
      font-size: 1rem;
    }
  }

  .error-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
}
