/* Showcase grid and card styles */
.fc-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--fc-showcase-card-min-width, 280px), 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
  max-width: 100% !important;
}

.fc-showcase-toc-anchor {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0 !important;
  scroll-margin-top: 5rem;
}

.fc-showcase-toc-anchor .headerlink {
  display: none !important;
}

.fc-showcase-card {
  display: flex;
  flex-direction: column;
  background-color: var(--md-card-bg-color, var(--md-default-bg-color));
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.fc-showcase-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: var(--md-accent-fg-color);
}

.fc-showcase-card-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fc-showcase-card-preview img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.fc-showcase-card-info {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fc-showcase-card-title {
  margin: 0 !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  color: var(--md-default-fg-color) !important;
}

.fc-showcase-card-info p {
  margin: 0 !important;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--md-default-fg-color--light);
}

/* Modal styles */
.fc-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: none; /* Controlled by active class */
  align-items: center;
  justify-content: center;
}

.fc-modal.is-active {
  display: flex;
}

.fc-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fc-modal-container {
  position: relative;
  width: 92%;
  max-width: 1300px;
  height: 85vh;
  background-color: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  z-index: 1010;
  overflow: hidden;
  display: flex;
  animation: fc-modal-zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fc-modal-zoom {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.fc-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.4);
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1020;
  transition: background-color 0.2s, transform 0.2s;
}

.fc-modal-close:hover {
  background-color: var(--md-accent-fg-color);
  transform: rotate(90deg);
}

.fc-modal-content {
  display: flex;
  width: 100%;
  height: 100%;
}

.fc-showcase-card-details {
  display: flex;
  width: 100%;
  height: 100%;
}

.fc-modal-image-col {
  width: 65%;
  height: 100%;
  background-color: #0f172a; /* Slate 900 for image frame contrast */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden; /* Prevent zoomed-in leakage */
  position: relative;
}

.fc-modal-image-col img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.35rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none; /* Disable default browser drag behavior */
}

.fc-modal-info-col {
  width: 35%;
  height: 100%;
  padding: 2rem;
  overflow-y: auto;
  border-left: 1px solid var(--md-default-fg-color--lightest);
  background-color: var(--md-default-bg-color);
}

/* Modal typography and scrollbar polish */
.fc-modal-info-col::-webkit-scrollbar {
  width: 6px;
}

.fc-modal-info-col::-webkit-scrollbar-track {
  background: transparent;
}

.fc-modal-info-col::-webkit-scrollbar-thumb {
  background: var(--md-default-fg-color--lightest);
  border-radius: 4px;
}

.fc-modal-info-col h2 {
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.fc-modal-info-col .fc-modal-title {
  margin: 0 0 1rem !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

.fc-modal-info-col h4 {
  margin-top: 1.8rem !important;
  margin-bottom: 0.8rem !important;
  font-size: 1.1rem !important;
}

@media (min-width: 76.25em) {
  .fc-showcase-page {
    --fc-showcase-card-min-width: 260px;
  }

  /* Material hides drawer toggle on desktop by default; enable it for showcase page. */
  .fc-showcase-page .md-header__button.md-icon[for="__drawer"] {
    display: inline-flex !important;
  }

  .fc-showcase-page .md-sidebar--primary {
    transform: translateX(calc(-100% - 0.75rem));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .fc-showcase-page .md-content {
    margin-left: 0;
  }

  .fc-showcase-page .md-toggle[data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar--primary {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .fc-showcase-page .md-toggle[data-md-toggle="drawer"]:checked ~ .md-container .md-content {
    margin-left: revert;
  }

  /* When the left panel is hidden, use the freed width for more card columns. */
  .fc-showcase-page .md-toggle[data-md-toggle="drawer"]:not(:checked) ~ .md-container .md-main .md-main__inner.md-grid {
    max-width: min(98vw, 1900px);
  }

  /* Restore the normal docs width when the left panel is visible again. */
  .fc-showcase-page .md-toggle[data-md-toggle="drawer"]:checked ~ .md-container .md-main .md-main__inner.md-grid {
    max-width: revert;
  }
}

/* Modal typography and code font size adjustments */
.fc-modal-info-col p,
.fc-modal-info-col li {
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
}

.fc-modal-info-col code {
  font-size: 0.9rem !important;
  padding: 0.1rem 0.3rem !important;
  background-color: var(--md-code-bg-color);
  border-radius: 0.2rem;
}

.fc-modal-info-col pre code {
  font-size: 0.95rem !important; /* Larger font size as requested */
  line-height: 1.5 !important;
  padding: 0 !important;
  background-color: transparent !important;
}

.fc-modal-info-col .highlight {
  margin: 1.2rem 0 !important;
  border-radius: 0.4rem;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.fc-modal-info-col .highlight pre {
  margin: 0 !important;
  padding: 1rem !important;
}

/* Ensure the copy button displays correctly in the modal */
.fc-modal-info-col .md-clipboard {
  font-size: 0.85rem !important;
  z-index: 1020;
}

/* Prevent document scroll when modal is active */
html.fc-modal-open,
body.fc-modal-open {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .fc-modal-container {
    flex-direction: column;
    height: 90vh;
  }
  
  .fc-modal-content {
    flex-direction: column;
  }
  
  .fc-showcase-card-details {
    flex-direction: column;
  }

  .fc-modal-image-col {
    width: 100%;
    height: 50%;
    padding: 1rem;
  }

  .fc-modal-info-col {
    width: 100%;
    height: 50%;
    border-left: none;
    border-top: 1px solid var(--md-default-fg-color--lightest);
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .fc-showcase-grid {
    grid-template-columns: 1fr;
  }
  
  .fc-modal-image-col {
    height: 40%;
  }

  .fc-modal-info-col {
    height: 60%;
    padding: 1.25rem;
  }
}
