:root {
  --bg: #fbfcff;
  --bg-soft: #f0f3f7;
  --text: #111111;
  --text-soft: #4b5665;
  --surface: rgba(255, 255, 255, 0.78);
  --border: rgba(142, 160, 181, 0.3);
  --accent: #0a84ff;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #d8e8ff 0%, rgba(216, 232, 255, 0) 35%),
    radial-gradient(circle at 90% 80%, #dbe1ea 0%, rgba(219, 225, 234, 0) 42%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-soft) 100%);
  overflow-x: hidden;
}

.portfolio-shell {
  width: min(1200px, 100% - 3rem);
  margin: 0 auto;
  padding: clamp(2.4rem, 3vw, 3.5rem) 0 4rem;
}

.page-header {
  text-align: center;
  margin-bottom: clamp(1.8rem, 4vw, 2.8rem);
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4.8vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  font-weight: 800;
  background: linear-gradient(115deg, #0d0d0d 20%, #0a84ff 58%, #3f3f3f 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-header p {
  margin: 0.95rem 0 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: clamp(1rem, 1.9vw, 1.5rem);
}

.project-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(19, 33, 56, 0.16);
  backdrop-filter: blur(14px);
}

.media-wrap {
  padding: 0.75rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
}

.video-frame {
  width: 100%;
  border: 0;
  border-radius: 14px;
  aspect-ratio: 16 / 9;
  display: block;
}

.image-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.55rem;
}

.image-mosaic img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  border: 1px solid rgba(130, 147, 170, 0.25);
  cursor: zoom-in;
}

.project-content {
  padding: 0.5rem 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
}

.project-title {
  margin: 0;
  font-size: clamp(1.06rem, 1.2vw, 1.3rem);
  line-height: 1.2;
}

.project-description {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.97rem;
  line-height: 1.52;
}

.project-link {
  margin-top: auto;
  align-self: flex-start;
  padding: 0.55rem 0.88rem;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.11);
  color: #0058b5;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(10, 132, 255, 0.22);
}

.project-link:focus-visible {
  outline: 3px solid rgba(10, 132, 255, 0.5);
  outline-offset: 2px;
}

.loading-state,
.error-state {
  text-align: center;
  color: var(--text-soft);
  padding: 2rem;
  font-weight: 500;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(10, 16, 27, 0.82);
  padding: 1rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font: inherit;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.lightbox-image {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 26px 60px rgba(2, 7, 16, 0.52);
  cursor: pointer;
}

@media (max-width: 720px) {
  .portfolio-shell {
    width: min(1200px, 100% - 1.2rem);
    padding-top: 1.8rem;
  }

  .project-card {
    border-radius: 16px;
  }

  .media-wrap {
    padding: 0.62rem;
  }
}
