/* ============================================================================
   Resources — page components (res-)

   Page-specific layout for the Resources hub and its sub-pages (tutorials,
   FAQ, PDK). Builds on css/wm-dark.css (tokens, bands, wm- primitives), loaded
   first by wm_header() via wm_theme('dark'). A res- component that turns out
   useful elsewhere should be promoted to css/wm-dark.css and renamed wm-.

   Loaded with a cache-busting query (controllers/resources.php passes
   css/resources-dark.css?v=N) — bump N when editing this file.
   ============================================================================ */

/* Section sub-heads get a little air above them. */
.res-head { margin-top: 32px; }

/* Horizontal rule between major sections. */
.res-rule {
  border: none;
  border-top: 1px solid var(--wm-divider);
  margin: 40px 0;
}

/* ---- Hub layout: content + cross-link rail ---- */
.res-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 44px;
  align-items: start;
  margin-top: 32px;
}
.res-main p { color: var(--wm-earth-200); }

.res-shot {
  display: block;
  margin: 8px 0 24px;
}
.res-shot img {
  display: block;
  width: 100%;
  max-width: 640px;
  border-radius: 6px;
  border: 1px solid var(--wm-earth-700);
}

/* ---- Cross-link rail (sidebar) ---- */
.res-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 88px;
}
.res-links { list-style: none; margin: 0; padding: 0; }
.res-links li { margin: 0 0 8px; }
.res-links li:last-child { margin-bottom: 0; }

/* ---- Tutorials: intro video block ---- */
.res-video {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 36px;
  align-items: start;
  margin-top: 24px;
}
.res-vidlist { margin: 0; padding-left: 20px; color: var(--wm-earth-200); }
.res-vidlist li { margin-bottom: 20px; }
.res-vidlist h3 { font-size: 20px; margin: 0 0 6px; }
.res-vidlist p { color: var(--wm-earth-300); margin: 0; }
.res-video__embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--wm-earth-700);
  background: var(--wm-earth-900);
}
.res-video__embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Tutorials: community entries ---- */
.res-tut { margin: 16px 0 24px; }
.res-tut p { color: var(--wm-earth-200); margin: 0 0 12px; }
.res-tut__name {
  font-family: var(--wm-font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 18px;
  color: var(--wm-earth-50);
  margin: 0 0 8px;
}
.res-tut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  margin-top: 8px;
}
.res-tut-grid .res-tut { margin: 0; }

/* ---- FAQ accordion (CSS-only) ---- */
.res-faq { max-width: 860px; }
.res-faq .wm-eyebrow { margin-top: 28px; }
.res-faq .wm-eyebrow:first-child { margin-top: 0; }

.res-faq__item {
  border: 1px solid var(--wm-earth-700);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 10px;
  overflow: hidden;
}
/* The toggle checkbox is the accordion state — visually hidden, still
   keyboard-focusable via its label. */
.res-faq__toggle {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.res-faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  font-family: var(--wm-font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 16px;
  color: var(--wm-earth-50);
  user-select: none;
}
.res-faq__q:hover { color: var(--wm-sand-gold); }
.res-faq__toggle:focus-visible + .res-faq__q {
  outline: 2px solid var(--wm-sand-gold);
  outline-offset: -2px;
}
.res-faq__chev {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--wm-earth-400);
  transition: transform 160ms ease;
}
.res-faq__toggle:checked + .res-faq__q .res-faq__chev { transform: rotate(180deg); }

/* Collapsible panel: grid-rows trick animates open/closed without JS. */
.res-faq__a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 200ms ease;
}
.res-faq__toggle:checked ~ .res-faq__a { grid-template-rows: 1fr; }
.res-faq__a-inner {
  overflow: hidden;
  padding: 0 20px;
}
.res-faq__toggle:checked ~ .res-faq__a .res-faq__a-inner { padding: 0 20px 18px; }
.res-faq__a-inner p { color: var(--wm-earth-200); margin: 0 0 12px; }
.res-faq__a-inner p:last-child { margin-bottom: 0; }
.res-faq__a-inner a { color: var(--wm-sand-gold); }
.res-faq__a-inner code {
  display: inline-block;
  word-break: break-word;
}

/* ---- PDK layout ---- */
/* Archival notice at the top of the (now unlinked) PDK page. */
.res-pdk__archive { margin-bottom: 28px; }

.res-pdk {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 28px;
}
.res-pdk__versions h3 { margin-bottom: 12px; }
.res-pdk__versions p { color: var(--wm-earth-300); margin-bottom: 14px; }
.res-pdk__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}
.res-pdk__list li { margin-bottom: 8px; color: var(--wm-earth-300); }
.res-pdk__list a { color: var(--wm-sand-gold); }
.res-pdk__side { position: sticky; top: 88px; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .res-layout,
  .res-video,
  .res-pdk { grid-template-columns: 1fr; gap: 28px; }
  .res-rail,
  .res-pdk__side { position: static; }
}
