/* ==========================================================================
   Topic wise PYQ page — page head, PYQ switch, topic navigator (paper switch +
   chips, sticky rail on desktop), paper blocks, topic cards, FAQ accordion.
   Requires tokens.css + base.css. Mobile-first (base = 360px).
   ========================================================================== */

/* Page head ------------------------------------------------------------ */
.page-head { padding-block: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.page-head__inner { display: grid; gap: var(--s-3); }
.page-head__text { display: grid; gap: var(--s-2); min-width: 0; }
.page-head__kicker {
  font-family: var(--ff-display);
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-red-text);
}
.page-head__title { font-size: var(--fs-h1); }
.page-head__intro { max-width: 70ch; color: var(--c-text-muted); }

/* Sign up / Sign in block and the signed-in line: same values as copies.css
   (.page-head__actions, .auth-cta*, .auth-status*, .link-btn); see SHARED_REQUESTS item 5 */
.page-head__actions { min-width: 0; }
.auth-cta { display: grid; gap: var(--s-1); }
.auth-cta__buttons { display: flex; gap: var(--s-2); }
.auth-cta__buttons .btn { flex: 1 1 0; min-width: 0; }
.auth-cta__note { color: var(--c-text-muted); font-size: var(--fs-sm); }
.auth-cta[hidden] { display: none; }
.auth-status { font-size: var(--fs-base); color: var(--c-text); }
.auth-status__email { font-weight: 700; }
.link-btn {
  display: inline;
  padding: 0;
  font: inherit;
  color: var(--c-link-text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.link-btn:hover { color: var(--c-slate); }

/* Breadcrumb */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0 var(--s-1); font-size: var(--fs-sm); color: var(--c-text-muted); }
.crumbs li + li::before { content: "\203A"; margin-right: var(--s-1); color: var(--c-text-muted); }
.crumbs a { color: var(--c-link-text); text-decoration: none; display: inline-flex; align-items: center; min-height: 28px; }
.crumbs a:hover { text-decoration: underline; }

/* PYQ switch: Year wise | Topic wise | Solved (links only; current page is filled) */
.pyq-switch { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.pyq-switch__link {
  flex: 1 1 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0 var(--s-2);
  font-family: var(--ff-display);
  font-size: 1rem;
  color: var(--c-slate);
  background: var(--c-white);
  border: 1px solid var(--c-slate);
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  transition: background var(--ease), color var(--ease);
}
.pyq-switch__link:hover { background: var(--c-surface); color: var(--c-charcoal); }
.pyq-switch__link[aria-current="page"] { background: var(--c-slate); color: var(--c-white); }
@media (min-width: 640px) {
  .pyq-switch__link { flex: 0 1 auto; }
}
@media (min-width: 960px) {
  .page-head { padding-block: var(--s-4) var(--s-5); }
  .page-head__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "crumbs crumbs" "text actions" "switch switch";
    column-gap: var(--s-6);
    row-gap: var(--s-3);
  }
  .page-head__inner > .crumbs { grid-area: crumbs; }
  .page-head__text { grid-area: text; }
  .page-head__actions { grid-area: actions; align-self: start; justify-self: end; width: 280px; padding-top: var(--s-1); }
  .page-head__inner > .pyq-switch { grid-area: switch; }
  .auth-cta__buttons { flex-direction: column; }
  .auth-cta__note, .auth-status { text-align: left; }
}

/* Layout: navigator above the cards; sticky left rail from 960px --------- */
.tw-body { padding-block: var(--s-4) var(--section-pad); }
.tw-layout { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
.tw-content { display: grid; gap: var(--s-5); min-width: 0; }
@media (min-width: 960px) {
  .tw-body { padding-block: var(--s-5) var(--section-pad); }
  .tw-layout { grid-template-columns: 288px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
  .tw-nav { position: sticky; top: var(--s-3); }
  .tw-content { gap: var(--s-6); }
}

/* Navigator ------------------------------------------------------------ */
.tw-nav {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  scroll-margin-top: var(--s-2);
}
.tw-nav__label {
  font-family: var(--ff-display);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}
.tw-nav__tg { font-size: var(--fs-sm); color: var(--c-text-muted); padding-top: var(--s-1); border-top: 1px solid var(--c-line); }
.tw-nav__tg a { display: inline-flex; align-items: center; min-height: var(--tap-min); font-weight: 700; }

/* Paper switch: segmented control, equal thirds */
.tw-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}
.tw-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0 var(--s-1);
  font-family: var(--ff-display);
  font-size: 1rem;
  color: var(--c-slate);
  border-radius: var(--radius-sm);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease);
}
.tw-switch__btn:hover { background: var(--c-surface); color: var(--c-charcoal); }
.tw-switch__btn[aria-current="true"] { background: var(--c-charcoal); color: var(--c-white); }

/* Chips: topic links in the navigator, sub-topic labels inside cards */
.tw-chips { display: grid; gap: var(--s-1); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tw-chip {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: var(--s-1) 0.75rem;
  font-size: var(--fs-base);
  line-height: 1.3;
  color: var(--c-text);
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
a.tw-chip:hover { border-color: var(--c-slate); color: var(--c-slate); }
.tw-chip--plain { background: var(--c-surface); color: var(--c-text-muted); min-height: 36px; }
.tw-chip--file { border-color: var(--c-slate); }
/* gated file buttons (<button data-copy-id>): the same look signed in or out */
button.tw-file { cursor: pointer; text-align: left; }
button.tw-chip--file:hover { border-color: var(--c-slate); color: var(--c-slate); }
/* sub-topic chips size to their text and wrap like tags */
.tw-chips--sub { display: flex; flex-wrap: wrap; }
.tw-chips--sub > li { max-width: 100%; }
@media (min-width: 640px) {
  .tw-chips--nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .tw-chips--nav { grid-template-columns: minmax(0, 1fr); } /* one column in the rail */
}

/* Paper filter: the switch adds data-show on the layout; content stays in the HTML */
.tw-layout[data-show="paper-1"] [data-paper="paper-2"],
.tw-layout[data-show="paper-2"] [data-paper="paper-1"] { display: none; }

/* Book card (store link, first in the content column) ------------------ */
.tw-book { gap: var(--s-2); }
.tw-book__img { width: 120px; height: auto; border-radius: var(--radius-sm); }
.tw-book__text { display: grid; gap: var(--s-1); min-width: 0; }
.tw-book__title { font-size: var(--fs-h3); }
.tw-book__line { font-family: var(--ff-display); font-size: 1.125rem; color: var(--c-red-text); }
.tw-book__hint { font-size: var(--fs-sm); }
.tw-book__foot { margin-top: 0; }
.tw-book__cta { width: 100%; }
@media (min-width: 640px) {
  .tw-book { flex-direction: row; align-items: center; gap: var(--s-3); }
  .tw-book__text { flex: 1 1 auto; }
  .tw-book__foot { flex: 0 0 auto; }
  .tw-book__cta { width: auto; }
}

/* Paper blocks -------------------------------------------------------- */
.tw-paper { display: grid; gap: var(--s-3); scroll-margin-top: var(--s-2); }
.tw-paper__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 3px solid var(--c-red);
}
.tw-paper__title { font-size: var(--fs-h2); }
.tw-paper__meta { color: var(--c-text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.tw-section { display: grid; gap: var(--s-2); }
.tw-section__label {
  font-family: var(--ff-display);
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}
.tw-grid { gap: var(--s-3); }
@media (min-width: 960px) {
  .tw-paper { gap: var(--s-4); }
  .tw-grid { gap: var(--s-3); }
}

/* Topic card ------------------------------------------------------------ */
.tw-topic { scroll-margin-top: var(--s-2); }
.tw-topic__meta { font-size: var(--fs-sm); color: var(--c-text-muted); }
.tw-topic__note { color: var(--c-text-muted); }
.tw-sub { display: grid; gap: var(--s-1); }
.tw-sub__label { font-size: var(--fs-sm); font-weight: 700; color: var(--c-text); }
.tw-topic__foot { gap: var(--s-1) var(--s-2); }
.tw-topic__cta { flex: 1 1 100%; }
.tw-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.tw-topic__ask { color: var(--c-link-text); }
.tw-topic__ask:hover { color: var(--c-slate); }
.tw-topic__back {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  text-decoration: none;
}
.tw-topic__back::before { content: "\2191"; margin-right: 0.35em; }
.tw-topic__back:hover { color: var(--c-slate); text-decoration: underline; }
@media (min-width: 640px) {
  .tw-topic__cta { flex: 0 1 auto; }
}
@media (min-width: 960px) {
  .tw-topic__back { display: none; } /* the rail is always in view on desktop */
}

/* FAQ accordion (native details) ---------------------------------------- */
.faq-list { display: grid; gap: var(--s-2); max-width: 820px; margin-inline: auto; }
.faq {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: var(--tap-min);
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover .faq__title { color: var(--c-charcoal); }
.faq__title { font-size: var(--fs-h3); text-wrap: pretty; }
.faq__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  position: relative;
  border: 1px solid var(--c-slate);
  border-radius: 50%;
}
.faq__icon::before,
.faq__icon::after {
  content: "";
  position: absolute; /* icon lines only, not layout */
  left: 50%; top: 50%;
  width: 12px; height: 2px;
  background: var(--c-slate);
  transform: translate(-50%, -50%);
  transition: transform var(--ease);
}
.faq__icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq[open] .faq__icon::after { transform: translate(-50%, -50%) rotate(0); }
.faq__a { padding: 0 var(--s-3) var(--s-3); color: var(--c-text-muted); display: grid; gap: var(--s-2); }
.faq__links a { display: inline-flex; align-items: center; min-height: var(--tap-min); }

/* Close ----------------------------------------------------------------- */
.tw-close { justify-content: center; }
