/* Description widget styles */
.homerunner-description-container {
  font-family: inherit;
  line-height: 1.6;
  color: inherit;
}

.homerunner-description-section {
  margin-bottom: 1.5rem;
}

.homerunner-description-section:last-child {
  margin-bottom: 0;
}

.homerunner-description-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: inherit;
}

.homerunner-description-content {
  color: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.homerunner-description-content p {
  margin-bottom: 0.75rem;
}

.homerunner-description-content p:last-child {
  margin-bottom: 0;
}

/* Loading skeleton styles */
.homerunner-description-skeleton {
  --base-color: #ebebeb;
  --highlight-color: #f5f5f5;
  --animation-duration: 1.5s;
  --animation-direction: normal;
  --pseudo-element-display: block;

  background-color: var(--base-color);
  width: 100%;
  border-radius: 0.25rem;
  display: inline-flex;
  line-height: 1;
  position: relative;
  user-select: none;
  overflow: hidden;
}

.homerunner-description-skeleton::after {
  content: ' ';
  display: var(--pseudo-element-display);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background-repeat: no-repeat;
  background-image: linear-gradient(
    90deg,
    var(--base-color) 0%,
    var(--highlight-color) 50%,
    var(--base-color) 100%
  );
  transform: translateX(-100%);
  animation-name: homerunner-description-skeleton-slide;
  animation-direction: var(--animation-direction);
  animation-duration: var(--animation-duration);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes homerunner-description-skeleton-slide {
  100% {
    transform: translateX(100%);
  }
}

/* Dark mode skeleton */
.dark .homerunner-description-skeleton {
  --base-color: #374151;
  --highlight-color: #4b5563;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion) {
  .homerunner-description-skeleton {
    --pseudo-element-display: none;
  }
}

/* Error state styles */
.homerunner-description-error {
  text-align: center;
  padding: 2rem;
  color: #dc2626;
}

.homerunner-description-error-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.homerunner-description-error-message {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Show More Button Styles */
.homerunner-description-more {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-start;
}

.homerunner-description-excerpt {
  margin-bottom: 1rem;
}

/* Description Dialog Size Override */
.homerunner-description-dialog.hr-dialog-content {
  max-width: min(1280px, 95vw);
}

/* Description Dialog Scrollbar Theming */
.homerunner-description-dialog {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.homerunner-description-dialog::-webkit-scrollbar {
  width: 6px;
}

.homerunner-description-dialog::-webkit-scrollbar-track {
  background: transparent;
}

.homerunner-description-dialog::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.homerunner-description-dialog.dark {
  scrollbar-color: var(--muted-foreground) transparent;
}

.homerunner-description-dialog.dark::-webkit-scrollbar-thumb {
  background-color: var(--muted-foreground);
}

/* Key-Value Layout Styles for Dialog */
.homerunner-description-dialog .grid > div:first-child h3 {
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground, #6b7280);
  margin-bottom: 0;
}

.homerunner-description-dialog .grid > div:last-child {
  line-height: 1.6;
  color: inherit;
}

.homerunner-description-dialog .grid > div:last-child p {
  margin-bottom: 0.75rem;
}

.homerunner-description-dialog .grid > div:last-child p:last-child {
  margin-bottom: 0;
}

.homerunner-description-container.dark .homerunner-description-dialog .grid > div:first-child h3 {
  color: var(--foreground) !important;
}

.homerunner-description-container.dark .homerunner-description-dialog .grid > div:last-child {
  color: var(--foreground) !important;
}

/* Responsive design */
@media (max-width: 768px) {
  .homerunner-description-container {
    padding: 0 1rem;
  }

  .homerunner-description-title {
    font-size: 1.125rem;
  }

  .homerunner-description-dialog .grid > div:first-child {
    margin-bottom: 0.5rem;
  }

  .homerunner-description-dialog .grid > div:first-child h3 {
    margin-bottom: 0.25rem;
  }
}

/* ----------------------------------------------------------------------------
 * Section heading (shared across content widgets)
 * Bold title on the left + horizontal divider line filling remaining width.
 * -------------------------------------------------------------------------- */

.hr-widget-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.hr-widget-section-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
  flex-shrink: 0;
}

.hr-widget-section-line {
  flex: 1;
  height: 1px;
  background-color: currentColor;
  opacity: 0.18;
  display: block;
}

@media (max-width: 640px) {
  .hr-widget-section-title { font-size: 1.25rem; }
  .hr-widget-section { gap: 1rem; margin-bottom: 1.5rem; }
}

/* ----------------------------------------------------------------------------
 * Dark first-paint variants (#900). Byte-identical mirror of the `.dark`-keyed
 * COLOR rules above, re-scoped to the shadow host so an `auto` widget on a dark
 * OS paints dark AT PARSE (no JS/cookie) and the runtime marker keeps working
 * post-hydration. The existing `.dark` rules are left untouched (append-only):
 *   - `:host([data-hr-theme="dark"])` — runtime marker (explicit dark + post-
 *     hydration auto) and the mirrored elevated-dialog host.
 *   - `@media (prefers-color-scheme: dark)` + `:host([data-hr-scheme="auto"]
 *     :not([data-hr-theme]))` — server-stamped auto widget, first paint. BOTH
 *     conditions stay INSIDE :host(...) so they actually match the host.
 * Skeleton base/highlight are HARDCODED hex that only flip via `.dark`; the
 * dialog/grid rules reuse the `--muted-foreground`/`--foreground` tokens that
 * styles/common.css already flips under these same selectors.
 * -------------------------------------------------------------------------- */
:host([data-hr-theme="dark"]) .homerunner-description-skeleton {
  --base-color: #374151;
  --highlight-color: #4b5563;
}

:host([data-hr-theme="dark"]) .homerunner-description-dialog {
  scrollbar-color: var(--muted-foreground) transparent;
}

:host([data-hr-theme="dark"]) .homerunner-description-dialog::-webkit-scrollbar-thumb {
  background-color: var(--muted-foreground);
}

:host([data-hr-theme="dark"]) .homerunner-description-container .homerunner-description-dialog .grid > div:first-child h3,
:host([data-hr-theme="dark"]) .homerunner-description-container .homerunner-description-dialog .grid > div:last-child {
  color: var(--foreground) !important;
}

@media (prefers-color-scheme: dark) {
  :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-description-skeleton {
    --base-color: #374151;
    --highlight-color: #4b5563;
  }

  :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-description-dialog {
    scrollbar-color: var(--muted-foreground) transparent;
  }

  :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-description-dialog::-webkit-scrollbar-thumb {
    background-color: var(--muted-foreground);
  }

  :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-description-container .homerunner-description-dialog .grid > div:first-child h3,
  :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-description-container .homerunner-description-dialog .grid > div:last-child {
    color: var(--foreground) !important;
  }
}
