/* ==========================================================================
   Campus2Cloud Universal Adaptive Responsive System
   Auto-compatible across:
   1. Compact Mobile (<= 400px)
   2. Standard Mobile (<= 640px)
   3. Tablet / iPad / Surface (641px - 1080px)
   4. Laptop (1081px - 1440px, incl. 1366x768)
   5. Desktop / PC Monitors (1441px - 1920px)
   6. 4K Displays, Ultrawides & Classroom Smart Boards (>= 1921px & Touch Panels)
   ========================================================================== */

/* 0. Universal Overflow Safety & Fluid Media */
html,
body {
  overflow-x: clip;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

.container {
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}

/* ==========================================================================
   1. Touch Devices (Phones, Tablets & Classroom Interactive Smart Boards)
   ========================================================================== */
@media (pointer: coarse) {
  .btn,
  .evt-btn,
  .quiz-opt-btn,
  .screening-tab-btn,
  .faq-trigger,
  .term-chip,
  .cmdk-item,
  .filters button,
  .pg-tabs button {
    min-height: 42px;
  }
  .modal-close-btn {
    width: 40px;
    height: 40px;
  }
}

/* ==========================================================================
   2. Classroom Smart Boards & 4K / Ultrawide Displays (>= 1921px)
   ========================================================================== */
@media (min-width: 1921px) {
  :root {
    --maxw: min(1600px, 86vw);
    --radius: 22px;
  }

  html {
    font-size: clamp(17px, 0.92vw, 22px);
  }

  .nav.floating-glass-nav {
    max-width: min(1540px, 86vw);
    padding: 0.5rem 0.65rem 0.5rem 1.15rem;
  }

  .hero {
    padding: 2.8rem 0 4rem;
  }

  .hero-grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 4rem;
  }

  .term-body {
    height: 270px;
    font-size: 0.86rem;
  }

  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.4rem;
  }

  .pg-explorer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.35rem;
  }

  .faq-list {
    max-width: 1120px;
  }

  .cmdk-dialog {
    max-width: 780px;
  }

  .modal-card {
    max-width: 580px;
  }
}

/* Ultra-Wide / 4K Smart Board (2560px+ & 3840px 4K Interactive Panels) */
@media (min-width: 2560px) {
  :root {
    --maxw: min(1840px, 82vw);
  }

  html {
    font-size: clamp(19px, 0.9vw, 25px);
  }

  .nav.floating-glass-nav {
    max-width: min(1760px, 82vw);
  }

  .section-head p,
  .hero-sub,
  .faculty-meta p {
    max-width: 64ch;
  }
}

/* Large Interactive Touch Smart Board (1200px+ with touch/stylus input) */
@media (pointer: coarse) and (min-width: 1200px) {
  .nav-links a {
    padding: 0.5rem 0.85rem;
    font-size: 0.92rem;
  }
  .btn,
  .cmdk-nav-btn,
  .theme-toggle-btn,
  .btn-discord {
    min-height: 44px;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .term-chip {
    padding: 0.35rem 0.72rem;
    font-size: 0.74rem;
  }
}

/* ==========================================================================
   3. Desktop / Standard PC Monitors (1441px - 1920px)
   ========================================================================== */
@media (min-width: 1441px) and (max-width: 1920px) {
  :root {
    --maxw: 1280px;
  }

  .nav.floating-glass-nav {
    max-width: 1240px;
  }

  .hero-grid {
    gap: 3.25rem;
  }

  .term-body {
    height: 230px;
  }
}

/* ==========================================================================
   4. Laptop View (1081px - 1440px, including 1280x720 & 1366x768)
   ========================================================================== */
@media (min-width: 1081px) and (max-width: 1440px) {
  .nav.floating-glass-nav {
    max-width: min(1180px, calc(100vw - 1.5rem));
    gap: 0.5rem;
    padding: 0.36rem 0.45rem 0.36rem 0.85rem;
  }

  .nav-links a {
    padding: 0.34rem 0.56rem;
    font-size: 0.81rem;
  }

  .hero {
    padding: 1.4rem 0 2.4rem;
  }

  .hero-grid {
    gap: 2.2rem;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 4.4vw, 3.85rem);
  }

  .term-body {
    height: 195px;
  }
}

/* Short-height laptops (e.g. 1366x768 / 1280x720) */
@media (min-width: 1081px) and (max-height: 790px) {
  .hero {
    padding: 1rem 0 1.8rem;
  }
  .pill {
    margin-bottom: 0.65rem;
  }
  .hero-motto {
    margin-bottom: 0.9rem;
  }
  .hero-cta {
    margin-bottom: 1.1rem;
  }
  .term-body {
    height: 175px;
  }
}

/* ==========================================================================
   5. Tablet View (641px - 1080px — iPad Mini, iPad Air/Pro, Surface)
   ========================================================================== */
@media (min-width: 641px) and (max-width: 1080px) {
  .nav.floating-glass-nav {
    max-width: calc(100vw - 1.5rem);
    padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  }

  .hero {
    padding: 1.75rem 0 3rem;
  }

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

  .pipeline {
    max-width: 100%;
  }

  .terminal {
    max-width: 100%;
  }

  .term-body {
    height: 220px;
  }

  .vision-grid,
  .join-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .mission-grid,
  .team-grid,
  .quiz-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faculty-spotlight {
    grid-template-columns: auto 1fr;
    gap: 1.15rem;
  }

  .faculty-badge-stack {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .pg-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .pg-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .pg-tabs::-webkit-scrollbar {
    display: none;
  }

  .pg-filter-controls {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   6. Standard Mobile View (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  /* Prevent iOS Safari auto-zoom on form inputs */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .nav-right {
    gap: 0.3rem;
  }

  .cmdk-nav-btn {
    height: 30px;
    padding: 0 0.5rem;
  }

  .theme-toggle-btn .theme-label {
    display: none;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }

  .pg-toolbar,
  .pg-filter-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.65rem;
  }

  .pg-select,
  .pg-search-box,
  .pg-search-box input {
    width: 100%;
  }

  .pg-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .pg-tabs::-webkit-scrollbar {
    display: none;
  }

  .pg-tabs button {
    flex-shrink: 0;
  }

  .pg-overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.6rem;
  }

  .pg-explorer-grid {
    grid-template-columns: 1fr !important;
  }

  .quiz-launcher-card {
    padding: 1.15rem;
  }

  .quiz-head-row .btn,
  .quiz-actions .btn,
  .tracker-actions .btn,
  .tracker-form-row .btn {
    width: 100%;
    justify-content: center;
  }

  .screening-tabs {
    flex-direction: row;
  }

  .screening-tab-btn {
    font-size: 0.78rem;
    padding: 0.55rem 0.5rem;
  }

  .event-countdown-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .countdown-digits {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .event-item-actions {
    gap: 0.4rem;
  }

  .faculty-spotlight {
    padding: 1.2rem;
    gap: 1rem;
  }

  .faculty-avatar {
    width: 54px;
    height: 54px;
    font-size: 1.1rem;
  }

  .faculty-badge-stack {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

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

  .faq-panel-inner {
    padding: 0 1rem 1rem;
    font-size: 0.84rem;
  }

  .cmdk-backdrop {
    padding: 0.75rem;
    align-items: flex-start;
  }

  .cmdk-dialog {
    margin-top: 2.5rem;
    border-radius: 14px;
  }

  .cmdk-results {
    max-height: 60dvh;
  }

  .cmdk-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .foot-links-row {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   7. Extra-Small / Compact Phones (<= 400px — iPhone SE / Mini Android)
   ========================================================================== */
@media (max-width: 400px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .nav.floating-glass-nav {
    padding: 0.32rem 0.36rem 0.32rem 0.65rem;
    gap: 0.3rem;
  }

  .brand {
    font-size: 0.82rem;
  }

  .cmdk-nav-btn kbd {
    display: none;
  }

  .cmdk-nav-btn {
    width: 30px;
    padding: 0;
    justify-content: center;
  }

  .nav .btn {
    padding: 0 0.6rem;
    font-size: 0.72rem;
  }

  .pipeline {
    grid-template-columns: 1fr;
  }

  .pipeline::before,
  .pipeline::after {
    display: none;
  }

  .step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    padding: 0.55rem 0.75rem;
  }

  .step .node {
    margin: 0;
    flex-shrink: 0;
  }

  .modal-backdrop {
    padding: 0.5rem;
  }

  .modal-card {
    border-radius: 18px;
  }
}
