/*
 * RightClick Institute — Responsive Stylesheet
 * Covers: 320px, 375px, 390px, 414px, 768px, 1024px, 1440px+
 * Strategy: mobile-first fixes layered on top of desktop base styles
 * Goal: ZERO horizontal scrolling on every device
 */

/* ============================================================
   1. GLOBAL OVERFLOW PREVENTION — The nuclear option
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  max-width: 100%;
}

html {
  /* Do NOT set overflow-x:hidden on <html> — it creates a containing block
     for position:fixed elements, breaking mobile menu clicks on iOS/Android */
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  /* NOTE: do NOT set position:relative on body — it traps position:fixed children
     (nav panel, backdrop) and breaks mobile menu interaction on iOS/Android */
  width: 100%;
  min-width: 0;
}

/* ============================================================
   2. IMAGES — Never overflow, scale proportionally
   ============================================================ */
img,
video,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   3. CONTAINER — Safe horizontal padding at every width
   ============================================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

/* ============================================================
   4. SECTIONS — Fluid vertical rhythm
   ============================================================ */
section {
  width: 100%;
  overflow-x: hidden; /* each section is its own overflow boundary */
}

/* ============================================================
   5. NAVBAR — Full responsive with hamburger
   ============================================================ */

/* Ensure brand logo never overflows */
.nav-brand img,
.brand-logo {
  max-width: 160px;
  height: auto;
  max-height: 55px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Make CTA accessible on very small nav */
.nav-cta {
  white-space: nowrap;
  font-size: clamp(0.75rem, 2vw, 1rem);
  padding: 0.5rem 1.2rem;
}

/* ============================================================
   6. HERO SECTION — Fluid typography & no overflow
   ============================================================ */
.hero {
  width: 100%;
  overflow: hidden; /* clip hero slider from leaking */
}

.hero-slider,
.hero-slider .slide {
  width: 100%;
  max-width: 100%;
}

/* Fluid hero headings */
.hero-title,
.hero h1 {
  font-size: clamp(1.75rem, 6vw, 4rem);
  line-height: 1.1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.hero-copy {
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  max-width: 100%;
}

.hero-label {
  font-size: clamp(0.7rem, 2vw, 0.95rem);
  letter-spacing: 0.15rem;
  word-break: break-word;
}

/* ============================================================
   7. SECTION TITLES — Fluid
   ============================================================ */
.section-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ============================================================
   8. SERVICE / COURSE CARDS
   ============================================================ */
.service-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.service-card {
  width: 100%;
  min-width: 0; /* prevent flex/grid blowout */
}

.card-img {
  width: 100%;
  height: clamp(160px, 30vw, 220px);
  object-fit: cover;
}

/* ============================================================
   9. STATS SECTION
   ============================================================ */
.stat-item h3 {
  font-size: clamp(2rem, 6vw, 3.5rem);
}

/* ============================================================
   10. MARQUEE — Safe, no x-overflow contribution
   ============================================================ */
.recruiters-marquee-section {
  width: 100%;
  overflow: hidden;
}

.marquee-container {
  overflow: hidden;
  width: 100%;
}

.marquee-content span {
  font-size: clamp(0.85rem, 2.5vw, 1.5rem);
  padding: 0.6rem 1.5rem;
  white-space: nowrap;
}

/* ============================================================
   11. TESTIMONIALS
   ============================================================ */
.testimonial-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.testimonial-card {
  min-width: 0;
}

.quote {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
}

/* ============================================================
   12. REVIEWS CAROUSEL — Contained scrolling, no page overflow
   ============================================================ */
.reviews-carousel-wrapper {
  width: 100%;
  overflow: hidden;
}

.reviews-carousel {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.reviews-grid {
  width: max-content; /* intentional — contained inside .reviews-carousel */
}

/* ============================================================
   13. CONTACT SECTION / FORM
   ============================================================ */
.contact-content h2 {
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  overflow-wrap: break-word;
}

.contact-card {
  overflow: hidden;
}

.contact-form button,
.btn {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================================
   14. FAQ SECTION
   ============================================================ */
.faq-question {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  min-height: 44px;
  padding: 1rem 1.2rem;
}

/* ============================================================
   15. FOOTER — Fluid, no overflow
   ============================================================ */
footer {
  width: 100%;
  overflow-x: hidden;
}

.footer-col p {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

.footer-col ul li {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ============================================================
   16. WHY US / FEATURES
   ============================================================ */
.features {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.features li {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

/* ============================================================
   17. BUTTONS — Touch friendly, no overflow
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  text-align: center;
}

/* ============================================================
   18. PAGE HEADER (course/inner pages)
   ============================================================ */
.page-header {
  padding: clamp(100px, 20vw, 150px) 0 clamp(50px, 8vw, 80px);
  overflow-x: hidden;
}

.page-header h1 {
  font-size: clamp(1.6rem, 5vw, 3rem);
  overflow-wrap: break-word;
  word-break: break-word;
  padding: 0 1rem;
}

/* ============================================================
   19. COURSE DETAIL PAGES — Sidebar & chips
   ============================================================ */
.course-chip {
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  padding: 0.4rem 0.8rem;
  white-space: normal;
  word-break: break-word;
}

.course-sidebar {
  min-width: 0;
}

/* ============================================================
   20. WHATSAPP FLOAT — Safe positioning
   ============================================================ */
.whatsapp-float {
  max-width: calc(100vw - 2rem);
  z-index: 1100;
}

/* ============================================================
   21. HERO ARROWS — Prevent overflow
   ============================================================ */
.hero-nav {
  max-width: 100%;
  left: 0;
  right: 0;
  overflow: hidden;
}

/* ============================================================
   22. ABOUT & PLACEMENTS SPECIFIC
   ============================================================ */
.about-content {
  gap: clamp(1.5rem, 4vw, 4rem);
}

.about-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ============================================================
   === BREAKPOINTS ===
   ============================================================ */

/* ────────────────────────────────
   TABLET & BELOW — max 1024px
   ──────────────────────────────── */
@media (max-width: 1024px) {
  .navbar {
    padding: 0 1.5rem;
  }

  .hero-title,
  .hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
  }

  .hero-btns {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  /* Why us section */
  .why-us h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
  }

  /* Bottom CTA */
  .bottom-cta h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
  }

  /* Contact grid  */
  .contact-grid {
    gap: 1.5rem;
  }
}

/* ────────────────────────────────
   TABLET — max 900px
   ──────────────────────────────── */
@media (max-width: 900px) {
  /* Section padding */
  section {
    padding: 4rem 0;
  }

  /* Hero */
  .hero-title,
  .hero h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
  }

  .hero-copy {
    font-size: 1rem;
    padding: 0 1rem;
  }

  .hero-btns {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .hero-btns .btn {
    width: min(280px, 90%);
    text-align: center;
  }

  /* Why us */
  .why-us h2 {
    font-size: 2.2rem;
  }

  .why-us p {
    font-size: 1rem;
  }

  /* Contact grid */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Course details */
  .course-details {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .course-sidebar {
    position: static;
    top: auto;
  }

  /* About */
  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Contact page */
  .contact-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ────────────────────────────────
   MOBILE LARGE — max 768px
   ──────────────────────────────── */
@media (max-width: 768px) {
  /* Nav */
  .navbar {
    padding: 0 1rem;
    height: 64px;
    --nav-height: 64px;
  }

  .brand-logo {
    max-height: 42px;
  }

  /* Nav links — slide-in panel */
  .nav-links {
    position: fixed !important;
    top: 64px !important;
    right: -100% !important;
    width: min(300px, 100%) !important;
    height: calc(100dvh - 64px) !important;
    background: rgba(5, 5, 10, 0.98) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1.25rem;
    gap: 0;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-left: 1px solid var(--glass-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999999 !important;
    pointer-events: auto !important;
    isolation: isolate;
  }

  .nav-links.active {
    right: 0 !important;
    pointer-events: auto !important;
  }

  .nav-links li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links li a {
    display: block;
    width: 100%;
    padding: 0.9rem 0.5rem;
    font-size: 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* Mobile dropdown — collapsed by default, expands when .dropdown gets
     the .open class (toggled by js/main.js when "Courses" is tapped) */
  .nav-links .dropdown-menu {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0 0.5rem 1rem;
    margin-top: 0;
    box-shadow: none;
    width: 100%;
  }

  .nav-links .dropdown.open .dropdown-menu {
    display: block;
  }

  .nav-links .dropdown > a i.fa-caret-down {
    transition: transform 0.25s ease;
  }

  .nav-links .dropdown.open > a i.fa-caret-down {
    transform: rotate(180deg);
  }

  .nav-links .dropdown-menu li {
    padding: 0;
    border-bottom: none;
  }

  .nav-links .dropdown-menu li a {
    font-size: 0.9rem;
    padding: 0.6rem 0.5rem;
    min-height: 40px;
  }

  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    z-index: 1100;
    color: #fff;
    font-size: 1.4rem;
  }

  .nav-cta {
    display: none;
  }

  /* Hero */
  .hero {
    min-height: calc(100svh - 64px);
    margin-top: 64px;
    padding: 2rem 1rem 5rem;
  }

  .hero-content {
    padding: 0 0.5rem;
    max-width: 100%;
  }

  .hero-title,
  .hero h1 {
    font-size: clamp(1.75rem, 7vw, 2.6rem);
    text-align: center;
    padding: 0;
  }

  .hero-label {
    font-size: 0.7rem;
    letter-spacing: 0.12rem;
  }

  .hero-copy {
    font-size: 0.95rem;
    text-align: center;
    padding: 0;
  }

  .hero-btns {
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
  }

  .hero-btns .btn {
    width: min(260px, 100%);
    justify-content: center;
    font-size: 0.95rem;
    padding: 0.85rem 1.5rem;
  }

  .hero-nav {
    padding: 0 0.75rem;
  }

  .hero-arrow {
    width: 40px;
    height: 40px;
  }

  /* Sections */
  section {
    padding: 3.5rem 0;
  }

  .section-title {
    font-size: clamp(1.4rem, 5.5vw, 2rem);
    margin-bottom: 2rem;
    padding: 0 1rem;
  }

  /* Service cards */
  .service-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .card-img {
    height: 200px;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .stat-item h3 {
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .stat-item p {
    font-size: 0.85rem;
    letter-spacing: 0;
  }

  /* Marquee — smaller text */
  .marquee-content span {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    margin: 0 0.4rem;
  }

  /* Testimonials */
  .testimonial-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .testimonial-card {
    padding: 1.75rem 1.5rem;
  }

  /* Why us */
  .why-us h2 {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
  }

  .why-us p {
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Features hover shouldn't move outside viewport */
  .features li:hover {
    transform: translateX(4px);
  }

  /* Bottom CTA */
  .bottom-cta h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .bottom-cta p {
    font-size: 0.95rem;
  }

  /* CTA button */
  .bottom-cta .btn {
    width: min(260px, 100%);
    justify-content: center;
    padding: 0.9rem 1.5rem !important;
    font-size: 1rem !important;
    margin-top: 1.5rem !important;
  }

  /* Contact section */
  .contact-section .contact-card {
    padding: 1.5rem;
  }

  .contact-content h2 {
    font-size: clamp(1.4rem, 5vw, 2rem);
    margin-bottom: 0.75rem;
  }

  .contact-form button {
    width: 100%;
    justify-content: center;
  }

  /* FAQ */
  .faq-section {
    padding: 3.5rem 0 !important;
  }

  .faq-question {
    font-size: 0.9rem;
    padding: 1rem;
  }

  .faq-answer p {
    padding: 0.5rem 1rem 1rem;
    font-size: 0.9rem;
  }

  /* Reviews carousel */
  .reviews-carousel-wrapper {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .carousel-btn {
    display: none; /* hide arrows — swipe on mobile */
  }

  .reviews-carousel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .review-card {
    min-width: min(300px, 85vw) !important;
    flex-shrink: 0;
  }

  /* Footer */
  footer {
    padding: 3rem 1.25rem 2rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-col p {
    max-width: 100%;
  }

  footer .nav-brand img,
  footer .brand-logo {
    max-height: 60px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
  }

  /* WhatsApp float */
  .whatsapp-float {
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    gap: 0.6rem;
  }

  /* Page header (inner pages) */
  .page-header {
    padding: 100px 1rem 50px;
  }

  .page-header h1 {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
  }

  /* Course sidebar */
  .course-sidebar {
    padding: 1.75rem;
  }

  /* Course chips */
  .course-chip {
    font-size: 0.8rem;
  }

  /* About page */
  .about-image {
    order: -1; /* image above text on mobile */
  }

  /* Contact page */
  .contact-form {
    padding: 1.75rem 1.25rem;
  }

  /* Placements */
  .placement-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-box h3 {
    font-size: 2.2rem;
  }

  .recruiters-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
  }
}

/* ────────────────────────────────
   MOBILE MEDIUM — max 480px
   ──────────────────────────────── */
@media (max-width: 480px) {
  .hero-title,
  .hero h1 {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
  }

  .hero-copy {
    font-size: 0.9rem;
  }

  /* Single column stats on tiny screens */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item h3 {
    font-size: 2.2rem;
  }

  .section-title {
    font-size: clamp(1.25rem, 6vw, 1.8rem);
  }

  /* Contact card very small screens */
  .contact-section .contact-card {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .contact-content h2 {
    font-size: 1.4rem;
  }

  /* Testimonial card */
  .testimonial-card {
    padding: 1.25rem;
  }

  /* Footer columns */
  .footer-grid {
    grid-template-columns: 1fr;
  }

  /* Placement stats */
  .placement-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* Hide extended WhatsApp label, keep icon */
  .whatsapp-float span.wa-label {
    display: none;
  }
}

/* ────────────────────────────────
   MOBILE SMALL — max 375px
   ──────────────────────────────── */
@media (max-width: 375px) {
  .hero-title,
  .hero h1 {
    font-size: clamp(1.35rem, 8.5vw, 2rem);
  }

  .navbar {
    padding: 0 0.75rem;
  }

  .brand-logo {
    max-height: 36px;
    max-width: 130px;
  }

  .hero-btns .btn {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.8rem 1rem;
  }

  .whatsapp-float {
    right: 0.5rem;
    bottom: 0.5rem;
    font-size: 0.8rem;
    padding: 0.65rem 0.85rem;
  }

  .bottom-cta h2 {
    font-size: 1.4rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .stat-item h3 {
    font-size: 2rem;
  }
}

/* ────────────────────────────────
   MOBILE TINY — max 320px
   ──────────────────────────────── */
@media (max-width: 320px) {
  body {
    font-size: 14px;
  }

  .navbar {
    padding: 0 0.5rem;
  }

  .brand-logo {
    max-height: 32px;
    max-width: 110px;
  }

  .hero-title,
  .hero h1 {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .hero-copy {
    font-size: 0.85rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.7rem 1rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .stat-item h3 {
    font-size: 1.8rem;
  }

  .whatsapp-float {
    font-size: 0.75rem;
    padding: 0.6rem 0.75rem;
    gap: 0.4rem;
  }

  .marquee-content span {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }
}

/* ────────────────────────────────
   LARGE DESKTOP — min 1440px
   ──────────────────────────────── */
@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }

  .hero-title,
  .hero h1,
  .hero-title {
    font-size: 4.5rem;
  }

  .section-title {
    font-size: 3rem;
  }
}

/* ============================================================
   23. ACCESSIBILITY & PERFORMANCE
   ============================================================ */

/* Respect reduced-motion preference — keep animations, just reduce intensity */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: opacity 0.4s ease;
    transform: none !important;
  }

  .reveal.active {
    transform: none !important;
  }

  .marquee-content {
    animation-duration: 60s;
  }

  .service-card:hover,
  .testimonial-card:hover,
  .features li:hover {
    transform: none;
  }
}

/* Lazy loading images */
img[loading="lazy"] {
  content-visibility: auto;
}

/* ============================================================
   24. UTILITY OVERFLOW GUARDS
   ============================================================ */

/* Fix any stray translateX that causes overflow */
.marquee-container,
.hero-slider,
.footer-grid,
.service-grid,
.stats-grid,
.testimonial-grid,
.features {
  overflow: hidden;
}

/* Ensure marquee rows don't contribute to page width */
.recruiters-marquee-section .marquee-container {
  overflow: hidden;
  contain: layout;
}

/* Prevent absolute/fixed elements from creating page-width issues */
.dropdown-menu {
  max-width: min(280px, 90vw);
}

/* ============================================================
   25. iOS SAFE-AREA SUPPORT (notches, home indicator)
   ============================================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  .whatsapp-float {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  .nav-links {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   26. FOCUS / ACCESSIBILITY (touch & keyboard)
   ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}
