/* The AR/EN shell (shell/document.ts, ADR-PLAT-03): what the shell adds to PLAT-UI's navigation pieces
 * (components.css): the entry layout, the language switch, the person menu and the focus-mode extras.
 * Tokens and logical properties only (scripts/css-lint.ts). Unlayered on purpose: page CSS sits above the
 * component layer (base.css). */

/* ---------- Language switch: the other language by its own name ---------- */
.shell-lang {
  gap: var(--space-1-5);
  padding-inline: var(--space-3);
  border-radius: var(--radius-full);
  color: var(--color-text);
  font-size: var(--text-label);
  line-height: var(--lh-label);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-fast) var(--ease-standard);
}
.shell-lang:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.shell-lang [lang="en"] { font-family: var(--font-latin); }

/* ---------- Entry layout: signed-out pages, under the document's own header ---------- */
/* The header holds the brand and the language switch, both 44 px targets. At 200% text on a phone the switch
 * drops under the brand instead of pushing the page sideways (WCAG 1.4.4, 1.4.10). */
.site-header { flex-wrap: wrap; }
.site-header > .brand-word { display: inline-flex; align-items: center; min-block-size: var(--target-min); }
/* The reference is one unbroken token; it may break anywhere rather than widen a narrow screen. */
.error-page .trace { overflow-wrap: anywhere; }
body:has(> .site-header) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-block-size: 100dvh;
}
body:has(> .site-header) > main { inline-size: 100%; padding-block: var(--space-4) var(--space-9); }

/* ---------- App layout: signed-in pages ---------- */
.shell-home bdi { white-space: nowrap; }
.app:not(:has(~ .bottom-nav)) > main { padding-block-end: var(--space-9); }
.topbar .shell-lang { padding-inline: var(--space-2); }

.shell-person { position: relative; }
.shell-person-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: var(--target-min);
  padding-inline: var(--space-1);
  border-radius: var(--radius-full);
  cursor: pointer;
  list-style: none;
}
.shell-person-summary::-webkit-details-marker { display: none; }
.shell-person-summary:hover { background: var(--color-surface-sunken); }
.shell-person-summary > .i { color: var(--color-text-muted); transition: transform var(--motion-fast) var(--ease-standard); }
.shell-person[open] .shell-person-summary > .i { transform: rotate(180deg); }
.shell-person-panel {
  z-index: 40;
  inset-inline-end: 0;
  inset-block-start: calc(100% + var(--space-1));
  max-inline-size: calc(100vw - 2 * var(--page-pad));
}
.shell-person-id { display: grid; gap: var(--space-0-5); padding: var(--space-2) var(--space-3) var(--space-3); margin-block-end: var(--space-1); border-block-end: var(--border-width) solid var(--color-border); }
.shell-person-id b { font-size: var(--text-label); line-height: var(--lh-label); font-weight: var(--weight-semibold); }
.shell-person-id span, .shell-person .who span { font-family: var(--font-latin); font-size: var(--text-latin-sm); color: var(--color-text-muted); overflow-wrap: anywhere; text-align: start; }
.shell-menu { list-style: none; margin: 0; padding: 0; }
.shell-menu form { margin: 0; }
.shell-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: var(--target-min);
  padding-inline: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--text-label);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.shell-menu-item:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.shell-menu-item .i { color: var(--color-text-muted); }

/* The rail's foot holds the language switch and the person card; the card's menu opens upwards. */
.rail .rail-foot { flex-direction: column; align-items: stretch; gap: var(--space-2); padding: 0; border: 0; }
.rail .shell-lang { justify-content: flex-start; border-radius: var(--radius-md); }
.shell-person[data-place="rail"] .shell-person-summary { gap: var(--space-3); padding: var(--space-3); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); }
.shell-person[data-place="rail"] .who { flex: 1; min-inline-size: 0; }
.shell-person[data-place="rail"] .who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.shell-person[data-place="rail"] .shell-person-panel { inset-block-start: auto; inset-block-end: calc(100% + var(--space-1)); inset-inline: 0; }

/* ---------- Focus layout: learning activities ---------- */
.shell-review {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--page-pad);
  background: var(--color-warning-soft);
  color: var(--color-on-warning-soft);
  font-size: var(--text-caption);
  line-height: var(--lh-caption);
}
/* FocusFrame.status: the head keeps the bar and the page's status (an exam's time left) in one sticky row; the bar
 * hands its stickiness and border to the head. The bar's basis grows with the text size, so with large text the
 * status moves to a line of its own instead of squeezing the title. */
.focus-head {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: var(--color-bg);
  border-block-end: var(--border-width) solid var(--color-border);
}
.focus-head > .focus-bar { position: static; flex: 1 1 calc(var(--text-label) * 14); min-inline-size: 0; border-block-end: 0; }
/* Label size like the bar's title, and even digits so a countdown does not shift as it runs. One line while it fits;
   never wider than the head, so longer copy wraps on its own line instead of running past the screen. */
.focus-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-inline-size: 100%;
  margin-inline-start: auto;
  padding-block: var(--space-1-5);
  padding-inline-end: var(--space-3);
  font-size: var(--text-label);
  line-height: var(--lh-label);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1024px) {
  .focus-status { padding-inline-end: var(--space-5); }
}
.shell-theatre .focus-head { background: var(--color-player-chrome); color: var(--color-on-player); border-color: transparent; }

/* FocusFrame.theatre: a dark surface around the player. The wrapper generates no box, so the bar stays sticky. */
.shell-theatre { display: contents; }
body:has(> .focus-page > .shell-theatre) { background: var(--color-player); color: var(--color-on-player); }
.shell-theatre .focus-bar { background: var(--color-player-chrome); color: var(--color-on-player); border-color: transparent; }
.shell-theatre .focus-bar .icon-btn { color: var(--color-on-player); }
.shell-theatre .focus-bar .icon-btn:hover { background: var(--color-player-hover); }
.shell-theatre .focus-bar .t > span { color: var(--color-on-player-muted); }

@media (prefers-reduced-motion: reduce) {
  .shell-lang, .shell-person-summary > .i { transition: none; }
}
