/* Visual Suspect — homepage Resources mega-menu (replaces the LATEST NEWS
   blog grid inside the News section). Loaded on site/index.html only, by
   inject_resources.py. Pure CSS interaction: the red highlight lives on the
   featured card by default and migrates to whichever card is hovered or
   keyboard-focused (gradient painted on ::before so opacity can animate —
   background-image itself never tweens). Browsers without :has() degrade to
   "featured stays red, hovered card also turns red". */

.vs-resources {
  --vsr-red: #D20000;
  --vsr-red-2: #A50000;
  --vsr-red-hi: #ff2e2e;
  --vsr-ink: #131517;
  --vsr-frame: #33363a;
  --vsr-card-a: #24272a;
  --vsr-card-b: #17191b;
  --vsr-line: rgba(255, 255, 255, 0.13);
  --vsr-ease: cubic-bezier(.22, .61, .36, 1);
  --vsr-font: "Montserrat", "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
  max-width: 1580px;
  margin: 0 auto;
  padding: 30px 28px 100px;
  font-family: var(--vsr-font);
  background: #fff;
}

/* ------------------------------------------------------------ header */
.vs-res-head { text-align: center; }

.vs-res-kicker {
  margin: 0 0 6px;
  color: var(--vsr-red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .38em;
  text-indent: .38em; /* re-centers letterspaced text */
  text-transform: uppercase;
}

.vs-resources .vs-res-title {
  margin: 4px 0 0;
  color: #101114;
  font-family: var(--vsr-font);
  font-size: 80px; /* match the theme .section-title (ALWAYS ORIGINALS) */
  font-weight: 800;
  letter-spacing: .015em;
  line-height: 1.02;
  text-transform: uppercase;
}

.vs-res-rule {
  display: block;
  width: 88px;
  height: 3px;
  margin: 26px auto 24px;
  background: var(--vsr-red);
}

.vs-res-lead {
  max-width: 660px;
  margin: 0 auto;
  color: #4a4f54;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
}

/* ------------------------------------------------------------ panel */
.vs-res-panel {
  display: grid;
  grid-template-columns: 1.22fr 1.02fr 1fr 1fr 1fr;
  gap: 12px;
  min-height: 372px;
  margin-top: 42px;
  padding: 12px;
  border-radius: 26px;
  background: var(--vsr-frame);
  box-shadow:
    0 80px 150px -38px rgba(0, 0, 0, 0.58),
    0 36px 70px -28px rgba(0, 0, 0, 0.42),
    0 14px 30px -14px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.vs-res-stack {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  min-width: 0;
}

/* ------------------------------------------------------------- cards */
.vs-res-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding: 20px 22px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(168deg, var(--vsr-card-a), var(--vsr-card-b));
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  transition: transform .3s var(--vsr-ease), box-shadow .3s var(--vsr-ease);
}
.vs-res-card,
.vs-res-card:hover,
.vs-res-card:focus,
.vs-res-card:active { color: #fff; }

/* the migrating red coat */
.vs-res-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(158deg, var(--vsr-red-hi) -18%, var(--vsr-red) 42%, var(--vsr-red-2) 108%);
  opacity: 0;
  transition: opacity .32s var(--vsr-ease);
}

/* diagonal stripes, top right */
.vs-res-card::after {
  content: "";
  position: absolute;
  top: -14%;
  right: -3%;
  z-index: 1;
  width: 46%;
  height: 74%;
  background:
    linear-gradient(#fff, #fff) 0% 0% / 17% 100% no-repeat,
    linear-gradient(#fff, #fff) 44% 0% / 11% 76% no-repeat,
    linear-gradient(#fff, #fff) 78% 0% / 8% 54% no-repeat;
  border-radius: 4px;
  transform: skewX(-24deg);
  opacity: .05;
  pointer-events: none;
  transition: opacity .32s var(--vsr-ease);
}

.vs-res-card > * { position: relative; z-index: 2; }

.vs-res-card:hover,
.vs-res-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 26px 50px -22px rgba(0, 0, 0, 0.65);
}
.vs-res-card:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* red-state plumbing: featured wears the coat by default; any hovered or
   focused card takes it; the featured card yields while another is lit */
.vs-res-featured::before { opacity: 1; }
.vs-res-featured::after { opacity: .34; }
.vs-res-card:hover::before,
.vs-res-card:focus-visible::before { opacity: 1; }
.vs-res-card:hover::after,
.vs-res-card:focus-visible::after { opacity: .34; }
.vs-res-panel:has(.vs-res-card:not(.vs-res-featured):hover) .vs-res-featured:not(:hover)::before,
.vs-res-panel:has(.vs-res-card:not(.vs-res-featured):focus-visible) .vs-res-featured:not(:focus-visible)::before { opacity: 0; }
.vs-res-panel:has(.vs-res-card:not(.vs-res-featured):hover) .vs-res-featured:not(:hover)::after,
.vs-res-panel:has(.vs-res-card:not(.vs-res-featured):focus-visible) .vs-res-featured:not(:focus-visible)::after { opacity: .05; }

/* -------------------------------------------------------- card copy */
.vs-res-card-kick {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.vs-res-card-name {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: .005em;
}
.vs-res-featured .vs-res-card-name { font-size: clamp(21px, 1.7vw, 27px); }
.vs-res-mini .vs-res-card-name { font-size: 18px; }

.vs-res-card-note {
  margin-top: 10px;
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
}

.vs-res-mini { justify-content: center; }

/* -------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .vs-res-panel {
    grid-template-columns: 1.3fr 1fr;
    min-height: 0;
  }
  .vs-res-featured { min-height: 280px; }
  .vs-res-tall { min-height: 150px; }
}

@media (max-width: 640px) {
  .vs-resources { padding: 22px 16px 70px; }
  .vs-res-panel {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 10px;
    border-radius: 22px;
  }
  .vs-res-stack { gap: 10px; }
  .vs-res-featured { min-height: 230px; }
  .vs-res-tall { min-height: 120px; }
  .vs-res-mini { min-height: 78px; }
  .vs-res-card { padding: 18px 20px; }
  .vs-res-lead { font-size: 16px; }
  /* keep RESOURCES on one line on narrow phones */
  .vs-resources .vs-res-title { font-size: clamp(30px, 10.5vw, 46px); }
}

@media (prefers-reduced-motion: reduce) {
  .vs-res-card,
  .vs-res-card::before,
  .vs-res-card::after,
  .vs-res-pick summary svg { transition: none; }
  .vs-res-card:hover, .vs-res-card:focus-visible { transform: none; }
}
