/* =========================
   Behtar Blue/Red Theme (clean)
   ========================= */

:root,
:root[data-bs-theme="light"],
:root[data-bs-theme="dark"]{
  --brand-primary: #0b5aa6;
  --brand-primary-600: #094886;
  --brand-accent:  #d6252a;

  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: 11,90,166;
  --bs-link-color: var(--brand-primary);
  --bs-link-hover-color: var(--brand-primary-600);
  --bs-focus-ring-color: rgba(var(--bs-primary-rgb), .25);

  --site-max-width: 1140px;
}

:root[data-bs-theme="dark"]{
  --bs-link-hover-color: color-mix(in srgb, var(--brand-primary) 85%, white 15%);
}

/* ---------- Base ---------- */
body { font-feature-settings: "rlig" 1, "calt" 1; }
.navbar { background: var(--bs-body-bg) !important; border-bottom: 1px solid var(--bs-border-color); }
.navbar .btn { border-radius: 999px; }
.navbar .nav-link { position: relative; color: var(--bs-body-color); }
.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active { color: var(--brand-primary); }
.navbar .nav-link::after{
  content:""; position:absolute; left:0; right:0; bottom:-2px; height:2px;
  background: var(--brand-primary); transform:scaleX(0); transform-origin:left; transition:transform .18s ease;
}
.navbar .nav-link:hover::after,
.navbar .nav-link:focus::after,
.navbar .nav-link.active::after{ transform:scaleX(1); }
.dropdown-menu { border: 1px solid var(--bs-border-color); }

.navbar-brand img { display:block; height:30px; width:auto; }
@media (min-width: 992px){ .navbar-brand img { height:34px; } }

/* Containers capped site-wide */
.container,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl,
.navbar > .container,
.site-footer > .container{ max-width: var(--site-max-width) !important; }

@media (min-width: 1400px){
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-xxl,
  .navbar > .container,
  .site-footer > .container{
    padding-inline: 1rem;
  }
}

/* Full-width utility (keep for other sections) */
.bleed{
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* ---------- Buttons ---------- */
.btn-primary{
  --bs-btn-color:#fff;
  --bs-btn-bg:var(--brand-primary);
  --bs-btn-border-color:var(--brand-primary);
  --bs-btn-hover-color:#fff;
  --bs-btn-hover-bg:var(--brand-primary-600);
  --bs-btn-hover-border-color:var(--brand-primary-600);
  --bs-btn-focus-shadow-rgb:var(--bs-primary-rgb);
  --bs-btn-active-bg:var(--brand-primary-600);
  --bs-btn-active-border-color:var(--brand-primary-600);
}
.btn-outline-primary{
  --bs-btn-color:var(--brand-primary);
  --bs-btn-border-color:var(--brand-primary);
  --bs-btn-hover-color:#fff;
  --bs-btn-hover-bg:var(--brand-primary);
  --bs-btn-hover-border-color:var(--brand-primary);
  --bs-btn-focus-shadow-rgb:var(--bs-primary-rgb);
}

/* Accent button */
.btn-accent{
  --bs-btn-color:#fff;
  --bs-btn-bg:var(--brand-accent);
  --bs-btn-border-color:var(--brand-accent);
}
.btn-accent:hover{ filter: brightness(.95); }

/* ---------- Cards ---------- */
.card.modern{
  border:1px solid var(--bs-border-color);
  border-radius:1rem;
  overflow:hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card.modern:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border-color: rgba(var(--bs-primary-rgb), .30);
}
.card.modern .meta{ font-size:.825rem; color:var(--bs-secondary-color); }
.card img { object-fit: cover; width: 100%; height: auto; max-height: 220px; }
.card-cover-16x9 { aspect-ratio: 16/9; }
.card-cover-4x3  { aspect-ratio: 4/3; }

/* ---------- Pagination / Forms ---------- */
.pagination .page-link{
  color: var(--brand-primary);
  border-color: rgba(var(--bs-primary-rgb), .35);
}
.pagination .page-link:hover{
  color:#fff; background-color:var(--brand-primary); border-color:var(--brand-primary);
}
.pagination .page-item.active .page-link{
  color:#fff; background-color:var(--brand-primary); border-color:var(--brand-primary);
}
.pagination .page-item.disabled .page-link{
  color: var(--bs-secondary-color);
  background: transparent;
  border-color: rgba(var(--bs-primary-rgb), .25);
  opacity:.6;
}
.form-control:focus, .form-select:focus{
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

/* ---------- Footer ---------- */
.site-footer{
  background: linear-gradient(180deg, var(--bs-body-bg) 0%, rgba(0,0,0,.02) 100%);
  border-top: 1px solid var(--bs-border-color);
}
.site-footer .footer-link{ color: var(--bs-body-color); text-decoration: none; }
.site-footer .footer-link:hover{ color: var(--brand-primary); text-decoration: underline; }
.site-footer .social a{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; border-radius:50%;
  color: var(--brand-primary);
  border:1px solid rgba(var(--bs-primary-rgb), .35);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.site-footer .social a:hover{ color:#fff; background:var(--brand-primary); border-color:var(--brand-primary); }
:root[data-bs-theme="dark"] .site-footer{
  background: linear-gradient(180deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.06) 100%);
}
.footer-logo { display:block; height:34px; width:auto; }
@media (min-width: 992px){ .footer-logo { height:40px; } }
:root[data-bs-theme="dark"] .footer-logo { filter: brightness(1.15) contrast(1.05); }

/* ---------- Status badges ---------- */
.badge-status-current       { background: var(--brand-primary); }
.badge-status-in-development{ background: #ffd85a; color:#111; }
.badge-status-completed     { background: #adb5bd; color:#111; }

/* ---------- Video embeds ---------- */
.video-embed { background: #000; }
.video-embed iframe { border: 0; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  .navbar .nav-link::after,
  .card.modern { transition: none; }
}

/* ======================================================
   HERO COMPONENTS
   ====================================================== */

/* A) LOGO HERO (centered) */
.hero-brand {
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(135deg, rgba(11,90,166,.06), rgba(214,37,42,.06));
  border-radius: 0 0 24px 24px;
}
.hero-brand__inner {
  min-height: clamp(240px, 36vw, 520px);
  display: flex; flex-direction: column; justify-content: center;
  text-align: center;
}
.hero-brand__img {
  display: block; margin-inline: auto;
  height: clamp(140px, 20vw, 360px);
  width: auto; max-width: min(100%, 1200px);
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.06));
}
.hero-brand .btn-outline-light{
  --bs-btn-color:#fff;
  --bs-btn-border-color:rgba(255,255,255,.65);
  --bs-btn-hover-bg:rgba(255,255,255,.1);
  --bs-btn-hover-border-color:rgba(255,255,255,.9);
  --bs-btn-hover-color:#fff;
}

/* B) PHOTO HERO */
.hero-photo {
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0 0 24px 24px;
  overflow: hidden;
}
.hero-photo__img {
  width: 100%;
  height: clamp(240px, 36vw, 520px);
  object-fit: cover;
  display: block;
}
.hero-photo.hero-photo--rotator::before,
.hero-photo.hero-photo--rotator::after{
  content:"";
  position:absolute; inset:0;
  background-size: cover;
  background-position: center;
  filter: contrast(1.05) brightness(.85);
  opacity:.15;
  border-radius: inherit;
}
.hero-photo.hero-photo--rotator::before{ animation: heroFadeA 14s linear infinite; }
.hero-photo.hero-photo--rotator::after { animation: heroFadeB 14s linear infinite; }
@keyframes heroFadeA { 0%,45%{opacity:.18} 55%,100%{opacity:0} }
@keyframes heroFadeB { 0%,45%{opacity:0} 55%,100%{opacity:.18} }
@media (prefers-reduced-motion: reduce){
  .hero-photo.hero-photo--rotator::before,
  .hero-photo.hero-photo--rotator::after{ animation: none; }
}

/* =========================
   HERO PRO (split layout) — SINGLE SOURCE OF TRUTH
   ========================= */
.hero-pro{
  position:relative;
  border-radius: 0 0 24px 24px;
  padding: clamp(36px, 6vw, 72px) 0 clamp(32px, 5vw, 64px);
  overflow-x: clip; /* prevent any fractional overflow */
}
.hero-pro::before{
  content: "";
  position: absolute;
  inset: 0;
  /* bleed the background to viewport edges */
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: inherit;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 85% 20%, rgba(11,90,166,.07), transparent 70%),
    radial-gradient(900px 500px  at 0% 90%, rgba(214,37,42,.06), transparent 70%),
    linear-gradient(135deg, rgba(11,90,166,.04), rgba(214,37,42,.04));
}

.hero-pro__frame{ position:relative; isolation:isolate; }

.hero-pro__grid{
  display:grid;
  grid-template-columns: 1fr;
  align-items:center;
  gap: clamp(12px, 2vw, 24px);
  min-height: clamp(260px, 36vw, 520px);
}

/* Left column */
.hero-pro__copy{ max-width: 700px; z-index:1; }
.hero-pro__title{
  margin:0 0 .25rem;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(28px, 4.4vw, 48px);
}
.hero-pro__tag{
  margin: 0 0 1rem;
  color: var(--bs-secondary-color);
  font-size: clamp(15px, 1.6vw, 18px);
  max-width: 56ch;
}
.hero-pro__ctas{ display:flex; gap:.5rem; flex-wrap:wrap; }

/* Right column (default “carded” art) */
.hero-pro__art{
  position:relative;
  justify-self:end;
  background: color-mix(in srgb, var(--bs-body-bg) 96%, white 4%);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
  border-radius: 20px;
  padding: clamp(12px, 1.8vw, 18px);
  max-width: min(100%, 680px);
  overflow: hidden;
}
.hero-pro__logo{
  display:block;
  width: 100%;
  max-width: 640px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.06));
}

/* Two-column from lg up */
@media (min-width: 992px){
  .hero-pro__grid{
    grid-template-columns: minmax(300px, .75fr) minmax(520px, 1.25fr);
    column-gap: clamp(16px, 4vw, 56px);
  }
  .hero-pro__art{ justify-self:center; max-width: min(100%, 960px); }
  .hero-pro__logo{ max-width: clamp(560px, 52vw, 980px); margin: 0 auto; }
}

/* XL screens */
@media (min-width: 1400px){
  .hero-pro__art{ max-width: min(100%, 1040px); }
  .hero-pro__logo{ max-width: clamp(620px, 48vw, 1040px); }
}

/* Logo-only variant */
.hero-pro--logo-only .hero-pro__art{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: none;
  overflow: visible;
}
.hero-pro--logo-only .hero-pro__logo{
  display: block;
  width: min(92vw, 1200px);
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  filter: none;
}

/* Kill any legacy hero effects */
.hero-fullbleed .hero-bg img,
.hero-rotator .carousel-item img{ height:auto !important; width:auto !important; max-width:100% !important; object-fit:contain !important; }
.hero-rotator::before,
.hero-rotator::after{ content:none !important; background:none !important; animation:none !important; opacity:0 !important; }

/* =========================
   KPI Dock
   ========================= */
.kpi-dock{
  position:relative;
  margin-top: -26px;
  margin-bottom: clamp(16px, 3vw, 24px);
}
.kpi-dock__grid{
  list-style:none; margin:0; padding:0;
  display:grid; gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 520px){
  .kpi-dock__grid{ grid-template-columns: 1fr; }
}
.kpi-dock__tile{
  text-align:center;
  padding: .9rem 1rem;
  border:1px solid var(--bs-border-color);
  border-radius: 1rem;
  background: var(--bs-body-bg);
  box-shadow: 0 4px 16px rgba(0,0,0,.04);
}
.kpi-dock__value{ font-weight: 800; font-size: 1.45rem; }
.kpi-dock__label{ color: var(--bs-secondary-color); font-size: .9rem; }

/* ---------- Bootstrap color normalizers ---------- */
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--brand-primary) !important; }
.progress-bar { background-color: var(--brand-primary); }
a.link-primary, .text-primary { color: var(--brand-primary) !important; }
.bg-primary { background-color: var(--brand-primary) !important; }
.border-primary { border-color: var(--brand-primary) !important; }

/* HERO PRO: stacked variant (logo on top, info underneath) */
.hero-pro--stacked .hero-pro__grid{
  grid-template-columns: 1fr !important;   /* force single column on all sizes */
  text-align: center;
}

.hero-pro--stacked .hero-pro__art{ 
  order: 0; 
  justify-self: center; 
}

.hero-pro--stacked .hero-pro__copy{ 
  order: 1; 
  justify-self: center; 
  margin-top: clamp(12px, 2vw, 20px);
}

.hero-pro--stacked .hero-pro__title{ 
  font-size: clamp(26px, 4vw, 40px); /* a bit smaller under the big logo */
  margin-bottom: .35rem;
}

.hero-pro--stacked .hero-pro__tag{ 
  max-width: 60ch; 
  margin-inline: auto; 
}

.hero-pro--stacked .hero-pro__ctas{ 
  justify-content: center; 
}

/* keep KPI overlap gentle when stacked */
.hero-pro--stacked + .kpi-dock{ 
  margin-top: -14px; 
}

/* --- Site-wide background gradient (light/dark) --- */
:root{
  --bg-behtar:
    radial-gradient(1200px 600px at 85% 20%, rgba(11,90,166,.07), transparent 70%),
    radial-gradient(900px 500px  at 0% 90%,  rgba(214,37,42,.06), transparent 70%),
    linear-gradient(135deg, rgba(11,90,166,.04), rgba(214,37,42,.04));
}
:root[data-bs-theme="dark"]{
  --bg-behtar:
    radial-gradient(1200px 600px at 85% 20%, rgba(11,90,166,.10), transparent 70%),
    radial-gradient(900px 500px  at 0% 90%,  rgba(214,37,42,.10), transparent 70%),
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
html, body { min-height: 100%; }
body { background: var(--bg-behtar); }

/* --- Hero without inner Bootstrap container --- */
.hero-pro__frame{
  max-width: var(--site-max-width);
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 24px);
}

/* Use the site background behind the hero, not an extra overlay */
.hero-pro--use-site-bg::before{ content: none !important; }

/* Optional: soften the KPI overlap a touch when stacked */
.hero-pro--stacked + .kpi-dock{ margin-top: -12px; }

/* Make navbar feel elevated over the hero */
.modern-nav{
  background: color-mix(in srgb, var(--bs-body-bg) 92%, white 8%) !important;
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* Language toggle pills */
.lang-toggle .btn{
  border-radius: 999px !important;
  padding-inline: .75rem;
  min-width: 44px; line-height: 1.2;
}
.lang-toggle .btn.active{
  color:#fff;
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* Mobile menu styles */
@media (max-width: 991.98px){
  /* Turn collapsed area into a card */
  .modern-nav .navbar-collapse.mobile-menu{
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    padding: .35rem;
    margin-top: .5rem;
  }

  /* Bigger tap targets; soften underline effect */
  .navbar .nav-link{ padding: .6rem .75rem; border-radius: .75rem; }
  .navbar .nav-link::after{ display:none; }                /* remove long blue line */
  .navbar .nav-link.active{
    font-weight: 600;
    background: rgba(var(--bs-primary-rgb), .08);
  }

  /* Dropdown behaves inline within the panel */
  .modern-nav .navbar-collapse .dropdown-menu{
    position: static; float: none; box-shadow: none;
    border: 0; padding: .25rem 0 .5rem 1rem;
  }
  .modern-nav .navbar-collapse .dropdown-item{
    padding: .4rem 0; border-radius: .5rem;
  }

  /* Language + Donate row inside panel */
  .modern-nav .menu-actions{
    display:flex; gap:.5rem; align-items:center;
    padding: .5rem; margin-top: .25rem;
    border-top: 1px dashed var(--bs-border-color);
  }
}

/* Desktop rhythm */
.navbar .nav-link{ padding:.5rem .75rem; }
.navbar .nav-link.active{ font-weight: 600; }
.navbar .dropdown-menu{ border-radius: .75rem; padding: .5rem; }

/* Project tabs: make long labels wrap and look tidy */
.project-tabs .btn{
  white-space: normal;      /* allow "In development" to break */
  line-height: 1.2;
  padding: .45rem .6rem;
}

/* On small screens: turn the group into a neat grid and
   neutralize Bootstrap's collapsed-border negative margins */
@media (max-width: 576px){
  .project-tabs{
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);   /* 2x2 grid for your 4 buttons */
    gap: .5rem;
  }
  .project-tabs .btn{
    margin-left: 0 !important;               /* cancel .btn-group -1px margin */
    border-radius: .5rem !important;         /* separate pill look */
  }
}

/* From sm and up: behave like a normal inline-flex btn group again */
@media (min-width: 577px){
  .project-tabs{
    display: inline-flex !important;
  }
}

.section-header{
  margin-bottom: 1rem;
}

/* Let long Tajik labels wrap nicely */
.project-tabs .btn{
  white-space: normal;
  line-height: 1.2;
  padding: .45rem .6rem;
}

/* MOBILE: turn the segmented group into a clean 2-column grid.
   This avoids Bootstrap's negative-margin seams and cramped look. */
@media (max-width: 576px){
  .project-tabs{
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
    width: 100%;
  }
  .project-tabs .btn{
    margin-left: 0 !important;           /* cancel .btn-group -1px margin */
    border-radius: .5rem !important;     /* individual pill tiles on mobile */
  }
}

/* TABLET & UP: keep classic single-row segmented buttons */
@media (min-width: 577px){
  .project-tabs{
    display: inline-flex !important;     /* use native .btn-group behavior */
  }
}

/* Hero */
.project-hero { min-height: 44vh; }
.project-hero-img { height: clamp(260px, 48vh, 520px); }
.project-hero-gradient {
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.55) 70%);
}
.project-hero-content {
  position:absolute; inset:0; display:flex; align-items:flex-end; padding-bottom:1.5rem;
}
.hero-donate-card {
  position:absolute; right:0; top:50%; transform:translateY(-50%);
  width:min(360px, 90%); margin-right: .25rem;
}

/* Support image aspect ratios in gallery */
.object-fit-cover { object-fit: cover; }
.ratio-4x3 { aspect-ratio: 4 / 3; }

/* Tweak white text legibility over hero */
.text-white-75 { color: rgba(255,255,255,.85); }

/* ---- Normalized card cover area (used by blog + project cards) ---- */
.card-cover-16x9 {
  position: relative;
  aspect-ratio: 16 / 9;           /* consistent visual height */
  overflow: hidden;
  background: var(--bs-secondary-bg);
}

.card-cover-16x9 > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;              /* crops tall/wide covers evenly */
  display: block;
}

/* Blog polish */
.blog-list .blog-card { transition: transform .18s ease, box-shadow .18s ease; }
.blog-list .blog-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.08); }

.line-clamp-3{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;

  /* helpful fallbacks so even without -webkit support we don't show walls of text */
  max-height: 4.5em;         /* ≈ 3 lines @ line-height:1.5 */
}

/* Put this in static/css/site.css */
.card-cover-16x9 { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.card-cover-16x9 > img {
  width: 100%;
  height: 100%;
  max-height: none;     /* override the global .card img max-height */
  object-fit: cover;
  display: block;
}
