/*
 RIC HOMEPAGE 2026 — STAGE A
 Fluid / responsive / device-independent layout.
 IMPORTANT:
 - No display:none on page content
 - No opacity/visibility manipulation
 - No full-screen overlays
 - No JavaScript dependency
*/

*,
*::before,
*::after{
  box-sizing:border-box;
}

html{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
  -webkit-text-size-adjust:100%;
}

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

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

img,
video{
  height:auto;
}

iframe{
  width:100%;
}

/* ---------------------------------------------------------
   GLOBAL FLUID WIDTH
--------------------------------------------------------- */

main,
header,
footer,
section,
nav{
  min-width:0;
}

.ric-container,
.ric-wrap,
.ric-inner,
.ric-section-inner,
.ric-content,
.ric-page-width{
  width:min(100% - clamp(24px,5vw,80px),1600px);
  margin-inline:auto;
}

/* Prevent fixed-width descendants from forcing overflow */
body :where(
  .ric-panel,
  .ric-card,
  .ric-prayer,
  .ric-prayer-card,
  .ric-quran-card,
  .ric-adhan-box,
  .ric-event,
  article,
  aside
){
  min-width:0;
  max-width:100%;
}

/* ---------------------------------------------------------
   TYPOGRAPHY
--------------------------------------------------------- */

body{
  font-size:clamp(15px,1vw + 11px,18px);
}

h1{
  font-size:clamp(2.15rem,5vw,5rem);
  line-height:1.02;
  overflow-wrap:anywhere;
}

h2{
  font-size:clamp(1.55rem,3vw,2.65rem);
  line-height:1.08;
}

h3{
  font-size:clamp(1.08rem,1.7vw,1.45rem);
}

p,
li,
a,
button,
input,
select,
textarea{
  overflow-wrap:anywhere;
}

/* ---------------------------------------------------------
   HEADER / NAVIGATION
--------------------------------------------------------- */

.ric-header,
.ric-site-header,
header{
  width:100%;
}

.ric-nav,
.ric-navigation{
  min-width:0;
}

.ric-nav-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:clamp(6px,1vw,12px);
}

.ric-nav-actions a,
.ric-nav-actions button{
  white-space:normal;
}

/* ---------------------------------------------------------
   HERO
--------------------------------------------------------- */

.ric-hero{
  width:100%;
  min-height:clamp(340px,52vw,650px);
  background-size:cover;
  background-position:center;
}

.ric-hero-content,
.ric-hero-copy{
  width:min(100%,850px);
}

.ric-hero-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.ric-hero-actions a,
.ric-hero-actions button{
  flex:0 1 auto;
}

/* ---------------------------------------------------------
   PRAYER SECTION
--------------------------------------------------------- */

.ric-prayer-shell{
  width:100%;
}

.ric-prayer-card{
  width:100%;
}

.ric-prayer-grid{
  display:grid;
  grid-template-columns:
    repeat(auto-fit,minmax(min(155px,100%),1fr));
  gap:clamp(8px,1.1vw,15px);
}

.ric-prayer{
  width:100%;
  min-width:0;
}

.ric-prayer img,
.ric-prayer video{
  width:100%;
}

/* Prayer information / control boxes */
.ric-prayer-intro,
.ric-adhan-box,
.ric-prayer-audio-compact{
  min-width:0;
  max-width:100%;
}

/* ---------------------------------------------------------
   QUICK ACCESS / CONTENT CARDS
--------------------------------------------------------- */

.ric-card-grid,
.ric-quick-grid,
.ric-service-grid,
.ric-resource-grid,
.ric-grid{
  display:grid;
  grid-template-columns:
    repeat(auto-fit,minmax(min(220px,100%),1fr));
  gap:clamp(10px,1.4vw,20px);
}

/* Existing panels should be allowed to resize */
.ric-panel{
  width:100%;
}

/* ---------------------------------------------------------
   EVENTS
--------------------------------------------------------- */

.ric-event{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
}

.ric-event-title,
.ric-event-time{
  min-width:0;
}

/* ---------------------------------------------------------
   TABLES
--------------------------------------------------------- */

table{
  max-width:100%;
}

.ric-table-wrap,
.table-responsive{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

/* ---------------------------------------------------------
   FORMS / CONTROLS
--------------------------------------------------------- */

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

button,
a.ric-button,
.ric-button,
.ric-pill{
  min-height:42px;
}

/* ---------------------------------------------------------
   FOOTER
--------------------------------------------------------- */

footer{
  width:100%;
}

.ric-footer-grid{
  display:grid;
  grid-template-columns:
    repeat(auto-fit,minmax(min(190px,100%),1fr));
  gap:clamp(16px,2vw,30px);
}

/* ---------------------------------------------------------
   CONTENT-BASED REFLOW
--------------------------------------------------------- */

@media (max-width:980px){

  .ric-event{
    grid-template-columns:auto minmax(0,1fr);
  }

  .ric-event > :last-child{
    grid-column:2;
  }

}

@media (max-width:760px){

  .ric-nav-actions{
    justify-content:flex-start;
  }

  .ric-hero{
    min-height:clamp(390px,80vw,560px);
  }

  .ric-hero-actions{
    align-items:stretch;
  }

  .ric-hero-actions > *{
    flex:1 1 180px;
    text-align:center;
  }

  .ric-prayer-grid{
    grid-template-columns:
      repeat(auto-fit,minmax(min(135px,100%),1fr));
  }

}

@media (max-width:520px){

  body{
    font-size:15px;
  }

  .ric-nav-actions > *{
    flex:1 1 auto;
  }

  .ric-hero-actions > *{
    width:100%;
    flex-basis:100%;
  }

  .ric-prayer-grid{
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }

  .ric-event{
    grid-template-columns:1fr;
  }

  .ric-event > :last-child{
    grid-column:auto;
  }

}

@media (max-width:340px){

  .ric-prayer-grid{
    grid-template-columns:1fr;
  }

}

/* ---------------------------------------------------------
   ACCESSIBILITY
--------------------------------------------------------- */

@media (prefers-reduced-motion:reduce){

  *,
  *::before,
  *::after{
    scroll-behavior:auto !important;
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }

}
