/* Quality Modal Styles */

/* Make quality images and titles clickable */
.quality-card-image,
.quality-card-title {
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.quality-card-image:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

.quality-card-title:hover {
  color: var(--md-accent-fg-color);
  text-decoration: underline;
}

/* Modal dialog */
.quality-modal {
  max-width: 1200px;
  max-height: 85vh;
  width: 90vw;
  border: none;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Backdrop */
.quality-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* Header bar */
.quality-modal__header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--md-default-bg-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 10;
}

/* Right side buttons container */
.quality-modal__header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Expand button (left side) */
.quality-modal__expand {
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.5);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.quality-modal__expand:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .quality-modal__expand {
  color: rgba(255, 255, 255, 0.5);
}

[data-md-color-scheme="slate"] .quality-modal__expand:hover {
  color: rgba(255, 255, 255, 0.9);
}

.quality-modal__expand svg {
  flex-shrink: 0;
}

/* Share button */
.quality-modal__share {
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--md-default-fg-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s ease;
}

.quality-modal__share:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Close button */
.quality-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--md-default-fg-color);
  border-radius: 4px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.quality-modal__close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ===========================================
   QUALITY PAGE LAYOUT (Modal + Standalone)
   Simple CSS Grid - no repositioning tricks
   =========================================== */

/* Modal content wrapper */
.quality-modal__content {
  overflow-y: auto;
  max-height: 85vh;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.4;

  /* Two-column grid layout */
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 2rem;
  padding: 0 2rem 2rem 2rem;
}

/* Title - spans both columns */
.quality-modal__content h1 {
  grid-column: 1 / -1;
  padding: 1rem 0 0.5rem 0;
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Hero image - spans both columns, full width with negative margins */
.quality-modal__content p:has(img) {
  grid-column: 1 / -1;
  margin: 0 -2rem;
  padding: 0;
  order: -1; /* Show before title */
}

.quality-modal__content p:has(img) img {
  width: 100%;
  height: 25vh;
  max-height: 400px;
  object-fit: cover;
  object-position: center 5%;
  display: block;
  margin: 0;
}

/* Per-image crop overrides, for heroes whose subject sits below the top band */
.quality-modal__content p:has(img) img[src*="cyborg-hero"] {
  object-position: center 55%;
}

/* H2 headings - left column as labels */
.quality-modal__content h2 {
  grid-column: 1;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0;
  margin: 0;
  align-self: start;
}

[data-md-color-scheme="slate"] .quality-modal__content h2 {
  color: rgba(255, 255, 255, 0.5);
}

/* All other content - right column */
.quality-modal__content > *:not(h1):not(h2):not(p:has(img)) {
  grid-column: 2;
  padding: 0.5rem 0;
  margin: 0;
}

/* Paragraphs */
.quality-modal__content p {
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

/* Lists */
.quality-modal__content ul,
.quality-modal__content ol {
  margin: 0;
  padding-left: 1.5rem;
}

.quality-modal__content li {
  margin: 0.25rem 0;
  line-height: 1.5;
}

/* Bold text */
.quality-modal__content strong {
  font-weight: 600;
}

/* Links - match Material's typeset link colors (the modal content div is
   outside .md-typeset, so links inherit body color without this) */
.quality-modal__content a {
  color: var(--md-typeset-a-color);
}

.quality-modal__content a:hover,
.quality-modal__content a:focus {
  color: var(--md-accent-fg-color);
}

/* Hide heading permalink anchors (Material only hides them inside .md-typeset) */
.quality-modal__content .headerlink {
  display: none;
}

/* Responsive - single column on mobile */
@media screen and (max-width: 768px) {
  .quality-modal {
    width: 95vw;
    max-height: 90vh;
  }

  .quality-modal__content {
    grid-template-columns: 1fr;
    padding: 0 1.5rem 1.5rem 1.5rem;
  }

  .quality-modal__content h1 {
    font-size: 1.625rem;
  }

  .quality-modal__content p:has(img) {
    margin: 0 -1.5rem;
  }

  .quality-modal__content p:has(img) img {
    height: 20vh;
    max-height: 200px;
  }

  /* H2 becomes regular heading on mobile */
  .quality-modal__content h2 {
    color: var(--md-default-fg-color);
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    grid-column: 1;
  }

  .quality-modal__content > *:not(h1):not(h2):not(p:has(img)) {
    grid-column: 1;
  }

  .quality-modal__header {
    padding: 0.5rem 0.75rem;
  }
}
