/* One width for pages of text and lists (course, unit theory, legal texts), centred in their column. */
:root {
  --page-text: 860px;
}

/* Base styles on top of tokens.css (D-66). Components keep their own styles in *.razor.css. */

:root {
  color-scheme: dark;
}

[data-theme=light],
[data-theme=blush],
[data-theme=lavender] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* FocusOnNavigate moves focus to the page heading so screen readers announce the new page;
   that focus is programmatic, so the heading gets no focus ring. */
[tabindex="-1"]:focus {
  outline: none;
}

/* Spanish text is always Serif, numbers and dates Mono (tokens.css). */
.es,
[lang=es] {
  font-family: var(--font-serif);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-muted);
  font-weight: var(--quiet-weight);
}

.dim {
  color: var(--text-dim);
  font-weight: var(--quiet-weight);
}

/* Labels are Russian: Sans, as the rest of the interface (IBM Plex Mono has no Cyrillic). */
.label-caps {
  font: 500 11.5px var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* A labelled select or input of the settings and the profile (the TextField component styles its own). */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  color: var(--text-muted);
}

.field input,
.field select {
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: 400 16px var(--font-sans);
}

.field input:focus-visible,
.field select:focus-visible {
  outline: none;
  border: 1.5px solid var(--accent);
}

/* Blazor start-up and error UI */

.loading-progress {
  position: absolute;
  display: block;
  width: 6rem;
  height: 6rem;
  inset: 30vh 0 auto 0;
  margin: 0 auto;
}

.loading-progress circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.4rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1000;
  padding: 12px 48px 14px 16px;
  background: var(--bad-wash);
  border-top: 1px solid var(--bad-line);
  color: var(--text);
}

#blazor-error-ui .dismiss {
  position: absolute;
  right: 8px;
  top: 4px;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  background: none;
  cursor: pointer;
}

.blazor-error-boundary {
  padding: 16px;
  border: 1px solid var(--bad-line);
  border-radius: var(--radius-m);
  background: var(--bad-wash);
}

.validation-message {
  color: var(--bad);
  font-size: 13px;
}

/* Long text rendered from Markdown: legal pages and theory sections (spec 10.2). */

.prose {
  color: var(--text-body);
  font-size: 16.5px;
  line-height: 1.6;
}

.prose h2 {
  margin: 28px 0 8px;
  color: var(--text);
  font-size: 19px;
}

.prose h3 {
  margin: 20px 0 6px;
  color: var(--text);
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 12px;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li + li {
  margin-top: 4px;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

/* Theory (mock-up Theory): Spanish in italics is set in the serif, tables are cards that scroll on a phone, the "remember" note is framed. */

.prose em {
  font-family: var(--font-serif);
  color: var(--text);
}

/* As wide as its content (no empty frame to the right), scrolled sideways on a narrow screen. */
.prose table {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 4px 0 16px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 9px 28px;
  text-align: left;
  vertical-align: baseline;
  border-top: 1px solid var(--border);
}

/* A phone: narrower cells, so a table of three or four columns scrolls less. */
@media (max-width: 599.98px) {
  .prose th,
  .prose td {
    padding: 8px 12px;
  }
}

/* The header row as large as the cells, set apart by weight. */
.prose thead th {
  border-top: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

/* As wide as its content: a short note or a table gets a frame around it, a long text still fills the line. */
.prose blockquote {
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  color: var(--text);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose blockquote > p:first-child > strong:first-child {
  display: block;
  margin-bottom: 6px;
  font: 500 11px var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* In-section exercises (mock-up Exercises): one card each, right in green, wrong in red. */

.exercise {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exercise .head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.exercise .label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exercise .aside {
  text-align: right;
}

.exercise .prompt {
  margin: 0;
  font-size: 15px;
  color: var(--text-body);
}

.exercise .prompt:lang(es) {
  font: 400 18px var(--font-serif);
  color: var(--text);
}

.exercise .options,
.exercise .pairs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.exercise .option,
.exercise .pair,
.exercise .fragment,
.exercise .word {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: 400 17px var(--font-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.exercise .pair:not(:lang(es)) {
  font: 400 15px var(--font-sans);
}

.exercise button:disabled {
  cursor: default;
}

.exercise .right {
  border-color: var(--ok-line);
  background: var(--ok-wash);
}

.exercise .right .mark {
  color: var(--ok);
}

.exercise .wrong,
.exercise .missed {
  border-color: var(--bad-line);
  background: var(--bad-wash);
}

.exercise .wrong .mark {
  color: var(--bad);
}

.exercise .faded {
  color: var(--text-muted);
}

.exercise .selected {
  border: 1.5px solid var(--accent);
  background: var(--accent-wash);
}

.exercise .pair.right {
  color: var(--text-muted);
}

.exercise .fragments,
.exercise .bank,
.exercise .line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exercise .fragment {
  border-color: transparent;
  color: var(--text-muted);
  padding: 0 8px;
}

.exercise .fragment:not(:disabled):hover {
  border-color: var(--line);
}

.exercise .fragment.error {
  border-color: var(--bad-line);
  background: var(--bad-wash);
  color: var(--text);
  text-decoration: line-through;
  text-decoration-color: var(--bad);
}

.exercise .line {
  min-height: 48px;
  box-sizing: border-box;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.exercise .word.placed {
  border-color: transparent;
  background: var(--surface-raised);
}

.exercise .result {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-body);
}

.exercise .result .mark.right {
  display: flex;
  color: var(--ok);
  background: none;
  border: none;
}

.exercise .result .mark.wrong {
  display: flex;
  color: var(--bad);
  background: none;
  border: none;
}

.exercise .explanation {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* The question with a typed answer (D-137, js/typing.js): the session fills what is left above the keyboard. */
html.typing .session-layout {
  position: fixed;
  top: var(--visible-top, 0);
  right: 0;
  left: 0;
  height: var(--visible-height, 100dvh);
  min-height: 0;
}

html.keyboard-open {
  --actions-bottom: 8px;
}

/* A list with ticks: what the free version holds, what the paid course gives (D-217). */

.ticks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-body);
  font-size: 15px;
}

.ticks li {
  display: flex;
  gap: 8px;
}

.ticks li::before {
  content: '✓';
  color: var(--ok);
  font-weight: 700;
}
