/* Base Variables */
:root {
  --primary-color: #751313;
  --primary-light: #9a2d2d;
  --primary-dark: #4d0c0c;
  --secondary-color: #ff6b6b;
  --secondary-dark: #ff3838;
  --bg-color: #f8f9fa;
  --text-color: #2d3436;
  --card-bg: #ffffff;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --gradient-primary: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  --section-spacing: 4rem;
  --card-radius: 20px;
  --shadow-normal: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] {
  --primary-color: #9a2d2d;
  --primary-light: #b64545;
  --primary-dark: #3a0909;
  --secondary-color: #ff5252;
  --secondary-dark: #ff2626;
  --bg-color: #121212;
  --text-color: #ececec;
  --card-bg: #1a1a1a;
  --shadow-normal: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: var(--transition);
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  flex: 1;
}

/* Header Styles */
.header {
  text-align: center;
  padding: var(--section-spacing) 0;
  position: relative;
}

.title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--primary-color);
  margin-bottom: 1rem;
  transform: translateY(30px);
  opacity: 0;
  animation: slideInUp 0.8s forwards;
  line-height: 1.2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  color: var(--text-color);
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
  font-size: clamp(1rem, 2vw, 1.2rem);
  transform: translateY(30px);
  opacity: 0;
  animation: slideInUp 0.8s 0.2s forwards;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 2rem;
  padding: var(--section-spacing) 0;
}

.project-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-normal);
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s forwards;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.project-image {
  position: relative;
  border-radius: calc(var(--card-radius) / 2);
  overflow: hidden;
  height: 220px;
  margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.8) 100%
  );
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.project-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card h3 {
  color: var(--primary-color);
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  gap: 0.8rem;
  align-items: center;
  display: flex;
}

.project-card p {
  color: var(--text-color);
  margin-bottom: 1rem;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.project-links {
  margin: auto 0 1rem 0;
  gap: 0.75rem;
  display: flex;
  flex-wrap: wrap;
}

.project-links a {
  color: var(--secondary-color);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--secondary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.project-links a:hover {
  background: var(--secondary-color);
  color: var(--bg-color);
  transform: translateY(-2px);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.tag {
  background: rgba(117, 19, 19, 0.1);
  color: var(--primary-color);
  padding: 0.4rem 1rem;
  border-radius: 25px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(117, 19, 19, 0.2);
  transition: all 0.3s ease;
}

.tag:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

/* Portfolio CTA Styles */
.portfolio-cta {
  padding: var(--section-spacing) 0;
  text-align: center;
  background: rgba(117, 19, 19, 0.05);
  margin-top: 2rem;
  border-radius: var(--card-radius);
}

.cta-content {
  max-width: 600px;
  margin: 0 auto;
}

.cta-content h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

.cta-content p {
  color: var(--text-color);
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--gradient-primary);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-normal);
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.cta-button i {
  transition: transform 0.3s ease;
}

.cta-button:hover i {
  transform: translateX(3px);
}

/* Footer Styles */
footer {
  background: var(--card-bg);
  padding: var(--section-spacing) 0;
  margin-top: 2rem;
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.contact-info div {
  padding: 1rem;
  background: rgba(117, 19, 19, 0.05);
  border-radius: var(--card-radius);
  opacity: 0;
  transform: translateX(-30px);
  animation: slideInLeft 0.8s forwards;
}

.contact-info h4 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.contact-info a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.95rem;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-normal);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  transition: all 0.3s ease;
}

.theme-icon {
  position: absolute;
  font-size: 1.2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.light-icon {
  opacity: 0;
  transform: rotate(-180deg);
}

[data-theme='dark'] .dark-icon {
  opacity: 0;
  transform: rotate(180deg);
}

[data-theme='dark'] .light-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: var(--primary-light);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation Delays */
.project-card:nth-child(1) {
  animation-delay: 0.2s;
}
.project-card:nth-child(2) {
  animation-delay: 0.3s;
}
.project-card:nth-child(3) {
  animation-delay: 0.4s;
}
.project-card:nth-child(4) {
  animation-delay: 0.5s;
}
.project-card:nth-child(5) {
  animation-delay: 0.6s;
}
.contact-info div:nth-child(1) {
  animation-delay: 0.2s;
}
.contact-info div:nth-child(2) {
  animation-delay: 0.3s;
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --section-spacing: 3rem;
  }

  .container {
    padding: 0 1.5rem;
  }

  .project-image {
    height: 200px;
  }

  .project-card {
    padding: 1.25rem;
  }

  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  :root {
    --section-spacing: 2rem;
  }

  .project-image {
    height: 180px;
    margin: -1.25rem -1.25rem 1.25rem -1.25rem;
  }

  .project-links a {
    width: 100%;
    justify-content: center;
  }

  .contact-info {
    grid-template-columns: 1fr;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

/* Print Styles */
@media print {
  .theme-toggle {
    display: none;
  }

  .project-card {
    break-inside: avoid;
  }
}
