/*
 * Northstar Commercial — evergreen commercial template.
 *
 * Hand-written, ns- prefixed, self-contained. It is NOT written in Tailwind
 * utilities: the theme ships a PREBUILT app.css that contains only the classes
 * the original export happened to use, so any utility invented here would
 * simply not exist in the bundle and would silently do nothing.
 *
 * It does, however, CONSUME the theme's design tokens (--primary, --card,
 * --border, … as shadcn-style HSL triplets). That is what makes these
 * components inherit the site's warm archive palette and its dark mode for
 * free. Every var() carries a fallback so the components still render
 * correctly if the theme's token block ever moves.
 */

.ns-toplist {
  --ns-primary: var(--primary, 8 45% 35%);
  --ns-card-bg: var(--card, 40 30% 99%);
  --ns-fg: var(--card-foreground, 20 15% 15%);
  --ns-muted: var(--muted-foreground, 20 10% 45%);
  --ns-border: var(--border, 30 15% 85%);
  --ns-radius: var(--radius, 0.375rem);
  display: grid;
  gap: 1.25rem;
  margin: 0 0 3rem;
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.ns-card {
  position: relative;
  display: grid;
  gap: 0.875rem;
  padding: 1.25rem;
  background: hsl(var(--ns-card-bg));
  color: hsl(var(--ns-fg));
  border: 1px solid hsl(var(--ns-border));
  border-radius: calc(var(--ns-radius) * 2);
  box-shadow: 0 1px 2px hsl(var(--ns-fg) / 0.04);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

@media (hover: hover) {
  .ns-card:hover {
    box-shadow: 0 6px 20px hsl(var(--ns-fg) / 0.08);
    transform: translateY(-1px);
  }
}

/* The #1 slot is the commercial focus of the page; give it a visible edge
   without turning it into a different component. */
.ns-card.is-first {
  border-color: hsl(var(--ns-primary) / 0.45);
  box-shadow: 0 0 0 1px hsl(var(--ns-primary) / 0.2), 0 6px 18px hsl(var(--ns-fg) / 0.07);
}

.ns-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  flex-wrap: wrap;
}

.ns-rank {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--primary-foreground, 40 25% 97%));
  background: hsl(var(--ns-primary));
  border-radius: 999px;
}

.ns-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 12rem;
}

.ns-logo {
  width: auto;
  height: 2.25rem;
  max-width: 7.5rem;
  object-fit: contain;
}

/* No art on file for this partner: a text wordmark is honest and costs nothing. */
.ns-wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.ns-brand-meta {
  display: grid;
  min-width: 0;
}

.ns-name {
  font-weight: 650;
  font-size: 1.0625rem;
  line-height: 1.2;
}

.ns-domain {
  font-size: 0.75rem;
  color: hsl(var(--ns-muted));
}

.ns-card-head-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.ns-badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--ns-primary));
  background: hsl(var(--ns-primary) / 0.1);
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Rating ────────────────────────────────────────────────────────────── */

.ns-rating {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.ns-stars {
  display: inline-flex;
  gap: 1px;
}

.ns-star {
  width: 0.875rem;
  height: 0.875rem;
  background: hsl(var(--ns-border));
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.ns-star.is-full { background: hsl(38 92% 50%); }
.ns-star.is-half { background: linear-gradient(90deg, hsl(38 92% 50%) 50%, hsl(var(--ns-border)) 50%); }

.ns-rating-num {
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ns-rating-den {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--ns-muted));
}

/* ── Tags, bonus ───────────────────────────────────────────────────────── */

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

.ns-tag {
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--ns-muted));
  border: 1px solid hsl(var(--ns-border));
  border-radius: 999px;
}

.ns-bonus {
  display: grid;
  gap: 0.125rem;
  padding: 0.75rem 0.875rem;
  background: hsl(var(--ns-primary) / 0.07);
  border-left: 3px solid hsl(var(--ns-primary));
  border-radius: var(--ns-radius);
}

.ns-bonus-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--ns-muted));
}

.ns-bonus-value {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ── Body: features + quick facts ──────────────────────────────────────── */

.ns-card-body {
  display: grid;
  gap: 0.875rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .ns-card-body { grid-template-columns: 1.1fr 1fr; }
}

.ns-features {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.ns-features li {
  position: relative;
  padding-left: 1.375rem;
  line-height: 1.45;
}

.ns-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 0.75rem;
  height: 0.4rem;
  border-left: 2px solid hsl(142 55% 38%);
  border-bottom: 2px solid hsl(142 55% 38%);
  transform: rotate(-45deg);
}

.ns-facts {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid hsl(var(--ns-border));
  border-radius: var(--ns-radius);
  overflow: hidden;
}

.ns-fact {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4375rem 0.625rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid hsl(var(--ns-border));
}

.ns-fact:last-child { border-bottom: 0; }

.ns-fact dt {
  color: hsl(var(--ns-muted));
  white-space: nowrap;
}

.ns-fact dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* ── Payments ──────────────────────────────────────────────────────────── */

.ns-pays {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.ns-pays-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--ns-muted));
}

.ns-pay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3125rem;
}

.ns-chip {
  padding: 0.1875rem 0.4375rem;
  font-size: 0.75rem;
  background: hsl(var(--muted, 35 15% 92%));
  border-radius: calc(var(--ns-radius) / 1.5);
}

/* ── Pros / cons ───────────────────────────────────────────────────────── */

.ns-proscons {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid hsl(var(--ns-border));
}

@media (min-width: 640px) {
  .ns-proscons { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

.ns-proscons h4 {
  margin: 0 0 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ns-pros h4 { color: hsl(142 55% 30%); }
.ns-cons h4 { color: hsl(var(--destructive, 0 65% 50%)); }

.ns-proscons ul {
  display: grid;
  gap: 0.3125rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.ns-proscons li {
  position: relative;
  padding-left: 1.125rem;
}

.ns-pros li::before,
.ns-cons li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}

.ns-pros li::before { content: "+"; color: hsl(142 55% 35%); }
.ns-cons li::before { content: "−"; color: hsl(var(--destructive, 0 65% 50%)); }

/* ── CTA ───────────────────────────────────────────────────────────────── */

.ns-card-foot {
  display: grid;
  gap: 0.5rem;
  justify-items: stretch;
}

.ns-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.6875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  color: hsl(var(--primary-foreground, 40 25% 97%));
  background: hsl(var(--ns-primary, 8 45% 35%));
  border-radius: var(--ns-radius);
  transition: filter 0.15s ease, transform 0.1s ease;
}

/* The theme's prose rules style links globally; be explicit so a visited or
   hovered CTA never inherits an underline or a link colour from them. */
.ns-cta,
.ns-cta:hover,
.ns-cta:focus,
.ns-cta:visited {
  color: hsl(var(--primary-foreground, 40 25% 97%));
  text-decoration: none;
}

.ns-cta:hover { filter: brightness(1.08); }
.ns-cta:active { transform: translateY(1px); }

.ns-cta:focus-visible {
  outline: 2px solid hsl(var(--ns-primary));
  outline-offset: 2px;
}

.ns-cta-arrow { font-size: 1.05em; line-height: 1; }

.ns-cta-sm {
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
}

.ns-cta-inline {
  padding: 0.125rem 0.5rem;
  font-size: inherit;
}

.ns-disclaimer {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: hsl(var(--ns-muted));
  text-align: center;
}

/* ── Compact teaser ────────────────────────────────────────────────────── */

.ns-compact { gap: 0.625rem; margin-bottom: 2rem; }

.ns-mini {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.875rem;
  background: hsl(var(--ns-card-bg));
  color: hsl(var(--ns-fg));
  border: 1px solid hsl(var(--ns-border));
  border-radius: calc(var(--ns-radius) * 1.5);
}

.ns-mini.is-first { border-color: hsl(var(--ns-primary) / 0.45); }

.ns-mini .ns-rank { width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }
.ns-mini-brand { flex: 0 0 auto; display: flex; align-items: center; }
.ns-mini-brand .ns-logo { height: 1.75rem; max-width: 5.5rem; }
.ns-mini-brand .ns-wordmark { font-size: 0.9375rem; }

.ns-mini-text { display: grid; flex: 1 1 10rem; min-width: 0; }
.ns-mini-bonus { font-size: 0.8125rem; color: hsl(var(--ns-muted)); line-height: 1.3; }

.ns-mini-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .ns-mini-right { width: 100%; justify-content: space-between; }
  .ns-mini-right .ns-cta { flex: 1 1 auto; }
}

/* ── Comparison table ──────────────────────────────────────────────────── */

.ns-table-wrap {
  --ns-border: var(--border, 30 15% 85%);
  --ns-muted: var(--muted-foreground, 20 10% 45%);
  margin: 0 0 2.5rem;
  overflow-x: auto;
  border: 1px solid hsl(var(--ns-border));
  border-radius: calc(var(--radius, 0.375rem) * 2);
}

.ns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ns-table thead th {
  position: sticky;
  top: 0;
  padding: 0.6875rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--ns-muted));
  background: hsl(var(--muted, 35 15% 92%));
  white-space: nowrap;
}

.ns-table tbody td,
.ns-table tbody th {
  padding: 0.6875rem 0.75rem;
  text-align: left;
  font-weight: 400;
  border-top: 1px solid hsl(var(--ns-border));
  vertical-align: middle;
}

.ns-table tbody tr:nth-child(even) { background: hsl(var(--muted, 35 15% 92%) / 0.4); }

.ns-td-rank,
.ns-td-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.ns-td-name a {
  font-weight: 650;
  text-decoration: none;
}

.ns-td-name a:hover { text-decoration: underline; }

.ns-td-cta { text-align: right; white-space: nowrap; }

.ns-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Below 760px the table stops being a table and becomes one block per row.
   A horizontally scrolling 8-column table on a phone is unreadable, and this
   page is overwhelmingly mobile traffic. */
@media (max-width: 760px) {
  .ns-table-wrap { overflow-x: visible; border: 0; }
  .ns-table thead { display: none; }
  .ns-table,
  .ns-table tbody,
  .ns-table tr,
  .ns-table td,
  .ns-table th { display: block; width: 100%; }

  .ns-table tbody tr {
    margin-bottom: 0.875rem;
    background: hsl(var(--card, 40 30% 99%));
    border: 1px solid hsl(var(--ns-border));
    border-radius: calc(var(--radius, 0.375rem) * 2);
    overflow: hidden;
  }

  .ns-table tbody tr:nth-child(even) { background: hsl(var(--card, 40 30% 99%)); }

  .ns-table tbody td,
  .ns-table tbody th {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-top: 0;
    border-bottom: 1px solid hsl(var(--ns-border) / 0.6);
  }

  .ns-table tbody td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--ns-muted));
  }

  .ns-td-cta { border-bottom: 0; }
  .ns-td-cta .ns-cta { width: 100%; }
}

.ns-toplist-heading {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ── Sticky bottom bar ─────────────────────────────────────────────────── */

.ns-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--card, 40 30% 99%) / 0.97);
  border-top: 1px solid hsl(var(--border, 30 15% 85%));
  box-shadow: 0 -4px 16px hsl(20 15% 15% / 0.1);
  backdrop-filter: blur(6px);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

.ns-strip-inner {
  max-width: 72rem;
  margin: 0 auto;
}

/* MOBILE: exactly one tile, full width, nothing to scroll.
   The previous bar laid three tiles (1088px of them) inside a centred
   scroller in a 390px viewport, so the strip parked in the middle and the #1
   offer sat off-screen to the left — the visible tile was #2. Measured at
   390x844, not assumed. */
.ns-strip-tiles {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ns-strip .ns-tile { display: none; }
.ns-strip .ns-tile-first { display: flex; width: 100%; }

.ns-tile {
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1 1 0;
}

.ns-tile-brand { flex: 0 0 auto; display: flex; align-items: center; }
.ns-tile-brand .ns-logo { height: 1.75rem; max-width: 4.5rem; }
.ns-tile-brand .ns-wordmark { font-size: 0.875rem; }

.ns-tile-text {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.ns-tile-name {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.2;
}

.ns-tile-bonus {
  font-size: 0.75rem;
  line-height: 1.25;
  color: hsl(var(--muted-foreground, 20 10% 45%));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ns-tile .ns-cta { flex: 0 0 auto; }

@media (min-width: 768px) {
  .ns-strip .ns-tile { display: flex; }
  .ns-strip .ns-tile-first { width: auto; }
  .ns-strip-tiles { gap: 1.25rem; }
  .ns-tile-bonus { white-space: normal; }
}

/* ── Widget hosts (theme-managed reusable blocks) ──────────────────────── */

/* The theme hides [data-aa-widget] until its JS adds .is-visible, so the host
   element — not the strip — owns the fixed positioning. */
.ns-sticky-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
}

.ns-sticky-host .ns-strip { position: static; }

/* 2.75rem = 44px, a proper touch target and the size the theme's button rules
   were already producing. Stated explicitly so the reserved space below is
   derived from a number this file controls, not from whatever wins the
   cascade. */
.ns-sticky-host .ns-sticky-x,
.ns-float .ns-float-x {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.375rem;
  line-height: 1;
  color: hsl(var(--muted-foreground, 20 10% 45%));
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.ns-sticky-host .ns-sticky-x:hover,
.ns-float .ns-float-x:hover { background: hsl(var(--muted, 35 15% 92%)); }

/* Reserve the dismiss button its own column so it cannot land on top of the
   CTA. The X is 44px wide and sits 6px from the edge, so the content has to
   stop ~54px short of it. Measured at 390x844: with only 24px reserved the
   button covered the last 16px of a paid link, turning the close control into
   a mis-tap on the CTA. */
.ns-sticky-host .ns-strip-inner { padding-right: 3.25rem; }

@media (min-width: 768px) {
  .ns-sticky-host .ns-strip-inner { padding-right: 3.5rem; }
}

.ns-float .ns-float-x {
  position: static;
  transform: none;
  width: 2rem;
  height: 2rem;
  font-size: 1.125rem;
}

/* The theme's back-to-top button is fixed at bottom-6 and would otherwise sit
   on the bar. Lift it while the bar is showing. */
body:has(.ns-sticky-host.is-visible) [data-aa-scroll-top] {
  bottom: 7rem;
}

.ns-float {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  padding: 0.5rem 0.75rem 0.75rem;
  background: hsl(var(--card, 40 30% 99%));
  border: 1px solid hsl(var(--border, 30 15% 85%));
  border-radius: calc(var(--radius, 0.375rem) * 2);
  box-shadow: 0 12px 32px hsl(20 15% 15% / 0.18);
}

.ns-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.ns-float-label,
.ns-inline-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground, 20 10% 45%));
}

.ns-float .ns-toplist { margin-bottom: 0; }
.ns-float-x { position: static; }

.ns-inline-promo {
  padding: 3rem 0;
  border-top: 1px solid hsl(var(--border, 30 15% 85%));
}

.ns-inline-label { display: block; margin-bottom: 0.5rem; }

.ns-inline-foot {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground, 20 10% 45%));
}

@media print {
  .ns-strip,
  .ns-sticky-host,
  .ns-float { display: none; }
}
