/* Japademy Level Assessment — LAYOUT ONLY.
 * Everything visual (buttons, tiles, chips, callouts, feedback, typography,
 * color) comes from the design system's UI kit (/v1/app.css, linked by the
 * page). This file only arranges those components for this tool. If you're
 * about to add a color, font or border here, it belongs in the design system
 * (japademy/design-system, project/ui/components.css) instead.
 *
 * Shell: header (fixed height) / main (the ONE scroll area) / footer (docked,
 * only while answer feedback shows). The full-height chain it relies on is in
 * the kit's ui/base.css ([data-jp-app]).
 */

/* This tool's own layout values (not design tokens). */
:root {
  --jpla-content-width: 540px;
  --jpla-gutter: var(--space-5);
  --jpla-gutter-narrow: var(--space-4);
}

.jpla-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header: [Back | Start over]  [progress, during a check]  [close, when embedded] */
.jpla-header {
  flex: none;
  padding: var(--space-2) var(--jpla-gutter);
}
.jpla-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--jpla-content-width);
  margin: 0 auto;
}
.jpla-header__back { margin-left: calc(var(--space-2) * -1); }
.jpla-header__spacer { flex: none; width: 1px; height: var(--tap-min); }
/* Stands in for the progress bar outside a check, keeping close on the right. */
.jpla-header__fill { flex: 1; }

/* Main: the only scroll container. min-height: 0 lets it shrink inside the
   flex column instead of pushing the footer off-screen. Gutter padding sits
   here, OUTSIDE the content's max-width, so content always gets the full
   width at every breakpoint. */
.jpla-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6) var(--jpla-gutter) var(--space-12);
}
.jpla-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: var(--jpla-content-width);
  margin: 0 auto;
}

/* Footer: docked answer feedback. */
.jpla-footer {
  flex: none;
  padding: var(--space-4) var(--jpla-gutter);
  border-top: 1px solid var(--divider);
  background: var(--surface-page);
}
.jpla-footer__inner {
  max-width: var(--jpla-content-width);
  margin: 0 auto;
}

/* Groups inside a screen */
.jpla-intro { display: flex; flex-direction: column; gap: var(--space-3); }
.jpla-intro p { margin: 0; }
.jpla-list { display: grid; gap: var(--space-4); }
.jpla-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.jpla-section { display: flex; flex-direction: column; gap: var(--space-3); }
/* Result sections: the reason and the level's description read at the same
   size as the lists below them (what you'll learn, what's included), so the
   bold section labels are what stands out. */
.jpla-section__lead {
  margin: 0;
  font-size: var(--text-app-small);
  color: var(--text-secondary);
}
.jpla-callout__label { margin-bottom: var(--space-3); }
.jpla-review { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.jpla-review > .jpla-list { align-self: stretch; }

/* Recommendation head: level badge beside the level name. */
.jpla-rec-head { display: flex; align-items: center; gap: var(--space-3); }

/* Quiz */
.jpla-quiz-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.jpla-quiz-meta__count {
  flex: none;
  font-family: var(--font-app-label);
  font-size: var(--text-app-small);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.jpla-quiz-instruction { font-size: var(--text-app-small); }
.jpla-prompt {
  margin: 0;
  font-size: var(--text-app-jp-prompt);
  line-height: 1.5;
  text-wrap: balance;
}
/* Programmatic focus targets (headings, the prompt) shouldn't show a ring
   when focus moved there for us; keyboard tabbing never lands on them. */
[data-focus="heading"]:focus, [data-focus="feedback"]:focus { outline: none; }

@media (max-width: 480px) { /* --breakpoint-sm */
  .jpla-header { padding-left: var(--jpla-gutter-narrow); padding-right: var(--jpla-gutter-narrow); }
  .jpla-main { padding: var(--space-5) var(--jpla-gutter-narrow) var(--space-10); }
  .jpla-footer { padding-left: var(--jpla-gutter-narrow); padding-right: var(--jpla-gutter-narrow); }
  .jpla-screen { gap: var(--space-5); }
}

/* Inside a site modal panel (the host passes ?panel=1 and the panel's
   padding, see engine.js): match the site's own modals. Their surface
   (Wild Sand #f6f6f6, with white cards on it), their
   padding, and their close button's position: a 32px X 16px from the top
   and right, so ours (a 44px target, --tap-min) is centred 32px in. The
   content fills the padded width instead of centring at 540px, so the Back
   link, the content and the footer all line up on the same edge. */
/* On the Wild Sand page, the kit's soft-grey fills (progress track,
   secondary buttons, neutral chips, default cards) would vanish into the
   background, so they become white, like the cards in the site's modals.
   If a second app ever needs this, move it to the design system as a
   "muted surface" scheme rather than copying it. */
[data-jp-panel] {
  --surface-page: var(--color-wild-sand);
  --surface-subtle: var(--surface-card);
  --surface-muted: var(--surface-card);
}
[data-jp-panel] .jpla-header {
  box-sizing: border-box;
  height: var(--jpla-panel-top);
  padding: calc(32px - var(--tap-min) / 2) calc(32px - var(--tap-min) / 2) 0 var(--jpla-panel-x);
}
[data-jp-panel] .jpla-header__inner,
[data-jp-panel] .jpla-screen,
[data-jp-panel] .jpla-footer__inner { max-width: none; }
[data-jp-panel] .jpla-main { padding: 0 var(--jpla-panel-x) var(--jpla-panel-bottom); }
[data-jp-panel] .jpla-footer { padding-left: var(--jpla-panel-x); padding-right: var(--jpla-panel-x); }
