/*
Theme Name: Projects Portfolio
Theme URI: https://example.com
Author: Your Name
Description: Minimalist portfolio theme with Projects CPT, People taxonomy, AJAX loading, and list/grid views
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: projects-portfolio
*/

:root {
  --bg: #fff;
  --text: #000;
  --text-muted: #666;
  --border: #e0e0e0;
  --hover: #333;
  --modal-bg: #fff;
  --overlay: rgba(255,255,255,0.75);
}

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

body {
  margin: 0;
  padding: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--hover); }

img { max-width: 100%; height: auto; display: block; }

h2 {
  line-height: 1.2em;
  font-weight: normal;
}

h3 {
  line-height: 1.2em;
  font-weight: normal;
}

/* Header */
.site-header {
  padding: 40px 40px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.site-title {
  font-size: 18px;
  font-weight: 400;
  margin: 0;
  /* text-transform: lowercase; */
}

.site-title a { color: var(--text); }

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;
}

.main-nav a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.main-nav a:hover,
.main-nav a.active { color: var(--text); }

/* Controls */
.controls {
  padding: 20px 00px 20px 0px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  /* border-bottom: 1px solid var(--border); */
}

.view-toggle {
  display: flex;
  gap: 12px;
}

.view-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.4;
  transition: opacity 0.2s;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.view-btn:hover,
.view-btn.active { opacity: 1; }

.view-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.module-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px 8px;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--text);
  background: #f0f0f0;
}

/* Main Content */
.site-main {
  padding: 0px 40px 0px 40px;
  min-height: 60vh;
}

/* Projects List View */
.projects-list {
  display: flex;
  flex-direction: column;
}

/* Hide thumbnails in list view */
.projects-list .project-thumb {
  display: none;
}

.projects-list .project-item {
  display: grid;
  grid-template-columns: minmax(200px, 4fr) 2fr 2fr 1fr;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.1s;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s ease forwards;
}

.projects-list .project-item:hover {
  background-color: #f7f7f7;
}

.projects-list .project-title {
  font-size: 16px;
  font-weight: 400;
  margin: 0;
  color: var(--text);
}

.projects-list .project-meta {
  display: contents;
}

.projects-list .project-meta-item {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 10px;
  font-family: inherit;
  font-weight: 400;
  font-size: 16px;
  color: var(--text);
  opacity: 1;
}

.projects-list .project-meta .year {
  justify-content: flex-end;
  font-weight: 400;
}

/* Projects Grid View */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
}

.projects-grid .project-item {
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s ease forwards;
}

.projects-grid .project-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f5f5f5;
  margin-bottom: 12px;
}

.projects-grid .project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.projects-grid .project-item:hover .project-thumb img {
  transform: scale(1.03);
}

.projects-grid .project-title {
  font-size: 16px;
  font-weight: 400;
  margin: 0 0 4px;
  text-align: center;
}

.projects-grid .project-meta {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.project-metadata {margin-bottom: 20px}

/* Animation delays for staggered fade-in */
.project-item:nth-child(1) { animation-delay: 0.05s; }
.project-item:nth-child(2) { animation-delay: 0.1s; }
.project-item:nth-child(3) { animation-delay: 0.15s; }
.project-item:nth-child(4) { animation-delay: 0.2s; }
.project-item:nth-child(5) { animation-delay: 0.25s; }
.project-item:nth-child(6) { animation-delay: 0.3s; }
.project-item:nth-child(7) { animation-delay: 0.35s; }
.project-item:nth-child(8) { animation-delay: 0.4s; }
.project-item:nth-child(9) { animation-delay: 0.45s; }
.project-item:nth-child(10) { animation-delay: 0.5s; }
.project-item:nth-child(11) { animation-delay: 0.55s; }
.project-item:nth-child(12) { animation-delay: 0.6s; }
.project-item:nth-child(13) { animation-delay: 0.65s; }
.project-item:nth-child(14) { animation-delay: 0.7s; }
.project-item:nth-child(15) { animation-delay: 0.75s; }
.project-item:nth-child(16) { animation-delay: 0.8s; }
.project-item:nth-child(17) { animation-delay: 0.85s; }
.project-item:nth-child(18) { animation-delay: 0.9s; }
.project-item:nth-child(19) { animation-delay: 0.95s; }
.project-item:nth-child(20) { animation-delay: 1s; }
.project-item:nth-child(21) { animation-delay: 1.05s; }
.project-item:nth-child(22) { animation-delay: 1.1s; }
.project-item:nth-child(23) { animation-delay: 1.15s; }
.project-item:nth-child(24) { animation-delay: 1.2s; }
.project-item:nth-child(25) { animation-delay: 1.25s; }
.project-item:nth-child(26) { animation-delay: 1.3s; }
.project-item:nth-child(27) { animation-delay: 1.35s; }
.project-item:nth-child(28) { animation-delay: 1.4s; }
.project-item:nth-child(29) { animation-delay: 1.45s; }
.project-item:nth-child(30) { animation-delay: 1.5s; }
.project-item:nth-child(31) { animation-delay: 1.55s; }
.project-item:nth-child(32) { animation-delay: 1.6s; }
.project-item:nth-child(33) { animation-delay: 1.65s; }
.project-item:nth-child(34) { animation-delay: 1.7s; }
.project-item:nth-child(35) { animation-delay: 1.75s; }
.project-item:nth-child(36) { animation-delay: 1.8s; }
.project-item:nth-child(37) { animation-delay: 1.85s; }
.project-item:nth-child(38) { animation-delay: 1.9s; }
.project-item:nth-child(39) { animation-delay: 1.95s; }
.project-item:nth-child(40) { animation-delay: 2s; }
.project-item:nth-child(n+41) { animation-delay: 2.05s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Panel */
.modal-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 80%;
  height: 100%;
  background: var(--modal-bg);
  z-index: 1001;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-panel.active {
  transform: translateX(0);
}

.modal-close {
  position: sticky;
  top: 20px;
  float: right;
  margin: 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
  z-index: 10;
}

.modal-close:hover { color: var(--text-muted); }

.modal-content {
  padding: 0px 60px 60px;
  clear: both;
}

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

.modal-content .project-title {
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 8px;
}

.modal-content .project-people {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Gallery Slideshow */
.project-gallery {
  position: relative;
  margin-bottom: 30px;
  background: #f5f5f5;
}

.gallery-slides {
  position: relative;
  overflow: hidden;
}

.gallery-slide {
  display: none;
}

.gallery-slide.active {
  display: block;
}

.gallery-slide img {
  width: 100%;
  height: auto;
}

.gallery-nav {
  position: absolute;
  top: 0px;
  right: 0px;
  display: flex;
  gap: 0px;
}

.gallery-btn {
  background: var(--bg);
  border: none;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.gallery-btn:hover { background: #e0e0e0; }

.gallery-counter {
  position: absolute;
  top: 0px;
  left: 0px;
  font-size: 14px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.9);
  padding: 4px 10px;
}

/* Modal Body Content */
.modal-content .project-body, .entry-content {
  font-size: 16px !important;
  line-height: 1.6;
  max-width: 700px;
  margin-bottom: 40px;
}

.modal-content .project-body p {
  margin: 0 0 1.5em;
}

/* Project Metadata */
.project-metadata {
  max-width: 700px;
  margin-bottom: 40px;
  font-size: 15px;
  line-height: 1.6;
}

.project-metadata p {
  margin: 0 0 0.5em;
}

.project-metadata strong {
  font-weight: 600;
  color: var(--text);
}

/* Tags */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.project-tags .tag {
  font-size: 13px;
  color: var(--text-muted);
  background: #f5f5f5;
  padding: 4px 12px;
  border-radius: 2px;
}

/* Close Button Bottom */
.modal-close-bottom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.modal-close-bottom:hover {
  background: #f5f5f5;
}

/* Footer */
.site-footer {
  padding: 40px;
  /* border-top: 1px solid var(--border); */
  font-size: 14px;
  color: var(--text-muted);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hover Thumbnail for List View */
.hover-thumbnail {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.15s ease, transform 0.15s ease;
  background: #e0e0e0;
  padding: 10px;
}

.hover-thumbnail.visible {
  opacity: 1;
  transform: scale(1);
}

.hover-thumbnail img {
  width: 400px;
  height: 300px;
  object-fit: cover;
  display: block;
}

/* Ensure list items have position for proper event handling */
.projects-list .project-item {
  position: relative;
}

/* Responsive */
@media (max-width: 768px) {
  .site-main,
  .site-footer { padding-left: 20px; padding-right: 20px; }

  .site-header { padding-left: 20px; padding-right: 20px; padding-top: 20px;}

  .modal-panel { width: 100%; }

  .modal-content { padding: 0px 20px 40px; }

  .modal-content .project-title { font-size: 24px; }

  .projects-grid { grid-template-columns: 1fr; }

  /* Mobile List View - Stacked Layout */
  .projects-list .project-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
  }

  .projects-list .project-title {
    width: 100%;
    font-size: 16px;
  }

  .projects-list .project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
  }

  .projects-list .project-meta-item {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0;
  }

  /* Add separator between meta items */
  .projects-list .project-meta-item:not(:last-child)::after {
    content: "·";
    margin: 0 8px;
    color: var(--text-muted);
  }

  .projects-list .project-meta .year {
    justify-content: flex-start;
  }

  /* Hide hover thumbnail on mobile */
  .hover-thumbnail {
    display: none;
  }
}


/* 1. APPLIED ANIMATION FULL-WIDTH CONTENT OVERRIDE */
.modal-content.full-width-content .project-body {
    /* Set the project content to use the full width of the modal panel's padding */
    max-width: 100%;
}

.wp-block-embed,
.wp-block-embed__wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

.wp-block-embed.alignfull {
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

.rotating-line {
  display: inline-block;
  margin-left: 0em;
  font-size: inherit;
  animation: rotate 2s linear infinite;
  transform-origin: center;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


/* List View Header Row */
.list-header {
  display: grid;
  grid-template-columns: minmax(200px, 4fr) 2fr 2fr 1fr;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.list-header div {
  padding: 0 10px;
}

/* Match year alignment */
.list-header .header-year {
  text-align: right;
}

/* Match year alignment */
.list-header .header-title {
  padding: 0px 0;
}

/* Mobile version — consistent with your stacked list */
@media (max-width: 768px) {
  .list-header {
    display: none; /* hide header on mobile list (matches your stacked layout) */
  }
}
