/* --- Base Styles & Loader --- */
.loader {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #f5f7fa; display: flex; justify-content: center;
  align-items: center; z-index: 9999; opacity: 1; visibility: visible;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-circle {
  width: 50px; height: 50px; border: 5px solid rgba(10, 89, 247, 0.2);
  border-top-color: #0a59f7; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- CSS Variables --- */
:root {
  --primary-color: #0a59f7;
  --text-color: #333;
  --text-light: #555;
  --card-bg: rgba(255, 255, 255, 0.9);
  --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.05);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 35px rgba(10, 89, 247, 0.15);
  --mouse-x: 50%;
  --mouse-y: 50%;
}

html { scroll-behavior: smooth; }

@keyframes animatedGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body {
  font-family: 'HarmonyOS Sans', -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
    'Helvetica Neue', sans-serif;
  margin: 0; padding: 0; color: var(--text-color); line-height: 1.7;
  overflow-x: hidden; min-height: 100vh;
  background:
    radial-gradient(
      circle 400px at var(--mouse-x) var(--mouse-y),
      rgba(255, 255, 255, 0.2) 0%,
      transparent 80%
    ),
    linear-gradient( 135deg, #eaf0f9, #dce7f7, #eaf0f9 );
  background-size: 100% 100%, 200% 200%;
  background-position: 0 0, 0 0;
  background-repeat: no-repeat, repeat;
  animation: animatedGradient 15s ease infinite;
  transition: overflow 0.3s ease;
}
body.no-scroll { overflow: hidden; }

/* --- Top Navigation --- */
.navbar {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: var(--shadow-light);
  padding: 10px 25px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.navbar .nav-link {
  background: var(--primary-color);
  color: white !important;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: var(--shadow-light);
  transform: translateZ(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s ease, background-color 0.3s ease;
  margin: 5px;
  text-align: center;
}

.navbar .nav-link.lang-switch {
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color) !important;
}

.navbar .nav-link:hover {
  transform: translateY(-2px) scale(1.05) translateZ(5px);
  box-shadow: var(--shadow-medium);
  background-color: #084ac8;
}

.navbar .nav-link.lang-switch:hover {
  background-color: var(--primary-color);
  color: white !important;
}

.navbar-toggler {
  border: none;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  transition: background-image 0.3s ease-in-out;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M6 6L24 24M6 24L24 6'/%3e%3c/svg%3e");
}

/* --- Header --- */
header {
  background: transparent;
  color: var(--text-color); text-align: center;
  padding: 120px 20px 60px;
  position: relative; overflow: hidden;
}
@keyframes fadeInUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
header img {
  border-radius: 50%; width: 130px; height: 130px; object-fit: cover;
  border: 5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-medium); opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards; animation-delay: 0.2s;
  transform: translateZ(0);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s ease;
}
header img:hover {
  transform: scale(1.1); box-shadow: var(--shadow-hover);
}
header h1 {
  margin-top: 15px; font-size: 2.5rem; letter-spacing: 1.5px;
  font-weight: 700; opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards; animation-delay: 0.4s;
  /* Removed transition for language switch */
  /* will-change: opacity; NO LONGER NEEDED */
  min-height: 1.2em; /* Prevent layout shift during typing */
}
header p {
  font-size: 1.1rem; margin-top: 10px; color: var(--text-light);
  opacity: 0; animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: 0.6s;
  /* Removed transition for language switch */
   /* will-change: opacity; NO LONGER NEEDED */
   min-height: 1.2em; /* Prevent layout shift during typing */
}

/* --- Content & Sections --- */
.container {
  max-width: 1200px; margin: 40px auto; padding: 0 20px;
   /* Removed transition for language switch */
  /* will-change: opacity; NO LONGER NEEDED */
}
.section {
  background: transparent; border-radius: 15px; margin-bottom: 40px;
  overflow: visible;
}
.section-header {
  background: var(--primary-color); color: white; padding: 20px;
  font-size: 1.8rem; text-align: center; position: relative;
  border-radius: 15px 15px 0 0; margin-bottom: 30px; font-weight: 600;
  box-shadow: 0 4px 10px rgba(10, 89, 247, 0.2); opacity: 0;
  transform: translateY(20px);
  min-height: 1.2em; /* Prevent layout shift during typing */
}
.section-header.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease-out 0.1s, transform 0.8s ease-out 0.1s;
}
.section-content { padding: 0px; }

/* Removed .content-hidden class */

/* --- Harmony Cards --- */
.harmony-card {
  background: var(--card-bg);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  border: none;
  box-shadow: var(--shadow-medium);
  text-align: center;
  opacity: 0;
  transform: translateY(40px) translateZ(0);
  transform-style: preserve-3d;
  transition: opacity 0.6s ease-out, transform 0.4s ease-out,
              box-shadow 0.3s ease;
}
.harmony-card.is-visible { opacity: 1; transform: translateY(0) translateZ(0); }
.harmony-card:hover {
  transform: translateY(-8px) scale(1.03); box-shadow: var(--shadow-hover);
}
.harmony-card .card-img-top {
  max-height: 180px;
  object-fit: contain;
  padding: 15px;
}
.harmony-card h3 {
  font-size: 1.3rem; margin-bottom: 12px; color: var(--primary-color);
  font-weight: 600; transform: translateZ(20px);
  min-height: 1.2em; /* Prevent layout shift during typing */
}
.harmony-card p {
  font-size: 1rem; margin-bottom: 20px; color: var(--text-light);
  min-height: 4em; /* Keep this for layout */
  flex-grow: 1;
}
.harmony-card .tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 15px; margin-bottom: 20px; transform: translateZ(10px);
   min-height: 1.5em; /* Prevent layout shift during typing */
}
.harmony-card .tag {
  background: rgba(10, 89, 247, 0.1); color: var(--primary-color);
  padding: 6px 12px; border-radius: 15px; font-size: 0.8rem;
  font-weight: 500; display: inline-block;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}
.harmony-card .tag:hover {
  background: var(--primary-color); color: white; transform: scale(1.05);
}

/* --- Buttons & Links --- */
button.project-btn, a.contact-btn-link {
  background: var(--primary-color); color: white !important; border: none;
  padding: 10px 22px; border-radius: 20px; cursor: pointer;
  font-size: 1rem; font-weight: 500; box-shadow: var(--shadow-light);
  text-decoration: none; display: inline-block; text-align: center;
  transform: translateZ(30px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s ease, background-color 0.3s ease;
  min-height: 1.2em; /* Prevent layout shift during typing */
  vertical-align: middle; /* Align better if height changes slightly */
}
button.project-btn { margin-top: auto; align-self: center; }
button.project-btn:disabled {
  background-color: #cccccc; color: #666666 !important; cursor: not-allowed;
  box-shadow: none; transform: translateZ(0);
}
button.project-btn:disabled:hover { background-color: #cccccc; transform: none; }
button.project-btn:hover:not(:disabled), a.contact-btn-link:hover {
  transform: translateY(-2px) scale(1.05) translateZ(30px);
  box-shadow: var(--shadow-medium); background-color: #084ac8;
  color: white !important;
}
button.project-btn:active:not(:disabled), a.contact-btn-link:active {
  transform: scale(0.98) translateZ(30px); box-shadow: var(--shadow-light);
}
button.project-btn:focus-visible:not(:disabled), a.contact-btn-link:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 2px;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease, backdrop-filter 0.4s ease;
  perspective: 800px;
}
.modal-content {
  background: rgba(255, 255, 255, 0.85);
  padding: 30px 40px; border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); max-width: 600px;
  width: 90%; position: relative;
  transform: scale(0.9) rotateX(-10deg) translateY(20px); opacity: 0;
  transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.35s ease;
  text-align: center;
}
.modal-close-btn {
  position: absolute; top: 10px; right: 15px; background: none;
  border: none; font-size: 1.8rem; color: var(--text-light);
  cursor: pointer; padding: 5px; line-height: 1;
  transition: color 0.3s ease, transform 0.3s ease;
}
.modal-close-btn:hover {
  color: var(--text-color); transform: rotate(90deg) scale(1.1);
}
.modal-content h2 {
  margin-top: 0; margin-bottom: 25px; color: var(--primary-color);
  text-align: center; min-height: 1.2em; /* Prevent layout shift */
}
#about-modal .modal-content h3 {
    margin-top: 25px; margin-bottom: 10px; color: var(--primary-color);
    font-size: 1.2rem; text-align: left; min-height: 1.2em;
}
#about-modal .modal-content p {
    margin-bottom: 15px; line-height: 1.8; text-align: left; min-height: 1.2em;
}
#about-modal .modal-content ul {
    list-style: disc; padding-left: 25px; margin-bottom: 20px; text-align: left;
}
#about-modal .modal-content li {
    margin-bottom: 8px; color: var(--text-light); min-height: 1.2em;
}
#contact-modal .modal-content .contact-links {
    display: flex; flex-direction: column; align-items: center;
    gap: 20px; margin-top: 20px; margin-bottom: 15px;
}
#contact-modal .modal-content a.contact-btn-link {
    min-width: 200px; transform: translateZ(0);
}
#contact-modal .modal-content a.contact-btn-link:hover { transform: translateY(-2px) scale(1.05); }
#contact-modal .modal-content a.contact-btn-link:active { transform: scale(0.98); }
.modal-overlay.modal-visible { opacity: 1; visibility: visible; }
.modal-overlay.modal-visible .modal-content {
  transform: scale(1) rotateX(0deg) translateY(0); opacity: 1;
}

/* --- Footer & Responsive --- */
footer {
  text-align: center; padding: 30px 20px; margin-top: 50px;
  color: var(--text-light); font-size: 0.9rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}
footer span[data-lang-key] {
    display: inline-block; /* Helps with min-height */
    min-height: 1.2em; /* Prevent layout shift */
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid rgba(0,0,0,0.08);
  }
}

@media (max-width: 768px) {
  body {
    background: linear-gradient( 135deg, #eaf0f9, #dce7f7, #eaf0f9 );
    background-size: 200% 200%; animation: animatedGradient 15s ease infinite;
  }
  header { padding-top: 100px; padding-bottom: 40px; }
  header h1 { font-size: 2rem; }
  header p { font-size: 1rem; }
  header img { width: 110px; height: 110px; }
  .container { margin-top: 20px; }
  .section-header { font-size: 1.5rem; padding: 15px; margin-bottom: 20px; }
  .harmony-card {
    padding: 20px; min-height: auto; transform: translateY(0) translateZ(0);
    transform-style: flat;
  }
  .harmony-card.is-visible { opacity: 1; transform: translateY(0); }
  .harmony-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: var(--shadow-medium); }
  .harmony-card h3 { transform: none; }
  .harmony-card p { min-height: auto; } /* Reset card paragraph min-height */
  .harmony-card .tags { transform: none; gap: 6px; }
  .harmony-card .tag { padding: 5px 10px; font-size: 0.75rem; }
  button.project-btn, a.contact-btn-link {
      transform: none; padding: 9px 20px; font-size: 0.95rem;
  }
  button.project-btn:hover:not(:disabled), a.contact-btn-link:hover { transform: translateY(-2px) scale(1.04); }
  button.project-btn:active:not(:disabled), a.contact-btn-link:active { transform: scale(0.98); }
  .modal-content {
    padding: 25px 20px; width: 90%; transform: scale(0.95) translateY(10px);
    max-height: 80vh; overflow-y: auto;
  }
  .modal-overlay.modal-visible .modal-content { transform: scale(1) translateY(0); }
  .modal-close-btn { top: 5px; right: 10px; font-size: 1.5rem; }
  .modal-content h2 { font-size: 1.5rem; }
  #about-modal .modal-content h3 { font-size: 1.1rem; }
  #about-modal .modal-content ul { padding-left: 20px; }
  #contact-modal .modal-content a.contact-btn-link { min-width: 180px; }
} /* End Media Query */

/* Blinking cursor for typewriter effect */
.typewriter-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  margin-left: 2px; /* Space between text and cursor */
  /* Consider adjusting color/size */
  color: var(--primary-color);
  font-weight: bold;
}
@keyframes blink {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}
