/* responsive.css */

/* Images scale fluidly */
img {
  max-width: 100%;
  height: auto;
}

/* Nav wraps on smaller screens */
@media (max-width: 768px) {
  nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0;
  }
  nav ul li {
    flex: 1 1 100%;
    text-align: center;
    margin: 5px 0;
  }
}

/* Logo grid responsiveness */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  align-items: center;
}
.logo-grid img {
  max-height: 60px;
  margin: 0 auto;
  display: block;
}

/* Card grid (projects, certifications etc.) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* Stack-on-mobile utility */
@media (max-width: 600px) {
  .stack-on-mobile {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
}

/* CTA button group */
.cta-buttons {
  display: flex;
  gap: 15px;
}
@media (max-width: 600px) {
  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}


/* === Responsive Additions (non-destructive) === */

/* Layout */
.site-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.site-logo img, .site-logo svg { max-width:180px; height:auto; }
.site-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Burger */
.nav-toggle { display:none; }
.nav-toggle-btn { display:none; background:none; border:0; width:40px; height:40px; position:relative; cursor:pointer; }
.nav-toggle-btn .bar { position:absolute; left:8px; right:8px; height:2px; top:12px; background: currentColor; }
.nav-toggle-btn .bar:nth-child(2){ top:19px; }
.nav-toggle-btn .bar:nth-child(3){ top:26px; }

/* Base media */
img, video { max-width:100%; height:auto; }

/* Grids */
.logo-grid, .card-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:1rem; }

/* Buttons */
.button, .btn, a.button, a.btn, button {
  display:inline-block;
  padding: clamp(.55rem, 2.2vw, .9rem) clamp(.9rem, 3vw, 1.2rem);
  font-size: clamp(.95rem, 2.6vw, 1.05rem);
}

/* Prevent horizontal scroll */
html, body { overflow-x:hidden; }

/* Mobile behaviour */
@media (max-width: 900px) {
  .site-logo img, .site-logo svg { max-width:160px; }
}

@media (max-width: 768px) {
  .site-nav { display:none; width:100%; }
  .nav-toggle-btn { display:block; }
  .nav-toggle:checked ~ .nav-toggle-btn ~ .site-nav,
  .nav-toggle:checked + .nav-toggle-btn + .site-nav,
  .nav-toggle:checked ~ .site-nav { display:block; }
  .site-nav ul { display:flex; flex-direction:column; gap:.5rem; margin-top:.75rem; }
  .site-header { align-items:center; }
}

/* Ensure header elements wrap nicely */
.site-header > * { min-width: 0; }


/* Logo + brand text */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.site-logo img {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.site-logo span {
  /* Fluid size: smaller on phones, bigger on desktop */
  font-size: clamp(1.05rem, 2.2vw + 0.4rem, 1.6rem);
  color: #134d82;     /* site blue */
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;         /* avoid wrapping into menu */
}

/* Very small screens: nudge sizes to protect the header layout */
@media (max-width: 480px) {
  .site-logo img { width: 28px; height: 28px; }
  .site-logo span { font-size: clamp(1rem, 3vw + 0.3rem, 1.25rem); }
}

/* Safety: if your header uses a flex container, make sure it can wrap nicely */
@media (max-width: 400px) {
  .site-header { 
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;       /* keep items on one line */
    gap: 8px;
  }
  /* If space is *really* tight, allow truncation rather than overlap */
  .site-logo span {
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

}

/* === Header mobile fixes (2025-08-19) === */
@media (max-width: 768px) {
  .site-header { 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: .5rem; 
    flex-wrap: wrap; 
  }
  .site-logo { 
    display: flex; 
    align-items: center; 
    gap: .5rem; 
    flex: 1 1 auto; 
    min-width: 0; 
  }
  .site-logo span { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: clamp(0.95rem, 3.5vw + 0.3rem, 1.3rem);
  }
  /* Make header buttons smaller on mobile */
  .site-header .btn, .site-header .button, .site-header button, .site-header a.btn, .site-header a.button {
    padding: 6px 10px;
    font-size: .9rem;
    line-height: 1.2;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .site-header .btn, .site-header .button, .site-header button, .site-header a.btn, .site-header a.button {
    padding: 5px 9px;
    font-size: .85rem;
  }
}

/* Ensure the injected mobile menu appears under the burger */
@media (max-width: 900px) {
  header { position: relative; }
  nav { width: 100%; }
  nav.__cs_open {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
  }
}

/* === Mobile header refinements (2025-08-19b) === */
@media (max-width: 768px) {
  /* Stack header buttons under the logo + company name */
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .site-header .btn.cv,
  .site-header .btn.linkedin {
    align-self: flex-start;
    margin-top: 6px;
  }

  /* Ensure nav slides content down instead of overlapping */
  .site-nav {
    position: static !important;
    width: 100%;
    margin-top: .5rem;
  }
  .site-nav ul {
    background: #fff;
    border-top: 1px solid #eee;
    padding: .5rem 0;
  }
}

/* === Mobile header adjustments (2025-08-19c) === */
@media (max-width: 768px) {
  /* Place CV + LinkedIn buttons side by side */
  .site-header .btn.cv,
  .site-header .btn.linkedin {
    display: inline-flex;
    margin-top: 6px;
  }
  .site-header .btn.cv + .btn.linkedin {
    margin-left: 8px;
  }
  /* Ensure they wrap neatly if space is too tight */
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .site-header .btn.cv,
  .site-header .btn.linkedin {
    flex: 0 0 auto;
  }
  .site-header .btn-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  /* Hide duplicate hamburger if injected */
  .__cs_nav_toggle {
    display: none !important;
  }
}

/* === Mobile header button scaling (2025-08-19d) === */
@media (max-width: 480px) {
  .site-header .btn.cv,
  .site-header .btn.linkedin {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
}

/* === Mobile header layout + nav button style (2025-08-19e) === */
@media (max-width: 768px) {
  /* Keep logo/name left, burger far right */
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .site-logo { flex: 1 1 auto; min-width: 0; }
  .nav-toggle-btn { margin-left: auto; }

  /* Side by side CV + LinkedIn buttons below header */
  .header-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
  }
  .header-buttons .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  /* Full-width style for hamburger menu links */
  .site-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
  }
  .site-nav ul li, .site-nav a {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
  }
}



/* Desktop nav flicker guard */
@media (min-width: 901px) {
  header nav, .site-header { transition: none !important; }
}

/* === Desktop nav alignment (2025-08-19f) === */
@media (min-width: 901px) {
  .site-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
  }
  .site-logo { flex: 0 0 auto; }
  .site-nav { margin-left: auto; } /* push nav to the right */
  .site-nav ul { justify-content: flex-end; }
  .btn.cv, .btn.linkedin { margin-left: .5rem; }
}

