/* ================================
   NEWS & VIDEOS PAGE (Ang Agila)
   RESPONSIVE (Mobile / Tablet / Web)
   + ADDED: FULLSCREEN LOADER
================================ */

/* THEME VARIABLES */
:root {
  --bg: #f0f4ff;
  --section-bg: #e3ecff;
  --blue-dark: #162447;
  --blue-main: #1f4068;
  --text-dark: #222;
  --text-soft: #333;
  --white: #fff;
}

/* ================= BASE (RESPONSIVE SAFETY) ================= */
html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  font-family: "Inter", sans-serif;
  margin: 0;
  padding-top: 70px;
  background: var(--bg);
  color: var(--blue-main);
  overflow-x: hidden;
}

/* Prevent scroll while loader is on */
body.is-loading{
  overflow: hidden !important;
}

/* Make media never overflow */
img, video{
  max-width: 100%;
  height: auto;
  display: block;
}

/* HEADERS */
h1,h2,h3,h4,h5,h6 {
  font-family: "Merriweather", serif;
  font-weight: 700;
  margin: 0 0 12px 0;
}

/* =========================
   FULLSCREEN LOADER (NEW)
========================= */
.page-loader{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: rgba(240,244,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .35s ease, visibility .35s ease;
}

.page-loader.hide{
  opacity: 0;
  visibility: hidden;
}

.loader-wrap{
  width: min(420px, 92vw);
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 18px 55px rgba(0,0,0,0.14);
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.loader-spinner{
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 6px solid rgba(31,64,104,0.18);
  border-top-color: rgba(31,64,104,0.95);
  animation: spin .9s linear infinite;
}

@keyframes spin{
  to { transform: rotate(360deg); }
}

.loader-text{
  margin: 0;
  font-weight: 600;
  color: var(--blue-dark);
  letter-spacing: .2px;
}

/* ================= HERO ================= */
.news-hero {
  position: relative;
  min-height: 50vh;
  background: url('../static/news.png') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  padding: clamp(56px, 6vw, 70px) 20px;
}

.news-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.news-hero > * {
  position: relative;
  z-index: 2;
}

.news-hero h1 {
  font-size: 54px;
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: 0.4px;
  overflow-wrap: anywhere;
}

.news-hero p {
  font-size: 18px;
  max-width: 760px;
  line-height: 1.7;
  margin: 0 0 28px;
  opacity: 0.95;
  padding-inline: clamp(0px, 2vw, 8px);
}

/* HERO BUTTONS */
.hero-buttons {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-buttons a {
  font-weight: 600;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
}

/* PRIMARY */
.hero-buttons .btn-primary {
  background: linear-gradient(135deg, var(--blue-main), var(--blue-dark));
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.15);
}

.hero-buttons .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

/* SECONDARY */
.hero-buttons .btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.85);
}

.hero-buttons .btn-secondary:hover {
  background: var(--white);
  color: var(--blue-main);
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
}

/* ================= NEWS ================= */
.news-section {
  padding: 85px 20px;
  background: var(--section-bg);
}

.news-section h2 {
  text-align: center;
  font-size: 38px;
  font-weight: 900;
  color: var(--blue-main);
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.news-section p {
  text-align: center;
  font-size: 16px;
  color: var(--text-soft);
  margin-bottom: 50px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding-inline: 8px;
}

/* NEWS GRID */
.news-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 28px;
}

/* NEWS CARD */
.news-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  min-width: 0;
}

.news-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.18);
}

/* IMAGE */
.news-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* CONTENT */
.news-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.news-card-content h3 {
  font-size: 20px;
  color: var(--blue-dark);
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

/* READ MORE BUTTON */
.read-more-btn {
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue-main), var(--blue-dark));
  color: var(--white);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
  touch-action: manipulation;
}

.read-more-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-main));
}

/* ================= VIDEOS ================= */
.video-section {
  padding: 85px 20px;
  background: var(--bg);
}

.video-section h2 {
  text-align: center;
  font-size: 38px;
  font-weight: 900;
  color: var(--blue-main);
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.video-grid{
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 360px));
  gap: 28px;
  justify-content: center;
}

/* VIDEO CARD */
.video-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  width: 100%;
  min-width: 0;
}

.video-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.18);
}

.video-card.clickable {
  cursor: pointer;
}

.video-card video {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid #ddd;
}

.video-card-content {
  padding: 18px;
  text-align: center;
  min-width: 0;
}

.video-card-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
  margin: 0;
  overflow-wrap: anywhere;
}

/* ================= MODAL (FIXED) ================= */
.modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:1000;
  justify-content:center;
  align-items:center;
  background:rgba(0,0,0,.65);
  padding:24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.modal-content{
  position:relative;
  width:min(920px, 100%);
  background:#fff;
  border-radius:14px;
  box-shadow:0 18px 55px rgba(0,0,0,.25);
  max-height: calc(100vh - 48px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-width: 0;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid rgba(15,23,42,.10);
  min-width: 0;
}

.modal-header h3{
  margin:0;
  font-size:20px;
  font-family:"Merriweather", serif;
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}

.modal-close{
  border:none;
  background:transparent;
  font-size:26px;
  line-height:1;
  cursor:pointer;
  color:#1f2937;
  padding:4px 8px;
  border-radius:10px;
  flex: 0 0 auto;
}

.modal-close:hover{
  background: rgba(15,23,42,.06);
}

.modal-body{
  padding:16px;
  overflow:auto;
  min-width: 0;
}

.modal-body img{
  width:100%;
  height:auto;
  border-radius:10px;
  display:block;
  margin-bottom:12px;
}

.modal-body video{
  width:100%;
  max-height:55vh;
  border-radius:10px;
  display:block;
  margin-bottom:12px;
  height: auto;
}

.modal-body p{
  margin:0;
  line-height:1.65;
  color:#111827;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px){
  .news-section,
  .video-section{
    padding: 75px 18px;
  }
}

@media (max-width: 768px) {
  body{ padding-top: 70px; }

  .news-hero{
    min-height: 48vh;
    padding: 62px 18px;
  }

  .news-hero h1 { font-size: 38px; }
  .news-hero p { font-size: 16px; }

  .news-section h2,
  .video-section h2{
    font-size: 34px;
  }

  .news-card img,
  .video-card video{
    height: 180px;
  }

  .hero-buttons a{
    padding: 12px 26px;
  }
}

@media (max-width: 480px){
  .news-hero{
    padding: 56px 14px;
  }

  .news-hero h1{
    font-size: 32px;
  }

  .hero-buttons{
    gap: 12px;
  }

  .hero-buttons a{
    width: auto;
    max-width: 100%;
  }

  .news-section,
  .video-section{
    padding: 70px 14px;
  }

  .news-section h2,
  .video-section h2{
    font-size: 30px;
  }

  .news-grid,
  .video-grid{
    gap: 18px;
  }

  .modal{
    padding:12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .modal-content{ max-height: calc(100vh - 24px); }
  .modal-header{ padding:12px 12px; }
  .modal-body{ padding:12px; }

  .modal-header h3{ font-size: 18px; }
}

@media (max-width: 360px){
  .news-hero h1{ font-size: 28px; }
  .news-hero p{ font-size: 15px; }
  .hero-buttons a{ padding: 11px 22px; font-size: 14px; }
}
