@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  /* Elegant Dark mode - Deeper & Richer */
  --bg-color: #0a0a0a;
  --text-color: #e0e0e0;
  --nav-bg: rgba(10, 10, 10, 0.85);
  --link-color: #e2c08d;
  /* Muted Gold */
  --link-hover: #f0d5a3;
  --card-bg: rgba(25, 25, 25, 0.6);
  --btn-bg: rgba(226, 192, 141, 0.1);
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --active-indicator: #e2c08d;
  --tooltip-bg: rgba(15, 15, 15, 0.95);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --primary-color: #e2c08d;
  --secondary-color: #c5a065;
  --gradient-bg: radial-gradient(circle at top center, #1a1a1a 0%, #0a0a0a 100%);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Elegant Light mode - Soft & Clean */
body.light-mode {
  --bg-color: #f5f5f7;
  --text-color: #1d1d1f;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --link-color: #8c7a58;
  --link-hover: #6b5d43;
  --card-bg: rgba(255, 255, 255, 0.7);
  --btn-bg: rgba(140, 122, 88, 0.1);
  --active-indicator: #8c7a58;
  --tooltip-bg: rgba(255, 255, 255, 0.95);
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(0, 0, 0, 0.05);
  --primary-color: #8c7a58;
  --secondary-color: #a67c52;
  --gradient-bg: radial-gradient(circle at top center, #ffffff 0%, #f0f0f2 100%);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
}

nav {
  background: var(--nav-bg);
  padding: 1.2em 2em;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  margin-left: 2em;
}

.nav-menu {
  display: flex;
  align-items: center;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1em;
}

nav a {
  position: relative;
  margin-right: 2em;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5em 1em;
  border-radius: 4px;
  opacity: 0.8;
}

nav a:hover {
  color: var(--link-color);
  background: rgba(138, 180, 248, 0.05);
  opacity: 1;
}

nav a.active {
  color: var(--link-color);
  background: rgba(138, 180, 248, 0.08);
  font-weight: 500;
  opacity: 1;
}

nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 10%;
  width: 80%;
  height: 2px;
  background: var(--link-color);
  border-radius: 2px;
  opacity: 0.8;
  transform: translateY(2px);
  transition: var(--transition);
}

nav a:hover::after {
  opacity: 0.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2em;
}

.card {
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 2.5em;
  margin: 1.5em auto;
  max-width: 900px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  background-color: var(--nav-bg);
}

h1 {
  font-weight: 600;
  margin-top: 0;
  font-size: 2.4em;
  color: var(--text-color);
  letter-spacing: -0.03em;
  background: none;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: unset;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 14px 32px;
  background: var(--btn-bg);
  border: 1px solid var(--glass-border);
  color: var(--link-color);
  text-decoration: none;
  border-radius: 50px;
  /* Pill shape */
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* Removed excessive ::after swipe animation */

.btn:hover {
  background: rgba(226, 192, 141, 0.15);
  /* Subtle tint increase */
  border-color: var(--link-color);
  color: var(--link-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
  /* Soft elegant glow */
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

#theme-toggle {
  background: transparent;
  border: 1px solid var(--link-color);
  color: var(--link-color);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.8;
}

#theme-toggle:hover {
  background: rgba(138, 180, 248, 0.1);
  opacity: 1;
}

.diagram-container {
  margin: 2em 0;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.diagram-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 aspect ratio */
  height: 0;
  background: var(--bg-color);
}

.diagram-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.diagram-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.diagram-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--card-bg);
}

.diagram-error {
  padding: 2em;
  text-align: center;
  background: rgba(255, 0, 0, 0.1);
  border-radius: 8px;
  color: #ff6b6b;
  font-weight: 500;
}

.diagram-content>* {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid var(--card-bg);
  border-top: 4px solid var(--link-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

.fullscreen-instructions {
  text-align: center;
  margin-bottom: 1.5em;
  padding: 1em;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fullscreen-instructions p {
  margin: 0 0 0.8em 0;
  font-size: 1.1em;
  color: var(--link-color);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.instructions-image {
  max-width: 300px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

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

.gallery-img {
  transition: transform 0.3s ease;
  cursor: pointer;
  /* added pointer cursor */
}

.gallery-img:hover {
  transform: scale(1.1);
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  transition: transform 0.3s ease;
}

.close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;

  /* updated for circle shape */
  background: var(--link-color);
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 50%;
  z-index: 1050;
  /* bring to front */
  border: 2px solid black;
  /* add black border */
}

.close:hover {
  color: #bbb;
}

/* Global tooltip styling */
.tooltip {
  position: relative;
  cursor: pointer;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--tooltip-bg);
  border: 1px solid var(--link-color);
  /* added border */
  color: var(--link-color);
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1.5em;
  cursor: pointer;
  float: right;
}

/* New keyframes for slide in animation */
@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Replace the slideIn keyframes with slideDown */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(226, 192, 141, 0.2);
  }

  50% {
    box-shadow: 0 0 20px rgba(226, 192, 141, 0.4);
  }

  100% {
    box-shadow: 0 0 5px rgba(226, 192, 141, 0.2);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-100 {
  animation-delay: 0.1s;
}

.delay-200 {
  animation-delay: 0.2s;
}

.delay-300 {
  animation-delay: 0.3s;
}

@media (max-width: 768px) {
  .diagram-wrapper {
    padding-bottom: 75%;
    /* Adjust aspect ratio for mobile */
  }

  .instructions-image {
    max-width: 100%;
  }

  .fullscreen-instructions {
    margin: 1em 0;
  }

  nav {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  nav a {
    margin: 0.5em 0;
    display: none;
  }

  nav.nav-open a {
    display: block;
  }

  .mobile-menu-toggle {
    display: block;
  }

  /* Updated nav.nav-open: add top padding to prevent overlap and animate sliding down */
  nav.nav-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    z-index: 2000;
    align-items: flex-start;
    padding: 3em 1em 1em 1em;
    /* top padding creates space for buttons */
    animation: slideDown 0.4s ease-out forwards;
  }

  /* Exclude theme toggle button from menu animation */
  nav.nav-open>#theme-toggle {
    position: absolute;
    top: 1em;
    right: 1em;
    animation: none;
  }

  #mobile-menu-toggle {
    position: absolute;
    top: 1em;
    left: 1em;
    float: none;
    z-index: 3001;
    /* ensure it's above nav if needed */
  }

  #theme-toggle {
    position: absolute;
    top: 1em;
    right: 1em;
    float: none;
  }

  .container {
    padding: 1em;
  }

  .nav-content {
    flex-direction: column;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
    margin-left: 0;
  }

  .nav-menu {
    flex-direction: column;
    width: 100%;
  }

  .nav-controls {
    margin-top: 1em;
  }

  nav.nav-open .nav-menu a,
  nav.nav-open .nav-controls {
    display: flex;
    animation: slideDown 0.4s ease-out forwards;
  }

  .nav-menu a,
  .nav-controls {
    display: none;
  }

  #mobile-menu-toggle {
    display: block;
    position: absolute;
    top: 1em;
    right: 1em;
  }

  .nav-brand {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 0;
  }

  .nav-content {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    display: none;
    margin-left: 0;
  }

  .nav-menu {
    flex-direction: column;
    width: 100%;
  }

  .nav-menu a {
    width: 100%;
    text-align: center;
    margin: 0.5em 0;
  }

  .nav-controls {
    margin-top: 1em;
    justify-content: center;
  }

  .mobile-menu-toggle {
    display: block;
  }

  nav.nav-open .nav-links {
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease-out forwards;
  }

  #theme-toggle {
    position: static;
  }
}

/* Glassmorphism components */
.glass-nav,
.glass-footer,
.glass-button,
.feature-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 6rem 2rem;
  margin: -2rem -2rem 2rem -2rem;
  background: var(--gradient-bg);
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 4rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  opacity: 0.8;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 4rem 0;
}

.feature-card {
  padding: 2rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.card-icon-img {
  width: 75px;
  height: 75px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.card-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--primary-color);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.card-link:hover {
  transform: translateX(5px);
}

/* Footer */
.glass-footer {
  margin-top: 4rem;
  padding: 3rem 2rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.footer-section a {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  margin: 0.5rem 0;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-section a:hover {
  opacity: 1;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }
}

/* Gallery Grid System */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2em;
  padding: 1em 0;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  aspect-ratio: 16/9;
  /* Enforce consistent aspect ratio */
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover .gallery-img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5em;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-caption {
  color: #fff;
  font-weight: 500;
  font-size: 0.95em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Contact Profile Cards */
.profile-card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5em;
  margin-top: 2em;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1.5em;
  padding: 2em;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
  z-index: 0;
}

.profile-card:hover {
  transform: translateY(-2px);
  /* Reduced from -5px to match buttons */
  background: rgba(226, 192, 141, 0.05);
  /* Subtle tint match */
  border-color: var(--link-color);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
  /* Soft elegant glow match */
}

/* Light mode specific hover adjust */
body.light-mode .profile-card:hover {
  background: #ffffff;
}

.profile-card-icon {
  width: 60px;
  height: 60px;
  min-width: 60px;
  /* Prevent shrinking */
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(226, 192, 141, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--link-color);
  z-index: 1;
}

.profile-card-icon svg {
  width: 28px;
  height: 28px;
  transition: var(--transition);
}

.profile-card:hover .profile-card-icon {
  background: var(--link-color);
  color: #121212;
  /* Dark icon on gold background */
  transform: scale(1.1);
  border-color: transparent;
}

.profile-card-content {
  z-index: 1;
}

.profile-card-content h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.25em;
  color: var(--text-color);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.profile-card-content p {
  margin: 0;
  font-size: 0.95em;
  opacity: 0.6;
  color: var(--text-color);
  transition: opacity 0.3s ease;
}

.profile-card:hover .profile-card-content p {
  opacity: 1;
}

/* Email Copy Button Styles */
.email-row {
  display: flex;
  align-items: center;
  gap: 0.8em;
}

.email-row a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95em;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.profile-card:hover .email-row a {
  opacity: 1;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--link-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  opacity: 1;
  background: rgba(226, 192, 141, 0.1);
  transform: scale(1.1);
}

.copy-tooltip {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -30px);
  background: var(--nav-bg);
  color: var(--link-color);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
}

/* Ensure tooltips are above everything */
.profile-card {
  overflow: visible;
  /* Override to let tooltip show */
}