/* Portfolio Grid Styles */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */

:root {
  --plum: #4a3154;
  --plum-dark: #3d2845;
  --plum-light: #5d3f6a;
  --plum-text-light: #f5f0f7;
  --plum-text-sidebar: #e0d5e5;
  --plum-text-footer: #d0c5d5;
  --plum-text-muted: #a090a8;
}

/* Base styles */
html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body, h1, h2, h3, h4, h5 {
  font-family: "Raleway", sans-serif;
}

/* ============================================
   HEADER - Deep Plum Theme
   ============================================ */

.header-bar {
  background: var(--plum);
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.header-bar .w3-padding-small {
  padding: 0 !important;
}

.header-display-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.header-display-topleft {
  flex-grow: 1;
  background: transparent !important;
  padding: 0 !important;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.header-display-topleft span {
  color: var(--plum-text-light);
  font-family: "Sour Gummy", sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.15em;
  font-weight: 400;
}

/* Hamburger menu button */
.header-bar .w3-button.w3-blue-grey {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #f0e8f3 !important;
  border-radius: 6px;
  padding: 8px 12px !important;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.header-bar .w3-button.w3-blue-grey:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

/* ============================================
   FILTER BAR
   ============================================ */

.header-bar .w3-bar {
  background: rgba(0, 0, 0, 0.2) !important;
  border: none !important;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.header-bar .w3-bar::-webkit-scrollbar {
  display: none;
}

/* Filter buttons - pill style */
.filter-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  padding: 5px 14px !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
}

.filter-btn.selected-filter {
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--plum) !important;
  border-color: white !important;
  font-weight: 600 !important;
}

/* Mobile: tighter filter buttons */
@media (max-width: 480px) {
  .header-display-topleft span {
    font-size: 1.1rem;
    letter-spacing: 0.1em;
  }

  .header-bar .w3-bar {
    padding: 6px 8px;
    gap: 6px;
  }

  .filter-btn {
    padding: 4px 10px !important;
    font-size: 0.7rem !important;
    border-radius: 12px !important;
  }
}

/* ============================================
   SIDEBAR - Match Plum Theme
   ============================================ */

#mySidebar {
  background: var(--plum-dark) !important;
}

#mySidebar .w3-bar-item {
  color: var(--plum-text-sidebar) !important;
  transition: background 0.2s ease, color 0.2s ease;
}

#mySidebar .w3-bar-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: white !important;
}

/* ============================================
   MAIN CONTENT SPACING
   ============================================ */

.portfolio-main {
  margin-top: 105px;
}

@media (max-width: 480px) {
  .portfolio-main {
    margin-top: 95px;
  }
}

/* ============================================
   PORTFOLIO GRID
   ============================================ */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .portfolio-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 12px;
  }
}

@media (min-width: 1200px) {
  .portfolio-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   PORTFOLIO ITEM (Card)
   ============================================ */

.portfolio-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #222;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portfolio-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Thumbnail image */
.portfolio-item .thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: opacity 0.3s ease;
}

/* Video preview overlay */
.portfolio-item .preview-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Show video when playing (all devices) */
.portfolio-item.video-playing .thumbnail {
  opacity: 0;
}

.portfolio-item.video-playing .preview-video {
  opacity: 1;
}

/* Hide play icon when video is playing */
.portfolio-item.video-playing .play-icon {
  opacity: 0;
}

/* Play icon overlay for video items */
.portfolio-item .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.portfolio-item .play-icon::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 20px solid white;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 4px;
}

.portfolio-item:hover .play-icon {
  background: rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Item title overlay */
.portfolio-item .item-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.portfolio-item:hover .item-title {
  opacity: 1;
  transform: translateY(0);
}

/* Filter animations */
.portfolio-item.hidden {
  display: none;
}

.portfolio-item.fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.portfolio-item.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   MODALS
   ============================================ */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  overflow: auto;
  animation: modalFadeIn 0.2s ease;
}

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

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-close:hover {
  color: #ccc;
}

.modal-content {
  max-width: 90%;
  text-align: center;
  padding: 20px;
}

.modal-content img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border: 3px solid #444;
  border-radius: 4px;
  margin: 0 auto;
}

.modal-content video {
  max-width: 100%;
  max-height: 85vh;
  border: 3px solid #444;
  border-radius: 4px;
}

.modal-content p {
  color: white;
  margin-top: 16px;
  font-size: 16px;
}

.modal-content a {
  color: #88c8ff;
}

.modal-description {
  color: #aaa;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 8px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  display: none;
}

/* ============================================
   IMAGE PROTECTION
   ============================================ */

img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: auto;
}

/* ============================================
   LOADING STATE
   ============================================ */

.portfolio-item.loading {
  background: linear-gradient(90deg, #222 25%, #333 50%, #222 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.grid-error {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  font-size: 1rem;
  padding: 60px 20px;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

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

  .portfolio-item {
    aspect-ratio: 16 / 10;
  }

  .play-icon {
    width: 48px;
    height: 48px;
  }

  .play-icon::after {
    border-left-width: 14px;
    border-top-width: 8px;
    border-bottom-width: 8px;
  }
}

/* Touch device adjustments */
@media (hover: none) {
  .portfolio-item .item-title {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   ABOUT SECTION
   ============================================ */

.about-section {
  background: linear-gradient(180deg, #f5f5f5 0%, #fff 100%);
  padding: 60px 20px;
  scroll-margin-top: 100px;
}

.about-container {
  max-width: 600px;
  margin: 0 auto;
}

.about-heading {
  color: var(--plum);
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 32px;
}

.about-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(74, 49, 84, 0.1);
  border: 1px solid rgba(74, 49, 84, 0.08);
}

.about-photo img {
  width: 100%;
  height: auto;
  display: block;
}

.about-content {
  padding: 28px;
}

.about-content p {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
  text-align: left;
}

.about-content p:last-of-type {
  margin-bottom: 24px;
}

.about-content a {
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-content a:hover {
  color: #6b4a7a;
}

.about-content em {
  font-style: italic;
  color: #5a4064;
}

.about-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  color: #555;
  font-size: 0.95rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--plum);
  color: white !important;
  border-radius: 8px;
  font-size: 1.3rem;
  text-decoration: none !important;
  transition: background 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
  background: var(--plum-light);
  transform: translateY(-2px);
}

/* ============================================
   CONTACT SECTION
   ============================================ */

.contact-section {
  background: #f5f5f5;
  padding: 60px 20px;
  scroll-margin-top: 100px;
}

.contact-container {
  max-width: 500px;
  margin: 0 auto;
}

.contact-heading {
  color: var(--plum);
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.contact-subheading {
  color: #666;
  font-size: 1rem;
  text-align: center;
  margin-bottom: 32px;
}

.contact-form {
  background: white;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(74, 49, 84, 0.1);
  border: 1px solid rgba(74, 49, 84, 0.08);
}

.form-group {
  margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: "Raleway", sans-serif;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--plum);
  background: white;
  box-shadow: 0 0 0 3px rgba(74, 49, 84, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #999;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-submit {
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Raleway", sans-serif;
  color: white;
  background: var(--plum);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-submit:hover {
  background: var(--plum-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 49, 84, 0.3);
}

.contact-submit:active {
  transform: translateY(0);
}

.contact-spinner {
  text-align: center;
  margin-bottom: 16px;
  display: none;
  color: var(--plum);
  font-size: 1.5rem;
}

.contact-spinner.visible {
  display: block;
}

.spinner-icon {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(74, 49, 84, 0.2);
  border-top-color: var(--plum);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.contact-error {
  color: #c0392b;
  text-align: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.contact-success {
  color: #27ae60;
  text-align: center;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background: var(--plum-dark);
  padding: 40px 20px;
  color: var(--plum-text-footer);
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-nav a {
  color: var(--plum-text-footer);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: white;
}

.footer-social {
  margin-bottom: 20px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--plum-text-sidebar);
  border-radius: 50%;
  font-size: 1.4rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.footer-social a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: translateY(-2px);
}

.footer-copyright {
  font-size: 0.85rem;
  color: var(--plum-text-muted);
  margin: 0;
}

/* ============================================
   RESPONSIVE - ABOUT/CONTACT/FOOTER
   ============================================ */

@media (max-width: 480px) {
  .about-section,
  .contact-section {
    padding: 40px 16px;
  }

  .about-heading,
  .contact-heading {
    font-size: 1.5rem;
  }

  .about-content {
    padding: 20px;
  }

  .about-content p {
    font-size: 0.9rem;
  }

  .contact-form {
    padding: 20px;
  }

  .footer-nav {
    gap: 20px;
  }

  .footer-nav a {
    font-size: 0.85rem;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
