/* ==========================================================================
   Shared Button Styles
   ========================================================================== */

.btn-circle {
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--footer-text);
  cursor: pointer;
  display: flex;
  font-size: 1.1rem;
  height: 40px;
  justify-content: center;
  position: relative;
  text-decoration: none;
  transition: all 0.3s ease;
  width: 40px;
  z-index: 1000;
}

.btn-circle:hover {
  background: var(--social-bg);
  box-shadow: 0 4px 12px var(--card-shadow);
  color: var(--text-color);
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-circle:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.btn-circle:active {
  transform: translateY(-1px);
  transition: all 0.1s ease;
}

[data-theme='dark'] .btn-circle {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .btn-circle:hover {
  background: var(--social-bg);
  box-shadow: 0 4px 12px var(--card-shadow);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* CSS Custom Properties for theming */
:root {
  /* Light mode colors */
  --bg-gradient-end: rgba(255, 189, 6, 0.15);
  --bg-gradient-middle: rgba(253, 118, 36, 0.2);
  --bg-gradient-start: rgba(255, 160, 16, 0.15);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(0, 0, 0, 0.2);
  --card-shadow: rgba(0, 0, 0, 0.1);
  --footer-border: rgba(0, 0, 0, 0.1);
  --footer-text: rgba(51, 51, 51, 0.7);
  --primary-color: #ffa010;
  --primary-hover: #e68a00;
  --social-bg: rgba(255, 255, 255, 0.8);
  --social-border: rgba(0, 0, 0, 0.05);
  --social-color: #666;
  --text-color: #333;
}

[data-theme='dark'] {
  /* Dark mode colors - blueish theme for better visual appeal */
  --bg-gradient-end: rgba(51, 65, 85, 0.8);
  --bg-gradient-middle: rgba(30, 41, 59, 0.9);
  --bg-gradient-start: rgba(15, 23, 42, 0.8);
  --card-bg: rgba(15, 23, 42, 0.95);
  --card-border: rgba(59, 130, 246, 0.2);
  --card-shadow: rgba(0, 0, 0, 0.4);
  --footer-border: rgba(255, 255, 255, 0.1);
  --footer-text: rgba(241, 245, 249, 0.7);
  --primary-color: #ffa010;
  --primary-hover: #e68a00;
  --social-bg: rgba(30, 41, 59, 0.8);
  --social-border: rgba(59, 130, 246, 0.2);
  --social-color: #cbd5e1;
  --text-color: #f1f5f9;
}

body {
  background: linear-gradient(
    135deg,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-middle) 50%,
    var(--bg-gradient-end) 100%
  );
  color: var(--text-color);
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.sr-only {
  border: 0 !important;
  clip: rect(0, 0, 0, 0) !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.sr-only:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  border: 1px solid #007bff !important;
  background: #fff !important;
  color: #000 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 9999 !important;
}

/* Skip links for keyboard navigation */
.skip-link {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  color: var(--text-color);
  left: 6px;
  padding: 8px;
  position: absolute;
  text-decoration: none;
  top: -40px;
  transition: top 0.3s ease;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
}

.skip-link:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
  top: 6px;
  opacity: 1;
  pointer-events: auto;
}

/* Focus styles for better keyboard navigation */
a:focus,
button:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Ensure focus is visible on all interactive elements */
.social-link:focus,
.footer-social-link:focus,
.theme-toggle:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.main-container {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  contain: layout style paint;
  will-change: auto;
}

.content-wrapper {
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

.projects-section {
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

/* ==========================================================================
   Logo Section
   ========================================================================== */

.logo-section {
  margin-bottom: 2rem;
  padding-top: 20px;
}

.logo-img {
  height: auto;
  max-width: 300px;
  transition: transform 0.3s ease;
  width: 100%;
  /* Responsive logo sizing */
  display: block;
  margin: 0 auto;
  aspect-ratio: 300/85;
  contain: layout style paint;
}

.logo-img:hover {
  transform: translateY(-2px);
}

/* Dark mode logo enhancements for better contrast */
[data-theme='dark'] .logo-img {
  filter: drop-shadow(0 4px 32px rgba(255, 255, 255, 0.55));
}

/* ==========================================================================
   Projects Grid
   ========================================================================== */

.projects-container {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  min-height: 600px;
  contain: layout style paint;
}

/* ==========================================================================
   Project Cards
   ========================================================================== */

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  position: relative;
  transition: all 0.3s ease;
}

/* Cards with transparent images need a light background */
.project-card.has-transparent-image {
  background: rgba(255, 255, 255, 1) !important;
}

/* [data-theme='dark'] .project-card.has-transparent-image {
  background: rgba(15, 23, 42, 1) !important;
} */

.project-card:hover {
  background: var(--card-bg);
  box-shadow: 0 12px 40px var(--card-shadow);
  transform: translateY(-4px);
}

/* Transparent image cards should keep their light background on hover */
.project-card.has-transparent-image:hover {
  background: rgba(255, 255, 255, 1) !important;
}

[data-theme='dark'] .project-card.has-transparent-image:hover {
  background: rgba(15, 23, 42, 1) !important;
}

/* Hero Image Cards */
.project-card.has-hero-image {
  color: var(--text-color);
}

.project-card.has-hero-image .project-content {
  margin-bottom: 16px;
}

.project-card.has-hero-image .project-title {
  color: var(--text-color);
  text-shadow: none;
}

.project-card.has-hero-image .project-description {
  color: var(--text-color);
  opacity: 0.8;
  text-shadow: none;
}

.project-card.has-hero-image .project-footer {
  border-top: 1px solid var(--card-border);
}

.project-card.has-hero-image .social-link {
  background: var(--social-bg);
  color: var(--social-color);
}

.project-card.has-hero-image .social-link:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* ==========================================================================
   Hero Images
   ========================================================================== */

.hero-link {
  display: block;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.hero-link:hover {
  transform: scale(1.02);
}

/* Add background to hero links for transparent images */
.project-card.has-transparent-image .hero-link {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px 12px 0 0;
  padding: 1rem;
}

[data-theme='dark'] .project-card.has-transparent-image .hero-link {
  background: rgba(15, 23, 42, 0.9);
}

.project-hero-image {
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  height: 200px;
  margin-bottom: 16px;
  object-fit: contain;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
  width: 100%;
  aspect-ratio: 400/225;
  /* Solid white background for all hero images */
  background-color: white;
}

/* Transparent images should use contain instead of cover to avoid cropping */
.project-card.has-transparent-image .project-hero-image {
  object-fit: contain;
  background-color: rgba(255, 255, 255, 0.8);
}

[data-theme='dark'] .project-card.has-transparent-image .project-hero-image {
  background-color: rgba(15, 23, 42, 0.8);
}

/* Ensure white background for all hero images in both light and dark themes */
[data-theme='dark'] .project-hero-image {
  background-color: white;
}

/* Loading animation */
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Progressive enhancement - hide loading when image is loaded */
.project-hero-image {
  /* Start with loading state */
  opacity: 0.8;
}

/* When image is loaded, show it properly */
.project-hero-image:not([src='']) {
  animation: none;
  background: white;
  opacity: 1;
}

/* Alternative: use focus-within to detect when image container is active */
.project-card:focus-within .project-hero-image {
  animation: none;
  background: white;
  opacity: 1;
}

/* Progressive enhancement for images */
.project-hero-image {
  transition: opacity 0.3s ease;
  will-change: opacity;
  /* Optimize for progressive loading */
  contain: layout style paint;
}

/* Ensure proper sizing for responsive images */
@media (max-width: 480px) {
  .project-hero-image {
    height: 150px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .project-hero-image {
    height: 180px;
  }
}

@media (min-width: 769px) {
  .project-hero-image {
    height: 200px;
  }
}

.project-hero-image:hover {
  transform: scale(1.02);
}

/* ==========================================================================
   Project Content
   ========================================================================== */

.project-content {
  flex: 1;
  margin-bottom: 20px;
  text-align: center;
}

.project-title {
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 600;
  hyphens: none;
  margin-bottom: 12px;
  overflow-wrap: break-word;
  word-break: keep-all;
}

.project-description {
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 400;
  hyphens: none;
  line-height: 1.5;
  margin-bottom: 0;
  opacity: 0.8;
  overflow-wrap: break-word;
  text-align: left;
  word-break: keep-all;
}

.city-name {
  display: inline-block;
  white-space: nowrap;
}

/* ==========================================================================
   Social Links
   ========================================================================== */

.project-footer {
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding-top: 16px;
  text-align: center;
}

/* ==========================================================================
   Link Buttons (used for both cards and footer)
   ========================================================================== */

.link-button {
  font-size: 1.2rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer-section {
  margin-top: 1rem;
  padding: 3rem 0 2rem 0;
}

.footer-container {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 20px;
}

.footer-main {
  border-top: 1px solid var(--footer-border);
  display: grid;
  gap: 4rem;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 2rem;
  padding-top: 2rem;
}

.footer-main {
  display: grid;
  gap: 4rem;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 2rem;
}

.footer-about {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-title {
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.footer-description {
  color: var(--footer-text);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
  opacity: 0.8;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-contact-title {
  color: var(--text-color);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.footer-social-links {
  display: flex;
  gap: 1rem;
}

.footer-social-link {
  font-size: 1.2rem;
}

.footer-bottom {
  border-top: 1px solid var(--footer-border);
  padding-top: 1.5rem;
}

.footer-bottom-content {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  text-align: left;
}

/* Button container for theme toggle and PWA install */
.footer-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Responsive adjustments for footer buttons */
@media (max-width: 480px) {
  .footer-bottom-content {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .footer-buttons {
    margin-left: 0;
    justify-content: center;
  }

  .footer-author {
    text-align: center;
  }
}

.footer-author {
  color: var(--footer-text);
  font-size: 0.9rem;
  font-weight: 400;
  margin: 0;
  opacity: 0.7;
  text-align: left;
}

.footer-author a {
  color: var(--text-color);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-author a:hover {
  color: var(--footer-text);
  text-decoration: none;
}

.theme-toggle {
  /* Inherits all styles from .btn-circle */
}

/* Theme toggle icons */
.light-icon {
  display: block;
}

.dark-icon {
  display: none;
}

[data-theme='dark'] .light-icon {
  display: none;
}

[data-theme='dark'] .dark-icon {
  display: block;
}

/* ==========================================================================
   PWA Install Button
   ========================================================================== */

.pwa-install-btn {
  /* Inherits all styles from .btn-circle */
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.projects-container .project-card {
  animation: fadeInUp 0.8s ease-out;
  animation-fill-mode: both;
}

.projects-container .project-card:nth-child(1) {
  animation-delay: 0.1s;
}
.projects-container .project-card:nth-child(2) {
  animation-delay: 0.2s;
}
.projects-container .project-card:nth-child(3) {
  animation-delay: 0.3s;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Extra Small (xs) */
@media (max-width: 480px) {
  .container-fluid {
    padding: 15px;
  }

  .logo-img {
    max-width: 150px;
    width: 150px;
  }

  .projects-container {
    gap: 12px;
  }

  .project-card {
    padding: 16px;
  }
  .project-title {
    font-size: 1.2rem;
  }
  .project-footer {
    gap: 10px;
    padding-top: 10px;
  }
  .link-button {
    font-size: 0.9rem;
    height: 32px;
    width: 32px;
  }

  .footer-main {
    gap: 2rem;
    grid-template-columns: 1fr;
  }

  .footer-bottom-content {
    align-items: center;
    flex-direction: row;
    gap: 1rem;
    justify-content: space-between;
    text-align: left;
  }

  .footer-author {
    text-align: left;
  }
}

/* Small (sm) */
@media (min-width: 481px) and (max-width: 767px) {
  .logo-img {
    max-width: 200px;
    width: 200px;
  }

  .projects-container {
    gap: 15px;
  }
  .project-card {
    padding: 20px;
  }
  .project-title {
    font-size: 1.3rem;
  }
  .project-footer {
    gap: 12px;
    padding-top: 12px;
  }
  .link-button {
    font-size: 1rem;
    height: 36px;
    width: 36px;
  }
}

/* Medium (md) */
@media (min-width: 768px) and (max-width: 991px) {
  .container-fluid {
    max-width: 900px;
  }

  .logo-img {
    max-width: 300px;
    width: 300px;
  }

  .projects-container {
    gap: 18px;
    grid-template-columns: repeat(2, 1fr);
  }

  .project-hero-image {
    height: 220px;
  }

  .footer-bottom-content {
    text-align: center;
  }

  .footer-author {
    text-align: center;
  }
}

/* Large (lg) */
@media (min-width: 992px) and (max-width: 1439px) {
  .container-fluid {
    max-width: 1000px;
  }

  .projects-container {
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
  }

  .project-card {
    padding: 16px;
  }
  .project-card .project-content {
    margin-bottom: 12px;
  }
  .project-card .project-footer {
    padding-top: 12px;
  }

  .logo-img {
    max-width: 400px;
    width: 400px;
  }
}

/* Extra Large (xl) */
@media (min-width: 1440px) {
  .container-fluid {
    max-width: 1400px;
  }

  .projects-container {
    gap: 24px;
    grid-template-columns: repeat(3, 1fr);
  }

  .project-card {
    padding: 20px;
  }

  .logo-img {
    max-width: 500px;
    width: 500px;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  body {
    background: white;
    color: black;
  }

  .project-card {
    background: white;
    border: 1px solid #ddd;
    color: black;
  }

  .link-button {
    background: white;
    border: 1px solid #ddd;
    color: black;
  }
}
