/* ==============================================================
   CSS Variables
============================================================== */
:root {
  /* Colors */
  --color-primary: #2c3e50;
  --color-secondary: #3498db;
  --color-unimportant: #bdc3c7;
  --color-accent: #e74c3c;
  --color-background: #f9f9f9;
  --color-text: #333;
  --color-light: #ecf0f1;
  --color-muted: #7f8c8d;
  --color-border: #bdc3c7;

  /* Font */
  --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 15px rgba(0, 0, 0, 0.1);

  /* Transition */
  --transition-fast: 0.2s ease-in-out;
  --transition-medium: 0.3s ease;
}

/* ==============================================================
   Global Styles
============================================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==============================================================
   Header
============================================================== */
header {
  background-color: var(--color-primary);
  color: var(--color-light);
  padding: var(--spacing-md) 0;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 0.25rem;
  font-weight: bold;
  line-height: 1.2;
}

header p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  margin: 0;
}

/* ==============================================================
   Container
============================================================== */
.container {
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--spacing-sm);
}

/* ==============================================================
   Sections
============================================================== */
section {
  margin: var(--spacing-xl) 0;
}

h2 {
  margin-bottom: var(--spacing-md);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--color-primary);
}

/* ==============================================================
   About Section
============================================================== */
.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

@media (min-width: 768px) {
  .about-content {
    flex-direction: row;
    text-align: left;
    gap: 30px;
  }
}

.headshot {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background-color: var(--color-border);
}

@media (min-width: 768px) {
  .headshot {
    width: 150px;
    height: 150px;
  }
}

.about-text {
  flex-grow: 1;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--color-primary);
}

/* ==============================================================
   Work Experience Section
============================================================== */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  justify-items: center; /* Center the work cards */
}

@media (min-width: 768px) {
  .work-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    justify-items: center; /* Ensure centering on larger screens */
  }
}

.work-item {
  background-color: #fff;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-align: center;
  width: 100%;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.work-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.logo-container {
  background-color: #1b1b1b;
  padding: 10px;
  border-radius: 12px;
  width: 100%;
  height: 100px;
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.work-thumbnail {
  width: 90%;
  max-width: 250px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

.work-item h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  color: var(--color-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.work-item p {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.work-item ul {
  list-style-type: disc;
  padding-left: var(--spacing-md);
}

.work-item ul li {
  margin-bottom: 8px;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  text-align: left;
}

/* ==============================================================
   Projects Section
============================================================== */
.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 992px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 30px;
  }
}

.project-item {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-align: left;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.project-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.project-thumbnail-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.project-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 15px;
  opacity: 0; /* Start invisible */
  transition: opacity 0.5s ease; /* Smooth fade-in effect */
}

@media (min-width: 768px) {
  .project-thumbnail {
    height: 280px;
  }
}

.project-item h3 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-bottom: 10px;
  font-weight: bold;
}

.project-item p {
  font-size: 1rem;
  color: var(--color-muted);
}

.project-details {
  display: flex;
  flex-direction: column;
  margin: 0px 7px 15px;
}

.project-summary {
  margin-top: 10px;
  padding: 0;
  text-align: left;
  font-size: 0.9rem;
  color: #555;
}

.project-summary ul {
  list-style-type: disc;
  padding-left: var(--spacing-md);
  margin-bottom: 10px;
}

.project-summary li {
  margin-bottom: 5px;
}

/* ==============================================================
   Tags
============================================================== */
.tag-group-1 {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-group-1 p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tag-group-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-left: 7px;
}

/* NEW: make dynamic tag containers use flex gap */
#core-tags,
#systems-tags,
#skills-tags,
#learning-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag1 {
  background-color: var(--color-secondary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-block;
  transition: background-color 0.2s ease;
}

.tag2 {
  background-color: var(--color-unimportant);
  color: #2c3e50;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  display: inline-block;
  transition: background-color 0.2s ease;
}

.tag3 {
  background: var(--color-secondary);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.last-updated {
  font-size: 0.8rem;
  color: #666;
  margin-left: 1rem;
}

/* ==============================================================
   Engine Badge
============================================================== */
.engine-badge {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 0% 100%, 100% 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.engine-badge img {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 6px;
  left: 6px;
  filter: brightness(0) invert(1);
}

/* ==============================================================
   Links
============================================================== */
a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #2980b9; /* slightly darker */
  text-decoration: underline;
}

/* ==============================================================
   Footer
============================================================== */
footer {
  background-color: var(--color-primary);
  color: var(--color-light);
  text-align: center;
  padding: 1.5rem;
  margin-top: var(--spacing-xl);
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* ==============================================================
   Loading Spinner
============================================================== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--color-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

.loading-spinner-card {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--color-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

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

/* ==============================================================
   Sticky Header
============================================================== */
.sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--color-primary);
  transform: translateY(-100%);
  transition: transform var(--transition-medium);
  z-index: 1000;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-header.visible {
  transform: translateY(0);
}

.sticky-header .name {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 500;
}

.sticky-header .socials {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.sticky-header .social-icon {
  color: #fff;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
  width: 24px;
  height: 24px;
}

.sticky-header .social-icon:hover {
  opacity: 1;
}
