/* Physics Sensei Finder 1.0.1 — one look for every student hub.
 * Each hub sets --psf-accent (Reviews orange, Q&A light blue, Step by Step
 * blue, Practice green, Study Guides purple, Exam Prep red). */

.psf {
  --psf-accent: #4f86ec;
  /* Follow the Physics Sensei 5.0 tokens (light and dark mode), with fallbacks. */
  --psf-text: var(--ps-text, var(--psf-text));
  --psf-muted: var(--ps-text-muted, #5f6878);
  --psf-border: var(--ps-border, #dddddd);
  --psf-soft: var(--ps-surface-soft, #f8fafc);
  --psf-card: var(--ps-card, #ffffff);
  max-width: 1080px;
  margin: 0 auto;
  color: var(--psf-text);
  font-size: 16px;
  line-height: 1.45;
}
.psf *, .psf *::before, .psf *::after { box-sizing: border-box; }
.psf [hidden] { display: none !important; }

/* Search */
.psf-label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 15px;
}
.psf-field { position: relative; }
.psf-field svg {
  position: absolute; left: 14px; top: 50%;
  width: 20px; height: 20px; transform: translateY(-50%);
  fill: none; stroke: var(--psf-muted); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.psf .psf-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 44px 12px 44px;
  border: 2px solid var(--psf-border) !important;
  border-radius: 12px;
  background: var(--psf-card) !important;
  color: var(--psf-text) !important;
  -webkit-text-fill-color: var(--psf-text) !important;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.psf .psf-input:focus {
  outline: none;
  border-color: var(--psf-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--psf-accent) 22%, transparent);
}
.psf .psf-input::-webkit-search-cancel-button { display: none; }
.psf .psf-input::placeholder { color: var(--psf-muted) !important; -webkit-text-fill-color: var(--psf-muted) !important; opacity: 1; }
.psf-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--psf-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.psf-clear:hover, .psf-clear:focus-visible { background: var(--psf-soft); color: var(--psf-text); }

/* Topic buttons */
.psf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.psf .psf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 13px;
  border: 1px solid var(--psf-border); border-radius: 999px;
  background: var(--psf-card); color: var(--psf-text);
  font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.psf .psf-chip:hover, .psf .psf-chip:focus-visible { border-color: var(--psf-accent); }
.psf .psf-chip.is-active { background: var(--psf-accent); border-color: var(--psf-accent); color: #fff; }
.psf-chip-count { font-weight: 500; opacity: .75; font-size: 12px; }

.psf-status { margin: 10px 0 12px; color: var(--psf-muted); font-size: 14px; min-height: 1.4em; }

/* Topic groups (plain HTML <details>, so every link is in the page) */
.psf-groups { display: grid; gap: 12px; }
.psf-group { border: 1px solid var(--psf-border); border-radius: 12px; background: var(--psf-card); overflow: hidden; }
.psf-group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; cursor: pointer; list-style: none;
  background: var(--psf-soft); font-weight: 800; font-size: 17px;
  border-left: 4px solid var(--psf-accent);
}
.psf-group > summary::-webkit-details-marker { display: none; }
.psf-group > summary::after { content: '+'; font-weight: 700; color: var(--psf-muted); font-size: 20px; line-height: 1; }
.psf-group[open] > summary::after { content: '−'; }
.psf-group-title { flex: 1; }
.psf-group-count { color: var(--psf-muted); font-size: 13px; font-weight: 700; }

.psf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 14px;
}

/* Cards */
.psf-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--psf-border); border-radius: 10px; background: var(--psf-card);
}
.psf-card-head { display: flex; flex-direction: column; gap: 4px; }
.psf-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: color-mix(in srgb, var(--psf-accent) 70%, var(--psf-text));
}
.psf .psf-card-title { margin: 0; padding: 0; font-size: 18px; font-weight: 800; line-height: 1.3; color: var(--psf-text); }

.psf-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.psf .psf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--psf-accent) 45%, var(--psf-card));
  border-radius: 8px;
  background: color-mix(in srgb, var(--psf-accent) 9%, var(--psf-card));
  color: color-mix(in srgb, var(--psf-accent) 60%, var(--psf-text)) !important;
  font-size: 14px; font-weight: 700; line-height: 1.2;
  text-decoration: none !important;
}
.psf .psf-btn:hover, .psf .psf-btn:focus-visible { background: var(--psf-accent); border-color: var(--psf-accent); color: #fff !important; }

/* Review cards: Quick / Focused / Full rows, one button per level */
.psf-matrix { display: grid; gap: 8px; }
.psf-row { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: center; }
.psf-row .psf-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex-wrap: nowrap; }
.psf-cards:has(.psf-card-review) { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.psf-row-label { font-weight: 700; font-size: 14px; }
.psf-row-label small { display: block; font-weight: 500; color: var(--psf-muted); font-size: 12px; }
.psf-row .psf-btn { min-height: 34px; padding: 5px 6px; font-size: 13px; white-space: nowrap; }

/* Q&A cards: the whole card is the link */
.psf-card-link { padding: 0; }
.psf-card-link a {
  display: flex; flex-direction: column; gap: 4px; position: relative;
  padding: 14px 40px 14px 16px; color: inherit !important; text-decoration: none !important; border-radius: 10px;
}
.psf-card-link .psf-card-title { font-size: 16px; font-weight: 700; }
.psf-card-link .psf-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--psf-accent); font-weight: 800; }
.psf-card-link:hover { border-color: var(--psf-accent); }
.psf-card-link a:focus-visible { outline: 3px solid var(--psf-accent); outline-offset: 2px; }

/* Access badge */
.psf-lock {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
  margin-top: 2px; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--psf-accent) 12%, var(--psf-card));
  color: color-mix(in srgb, var(--psf-accent) 65%, var(--psf-text));
  font-size: 12px; font-weight: 700;
}
.psf-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Empty states */
.psf-empty, .psf-coming {
  padding: 18px 20px; border-radius: 12px; text-align: center;
  background: var(--psf-soft); border: 1px dashed var(--psf-border);
}
.psf-empty p, .psf-coming p { margin: 6px 0 0; padding: 0; }
.psf-coming .psf-lock { margin: 0 auto 6px; }
.psf-empty a { color: var(--psf-accent); font-weight: 700; }

@media (max-width: 600px) {
  .psf-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .psf-chips::-webkit-scrollbar { display: none; }
  .psf .psf-chip { flex: 0 0 auto; }
  .psf-cards { grid-template-columns: 1fr; padding: 10px; }
  .psf-cards:has(.psf-card-review) { grid-template-columns: 1fr; }
  .psf-row { grid-template-columns: 1fr; gap: 4px; }
  .psf-row-label small { display: inline; margin-left: 4px; }
  .psf-group > summary { padding: 12px 14px; font-size: 16px; }
}
