/* ============================================================
   vpm.sleightly.dev — practical JustSleightly VPM listing shell
   ============================================================ */

@import url('tokens.css');

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./assets/fonts/IBMPlexSans-VariableFont_wdth_wght.ttf') format('truetype-variations');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./assets/fonts/IBMPlexSans-Italic-VariableFont_wdth_wght.ttf') format('truetype-variations');
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --font-ibm-plex-sans: 'IBM Plex Sans';
  --stage-max: 1180px;
  --glass: rgba(18, 18, 18, 0.72);
  --glass-strong: rgba(14, 14, 14, 0.94);
  --glass-border: rgba(255, 255, 255, 0.14);
  --silver-line: rgba(152, 174, 165, 0.16);
  --button-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  --soft-ring: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 22px 70px rgba(0, 0, 0, 0.36);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: var(--text-body-30);
  line-height: var(--leading-body-30);
  color: var(--fg);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.055), transparent 24rem),
    radial-gradient(circle at 82% 12%, rgba(255, 0, 42, 0.07), transparent 26rem),
    linear-gradient(180deg, #141414 0%, #0b0b0b 54%, #121212 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(to right, rgba(152, 174, 165, 0.065) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(152, 174, 165, 0.055) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0 31%, transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 9% 20%, rgba(255, 255, 255, 0.105), transparent 34%),
    radial-gradient(ellipse at 74% 8%, rgba(255, 0, 42, 0.075), transparent 38%);
  filter: blur(18px);
  opacity: 0.88;
}

#stageCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.36;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--fg);
  letter-spacing: -0.012em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }
::selection { background: var(--accent-selection); color: #fff; }

.page-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  position: sticky;
  top: 16px;
  z-index: 20;
  width: min(calc(100% - 32px), var(--stage-max));
  min-height: 58px;
  margin: 16px auto 0;
  padding: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(16px) saturate(128%);
  box-shadow: var(--soft-ring);
}

.brand-chip,
.nav-pills {
  display: inline-flex;
  align-items: center;
}

.brand-chip {
  min-width: 0;
  gap: 10px;
  color: #fff;
  font-weight: 700;
}

.brand-logo-wrap {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #050505;
  box-shadow: 0 0 0 1px rgba(255, 0, 42, 0.14), 0 0 22px rgba(255, 0, 42, 0.12);
  transition: transform 420ms var(--ease-reveal), border-color 160ms ease;
}

.brand-logo-wrap img,
.dialog-package-icon img,
.package-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (hover: hover) and (pointer: fine) {
  .brand-chip:hover .brand-logo-wrap { transform: rotate(12deg) scale(1.04); border-color: rgba(255, 0, 42, 0.36); }
}

.brand-wordmark { white-space: nowrap; }

.nav-pills {
  justify-self: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.055);
}

.nav-pills a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  color: var(--fg-2);
  font-size: var(--text-label-10);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-pills a:hover,
.nav-pills a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.nav-cta {
  justify-self: end;
  min-height: 42px;
  border-color: rgba(255, 0, 42, 0.32);
  background: rgba(255, 0, 42, 0.13);
}

.nav-cta:hover,
.nav-cta:focus-visible {
  background: linear-gradient(180deg, #ff002a, #8b0015);
}

.hero-section {
  width: min(100%, var(--stage-max));
  margin: 0 auto;
  padding: clamp(34px, 5vw, 64px) 24px 30px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.72fr);
  gap: clamp(22px, 4vw, 44px);
  align-items: end;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.eyebrow {
  color: var(--accent);
  font-size: var(--text-label-10);
  line-height: var(--leading-label-10);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 680px;
  font-size: clamp(2.5rem, 5.2vw, 4.35rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.hero-lede {
  max-width: 560px;
  color: var(--fg-2);
  font-size: var(--text-body-30);
  line-height: 1.55;
}

.package-count-line {
  color: var(--muted);
  font-size: var(--text-body-20);
  line-height: var(--leading-body-20);
}

.package-count-line strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(152, 174, 165, 0.18);
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: rgba(152, 174, 165, 0.075);
  font-size: var(--text-label-10);
  font-weight: 700;
}

.install-panel,
.packages,
.dialog-card {
  border: 1px solid var(--glass-border);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: var(--soft-ring);
  backdrop-filter: blur(18px) saturate(120%);
}

.install-panel {
  padding: 16px;
  border-radius: 22px;
  display: grid;
  gap: 12px;
}

.toolbar-row,
.dialog-header,
.dialog-meta-row,
.dialog-url-row,
.dialog-actions-primary,
.dialog-action-footer,
.action-row,
.package-action-cell {
  display: flex;
  align-items: center;
}

.install-header {
  justify-content: space-between;
  gap: 12px;
}

.install-label {
  color: var(--muted);
  font-size: var(--text-label-10);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vccUrlField,
#searchInput {
  width: 100%;
  height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  outline: none;
  color: var(--fg);
  background: rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font: 500 var(--text-body-20)/1 var(--font-body);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.vccUrlField {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-body-10);
}

.vccUrlField:focus,
#searchInput:focus {
  border-color: rgba(255, 0, 42, 0.58);
  background: rgba(0, 0, 0, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 3px rgba(255, 0, 42, 0.13);
}

#searchInput::placeholder { color: rgba(220, 226, 224, 0.46); }

.action-row,
.dialog-url-row,
.dialog-action-footer,
.package-action-cell { gap: 10px; }

.button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: var(--button-shadow);
  cursor: pointer;
  font: 700 var(--text-button-20)/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.button:hover,
.button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.button:focus-visible { box-shadow: var(--button-shadow), var(--focus-ring); }
.button.primary { border-color: rgba(255, 0, 42, 0.32); background: linear-gradient(180deg, #ff002a, #8b0015); }
.button.primary:hover,
.button.primary:focus-visible { background: linear-gradient(180deg, #ff2447, #9e001a); }
.button.secondary { background: rgba(255, 255, 255, 0.06); }
.icon-button { width: 40px; padding: 0; font-size: 17px; line-height: 1; }
.close-button { font-size: 24px; }
.help-button { padding-inline: 14px; }

.main-content {
  width: 100%;
  padding: 0 24px 12px;
}

.package-section {
  width: min(100%, var(--stage-max));
  margin: 0 auto;
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1;
}

.toolbar-row {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.searchBlock { flex: 1; min-width: 240px; }
.index-link { flex: 0 0 auto; }

.packages {
  display: grid;
  gap: 10px;
  width: 100%;
  border-radius: 24px;
  padding: 12px;
}

.package-row[hidden] {
  display: none !important;
}

.package-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(14px, 2vw, 22px);
  align-items: center;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0 0, rgba(255, 0, 42, 0.09), transparent 35%),
    rgba(255, 255, 255, 0.055);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.package-row:hover,
.package-row:focus-within {
  transform: translateY(-1px);
  border-color: rgba(255, 0, 42, 0.32);
  background:
    radial-gradient(circle at 0 0, rgba(255, 0, 42, 0.13), transparent 34%),
    rgba(255, 255, 255, 0.07);
}

.package-primary-cell { min-width: 0; display: flex; align-items: center; gap: 14px; }

.package-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  background: #050505;
  box-shadow: 0 14px 28px rgba(255, 0, 42, 0.08);
}

.package-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.package-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.package-type-badge { min-height: 26px; padding: 4px 8px; }
.packageName { color: #fff; font-size: var(--text-title-20); line-height: 1.2; }
.caption1 { color: var(--fg-2); font-size: var(--text-body-20); line-height: 1.45; }
.caption2 { color: var(--muted); font-size: var(--text-body-10); line-height: 1.4; }
.text-mono { font-family: var(--font-mono); }
.package-action-cell { justify-content: flex-end; flex-wrap: wrap; }

.empty-state {
  margin-top: 14px;
  padding: 16px;
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.modal-overlay[hidden] { display: none !important; }

.modal-overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 5, 7, 0.78);
  backdrop-filter: blur(14px) saturate(118%);
  -webkit-backdrop-filter: blur(14px) saturate(118%);
}

.dialog-card {
  width: min(92vw, 820px);
  max-height: min(86vh, 680px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(17, 17, 18, 0.98), rgba(27, 11, 15, 0.97));
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.62), 0 0 34px rgba(255, 0, 42, 0.1);
}

.setup-dialog-card { width: min(92vw, 620px); }

.dialog-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.package-dialog-header { align-items: center; }
.package-dialog-title { min-width: 0; display: flex; align-items: center; gap: 14px; }
.dialog-package-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  overflow: hidden;
  background: #050505;
}

.dialog-header h3 { margin-top: 4px; font-size: var(--text-title-30); line-height: var(--leading-title-30); }
.dialog-meta-row { gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: var(--text-body-10); }
.package-description {
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--fg-2);
  background: rgba(255, 255, 255, 0.045);
  line-height: 1.55;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-grid section {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.info-grid h4 {
  margin-bottom: 8px;
  color: #fff;
  font-size: var(--text-title-10);
}

.info-grid p,
.info-grid li {
  color: var(--fg-2);
  font-size: var(--text-body-20);
  line-height: 1.55;
}

.info-grid ul { margin: 0; padding-left: 18px; }
.keyword-row { display: flex; flex-wrap: wrap; gap: 6px; }
.keyword-row .badge { min-height: 28px; padding: 5px 8px; font-size: 11px; }
.repo-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 0, 42, 0.13), transparent 46%),
    rgba(255, 255, 255, 0.045) !important;
}
.repo-card::after {
  content: "";
  position: absolute;
  inset: auto 12px 10px auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transform: rotate(8deg);
  background: linear-gradient(145deg, rgba(255, 0, 42, 0.18), rgba(255, 255, 255, 0.035));
  opacity: 0.34;
  pointer-events: none;
}
.repo-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.repo-badge { min-height: 24px; padding: 4px 8px; font-size: 10px; }
.repo-name {
  color: #fff;
  font-size: var(--text-body-10);
  overflow-wrap: anywhere;
}
.repo-card-copy {
  margin-top: 7px;
  max-width: 34ch;
  color: var(--fg-2);
  font-size: var(--text-body-20);
  line-height: 1.45;
}
.repo-card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.repo-button { min-height: 34px; padding-inline: 12px; font-size: var(--text-button-10); }
.dialog-action-footer {
  position: sticky;
  bottom: -18px;
  margin: 16px -18px -18px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(17,17,18,0.82), rgba(17,17,18,0.98));
  display: grid;
  gap: 10px;
}
.dialog-actions-primary {
  gap: 10px;
  flex-wrap: wrap;
}
.dialog-url-row .vccUrlField { flex: 1; }

.setup-list {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--fg-2);
}
.setup-list li { margin: 0 0 8px; }
.dialog-footnote {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--fg-2);
  font-size: var(--text-body-20);
}
.hidden { display: none !important; }

.site-footer {
  width: min(calc(100% - 48px), var(--stage-max));
  margin: 18px auto 20px;
  padding: 14px 0 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--glass-border);
  color: var(--muted);
  font-size: var(--text-label-10);
}

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

@media (max-width: 940px) {
  .top-bar { grid-template-columns: auto minmax(0, 1fr) auto; border-radius: 28px; }
  .nav-pills {
    grid-column: auto;
    justify-self: stretch;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-cta { justify-self: end; }
  .hero-grid { grid-template-columns: 1fr; }
  .install-panel { max-width: 680px; }
  .package-row { grid-template-columns: 1fr; }
  .package-action-cell { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .top-bar {
    position: relative;
    top: 0;
    width: min(calc(100% - 20px), var(--stage-max));
    min-height: 56px;
    margin-top: 10px;
    gap: 8px;
  }
  .brand-wordmark { display: none; }
  .brand-logo-wrap { width: 38px; height: 38px; }
  .nav-pills { padding: 3px; gap: 2px; }
  .nav-pills a { min-height: 32px; padding: 7px 8px; font-size: 10px; letter-spacing: 0.01em; }
  .nav-cta { min-height: 38px; padding-inline: 12px; }
  .hero-section { padding: 34px 16px 24px; }
  .main-content { padding-inline: 16px; }
  .hero-copy h1 { font-size: clamp(2.7rem, 16vw, 4.3rem); }
  .toolbar-row { flex-direction: column; align-items: stretch; }
  .index-link { width: 100%; }
  .packages { padding: 8px; border-radius: 18px; }
  .package-row { padding: 14px; }
  .package-action-cell { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-action-cell .button { width: 100%; }
  .action-row, .dialog-url-row, .dialog-action-footer { flex-direction: column; align-items: stretch; }
  .action-row .button, .dialog-url-row .button, .dialog-action-footer .button { width: 100%; }
  .rowPackageInfoButton { white-space: normal; text-align: center; }
  .info-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 16px; }
  .dialog-action-footer { margin: 16px -16px -16px; padding: 14px 16px 16px; }
}

@media (max-width: 420px) {
  .top-bar { width: min(calc(100% - 16px), var(--stage-max)); gap: 6px; padding: 7px; }
  .nav-pills a { padding-inline: 7px; font-size: 9.5px; }
  .nav-cta { padding-inline: 10px; font-size: 12px; }
  .package-primary-cell { align-items: flex-start; }
  .package-action-cell { grid-template-columns: 1fr; }
}

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