body.portfolio-page {
  background: var(--deep);
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portfolio-hero {
  position: relative;
  overflow: hidden;
  padding: 190px 0 108px;
  background:
    radial-gradient(circle at 16% 18%, rgba(43, 23, 111, 0.9), transparent 34%),
    radial-gradient(circle at 86% 30%, rgba(16, 71, 196, 0.34), transparent 31%),
    linear-gradient(135deg, #05081d, #090c28 62%, #111035);
}

.portfolio-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: radial-gradient(rgba(255, 255, 255, 0.38) 0.7px, transparent 0.7px);
  background-size: 25px 25px;
}

.portfolio-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin-right: auto;
}

.portfolio-hero h1 {
  max-width: 780px;
  margin: 18px 0 22px;
  font: 800 clamp(48px, 7vw, 88px) / 1.05 "Manrope", sans-serif;
  letter-spacing: -0.055em;
}

.portfolio-hero h1 span {
  color: var(--orange);
}

.portfolio-hero p {
  max-width: 650px;
  margin: 0;
  color: #bac1d7;
  font-size: 18px;
  line-height: 1.75;
}

.portfolio-content {
  min-height: 700px;
  padding: 42px 0 120px;
  background:
    linear-gradient(180deg, var(--deep) 0%, #0b0e2b 100%);
}

.portfolio-filters {
  position: sticky;
  top: 102px;
  z-index: 10;
  display: flex;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 76px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(8, 11, 36, 0.84);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.portfolio-filters::-webkit-scrollbar {
  display: none;
}

.portfolio-filter {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #bfc6dc;
  background: transparent;
  font: 700 13px "DM Sans", sans-serif;
  cursor: pointer;
  transition: 0.25s ease;
}

.portfolio-filter:hover,
.portfolio-filter:focus-visible,
.portfolio-filter.is-active {
  color: #08102d;
  background: var(--orange);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.project-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.project-card:hover,
.project-card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(255, 173, 22, 0.48);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.25);
}

.project-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #111533;
  cursor: pointer;
}

.project-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.project-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(4, 7, 25, 0.72));
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.project-cover:hover img,
.project-cover:focus-visible img {
  transform: scale(1.035);
  filter: saturate(1.08);
}

.project-cover:hover::after,
.project-cover:focus-visible::after {
  opacity: 0.82;
}

.project-cover:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: -3px;
}

.project-cover-overlay {
  position: absolute;
  z-index: 1;
  right: 16px;
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.project-cover-overlay b {
  color: var(--orange);
  font-size: 18px;
}

.project-cover:hover .project-cover-overlay,
.project-cover:focus-visible .project-cover-overlay {
  opacity: 1;
  transform: none;
}

.project-card-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.project-card-info h3 {
  margin: 0 0 7px;
  color: #fff;
  font: 800 18px/1.25 "Manrope", sans-serif;
}

.project-category {
  color: #aeb5cd;
  font-size: 11px;
  line-height: 1.4;
}

.project-image-count {
  flex: 0 0 auto;
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  text-align: right;
  text-transform: uppercase;
}

.portfolio-status {
  margin: 22px 0 0;
  color: #737d99;
  font-size: 12px;
}

.portfolio-lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1100px) 72px;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px;
  visibility: hidden;
  background: rgba(3, 7, 24, 0.92);
  opacity: 0;
  backdrop-filter: blur(16px);
  transition: 0.25s ease;
}

.portfolio-lightbox.is-open {
  visibility: visible;
  opacity: 1;
}

.portfolio-lightbox .lightbox-panel {
  width: min(1100px, 78vw);
  transform: translateY(18px) scale(0.97);
  transition: 0.3s ease;
}

.portfolio-lightbox.is-open .lightbox-panel {
  transform: none;
}

.portfolio-lightbox img {
  width: 100%;
  height: min(72vh, 760px);
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.45);
}

.lightbox-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
}

.lightbox-meta p,
.lightbox-meta h2 {
  margin: 0;
}

.lightbox-meta p {
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
}

.lightbox-meta h2 {
  margin-top: 4px;
  color: #fff;
  font: 800 22px/1.3 "Manrope", sans-serif;
}

#lightbox-counter {
  color: #aeb5cd;
  font-size: 13px;
  white-space: nowrap;
}

.lightbox-thumbnails {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin-top: 14px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lightbox-thumbnail {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #111533;
  opacity: 0.58;
  cursor: pointer;
  transition: 0.2s ease;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail:focus-visible,
.lightbox-thumbnail.is-active {
  border-color: var(--orange);
  opacity: 1;
}

.lightbox-thumbnail img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  box-shadow: none;
}

.lightbox-arrow,
.portfolio-lightbox .lightbox-close {
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: 0.25s ease;
}

.lightbox-arrow:hover,
.lightbox-arrow:focus-visible,
.portfolio-lightbox .lightbox-close:hover,
.portfolio-lightbox .lightbox-close:focus-visible {
  color: #07132d;
  background: var(--orange);
}

.lightbox-arrow {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font: 400 36px/1 Arial, sans-serif;
}

.portfolio-lightbox .lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font: 300 34px/1 Arial, sans-serif;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .portfolio-hero {
    padding-top: 160px;
  }

  .portfolio-filters {
    top: 94px;
    width: 100%;
  }

  .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-lightbox {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    gap: 12px;
    padding: 24px;
  }

  .portfolio-lightbox .lightbox-panel {
    width: 100%;
  }
}

@media (max-width: 1200px) and (min-width: 981px) {
  .project-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .portfolio-hero {
    padding: 132px 0 74px;
  }

  .portfolio-hero h1 {
    font-size: clamp(42px, 12vw, 58px);
    line-height: 1.1;
  }

  .portfolio-hero p {
    font-size: 16px;
    line-height: 1.8;
  }

  .portfolio-content {
    padding-top: 28px;
  }

  .portfolio-filters {
    top: 84px;
    margin-bottom: 52px;
  }

  .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .project-card-info {
    display: block;
    padding: 12px;
  }

  .project-card-info h3 {
    font-size: 16px;
  }

  .project-image-count {
    display: block;
    margin-top: 8px;
    text-align: left;
  }

  .portfolio-lightbox {
    display: flex;
    padding: 18px;
  }

  .portfolio-lightbox .lightbox-panel {
    width: 100%;
  }

  .portfolio-lightbox img {
    height: 68vh;
  }

  .lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
  }

  .lightbox-prev {
    left: 14px;
  }

  .lightbox-next {
    right: 14px;
  }

  .portfolio-lightbox .lightbox-close {
    top: 14px;
    right: 14px;
  }

  .lightbox-meta h2 {
    font-size: 18px;
  }
}

@media (max-width: 420px) {
  .project-list {
    grid-template-columns: 1fr;
  }
}
