:root {
  color-scheme: dark;
  color: #f3f3f3;
  background: #060607;
  font-family: "Avenir Next", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.08), transparent 28%),
    linear-gradient(140deg, #060607 0%, #121217 45%, #08080a 100%);
  color: #f1efe8;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-y: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 4px);
  opacity: 0.18;
  mix-blend-mode: screen;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 1.25rem;
  min-height: 56px;
  background: rgba(6, 6, 7, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.brand-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  justify-self: start;
}

.brand {
  display: flex;
  align-items: center;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 0;
  padding: 0;
  background: none;
}

.back-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-home-link:hover {
  opacity: 1;
  transform: translateX(-1px);
}

.nav-links {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.nav-links a {
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
}

.nav-links a:hover {
  opacity: 1;
  transform: translateY(-1px);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.22);
}

main {
  padding: 0 1.25rem 2.4rem;
}

.popup-stage {
  position: relative;
  min-height: 120vh;
  overflow-x: hidden;
  overflow-y: visible;
  padding-top: 0.4rem;
  margin-top: -0.8rem;
}

.art-popup {
  position: absolute;
  left: auto;
  top: auto;
  width: var(--popup-width, 390px);
  max-width: calc(100vw - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #f8f4ea;
  transform: scale(0.96);
  opacity: 0;
  animation: popup-in 0.35s ease-out forwards;
  cursor: grab;
  overflow: hidden;
  z-index: 40;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.art-popup.portrait {
  --popup-width: min(390px, calc(100vw - 2rem));
}

.art-popup.landscape {
  --popup-width: min(620px, calc(100vw - 2rem));
}

@media (max-width: 820px) {
  .art-popup.landscape {
    --popup-width: min(520px, calc(100vw - 2rem));
  }

  .art-popup.portrait {
    --popup-width: min(320px, calc(100vw - 2rem));
  }
}

@media (max-width: 620px) {
  .art-popup.landscape {
    --popup-width: min(420px, calc(100vw - 2rem));
  }

  .art-popup.portrait {
    --popup-width: min(280px, calc(100vw - 2rem));
  }
}

.art-popup.dragging {
  cursor: grabbing;
  z-index: 50;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.popup-close-button {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.65);
  color: #f8f4ea;
  font-size: 1rem;
  cursor: pointer;
  z-index: 2;
}

.art-popup img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  max-height: 520px;
  pointer-events: none;
}

.art-popup.landscape img {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

.art-popup.portrait img {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  height: auto;
  object-fit: cover;
}

.art-popup .popup-label {
  display: block;
  padding: 0.4rem 0.65rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  margin-top: 0;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.art-popup.portrait .popup-close-button {
  top: 0.6rem;
  right: 0.6rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow-x: hidden;
}

.modal-overlay.open {
  display: flex;
}

.modal-window {
  position: relative;
  width: min(1200px, calc(100vw - 4rem));
  max-width: 100%;
  max-height: 90vh;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  padding: 1.25rem;
  background: rgba(8, 8, 10, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.modal-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  min-height: 420px;
  overflow: hidden;
}

.modal-media img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(78vh, calc(100vh - 6rem));
  object-fit: contain;
}

.modal-close-button {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.55);
  color: #f8f4ea;
  font-size: 1rem;
  cursor: pointer;
  z-index: 2;
}

.modal-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.35rem 0.2rem;
}

.modal-info h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.modal-info p {
  margin: 0;
  color: #d7d0c0;
  line-height: 1.7;
}

.modal-close-hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8e8780;
}

body.popup-open {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

html.popup-open {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.page-shell {
  max-width: 920px;
  margin: 3.4rem auto;
  padding: 2.2rem 2rem;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.035);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.page-shell h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.8rem, 3.3vw, 2.8rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-shell p,
.page-shell li {
  color: #d9d4c7;
  line-height: 1.8;
}

.page-shell .signal-list {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  display: grid;
  gap: 0.6rem;
}

.page-shell .signal-list li {
  padding: 0.65rem 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

footer {
  text-align: center;
  padding: 1.25rem 1rem 1.75rem;
  color: #8c887e;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

@media (max-width: 720px) {
  .modal-window {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow: auto;
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
    margin: 0 auto;
  }

  .modal-media {
    min-height: 280px;
  }

  .modal-overlay {
    padding: 1rem;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .brand-stack {
    justify-self: center;
    align-items: center;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem 1rem;
  }

  .page-shell {
    margin: 2rem 0;
    padding: 1.5rem;
  }
}
