/* ===================================================================
   SECURE INTELLIGENCE — RESPONSIVE IMAGE COMPONENT & OVERLAY STYLES
   Fixed aspect-ratio boxes, focal-point object-position, maxDisplayWidth
   capping, hero contrast overlay, and prefers-reduced-motion support.
   =================================================================== */

.ri-figure {
  margin: 0;
  width: 100%;
  display: block;
}

.ri-figure--capped {
  max-width: var(--ri-max-width, 100%);
  margin-inline: auto;
}

.ri-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg, 12px);
  background-color: #0f172a;
  background-size: cover;
  background-position: center;
  aspect-ratio: var(--ri-ar-mobile, 4 / 3);
}

@media (min-width: 768px) {
  .ri-frame {
    aspect-ratio: var(--ri-ar-tablet, var(--ri-ar-mobile, 3 / 2));
  }
}

@media (min-width: 1024px) {
  .ri-frame {
    aspect-ratio: var(--ri-ar-desktop, var(--ri-ar-tablet, 3 / 2));
  }
}

.ri-picture,
.ri-img {
  display: block;
  width: 100%;
  height: 100%;
}

.ri-img {
  object-fit: cover;
  object-position: var(--ri-focal-x, 50%) var(--ri-focal-y, 50%);
}

/* Hero / banner dark gradient overlay for >= 4.5:1 text contrast */
.ri-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
      rgba(2, 6, 23, calc(var(--ri-overlay-strength, 0.65) * 0.55)) 0%,
      rgba(2, 6, 23, var(--ri-overlay-strength, 0.65)) 65%,
      rgba(2, 6, 23, min(0.92, calc(var(--ri-overlay-strength, 0.65) + 0.15))) 100%);
}

.ri-overlay-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-lg, 1.5rem);
  color: #f8fafc;
  z-index: 1;
}

.ri-caption {
  margin-top: var(--space-xs, 0.5rem);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.5;
  color: var(--color-text-muted, #94a3b8);
}

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

  .ri-frame,
  .ri-img {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

/* ===================================================================
   HOMEPAGE PHOTOGRAPHIC SECTIONS (Gated by permissionConfirmed)
   =================================================================== */

.homepage-photo-section {
  padding: var(--space-3xl, 3.5rem) 0;
  position: relative;
  overflow: hidden;
}

/* Section 1: Practical Training wide band */
.hp-practical-band {
  position: relative;
  max-width: 2048px;
  margin-inline: auto;
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.hp-practical-media .ri-frame {
  border-radius: 0;
}

.hp-practical-media .ri-overlay {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.04) 0%, rgba(2, 6, 23, 0.2) 100%);
}

.hp-practical-copy {
  padding: var(--space-lg, 1.5rem);
  color: #f8fafc;
}

.hp-practical-copy .section-tag {
  margin-bottom: var(--space-xs, 0.5rem);
  display: inline-block;
}

.hp-practical-heading {
  font-size: var(--text-2xl, 1.5rem);
  line-height: 1.25;
  margin: 0 0 var(--space-sm, 0.75rem);
  color: #ffffff;
}

.hp-practical-desc {
  font-size: var(--text-base, 1rem);
  line-height: 1.6;
  margin: 0;
  color: #e2e8f0;
  max-width: 46ch;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hp-practical-band {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  .hp-practical-band {
    position: relative;
  }

  .hp-practical-media .ri-overlay {
    background: linear-gradient(90deg,
        rgba(2, 6, 23, calc(var(--ri-overlay-strength, 0.38) * 1.45)) 0%,
        rgba(2, 6, 23, calc(var(--ri-overlay-strength, 0.38) * 0.85)) 36%,
        rgba(2, 6, 23, 0.05) 68%,
        rgba(2, 6, 23, 0) 100%);
  }

  .hp-practical-copy {
    position: absolute;
    inset-block: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-2xl, 2.5rem);
    max-width: 520px;
    z-index: 2;
  }

  .hp-practical-heading {
    font-size: var(--text-3xl, 1.875rem);
  }
}

/* Section 2: Learning Beyond the Screen */
.hp-workshop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl, 2rem);
  align-items: center;
  max-width: 2048px;
  margin-inline: auto;
}

.hp-workshop-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md, 1rem);
}

.hp-workshop-copy .section-title {
  text-align: left;
  margin-bottom: 0;
}

.hp-workshop-desc {
  margin: 0;
  line-height: 1.65;
  color: var(--color-text-secondary, #cbd5e1);
}

@media (min-width: 768px) {
  .hp-workshop-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

@media (min-width: 1280px) {
  .hp-workshop-grid {
    grid-template-columns: 1.3fr 0.7fr;
  }
}

/* ===================================================================
   ABOUT US — LEARNING APPROACH PHOTO ROW (whatsapp-103420)
   =================================================================== */

.about-approach-row {
  display: block;
}

.about-approach-row.has-media {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl, 2rem);
  align-items: center;
  margin-bottom: var(--space-2xl, 2.5rem);
}

.about-approach-row.has-media .about-approach-text {
  text-align: left;
  margin: 0;
  max-width: none;
}

@media (min-width: 768px) {
  .about-approach-row.has-media {
    grid-template-columns: 0.4fr 0.6fr;
    gap: var(--space-2xl, 2.5rem);
  }
}

/* ===================================================================
   FOUNDER / LEADERSHIP — PORTRAIT LAYOUT (founder-portrait)
   =================================================================== */

@media (min-width: 768px) {
  .founder-profile-grid.has-portrait {
    grid-template-columns: minmax(240px, 480px) 1fr;
    align-items: start;
  }
}

/* ===================================================================
   EVENTS PAGE — INSTITUTIONAL WORKSHOP GALLERY & DOCUMENTATION
   =================================================================== */

.events-doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl, 2rem);
  align-items: start;
}

@media (min-width: 768px) {
  .events-doc-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* ===================================================================
   COURSE PAGES — PRACTICAL LEARNING PHOTO SLOT
   =================================================================== */

.course-practical-media {
  margin: 0 auto var(--space-xl, 2rem);
  max-width: 1000px;
}

/* ===================================================================
   CGC UNIVERSITY WORKSHOP DOCUMENTATION & ACCESSIBLE LIGHTBOX
   =================================================================== */

.cgc-event-intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl, 2rem);
  align-items: start;
  margin-bottom: var(--space-2xl, 2.5rem);
}

@media (min-width: 1024px) {
  .cgc-event-intro.has-poster {
    grid-template-columns: minmax(260px, 380px) 1fr;
  }
}

.cgc-event-meta {
  display: grid;
  gap: var(--space-sm, 0.75rem);
  margin: var(--space-lg, 1.25rem) 0;
  padding: var(--space-md, 1rem);
  border-radius: var(--radius-md, 8px);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.cgc-event-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: var(--text-sm, 0.875rem);
}

.cgc-event-meta-row dt {
  font-weight: 600;
  color: #93c5fd;
  margin: 0;
}

.cgc-event-meta-row dd {
  margin: 0;
  color: var(--color-text-secondary, #cbd5e1);
}

.cgc-photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg, 1.5rem);
}

@media (min-width: 768px) {
  .cgc-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .cgc-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cgc-photo-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs, 0.5rem);
}

.cgc-photo-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-lg, 12px);
}

.cgc-photo-trigger:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}

.cgc-photo-grid .ri-frame {
  aspect-ratio: 4 / 3 !important;
}

.cgc-permission-note {
  margin-top: var(--space-lg, 1.5rem);
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-muted, #94a3b8);
  text-align: center;
}

/* Accessible Lightbox */
.cgc-lightbox[hidden] {
  display: none !important;
}

.cgc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 6, 23, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md, 1rem);
}

.cgc-lightbox-dialog {
  width: min(100%, 960px);
  max-height: 92vh;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-md, 1rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 0.75rem);
}

.cgc-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md, 1rem);
  color: #e2e8f0;
  font-size: var(--text-sm, 0.875rem);
}

.cgc-lightbox-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  cursor: pointer;
}

.cgc-lightbox-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.cgc-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  max-height: 70vh;
  overflow: hidden;
}

.cgc-lightbox-stage img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm, 6px);
}

.cgc-lightbox-caption {
  margin: 0;
  text-align: center;
  font-size: var(--text-sm, 0.875rem);
  color: #cbd5e1;
}

/* ===================================================================
   TASK 7 RESPONSIVE & OVERFLOW SAFEGUARDS
   =================================================================== */

.ri-figure,
.hp-practical-media,
.hp-workshop-media,
.about-approach-media,
.cgc-photo-card {
  min-width: 0;
}

.hero-layout-grid--single {
  grid-template-columns: 1fr !important;
  max-width: 780px;
  margin-inline: auto;
}

.hero-photo-slot:has(.ri-figure) {
  display: block;
  width: 100%;
  aspect-ratio: auto;
  min-height: 0;
}

.guest-lecture-layout--no-media {
  grid-template-columns: 1fr !important;
  max-width: 780px;
  margin-inline: auto;
}

.guest-lecture-meta-row[hidden] {
  display: none !important;
}

.guest-photo-grid:has(.ri-figure) {
  grid-template-rows: auto auto;
  align-items: start;
}

.guest-photo-tile:has(.ri-figure) {
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: auto;
}

.guest-photo-main .ri-frame {
  aspect-ratio: 16 / 9;
}

.guest-photo-tile:not(.guest-photo-main) .ri-frame {
  aspect-ratio: 4 / 3;
}

.founder-layout--no-photo {
  grid-template-columns: 1fr !important;
}

.founder-photo-slot:has(.ri-figure) {
  display: block;
  width: 100%;
  aspect-ratio: auto;
  min-height: 0;
}

@media (min-width: 1024px) {
  .hp-practical-media .ri-overlay {
    background: linear-gradient(90deg,
        rgba(2, 6, 23, calc(var(--ri-overlay-strength, 0.38) * 1.45)) 0%,
        rgba(2, 6, 23, calc(var(--ri-overlay-strength, 0.38) * 0.85)) 36%,
        rgba(2, 6, 23, 0.05) 68%,
        rgba(2, 6, 23, 0) 100%);
  }

  .hp-practical-copy {
    justify-content: flex-end;
    max-width: 460px;
    padding: var(--space-xl, 2rem);
  }

  .hp-practical-heading,
  .hp-practical-desc {
    text-shadow: 0 2px 10px rgba(2, 6, 23, 0.75);
  }
}