/* PDQ Package Library. Styling follows pdq.com: Inter body, Space Grotesk headings and buttons,
   charcoal primary with mint hover. Fonts are Inter and Space Grotesk (SIL Open Font License 1.1). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("inter-latin.woff2?v=c940764593") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("space-grotesk-latin.woff2?v=a0d054c4af") format("woff2");
}

:root {
  --charcoal: #131515;
  --charcoal-2: #1f2121;
  --slate: #4c5158;
  --grey-200: #c8cccf;
  --grey-100: #f5f6f7;
  --white: #ffffff;
  --mint: #007d54;
  --mint-light: #5cdbbe;
  --mint-wash: #d4f5ea;
  --teal: #0a95e6;
  --navy: #004395;
  --sky-wash: #e8f6fe;
  --orange-ink: #8a4300;
  --orange-wash: #ffebd6;
  --radius: 8px;
  --shadow: 0 2px 15px rgba(0, 67, 149, 0.08);
  --font-body: "Inter", Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", Helvetica, Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--charcoal);
  background: var(--white);
}

a {
  color: var(--navy);
}

a:hover {
  color: var(--mint);
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 16px;
  background: var(--charcoal);
  color: var(--white);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 16px;
  color: var(--white);
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.4s ease-in-out, color 0.4s ease-in-out, border-color 0.4s ease-in-out;
}

.btn-primary {
  background: var(--charcoal);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--mint);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  border-color: var(--charcoal);
  color: var(--charcoal);
}

.btn-secondary:hover {
  border-color: var(--mint);
  color: var(--mint);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: var(--mint);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--grey-100);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.logo {
  display: inline-flex;
}

.logo img {
  display: block;
  height: 26px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a:not(.btn) {
  color: var(--charcoal);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}

.header-nav a:not(.btn):hover {
  color: var(--mint);
}

/* Hero */

.hero {
  padding: 64px 0 48px;
  background: linear-gradient(180deg, var(--white) 0%, var(--grey-100) 100%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mint);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 680px;
  margin: 0 0 24px;
  color: var(--slate);
  font-size: 18px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: var(--slate);
}

.stats strong {
  color: var(--charcoal);
  font-family: var(--font-display);
  font-size: 22px;
}

.feeds {
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--slate);
}

.search input {
  width: 100%;
  max-width: 720px;
  height: 56px;
  padding: 0 20px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 17px;
  color: var(--charcoal);
}

.search input:focus {
  border-color: var(--charcoal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 149, 230, 0.35);
}

.no-js .search,
.no-js .filters-panel,
.no-js .js-only,
.no-js .sort {
  display: none;
}

/* Library layout */

.library {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 80px;
}

/* The sidebar scrolls on desktop, and a scroll container clips at its padding edge, which cut off the radio
   buttons and every focus ring along its left edge. Pad it by the focus ring's reach (3px outline + 2px offset)
   and pull it back with negative margins so it still lines up with the results. */
.filters {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  margin: -5px 0 -5px -5px;
  padding: 5px 8px 5px 5px;
  scroll-padding-block: 5px;
}

.filters-panel {
  position: relative;
}

.filters-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  list-style: none;
  cursor: pointer;
}

.filters-head::-webkit-details-marker {
  display: none;
}

.filters-head::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-right: 2px solid var(--charcoal);
  border-bottom: 2px solid var(--charcoal);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}

.filters-panel:not([open]) .filters-head::after {
  transform: rotate(-45deg);
}

.filters-panel:not([open]) .filters-head {
  padding-bottom: 0;
}

.filters-panel .js-clear {
  position: absolute;
  top: 4px;
  right: 0;
}

.filters-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}

.facet {
  margin: 0;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--grey-100);
}

/* A floated legend sits inside the fieldset instead of on its border; clear it so options start below. */
.facet legend + * {
  clear: both;
}

.facet legend {
  float: left;
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.facet-search {
  width: 100%;
  height: 36px;
  margin-bottom: 8px;
  padding: 0 10px;
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  font: inherit;
  font-size: 14px;
}

/* A scroll container clips at its padding edge, which cut off the checkboxes and their focus ring (3px outline +
   2px offset). Pad the list by that much and pull it back with a negative margin so it still lines up with the
   other facets; the right padding keeps the counts off the scrollbar. */
.facet-list .facet-options {
  max-height: 260px;
  overflow-y: auto;
  margin: 0 -5px 0 -5px;
  padding: 5px 10px 5px 5px;
  /* Keeps the focus ring of an option scrolled into view by keyboard focus inside the clip region too. */
  scroll-padding-block: 5px;
}

.option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  cursor: pointer;
}

.option input {
  margin: 0;
  accent-color: var(--mint);
}

.option span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-count {
  color: var(--slate);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.results:focus {
  outline: none;
}

/* Loading overlay over the package list. It fades in after a short delay so quick filter changes never
   flicker; the initial load shows it straight away. Only applies when JS runs. */
.results {
  position: relative;
}

.results::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.results-loading {
  display: none;
}

.js .results.is-loading::before {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.12s;
}

.js .results.is-loading.is-initial::before {
  transition: none;
}

.js .results.is-loading .results-loading {
  display: flex;
  position: sticky;
  top: 50vh;
  z-index: 3;
  justify-content: center;
  height: 0;
  animation: show-loading 0.15s ease 0.12s both;
}

.js .results.is-loading.is-initial .results-loading {
  animation: none;
}

.spinner {
  width: 40px;
  height: 40px;
  margin-top: 24px;
  border: 3px solid var(--grey-200);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes show-loading {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.result-count {
  margin: 0;
  font-weight: 500;
  color: var(--slate);
}

.sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.sort select {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  background: var(--white);
  font: inherit;
  font-size: 14px;
}

/* Package cards */

.package-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.package {
  border: 1px solid var(--grey-100);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  scroll-margin-top: 96px;
}

.package:hover {
  border-color: var(--grey-200);
  box-shadow: var(--shadow);
}

.package:target {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-wash);
}

/* The card itself is the <summary> of a <details>; expanding it shows the version list. */
.package-summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  list-style: none;
  cursor: pointer;
  border-radius: var(--radius);
}

.package-summary::-webkit-details-marker {
  display: none;
}

.package-summary:focus-visible {
  outline-offset: -3px;
}

.package-body {
  display: block;
  min-width: 0;
}

.package-icon {
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--grey-100);
  overflow: hidden;
}

.package-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.package-name {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
}

.package-summary:hover .package-name {
  color: var(--mint);
}

/* Every meta item gets a leading dot, and the list is shifted left by one dot's width inside a clipping
   wrapper, so the dot on whichever item starts a line is hidden. Wrapped lines never begin with a stray "·". */
.package-meta-wrap {
  display: block;
  margin: 0 0 8px;
  overflow: hidden;
}

.package-meta {
  display: flex;
  flex-wrap: wrap;
  row-gap: 2px;
  margin-left: -20px;
  font-size: 13px;
  color: var(--slate);
}

.package-meta span::before {
  content: "\00b7";
  display: inline-block;
  width: 20px;
  text-align: center;
}

.package-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  color: var(--slate);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow-wrap: anywhere;
}

.package-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-connect {
  background: var(--sky-wash);
  color: var(--navy);
}

.badge-deploy {
  background: var(--mint-wash);
  color: var(--mint);
}

.badge-both {
  background: var(--charcoal);
  color: var(--white);
}

.badge-paid {
  background: var(--orange-wash);
  color: var(--orange-ink);
}

.badge-free {
  border: 1px solid var(--grey-200);
  color: var(--slate);
}

.package-updated {
  font-size: 12px;
  color: var(--slate);
  white-space: nowrap;
}

.package-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
}

.package-toggle .chevron {
  transition: transform 0.2s ease;
}

.package-details[open] .package-toggle .chevron {
  transform: rotate(180deg);
}

/* Labeled fields on the collapsed card: one line each, truncated. */
.package-fields {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
}

.field-value {
  overflow: hidden;
  color: var(--slate);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The expanded view lists every field, so drop the truncated preview to avoid showing them twice. */
.package-details[open] .package-fields,
.package-details[open] .package-description {
  display: none;
}

/* Expanded card: every field, then the versions. */
.package-expanded {
  margin: 0 20px 20px 84px;
  padding-top: 16px;
  border-top: 1px solid var(--grey-100);
}

.package-info {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 14px;
}

.package-info div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}

.package-info dt {
  font-weight: 600;
  color: var(--charcoal);
}

.package-info dd {
  margin: 0;
  color: var(--slate);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.package-description-full {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--slate);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.package-versions-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 15px;
}

.package-versions {
  overflow-x: auto;
}

.package-versions table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.package-versions th,
.package-versions td {
  padding: 10px 12px 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--grey-100);
  white-space: nowrap;
}

.package-versions th {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.package-versions td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.package-versions tbody tr:first-child td:first-child::after {
  content: "Latest";
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--mint-wash);
  color: var(--mint);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
}

/* Resources */

.resources {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--grey-100);
  border-radius: var(--radius);
  background: var(--white);
}

.resources h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 20px;
}

.resources ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.resources a,
.resource-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--charcoal);
  font: inherit;
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.resources a:hover,
.resource-button:hover {
  color: var(--mint);
}

.resources .icon {
  flex: none;
  color: var(--slate);
}

.resources a:hover .icon,
.resource-button:hover .icon {
  color: var(--mint);
}

.resources-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--mint);
}

.resources-status:empty {
  display: none;
}

.no-results {
  padding: 48px 24px;
  border: 1px dashed var(--grey-200);
  border-radius: var(--radius);
  text-align: center;
}

.no-results-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

/* Footer */

.site-footer {
  padding: 48px 0;
  background: var(--charcoal);
  color: rgba(255, 255, 255, 0.85);
}

.footer-inner {
  display: grid;
  gap: 24px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 15px;
}

.footer-nav a:hover {
  color: var(--mint-light);
}

.footer-meta {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
}

/* Responsive */

@media (max-width: 960px) {
  .library {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .filters {
    position: static;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  /* Resources and Filters stack as two sibling cards rather than one card nested in another. */
  .filters-panel {
    padding: 16px 20px;
    border: 1px solid var(--grey-100);
    border-radius: var(--radius);
    background: var(--white);
  }

  .filters-panel .js-clear {
    top: 20px;
    right: 20px;
  }

  .facet-list .facet-options {
    max-height: 200px;
  }
}

@media (max-width: 640px) {
  .header-nav a:not(.btn) {
    display: none;
  }

  .hero {
    padding: 40px 0 32px;
  }

  /* Icon sits beside the name and meta only; fields, description, and badges use the card's full width
     instead of a narrow column indented past the icon. */
  .package-summary {
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 8px;
    padding: 16px;
  }

  .package-body {
    display: contents;
  }

  .package-icon {
    grid-row: span 2;
  }

  .package-name,
  .package-meta-wrap {
    grid-column: 2;
    margin: 0;
  }

  .package-fields,
  .package-description {
    grid-column: 1 / -1;
  }

  .package-expanded {
    margin: 0 16px 16px;
  }

  /* Collapsed fields keep label and value on one line now that they have the full width. */
  .field {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
  }

  .package-info div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .package-icon {
    width: 40px;
    height: 40px;
  }

  .package-icon img {
    width: 32px;
    height: 32px;
  }

  .package-badges {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .results-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Stack each version instead of a three-column table that scrolls sideways on phones:
     version (with the Latest tag) and date on one line, availability underneath. */
  .package-versions {
    overflow-x: visible;
  }

  .package-versions thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .package-versions tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--grey-100);
  }

  .package-versions th,
  .package-versions td {
    padding: 0;
    border: 0;
  }

  .package-versions td:nth-child(2) {
    color: var(--slate);
    font-size: 13px;
  }

  .package-versions td:nth-child(3) {
    grid-column: 1 / -1;
    color: var(--slate);
    font-size: 13px;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  /* Keep a visible loading indicator, just without the spin. */
  .spinner {
    animation: none;
    border-color: var(--mint);
  }
}
