/**
 * Detail.design High-Craft Layout, Cards & Modal CSS
 * Clean, Monochromatic, Anti-AI-Slop Architecture
 * For holynova Portfolio v2
 */

/* Subtle Ambient Spotlight (Monochrome) */
.ambient-glow-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 30%), rgba(255, 255, 255, 0.025), transparent 70%);
  transition: opacity 0.4s ease;
}

[data-theme="light"] .ambient-glow-layer {
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 30%), rgba(0, 0, 0, 0.02), transparent 70%);
}

/* Site Layout Container */
.site-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Top Navigation Bar */
.site-header {
  position: relative;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  height: 60px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
}

.nav-left, .nav-right {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Brand Floating Pill */
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px 6px 8px;
  border-radius: var(--pill-radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.2s var(--ease-spring), transform 0.2s var(--ease-spring);
  cursor: pointer;
}

.brand-pill:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.brand-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-medium);
  background: var(--surface-tertiary);
}

.brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--accent-pill-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--text-secondary);
}

/* Nav Control Buttons */
.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--pill-radius);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.18s var(--ease-spring);
  cursor: pointer;
  white-space: nowrap;
}

.nav-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.nav-action-btn.nav-primary-action {
  color: var(--text-primary);
  background: var(--surface-secondary);
  border-color: var(--border-medium);
}

.nav-action-btn.nav-primary-action:hover {
  border-color: var(--border-focus);
}

/* Hero Section (No Eyebrow Kicker, Crisp Editorial Typography) */
.hero-section {
  padding-top: 130px;
  padding-bottom: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero-title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text-primary);
  margin-bottom: 14px;
  max-width: 820px;
}

.hero-subtitle {
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.hero-author-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.author-sig-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}

.author-sig-link:hover {
  border-color: var(--text-primary);
}

/* Sticky Progressive Blur Toolbar - Pins cleanly at the very top */
.sticky-toolbar-wrapper {
  position: sticky;
  top: 0px;
  z-index: 90;
  margin-bottom: 24px;
  padding: 12px 0;
}

/* Full-width Screen Blur Effect across 100vw */
.progressive-blur-bg {
  position: absolute;
  top: -12px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  pointer-events: none;
  z-index: -1;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: linear-gradient(to bottom, 
    rgba(var(--bg-page-rgb), 0.96) 0%, 
    rgba(var(--bg-page-rgb), 0.90) 80%, 
    rgba(var(--bg-page-rgb), 0) 100%
  );
  mask: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
  -webkit-mask: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
}

.toolbar-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s ease, box-shadow 0.35s var(--ease-spring), transform 0.25s var(--ease-spring);
}

/* Web Motion: Scroll Shadow - Soft elevation shadow when scrolled away from top */
.sticky-toolbar-wrapper.is-scrolled .toolbar-container {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-scroll-nav);
}

.toolbar-container:focus-within {
  border-color: var(--border-medium);
}

.toolbar-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-field {
  width: 100%;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--pill-radius);
  padding: 8px 68px 8px 38px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s var(--ease-spring);
}

.search-input-field:focus {
  background: var(--surface-primary);
  border-color: var(--border-focus);
}

.search-clear-btn {
  position: absolute;
  right: 34px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
}

.search-clear-btn span {
  font-size: 18px;
  line-height: 1;
}

.search-kbd-hint {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--surface-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}

.results-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 24px;
  margin: -8px 2px 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.results-summary {
  margin: 0;
}

.clear-filters-btn,
.empty-state-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--border-medium);
  border-radius: var(--pill-radius);
  color: var(--text-secondary);
  background: var(--surface-secondary);
  font-size: 12px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.clear-filters-btn:hover,
.empty-state-action:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

/* Category Filter Pills */
.category-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.category-pills-row::-webkit-scrollbar {
  display: none;
}

.cat-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--pill-radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: all 0.15s var(--ease-spring);
}

.cat-pill-btn:hover {
  color: var(--text-primary);
  background: var(--surface-secondary);
}

.cat-pill-btn.active {
  color: var(--text-primary);
  background: var(--surface-secondary);
  border-color: var(--border-medium);
  font-weight: 600;
}

.cat-count-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Sort Controls */
.toolbar-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.sort-select-wrapper {
  position: relative;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--pill-radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.15s var(--ease-spring);
}

.sort-button:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.sort-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface-primary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 160px;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.sort-menu-dropdown.open {
  display: flex;
}

.sort-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sort-menu-item:hover, .sort-menu-item.selected {
  color: var(--text-primary);
  background: var(--surface-secondary);
}

.sort-menu-item.selected {
  font-weight: 600;
}

.item-counter-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--pill-radius);
}

/* =========================================================================
   Standard Aligned Grid Layout (3 Columns, No Masonry Waterfall)
   ========================================================================= */
.detail-masonry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  width: 100%;
}

@media (min-width: 640px) {
  .detail-masonry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .detail-masonry-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Detail Card Item (Standard 16:10 Aligned Grid Card) */
.detail-card {
  height: 100%;
  margin-bottom: 0;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card-rest);
  --spotlight-x: 50%;
  --spotlight-y: 50%;
  --spotlight-opacity: 0;
  transition: transform 0.22s var(--ease-spring), border-color 0.2s ease, box-shadow 0.3s var(--ease-spring);
  cursor: default;
}

/* Web Motion: cursor-tracked light across the card surface and border. */
.detail-card::before,
.detail-card::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
  opacity: var(--spotlight-opacity);
  transition: opacity 0.22s ease;
}

.detail-card::before {
  inset: 0;
  padding: 1px;
  background: radial-gradient(
    280px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(255, 255, 255, 0.94),
    rgba(255, 255, 255, 0.32) 40%,
    transparent 76%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  z-index: 3;
}

.detail-card::after {
  inset: 1px;
  background: radial-gradient(
    360px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(255, 255, 255, 0.12),
    transparent 72%
  );
  z-index: 0;
}

.detail-card > * {
  position: relative;
  z-index: 1;
}

.detail-card:hover,
.detail-card:focus-within {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover), 0 0 0 1px var(--card-hover-ring);
}

.detail-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .detail-card::before {
  background: radial-gradient(
    280px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(0, 0, 0, 0.64),
    rgba(0, 0, 0, 0.18) 40%,
    transparent 76%
  );
}

[data-theme="light"] .detail-card::after {
  background: radial-gradient(
    360px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(0, 0, 0, 0.08),
    transparent 72%
  );
}

/* Card Entry Animation for Infinite/Progressive Scroll */
.card-appear {
  animation: cardEntry 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntry {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Sentinel & Loading Indicator */
.scroll-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}

.scroll-status-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0 16px;
  min-height: 56px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.scroll-loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.spinner-icon {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.scroll-end-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
}

.scroll-progress-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.scroll-progress-label {
  color: var(--text-muted);
  font-size: 12px;
}

.load-more-btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--pill-radius);
  color: var(--text-primary);
  background: var(--surface-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.load-more-btn:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

/* Top Media Box */
.card-media-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--media-stage);
  background: color-mix(
    in srgb,
    var(--media-stage) calc(100% - var(--media-tint-strength)),
    var(--media-tint, var(--media-stage)) var(--media-tint-strength)
  );
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

.aspect-16-10 { aspect-ratio: 16 / 10; }
.aspect-16-9  { aspect-ratio: 16 / 10; }
.aspect-4-3   { aspect-ratio: 16 / 10; }

.visual-canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
}

.card-demo-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.62);
  display: block;
  transition: filter 0.2s ease;
}

.card-image-link {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: 100%;
  padding: 10px;
  overflow: hidden;
  background: var(--media-stage);
  background: color-mix(
    in srgb,
    var(--media-stage) calc(100% - var(--media-tint-strength)),
    var(--media-tint, var(--media-stage)) var(--media-tint-strength)
  );
  cursor: pointer;
}

/* A muted, blurred copy of the artwork fills the frame and softens hard black/white edges. */
.card-image-link::before {
  content: '';
  position: absolute;
  inset: -18px;
  z-index: 0;
  pointer-events: none;
  background-image: var(--card-image, none);
  background-position: center;
  background-size: cover;
  filter: blur(22px) saturate(var(--media-halo-saturation)) brightness(var(--media-halo-brightness));
  opacity: var(--media-halo-opacity);
  transform: scale(1.08);
}

.card-image-link::after {
  content: '';
  position: absolute;
  inset: 10px;
  z-index: 2;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 48%, var(--media-overlay) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.detail-card:hover .card-image-link::after,
.detail-card:focus-within .card-image-link::after {
  border-color: var(--border-hover);
  background: linear-gradient(180deg, transparent 38%, var(--media-overlay-hover) 100%);
}

.detail-card:hover .card-demo-image,
.detail-card:focus-within .card-demo-image {
  filter: brightness(0.95) saturate(0.97);
}

.card-image-link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -4px;
}

.card-name-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--media-stage);
  padding: 20px;
  text-align: center;
  position: relative;
  user-select: none;
}

.placeholder-repo-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  word-break: break-word;
  transition: color 0.15s ease;
}

.detail-card:hover .placeholder-repo-name {
  color: var(--text-primary);
}

/* Card Body (Flex Column Stretched to Align Rows Perfectly) */
.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.card-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-meta-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.card-category-tag {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.card-status-badge {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.card-status-badge.star-badge {
  color: var(--accent-star);
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.2);
}

.card-like-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--surface-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease-spring);
}

.card-like-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: scale(1.05);
}

.card-like-btn.liked {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.card-like-btn.liked .heart-icon {
  fill: #ef4444;
  stroke: #ef4444;
  animation: heartPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.card-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.48;
  color: var(--text-primary);
  transition: color 0.15s ease;
  overflow-wrap: anywhere;
}

.detail-card:hover .card-title {
  color: var(--text-primary);
}

.card-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.72;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 46px;
}

html[lang="zh-CN"] .hero-subtitle,
html[lang="zh-CN"] .card-description {
  letter-spacing: 0.012em;
}

html[lang="zh-CN"] .card-category-tag,
html[lang="zh-CN"] .cat-pill-btn,
html[lang="zh-CN"] .sort-button {
  /* Match the English page for Latin labels while preserving CJK fallback. */
  font-family: var(--font-sans);
  letter-spacing: 0.015em;
}

.card-hover-actions {
  display: flex;
  align-items: center;
  padding-top: 10px;
  margin-top: auto;
  min-height: 46px;
}

.card-action-links {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s var(--ease-spring);
}

.detail-card:hover .card-action-links,
.detail-card:focus-within .card-action-links {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.card-action-btn {
  flex: 1;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease-spring);
}

.card-live-demo-btn {
  color: var(--action-primary-fg);
  background: var(--action-primary-bg);
  border-color: var(--action-primary-bg);
}

.card-action-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.card-live-demo-btn:hover {
  color: var(--action-primary-fg);
  background: var(--action-primary-hover);
  border-color: var(--action-primary-hover);
}

.cat-pill-btn.favorites-pill.has-likes {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.cat-pill-btn.favorites-pill.active {
  color: #ffffff;
  background: #ef4444;
  border-color: #ef4444;
}

.cat-pill-btn.favorites-pill.active .cat-count-badge {
  color: rgba(255, 255, 255, 0.85);
}

/* Empty State */
.empty-state-box {
  padding: 80px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.empty-state-icon {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.empty-state-box > div:not(.empty-state-title),
.error-state-box > div:not(.empty-state-title) {
  max-width: 46ch;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Footer */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* Shared keyboard state. */
:where(a, button, input):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
  .site-wrapper {
    padding: 0 16px 50px;
  }
  .site-header {
    padding: 0 16px;
  }
  .hero-section {
    padding-top: 100px;
    padding-bottom: 28px;
  }
  .toolbar-top-row {
    align-items: stretch;
  }
  .search-box {
    flex-basis: 100%;
    min-width: 0;
  }
  .toolbar-controls-right,
  .sort-select-wrapper,
  .sort-button {
    width: 100%;
  }
  .sort-menu-dropdown {
    left: 0;
    right: 0;
    min-width: 0;
  }
  .results-summary-row {
    align-items: flex-start;
    margin-top: -4px;
  }
}

@media (pointer: coarse), (max-width: 768px) {
  .nav-action-btn,
  .cat-pill-btn,
  .sort-button,
  .search-clear-btn,
  .card-action-btn,
  .card-like-btn,
  .load-more-btn,
  .clear-filters-btn,
  .empty-state-action {
    min-height: 44px;
  }

  .card-action-btn,
  .card-like-btn,
  .search-clear-btn {
    min-width: 44px;
  }

  .card-action-links {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

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

  .detail-card::before,
  .detail-card::after {
    opacity: 0 !important;
  }
}
