/* KensScan Discover — styled after the KensScan Supporters banner: cyan → blue → indigo,
   dark navy text on bright buttons, soft blue glow. Text colour and font come from the theme. */
.ksd {
  --ksd-c1: #67e8f9;   /* cyan   */
  --ksd-c2: #60a5fa;   /* blue   */
  --ksd-c3: #818cf8;   /* indigo */
  --ksd-ink: #0a1230;  /* text on the bright gradient */
  --ksd-accent: var(--ksd-c2);
  --ksd-grad: linear-gradient(110deg, var(--ksd-c1), var(--ksd-c2) 45%, var(--ksd-c3) 75%, var(--ksd-c1));
  --ksd-line: rgba(103, 232, 249, .22);
  --ksd-soft: rgba(96, 165, 250, .12);
  --ksd-glow: 0 0 18px rgba(56, 189, 248, .35);
  --ksd-gap: 20px;
  margin: 24px 0; scroll-margin-top: 80px;
}
.ksd *, .ksd *::before, .ksd *::after { box-sizing: border-box; }

@keyframes ksd-flow { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.ksd-tab[aria-current="true"], .ksd-next {
  background-image: var(--ksd-grad); background-size: 250% 100%;
  animation: ksd-flow 6s ease-in-out infinite alternate;
}

/* ---- top bar ---- */
.ksd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 20px; }
.ksd-heading { margin: 0; font-size: 20px; line-height: 28px; font-weight: 700; flex: 1 1 auto; }

.ksd-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--ksd-line); border-radius: 999px;
  box-shadow: inset 0 0 12px rgba(56, 189, 248, .08); }
.ksd-tab { display: inline-flex; align-items: center; min-height: 32px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: inherit; text-decoration: none; opacity: .72;
  transition: background-color .15s ease, opacity .15s ease, box-shadow .2s ease; }
.ksd-tab:hover { opacity: 1; background-color: var(--ksd-soft); }
.ksd-tab[aria-current="true"] { opacity: 1; color: var(--ksd-ink); font-weight: 600; box-shadow: var(--ksd-glow); }

/* ---- pager (top and bottom) ---- */
.ksd-pager { display: flex; align-items: center; gap: 8px; }
.ksd-range { font-size: 14px; opacity: .7; font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: 4px; }
.ksd-arrow { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px;
  padding: 0 10px; border: 1px solid var(--ksd-line); border-radius: 999px; color: inherit; text-decoration: none;
  font-size: 14px; font-weight: 600; transition: background-color .15s ease, box-shadow .2s ease, transform .15s ease; }
.ksd-arrow svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.25;
  stroke-linecap: round; stroke-linejoin: round; }
.ksd-arrow:hover { background-color: var(--ksd-soft); }
.ksd-next { border-color: transparent; color: var(--ksd-ink); box-shadow: var(--ksd-glow); }
.ksd-next:hover { box-shadow: 0 0 26px rgba(56, 189, 248, .55); transform: translateX(2px); }
.ksd-arrow[aria-disabled="true"] { opacity: .3; pointer-events: none; background-image: none; animation: none;
  box-shadow: none; border-color: var(--ksd-line); color: inherit; }
.ksd a:focus-visible { outline: 2px solid var(--ksd-c1); outline-offset: 2px; }

.ksd-foot { display: flex; justify-content: center; margin-top: 32px; }
.ksd-pager-bottom .ksd-next { padding: 0 14px 0 20px; }

/* ---- grid + cards ---- */
.ksd-grid { display: grid; gap: var(--ksd-gap) 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  transition: opacity .15s ease; }
.ksd.is-loading .ksd-grid { opacity: .4; }
.ksd-card { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; min-width: 0; }
.ksd-cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden;
  background: var(--ksd-soft); box-shadow: 0 0 0 1px rgba(255, 255, 255, .04);
  transition: box-shadow .2s ease, transform .2s ease; }
.ksd-card:hover .ksd-cover { transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, .55), 0 10px 28px rgba(59, 130, 246, .28); }
.ksd-img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .25s ease; }
.ksd-card:hover .ksd-img { transform: scale(1.04); }
/* landscape covers: whole picture, centred, over a blurred copy of itself */
/* zoomed in: the middle of the picture fills ~60% of the card height (sides are trimmed a little) */
.ksd-cover.is-wide .ksd-img { position: absolute; left: 0; top: 20%; height: 60%; object-fit: cover;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.ksd-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(14px) brightness(.7); transform: scale(1.2); }

.ksd-title { margin-top: 4px; font-size: 14px; line-height: 20px; font-weight: 600; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ksd-genres { display: flex; flex-wrap: wrap; gap: 4px; max-height: 44px; overflow: hidden; }
.ksd-genres:empty { display: none; }
.ksd-chip { flex: none; padding: 1px 8px; border: 1px solid rgba(96, 165, 250, .35); border-radius: 999px;
  background: rgba(96, 165, 250, .10); font-size: 11px; line-height: 16px; white-space: nowrap; opacity: .9; }
.ksd-meta { display: flex; gap: 12px; margin-top: auto; padding-top: 2px; font-size: 12px; line-height: 16px;
  font-weight: 600; font-variant-numeric: tabular-nums; }
/* same cyan-blue as the buttons, bright enough to read on the dark background */
.ksd-stat { display: inline-flex; align-items: center; gap: 4px; color: #a5e9ff; }
.ksd-stat svg { width: 14px; height: 14px; fill: none; stroke: var(--ksd-c1); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.ksd-short { display: none; }
.ksd-upd { opacity: .85; white-space: nowrap; }
.ksd-upd.is-fresh { opacity: 1; color: #fff; padding: 0 7px; border-radius: 999px; background-image: var(--ksd-grad);
  background-size: 250% 100%; color: var(--ksd-ink); font-weight: 700; animation: ksd-flow 6s ease-in-out infinite alternate; }
.ksd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ksd-empty { opacity: .7; }

/* ---- phones ---- */
@media (max-width: 640px) {
  .ksd { --ksd-gap: 16px; }
  .ksd-heading { flex-basis: 100%; font-size: 18px; }
  .ksd-tabs { flex-basis: 100%; }
  .ksd-tab { flex: 1 1 0; justify-content: center; padding: 0 6px; font-size: 13px; white-space: nowrap; }
  .ksd-long { display: none; }
  .ksd-short { display: inline; }
  .ksd-pager-top { margin-left: auto; }
  .ksd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .ksd-title { font-size: 14px; line-height: 20px; }
  .ksd-chip { font-size: 11px; padding: 0 7px; }
  .ksd-chip:nth-child(n+3) { display: none; }
  .ksd-meta { gap: 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ksd-tab[aria-current="true"], .ksd-next, .ksd-upd.is-fresh { animation: none; }
  .ksd-grid, .ksd-img, .ksd-cover, .ksd-tab, .ksd-arrow { transition: none; }
  .ksd-card:hover .ksd-img, .ksd-card:hover .ksd-cover, .ksd-next:hover { transform: none; }
}
