/* NRPCES responsive layer
   Breakpoints match Bootstrap 5:
   xs <576 | sm ≥576 | md ≥768 | lg ≥992 | xl ≥1200 | xxl ≥1400
   Kept as a separate sheet so the custom brand CSS is not replaced by Bootstrap's .btn/.nav/.container.
*/

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  max-width: 100%;
}

body {
  max-width: 100%;
  overflow-x: hidden;
}

.site-header {
  overflow: visible;
}

.nav-mobile-extra {
  display: none !important;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

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

.site-header,
.site-footer {
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}

.site-footer {
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

/* —— Large tablets / small laptops —— */
@media (max-width: 1199.98px) {
  .header-inner {
    gap: 1rem;
  }

  .nav {
    gap: 0.95rem;
  }

  .nav a {
    font-size: 1.02rem;
  }

  .dash-uc-grid,
  .uc-grid-all {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

/* —— Tablet and down (hamburger already at 980px; tighten layout here) —— */
@media (max-width: 991.98px) {
  :root {
    --header: 84px;
  }

  .site-header {
    position: fixed;
    width: 100%;
    background: rgba(1, 22, 39, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .site-header::before {
    opacity: 0;
  }

  .header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: min(100% - 1.25rem, 1240px);
    gap: 0.5rem;
    min-height: 56px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-actions {
    gap: 0.45rem;
    flex-shrink: 0;
  }

  .nav-toggle {
    display: flex;
    flex-shrink: 0;
  }

  .nav-mobile-extra {
    display: none !important;
  }

  .site-header.is-open .nav-mobile-extra {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
  }

  .brand-logo {
    height: 52px;
    max-width: 168px;
  }

  .lang-dropdown-toggle {
    min-width: 0;
    min-height: 40px;
    padding: 0.4rem 0.7rem;
    gap: 0.35rem;
  }

  .btn-admin-login {
    min-height: 40px;
    padding: 0.4rem 0.85rem 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .site-header.is-open .nav {
    top: 100%;
    max-height: calc(100dvh - var(--header));
    overflow-y: auto;
    padding-bottom: max(1.35rem, env(safe-area-inset-bottom));
  }

  .hero-main {
    width: min(100% - 1.5rem, var(--container));
    min-height: clamp(420px, 62vh, 580px);
    padding: calc(var(--header) + 1.4rem) 0 1.8rem;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(2rem, 6.2vw, 2.85rem);
  }

  .hero-lead {
    font-size: 1.08rem;
    max-width: 38rem;
  }

  .page-hero,
  .dashboards-hero {
    padding: calc(var(--header) + 1.8rem) 0 1.8rem;
  }

  .dashboards-hero {
    min-height: 280px;
  }

  .page-section,
  .section {
    padding: 2.2rem 0 2.6rem;
  }

  .auth-section,
  .admin-section {
    padding: calc(var(--header) + 1.6rem) 0 2.6rem;
  }

  .container,
  .section-home-split .container {
    width: min(100% - 1.5rem, var(--container));
  }

  .trust-inner,
  .footer-shell {
    width: min(100% - 1.5rem, 1240px);
  }

  .home-tablist {
    width: 100%;
  }

  .home-tab {
    flex: 1 1 0;
    justify-content: center;
    font-size: 0.98rem;
    padding: 0.8rem 0.7rem;
  }

  .map-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .admin-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-head .btn {
    align-self: flex-start;
  }

  .about-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .uc-featured,
  .dash-uc-grid,
  .uc-grid-all {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .uc-secondary {
    grid-template-columns: 1fr;
  }
}

/* —— Phones (landscape-capable) —— */
@media (max-width: 767.98px) {
  :root {
    --header: 76px;
  }

  .header-inner {
    width: min(100% - 1rem, 1240px);
  }

  .brand-logo {
    height: 46px;
    max-width: 148px;
  }

  .btn-admin-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .btn-admin-login {
    position: relative;
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    gap: 0;
  }

  .lang-code,
  .lang-caret {
    display: none;
  }

  .lang-dropdown-toggle {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    gap: 0;
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
  }

  .hero-copy,
  .hero-lead,
  .hero h1,
  .page-hero h1,
  .page-hero p,
  .dashboards-hero h1,
  .consortium-title {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }

  .hero-main {
    width: min(100% - 1.25rem, var(--container));
    min-height: 0;
    padding: calc(var(--header) + 1.15rem) 0 1.45rem;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8.4vw, 2.25rem);
    max-width: none;
  }

  .hero-lead {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 1rem;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 0.85rem 1.1rem;
  }

  .page-hero h1,
  .dashboards-hero h1,
  .consortium-title {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .page-hero p,
  .dashboards-hero p {
    font-size: 0.98rem;
  }

  .container,
  .section-home-split .container,
  .contact-layout,
  .about-layout {
    width: min(100% - 1.25rem, var(--container));
  }

  .trust-inner,
  .footer-shell {
    width: min(100% - 1.25rem, 1240px);
  }

  .about-facts,
  .uc-featured,
  .dash-uc-grid,
  .uc-grid-all,
  .partner-logos,
  .consortium-grid {
    grid-template-columns: 1fr;
  }

  .about-section-card,
  .contact-card,
  .panel,
  .admin-panel {
    padding: 1.15rem 1.05rem 1.25rem;
  }

  .about-section-head {
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .about-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .about-section-head h2,
  .contact-form-title,
  .panel-title {
    font-size: 1.12rem;
  }

  .content-actions,
  .about-actions,
  .uc-dashboard-actions,
  .map-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .content-actions .btn,
  .about-actions .btn,
  .uc-dashboard-actions .btn,
  .map-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .home-tablist {
    flex-direction: column;
  }

  .home-tab {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.72rem 0.5rem;
    gap: 0.4rem;
  }

  .auth-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .home-tab-icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  .footer-brand > p,
  .footer-bottom,
  .footer-col a {
    font-size: 0.98rem;
  }

  .footer-brand .brand-text {
    white-space: normal;
  }

  .footer-legal {
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }

  .auth-shell {
    width: 100%;
    min-height: 0;
    border-radius: 16px;
  }

  .auth-card {
    padding: 1.35rem 1.15rem 1.3rem;
  }

  .auth-card h1 {
    font-size: 1.45rem;
  }

  .admin-form-grid,
  .admin-form-grid-3 {
    grid-template-columns: 1fr;
  }

  .admin-form-actions,
  .admin-form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .admin-table {
    min-width: 760px;
  }

  .map-frame,
  .nrpces-map {
    min-height: 320px;
    height: 52vh;
    border-radius: 14px;
  }

  .home-map {
    height: 220px;
  }

  .contact-field input,
  .contact-field textarea,
  .form-grid input,
  .form-grid textarea,
  .auth-card input,
  .admin-form input,
  .admin-form select,
  .admin-form textarea {
    font-size: 16px;
  }

  .toast-stack,
  .toast-stack.is-center {
    width: min(100% - 1.25rem, 420px);
    right: 0.65rem;
    left: 0.65rem;
    margin-inline: auto;
  }

  .lang-dropdown-menu {
    min-width: min(230px, calc(100vw - 1.5rem));
    right: 0;
  }
}

/* —— Small phones —— */
@media (max-width: 575.98px) {
  :root {
    --header: 72px;
  }

  .header-actions .btn-admin-login {
    display: none;
  }

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

  .lang-dropdown-toggle img,
  .lang-dropdown-item img {
    width: 22px;
    height: 16px;
  }

  .hero-main {
    padding: calc(var(--header) + 1rem) 0 1.2rem;
  }

  .hero-eyebrow,
  .about-hero-eyebrow,
  .consortium-eyebrow {
    font-size: 0.7rem;
  }

  .page-hero,
  .dashboards-hero {
    padding: calc(var(--header) + 1.35rem) 0 1.35rem;
  }

  .dashboards-hero {
    min-height: 220px;
  }

  .partners-band {
    padding: 2rem 0 2.2rem;
  }

  .partner-tile-frame {
    min-height: 96px;
  }

  .otp-dev-code {
    letter-spacing: 0.12em;
    font-size: 1.25rem;
  }

  .auth-otp-input {
    letter-spacing: 0.16em;
  }
}

/* —— Very small screens —— */
@media (max-width: 379.98px) {
  .brand-logo {
    height: 36px;
    max-width: 112px;
  }

  .lang-code {
    display: none;
  }

  .home-tab-icon {
    display: none;
  }
}

/* —— iPad / small laptop: restore two-up cards where it still fits —— */
@media (min-width: 700px) and (max-width: 991.98px) {
  .trust-inner {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 72px;
  }

  .trust-item {
    justify-content: center;
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.9rem 0.5rem;
  }

  .trust-item:last-child {
    border-right: 0;
  }

  .about-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .uc-featured,
  .dash-uc-grid,
  .uc-grid-all,
  .consortium-grid,
  .partner-logos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* —— Landscape phones —— */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --header: 64px;
  }

  .hero-main {
    min-height: 0;
    padding: calc(var(--header) + 0.8rem) 0 1rem;
  }

  .site-header.is-open .nav {
    max-height: calc(100dvh - 64px);
  }
}

/* —— Touch: no hover lifts that feel sticky on phones —— */
@media (hover: none) {
  .btn:hover,
  .btn-admin-login:hover,
  .uc-card:hover,
  .about-fact:hover,
  .about-section-card:hover,
  .dash-uc-card:hover,
  .consortium-card:hover {
    transform: none;
  }
}
