/* GSSE UI/UX v0.2 — Step 4 responsive QA, accessibility and deferred visual polish */

/* Global interaction/accessibility hardening */
:where(button, a, input, textarea) { min-width: 0; }
:where(button, a, input, textarea):focus-visible { outline: 3px solid rgba(20, 86, 160, .30); outline-offset: 3px; }
input:focus-visible { outline-offset: 1px; }
[aria-disabled="true"] { cursor: not-allowed; }

/* Page-first top-bar context is applied by qa-v04.js. Keep long context from crowding controls. */
.topbar > div:first-child { min-width: 0; }
.topbar-title, .topbar-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* STEP 4 deferred Bank polish: reduce hero footprint on desktop. */
@media (min-width: 1200px) {
  .bank-page { padding-top: 22px; }
  .bank-page .page-head { margin-bottom: 17px; }
  .bank-page .page-head h1 { max-width: 1020px; font-size: clamp(30px, 2.25vw, 36px); line-height: 1.08; }
  .bank-page .page-head p { max-width: 650px; margin-top: 7px; font-size: 12px; line-height: 1.5; }
  .bank-page .notice { margin-bottom: 15px; }
  .bank-blueprint { margin-bottom: 15px; }
}

/* Zero-count official disciplines stay visible as syllabus context, but are clearly unavailable in this fixture. */
.blueprint-card.qa-unavailable {
  opacity: .48;
  filter: saturate(.55);
  background: #f8fafc;
  box-shadow: none;
  cursor: not-allowed;
}
.blueprint-card.qa-unavailable:hover { border-color: var(--line); }
.blueprint-card.qa-unavailable b { color: #708198; }
.blueprint-card.qa-unavailable::after {
  content: "Not loaded in preview";
  grid-column: 1 / -1;
  width: fit-content;
  margin-top: 2px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #eef2f6;
  color: #718096;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* Better visual hierarchy in the Bank workspace. */
.bank-selection-strip strong, .builder-context-summary strong, .session-builder h2 { overflow-wrap: anywhere; }
.bank-workspace, .taxonomy-panel, .session-builder { min-width: 0; }
.bank-result-copy { min-width: 0; }
.bank-result h3, .bank-result p { overflow-wrap: anywhere; }

/* Home: recommendation is the actionable card, focus areas become supporting evidence rather than a duplicate hero. */
@media (min-width: 901px) {
  .home-v03-page { max-width: 1320px; }
  .home-v03-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); }
  .home-recommend-card { background: linear-gradient(145deg, #ffffff 0%, #f3faf9 100%); border-color: #cfe5e3; }
  .home-focus-card { background: #fbfcfe; }
  .home-focus-row { background: #fff; }
  .home-v03-head { margin-bottom: 18px; }
  .home-continue-card { padding-top: 22px; padding-bottom: 22px; }
}
.home-recommend-card .primary-btn { min-width: 170px; }

/* Touch target and control QA. */
@media (max-width: 1199px) {
  .side-link, .icon-btn, .filter-chip, .size-chip, .taxonomy-panel-actions button,
  .bank-filter-toggle, .bank-open, .study-flow-link, .study-bookmark,
  .primary-btn, .secondary-btn, .submit-btn, .save-note, .retry {
    min-height: 44px;
  }
  .tax-tree-row { min-height: 42px; }
  .tax-collapse-toggle { width: 34px; height: 34px; top: 4px; right: 29px; }
  .tax-tree-row-wrap.has-collapse > .tax-tree-row { padding-right: 68px; }
}

/* Landscape tablet / compact desktop: preserve usable working widths. */
@media (min-width: 901px) and (max-width: 1199px) {
  .page { padding-left: 22px; padding-right: 22px; }
  .bank-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .bank-controls { padding: 16px; }
  .question-card { min-width: 0; }
  .home-v03-metrics { gap: 10px; }
}

/* Portrait tablet: avoid over-dense cards and keep reading width controlled. */
@media (min-width: 768px) and (max-width: 900px) {
  .page { padding-left: 22px; padding-right: 22px; }
  .page-head h1 { max-width: 760px; }
  .bank-page .page-head h1 { font-size: 34px; }
  .bank-blueprint { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .blueprint-card { min-height: 105px; }
  .taxonomy-panel .tax-tree { max-height: 360px; }
  .context-pane { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-block:last-child { display: none; }
  .home-v03-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .home-metric-card { min-height: 116px; }
}

/* Mobile: compact hierarchy, readable text, safe wrapping, comfortable controls. */
@media (max-width: 767px) {
  body { overflow-x: hidden; }
  .page { width: 100%; overflow-x: clip; }
  .notice { font-size: 10px; }

  /* Bank is a working screen, not a marketing landing page. */
  .bank-page { padding-top: 15px; }
  .bank-page .page-head { gap: 0; margin-bottom: 12px; }
  .bank-page .page-head .eyebrow { font-size: 9px; }
  .bank-page .page-head h1 { max-width: 620px; margin-top: 5px; font-size: clamp(24px, 7vw, 28px); line-height: 1.08; }
  .bank-page .page-head p { max-width: 620px; margin-top: 7px; font-size: 11px; line-height: 1.45; }
  .bank-page .notice { margin-bottom: 11px; padding: 10px 11px; }

  /* Keep syllabus context visible without making the learner scroll through three large cards. */
  .bank-blueprint { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 11px; }
  .blueprint-card { min-height: 66px; padding: 10px 9px; border-radius: 12px; align-content: center; gap: 3px 6px; }
  .blueprint-card span { font-size: 9px; line-height: 1.15; }
  .blueprint-card b { font-size: 18px; line-height: 1; }
  .blueprint-card small, .blueprint-card.qa-unavailable::after { display: none; }

  .bank-selection-strip { gap: 8px; }
  .bank-selection-strip strong { max-width: 55vw; }
  .active-filter-summary { gap: 8px; }
  .bank-search input { min-height: 48px; font-size: 16px; } /* Prevent iOS zoom. */
  .filter-chip, .size-chip { padding-left: 13px; padding-right: 13px; }
  .tax-tree-row { min-height: 46px; }
  .bank-result { padding: 13px; }
  .bank-result h3 { font-size: 12px; }
  .session-builder h2 { font-size: 18px; }
  .builder-number { margin-top: 12px; }

  .home-v03-head p { font-size: 11px; line-height: 1.5; }
  .home-bank-action { width: 100%; }
  .home-continue-card { border-radius: 16px; }
  .home-continue-copy h2 { overflow-wrap: anywhere; }
  .home-recommend-note { font-size: 9px; }
  .home-recommend-card .primary-btn { width: 100%; }
  .home-focus-row { min-height: 58px; }

  .question-meta { align-items: flex-start; }
  .question-index { width: 100%; margin: 3px 0 0; }
  .answer-option { min-height: 58px; }
  .answer-copy { font-size: 13px; }
  .explanation-jump-nav button { min-height: 40px; }
  .study-flow-bar { scroll-margin-top: 70px; }
}

@media (max-width: 430px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .mobile-header { padding-left: 12px; padding-right: 12px; }
  .bank-selection-strip strong { max-width: 48vw; }
  .blueprint-card { padding-left: 8px; padding-right: 8px; }
  .blueprint-card span { font-size: 8.5px; }
  .blueprint-card b { font-size: 17px; }
  .home-v03-head h1 { font-size: 30px; }
  .home-recommend-main { gap: 10px; }
  .home-focus-row { gap: 10px; }
  .question-card, .explanation-main, .evidence-card, .notes-card, .concept-card { border-radius: 15px; }
}

@media (max-width: 375px) {
  .page { padding-left: 10px; padding-right: 10px; }
  .mobile-nav a { font-size: 8px; }
  .mobile-nav .side-icon { font-size: 16px; }
  .home-v03-head h1 { font-size: 28px; }
  .home-continue-copy h2 { font-size: 22px; }
  .bank-page .page-head h1 { font-size: 24px; }
  .bank-selection-strip { padding-left: 9px; padding-right: 9px; }
  .bank-selection-strip strong { max-width: 44vw; font-size: 11px; }
  .blueprint-card { min-height: 62px; padding: 8px 6px; }
  .blueprint-card span { font-size: 8px; }
  .blueprint-card b { font-size: 16px; }
  .study-flow-link, .study-bookmark { padding-left: 9px; padding-right: 9px; }
}

/* Keyboard users should always be able to see the active item. */
.tax-tree-row:focus-visible, .filter-chip:focus-visible, .size-chip:focus-visible,
.answer-option:focus-visible, .nav-dot:focus-visible, .confidence button:focus-visible,
.blueprint-card:focus-visible { position: relative; z-index: 3; }

/* Honour reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* Avoid hover-only affordances on touch devices. */
@media (hover: none) {
  .question-tile:hover { transform: none; }
}
