/* =========================================================================
   Resources hub: prompts + AI agent skills
   Uses the shared cream/ink/sticker design tokens from app.css.
   ========================================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.res-library-body { background: var(--report-bg); }

/* ---------- Landing ------------------------------------------------------ */
.res-hub { padding: 56px 0 80px; }

.res-hub__head { max-width: 760px; }

.res-hub__head h1 { margin: 1rem 0 0.6rem; }

.res-hub__lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 62ch;
}

.res-hub__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 2.2rem 0 1.6rem;
}

.res-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 300px;
  padding: 2rem;
  color: var(--ink);
  text-decoration: none;
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.res-tile::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 190px;
  height: 190px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
}

.res-tile--prompts { background: var(--report-yellow); }
.res-tile--skills { background: var(--report-pink); }

.res-tile:hover,
.res-tile:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 5px 6px 0 var(--ink);
}

.res-tile__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--report-surface);
  box-shadow: var(--shadow-hard-sm);
  margin-bottom: 0.75rem;
}

.res-tile__eyebrow {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.res-tile__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.res-tile__desc {
  font-size: 1.02rem;
  max-width: 34ch;
}

.res-tile__meta {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
}

.res-tile__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.02rem;
}

.res-hub__note {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 72ch;
}

.res-hub__note a { color: var(--ink); font-weight: 700; }

/* ---------- Catalog ------------------------------------------------------ */
.res-catalog { padding: 32px 0 80px; }

.res-catalog__head { max-width: 760px; margin-bottom: 1.5rem; }
.res-catalog__head h1 { margin: 0.85rem 0 0.5rem; }
.res-catalog__lead { color: var(--muted); font-size: 1.05rem; margin: 0; }

.res-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 0.9rem;
  margin: 1.4rem 0 1rem;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.res-filterbar__search {
  display: flex;
  gap: 8px;
  flex: 1 1 320px;
  min-width: 0;
}

.res-filterbar__search input {
  flex: 1;
  min-width: 0;
  padding: 0.68rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: var(--report-surface-soft);
  border: var(--border);
  border-radius: 8px;
}

.res-filterbar__sort { display: flex; align-items: center; gap: 8px; }
.res-filterbar__sort label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.res-filterbar__sort select {
  padding: 0.62rem 0.7rem;
  font: inherit;
  background: var(--report-surface);
  border: var(--border);
  border-radius: 8px;
}

.res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.8rem;
}

.res-chip {
  padding: 0.32rem 0.8rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--report-surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
}

.res-chip:hover,
.res-chip:focus-visible { background: var(--report-surface-soft); }
.res-chip.is-active { background: var(--report-blue); }

.res-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.res-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard-sm);
}

.res-card__thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--report-surface-soft);
  border-bottom: 2px solid var(--ink);
  text-decoration: none;
}

.res-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.res-card__thumb--fallback { background: var(--accent, var(--report-yellow)); }

.res-card__thumb-mark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2.6rem;
  opacity: 0.55;
}

.res-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  padding: 1.15rem;
}

.res-card__tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.res-card__tag { font-size: 0.76rem; color: var(--muted); font-weight: 600; }

.res-card__title { font-size: 1.2rem; margin: 0; }
.res-card__title a { text-decoration: none; }
.res-card__title a:hover { text-decoration: underline; }

.res-card__desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.res-card__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.res-card__rating { display: inline-flex; align-items: center; gap: 5px; }

.res-card__count {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
}

.res-card__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 0.55rem;
}

.res-card__actions .btn { flex: 1; justify-content: center; }

.res-card__share,
.res-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: var(--report-surface);
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
}

.res-card__share:hover,
.res-icon-btn:hover { background: var(--report-yellow); }

/* ---------- Stars -------------------------------------------------------- */
.res-stars {
  position: relative;
  display: inline-block;
  font-size: 1.02rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #d8d2c4;
}
.res-stars--sm { font-size: 0.86rem; }

.res-stars__base { display: block; }
.res-stars__fill {
  position: absolute;
  inset: 0;
  width: var(--rating, 0%);
  overflow: hidden;
  white-space: nowrap;
  color: var(--report-warning);
}

/* ---------- Detail ------------------------------------------------------- */
.res-detail { padding: 30px 0 80px; }

.res-detail__hero { max-width: 850px; margin-bottom: 1.6rem; }
.res-detail__hero h1 { margin: 0.8rem 0 0.6rem; }
.res-detail__lead { color: var(--muted); font-size: 1.08rem; }

.res-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.res-detail__stat strong { color: var(--ink); font-family: var(--font-display); }

.res-detail__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 34px;
  align-items: start;
}

.res-detail__side { position: sticky; top: 24px; }

.res-block {
  padding: 1.5rem;
  margin-bottom: 1.4rem;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
}

.res-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.res-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  margin: 0 0 0.85rem;
  text-transform: uppercase;
}

.res-prose { color: var(--ink); }
.res-prose > :last-child { margin-bottom: 0; }
.res-prose h2, .res-prose h3 { margin-top: 1.2rem; }
.res-prose a { font-weight: 700; }

.res-note { color: var(--muted); font-size: 0.85rem; margin: 0.75rem 0 0; }

.res-prompt-code {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  color: #f4f1e8;
  background: var(--ink);
  border: var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.res-variables { display: flex; flex-wrap: wrap; gap: 8px; }
.res-variable {
  padding: 0.28rem 0.6rem;
  background: var(--lemonbg);
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-size: 0.8rem;
}

/* ---------- Action card / terminal -------------------------------------- */
.res-action-card {
  padding: 1.35rem;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}

.res-action-card__label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 0.8rem;
}

.res-action-card .btn--block { margin-bottom: 0.6rem; }

.res-action-card__note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.5rem 0 0.9rem;
}

.res-terminal {
  overflow: hidden;
  background: var(--report-surface-soft);
  border: var(--border);
  border-radius: 10px;
  margin-bottom: 0.8rem;
}

.res-terminal__bar {
  display: flex;
  gap: 6px;
  padding: 0.5rem 0.7rem;
  border-bottom: 2px solid var(--ink);
  background: var(--report-surface);
}

.res-terminal__bar span {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--report-pink);
}
.res-terminal__bar span:nth-child(2) { background: var(--report-yellow); }
.res-terminal__bar span:nth-child(3) { background: var(--report-lime); }

.res-terminal__code {
  margin: 0;
  padding: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.res-terminal__prompt { color: var(--report-success); font-weight: 700; }
.res-terminal__url { color: var(--report-blue); }

.res-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 1rem;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.94rem;
  text-decoration: none;
  cursor: pointer;
}

.res-install-btn:hover { transform: translate(1px, 1px); box-shadow: var(--shadow-hard-sm); }

.res-install-soon {
  padding: 0.85rem;
  margin-bottom: 0.8rem;
  background: var(--lemonbg);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 0.88rem;
}

.res-download-btn { margin-top: 0.6rem; }

/* ---------- Share -------------------------------------------------------- */
.res-share {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 2px dashed var(--ink);
}

.res-share__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.res-share__actions { display: flex; flex-wrap: wrap; gap: 6px; }

.res-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0.3rem 0.55rem;
  color: var(--ink);
  background: var(--report-surface);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.res-share__btn:hover { background: var(--report-yellow); }
.res-share__btn--native[hidden] { display: none; }

/* ---------- Rating ------------------------------------------------------- */
.res-rating__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 0.9rem;
}

.res-rating__number {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
}

.res-rating__count { color: var(--muted); font-size: 0.85rem; }

.res-rating__fieldset { border: 0; padding: 0; margin: 0; }
.res-rating__fieldset legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  padding: 0;
}

.res-rating__inputs {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 2px;
}

.res-rating__inputs input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.res-rating__inputs label {
  font-size: 1.8rem;
  line-height: 1;
  color: #d8d2c4;
  cursor: pointer;
  transition: color 0.12s ease;
}

.res-rating__inputs label:hover,
.res-rating__inputs label:hover ~ label,
.res-rating__inputs input:checked ~ label { color: var(--report-warning); }

.res-rating__inputs input:focus-visible + label {
  outline: 3px solid var(--report-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.res-rating__signin {
  display: inline-block;
  font-weight: 700;
  border-bottom: 2px solid var(--report-pink);
  text-decoration: none;
}

/* ---------- Gallery / lightbox ------------------------------------------ */
.res-gallery-section { margin-bottom: 1.4rem; }

.res-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.res-gallery__figure {
  margin: 0;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.res-gallery__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.res-gallery__button img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.res-gallery__figure figcaption {
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 2px solid var(--ink);
}

.res-lightbox {
  width: min(1000px, 92vw);
  padding: 0;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--report-surface);
  box-shadow: var(--shadow-hard);
}
.res-lightbox::backdrop { background: rgba(17, 17, 17, 0.7); }

.res-lightbox__inner { position: relative; padding: 1rem; }
.res-lightbox__inner img { max-height: 78vh; margin: 0 auto; object-fit: contain; }

.res-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--ink);
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.res-lightbox__caption {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}
.res-lightbox__caption:empty { display: none; }

/* ---------- Related AI idea / prompts ----------------------------------- */
.res-idea {
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.4rem;
  background: var(--cyanbg);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard-sm);
}

.res-idea__label {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  margin-bottom: 0.6rem;
  background: var(--report-teal);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.res-idea__title { font-size: 1.35rem; margin: 0 0 0.4rem; }
.res-idea__body { color: var(--ink); font-size: 0.94rem; }
.res-idea__link { font-weight: 800; }

.res-related {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.res-related__card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--report-surface-soft);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.res-related__card:hover { background: var(--lemonbg); }
.res-related__desc { color: var(--muted); font-size: 0.8rem; }

/* ---------- Empty / toast ----------------------------------------------- */
.res-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--report-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.res-empty h2 { margin-top: 0; }

.res-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: min(360px, calc(100vw - 40px));
  padding: 0.85rem 1.1rem;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-hard-sm);
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.res-toast.is-visible { opacity: 1; transform: translateY(0); }
.res-toast--error { background: var(--report-danger); border-color: var(--report-danger); }

/* ---------- Focus -------------------------------------------------------- */
.res-tile:focus-visible,
.res-chip:focus-visible,
.res-card a:focus-visible,
.res-card__share:focus-visible,
.res-share__btn:focus-visible,
.res-install-btn:focus-visible,
.res-gallery__button:focus-visible {
  outline: 3px solid var(--report-blue);
  outline-offset: 3px;
}

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 1024px) {
  .res-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-detail__layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
  .res-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .res-hub__tiles { grid-template-columns: 1fr; }
  .res-detail__layout { grid-template-columns: 1fr; }
  .res-detail__side { position: static; }
  .res-related { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .res-hub { padding: 36px 0 56px; }
  .res-card-grid { grid-template-columns: 1fr; }
  .res-gallery { grid-template-columns: 1fr; }
  .res-filterbar { flex-direction: column; align-items: stretch; }
  .res-filterbar__sort { justify-content: space-between; }
  .res-tile { min-height: 250px; padding: 1.4rem; }
  .res-tile__title { font-size: 2.1rem; }
  .res-block { padding: 1.1rem; }
  .res-share__copy-label { display: none; }
}
