:root {
  --main-bg-color: black;
  --accent-color: white;
}

html,
body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

body {
  background-color: var(--main-bg-color);
  color: var(--accent-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  cursor: url(https://cur.cursors-4u.net/mechanics/mec-3/mec300.cur), auto !important;
  box-sizing: border-box;
  font-family: 'Courier New', Courier, monospace;
  font-size: 18px;
}

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

/* Star animation */
.star {
  position: absolute;
  background-color: white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.star.visible {
  opacity: 0.3;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.star.animate {
  animation: twinkle var(--duration) infinite var(--delay);
}

/* Layout elements */
header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.content {
  flex: 1;
  width: 100%;
  padding: 0 1rem;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Logo styles - absolutely positioned to ensure consistency across pages */
header {
  width: 100%;
  position: relative;
  height: 110px;
  overflow: visible;
}

#ascii-art2 {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#ascii-art2 img {
  height: 88px;
  width: auto;
  max-width: 100%;
  display: block;
}

/* 3D container */
#geo-container {
  position: relative;
  z-index: 1;
  background-color: var(--main-bg-color);
  width: 370px;
  height: 370px;
  margin: 10px auto;
  border: 1px solid #bebebe;
  box-shadow: 0 0 20px #5d5d5d;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

/* Glowing effects */
@keyframes mainImageGlow {
  0%,
  100% {
    box-shadow: 0 0 40px var(--accent-color);
  }
  50% {
    box-shadow: 0 0 60px var(--accent-color);
  }
}

.glow-image,
.horizontal-image {
  display: block;
  margin: 20px auto;
  padding: 5px;
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--accent-color);
  box-shadow: 0 0 50px var(--accent-color);
  animation: mainImageGlow 3s ease-in-out infinite;
}

/* Content layout */
.content-center {
  text-align: center;
  width: 100%;
  margin: 20px 0;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

.stars {
  font-size: 24px;
  margin: 0 0 20px 0;
}

.info-text {
  display: inline-block;
  text-align: left;
  font-size: 18px;
  margin: 0 auto;
  line-height: 1.4;
}

.content-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Project styles */
.project {
  margin-bottom: 60px;
  width: 100%;
  max-width: 1200px;
}

.project-title {
  font-size: 1.8em;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--accent-color);
  text-align: left;
}

.subtitle {
  text-align: left;
  margin: 0 0 30px 0;
  font-size: 1.5em;
  border-bottom: 1px solid var(--accent-color);
  padding-bottom: 10px;
  width: 100%;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  padding: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-image {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--accent-color);
  object-fit: cover;
  transition: transform 0.3s, box-shadow 0.3s ease;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  justify-self: center;
}

.gallery-image:hover {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

/* Text and links */
.project-description {
  line-height: 1.6;
  margin: 25px 0;
  text-align: left;
  max-width: 1200px;
  font-size: 16px;
}

.project-description p {
  margin-bottom: 15px;
}

.project-description a,
.pdf-link {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-color);
  padding-bottom: 2px;
  transition: opacity 0.3s;
}

.project-description a:hover,
.pdf-link:hover {
  opacity: 0.8;
}

.back-link {
  margin: 30px 0 60px;
  text-align: left;
}

.back-link a,
.nav-link {
  color: var(--accent-color);
  text-decoration: none;
  transition: opacity 0.3s;
}

.back-link a {
  font-size: 16px;
}

.back-link a:hover,
.nav-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.nav-link {
  display: inline-block;
  margin: 5px 0;
}

/* Modal for gallery images */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  overflow: auto;
}

.modal-content {
  border: 3px solid var(--accent-color);
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
  margin: auto;
  display: block;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: var(--accent-color);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Media queries */
@media only screen and (max-width: 1024px) {
  #geo-container {
    width: 360px;
    height: 360px;
  }

  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-image {
    max-width: 180px;
  }
}

@media only screen and (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.5;
  }

  header {
    height: 80px;
  }

  #ascii-art2 {
    top: 16px;
  }

  #ascii-art2 img {
    height: 48px;
  }

  .content-container {
    width: 100%;
    padding: 0 15px;
  }

  #geo-container {
    width: 320px;
    height: 320px;
    margin: 15px auto;
  }

  .gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .gallery-image {
    max-width: 140px;
  }

  .project-description,
  .nav-link {
    font-size: 14px;
    line-height: 1.5;
  }

  .content-center {
    padding: 0 15px;
  }

  .stars {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .info-text {
    font-size: 15px;
    max-width: 90%;
  }

  .project-title {
    font-size: 22px;
  }

  .project {
    margin-bottom: 30px;
  }

  .close {
    top: 10px;
    right: 20px;
    font-size: 30px;
  }
}

@media only screen and (max-width: 480px) {
  #geo-container {
    width: 280px;
    height: 280px;
  }

  #ascii-art2 {
    font-size: 4px;
  }

  #ascii-art2 img {
    height: 40px;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .gallery-image {
    max-width: 130px;
  }

  .project-title {
    font-size: 1.3em;
  }
}

@media only screen and (max-width: 320px) {
  #ascii-art2 {
    font-size: 3px;
  }

  #ascii-art2 img {
    height: 24px;
  }

  #geo-container {
    width: 250px;
    height: 250px;
  }
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
  #geo-container {
    height: 0;
    padding-bottom: 100%;
    position: relative;
  }

  #geo-container > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .gallery-image {
    height: 0;
    padding-bottom: 100%;
    position: relative;
    overflow: hidden;
  }

  .gallery-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
