/* ==========================================================================
   A2Z Converter — "Popular tools" designs (home page)
   popular-variants.js adds .pt--<name> to #popular.
    1 classic   cards with file illustration (home.css, no overrides)
    2 ranked    numbered top chart in two columns
    3 tiles     square tiles, illustration fills the tile
    4 featured  first tool large, the rest around it
    5 shelf     one scrolling row of wide cards
    6 color     solid accent-colour cards
    7 index     typographic list with hairlines and mono formats
    8 glass     frosted cards over colour blobs
    9 split     wide cards: illustration left, text right
   10 chips     pill-shaped links in a centred cloud
   ========================================================================== */

#popular .container { position: relative; }

/* Section switcher sits at the bottom right of the section */
.hx-switch--section { position: absolute; right: var(--gutter); bottom: -6px; }
@media (max-width: 639px) {
  .hx-switch--section { position: relative; right: auto; bottom: auto; width: fit-content; margin: 18px 0 0 auto; }
}


/* ---------- 2. Top chart ---------- */
.pt--ranked .tool-grid { grid-template-columns: 1fr; gap: 0 48px; counter-reset: rank; }
@media (min-width: 768px) { .pt--ranked .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(4, auto); } }
.pt--ranked .tool-card {
  flex-direction: row; align-items: center; gap: 16px; padding: 14px 4px; overflow: visible;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; counter-increment: rank;
}
.pt--ranked .tool-card::before {
  content: counter(rank, decimal-leading-zero); min-width: 48px;
  font-size: 32px; font-weight: 800; letter-spacing: -.04em; color: var(--border-strong); transition: color .2s var(--ease);
}
.pt--ranked .tool-card:hover { transform: none; box-shadow: none; border-color: var(--border); }
.pt--ranked .tool-card:hover::before { color: var(--accent); }
.pt--ranked .tool-visual { flex: none; width: 64px; height: 56px; border-radius: 14px; gap: 0; }
.pt--ranked .tv-file:first-child, .pt--ranked .tv-arrow, .pt--ranked .tv-tag { display: none; }
.pt--ranked .tv-file { width: 32px; height: 40px; padding-bottom: 5px; border-radius: 5px 10px 5px 5px; font-size: 8.5px; }
.pt--ranked .tv-file::before { width: 10px; height: 10px; border-radius: 0 10px 0 5px; }
.pt--ranked .tv-file::after { display: none; }
.pt--ranked .tv-icon { width: 36px; height: 36px; border-radius: 11px; font-size: 15px; box-shadow: none; }
.pt--ranked .tool-body { padding: 0; min-width: 0; }
.pt--ranked .tool-body h3 { font-size: 16px; }
.pt--ranked .tool-body p { margin-top: 2px; font-size: 13.5px; }
.pt--ranked .tool-cta {
  flex: none; margin: 0; width: 38px; height: 38px; justify-content: center; border-radius: 50%;
  font-size: 0; background: var(--panel); color: var(--text-2); transition: background-color .2s var(--ease), color .2s var(--ease);
}
.pt--ranked .tool-card:hover .tool-cta { background: var(--accent); color: #fff; }


/* ---------- 3. Square tiles ---------- */
.pt--tiles .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .pt--tiles .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pt--tiles .tool-card {
  aspect-ratio: 1; justify-content: flex-end; padding: 0; text-align: center;
  border: 0; border-radius: 28px; background: color-mix(in srgb, var(--accent) 9%, #fff);
}
.pt--tiles .tool-visual {
  position: absolute; inset: 0 0 58px; height: auto; border-radius: 0;
  background: radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--accent) 22%, #fff), transparent 70%);
}
.pt--tiles .tv-file { width: 66px; height: 82px; font-size: 14px; }
.pt--tiles .tv-icon { width: 76px; height: 76px; font-size: 30px; }
.pt--tiles .tool-body { position: relative; flex: none; padding: 0 12px 20px; }
.pt--tiles .tool-body p, .pt--tiles .tool-cta { display: none; }
.pt--tiles .tool-card:hover { box-shadow: 0 24px 40px -24px color-mix(in srgb, var(--accent) 60%, transparent); }


/* ---------- 4. Featured ---------- */
@media (min-width: 560px) {
  .pt--featured .tool-card:first-child { grid-column: 1 / -1; }
}
@media (min-width: 992px) {
  .pt--featured .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pt--featured .tool-card:first-child { grid-column: span 2; grid-row: span 2; }
  .pt--featured .tool-card:last-child { grid-column: span 2; }
  .pt--featured .tool-card:not(:first-child) .tool-visual { height: 100px; }
}
.pt--featured .tool-card:first-child { padding: 12px 12px 24px; }
.pt--featured .tool-card:first-child .tool-visual { flex: 1; min-height: 220px; }
.pt--featured .tool-card:first-child .tv-file { width: 92px; height: 116px; font-size: 17px; padding-bottom: 18px; }
.pt--featured .tool-card:first-child .tv-arrow { width: 44px; height: 44px; font-size: 16px; }
.pt--featured .tool-card:first-child .tv-icon { width: 96px; height: 96px; font-size: 38px; border-radius: 28px; }
.pt--featured .tool-card:first-child .tool-body { flex: none; padding: 20px 12px 0; }
.pt--featured .tool-card:first-child .tool-body h3 { font-size: 26px; letter-spacing: -.02em; }
.pt--featured .tool-card:first-child .tool-body p { font-size: 16px; }
.pt--featured .tool-card:first-child .tool-cta { margin: 16px 12px 0; padding: 10px 18px; width: fit-content; border-radius: var(--radius-pill); background: var(--accent); color: #fff; }
.pt--featured .tool-card:first-child::before {
  content: 'Most popular'; position: absolute; top: 24px; left: 24px; z-index: 1;
  padding: 4px 12px; border-radius: var(--radius-pill); background: #fff; color: var(--accent);
  font-size: 12px; font-weight: 800; letter-spacing: .03em; box-shadow: var(--shadow-sm);
}


/* ---------- 5. Shelf ---------- */
.pt--shelf .tool-grid {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 20px; margin: -6px -4px 0;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.pt--shelf .tool-card { flex: 0 0 min(300px, 78%); scroll-snap-align: start; }
.pt--shelf .tool-visual { height: 170px; }
.pt--shelf .tool-card:hover { transform: translateY(-3px); }


/* ---------- 6. Colour cards ---------- */
.pt--color .tool-card {
  padding: 22px 20px 22px; border: 0; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 82%, #fff) 0%, color-mix(in srgb, var(--accent) 88%, #000) 100%);
}
.pt--color .tool-card:hover { box-shadow: 0 26px 44px -22px color-mix(in srgb, var(--accent) 80%, transparent); }
.pt--color .tool-body { order: -1; flex: none; padding: 0; }
.pt--color .tool-body h3 { font-size: 18px; }
.pt--color .tool-body p { color: rgba(255, 255, 255, .88); }
.pt--color .tool-visual { margin-top: 18px; height: 108px; background: rgba(255, 255, 255, .14); }
.pt--color .tv-file { background: rgba(255, 255, 255, .25); color: #fff; box-shadow: none; }
.pt--color .tv-file::before { background: rgba(255, 255, 255, .35); }
.pt--color .tv-file--out { background: #fff; color: var(--accent); }
.pt--color .tv-file--out::after {
  background: linear-gradient(color-mix(in srgb, var(--accent) 30%, #fff), color-mix(in srgb, var(--accent) 30%, #fff)) 0 0 / 100% 4px no-repeat,
              linear-gradient(color-mix(in srgb, var(--accent) 30%, #fff), color-mix(in srgb, var(--accent) 30%, #fff)) 0 9px / 70% 4px no-repeat;
}
.pt--color .tv-arrow { background: rgba(255, 255, 255, .25); color: #fff; box-shadow: none; }
.pt--color .tv-icon { background: #fff; color: var(--accent); box-shadow: 0 0 0 10px rgba(255, 255, 255, .16); }
.pt--color .tool-cta { margin: 16px 0 0; color: #fff; }
/* Phones: two cards per row instead of eight full-width cards; smaller illustration, no description */
@media (max-width: 559px) {
  .pt--color .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pt--color .tool-card { padding: 14px 12px; border-radius: 18px; }
  .pt--color .tool-body h3 { font-size: 14.5px; line-height: 1.25; }
  .pt--color .tool-body p { display: none; }
  .pt--color .tool-visual { zoom: .68; margin-top: 16px; border-radius: 18px; }
  .pt--color .tool-cta { margin-top: 10px; font-size: 12.5px; }
}


/* ---------- 7. Index ---------- */
.pt--index .tool-grid { grid-template-columns: 1fr; gap: 0 56px; border-top: 2px solid var(--text); }
@media (min-width: 768px) { .pt--index .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pt--index .tool-card {
  flex-direction: row; align-items: center; gap: 16px; padding: 20px 0; overflow: visible;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none;
}
.pt--index .tool-card:hover { transform: none; box-shadow: none; border-color: var(--border); }
.pt--index .tool-body { padding: 0; }
.pt--index .tool-body h3 { font-size: clamp(19px, 2vw, 24px); font-weight: 700; letter-spacing: -.02em; transition: color .2s var(--ease); }
.pt--index .tool-card:hover .tool-body h3 { color: var(--accent); }
.pt--index .tool-body p, .pt--index .tool-cta, .pt--index .tv-icon { display: none; }
.pt--index .tool-visual {
  flex: none; order: 2; height: auto; gap: 6px; padding: 0; background: none; border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.pt--index .tv-file, .pt--index .tool-card:hover .tv-file, .pt--index .tool-card:hover .tv-file:first-child, .pt--index .tool-card:hover .tv-file--out {
  width: auto; height: auto; padding: 0; background: none; box-shadow: none; transform: none;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.pt--index .tv-file::before, .pt--index .tv-file::after { display: none; }
.pt--index .tv-file--out { color: var(--accent); }
.pt--index .tool-card .tv-file--out { color: var(--accent); }
.pt--index .tv-arrow, .pt--index .tool-card:hover .tv-arrow { width: auto; height: auto; background: none; box-shadow: none; color: var(--muted-2); font-size: 10px; animation: none; transform: none; }
.pt--index .tv-tag { position: static; padding: 0; background: none; box-shadow: none; font-size: 13px; font-weight: 600; color: var(--accent); }
.pt--index .tool-card::after { content: '↗'; order: 3; font-size: 18px; color: var(--muted-2); transition: color .2s var(--ease), transform .2s var(--ease); }
.pt--index .tool-card:hover::after { color: var(--accent); transform: translate(2px, -2px); }


/* ---------- 8. Glass ---------- */
#popular.pt--glass {
  background:
    radial-gradient(40% 50% at 8% 20%, #FFCDB9 0%, rgba(255, 205, 185, 0) 70%),
    radial-gradient(35% 45% at 92% 30%, #FFC9DC 0%, rgba(255, 201, 220, 0) 70%),
    radial-gradient(40% 50% at 55% 95%, #DCCEFF 0%, rgba(220, 206, 255, 0) 70%),
    #FFF8F5;
}
.pt--glass .tabs { background: rgba(255, 255, 255, .55); }
.pt--glass .tool-card {
  background: rgba(255, 255, 255, .55); border-color: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 20px 40px -26px rgba(120, 40, 20, .35);
}
.pt--glass .tool-visual { background: rgba(255, 255, 255, .55); }


/* ---------- 9. Split cards ---------- */
.pt--split .tool-grid { grid-template-columns: 1fr; }
@media (min-width: 768px) { .pt--split .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pt--split .tool-card {
  display: grid; grid-template-columns: 42% 1fr; grid-template-rows: 1fr auto; padding: 10px; column-gap: 20px;
}
.pt--split .tool-visual { grid-row: 1 / span 2; height: auto; min-height: 150px; }
.pt--split .tool-body { padding: 14px 0 0; }
.pt--split .tool-body h3 { font-size: 18px; }
.pt--split .tool-cta { margin: 10px 0 8px; }


/* ---------- 10. Chips ---------- */
.pt--chips .tool-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pt--chips .tool-card {
  flex-direction: row; align-items: center; gap: 12px; padding: 8px 18px 8px 8px; border-radius: var(--radius-pill);
}
.pt--chips .tool-card:hover { transform: translateY(-2px); }
.pt--chips .tool-visual { flex: none; width: 48px; height: 48px; border-radius: 50%; gap: 0; background: color-mix(in srgb, var(--accent) 14%, #fff); }
.pt--chips .tv-file:first-child, .pt--chips .tv-arrow, .pt--chips .tv-tag, .pt--chips .tool-body p { display: none; }
.pt--chips .tv-file--out, .pt--chips .tool-card:hover .tv-file--out {
  width: auto; height: auto; padding: 0; background: none; box-shadow: none; transform: none;
  font-size: 10.5px; color: var(--accent);
}
.pt--chips .tv-file--out::before, .pt--chips .tv-file--out::after { display: none; }
.pt--chips .tv-icon, .pt--chips .tool-card:hover .tv-icon { width: 48px; height: 48px; border-radius: 50%; font-size: 18px; box-shadow: none; transform: none; }
.pt--chips .tool-body { flex: none; padding: 0; }
.pt--chips .tool-body h3 { font-size: 15.5px; }
.pt--chips .tool-cta { margin: 0; font-size: 0; }
