:root {
  --sidebar-width: 480px;
  --text-color: #1a1a1a;
  --text-light: #6b7280;
  --border-color: #e5e5e5;
  --background: #ffffff;
  --thumbnail-max-width: 1200px;
  --thumbnail-max-height: 80vh;
  --thumbnail-mobile-max-height: 70vh;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--text-color);
  line-height: 1.5;
  font-weight: 400;
  min-height: 100vh;
  scroll-behavior: auto;
}

.container {
  display: flex;
  flex-direction: column;
}

/* Logo Display */
.logo-display {
  position: fixed;
  top: 50%;
  left: calc(50% + var(--sidebar-width) / 2);
  transform: translate(-50%, -50%);
  max-height: none;
  max-width: none;
  width: auto;
  height: auto;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 200;
  padding: 20px;
}

/* Video and Image Display */
.video-display,
.image-display {
  position: fixed;
  top: 50%;
  left: calc(50% + var(--sidebar-width) / 2);
  transform: translate(-50%, -50%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none !important;
  max-height: none !important;
  width: auto !important;
  height: auto !important;
}

/* Override content pane constraints for larger videos */
.video-display mux-player {
  max-width: none !important;
  max-height: none !important;
  width: auto !important;
  height: auto !important;
}

.logo-display.show {
  opacity: 1;
}

.logo-display img {
  max-height: 300px;
  width: auto;
  object-fit: contain;
  opacity: 1;
}

.logo-display img.loaded {
  opacity: 1;
}

/* Override Mux player default styling to remove black bars */
mux-player {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  --media-object-fit: contain !important;
  --media-background-color: transparent !important;
}

mux-player::part(media) {
  background: transparent !important;
  object-fit: contain !important;
}

mux-player::part(controls) {
  background: transparent !important;
}

mux-player video {
  background: transparent !important;
  object-fit: contain !important;
}

mux-player .mux-player {
  background: transparent !important;
}

mux-player .mux-player video {
  background: transparent !important;
  object-fit: contain !important;
}

/* Hide controls on all project thumbnails */
.project-video::part(controls) {
  display: none !important;
}

.project-video .mux-player-controls {
  display: none !important;
}

.project-video .mux-player-overlay {
  display: none !important;
}

/* Additional MUX player control hiding */
.project-video mux-player-controls {
  display: none !important;
}

.project-video .mux-player-control-bar {
  display: none !important;
}

.project-video .mux-player-bottom-controls {
  display: none !important;
}

.project-video .mux-player-top-controls {
  display: none !important;
}

/* Hide all control-related elements */
.project-video [class*="control"] {
  display: none !important;
}

/* More aggressive MUX player control hiding */
.project-video {
  --media-controls: none !important;
}

.project-video * {
  pointer-events: none !important;
}

.project-video video {
  pointer-events: none !important;
}

/* Hide any bottom overlay or control bar */
.project-video > div:last-child {
  display: none !important;
}

/* Target MUX player shadow DOM elements */
.project-video::part(media-controls) {
  display: none !important;
}

.project-video::part(controls-container) {
  display: none !important;
}

.project-video::part(control-bar) {
  display: none !important;
}

.project-video::part(bottom) {
  display: none !important;
}

.project-video::part(time-range) {
  display: none !important;
}

/* Target the specific shadow DOM elements we saw in dev tools */
.project-video media-time-range {
  display: none !important;
}

.project-video media-control-bar {
  display: none !important;
}

.project-video media-controller {
  display: none !important;
}

/* Hide control icons */
.project-video .pause-icon,
.project-video .play-icon,
.project-video .pause-icon-pt1,
.project-video .pause-icon-pt2,
.project-video [class*="icon"] {
  display: none !important;
}

.project-video svg[slot="icon"] {
  display: none !important;
}

.project-video g[class*="icon"] {
  display: none !important;
}

.logo-display video,
.logo-display mux-player {
  max-height: 600px !important;
  width: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.logo-display mux-player.loaded {
  opacity: 1;
}

mux-player {
  --media-object-fit: contain;
  --media-object-position: center;
}

/* Header Styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  width: var(--sidebar-width);
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 100;
  border-bottom: none;
  min-height: 60px;
  box-sizing: border-box;
}

.gallery .header {
  width: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 60px;
  z-index: 1000;
  position: sticky;
  background: var(--background);
}

.page-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  height: 21px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}


.title-text {
  display: inline-block;
}

.title-link {
  color: var(--text-light);
  font-size: 14px;
  font-weight: 400;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.page-title:hover .title-link {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.title-link a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

.title-link a:hover {
  color: var(--text-color);
  text-decoration: underline;
}

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

.nav-toggle-container {
  display: flex;
  background-color: #f5f5f5;
  border-radius: 999px;
  padding: 2px;
  gap: 0;
  position: relative;
}

.nav-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  height: calc(100% - 4px);
  background-color: #ffffff;
  border-radius: 999px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  pointer-events: none;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  padding: 6px 16px;
  border-radius: 999px;
  white-space: nowrap;
  position: relative;
  z-index: 2;
  background-color: transparent;
  transition: color 0.3s ease;
  flex: 1;
  text-align: center;
}

.nav-link.active {
  background-color: transparent;
}

.nav-link:not(.active):hover {
  background-color: transparent;
}

/* Content Styles */
.content {
  display: flex;
  flex: 1;
}

/* Gallery specific content - full width */
.gallery .content {
  display: block;
  width: 100%;
}

.gallery .sidebar {
  width: 100%;
  padding: 0;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--background);
  padding: 0 32px 32px 32px;
  overflow-y: visible;
  scroll-behavior: auto;
}

.intro {
  margin-bottom: 48px;
}

.intro p {
  margin: 0 0 12px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-color);
}

.intro p:last-child {
  margin-bottom: 0;
}

.tool-name {
  cursor: pointer;
  transition: color 0.2s ease;
  color: var(--text-color);
  text-decoration: none;
}

.tool-name:hover {
  color: var(--text-color);
  text-decoration: underline;
}

/* Projects List Styles */
.projects-list {
  display: flex;
  flex-direction: column;
  background-color: #f5f5f5;
  border-radius: 16px;
  padding: 4px 16px 16px 16px;
}

.project-item {
  padding: 8px 0;
  border-bottom: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-item:first-child {
  padding-top: 8px;
}

.project-item:last-child {
  padding-bottom: 0;
}

.project-row {
  display: flex;
  align-items: center;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item:hover {
  background: transparent;
}

.project-item:hover .project-icon {
  filter: grayscale(0%);
}

.project-item.expanded {
  padding: 8px 0;
}

.project-item.expanded .project-icon {
  filter: grayscale(0%);
}

.project-item.selected {
  background: transparent;
}

.project-item.selected .project-icon {
  filter: grayscale(0%);
}

.project-number {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
  margin-right: 16px;
  min-width: 28px;
}

.project-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
  margin-right: auto;
  flex: 1;
}

.project-icon {
  width: 16px;
  height: 16px;
  margin-right: 12px;
  filter: grayscale(0%);
  transition: filter 0.2s ease;
  transform: translateY(-4px);
}

.project-item.disabled .project-icon {
  width: auto;
  height: auto;
  font-size: 12px;
  color: var(--text-light);
  filter: none;
  margin-left: auto;
  margin-right: 0;
  font-weight: 400;
}

.project-toggle {
  font-size: 16px;
  color: var(--text-color);
  font-weight: 300;
  cursor: pointer;
  user-select: none;
  margin-left: 8px;
  transform: translateY(-2px);
}

.project-details {
  margin-top: 0;
  width: 100%;
  display: none;
  padding: 14px 0 0 46px;
}

.project-item.expanded .project-details {
  display: block;
}

.project-description {
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-color);
  margin-bottom: 0;
  max-width: 300px;
}

.project-link {
  font-size: 14px;
  color: var(--text-light);
  text-decoration: none;
  margin-bottom: 16px;
  display: block;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.project-link:hover {
  color: var(--text-color);
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 0px;
  padding: 16px 0;
}

.meta-item {
  display: flex;
  font-size: 11px;
  margin-bottom: 0px;
}

.meta-label {
  color: var(--text-color);
  margin-right: 60px;
  min-width: 60px;
  flex-shrink: 0;
}

.meta-value {
  color: var(--text-color);
}

/* Disabled/placeholder projects */
.project-item.disabled {
  opacity: 0.5;
  cursor: default;
}

.project-item.disabled:hover {
  background: transparent;
}

.project-item.disabled .project-toggle {
  display: none;
}

/* Footer Styles */
.footer {
  padding: 24px 32px;
  background: var(--background);
  width: var(--sidebar-width);
}

.footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

/* Image Grid Styles - Vertical Scroll */
.image-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 400px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  align-items: center;
  position: relative;
  z-index: 1;
}

.image-card {
  position: relative;
  max-width: 100%;
  cursor: pointer;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.image-card img {
  max-width: 100%;
  max-height: var(--thumbnail-max-height);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  /* Ensure images scale proportionally and fit within viewport */
  max-width: min(100%, var(--thumbnail-max-width));
}

/* Hide overlays and captions for minimal design */
.image-overlay,
.image-caption {
  display: none;
}

.image-card.unclickable {
  opacity: 0.6;
  cursor: default;
}

.image-card.unclickable:hover {
  transform: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header {
    padding: 16px 20px;
    width: 100%;
    min-height: 60px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .gallery .header {
    padding: 16px 20px;
    width: 100%;
    min-height: 60px;
    box-sizing: border-box;
    z-index: 1000;
    position: sticky;
    background: var(--background);
  }
  
  .page-title {
    height: 21px;
    line-height: 1.5;
  }
  
  .sidebar {
    width: 100%;
    padding: 20px;
  }
  
  .projects-list {
    padding: 12px;
  }
  
  .content {
    flex-direction: column;
  }
  
  .footer {
    padding: 16px 20px;
    width: 100%;
  }
  
  /* Mobile responsive */
  .image-grid {
    padding: 10px;
    gap: 15px;
  }
  
  .image-card {
    max-width: 100%;
  }
  
  .image-card img {
    max-width: 100%;
    max-height: var(--thumbnail-mobile-max-height);
    width: auto;
    height: auto;
    object-fit: contain;
  }
  
  /* Mobile logo display positioning */
  .logo-display {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: none;
    max-width: none;
    width: auto;
    height: auto;
    padding: 10px;
  }
  
  .logo-display img {
    max-height: 150px;
  }
  
  .logo-display video,
  .logo-display mux-player {
    max-height: 300px !important;
  }
  
  /* Disable hover effects on mobile */
  .project-item:hover {
    background: transparent;
  }
  
  .project-item:hover .project-icon {
    filter: grayscale(100%);
  }
  
  .tool-name:hover {
    color: var(--text-color);
  }
  
  .nav-link:not(.active):hover {
    background-color: transparent;
  }
  
  .project-link:hover {
    color: var(--text-light);
  }
}

/* Project Overlay Styles */
.project-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff; /* White background */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  overflow-y: auto; /* Allow overlay to scroll if needed */
  will-change: opacity, visibility; /* Optimize transitions */
}

.project-overlay.active {
  pointer-events: auto;
}

.project-overlay .overlay-header,
.project-overlay .overlay-content {
  pointer-events: auto;
}

/* Keep original header visible above overlay background */
html.overlay-active body.overlay-active .header,
body.overlay-active .header {
  z-index: 1001 !important;
  position: fixed !important; /* Use fixed instead of sticky to prevent movement */
  top: 11px !important; /* Add 11px to compensate for upward shift */
  left: 0 !important; /* Ensure it starts at left edge */
  right: auto !important;
  bottom: auto !important;
  transform: none !important; /* Remove transform to prevent shifts */
  will-change: auto !important;
  min-height: 60px !important;
  height: 60px !important; /* Lock height to prevent shifts */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 24px 32px !important; /* Lock padding to prevent shifts */
  padding-top: 24px !important; /* Ensure top padding stays consistent */
  box-sizing: border-box !important;
  display: flex !important; /* Lock display to prevent layout changes */
  align-items: center !important; /* Lock alignment */
  vertical-align: top !important;
}

/* Prevent body/html layout shifts when overlay opens */
html.overlay-active {
  scrollbar-gutter: stable !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.overlay-active {
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  position: relative !important;
}

/* Ensure container doesn't shift */
body.overlay-active .container,
body.overlay-active .gallery {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

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

.overlay-close-button {
  position: fixed; /* Fixed to viewport, not overlay */
  top: 28px; /* Match header top position to compensate for shift */
  right: 32px; /* Match header padding-right */
  z-index: 1003;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
  cursor: pointer;
  transition: opacity 0.2s ease;
  font-family: inherit;
  line-height: 1.5;
  height: 60px; /* Match header height */
  display: flex;
  align-items: center; /* Center vertically like header does */
  justify-content: flex-end; /* Align text to right */
}

/* When overlay is active, ensure close button matches header position */
body.overlay-active .overlay-close-button {
  top: 17px !important; /* Match header top position */
}

.overlay-close-button:hover {
  opacity: 0.7;
}

.overlay-content {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  background: #ffffff; /* White background for content area */
  position: relative;
}

.iframe-container {
  position: absolute;
  left: 20px; /* 40px from left window edge */
  right: 20px; /* Right and bottom padding */
  bottom: 20px; /* Right and bottom padding */
  top: 80px; /* 200px top margin */
  border: 10px solid #F5F5F5;
  border-radius: 16px;
  background: #F5F5F5;
  box-sizing: border-box;
  z-index: 1002;
}

.project-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff; /* White background for iframe */
  border-radius: 6px; /* Inner radius (16px outer - 10px border) */
  display: block;
}

/* Hide nav toggle when overlay is active */
.nav-toggle-container.hidden {
  visibility: hidden !important;
  opacity: 0 !important;
  width: auto !important; /* Keep width to prevent layout shift */
  height: auto !important; /* Keep height to prevent layout shift */
  overflow: hidden !important;
  position: relative !important; /* Keep in flow */
  pointer-events: none !important;
}
