:root {
  --primary: #4310ff;
  --primary-glow: rgba(67, 16, 255, 0.45);
  --accent: #ff7824;
  --cyan: #00e5ff;
  --navy: #10104b;
  --dark-bg: #0d0c30;
  --card-bg: rgba(22, 20, 68, 0.85);
  --border: rgba(138, 92, 255, 0.25);
  --text-main: #fff;
  --text-muted: #b9b2de;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #10104b 0%, #0d0c30 100%);
  color: var(--text-main);
  min-height: 100vh;
}

.portfolio-page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.portfolio-header {
  text-align: center;
  margin-bottom: 45px;
}

.portfolio-kicker {
  display: inline-block;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.portfolio-header h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 850;
  margin: 0 0 16px;
  color: #fff;
  text-shadow: 0 0 30px var(--primary-glow);
}

.portfolio-subtitle {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 780px;
  margin: 0 auto 30px;
}

.portfolio-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.filter-pill {
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover, .filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 16px var(--primary-glow);
  transform: translateY(-2px);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.portfolio-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
  cursor: pointer;
}

.portfolio-card:hover {
  transform: translateY(-6px);
  border-color: var(--cyan);
  box-shadow: 0 16px 36px rgba(0, 229, 255, 0.18);
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: #1a174d;
  overflow: hidden;
}

.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.portfolio-card:hover .card-thumb-wrap img {
  transform: scale(1.05);
}

.card-category-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(16, 16, 75, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
}

.card-client {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 12px;
}

.card-desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 16px;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.card-tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #d0c9f7;
}

/* Modal Lightbox */
.portfolio-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100%;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}
.portfolio-modal[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 30, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 2;
  background: #171549;
  border: 1px solid rgba(138, 92, 255, 0.4);
  border-radius: 24px;
  max-width: 780px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.25s ease-out;
  margin: auto 0;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.3); }

.modal-media-wrap {
  width: 100%;
  background: #0d0c2e;
  max-height: 420px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-media-wrap img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.modal-info {
  padding: 28px;
}

.modal-badge {
  display: inline-block;
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.modal-info h2 {
  font-size: 1.8rem;
  margin: 0 0 8px;
  color: #fff;
}

.modal-client {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 20px;
  white-space: pre-line;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.modal-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 999px;
  transition: all 0.2s;
}
.modal-link-btn:hover {
  background: #5b28ff;
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-2px);
}

.loading-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

@media (max-width: 900px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .portfolio-grid { grid-template-columns: 1fr; }
  .portfolio-header h1 { font-size: 2rem; }
}
