/* packages.polyth.app — loaded after site.css and built only from its tokens.
   The catalog is a sibling of polyth.app: same type, palette and chrome,
   with a denser, scannable layout for browsing many small things. */

/* ---- chrome ---------------------------------------------------------------- */

.brand-suffix { margin-left: -2px; color: var(--ink-3); font-weight: 500; letter-spacing: -0.02em; }

.header-actions { gap: 8px; }
.main-link { gap: 4px; }
.main-link .icon { width: 15px; height: 15px; }

.address-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  min-height: 34px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(50, 45, 41, 0.06);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.address-chip::before { content: ""; position: absolute; inset: -5px 0; }
.address-chip:hover { background: rgba(50, 45, 41, 0.1); color: var(--ink); }
.address-chip-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.address-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--taupe); }
.address-chip.is-set .address-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-wash); }
.address-chip[hidden], .menu-address[hidden] { display: none; }

.menu-address {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: none;
  color: var(--ink-2);
  font-size: 17px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.menu-address .address-dot { width: 9px; height: 9px; }
.menu-address.is-set .address-dot { background: var(--ok); }

@media (max-width: 900px) {
  .main-link { display: none; }
  .nav + .header-actions { margin-left: auto; }
}
@media (max-width: 734px) {
  .header-actions .address-chip { display: none; }
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--wine);
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}
.link-btn .icon { width: 16px; height: 16px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn[hidden] { display: none; }

.btn-lg { width: 100%; min-height: 54px; font-size: 18px; }

/* ---- badges -------------------------------------------------------------- */

.badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.badges:empty { display: none; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(50, 45, 41, 0.06);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge-plain { padding: 0; background: none; }
.badge-core { background: var(--espresso); color: var(--cream); }
.badge-beta { background: var(--wait-wash); color: var(--wait); }
.badge-off { background: transparent; box-shadow: inset 0 0 0 1px var(--hair-strong); }
.badge-community { background: var(--accent-wash); color: var(--wine); }

/* ---- catalog hero ---------------------------------------------------------- */

.cat-hero { padding: clamp(40px, 6vw, 88px) 0 clamp(36px, 4.5vw, 64px); }
.cat-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.cat-hero .display { max-width: 13ch; font-size: clamp(40px, 5.2vw, 78px); }
.cat-hero .display span { display: block; color: var(--wine); }
.cat-hero .subhead { max-width: 600px; }
.cat-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 15px;
}
.cat-stats li + li::before { content: "·"; margin: 0 12px; color: var(--taupe); }
@media (max-width: 480px) { .cat-stats { gap: 4px 18px; font-size: 14px; } .cat-stats li + li::before { display: none; } }
.cat-stats strong { margin-inline: 2px; color: var(--ink); font-weight: 650; font-feature-settings: "tnum"; }

/* Decorative: every package's icon as a tile, in its default state. */
.icon-wall {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: clamp(8px, 0.8vw, 12px);
  max-height: clamp(380px, 36vw, 520px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 98%), linear-gradient(to right, transparent, #000 30%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, #000 62%, transparent 98%), linear-gradient(to right, transparent, #000 30%);
  mask-composite: intersect;
}
.iw {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 28%;
  background: var(--card);
  color: var(--wine);
  box-shadow: 0 1px 2px rgba(50, 45, 41, 0.06), inset 0 0 0 1px var(--hair);
}
.iw .icon { width: 44%; height: 44%; }
.iw:nth-child(3n) { background: var(--tile); box-shadow: none; }
.iw-core, .iw-core:nth-child(3n) { background: var(--espresso); color: var(--cream); box-shadow: none; }
.iw-off, .iw-off:nth-child(3n) { background: transparent; color: var(--taupe); box-shadow: inset 0 0 0 1px var(--hair-strong); }
.cat-hero-figure { display: grid; gap: 16px; margin: 0; }
.iw-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 18px; color: var(--ink-3); font-size: 13.5px; }
.iw-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.iw-legend .iw-legend-title { color: var(--ink-2); font-weight: 600; }
/* Each key is a tiny tile: its fill and its icon colour (the dot) match the wall. */
.iw-key { width: 16px; height: 16px; flex: none; border-radius: 5px; background: radial-gradient(circle, var(--wine) 0 2.5px, transparent 3px), var(--card); box-shadow: inset 0 0 0 1px var(--hair-strong); }
.iw-key-core { background: radial-gradient(circle, var(--cream) 0 2.5px, transparent 3px), var(--espresso); box-shadow: none; }
.iw-key-off { background: radial-gradient(circle, var(--taupe) 0 2.5px, transparent 3px); }
@media (max-width: 1068px) {
  .cat-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .cat-hero-figure { display: none; }
}
.cat-stats a { color: var(--wine); font-weight: 550; text-underline-offset: 3px; }
@media (max-width: 734px) {
  .cat-hero { padding: 28px 0 24px; }
  .cat-hero .display { font-size: clamp(34px, 9.4vw, 40px); }
  .cat-hero .subhead { font-size: 17px; }
  .cat-stats { margin-top: 18px; }
}

/* ---- catalog layout ----------------------------------------------------------- */

.catalog { padding-bottom: clamp(72px, 9vw, 128px); }
.catalog-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: clamp(32px, 4vw, 64px);
  align-items: start;
}
.filters-sticky {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: grid;
  gap: 18px;
  max-height: calc(100vh - var(--nav-h) - 40px);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
}
.filters-sticky::-webkit-scrollbar { display: none; }

.search { position: relative; }
.search > .icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  transform: translateY(-50%);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 44px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: -0.011em;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search input:focus-visible { border-color: var(--wine); box-shadow: 0 0 0 4px var(--accent-wash); }
.search-clear {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}
.search-clear:hover { color: var(--ink); }
.search-clear .icon { width: 18px; height: 18px; }
.search-clear[hidden] { display: none; }

.seg.kind { display: flex; width: 100%; }
.seg.kind button { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 10px; font-size: 13.5px; }

.filters-label { margin-bottom: 6px; padding-left: 12px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.shelf-nav ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.shelf-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.shelf-nav a:hover { background: rgba(50, 45, 41, 0.05); color: var(--ink); }
.shelf-nav a[aria-current="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(50, 45, 41, 0.14); }
.shelf-nav .n { color: var(--ink-3); font-size: 13px; font-weight: 500; font-feature-settings: "tnum"; }
.shelf-nav a.is-empty { color: var(--ink-3); }
.shelf-nav a.is-empty .n { opacity: 0.6; }

.filters-publish {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--tile);
  text-decoration: none;
  transition: background-color 0.2s var(--ease);
}
.filters-publish:hover { background: var(--tile-deep); }
.filters-publish strong { font-size: 15px; font-weight: 650; }
.filters-publish span { display: inline-flex; align-items: center; gap: 4px; color: var(--wine); font-size: 14px; font-weight: 500; }
.filters-publish .icon { width: 15px; height: 15px; }

/* ---- results ------------------------------------------------------------------- */

.results-status { min-height: 48px; display: flex; align-items: center; color: var(--ink-3); font-size: 15px; }
.shelf { scroll-margin-top: calc(var(--nav-h) + 20px); }
.shelf { margin-bottom: clamp(44px, 5vw, 64px); }
.shelf[hidden] { display: none; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.shelf-head h2 { font-size: clamp(22px, 2vw, 26px); font-weight: 650; letter-spacing: -0.024em; }
.shelf-head p { color: var(--ink-3); font-size: 15px; }

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pkg-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "icon name name"
    "desc desc desc"
    "badges badges get";
  gap: 12px 14px;
  padding: 18px 18px 16px;
  border-radius: var(--r);
  background: var(--card);
  outline: 1px solid var(--hair);
  transition: box-shadow 0.25s var(--ease), outline-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.pkg-card[hidden] { display: none; }
.pkg-card:hover { outline-color: var(--hair-strong); box-shadow: var(--shadow-soft); transform: translateY(-2px); }
.pkg-card:has(.pkg-card-link:focus-visible) { outline: 2px solid var(--wine); outline-offset: 2px; }
.pkg-card-body { display: contents; }
.pkg-card-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tile);
  color: var(--wine);
}
.pkg-card-icon .icon { width: 22px; height: 22px; }
.pkg-card h3 { grid-area: name; align-self: center; min-width: 0; font-size: 17px; font-weight: 620; line-height: 1.25; letter-spacing: -0.018em; }
.pkg-card-link { text-decoration: none; }
.pkg-card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.pkg-card-link:focus-visible { outline: 0; }
.pkg-card-desc {
  grid-area: desc;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}
.pkg-card .badges { grid-area: badges; align-self: center; }
.get {
  grid-area: get;
  position: relative;
  z-index: 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 72px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--wine);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.get::before { content: ""; position: absolute; inset: -5px -4px; }
.get:hover { background: var(--wine); color: #fbf6f2; }

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(48px, 7vw, 88px) 24px;
  border-radius: var(--r-lg);
  background: var(--card);
  outline: 1px dashed var(--hair-strong);
  text-align: center;
}
.empty[hidden] { display: none; }
.empty-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 6px; border-radius: 50%; background: var(--tile); color: var(--wine); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h2 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 650; letter-spacing: -0.024em; }
.empty p { max-width: 46ch; color: var(--ink-2); font-size: 16px; }
.empty .actions, .empty .btn { margin-top: 14px; }
.empty .actions .btn { margin-top: 0; }

/* Community band: an empty shelf, shown as a stack of listings to come. */
.community-band { overflow: hidden; overflow: clip; }
.community-band .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
.ghost-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-areas: "icon body" "get get";
  gap: 16px;
  max-width: 420px;
  margin-inline: auto;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.ghost-card::before, .ghost-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--card);
  outline: 1px dashed var(--hair-strong);
}
.ghost-card::before { transform: translate(18px, 16px) rotate(3deg); opacity: 0.7; }
.ghost-card::after { transform: translate(34px, 30px) rotate(6deg); opacity: 0.4; }
.ghost-card .pkg-card-icon { width: 52px; height: 52px; border-radius: 14px; }
.ghost-card .pkg-card-icon .icon { width: 26px; height: 26px; }
.ghost-card .pkg-card-body { grid-area: body; display: grid; gap: 9px; align-content: start; }
.ghost-card strong { font: 600 17px/1.3 var(--mono); letter-spacing: -0.02em; }
.ghost-line { display: block; height: 9px; border-radius: 99px; background: var(--mist); }
.ghost-line.short { width: 62%; }
.ghost-card .badges { margin-top: 6px; }
.ghost-card .get { grid-area: get; justify-self: end; z-index: 0; }
.ghost-card .get:hover { background: var(--accent-wash); color: var(--wine); }
.ghost-card .badge:not(.badge-community) { background: var(--ok-wash); color: var(--ok); }

/* Narrow screens: the filter column dissolves into the catalog grid, so the
   shelf chips can stick under the header for the whole list (no JS needed:
   without catalog.js each chip is a plain jump link to its shelf). */
@media (max-width: 1068px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .filters, .filters-sticky { display: contents; }
  .search { grid-column: 1; }
  .seg.kind { grid-column: 2; width: auto; }
  .seg.kind button { flex: none; padding: 0 16px; }
  .filters-label, .filters-publish { display: none; }
  .results { grid-column: 1 / -1; }
  .shelf-nav {
    position: sticky;
    top: var(--nav-h);
    z-index: 5;
    grid-column: 1 / -1;
    min-width: 0;
    margin: -4px calc(-1 * var(--gutter)) 0;
    padding: 8px 0;
    background: rgba(248, 245, 240, 0.94);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    box-shadow: 0 1px 0 var(--hair);
  }
  .shelf { scroll-margin-top: calc(var(--nav-h) + 76px); }
  .shelf-nav ul {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 2px var(--gutter);
    overflow-x: auto;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .shelf-nav ul::-webkit-scrollbar { display: none; }
  .shelf-nav li { flex: none; }
  .shelf-nav a { gap: 8px; padding: 0 16px; border-radius: 999px; background: var(--card); outline: 1px solid var(--hair); white-space: nowrap; }
  .shelf-nav a[aria-current="true"] { background: var(--espresso); color: var(--cream); outline-color: var(--espresso); box-shadow: none; }
  .shelf-nav a[aria-current="true"] .n { color: var(--greige); }
  .community-band .split { grid-template-columns: minmax(0, 1fr); }
  .ghost-card { margin: 8px auto 32px; }
}

/* Phones: each shelf is one grouped list of compact rows (about half the
   height of a card), so 72 packages stay scannable in one column. */
@media (max-width: 734px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .seg.kind { grid-column: 1; width: 100%; }
  .seg.kind button { flex: 1 1 0; padding: 0 6px; }
  .shelf { margin-bottom: 32px; }
  .shelf-head { display: block; margin-bottom: 12px; padding-bottom: 0; border-bottom: 0; }
  .shelf-head h2 { font-size: 21px; }
  .shelf-head p { margin-top: 2px; font-size: 14.5px; }
  .pkg-grid { gap: 0; overflow: hidden; border-radius: var(--r); background: var(--card); outline: 1px solid var(--hair); }
  .pkg-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    /* min-content: auto rows would share out the spanning icon and button
       heights and leave a gap under rows without badges. */
    grid-template-rows: min-content min-content min-content;
    grid-template-areas:
      "icon name get"
      "icon desc get"
      "icon badges get";
    gap: 2px 12px;
    padding: 13px 14px;
    border-radius: 0;
    background: none;
    outline: 0;
  }
  .pkg-card:not([hidden]) ~ .pkg-card { border-top: 1px solid var(--hair); }
  .pkg-card:hover { box-shadow: none; transform: none; background: rgba(50, 45, 41, 0.03); }
  .pkg-card:has(.pkg-card-link:focus-visible) { outline-offset: -2px; }
  .pkg-card-icon { align-self: start; width: 40px; height: 40px; border-radius: 11px; }
  .pkg-card-icon .icon { width: 20px; height: 20px; }
  .pkg-card h3 { align-self: end; font-size: 16px; }
  .pkg-card-desc { font-size: 14px; line-height: 1.4; -webkit-line-clamp: 2; line-clamp: 2; }
  .pkg-card .badges { margin-top: 5px; gap: 4px; }
  .pkg-card .badge { min-height: 20px; padding: 0 7px; font-size: 11.5px; }
  .pkg-card .get { min-width: 0; padding: 0 14px; }
}

/* ---- package page ---------------------------------------------------------------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; padding-top: 12px; color: var(--ink-3); font-size: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .icon { width: 16px; height: 16px; margin-left: -4px; }

.pkg-top {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  padding: clamp(20px, 3vw, 40px) 0 clamp(80px, 10vw, 140px);
}
.pkg-hero-icon {
  display: grid;
  place-items: center;
  width: clamp(76px, 7vw, 96px);
  height: clamp(76px, 7vw, 96px);
  margin-bottom: clamp(20px, 2.4vw, 32px);
  border-radius: 24px;
  background: linear-gradient(160deg, var(--cream), var(--tile-deep));
  color: var(--wine);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.pkg-hero-icon .icon { width: 46%; height: 46%; }
.pkg-hero .headline { overflow-wrap: anywhere; }
.pkg-hero .subhead { max-width: 640px; }
.pkg-hero .badges { margin-top: 24px; }
.pkg-hero .badge { min-height: 26px; padding: 0 11px; font-size: 13px; }
.pkg-hero .badge-plain { padding: 0 6px 0 0; }

.install-panel {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  padding: clamp(24px, 2.6vw, 34px);
  border-radius: var(--r-lg);
  background: var(--card);
  outline: 1px solid var(--hair);
  box-shadow: var(--shadow-soft);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.install-panel h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.024em; }
.install-lede { margin-top: 8px; color: var(--ink-2); font-size: 16px; }
.install-action { margin-top: 22px; }
.install-target { margin-top: 6px; color: var(--ink-3); font-size: 14px; text-align: center; }
.install-target b { color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }
.install-target .link-btn { font-size: 14px; }
.install-target[hidden] { display: none; }
.install-sub { margin-top: 26px; color: var(--ink); font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.install-steps { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: istep; }
.install-steps li { position: relative; padding-left: 36px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.install-steps li::before {
  counter-increment: istep;
  content: counter(istep);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tile);
  color: var(--wine);
  font-size: 12.5px;
  font-weight: 700;
}
.install-steps b, .install-manual b { color: var(--ink); font-weight: 600; }
.install-manual { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--hair); }
.install-manual p { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.install-manual .code { margin-top: 10px; }
.install-manual .code pre { padding-right: 88px; white-space: pre-wrap; word-break: break-all; }
.install-nopolyth { font-size: 14px !important; color: var(--ink-3) !important; }
.install-nopolyth a, .details-text a, .facts a, .source-link a { color: var(--wine); text-underline-offset: 3px; }
.install-panel:target { outline: 2px solid var(--wine); }

.pkg-main { min-width: 0; }
.pkg-details { display: grid; gap: clamp(40px, 4.5vw, 56px); margin-top: clamp(40px, 5vw, 64px); }
.details-title { margin-bottom: 14px; font-size: 22px; font-weight: 650; letter-spacing: -0.024em; }
.details-text { color: var(--ink-2); font-size: 16px; }
.details-text + .details-text, .details-text + .source-link { margin-top: 12px; }
.pkg-details .more, .pkg-details .btn { margin-top: 18px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 0; }
.facts div { padding: 14px 0; border-top: 1px solid var(--hair); }
.facts dt { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.facts dd { margin: 3px 0 0; font-size: 16px; overflow-wrap: anywhere; }
.source-link a { font: 500 14px/1.6 var(--mono); word-break: break-all; }
.perm-list { display: grid; margin: 16px 0 0; padding: 0; list-style: none; }
.perm-list li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); font-size: 16px; }
.perm-list .icon { width: 20px; height: 20px; margin-top: 2px; color: var(--wine); }
.related { display: grid; margin: 0; padding: 0; list-style: none; }
.related a { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 44px; padding: 12px 0; border-top: 1px solid var(--hair); text-decoration: none; }
.related .pkg-card-icon { grid-area: auto; }
.related-text { display: grid; gap: 2px; min-width: 0; }
.related-text strong { font-size: 16px; font-weight: 620; letter-spacing: -0.016em; }
.related-text span { overflow: hidden; color: var(--ink-2); font-size: 14.5px; white-space: nowrap; text-overflow: ellipsis; }
.related a:hover strong { color: var(--wine); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1068px) {
  .pkg-top { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pkg-main { display: contents; }
  .install-panel { position: static; margin-top: 32px; }
  .pkg-details { order: 1; }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
}

/* ---- documents (rules, terms) and publish ------------------------------------------ */

.doc-hero { text-align: left; padding-bottom: clamp(40px, 5vw, 72px); }
.doc-hero .display { max-width: 18ch; margin-inline: 0; font-size: clamp(40px, 5.4vw, 76px); }
.doc-hero .subhead { max-width: 720px; margin-inline: 0; }
.doc-date { margin-top: 20px; color: var(--ink-3); font-size: 15px; }

.doc {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  gap: clamp(40px, 7vw, 120px);
  align-items: start;
  padding: clamp(40px, 5vw, 64px) 0 clamp(96px, 11vw, 160px);
  border-top: 1px solid var(--hair);
}
.doc-toc { position: sticky; top: calc(var(--nav-h) + 32px); }
.doc-toc-title { margin-bottom: 8px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.doc-toc ol { margin: 0; padding: 0; list-style: none; }
.doc-toc a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding-left: 14px;
  border-left: 2px solid var(--hair);
  color: var(--ink-2);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.doc-toc a:hover { color: var(--ink); }
.doc-toc a[aria-current="true"] { border-left-color: var(--wine); color: var(--ink); font-weight: 600; }

.prose section { scroll-margin-top: calc(var(--nav-h) + 24px); }
.prose section + section { margin-top: clamp(44px, 5vw, 64px); }
.prose h2 { display: flex; align-items: baseline; gap: 14px; font-size: clamp(24px, 2.4vw, 30px); font-weight: 650; line-height: 1.2; letter-spacing: -0.026em; }
.prose .num {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--wine);
  font-size: 14px;
  font-weight: 700;
  transform: translateY(-3px);
}
.prose p, .prose ul { margin-top: 14px; color: var(--ink-2); font-size: 17px; line-height: 1.65; }
.prose ul { padding: 0; list-style: none; }
.prose li { position: relative; padding-left: 24px; }
.prose li + li { margin-top: 10px; }
.prose li::before { content: ""; position: absolute; top: 0.72em; left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--taupe); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a:not(.more) { color: var(--wine); text-underline-offset: 3px; }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px 28px; }

@media (max-width: 1068px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .doc-toc { position: static; padding: 20px 24px; border-radius: var(--r); background: var(--tile); }
  .doc-toc ol { columns: 2; column-gap: 24px; }
  .doc-toc a { min-height: 44px; border-left: 0; padding-left: 0; break-inside: avoid; }
}
@media (max-width: 520px) {
  .doc-toc ol { columns: 1; }
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(32px, 5vw, 64px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.checklist li { display: flex; gap: 16px; padding: 22px 0; border-top: 1px solid var(--hair); }
.checklist li > .icon { width: 34px; height: 34px; padding: 8px; border-radius: 50%; background: var(--ok-wash); color: var(--ok); }
.checklist h3 { font-size: 18px; font-weight: 620; letter-spacing: -0.018em; }
.checklist p { margin-top: 4px; color: var(--ink-2); font-size: 16px; }
.checklist code, .fields code, .route code { padding: 1px 6px; border-radius: 6px; background: rgba(50, 45, 41, 0.06); color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 734px) { .checklist { grid-template-columns: minmax(0, 1fr); } }

.steps.steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1068px) { .steps.steps-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .steps.steps-4 { grid-template-columns: minmax(0, 1fr); } }

.routes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.route {
  display: flex;
  flex-direction: column;
  padding: clamp(26px, 3vw, 36px);
  border-radius: var(--r-lg);
  background: var(--card);
  outline: 1px solid var(--hair);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.route-main { background: var(--tile); outline: 0; }
.route-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; border-radius: 14px; background: var(--card); color: var(--wine); box-shadow: var(--shadow-soft); }
.route:not(.route-main) .route-icon { background: var(--tile); box-shadow: none; }
.route-icon .icon { width: 24px; height: 24px; }
.route h3 { font-size: 24px; font-weight: 650; letter-spacing: -0.026em; }
.route p { margin-top: 8px; color: var(--ink-2); font-size: 16px; }
.route-actions { margin-top: auto; padding-top: 24px; }
@media (max-width: 860px) { .routes { grid-template-columns: minmax(0, 1fr); } }

.example { margin-top: clamp(32px, 4vw, 48px); }
.example figcaption { margin-bottom: 10px; color: var(--ink-3); font: 500 13.5px var(--mono); }
.example .code { margin-top: 0; }
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(32px, 5vw, 64px);
  margin: clamp(28px, 3vw, 40px) 0 0;
}
.fields div { padding: 16px 0; border-top: 1px solid var(--hair); }
.fields dd { margin: 6px 0 0; color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 734px) { .fields { grid-template-columns: minmax(0, 1fr); } }

.not-found-icon { display: grid; place-items: center; width: 80px; height: 80px; margin: 0 auto 32px; border-radius: 24px; background: var(--tile); color: var(--wine); }
.not-found-icon .icon { width: 38px; height: 38px; }
.not-found .actions { margin-top: 0; }

/* ---- "Where is your Polyth?" dialog ------------------------------------------------ */

.where {
  width: min(480px, 100vw - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(50, 45, 41, 0.08), 0 40px 100px -24px rgba(50, 45, 41, 0.55);
  overscroll-behavior: contain;
}
.where::backdrop { background: rgba(40, 36, 32, 0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.where-inner { position: relative; padding: 36px 32px 24px; }
.where-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}
.where-close:hover { background: rgba(50, 45, 41, 0.06); color: var(--ink); }
.where-close .icon { width: 20px; height: 20px; }
.where-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 18px; border-radius: 16px; background: var(--tile); color: var(--wine); }
.where-mark .icon { width: 26px; height: 26px; }
.where-title { font-size: 26px; font-weight: 650; letter-spacing: -0.028em; }
.where-lead { margin-top: 8px; color: var(--ink-2); font-size: 15.5px; }
.where-field { margin-top: 22px; }
.where-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.where-field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--hair-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: 500 17px var(--mono);
  letter-spacing: -0.01em;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.where-field input::placeholder { color: var(--taupe); opacity: 1; }
.where-field input:focus-visible { border-color: var(--wine); box-shadow: 0 0 0 4px var(--accent-wash); }
.where-field input[aria-invalid="true"] { border-color: var(--wine); }
.where-hint { margin-top: 8px; color: var(--ink-3); font-size: 13.5px; }
.where-error { color: var(--wine); font-size: 14px; font-weight: 550; }
.where-error:not(:empty) { margin-top: 6px; }
.where-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.where-actions .btn-primary { flex: 1 1 auto; }
.where-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--hair); }
.where-download { color: var(--ink-3); font-size: 14px; }
.where-download a { color: var(--wine); font-weight: 550; text-underline-offset: 3px; }
.where-status { color: var(--ok); font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.where-status:not(:empty) { margin-top: 8px; }
.where-status.is-error { color: var(--wine); }
@media (max-width: 480px) {
  .where-inner { padding: 32px 22px 18px; }
  .where-title { font-size: 23px; }
  .where-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .where[open] { animation: where-in 0.24s var(--ease); }
  .where[open]::backdrop { animation: where-fade 0.24s var(--ease); }
  @keyframes where-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
  @keyframes where-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ---- large screens ------------------------------------------------------------------ */

@media (min-width: 1441px) {
  .catalog-layout { grid-template-columns: 272px minmax(0, 1fr); }
}
