/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  background-color: #ffffff;
  color: #333;
  line-height: 1.6;
  position: relative;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #e0e0e0;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.logo {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  color: #222;
  white-space: nowrap;
}
.logo .bar { color: #4ab3f4; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  text-decoration: none; color: #4ab3f4; font-weight: 600; position: relative; transition: color .3s ease;
}
.nav-links a::after {
  content: ''; position: absolute; width: 0; height: 2px; left: 0; bottom: -4px;
  background-color: #4ab3f4; transition: width .3s ease;
}
.nav-links a:hover::after { width: 100%; }

/* Mobile navbar fixes */
@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; padding: .75rem 1rem; }
  .logo { flex: 1 0 100%; text-align: center; margin-bottom: .5rem; }
  nav { width: 100%; }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: .75rem 1.25rem;
  }
  .nav-links a { font-size: .95rem; }
}

/* Page Section */
.page-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}
.page-name { font-size: 2.2rem; color: #007acc; margin-bottom: 1rem; }

/* Profile photo (circle, larger, adjusted focus) */
.profile-photo-alt {
  width: clamp(260px, 75vw, 420px);
  height: clamp(260px, 75vw, 420px);
  border-radius: 50%;
  background-image: url('images/profile_pic.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 0%;
  background-color: #fff;
  margin: 1rem auto 1.5rem auto;
  display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border: 1px solid #599bec;
}

.quote {
  font-size: 1.5rem;
  font-style: italic;
  color: #333;
  margin-bottom: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
  text-align: justify;
}

/* Section Titles */
.section-title { font-size: 1.6rem; color: #007acc; text-align: center; margin-bottom: 2rem; }

/* About Page Spacing Fixes */
body.about-page .section-title { margin-top: 4rem; }
body.about-page .section-title + .section-content { margin-top: 1.5rem; }

/* Projects Section */
.projects { padding: 4rem 2rem; background-color: #f9f9f9; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
  justify-items: center;
}
.project-grid.vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

/* Cards/Tiles */
.project-tile,
.project-card {
  width: 70%;
  max-width: 600px;
  aspect-ratio: 1 / 1;          /* modern browsers */
  min-height: 320px;            /* ensures visible height */
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform .3s ease;
}
.project-grid.vertical .project-tile { display: block; } /* anchor -> block */
.project-tile:hover, .project-card:hover { transform: scale(1.03); }

.tile-overlay, .card-overlay {
  position: absolute; bottom: 0; left: 0; padding: 1rem; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent); width: 100%;
}
.tile-overlay h4, .card-overlay h4 { margin: 0; font-size: 1.2rem; }
.tile-overlay p, .card-overlay p { font-size: .9rem; margin-top: .5rem; }

.card-background {
  width: 100%; height: 100%; background-size: cover; background-position: center;
  filter: brightness(.75); transition: filter .3s ease;
}
.project-card:hover .card-background { filter: brightness(.5); }

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
  .project-tile, .project-card {
    height: 0;
    padding-bottom: 100%;        /* 1:1 square via padding */
    position: relative;
  }
  .tile-overlay, .card-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
  }
}

/* Scroll Animation */
.scroll-fade { opacity: 0; transform: translateY(30px); transition: opacity .5s ease-out, transform .5s ease-out; }
.scroll-fade.visible { opacity: 1; transform: translateY(0); }

/* Load More Button */
.load-more-wrapper { display: flex; justify-content: center; margin-top: 2rem; margin-bottom: 3rem; }
.load-more {
  padding: .75rem 1.5rem; background-color: #0077cc; color: #fff; border: none; border-radius: 6px;
  font-size: 1rem; cursor: pointer; transition: background-color .3s ease;
}
.load-more:hover { background-color: #005fa3; }

/* Footer */
.footer { background-color: #004d80; color: #fff; padding: 2rem 0; width: 100%; text-align: center; }
.footer-icons { display: flex; justify-content: center; gap: 2rem; margin-top: 1rem; }
.footer-icon {
  width: 40px; height: 40px; border: 1px solid #3399ff; border-radius: 8px; transition: transform .2s; cursor: pointer;
}
.footer-icon:hover { transform: scale(1.1); }
.tooltip {
  visibility: hidden; opacity: 0; background-color: #0077cc; color: #fff; text-align: center; border-radius: 5px; padding: 4px 8px;
  position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; transition: opacity .3s ease; z-index: 1;
}
.icon-wrapper { position: relative; }
.icon-wrapper:hover .tooltip { visibility: visible; opacity: 1; }

/* Utility */
.hidden { display: none; }

/* Smaller quote size on About page only */
body.about-page .quote { font-size: 1.2rem; }

/* Project Detail Styling */
.project-details { text-align: left; max-width: 800px; margin: 2rem auto; }
.project-details h3 { margin-top: 3rem; font-size: 1.3rem; color: #007acc; text-transform: uppercase; }
.project-details p { margin-top: .5rem; line-height: 1.7; }

/* Screenshot + caption stack */
.screenshot-wrapper { display: flex; flex-direction: column; align-items: center; margin-top: 2rem; }

/* Enlarge all screenshots/diagrams to same width */
.project-screenshot.wide-screenshot {
  width: 100%; max-width: 900px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.1); margin-bottom: .75rem;
}

/* Consistent caption placement + style */
.caption {
  text-align: center; font-style: italic; font-size: .95rem; color: #444; max-width: 850px;
  margin-left: auto; margin-right: auto; line-height: 1.5;
}

/* Flags */
.lang-flag {
  margin-right: 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  vertical-align: middle;
  border-radius: 2px;
}

/* Featured tile image rendering */
.project-tile { position: relative; overflow: hidden; }
.tile-bg {
  display: block;
  width: 70%;
  max-width: 600px;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
  .project-tile { height: 0; padding-bottom: 100%; }
  .tile-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .tile-overlay { position: absolute; left: 0; right: 0; bottom: 0; }
}

