@import url("/fonts/fraunces-normal.css");
@import url("/fonts/fraunces-italic.css");

/* UI hierarchy shared by every screen. Keep this after the component styles.
   Reading content (flashcards, quiz questions, PDFs and the map canvas) has its
   own deliberate scale; interface roles must not depend on their parent page. */
:root {
  --font-ui: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ui-type-page: 28px;
  --ui-type-section: 20px;
  --ui-type-subsection: 16px;
  --ui-type-body: 14px;
  --ui-type-meta: 13px;
  --ui-type-caption: 12px;
  --ui-type-metric: 20px;
  --ui-type-display: 28px;
  --ui-weight-regular: 400;
  --ui-weight-control: 600;
  --ui-weight-heading: 700;
  --ui-weight-page: 700;
}

#app-shell .screen h1, #preferences-heading > h1,
#app-shell .screen .pause-title, .static-page h1, body.offline-review h1 {
  font-size: var(--ui-type-page); font-weight: var(--ui-weight-page);
  line-height: 1.25; letter-spacing: -.025em;
}
/* Page navigation focuses headings for screen readers. These are reading
   destinations, not controls: keep the native ring on interactive elements. */
#app-shell :is(h1, h2, h3, h4, h5, h6)[tabindex="-1"]:focus {
  outline: 0;
}
#app-shell .screen h2, #app-shell .screen .dialog-title,
.dialog-backdrop .dialog-title, .install-dialog h2, .mobile-menu h2, .static-page h2 {
  font-size: var(--ui-type-section); font-weight: var(--ui-weight-heading);
  line-height: 1.35; letter-spacing: -.015em;
}
#app-shell .screen h3 {
  font-size: var(--ui-type-subsection); font-weight: var(--ui-weight-heading);
  line-height: 1.4; letter-spacing: -.015em;
}
/* A guide has the same role in Home, Maps and Social, even inside a section
   with more specific heading rules. No page-specific guide sizes. */
#app-shell .screen .workflow-guide .workflow-guide-heading > h2 {
  font-size: var(--ui-type-section); font-weight: var(--ui-weight-heading);
  line-height: 1.35; letter-spacing: -.015em;
}
/* White and AI guide cards are regular; green starting points alone use
   emphasis. Nested audio options and interactive headings share one size. */
#app-shell .screen .workflow-guide .material-flow-node :is(h3, strong) {
  font-size: var(--ui-type-subsection); font-weight: var(--ui-weight-regular);
  line-height: 1.4; letter-spacing: -.015em;
}
#app-shell .screen .workflow-guide .material-flow-node.workflow-start > :is(h3, strong) {
  font-weight: var(--ui-weight-heading);
}
#app-shell .screen .workflow-guide .material-flow-node :is(h3, strong) > .workflow-node-button {
  font: inherit; letter-spacing: inherit; line-height: inherit;
}
#app-shell .screen .workflow-guide :is(p, .workflow-guide-note, .material-flow-audio-steps span) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-regular); line-height: 1.55;
}

/* Button size is a spacing choice. btn-sm must not make its label smaller or
   lighter than the same action elsewhere. Controls inside reading content are
   treated separately below so answers and map objects retain their own style. */
#app-shell .screen :is(.btn, .btn-sm, .btn-big, .link-btn, .opt-btn, .side-btn, .preset),
#app-shell .screen .social-tabs button,
.dialog-backdrop :is(.btn, .link-btn), .install-dialog .btn,
#mobile-menu :is(.btn, .link-btn) {
  font-family: var(--font-ui); font-size: var(--ui-type-body);
  font-weight: var(--ui-weight-control); line-height: 1.4;
}
#app-shell .screen :is(.btn, .opt-btn, .side-btn) :is(b, strong) { font-weight: inherit; }
#app-shell .screen .opt-btn b { font-size: var(--ui-type-body); }
#app-shell .screen .opt-btn span {
  font-size: var(--ui-type-meta); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
#app-shell .screen :is(label, legend, .opt-label, .toggle-name),
.dialog-backdrop label, .install-dialog label {
  font-family: var(--font-ui); font-size: var(--ui-type-body);
  font-weight: var(--ui-weight-control); line-height: 1.4;
}
#app-shell .screen :is(.social-check, .card-import-check, .lesson-transcribe-choice) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
#app-shell .screen :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea:not(.map-text-editor)),
.dialog-backdrop :is(input, select, textarea) {
  font-family: var(--font-ui); font-size: var(--ui-type-body);
  font-weight: var(--ui-weight-regular); line-height: 1.55;
}
#app-shell .screen :is(.lede, .account-copy, .help-topic-body, .material-choice-content > p,
 .file-upload-panel > p, .data-settings-panel > p, .reset-progress-note,
 .dialog-desc, .card-import-complete > p, .shared-intro p) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-regular); line-height: 1.65;
}
#app-shell .screen :is(.toggle-desc, .simple-details-note, .card-import-note, .quiz-note,
 .map-hint, .lesson-tip, .lesson-text-status, .help-muted, .scope-note, .drop-feedback,
 .drop-sub, .type-desc, .block-meta, .project-meta, .loading-sub, .loading-hint,
 .loading-bar-note, .lesson-step-heading p, .lesson-local-box p, .lesson-archive > p,
 .lesson-entry small, .reset-progress-status, .storage-meter) {
  font-size: var(--ui-type-meta); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
#app-shell .screen :is(.simple-details > summary, .help-topic > summary,
 .settings-data-management > summary, .account-profile summary) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-control); line-height: 1.45;
}
#app-shell #social-blocked-details > summary {
  font-size: var(--ui-type-section); font-weight: var(--ui-weight-heading); line-height: 1.35;
}
#app-shell .screen :is(.type-name, .drop-title, .verdict-title, .study-cta-title,
 .gap-report-title, .exam-plan-title, .quiz-feedback > strong, .progress-empty > strong) {
  font-size: var(--ui-type-subsection); font-weight: var(--ui-weight-heading); line-height: 1.4;
}
#app-shell #screen-materials .project-title,
#app-shell .screen .project-title,
#app-shell #screen-data .data-settings-panel > h3 {
  font-size: var(--ui-type-section); font-weight: var(--ui-weight-heading); line-height: 1.35;
}
#app-shell .screen :is(.pill, .section-label, .eyebrow, .qa-src, .trash-card-origin,
 .type-formats, .home-support-label, .stat-label, .pause-lbl) {
  font-size: var(--ui-type-caption); line-height: 1.5;
}
#app-shell .screen .eyebrow:has(> .link-btn) { font-size: var(--ui-type-body); }
#app-shell .screen :where(strong, b) { font-weight: var(--ui-weight-heading); }
#app-shell .screen :is(.loading-text, .session-time-copy > strong) {
  font-size: var(--ui-type-subsection); font-weight: var(--ui-weight-heading); line-height: 1.4;
}
#app-shell .screen #pdf-explanations-page { font-size: var(--ui-type-caption); line-height: 1.5; }
#app-shell .screen :is(.stat-num, .pause-num, .checkpoint-stats strong,
 .lesson-clocks time, .an-num, .concept-n, .box-count, .exam-plan-num) {
  font-size: var(--ui-type-metric); font-weight: var(--ui-weight-heading);
  line-height: 1.3; font-variant-numeric: tabular-nums;
}
#app-shell .screen :is(.session-donut-center strong, .paywall-price, .hero-num, .dual-num) {
  font-size: var(--ui-type-display); font-weight: var(--ui-weight-heading);
  line-height: 1.3; font-variant-numeric: tabular-nums;
}

/* Study typography: content is intentionally larger than interface labels.
   Keep original typography of user-authored map objects and PDF pages. */
#app-shell #screen-quizzes #quiz-question {
  font-size: clamp(22px, 2.1vw, 28px); font-weight: var(--ui-weight-regular); line-height: 1.5;
}
#app-shell #screen-concept-map #map-quiz-question {
  font-size: clamp(22px, 2.1vw, 28px); font-weight: var(--ui-weight-regular); line-height: 1.5;
}
#app-shell #screen-quizzes .quiz-option { font-weight: var(--ui-weight-regular); line-height: 1.55; }
#app-shell #screen-quizzes .quiz-option > span:first-child { font-weight: var(--ui-weight-page); }
#app-shell #screen-study .face-text { font-weight: var(--ui-weight-regular); line-height: 1.55; }
#app-shell .screen :is(.face-text, [data-user-content]) :is(strong, b) { font-weight: 700; }
#app-shell #screen-study :is(.round-head, .round-head b) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-control); line-height: 1.4;
}
#app-shell #screen-study :is(.face-kicker, .face-hint, [data-sound-status]) {
  font-size: var(--ui-type-meta); line-height: 1.5;
}
#app-shell #screen-study .study-sound label { font-size: var(--ui-type-meta); }

@media (max-width: 769px) {
  #app-shell .screen :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea:not(.map-text-editor)),
  .dialog-backdrop :is(input, select, textarea) { font-size: var(--ui-type-subsection); }
}

/* Offline review and informational pages use the same UI scale. Offline
   questions and answers retain the larger flashcard reading size. */
body { font-family: var(--font-ui); font-optical-sizing: auto; }
body.offline-review { font-family: var(--font-ui); font-size: var(--ui-type-body); line-height: 1.65; }
body.offline-review :is(button, select, label, main > a), .static-page .btn {
  font-family: var(--font-ui); font-size: var(--ui-type-body);
  font-weight: var(--ui-weight-control); line-height: 1.4;
}
body.offline-review :is(.note, [data-sound-status], #offline-counter) {
  font-size: var(--ui-type-meta); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
body.offline-review :is(#offline-question, #offline-answer) {
  font-size: clamp(22px, 2.1vw, 30px); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
.static-page p, .static-page li { font-size: var(--ui-type-body); line-height: 1.65; }
.install-card strong { font-size: var(--ui-type-subsection); font-weight: var(--ui-weight-heading); line-height: 1.4; }
.install-card .btn { font-size: var(--ui-type-body); font-weight: var(--ui-weight-control); line-height: 1.4; }
.app-startup-card strong { font-size: var(--ui-type-section); font-weight: var(--ui-weight-heading); line-height: 1.35; }
@media (max-width: 769px) {
  body.offline-review select { font-size: var(--ui-type-subsection); }
}

/* Brand uses the heavier end of the variable family. */
#app-shell .topbar .logo {font-family:var(--font-ui);font-weight:800;}
#app-shell #screen-block #detail-project-name {font-weight:var(--ui-weight-heading);}

/* White content panels use regular headings at their existing hierarchy.
   Audio steps (including the optional AI step) follow the same scale. */
#app-shell .screen .panel:not(.ai-feature) > :is(h2,h3),
#app-shell #screen-lessons .panel :is(h2,h3) {
  font-weight: var(--ui-weight-regular);
}
#app-shell #screen-lessons .panel h2 {
  font-size: var(--ui-type-section); line-height: 1.35; letter-spacing: -.015em;
}
#app-shell #screen-lessons .panel h3 {
  font-size: var(--ui-type-subsection); line-height: 1.4; letter-spacing: -.015em;
}
#app-shell #screen-lessons :is(.panel,.lesson-privacy) p:not([role="status"]):not([role="alert"]):not(.lesson-text-status):not(.quiz-note):not(.lesson-tip) {
  font-size: var(--ui-type-body); font-weight: var(--ui-weight-regular); line-height: 1.55;
}
