/* Sponsors (src/sponsors-page.ts): the side rails, the top banner and the
   Advertise dialog that sitePage() pages get, plus /advertise and My ads.
   On the site's tokens and the directory's cards (/static/directory.css), so
   light and dark both work. Loaded only on pages that show one of them. */

/* ---- the top banner: one thin line above the site header, every screen ---- */
/* The top bar, like Mokxi's announcement bar: the accent with soft diagonal stripes, white text, a pill. */
.sp-banner {
  position: relative; color: #fff; font-size: 13.5px; line-height: 1.3;
  background: repeating-linear-gradient(135deg, rgb(255 255 255 / .07) 0 10px, transparent 10px 20px), linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #7c3aed));
}
.sp-banner[hidden] { display: none; }
.sp-banner-in { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: var(--site-max); margin: 0 auto; padding: 8px 48px; min-width: 0; white-space: nowrap; }
.sp-banner-by { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.sp-banner-link { display: flex; align-items: center; gap: 7px; min-width: 0; color: #fff; }
.sp-banner-link:hover { text-decoration: none; }
.sp-banner-link:hover .sp-banner-line { text-decoration: underline; }
.sp-banner strong { flex: none; font-weight: 700; }
.sp-banner-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: .95; }
.sp-banner .sp-logo.is-tiny { background: #fff; border-radius: 5px; }
.sp-banner-btn { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: #fff; color: #1a1918; font-size: 12.5px; font-weight: 700; }
.sp-banner-btn:hover { text-decoration: none; opacity: .92; }
.sp-banner-x { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; opacity: .85; }
.sp-banner-x:hover { opacity: 1; background: rgb(255 255 255 / .15); }
@media (max-width: 560px) { .sp-banner-btn { display: none; } .sp-banner-in { justify-content: flex-start; padding-left: var(--gutter); } }

/* ---- logos in a small tile, as .dir-logo ---- */
.sp-logo { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; color: var(--text-faint); }
.sp-logo .logo, .sp-logo img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.sp-logo .logo-letter { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sp-logo.is-plus { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.sp-logo.is-tiny { width: 18px; height: 18px; border-radius: 5px; border: 0; background: transparent; }
.sp-logo.is-tiny .logo, .sp-logo.is-tiny img { width: 16px; height: 16px; border-radius: 4px; }

/* ---- the side rails: wide screens only, filling the space beside the page ---- */
.sp-rail { display: none; }
@media (min-width: 1500px) {
  .sp-rail {
    /* As wide as the gutter allows (150px to 300px), 16px from the window edge. */
    --rail-w: clamp(150px, calc((100vw - var(--site-max)) / 2 - 32px), 300px);
    position: fixed; top: 112px; z-index: 5; width: var(--rail-w); display: flex; flex-direction: column; gap: 12px;
    max-height: calc(100vh - 128px); overflow-y: auto; scrollbar-width: none;
  }
  .sp-rail::-webkit-scrollbar { display: none; }
  .sp-rail.is-left { left: 16px; }
  .sp-rail.is-right { right: 16px; }
  /* Rail cards stand tall and centered: the logo big, the name, then the line. */
  .sp-rail .sp-card { align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 170px; padding: 22px 16px 18px; border-radius: 14px; }
  .sp-rail .sp-card-top { flex-direction: column; gap: 10px; max-width: 100%; }
  .sp-rail .sp-card-top strong { font-size: 15px; max-width: 100%; }
  .sp-rail .sp-logo { width: 48px; height: 48px; border-radius: 12px; }
  .sp-rail .sp-logo .logo, .sp-rail .sp-logo img { width: 40px; height: 40px; border-radius: 9px; }
  .sp-rail .sp-card-line { font-size: 13px; }
  .sp-rail .sp-label { position: absolute; top: 9px; right: 11px; }
}

.sp-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; min-width: 0;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.sp-card:hover { text-decoration: none; border-color: var(--line-strong); background: var(--bg-raised); }
@media (hover: hover) { .sp-card:hover { transform: translateY(-1px); } }
.sp-card.is-platinum { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.sp-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sp-card-top strong { min-width: 0; font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-card-line { font-size: 12.5px; line-height: 1.4; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sp-label { align-self: flex-start; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.sp-advertise { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.sp-advertise:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---- the Advertise dialog ---- */
.sp-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-sheet); }
.sp-dialog::backdrop { background: rgba(0, 0, 0, .55); }
/* Rows sit at their own height; without align-content a tall window stretched every row. */
.sp-dialog[open] { display: grid; gap: 14px; align-content: start; grid-auto-rows: max-content; height: fit-content; overflow-y: auto; }
.sp-dialog .eyebrow { margin: 0; }
.sp-dialog h2 { margin: 0; padding-right: 36px; font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; }
.sp-dialog .sp-dialog-label { margin: 4px 0 0; font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.sp-dialog-close { position: absolute; top: 14px; right: 14px; margin: 0; }
.sp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.sp-tile { display: grid; gap: 4px; align-content: start; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.sp-tile strong { font-family: var(--mono); font-size: 19px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sp-tile.is-text strong { font-family: inherit; font-size: 15.5px; letter-spacing: -0.01em; }
.sp-tile span { font-size: 12.5px; line-height: 1.35; color: var(--text-dim); }
.sp-tile.is-accent { background: var(--accent-soft); border-color: transparent; }
.sp-tile.is-accent strong { color: var(--accent); }
.sp-how { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.sp-prices { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; }
.sp-prices li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
.sp-prices li:last-child { border-bottom: 0; }
.sp-prices li > span:last-child { font-family: var(--mono); font-size: 13px; }

/* ---- /advertise ---- */
.sp-accent { color: var(--accent) !important; }
.sp-mo { font-size: 13px; color: var(--text-faint); font-weight: 500; }
.sp-why { gap: 18px; }
.sp-why-lede { margin: 0; max-width: 70ch; color: var(--text-dim); font-size: 15.5px; line-height: 1.55; }
.sp-why .dir-strip { margin: 0; }
.sp-chart-wrap { margin: 0; display: grid; gap: 10px; }
.sp-chart { width: 100%; height: auto; max-height: 220px; display: block; }
.sp-chart rect { fill: var(--accent); }
.sp-chart rect.is-now { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.sp-chart text { fill: var(--text-faint); font-size: 12px; font-family: var(--mono); }
.sp-chart text.v { fill: var(--text); font-weight: 600; }

.sp-form { gap: 18px; }
.sp-form .dir-label { margin-top: 4px; }
.sp-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.sp-tier { position: relative; display: grid; gap: 8px; align-content: start; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease; }
.sp-tier:hover { border-color: var(--line-strong); }
.sp-tier input { position: absolute; opacity: 0; pointer-events: none; }
.sp-tier:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sp-tier:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-tier.is-out { cursor: not-allowed; opacity: .55; }
.sp-tier-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sp-tier-head strong { font-size: 16px; }
.sp-tier-price { font-family: var(--mono); font-size: 20px; font-weight: 650; }
.sp-tier-price span { font-size: 12.5px; color: var(--text-faint); font-weight: 500; }
.sp-tier-line { font-size: 13.5px; line-height: 1.45; color: var(--text-dim); }
.sp-tier-spots { justify-self: start; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; color: var(--chip-ok-fg); background: var(--chip-ok-bg); border: 1px solid var(--chip-ok-line); }
.sp-tier-spots.is-out { color: var(--text-faint); background: transparent; border-color: var(--line); }

.sp-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
@media (max-width: 760px) { .sp-form-grid { grid-template-columns: minmax(0, 1fr); } }
.sp-fields { display: grid; gap: 14px; }
.sp-preview { display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px dashed var(--line-strong); background-image: radial-gradient(var(--site-dot) 1px, transparent 1px); background-size: 14px 14px; }
.sp-preview .dir-label { margin: 0; }
.sp-preview-rail { width: 150px; }
.sp-preview-banner { padding: 7px 10px; border-radius: 8px; background: var(--bg-raised); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-preview-banner strong { color: var(--text); }
.sp-preview-banner[hidden] { display: none; }
.sp-preview p { margin: 0; }
.sp-faq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; padding-bottom: 64px; }
.sp-faq-grid .dir-box { gap: 6px; align-content: start; }
.sp-faq-grid p { margin: 0; font-size: 14.5px; line-height: 1.55; }

/* ---- My ads, inside the shared dashboard rail (.dash-wrap in directory.css) ---- */
.sp-dash .dash-main { display: grid; gap: 18px; padding-top: 32px; }
.sp-dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sp-dash-head h1 { margin: 0; font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -0.02em; }
.sp-dash-head .eyebrow { margin-bottom: 6px; }
.sp-dash .dir-dash { padding-bottom: 0; }
.sp-dash .dir-flash, .sp-dash .dir-error { margin: 0; justify-self: start; }
.dir-status.is-past_due { color: var(--chip-warn-fg); background: var(--chip-warn-bg); border-color: var(--chip-warn-line); }
.dir-status.is-rejected { color: var(--chip-bad-fg); background: var(--chip-bad-bg); border-color: var(--chip-bad-line); }

/* ---- rails like TrustMRR: tall tinted cards that fill the side, rotating slots flip ---- */
@media (min-width: 1500px) {
  .sp-rail { height: calc(100vh - 128px); }
  .sp-rail .sp-card { flex: 1 1 0; min-height: 132px; max-height: 260px; perspective: 800px; }
  .sp-rail .sp-open-slot { border-style: dashed; background: transparent; color: var(--text-dim); }
  .sp-rail .sp-open-slot:hover { border-color: var(--accent); background: var(--accent-soft); }
  .sp-rail .sp-open-slot strong { color: var(--text); }
}
.sp-card.tint-0 { --tint: #3b82f6; }
.sp-card.tint-1 { --tint: #8b5cf6; }
.sp-card.tint-2 { --tint: #10b981; }
.sp-card.tint-3 { --tint: #e11d48; }
.sp-card.tint-4 { --tint: #f59e0b; }
.sp-card.tint-5 { --tint: #06b6d4; }
.sp-rail .sp-card[class*='tint-'] { background: color-mix(in srgb, var(--tint) 11%, var(--bg-panel)); border-color: color-mix(in srgb, var(--tint) 28%, var(--line)); }
.sp-rail .sp-card[class*='tint-']:hover { background: color-mix(in srgb, var(--tint) 17%, var(--bg-panel)); }
/* The flip: a quarter turn out, the new card in, a quarter turn back. */
.sp-card.is-flip-out { transform: rotateX(90deg) !important; transition: transform .28s ease-in; }
.sp-card.is-flip-in { transform: rotateX(-90deg); }
.sp-card.is-flip-done { transform: none; transition: transform .28s ease-out; }
@media (prefers-reduced-motion: reduce) { .sp-card.is-flip-out, .sp-card.is-flip-done { transition: none; } }

/* ---- the dialog like TrustMRR's ---- */
.sp-dialog-head h2 { margin: 0; }
.sp-dialog-head p { margin: 4px 0 0; font-size: 14px; }
.sp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-tile { justify-items: center; text-align: center; padding: 14px 8px; }
.sp-tile-ic { display: grid; color: var(--text-dim); }
.sp-tile.is-accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.sp-tile.is-accent strong, .sp-tile.is-accent .sp-tile-ic { color: var(--accent); }
.sp-tile strong { font-family: inherit; font-size: 17px; letter-spacing: -0.01em; }
.sp-price-box { display: grid; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.sp-price-box .sp-prices { border: 0; }
@media (max-width: 420px) { .sp-tiles { grid-template-columns: 1fr; } }
