/* Tbox-inspired portal skin: original colors, assets, and copy retained. */
:root {
  --navy: #101126;
  --ink: #273043;
  --muted: #7c8492;
  --coral: #e85c63;
  --coral-soft: #fff0f0;
  --line: rgba(31, 39, 63, .1);
  --paper: #0a0b1d;
  --white: rgba(255, 255, 255, .95);
}

html {
  min-width: 320px;
  background: #0a0b1d;
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 18% 16%, rgba(81, 91, 172, .2) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 10%, rgba(255, 255, 255, .4) 0 1px, transparent 2px),
    radial-gradient(circle at 42% 60%, rgba(255, 255, 255, .26) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 74%, rgba(120, 135, 221, .25) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(8, 9, 27, .72) 0%, rgba(17, 20, 45, .66) 56%, rgba(10, 11, 29, .8) 100%),
    url("./assets/atlas-night-sky.png") center top / cover fixed no-repeat;
  background-size: 170px 170px, 230px 230px, 310px 310px, 260px 260px, auto;
  background-attachment: fixed;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 12px 26px;
}

.site-header {
  display: none;
}

.portal-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.category-panel {
  position: sticky;
  top: 14px;
  margin-top: 440px;
  min-height: calc(100vh - 28px);
  padding: 14px 10px 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .24);
}

/* Match the content baseline; the earlier layout layer has a more specific
   selector, so repeat the margin at the same specificity here. */
.portal-grid > .category-panel {
  margin-top: 440px;
}

.panel-heading {
  padding: 0 8px;
  margin-bottom: 12px;
  color: #293145;
  font-size: 16px;
}

.count,
.list-status {
  color: #858c99;
}

.category-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid #dae0e8;
  border-radius: 9px;
  color: #263b65;
}

.category {
  height: 42px;
  padding: 0 10px 0 12px;
  border-radius: 7px;
  color: #677184;
  font-size: 13px;
}

.category .cat-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #eef2f8;
  color: #3e5b8e;
  font-size: 13px;
}

.category:hover {
  background: #f2f5fa;
  color: #243c6d;
}

.category.is-active {
  background: #fff0f0;
  color: #253c68;
}

.category.is-active:before {
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--coral);
}

.category.is-active .cat-icon {
  background: var(--coral);
}

.category-divider {
  margin: 14px 8px 12px;
  border-color: #e5e8ee;
}

.category-note {
  padding: 0 8px;
  color: #8b929e;
  font-size: 11px;
}

.main-column {
  min-width: 0;
}

.hero {
  min-height: 0;
  margin: 0;
  padding: 190px 20px 45px;
  overflow: visible;
  background: transparent;
}

.hero:after {
  display: none;
}

.hero-overlay {
  display: none;
}

.search-tabs {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin: 0 auto 12px;
  color: rgba(255, 255, 255, .74);
}

.search-tab {
  position: relative;
  padding: 6px 0 9px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.search-tab:after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 4px;
  background: transparent;
}

.search-tab:hover,
.search-tab.is-active {
  color: #fff;
}

.search-tab.is-active:after {
  background: #fff;
}

.search-form {
  width: min(820px, 100%);
  height: 50px;
  margin: 0 auto;
  border: 4px solid rgba(255, 255, 255, .88);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}

.search-form input {
  padding: 0 16px;
  font-size: 14px;
}

.search-form button {
  min-width: 50px;
  padding: 0 16px;
  border-radius: 7px;
  background: var(--coral);
  font-size: 0;
}

.search-form button:after {
  content: "⌕";
  font-size: 22px;
  line-height: 1;
}

.search-providers {
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  color: rgba(255, 255, 255, .56);
}

.provider-label,
.search-hint {
  display: none;
}

.provider {
  padding: 4px 7px;
  color: rgba(255, 255, 255, .7);
  font-size: 12px;
}

.provider.is-active,
.provider:hover {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.quick-links,
.tool-panel,
.category-strip {
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 11px;
  background: var(--white);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .14);
}

.quick-links {
  height: 58px;
  gap: 18px;
  margin: 0 0 14px;
  padding: 0 18px;
}

.quick-links a:hover {
  color: var(--coral);
}

.tool-panel {
  padding: 16px 16px 22px;
}

.section-bar {
  align-items: center;
  margin-bottom: 13px;
}

.section-kicker {
  color: var(--coral);
  font-size: 10px;
}

.section-bar h2,
.category-strip h2 {
  color: #263145;
  font-size: 18px;
}

.tool-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.tool-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0 9px;
  min-height: 128px;
  padding: 12px 10px 10px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 6px 14px rgba(36, 49, 75, .06);
}

.tool-item:hover {
  transform: translateY(-2px);
  border-color: #e5b9bc;
  box-shadow: 0 10px 20px rgba(36, 49, 75, .12);
}

.tool-icon {
  grid-row: 1 / span 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ebf0fb;
  color: #36579b;
  font-size: 13px;
}

.tool-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.tool-item:nth-child(2n) .tool-icon {
  background: #fff0ef;
  color: var(--coral);
}

.tool-content {
  min-width: 0;
}

.tool-title {
  overflow: hidden;
  margin: 2px 0 4px;
  color: #30384a;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-description {
  display: -webkit-box;
  overflow: hidden;
  color: #8a919d;
  font-size: 11px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tool-meta {
  grid-column: 1 / -1;
  align-self: end;
  gap: 4px;
  margin-top: 8px;
  overflow: hidden;
  flex-wrap: nowrap;
}

.tag {
  overflow: hidden;
  padding: 3px 5px;
  border-radius: 4px;
  color: #71809b;
  background: #f0f3f7;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.internal {
  color: var(--coral);
  background: #fff0ef;
}

.tool-arrow {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: #a9b0bd;
  font-size: 13px;
}

.category-strip {
  margin-top: 14px;
  padding: 18px;
}

.category-chips a {
  padding: 8px 12px;
  border-color: #e4e8ef;
  color: #526382;
  background: #f7f9fb;
  font-size: 11px;
}

.site-footer {
  border-top: 0;
  color: rgba(255, 255, 255, .6);
}

.site-footer span:first-child {
  color: #fff;
}

/* Desktop geometry aligned to the reference portal's content rhythm. */
.page-shell {
  padding-left: 10px;
  padding-right: 10px;
}

.portal-grid {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 15px;
}

.portal-grid > .category-panel {
  margin-top: 300px;
  min-height: 392px;
  padding: 10px;
}

.hero {
  padding: 32px 20px 65.5px;
}

.portal-grid > .main-column > .hero {
  width: calc(100% + 235px);
  margin-left: -235px;
}

.search-form {
  width: min(800px, 100%);
  max-width: 800px;
}

.search-tabs,
.search-form,
.search-providers {
  transform: translateX(-4px);
}

.portal-grid > .main-column > .tool-panel {
  min-height: 525px;
  padding: 11px 5px 12px 11px;
}

.section-bar {
  height: 19px;
  margin-bottom: 8px;
}

.section-bar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-bar h2 {
  margin: 0;
  font-size: 14px;
  line-height: 19px;
}

.section-kicker {
  display: none;
}

.tool-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 17px;
  max-width: 945px;
}

.tool-item {
  grid-template-columns: 77px minmax(0, 1fr);
  grid-template-rows: 74px 32px;
  width: 100%;
  height: 106px;
  min-height: 106px;
  padding: 0;
  gap: 0;
  border-radius: 8px;
}

.tool-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 63px;
  height: 63px;
  margin: 7.5px;
  border-radius: 50%;
}

.tool-content {
  grid-column: 2;
  grid-row: 1;
  padding-top: 19px;
}

.tool-title {
  margin: 0;
  font-size: 11px;
  line-height: 16px;
}

.tool-description {
  font-size: 9px;
  line-height: 13px;
  -webkit-line-clamp: 3;
}

.tool-meta {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 34px;
  margin: 0;
  margin-left: -1px;
  padding: 5px 10px 10px;
  width: calc(100% + 2px);
  align-self: stretch;
  flex-wrap: nowrap;
}

.tool-arrow {
  right: 10px;
  bottom: 7px;
  width: 16px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid #ccd1d6;
  border-radius: 50%;
  font-size: 11px;
  color: #9aa1a8;
}

.tool-meta .tag {
  font-size: 8.5px;
}

@media (max-width: 760px) {
  .tool-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .portal-grid {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .tool-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-tabs {
    gap: 15px;
  }

  .portal-grid > .main-column > .hero {
    width: calc(100% + 220px);
    margin-left: -220px;
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding: 0 8px 18px;
  }

  .portal-grid {
    display: block;
    margin-top: 8px;
  }

  .category-panel {
    position: relative;
    top: auto;
    margin-top: 0;
    min-height: 0;
    margin-bottom: 8px;
  }

  .portal-grid > .category-panel {
    margin-top: 0;
    min-height: 0;
    padding: 18px 16px;
  }

  .category-panel nav {
    display: flex;
    overflow-x: auto;
  }

  .category {
    flex: 0 0 auto;
    width: auto;
  }

  .category-divider,
  .category-note {
    display: none;
  }

  .hero {
    padding: 34px 8px 18px;
  }

  .portal-grid > .main-column > .hero {
    width: auto;
    margin-left: 0;
  }

  .search-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    gap: 20px;
    white-space: nowrap;
  }

  .search-tabs,
  .search-form,
  .search-providers {
    transform: none;
  }

  .quick-links {
    overflow-x: auto;
  }

  .tool-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 450px) {
  .tool-list {
    grid-template-columns: 1fr;
  }
}

/* The legacy layout layer restores counts and footer copy; keep the collapsed
   desktop rail icon-only until the pointer enters it. */
@media (min-width: 681px) {
  .portal-grid.sidebar-collapsed > .category-panel .category i,
  .portal-grid.sidebar-collapsed > .category-panel .category-divider,
  .portal-grid.sidebar-collapsed > .category-panel .category-note {
    display: none;
  }

  .portal-grid.sidebar-collapsed > .category-panel:hover .category i,
  .portal-grid.sidebar-collapsed > .category-panel:hover .category-divider,
  .portal-grid.sidebar-collapsed > .category-panel:hover .category-note {
    display: block;
  }
}
