/* ==========================================================================
   PORTFOLIO STYLING - NHẬT MINH MEDIA (ĐỒNG BỘ 100% VỚI BẢN MẪU VERCEL)
   ========================================================================== */

:root {
  --portfolio-hero-red: #f22f34;
  --portfolio-hero-container: min(1220px, calc(100vw - 40px));
  --portfolio-hero-ease: cubic-bezier(0.4, 0.2, 0.2, 1);
  --nm-blue: #0f3158;
  --nm-blue-deep: #031b47;
  --nm-red: #d52f2b;
  --nm-accent-blue: #1657f2;
}

/* --------------------------------------------------------------------------
   1. HERO BANNER
   -------------------------------------------------------------------------- */
.nm-portfolio-hero {
  position: relative;
  isolation: isolate;
  min-height: 620px;
  overflow: hidden;
  background: #031b47;
  color: #ffffff;
}

.nm-portfolio-hero-media,
.nm-portfolio-hero-media::after {
  position: absolute;
  inset: 0;
}

.nm-portfolio-hero-media {
  z-index: -3;
}

.nm-portfolio-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.nm-portfolio-hero-media::after {
  background:
    linear-gradient(90deg, rgba(1, 19, 52, 0.3) 0%, rgba(1, 19, 52, 0.08) 48%, rgba(1, 19, 52, 0.2) 100%),
    linear-gradient(180deg, rgba(2, 19, 50, 0.04) 48%, rgba(2, 18, 48, 0.52) 100%);
  content: "";
}

.nm-portfolio-hero-lines {
  position: absolute;
  z-index: -1;
  right: -72px;
  bottom: -20px;
  width: 430px;
  height: 145px;
  opacity: 0.72;
  pointer-events: none;
  transform: rotate(13deg);
}

.nm-portfolio-hero-lines::before,
.nm-portfolio-hero-lines::after {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 45, 49, 0.96));
  content: "";
}

.nm-portfolio-hero-lines::before { top: 48px; }
.nm-portfolio-hero-lines::after { top: 90px; }

.nm-portfolio-hero-shell {
  position: relative;
  width: var(--portfolio-hero-container);
  min-height: 620px;
  margin: 0 auto;
}

.nm-portfolio-hero-copy {
  position: relative;
  z-index: 5;
  width: min(610px, 52%);
  padding-top: 140px;
  animation: nm-portfolio-copy-in 720ms 80ms both var(--portfolio-hero-ease);
}

.nm-portfolio-hero-kicker {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 24px;
  border: 1.5px solid var(--portfolio-hero-red);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nm-portfolio-hero-copy h1 {
  margin: 24px 0 0;
  color: #ffffff !important;
  font-size: clamp(40px, 4.4vw, 60px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.nm-portfolio-hero-copy h1 span {
  display: block;
  margin-top: 8px;
  color: var(--portfolio-hero-red) !important;
}

.nm-portfolio-hero-copy p {
  max-width: 580px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.65;
}

.nm-portfolio-hero-actions {
  display: flex;
  margin-top: 32px;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nm-portfolio-hero-actions a {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.nm-portfolio-hero-actions a:hover {
  transform: translateY(-2px);
}

.nm-portfolio-hero-primary {
  min-width: 240px;
  gap: 20px;
  padding: 5px 6px 5px 24px;
  background: var(--portfolio-hero-red);
  color: #ffffff !important;
  box-shadow: 0 16px 36px rgba(243, 49, 53, 0.28);
}

.nm-portfolio-hero-primary > span {
  display: inline-grid;
  width: 44px;
  height: 44px;
  margin-left: auto;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #ef2d32;
  font-size: 18px;
}

.nm-portfolio-hero-secondary {
  min-width: 240px;
  gap: 24px;
  padding: 0 24px;
  border: 1.5px solid var(--portfolio-hero-red);
  background: rgba(2, 25, 64, 0.32);
  color: #ffffff !important;
}

.nm-portfolio-hero-secondary:hover {
  background: rgba(243, 49, 53, 0.16);
}

.nm-portfolio-hero-people {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  width: min(620px, 48vw);
  height: 580px;
  pointer-events: none;
  animation: nm-portfolio-people-in 850ms 90ms both var(--portfolio-hero-ease);
}

.nm-portfolio-hero-blur {
  position: absolute;
  z-index: 0;
  right: 4%;
  bottom: 2%;
  width: 92%;
  height: 78%;
  border-radius: 46% 52% 12% 20%;
  background: rgba(1, 31, 78, 0.3);
  -webkit-backdrop-filter: blur(14px) saturate(0.84);
  backdrop-filter: blur(14px) saturate(0.84);
  box-shadow: 0 0 70px 30px rgba(2, 25, 65, 0.26);
}

.nm-portfolio-hero-people img {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 20px 25px rgba(0, 10, 34, 0.25));
}

@keyframes nm-portfolio-copy-in {
  from { opacity: 0; transform: translate3d(-24px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes nm-portfolio-people-in {
  from { opacity: 0; transform: translate3d(30px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* --------------------------------------------------------------------------
   2. GALLERY & TOOLS SECTION
   -------------------------------------------------------------------------- */
.portfolio-page {
  padding: 60px 0 90px;
  background: #ffffff;
}

.portfolio-container {
  width: var(--portfolio-hero-container);
  margin: 0 auto;
}

.portfolio-tools {
  margin-top: 10px;
  scroll-margin-top: 120px;
  text-align: center;
}

.portfolio-tools-head {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.portfolio-tools-head h2 {
  max-width: 1180px;
  margin: 0;
  color: #031b47;
  font-size: clamp(28px, 2.7vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

/* Category Filter Slider */
.portfolio-industry-nav {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  margin: 0 auto;
}

.portfolio-filter-arrow {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1657f2;
  color: #fff;
  cursor: pointer;
  transition: background-color .24s ease, opacity .24s ease, transform .2s ease;
}

.portfolio-filter-arrow:hover:not(:disabled) {
  background: var(--portfolio-hero-red);
  transform: scale(1.05);
}

.portfolio-filter-arrow:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.portfolio-filter-arrow svg {
  width: 20px;
  height: 20px;
}

.portfolio-category-track {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 4px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: #f3f3f6;
  color: #20242d;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, transform .2s ease;
}

.filter-chip:hover {
  background: #e5e9f2;
  color: #0f3158;
}

.filter-chip.active {
  background: #1657f2;
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(22, 87, 242, 0.28);
}

/* Service Filter Box */
.portfolio-service-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  width: min(100%, 640px);
  margin: 28px auto 0;
  padding: 14px 18px;
  border-radius: 20px;
  background: #f3f3f6;
  text-align: left;
}

.portfolio-service-label {
  color: #20242d;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.portfolio-select {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  background: #ffffff;
}

.portfolio-select select {
  width: 100%;
  border: 0;
  background: transparent;
  color: #20242d;
  font-size: 15px;
  font-weight: 700;
  appearance: none;
  cursor: pointer;
  outline: none;
  padding-right: 30px;
}

.portfolio-select svg {
  position: absolute;
  right: 18px;
  pointer-events: none;
  color: #1657f2;
  width: 20px;
  height: 20px;
}

.portfolio-result-count-box {
  margin-top: 18px;
  text-align: center;
}

.portfolio-result-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(22, 87, 242, 0.08);
  color: #1657f2;
  font-size: 13px;
  font-weight: 750;
}

/* --------------------------------------------------------------------------
   3. PROJECT RESULTS GRID & CARDS
   -------------------------------------------------------------------------- */
.portfolio-results-shell {
  margin-top: 36px;
  position: relative;
}

.portfolio-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 28px;
}

.project-card {
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #edf0f5;
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15, 49, 88, 0.04);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: #d7e0ee;
  box-shadow: 0 18px 42px rgba(15, 49, 88, 0.09);
}

.project-card-open {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.project-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 551 / 400;
  overflow: hidden;
  border-radius: 17px 17px 0 0;
  background: #e2e8f0;
}

.project-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .45s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-card-media img {
  transform: scale(1.04);
}

.project-card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(3, 27, 71, 0.85);
  color: #ffffff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  backdrop-filter: blur(8px);
}

.project-card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 220px;
  padding: 22px 22px 0;
  background: #ffffff;
}

.project-card-body h3 {
  display: -webkit-box;
  min-height: 52px;
  margin: 0 0 16px;
  overflow: hidden;
  color: #171b24;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.02em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  transition: color .24s ease;
}

.project-card:hover .project-card-body h3 {
  color: #1657f2;
}

/* 3-Column KPIs Footer */
.project-card-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: auto -22px 0;
  border-top: 1px solid #edf0f5;
  background: #fbfcfe;
}

.project-card-kpi {
  min-width: 0;
  min-height: 88px;
  padding: 14px 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.project-card-kpi + .project-card-kpi {
  border-left: 1px solid #edf0f5;
}

.project-card-kpi strong {
  display: block;
  color: #1657f2;
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 900;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
}

.project-card-kpi span {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

/* Empty State */
.portfolio-empty {
  display: none;
  margin: 40px auto;
  padding: 60px 24px;
  max-width: 600px;
  text-align: center;
  border-radius: 20px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
}

.portfolio-empty strong {
  display: block;
  color: #031b47;
  font-size: 20px;
  font-weight: 800;
}

.portfolio-empty span {
  display: block;
  margin-top: 8px;
  color: #64748b;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   4. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .nm-portfolio-hero,
  .nm-portfolio-hero-shell {
    min-height: 640px;
  }
  .nm-portfolio-hero-copy {
    width: 54%;
    padding-top: 130px;
  }
  .nm-portfolio-hero-people {
    right: -20px;
    width: 540px;
    height: 520px;
  }
  .portfolio-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .nm-portfolio-hero,
  .nm-portfolio-hero-shell {
    min-height: 720px;
  }
  .nm-portfolio-hero-copy {
    width: 100%;
    padding-top: 80px;
    text-align: center;
  }
  .nm-portfolio-hero-copy h1 {
    font-size: clamp(34px, 8.5vw, 44px);
  }
  .nm-portfolio-hero-copy p {
    margin: 16px auto 0;
    font-size: 14px;
  }
  .nm-portfolio-hero-actions {
    justify-content: center;
    gap: 12px;
  }
  .nm-portfolio-hero-people {
    right: 50%;
    width: 440px;
    height: 380px;
    transform: translateX(50%);
  }
  .portfolio-page {
    padding: 40px 0 60px;
  }
  .portfolio-results {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .portfolio-service-box {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .project-card-kpi strong {
    font-size: 15px;
  }
}

/* ==========================================================================
   PROJECT DETAIL POPUP MODAL (Hiển thị chi tiết dự án không chuyển trang)
   ========================================================================== */
.nm-project-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(8, 21, 46, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.nm-project-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nm-project-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: min(86vh, 640px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 30px 70px -15px rgba(2, 17, 44, 0.45), 0 0 0 1px rgba(9, 36, 67, 0.06);
  overflow: hidden;
  display: flex;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
  opacity: 0;
}

.nm-project-modal-backdrop.is-open .nm-project-modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Nút đóng */
.nm-project-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.nm-project-modal-close:hover {
  background: #fef2f2;
  color: #d32029;
  border-color: #fecaca;
  transform: scale(1.08);
}

/* Cột bên trái: Ảnh dự án */
.nm-project-modal-media {
  width: 48%;
  position: relative;
  background: #031b47;
  flex-shrink: 0;
  overflow: hidden;
}

.nm-project-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.nm-project-modal-pill {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Cột bên phải: Thông tin dự án */
.nm-project-modal-content {
  width: 52%;
  padding: 34px 34px 28px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nm-project-modal-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(227, 30, 36, 0.08);
  color: #d32029;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.nm-project-modal-title {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.32;
  color: #0b1f42;
  margin: 0 0 10px;
  letter-spacing: -0.025em;
  padding-right: 30px;
}

.nm-project-modal-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: #4a5568;
  margin: 0 0 18px;
  font-weight: 400;
}

/* 4 KPI Grid (2x2) */
.nm-project-modal-kpi-grid {
  background: #f8fafd;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 22px;
}

.nm-project-modal-kpi-item .nm-kpi-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #718096;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.nm-project-modal-kpi-item .nm-kpi-value {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: #0b1f42;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nút CTA tư vấn */
.nm-project-modal-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d32029 0%, #ee2427 100%);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(211, 32, 41, 0.45);
  transition: all 0.25s ease;
}

.nm-project-modal-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(211, 32, 41, 0.55);
  color: #ffffff !important;
}

.nm-project-modal-cta svg {
  transition: transform 0.2s ease;
}

.nm-project-modal-cta:hover svg {
  transform: translateX(3px);
}

/* Responsive trên mobile */
@media (max-width: 768px) {
  .nm-project-modal-backdrop {
    padding: 16px;
  }
  .nm-project-modal-dialog {
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
  }
  .nm-project-modal-media {
    width: 100%;
    min-height: 220px;
    height: 220px;
  }
  .nm-project-modal-content {
    width: 100%;
    padding: 24px 20px 20px;
  }
  .nm-project-modal-title {
    font-size: 19px;
  }
  .nm-project-modal-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    padding: 12px;
  }
  .nm-project-modal-kpi-item .nm-kpi-value {
    font-size: 12.5px;
  }
}
