/* Shared reading scale and component contracts. Loaded after page compositions. */
:root {
  --ui-body: 1rem;
  --ui-label: .875rem;
  --ui-meta: .75rem;
  --ui-muted: #556171;
  --ui-soft: #647082;
  --ui-radius: 8px;
}
:is(.hsdt-page, .showcase-page, .code-lab-page, .ai-lab-page) {
  --type-body: var(--ui-body);
  --type-small: var(--ui-label);
  --type-meta: var(--ui-meta);
  --showcase-type-body: var(--ui-body);
  --showcase-type-small: var(--ui-label);
  --showcase-type-meta: var(--ui-meta);
  --institute-type-body: var(--ui-body);
  --institute-type-small: var(--ui-label);
  --institute-type-meta: var(--ui-meta);
  --ai-type-body: var(--ui-body);
  --ai-type-ui: var(--ui-label);
  --ai-type-meta: var(--ui-meta);
  --lab-type-ui: var(--ui-label);
  --lab-type-meta: var(--ui-meta);
  --text-soft: var(--ui-soft);
  --text-faint: var(--ui-soft);
  --showcase-text-soft: var(--ui-soft);
  --showcase-text-faint: var(--ui-soft);
  --ai-text-soft: var(--ui-soft);
  --lab-text-soft: var(--ui-soft);
}
:is(.hsdt-page, .showcase-page) :is(h1, h2, h3) { min-width: 0; overflow-wrap: anywhere; text-wrap: pretty; }
:is(.hsdt-page, .showcase-page) :is(input, textarea, select) { font-size: 1rem; }
:is(.hsdt-page, .showcase-page) :is(.hero-lead, .section-intro > p, .editorial-heading > p, .showcase-hero-copy > p, .showcase-section-head > p, .institute-hero-copy > p, .science-display > p, .leadership-copy > p, .contact-copy > p, .project-focus-copy > p, .learning-engine-copy > p, .voice-stage blockquote > p, .faculty-heading > p) { font-size: var(--ui-body); line-height: 1.6; }
:is(.hsdt-page, .showcase-page) :focus-visible { outline: 3px solid #153bc6; outline-offset: 4px; }
:is(.hsdt-page, .showcase-page) :is(.program-display, .program-page-display, .showcase-crosslink, .project-reel-art) :focus-visible { outline-color: #c9ff42; }
:is(.hsdt-page, .showcase-page) section[id], #main-content { scroll-margin-top: calc(var(--app-header-height) + 24px); }
.showcase-page main { padding-top: var(--app-header-height); }
.ai-lab-page .ai-lab-shell, .code-lab-page .code-lab-shell { grid-template-rows: var(--app-header-height) minmax(0, 1fr) 34px; }

/* Buttons retain their surface colors under the page-level link reset. */
.showcase-page .showcase-primary, .hsdt-page .button-primary { background: #2457ff; color: #fff; }
.showcase-page .showcase-primary:hover, .hsdt-page .button-primary:hover { background: #153bc6; color: #fff; }
:is(.showcase-primary, .showcase-secondary, .button-primary, .button-ghost, .form-submit, .footer-contact-button) { min-height: 52px; border-radius: var(--ui-radius); font-size: var(--ui-label); }
.showcase-page .showcase-crosslink p { color: #f0f4ff; }
.showcase-page .showcase-crosslink > div > span { color: #c9ff42; }
.trajectory-output small { color: #eaffc0; }
:is(.programs-directory, .program-page-directory) li.is-active small { color: #fff; }
:is(.programs-directory, .program-page-directory) :is(li button strong, li button small, .program-page-levels button, .program-levels button) { font-size: var(--ui-label); }
:is(.programs-directory, .program-page-directory) li button small { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.programs-directory li.is-active button small { color: #153bc6; }
.programs-directory ol { overflow-y: auto; }
.programs-directory-progress > i { animation: none; width: 100%; }
.project-rail button { grid-template-columns: 24px minmax(0, 1fr); }
.project-rail button small { white-space: nowrap; }
.department-grid article > strong { overflow-wrap: anywhere; line-height: 1.08; }
.lab-sidebar-status strong { white-space: normal; overflow-wrap: anywhere; }
.lab-shortcuts { top: calc(var(--app-header-height) + 12px); max-height: calc(100dvh - var(--app-header-height) - 24px); overflow-y: auto; transition: transform .2s ease, opacity .2s ease; }
.lab-shortcuts header button { min-width: 44px; min-height: 44px; }

/* Grid children must shrink below the intrinsic width of long Russian words. */
:is(.program-display, .program-page-display) { grid-template-columns: minmax(0, 1fr); }
:is(.program-display, .program-page-display) > *,
:is(.program-display-body, .program-page-display-body) > *,
:is(.editorial-heading, .faculty-heading, .showcase-section-head, .institute-hero-copy) > * { min-width: 0; }
:is(.program-display-body, .program-page-display-body) { min-width: 0; width: 100%; }
:is(.program-display, .program-page-display) h3 { font-size: clamp(2rem, 3.7vw, 4.4rem); letter-spacing: -.045em; line-height: 1.08; overflow-wrap: anywhere; hyphens: auto; }
:is(.program-display-body, .program-page-display-body) > small { font-family: inherit; font-size: var(--ui-label); letter-spacing: 0; line-height: 1.45; text-transform: none; }
:is(.program-display, .program-page-display) > header { gap: 12px; flex-wrap: wrap; }
:is(.program-display, .program-page-display) > a { gap: 16px; font-size: var(--ui-label); }
:is(.program-display, .program-page-display) :is(dt, dd) { line-height: 1.5; overflow-wrap: anywhere; }
:is(.program-display, .program-page-display) dd { font-size: var(--ui-label); }

/* The path is a real grid: card height can grow without covering the next step. */
.trajectory-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: center; gap: 16px 28px; padding: 28px; overflow: hidden; }
.trajectory-stage .trajectory-axis { top: 35px; bottom: 35px; left: 50%; }
.trajectory-stage :is(.trajectory-origin, .trajectory-node, .trajectory-output) { position: relative; inset: auto; min-width: 0; width: 100%; padding: 14px 16px; box-shadow: 0 8px 24px rgba(31, 57, 130, .08); }
.trajectory-stage .trajectory-origin { grid-row: 1; grid-column: 1; }
.trajectory-stage .is-bachelor { grid-row: 2; grid-column: 2; }
.trajectory-stage .is-project { grid-row: 3; grid-column: 1; }
.trajectory-stage .is-master { grid-row: 4; grid-column: 2; }
.trajectory-stage .trajectory-output { grid-row: 5; grid-column: 1 / -1; justify-self: center; width: min(100%, 240px); text-align: center; }
.trajectory-stage :is(.trajectory-origin, .is-project)::after { width: 14px; right: -14px; }
.trajectory-stage :is(.is-bachelor, .is-master)::after { width: 14px; left: -14px; }
.trajectory-stage .trajectory-output::after { display: none; }
.trajectory-stage .trajectory-scan { display: none; }
.trajectory-map { min-height: 0; align-self: center; }
.trajectory-map > :is(header, footer) { flex-wrap: wrap; gap: 8px 16px; padding: 16px 24px; }
.trajectory-stage small { font-size: var(--ui-meta); line-height: 1.4; }
.trajectory-stage strong { font-size: var(--ui-label); overflow-wrap: anywhere; }

/* A quieter landing: retain content, reduce repeated framing and empty height. */
.hsdt-page { --section-space-top: clamp(60px, 5vw, 84px); --section-space-bottom: clamp(56px, 5vw, 80px); --content-space: clamp(56px, 5vw, 80px); }
.hsdt-page .editorial-heading { min-height: 0; padding-top: var(--section-space-top); padding-bottom: var(--section-space-bottom); }
.hsdt-page .faculty-section { padding-top: var(--section-space-top); padding-bottom: var(--section-space-bottom); }
.hsdt-page .faculty-heading { margin-bottom: 44px; }
.hsdt-page .leadership-principles { display: none; }
.hsdt-page .leadership-file { grid-template-columns: minmax(220px, .45fr) minmax(0, 1fr); min-height: 0; margin-bottom: 0; }
.hsdt-page .leadership-portrait { min-height: 380px; }
.hsdt-page .leadership-copy { padding: clamp(28px, 4vw, 56px); }
.hsdt-page .leadership-copy h3 { font-size: clamp(2rem, 3.6vw, 3.6rem); line-height: 1.08; }
.hsdt-page .hero-code-streams { opacity: .4; }
.hsdt-page .hero-syntax-field { opacity: .5; }
.hsdt-page .hero-terminal { box-shadow: 0 18px 50px rgba(17, 21, 31, .15); }
:is(.hsdt-page, .showcase-page) .footer-brand > a:first-child { display: block; max-width: 210px; }

/* Lab reading and actionable controls. */
:is(.ai-composer, .lab-ai-form) textarea { font-size: 1rem; line-height: 1.5; }
.lab-ai-panel { top: var(--app-header-height); grid-template-columns: minmax(0, 1fr); grid-template-rows: 60px auto auto minmax(0, 1fr) auto auto; }
.lab-ai-panel > * { min-width: 0; }
.lab-ai-form { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(72px, auto) minmax(50px, auto); }
.lab-ai-form > * { min-width: 0; }
.lab-ai-actions button :is(strong, small), .lab-ai-feed :is(p, strong) { overflow-wrap: anywhere; }
.lab-ai-head > button, .lab-ai-form button { min-width: 44px; min-height: 44px; }
.lab-ai-form > div > span { min-width: 0; }
:is(.ai-welcome-actions, .lab-ai-actions) button { min-height: 44px; }
.ai-chat-head > div { min-width: 0; flex-wrap: wrap; gap: 4px 8px; }
.ai-chat-head small { font-size: .75rem; }
.ai-chat-head strong { font-size: .875rem; }
.ai-chat-head [data-new-chat] { flex: 0 0 auto; font-size: .875rem; min-height: 48px; }
.ai-lab-shell[data-service-state="error"] .ai-online-dot { background: #b45309; box-shadow: none; }
.ai-lab-shell[data-service-state="error"] [data-model-state] { color: #9a3412; }
.ai-lab-shell[data-service-state="error"] [data-status] { background: #fff0df; color: #9a3412; }
.ai-lab-shell[data-service-state="idle"] .ai-online-dot { background: #8b95a3; box-shadow: none; }
.lab-explorer > header :is([data-new-file], [data-download-project]) { width: 36px; height: 36px; }
.lab-run-button { color: #fff !important; }
.lab-run-copy strong { color: #fff; }
.lab-run-copy small { color: #e5ecff; }
:is(.ai-statusbar, .lab-statusbar) { font-size: .75rem; }

@media (max-width: 1120px) {
  .showcase-page .showcase-hero-copy { min-height: 0; padding-top: 64px; padding-bottom: 52px; }
  :is(.programs-display-size-probe, .program-page-size-probe) { display: none; }
  :is(.program-page-display-stack, .programs-console) { min-height: 0; }
  .program-page-display { min-height: 580px; }
}
@media (max-width: 920px) {
  :is(.editorial-heading, .editorial-heading.is-reverse) { grid-template-columns: minmax(0, 1fr); }
  .hsdt-page .leadership-file { grid-template-columns: minmax(200px, .7fr) minmax(0, 1fr); }
}
@media (max-width: 620px) {
  :is(.hsdt-page, .showcase-page) :is(.hero-lead, .section-intro > p, .editorial-heading > p, .institute-hero-copy > p, .contact-copy > p) { font-size: 1rem; }
  .showcase-page :is(.showcase-hero h1, .institute-hero-copy h1) { font-size: clamp(2rem, 10.5vw, 3.75rem); font-weight: 700; line-height: 1.04; letter-spacing: -.055em; }
  .hsdt-page .hero-copy h1 { font-size: clamp(2.6rem, 13vw, 4.4rem); line-height: 1.03; letter-spacing: -.05em; }
  :is(.hsdt-page, .showcase-page) :is(.editorial-heading h2, .faculty-heading h2, .showcase-section-head h2, .section-intro h2, .showcase-crosslink h2) { font-size: clamp(1.9rem, 8.5vw, 3rem); line-height: 1.08; letter-spacing: -.045em; }
  :is(.program-display, .program-page-display) h3 { font-size: clamp(1.65rem, 7vw, 2.65rem); line-height: 1.12; letter-spacing: -.035em; }
  :is(.program-display, .program-page-display) { grid-template-rows: minmax(64px, auto) minmax(0, 1fr) minmax(68px, auto); min-height: 460px; }
  :is(.program-display, .program-page-display) > header { padding: 14px 20px; }
  :is(.program-display-body, .program-page-display-body) { padding: 28px 20px; }
  :is(.program-display, .program-page-display) dl { margin-top: 28px; }
  :is(.program-display, .program-page-display) > a { padding: 16px 20px; }
  .programs-directory { height: auto; max-height: none; grid-template-rows: auto auto auto 4px; }
  .programs-directory ol { grid-auto-rows: minmax(84px, auto); }
  .program-page-directory { min-height: 0; }
  .program-page-directory ol { max-height: 340px; overflow-y: auto; }
  .institute-page .institute-hero-copy { min-height: 0; padding-top: 48px; padding-bottom: 40px; }
  .showcase-hero-actions { margin-top: 28px; }
  .showcase-hero-stats { margin-top: 32px; }
  .showcase-hero-stats > div { min-height: 0; padding: 16px 0; }
  .showcase-hero-stats dt { font-size: 1.5rem; }
  .showcase-hero-stats dd { font-size: .875rem; }
  .trajectory-map { margin-bottom: 40px; grid-template-rows: auto auto auto; }
  .trajectory-stage { gap: 12px 20px; padding: 20px; }
  .trajectory-stage :is(.trajectory-origin, .trajectory-node, .trajectory-output) { padding: 12px; }
  .trajectory-stage :is(.trajectory-origin, .is-project)::after { width: 10px; right: -10px; }
  .trajectory-stage :is(.is-bachelor, .is-master)::after { width: 10px; left: -10px; }
  .hsdt-page :is(.section-intro, .editorial-heading) { min-height: 0; padding-top: 44px; padding-bottom: 36px; }
  .hsdt-page .section-intro :is(.project-deck, .learning-intro-engine, .community-merge) { display: none; }
  .department-grid article { min-height: 0; padding: 32px 20px; }
  .department-grid article > strong { margin-top: 36px; font-size: clamp(1.85rem, 8vw, 2.65rem); letter-spacing: -.045em; }
  .showcase-section-head { padding-right: var(--showcase-gutter); padding-left: var(--showcase-gutter); }
  .hsdt-page .leadership-file { grid-template-columns: minmax(0, 1fr); }
  .hsdt-page .leadership-portrait { min-height: 300px; }
  .hsdt-page .faculty-heading { margin-bottom: 32px; }
  .hsdt-page .faculty-section { padding-top: 44px; padding-bottom: 44px; }
  .hsdt-page .about-statement { font-size: clamp(1.5rem, 6.7vw, 1.9rem); line-height: 1.22; letter-spacing: -.035em; }
  .hsdt-page .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 24px; padding-bottom: 32px; }
  .hsdt-page .capability-card { min-height: 74px; padding-top: 12px; padding-bottom: 12px; }
  .hsdt-page .capability-card strong { font-size: 1.25rem; }
  .hsdt-page .contact-copy, .hsdt-page .contact-form { min-height: 0; padding-top: 40px; padding-bottom: 40px; }
  .hsdt-page .contact-word { font-size: clamp(3rem, 16vw, 5rem); }
  .ai-chat-head > div { display: grid; grid-template-columns: 8px minmax(0, 1fr); }
  .ai-chat-head small { grid-column: 2; }
  .ai-chat-head [data-new-chat] { padding: 12px; }
  .ai-welcome { padding: 24px 16px; }
  .ai-welcome h1 { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.08; letter-spacing: -.045em; }
  .ai-welcome-actions { gap: 8px; }
  .ai-welcome-actions button { padding: 10px 12px; }
  .ai-statusbar > span, .lab-statusbar > span { padding: 0 10px; }
  .lab-statusbar > span:first-child { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 800px) {
  .project-rail button { flex: 0 0 190px; }
  .team-outcome-strip > i { transform: none; font-size: 0; }
  .team-outcome-strip > i::before { content: "↓"; font-size: 1.125rem; }
}
@media (max-width: 380px) {
  .lab-ai-actions button { grid-template-columns: minmax(0, 1fr); }
  .lab-ai-actions button > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :is(.hsdt-page, .showcase-page) [data-reveal], .faculty-section { opacity: 1; transform: none; }
}
