/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --grid-column-width: clamp(160px, calc(100vw / 5), 260px);
  --container-padding-y: 40px;
  --container-padding-x: 20px;
  --sidebar-width: 300px;
  --content-gap: 60px;
  --divider-color: rgba(0, 0, 0, 0.08);
}

body {
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  font-size: 14px;
  letter-spacing: 0.008rem;
  color: #3f3f3f;
  background-color: #fff;
}

h2 {
  padding-bottom: 4px;
  font-size: 18px;
  font-weight: 600;
}

h1 {
  font-size: 24px;
}

a {
  color: #242424;
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

ol > li {
  list-style-position: inside;
}

/* Container and layout */
.project-single {
  font-size: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--container-padding-y) var(--container-padding-x);
}

.header {
  margin-bottom: 40px;
}

.site-title {
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 0;
  color: #000;
  display: block;
  padding: 0;
  margin-left: -2px;
  font-family: "Raleway", "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.site-title a {
  text-decoration: none;
  color: inherit;
}

.site-subtitle {
  font-size: 16px;
  color: #272727;
}

.main-content {
  position: relative;
  display: flex;
  gap: var(--content-gap);
  margin-bottom: 60px;
  isolation: isolate;
}

.main-content > * {
  position: relative;
  z-index: 1;
}

.sidebar {
  flex: 0 0 300px;
  font-size: 16px;
  position: relative;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(-1 * var(--content-gap) / 2);
  width: 1px;
  background-color: var(--divider-color);
}

.bio {
  margin-bottom: 20px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 16px;
}

.contact-links a {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact-links a:hover {
  text-decoration: underline;
}

.resume-link span {
  margin-left: 4px;
}

.bio p {
  font-size: 16px;
  margin-bottom: 15px;
}

.content {
  flex: 1;
  max-width: 900px;
}

/* Projects list */
.projects-list {
  font-size: 16px;
}

.project-item {
  margin-bottom: 40px;
}

.project-content-wrapper {
  display: flex;
  gap: 60px;
  align-items: flex-start;
}

.project-text {
  flex: 1;
}

.project-image {
  flex: 0 0 400px;
}

.project-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: opacity 0.2s ease;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.project-image a:hover img {
  opacity: 0.8;
}

.project-image a {
  text-decoration: none;
}

.project-title {
  font-weight: normal;
  margin-bottom: 15px;
}

.project-title a {
  text-decoration: none;
}

.project-title a:hover {
  text-decoration: underline;
}

.project-description {
  margin-bottom: 15px;
  line-height: 1.4;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.read-more {
  text-decoration: underline;
}

.project-codes {
  text-align: right;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.project-divider {
  border: none;
  border-top: 1px solid var(--divider-color);
  margin: 40px 0;
}

/* Single project page */
.project-hero-image {
  margin-bottom: 40px;
}

.project-hero-image .image-with-caption {
  border-radius: 8px;
}

.project-hero-image .image-with-caption img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 500px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

.project-hero-image .image-caption {
  border-radius: 0 0 8px 8px;
  border-top: 1px solid #e0e0e0;
}

/* Fallback for hero images without captions */
.project-hero-image img:not(.image-with-caption img) {
  width: 100%;
  height: auto;
  display: block;
  max-height: 500px;
  object-fit: cover;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.project-single-content {
  max-width: 800px;
}

.project-header {
  margin-bottom: 30px;
}

.project-header .project-title {
  font-weight: normal;
  margin-bottom: 10px;
}

.project-doc-info {
  color: #666;
  margin-bottom: 20px;
}

.project-metadata {
  margin-bottom: 20px;
  font-size: 12px;
  color: #666;
}

.project-content {
  margin-bottom: 40px;
  line-height: 1.5;
}

.project-content p {
  margin-top: 0;
  margin-bottom: 16px;
}

.project-content h2 {
  margin-top: 50px;
  margin-bottom: 8px;
}

.project-content h2:first-child {
  margin-top: 0;
}

.project-content h3 {
  margin-top: 35px;
  margin-bottom: 12px;
}

.project-navigation {
  border-top: 1px solid #000;
  padding-top: 20px;
  display: flex;
  gap: 20px;
}

.project-navigation a {
  text-decoration: underline;
}

/* Designs grid */
.designs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
  margin: 30px 0;
}

.design-item {
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.design-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.design-item img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  display: block;
  flex: 1 1 auto;
}

.design-item .image-caption {
  border-radius: 0 0 8px 8px;
  padding: 15px 20px;
  font-size: 16px;
  line-height: 1.4;
  color: #343434;
  background-color: #f9f9f9;
  border-top: 1px solid #e0e0e0;
  height: auto;
  min-height: 50px;
}

/* Image captions */
.image-caption {
  padding: 10px 15px;
  font-size: 11px;
  line-height: 1.3;
  color: #666;
  background-color: #f9f9f9;
  border-top: 1px solid #e0e0e0;
  height: 60px;
  display: flex;
  align-items: center;
  text-align: left;
}

/* Project images container */
.project-images {
  margin: 30px 0;
}

.image-with-caption {
  margin-bottom: 30px;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
}

.image-with-caption img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 500px;
  object-fit: cover;
  object-position: top;
}

.image-with-caption .image-caption {
  padding: 15px 20px;
  font-size: 16px;
  line-height: 1.4;
  color: #343434;
  background-color: #f9f9f9;
  border-top: 1px solid #e0e0e0;
  height: auto;
  min-height: 50px;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(64, 64, 64, 0.85);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  position: relative;
  margin: auto;
  padding: 0;
  width: 90%;
  max-width: 1200px;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 90vh;
}

.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-caption {
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 15px 20px;
  margin-top: 10px;
  border-radius: 4px;
  line-height: 1.4;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.2s ease;
}

.close:hover {
  color: #ccc;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 24px;
  padding: 16px 20px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  z-index: 1001;
}

.modal-nav:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

/* Responsive design for designs grid */
@media (max-width: 768px) {
  .designs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  /* Modal responsive styles */
  .modal-content {
    width: 95%;
    padding: 20px;
  }

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

  .modal-nav {
    font-size: 20px;
    padding: 12px 16px;
  }

  .modal-nav.prev {
    left: 10px;
  }

  .modal-nav.next {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .designs-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Mobile modal adjustments */
  .modal-content {
    width: 100%;
    padding: 10px;
  }

  .modal-content img {
    max-height: 80vh;
  }

  .close {
    top: 5px;
    right: 10px;
    font-size: 28px;
  }

  .modal-nav {
    font-size: 18px;
    padding: 10px 12px;
  }

  .modal-nav.prev {
    left: 5px;
  }

  .modal-nav.next {
    right: 5px;
  }

  .modal-caption {
    font-size: 12px;
    padding: 10px 15px;
    max-width: 90%;
  }
}

/* Footer */
.footer {
  font-size: 12px;
  color: #666;
  text-align: left;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }

  .main-content {
    flex-direction: column;
    gap: 30px;
  }

  .sidebar {
    flex: none;
  }

  .project-content-wrapper {
    flex-direction: column;
    gap: 20px;
  }

  .project-image {
    flex: none;
    max-width: 100%;
  }

  .project-image img {
    height: 200px;
  }

  .project-meta {
    flex-direction: column;
    gap: 10px;
  }

  .project-codes {
    text-align: left;
  }

  .project-single-layout {
    flex-direction: column;
    gap: 30px;
  }

  .project-hero-image {
    flex: none;
  }

  /* Mobile caption adjustments */
  .image-caption {
    padding: 8px 12px;
    font-size: 10px;
    height: 50px;
  }

  .image-with-caption .image-caption {
    padding: 12px 15px;
    font-size: 11px;
    min-height: 40px;
  }

  .design-item img {
    height: calc(100% - 50px);
  }
}
