/* ==========================================================================
   site.css - project-authored chrome + directory-navigation styles.
   Loaded by base.html AFTER theme.min.css so overrides win on equal
   specificity. Scope: header/footer chrome, flash alerts, signup CTA,
   search typeahead, grid toolbar, sticky left rail, mobile offcanvas,
   back-to-top. Safe global tokens only - page bodies outside the redesign
   keep vendor defaults. Bump the ?v= query in base.html when editing.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Global tokens (conservative: rhythm + link polish only)
   -------------------------------------------------------------------------- */

:root {
  /* Shared horizontal padding for the full-width shell; the mobile sticky
     toolbar mirrors it with negative bleed margins. */
  --shell-pad: clamp(1rem, 2.5vw, 2.5rem);
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Full-width shell (YouTube-style): spans the viewport up to a 1920px cap.
   Used by the header, footer, and both directory grid pages instead of the
   vendor .container (which caps at 1140px).
   -------------------------------------------------------------------------- */

.site-shell {
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
  padding-inline: var(--shell-pad);
}

/* --------------------------------------------------------------------------
   Directory layout: fixed-width sticky rail + fluid card area.
   Replaces the old row/col-lg-3/col-lg-9 percentage split, which produced
   absurd rail widths on wide screens.
   -------------------------------------------------------------------------- */

/* Default stretch alignment is load-bearing: the rail column must be as
   tall as the card area so the sticky .app-rail inside it can travel. */
.app-layout {
  display: flex;
}

.app-layout-rail {
  flex: 0 0 260px;
  min-width: 0;
}

.app-layout-main {
  flex: 1 1 auto;
  min-width: 0;
}

@media (min-width: 992px) {
  .app-layout-main {
    border-left: 1px solid rgba(33, 50, 91, 0.1);
    padding-left: 1.5rem;
    margin-left: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

#header .navbar-nav {
  align-items: center;
  gap: 0.25rem;
}

#header .nav-link {
  font-weight: 500;
  font-size: 0.9375rem;
}

/* Nav labels must never wrap ("Log In" / "Start for Free" broke onto
   multiple lines at narrow xl widths). With nowrap the nav column's
   min-content width wins and the grid shrinks the minmax(0, 34rem)
   search column instead. */
#header .navbar-nav .nav-link,
#header .navbar-nav .btn {
  white-space: nowrap;
}

/* Header search (>=1200px): logo left, search center, nav right. The bar
   becomes a symmetric 3-column grid (1fr | search | 1fr) so the search
   column is centered on the viewport — matching the centered hero heading
   below it — instead of drifting into the flex gap. Below xl the slot is
   display:none (d-none d-xl-flex) and the grid pages fall back to their
   in-body search bar. */
@media (min-width: 1200px) {
  #header .navbar-nav-wrap {
    display: grid;
    grid-template-columns: 1fr minmax(0, 34rem) 1fr;
    align-items: center;
    column-gap: 1.5rem;
  }

  #header .navbar-brand {
    justify-self: start;
  }

  #header .navbar-collapse {
    justify-self: end;
  }
}

.site-header-search {
  justify-content: center;
  min-width: 0;
}

.site-header-search .app-search {
  width: 100%;
  max-width: 34rem;
}

/* Compact treatment for the header instance: the boxed .input-card look is
   for in-page heroes; in the chrome it reads as a plain rounded field. */
.site-header-search .input-card {
  padding: 0.125rem 0.125rem 0.125rem 0.75rem;
  box-shadow: none;
  border-radius: 2rem;
}

.site-header-search .input-card .form-control {
  padding-top: 0.4375rem;
  padding-bottom: 0.4375rem;
  font-size: 0.9375rem;
}

.site-header-search .input-card .btn {
  border-radius: 50%;
  width: 2.375rem;
  height: 2.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Hero (browse page)
   -------------------------------------------------------------------------- */

/* Full-bleed tinted band behind the hero; the .site-shell inside keeps the
   content on the 1920px cap. AppSumo-style vertical wash: strongest brand
   tint at the very top, dissolving into the white page — no hard bottom
   edge. */
/* AppSumo-style wash: white right under the header, deepening steadily
   toward the band's bottom edge. The peak stays pastel-light so the edge
   against the white page reads as a soft horizon, not a hard rule. */
.app-hero-section {
  background: linear-gradient(180deg,
    #ffffff 0%,
    #f8f9fe 45%,
    #eff2fd 100%);
  padding-block: 1.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.app-hero {
  max-width: 56rem;
}

.app-hero-heading {
  letter-spacing: -0.02em;
  font-size: calc(1.3rem + 1.05vw);
}

@media (min-width: 1200px) {
  .app-hero-heading {
    font-size: 2.125rem;
  }
}

.app-hero-tagline {
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
  color: #677788;
  font-size: 0.9375rem;
}

/* Stats row: quick-scan value props separated by dot dividers. */
.app-hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0;
  margin: 0.875rem 0 0;
  color: #677788;
  font-size: 0.875rem;
}

.app-hero-stat strong {
  color: #1e2022;
}

.app-hero-stat + .app-hero-stat::before {
  content: "\00B7";
  margin-inline: 0.875rem;
  color: rgba(33, 50, 91, 0.35);
}

/* Popular-category chips: quick entry points under the stats. */
.app-hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

.app-hero-chips .app-hero-chip {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

@media (max-width: 575.98px) {
  .app-hero-section {
    padding-block: 1.5rem 1.25rem;
  }
}

/* In-body search (grid pages, <992px only): never spans the full shell. */
.app-body-search {
  max-width: 44rem;
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Search + typeahead
   -------------------------------------------------------------------------- */

.app-search {
  position: relative;
}

.app-search-suggest {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  right: 0;
  z-index: 1050;
  background: #fff;
  border: 1px solid rgba(33, 50, 91, 0.1);
  border-radius: 0.5rem;
  box-shadow: 0 0.75rem 2.5rem rgba(33, 50, 91, 0.18);
  max-height: 22rem;
  overflow-y: auto;
  padding: 0.375rem;
}

.app-search-suggest[hidden] {
  display: none;
}

.app-search-suggest-group {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c98a4;
  padding: 0.5rem 0.75rem 0.25rem;
}

.app-search-suggest-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: #1e2022;
  font-size: 0.9375rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.app-search-suggest-item i {
  color: #8c98a4;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.app-search-suggest-item mark {
  background: transparent;
  color: inherit;
  font-weight: 600;
  padding: 0;
}

.app-search-suggest-item:hover,
.app-search-suggest-item.is-active {
  background: rgba(55, 125, 255, 0.08);
  color: #377dff;
}

.app-search-suggest-item.is-active i,
.app-search-suggest-item:hover i {
  color: #377dff;
}

.app-search-suggest-empty {
  padding: 0.625rem 0.75rem;
  color: #8c98a4;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Grid toolbar (count + chip + sort). Sticky compact bar on mobile.
   -------------------------------------------------------------------------- */

.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
  min-height: 2.375rem;
}

.app-toolbar-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.app-toolbar-count {
  font-size: 0.9375rem;
  color: #677788;
  white-space: nowrap;
}

.app-toolbar-count strong {
  color: #1e2022;
  font-weight: 600;
}

.app-toolbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 16rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(55, 125, 255, 0.35);
  border-radius: 2rem;
  background: rgba(55, 125, 255, 0.08);
  color: #377dff;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.app-toolbar-chip:hover,
.app-toolbar-chip:focus {
  background: rgba(55, 125, 255, 0.16);
  border-color: #377dff;
  color: #377dff;
}

.app-toolbar-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-toolbar-chip i {
  font-size: 0.625rem;
  flex-shrink: 0;
}

.app-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-toolbar-sort,
.app-toolbar-filters {
  border: 1px solid rgba(33, 50, 91, 0.15);
}

.app-toolbar-sort .text-muted {
  margin-right: 0.3em; /* the inter-word space collapses inside the button */
}

@media (max-width: 991.98px) {
  .app-toolbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    /* Bleed across the shell padding so the sticky bar spans edge to edge. */
    margin-left: calc(-1 * var(--shell-pad));
    margin-right: calc(-1 * var(--shell-pad));
    padding: 0.5rem var(--shell-pad);
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(33, 50, 91, 0.08);
  }
}

/* --------------------------------------------------------------------------
   Sticky left rail
   -------------------------------------------------------------------------- */

.app-rail {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.75rem;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(33, 50, 91, 0.2) transparent;
}

.app-rail::-webkit-scrollbar {
  width: 5px;
}

.app-rail::-webkit-scrollbar-thumb {
  background: rgba(33, 50, 91, 0.2);
  border-radius: 3px;
}

.app-rail::-webkit-scrollbar-track {
  background: transparent;
}

.app-rail-group {
  margin-bottom: 1.75rem;
}

.app-rail-group:last-child {
  margin-bottom: 0;
}

.app-rail-heading {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8c98a4;
  margin-bottom: 0.625rem;
}

.app-rail-nav .nav-link {
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
}

.app-rail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.app-rail-tags .app-rail-tag {
  margin: 0; /* flex gap owns the spacing between tags */
}

.js-rail-show-all {
  font-size: 0.8125rem;
  text-decoration: none;
  margin-top: 0.5rem;
}

.app-rail-links-list {
  columns: 2;
  column-gap: 1rem;
}

.app-rail-links-list li {
  padding: 0.1875rem 0;
  break-inside: avoid;
}

.app-rail-links-list a {
  font-size: 0.8125rem;
  color: #677788;
  text-decoration: none;
}

.app-rail-links-list a:hover,
.app-rail-links-list a:focus {
  color: #377dff;
}

/* --------------------------------------------------------------------------
   Mobile offcanvas drawer
   -------------------------------------------------------------------------- */

.app-rail-offcanvas {
  max-width: 20rem;
}

.app-rail-offcanvas .offcanvas-title {
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Back to top
   -------------------------------------------------------------------------- */

.app-back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1030;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(33, 50, 91, 0.1);
  border-radius: 50%;
  background: #fff;
  color: #377dff;
  box-shadow: 0 0.375rem 1.5rem rgba(33, 50, 91, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  cursor: pointer;
}

.app-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid rgba(33, 50, 91, 0.08);
}

.site-footer-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8c98a4;
  margin-bottom: 0.75rem;
}

.site-footer .link-sm {
  transition: color 0.15s ease;
}

.site-footer .link-sm:hover {
  color: #377dff !important;
}

.site-footer-tagline {
  max-width: 14rem;
}

/* --------------------------------------------------------------------------
   Signup CTA
   -------------------------------------------------------------------------- */

.site-cta {
  border: 1px solid rgba(33, 50, 91, 0.08);
  box-shadow: 0 0.375rem 1.5rem rgba(33, 50, 91, 0.06);
}

.site-cta-heading {
  letter-spacing: -0.01em;
}

.site-cta-copy {
  color: #677788;
}

.site-cta-note {
  color: #8c98a4;
}

/* --------------------------------------------------------------------------
   Pricing page (/pricing)
   -------------------------------------------------------------------------- */

.pricing-hero-sub {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e2022;
}

.pricing-hero-copy {
  color: #677788;
}

.pricing-tiers {
  max-width: 56rem;
}

.pricing-tier {
  border: 1px solid rgba(33, 50, 91, 0.12);
  border-radius: 0.5rem;
  background: #fff;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pricing-tier:hover {
  border-color: rgba(55, 125, 255, 0.4);
  box-shadow: 0 0.375rem 1.5rem rgba(33, 50, 91, 0.08);
}

.pricing-tier-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: #1e2022;
  cursor: pointer;
}

.pricing-tier-toggle:focus-visible {
  outline: 2px solid #377dff;
  outline-offset: -2px;
  border-radius: 0.5rem;
}

.pricing-tier-specs {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 500;
}

.pricing-tier-sep {
  color: #cbd3dd;
  margin: 0 0.25rem;
}

.pricing-tier-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pricing-tier-monthly {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e2022;
}

.pricing-tier-hourly {
  font-size: 0.8125rem;
  font-weight: 400;
  color: #677788;
}

.pricing-tier-chevron {
  flex-shrink: 0;
  color: #8c98a4;
  transition: transform 0.2s ease;
}

.pricing-tier-toggle[aria-expanded="true"] .pricing-tier-chevron {
  transform: rotate(180deg);
}

.pricing-compare {
  padding: 0.25rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(33, 50, 91, 0.08);
  background: #f8fafd;
}

.pricing-compare-heading {
  margin: 1rem 0 0.5rem;
  color: #1e2022;
}

.pricing-compare-table {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.pricing-compare-table th,
.pricing-compare-table td {
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
}

.pricing-compare-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c98a4;
  border-bottom-width: 1px;
}

.pricing-compare-table tbody th[scope="row"] {
  font-weight: 500;
  color: #1e2022;
}

.pricing-plan-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #8c98a4;
}

.pricing-price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pricing-compare-us {
  background: rgba(55, 125, 255, 0.06);
}

.pricing-compare-us th[scope="row"],
.pricing-compare-us .pricing-price {
  font-weight: 700;
  color: #377dff;
}

.pricing-footnote {
  max-width: 44rem;
  margin: 1.5rem auto 0;
  text-align: center;
}

@media (max-width: 575.98px) {
  .pricing-tier-toggle {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.875rem 1rem;
  }

  .pricing-tier-specs {
    flex-basis: calc(100% - 2rem);
  }

  .pricing-tier-prices {
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
  }

  .pricing-compare {
    padding: 0.25rem 0.75rem 1rem;
  }
}

/* Dynamic-scaling graph (labels positioned by js/dynamic-scaling.js) */

.scaling-graph-section {
  padding-left: 50px;
}

.instance-labels {
  /* display overrides the legacy theme.min.css rule that hid the RAM labels
     below 768px; labels are now JS-positioned and correct at every width. */
  display: block;
  left: 0;
  top: 0;
}

.scaling-graph-label {
  position: absolute;
  left: 0;
  font-size: 0.6875rem;
  color: #8c98a4;
  white-space: nowrap;
}

.graph-container {
  width: 100%;
  overflow: hidden;
}

.scaling-graph-axis {
  margin: 8px 0 24px 0;
  width: 100%;
  font-size: 0.6875rem;
}

.scaling-graph-axis div {
  flex: 1;
  text-align: left;
}

/* ------------------------------------------------------------------
 * Favorite toggle (heart) — shared state rules for the grid-card chip
 * (positioned in app-grid.css) and the app-details page button.
 * State class `is-favorited` is toggled by the favorites module in
 * site.js; the two <i> icons swap via display so no JS class juggling
 * of icon names is needed.
 * ------------------------------------------------------------------ */
.app-favorite-toggle .app-favorite-icon-filled {
  display: none;
}

.app-favorite-toggle.is-favorited .app-favorite-icon-filled {
  display: inline-block;
  color: #ed4c78;
}

.app-favorite-toggle.is-favorited .app-favorite-icon-outline {
  display: none;
}

/* Details-page favorite button (sits under the Deploy Now CTA). */
.app-favorite-detail-btn .app-favorite-icon-filled,
.app-favorite-detail-btn .app-favorite-icon-outline {
  margin-right: 0.375rem;
}
