[x-cloak] { display: none !important; }

:root {
  --hub-accent: #6ea8fe;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.hero {
  background:
    radial-gradient(1200px 300px at 10% -10%, rgba(110, 168, 254, .18), transparent),
    radial-gradient(800px 300px at 90% 0%, rgba(163, 113, 247, .14), transparent);
  border-bottom: 1px solid var(--bs-border-color);
}

.pkg-card {
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pkg-card:hover {
  transform: translateY(-2px);
  border-color: var(--hub-accent);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .35);
}

.pkg-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: .5rem;
  background: rgba(110, 168, 254, .12);
  color: var(--hub-accent);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
}

.text-break-all { word-break: break-all; }
.min-w-0 { min-width: 0; } /* lets .text-truncate work inside flex children */

/* Upload drop zone */
.dropzone {
  border: 2px dashed var(--bs-border-color);
  border-radius: .75rem;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragging {
  border-color: var(--hub-accent);
  background: rgba(110, 168, 254, .06);
  outline: none;
}
.dropzone.is-invalid { border-color: var(--bs-form-invalid-border-color); }

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, var(--bs-secondary-bg) 25%, var(--bs-tertiary-bg) 50%, var(--bs-secondary-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: .375rem;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .pkg-card, .skeleton { transition: none; animation: none; }
  .pkg-card:hover { transform: none; }
}

/* Voting */
.vote-group .btn { --bs-btn-padding-x: .5rem; }
.vote-score { min-width: 2.25rem; font-variant-numeric: tabular-nums; }

/* reCAPTCHA widget is 304px wide; scale it down on very narrow screens */
.captcha { min-height: 78px; }
@media (max-width: 360px) {
  .captcha { transform: scale(.88); transform-origin: 0 0; }
}

/* Card "⋯" actions menu (edit / delete / report) */
.pkg-menu { line-height: 1; text-decoration: none; }
.pkg-menu:hover, .pkg-menu:focus-visible { color: var(--bs-body-color) !important; }

/* Community rules modal */
.rule-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: .5rem;
  background: rgba(110, 168, 254, .12);
  color: var(--hub-accent);
}

/* user.html */
.profile-avatar {
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(110, 168, 254, .35), rgba(163, 113, 247, .35));
  border: 1px solid var(--bs-border-color);
  font-size: 1.75rem;
  font-weight: 600;
}
.stat {
  min-width: 6.5rem;
  padding: .5rem .85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-tertiary-bg);
}
.stat-value { font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--bs-secondary-color); }

/* Target app badge on package cards */
.app-badge {
  background: rgba(32, 201, 151, .14);
  border: 1px solid rgba(32, 201, 151, .45);
  color: #63e6be;
}
.app-badge:hover { background: rgba(32, 201, 151, .26); color: #96f2d7; }

/* Admin: target apps list */
.app-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
}
.app-row.is-archived { opacity: .7; }

/* ── Package preview dialog (js/preview.js) ── */
.pv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .5rem;
  padding: .5rem 1rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}
.pv-toolbar .nav-link { margin-bottom: -1px; }
.pv-stat {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  font-size: .8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
}

/* Parsed view — flat layout: collapsible headings, indentation guides and hairline
   dividers instead of nested boxes. */
.pv-parsed { display: grid; gap: 0; font-size: .925rem; line-height: 1.45; }

/* Collapsible rows (sections + nested groups) */
.pv-section > summary,
.pv-group > summary {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-radius: .3rem;
}
.pv-section > summary::-webkit-details-marker,
.pv-group > summary::-webkit-details-marker { display: none; }
.pv-section > summary:hover .pv-chevron,
.pv-group > summary:hover .pv-chevron { color: var(--bs-body-color); }
.pv-section > summary:focus-visible,
.pv-group > summary:focus-visible { outline: 2px solid var(--hub-accent); outline-offset: 2px; }
.pv-chevron {
  font-size: .7rem;
  color: var(--bs-secondary-color);
  transition: transform .15s ease;
  flex-shrink: 0;
}
details[open] > summary > .pv-chevron { transform: rotate(90deg); }
.pv-count {
  margin-left: .25rem;
  font-size: .75rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}

/* Top-level sections: separated by a hairline, no card */
.pv-section { padding: .55rem 0; }
.pv-section + .pv-section { border-top: 1px solid var(--bs-border-color-translucent); }
.pv-section > summary { padding: .1rem 0; }
.pv-section-icon { color: var(--hub-accent); font-size: .85rem; flex-shrink: 0; }
.pv-section-title {
  margin: 0;
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-section > summary .pv-count { margin-left: auto; }
.pv-section-body { padding: .4rem 0 .1rem 1.1rem; }

/* Key / value grid */
.pv-kv {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: .2rem 1rem;
  margin: 0;
}
.pv-kv > dt {
  font-weight: 400;
  color: var(--bs-secondary-color);
  overflow-wrap: anywhere;
}
.pv-kv > dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.pv-kv > .pv-wide { grid-column: 1 / -1; margin: 0; }
@media (max-width: 575.98px) {
  .pv-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pv-kv > dt { font-size: .8rem; }
  .pv-kv > dd { margin-bottom: .3rem; }
}

/* Nested groups: a subtle indentation guide instead of a box */
.pv-group > summary { padding: .05rem 0; }
.pv-group-title { color: var(--bs-secondary-color); font-weight: 500; }
.pv-group[open] > summary .pv-group-title { color: var(--bs-body-color); }
.pv-group-body {
  margin: .2rem 0 .3rem .3rem;
  padding-left: .8rem;
  border-left: 1px solid var(--bs-border-color-translucent);
}

/* Lists of objects: flat entries split by hairlines */
.pv-items { display: grid; gap: .35rem; }
.pv-common { padding-bottom: .35rem; border-bottom: 1px dashed var(--bs-border-color-translucent); }
.pv-common-label { font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .2rem; }
.pv-item-list { display: grid; }
.pv-item { padding: .4rem 0; }
.pv-item + .pv-item { border-top: 1px solid var(--bs-border-color-translucent); }
.pv-item-title {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  min-width: 0;
  margin-bottom: .2rem;
}
.pv-index { font-size: .7rem; color: var(--bs-secondary-color); font-family: var(--bs-font-monospace); }
.pv-list { margin: 0; padding-left: 1.25rem; }
.pv-list > li { margin-bottom: .15rem; }
.pv-list > li::marker { color: var(--bs-secondary-color); font-size: .8em; }

/* Chips (short primitive arrays) */
.pv-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.pv-chip {
  display: inline-block;
  padding: .05rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
  font-size: .8rem;
  line-height: 1.5;
  white-space: nowrap;
}
.pv-str { white-space: pre-wrap; }
.pv-num { font-family: var(--bs-font-monospace); color: #ffc078; }
.pv-null { color: var(--bs-secondary-color); font-style: italic; }
.pv-bool { font-weight: 500; }
.pv-bool.is-true { color: #8ce99a; }
.pv-bool.is-false { color: #ffa8a8; }
.pv-link { overflow-wrap: anywhere; }
.pv-color { display: inline-flex; align-items: center; gap: .4rem; }
.pv-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: .25rem;
  border: 1px solid rgba(255, 255, 255, .35);
  flex-shrink: 0;
}
.pv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1rem;
  padding-top: .5rem;
  border-top: 1px solid var(--bs-border-color-translucent);
}
.pv-meta-item { overflow-wrap: anywhere; }
.pv-single { font-size: 1.05rem; }
.pv-parsed > .alert { margin-bottom: .5rem; }

/* Raw JSON */
.pv-raw {
  margin: 0;
  padding: 1rem;
  font-size: .8rem;
  line-height: 1.5;
  background: #0d1117;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  color: #c9d1d9;
  white-space: pre;
  tab-size: 2;
}
.pv-raw .j-key { color: #79c0ff; }
.pv-raw .j-str { color: #7ee787; }
.pv-raw .j-num { color: #ffa657; }
.pv-raw .j-bool { color: #ff7b72; }
.pv-raw .j-null { color: #8b949e; font-style: italic; }

/* ZIP file list */
.pv-zip { max-height: 55vh; overflow-y: auto; border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.pv-zip thead th { position: sticky; top: 0; background: var(--bs-tertiary-bg); }
.app-row.active-edit { box-shadow: inset 3px 0 0 var(--bs-primary); }
