/* Mobile-first responsive overrides */

/* Basic reset & images */
* { box-sizing: border-box; }
img, video, iframe { max-width: 100%; height: auto; display: block; }

/* Container padding */
.nav-container,
.carousel-container,
.philosophy-container,
.stats-grid,
.skills-container,
.contact-container,
.footer-content,
.footer-bottom { padding-left: 16px; padding-right: 16px; }

/* Header / Nav */
.header { position: sticky; top: 0; z-index: 40; background: var(--bg, #fff); }
.nav-container { display:flex; align-items:center; justify-content:space-between; gap:12px; max-width:1200px; margin:0 auto; padding:12px 16px; }
.logo { display:flex; align-items:center; gap:8px; text-decoration:none; color:inherit; }
.menu-toggle { display:inline-flex !important; flex-direction:column; gap:5px; width:36px; height:36px; justify-content:center; align-items:center; cursor:pointer; background:transparent; border:none; }
.menu-toggle span { display:block; width:22px; height:3px; background: #ffffff; border-radius:2px; }

/* Mobile nav: hidden until toggled */
.nav-menu { display:none; flex-direction:column; gap:8px; width:100%; margin-top:8px; }
.nav-menu.open { display:flex; }
.nav-menu .nav-link { padding:10px 12px; border-radius:8px; }

/* Larger screens show horizontal menu */
@media (min-width: 900px) {
  .menu-toggle { display:none; }
  .nav-menu { display:flex !important; flex-direction:row; gap:18px; align-items:center; width:auto; margin-top:0; }
}

/* Hero / Carousel */
.carousel-container { width:100%; max-width:1200px; margin:0 auto; padding:20px 0; }
.carousel { width:100%; height:260px; display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius:8px; }
@media (min-width:768px) { .carousel { height:420px; } }
@media (min-width:1200px) { .carousel { height:520px; } }

/* Philosophy / About */
.philosophy-container { padding:18px 0 28px; max-width:1100px; margin:0 auto; }
.philosophy-pillars { display:grid; grid-template-columns:1fr; gap:14px; }
@media (min-width:768px) { .philosophy-pillars { grid-template-columns:repeat(3,1fr); gap:20px; } }

/* Stats grid */
.stats-grid { display:grid; grid-template-columns:1fr; gap:14px; max-width:1100px; margin:0 auto; padding:18px 0; }
@media (min-width:768px) { .stats-grid { grid-template-columns:repeat(2,1fr); } }
@media (min-width:1200px) { .stats-grid { grid-template-columns:repeat(4,1fr); } }
.stat-card { padding:14px; border-radius:10px; }

/* Skills grid */
.skill-categories { display:flex; justify-content:center; gap:8px; flex-wrap:wrap; padding:8px 0; }
.skills-hexagon-grid { display:grid; grid-template-columns:1fr; gap:12px; place-items:center; }
@media (min-width:600px) { .skills-hexagon-grid { grid-template-columns:repeat(2,1fr); } }
@media (min-width:992px) { .skills-hexagon-grid { grid-template-columns:repeat(4,1fr); } }

/* Contact */
.contact-container { display:flex; flex-direction:column; gap:16px; max-width:1100px; margin:0 auto; padding:18px 0; }
.contact-info { display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:900px) { .contact-container { flex-direction:row; align-items:flex-start; } .contact-info { width:40%; } .contact-form { width:60%; } }

/* Inputs & buttons */
input, textarea { width:100%; padding:10px; border:1px solid #ddd; border-radius:8px; font-size:15px; }
.submit-btn { display:inline-block; padding:12px 18px; border-radius:8px; width:100%; font-size:16px; }

/* Footer */
.footer .footer-content { display:grid; grid-template-columns:1fr; gap:16px; max-width:1200px; margin:0 auto; padding:18px 0; }
@media (min-width:900px) { .footer .footer-content { grid-template-columns:2fr 1fr 1fr; } }
.footer-bottom { display:flex; flex-direction:column; gap:8px; padding:12px 0; font-size:13px; }
@media (min-width:600px) { .footer-bottom { flex-direction:row; justify-content:space-between; align-items:center; } }

/* Typography scaling */
h2.section-title { font-size: clamp(18px, 3.6vw, 28px); }
.pillar-title, .section-subtitle { font-size: clamp(13px, 2.4vw, 16px); }

/* Accessibility / tap targets */
.info-item { display:flex; gap:12px; align-items:flex-start; padding:12px; border-radius:8px; text-decoration:none; color:inherit; }
a.info-item, .nav-menu .nav-link { -webkit-tap-highlight-color: rgba(0,0,0,0.05); }

/* Misc small-screen tweaks */
@media (max-width:420px) {
  .logo-text { font-size:16px; }
  .carousel { height:220px; }
  .menu-toggle { width:32px; height:32px; }
}

/* Strong mobile hero/carousel overrides to fix layout issues on small devices */
@media (max-width: 900px) {
  /* Reduce heavy hero padding so content isn't pushed off-screen */
  .hero {
    padding: 80px 12px 40px !important;
    min-height: 60vh !important;
  }

  /* Make carousel container fluid and not force a large fixed height */
  .carousel-container {
    height: auto !important;
    max-height: 72vh !important;
    padding-top: 12px !important;
  }

  /* Allow carousel itself to size naturally; keep a minimum height so transform math still works */
  .carousel {
    height: auto !important;
    min-height: 220px !important;
  }

  /* Make each carousel item responsive: allow width relative to viewport but keep a sensible max */
  .carousel-item {
    width: calc(100% - 48px) !important;
    max-width: 360px !important;
    height: auto !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    position: absolute !important;
  }

  /* Card inside the carousel item should size to its content */
  .carousel-item .card {
    height: auto !important;
    padding: 18px !important;
  }

  .card-image { height: auto !important; max-height: 220px !important; }
  .card-image img { height: auto !important; max-height: 220px !important; object-fit: cover; }

  /* Reduce oversized decorative numbers so they don't overflow */
  .card-number { font-size: 40px !important; right: 16px !important; top: 12px !important; }

  /* Position controls below the carousel in a more compact way */
  .carousel-controls { position: relative !important; bottom: auto !important; margin-top: 12px !important; }

  /* Make indicators compact */
  .carousel-indicators { gap: 8px !important; top: auto !important; margin-top: 8px !important; }

  /* Reduce scanline animation travel so it doesn't overshoot the shorter cards */
  @keyframes scanline { 0% { transform: translateY(0); } 100% { transform: translateY(300px); } }

  /* Disable hero parallax on small devices (script adds inline transform) */
  .hero { transform: none !important; }
}

/* Extra small screens safety clamp */
@media (max-width: 420px) {
  .carousel-item { max-width: 320px !important; width: calc(100% - 32px) !important; }
  .card-title { font-size: 18px !important; }
  .card-description { font-size: 13px !important; }
}

/* Gallery carousel styles */
.gallery-section { padding: 36px 0; }
.gallery-container { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.gallery-viewport { overflow-x: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.gallery-track { display: flex; gap: 12px; transition: transform 0.45s cubic-bezier(.2,.8,.2,1); scroll-behavior: smooth; scroll-snap-type: x mandatory; }
.gallery-item { scroll-snap-align: center; }
.gallery-item { flex: 0 0 auto; width: calc(25% - 9px); border-radius: 10px; overflow: hidden; height: 220px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.06); }
.gallery-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-btn { background: rgba(0,0,0,0.5); color: var(--text-primary); border: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.gallery-indicators { display:flex; gap:8px; justify-content:center; margin-top:12px; }
.gallery-indicators .dot { width:10px; height:10px; border-radius:50%; background: rgba(255,255,255,0.2); }
.gallery-indicators .dot.active { background: var(--accent-purple); }

@media (max-width: 992px) {
  .gallery-item { width: calc(33.333% - 8px); height: 180px; }
  .gallery-item img { height: 100%; }
}

@media (max-width: 600px) {
  .gallery-container { gap:8px; }
  .gallery-item { width: calc(50% - 6px); height: 160px; }
  .gallery-item img { height: 100%; }
  .gallery-btn { padding: 8px 10px; }
}

/* On small / tablet screens show one full image (centered) */
@media (max-width: 768px) {
  .gallery-item { width: calc(100% - 32px) !important; max-width: 640px; }
  .gallery-viewport { width: 100%; }
  .gallery-container { justify-content: center; }
  .gallery-indicators { margin-top: 14px; }
  /* Keep prev/next visible at the sides */
  .gallery-btn { z-index: 5; }
}

@media (max-width: 420px) {
  .gallery-item { width: calc(100% - 8px); height: 220px; }
  .gallery-item img { height: 100%; }
}