/* Interior pages: content determines height, including enlarged Russian text.
   Loaded after shared decoration; homepage has its own layout contract. */
.showcase-page :is(h1, h2, h3, .department-grid article > strong,
  .team-format-grid strong) {
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.showcase-page main :is(p, small, strong, span, code, dt, dd) { overflow-wrap: anywhere; }
.showcase-page main :is(section, article, header, footer, nav, div) { min-width: 0; }
.showcase-page :is(.project-reel-card, .project-focus, .intake-display,
  .role-story, .faculty-focus, .faculty-directory) { grid-template-columns: minmax(0, 1fr); }
.showcase-page :is(.project-reel-copy, .team-directory-copy) { grid-template-columns: minmax(0, 1fr); }
.showcase-page :is(.showcase-hero, .institute-hero) {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding-block: clamp(40px, 5vw, 80px);
}
.showcase-page :is(.showcase-hero-copy, .institute-hero-copy) { padding-block: 24px; }
.showcase-page :is(.showcase-hero, .institute-hero) h1 {
  font-size: clamp(2.25rem, 5.7vw, 6.5rem);
  line-height: 1.08;
  letter-spacing: -.055em;
}
.showcase-page :is(.showcase-kicker, .institute-kicker) { min-width: 0; line-height: 1.5; }
.showcase-page .showcase-kicker > :is(span, i) { flex-shrink: 0; }
.showcase-page .showcase-kicker > span { width: auto; height: auto; min-width: 38px; min-height: 38px; padding: 8px; }
.showcase-page .showcase-kicker > strong { flex: 1 1 12rem; }
.showcase-page :is(.showcase-primary, .showcase-secondary,
  .showcase-crosslink > a, .institute-primary, .institute-secondary) {
  min-height: 52px;
  height: auto;
  padding: 16px 20px;
  gap: 16px;
  line-height: 1.45;
}
.showcase-page :is(.showcase-primary, .showcase-secondary, .showcase-crosslink > a) > i { flex: 0 0 auto; }
.showcase-page :is(.project-reel, .team-assembly, .trajectory-map, .academic-lead-card) {
  min-height: 0;
  height: auto;
  grid-template-rows: auto auto auto;
}
.showcase-page :is(.project-reel, .team-assembly, .trajectory-map, .academic-lead-card,
  .program-page-directory, .program-page-display, .intake-display) > :is(header, footer) {
  min-height: 56px;
  height: auto;
  padding: 16px 20px;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* The diagram keeps its rhythm without absolute offsets between text cards. */
.showcase-page .trajectory-stage {
  display: grid;
  min-height: 0;
  gap: 16px;
  padding: 24px;
}
.showcase-page :is(.trajectory-origin, .trajectory-node, .trajectory-output) {
  position: relative;
  inset: auto;
  width: 85%;
  min-width: 0;
  max-width: none;
  padding: 16px;
  border-radius: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.showcase-page :is(.trajectory-node.is-bachelor, .trajectory-node.is-master, .trajectory-output) { justify-self: end; }
.showcase-page :is(.trajectory-origin, .trajectory-node, .trajectory-output)::after { display: none; }
.showcase-page .program-page-directory { grid-template-rows: auto auto minmax(0, 1fr) 3px; }
.showcase-page .program-page-directory ol { overflow-y: auto; overscroll-behavior: contain; }
.showcase-page .program-page-levels { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.showcase-page .program-page-levels button { min-height: 48px; padding: 12px 8px; line-height: 1.4; }
.showcase-page .program-page-display { grid-template-rows: auto 1fr auto; }
.showcase-page .program-page-display > a { min-height: 64px; padding-block: 20px; }
.showcase-page .program-page-display dl { gap: 16px; }
.showcase-page .program-page-display dl div { padding-right: 0; border: 0; }
.showcase-page .program-page-display dl div:last-child { display: block; }
.showcase-page .program-page-display h3 { line-height: 1.15; }

/* Project card artwork and descriptions share normal document flow. */
.showcase-page .project-reel-stage { min-height: 0; padding: 8px 16px 24px 8px; }
.showcase-page .project-reel-card {
  position: relative;
  inset: auto;
  grid-template-rows: auto auto;
  border-radius: 16px;
}
.showcase-page .project-reel-art {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: 'meta meta' 'case case' 'mark mark' 'tech proof' 'route route';
  min-height: 0;
  gap: 20px;
  padding: 20px;
}
.showcase-page .project-reel-art::after { display: none; }
.showcase-page .project-reel-art > * { position: relative; inset: auto; min-width: 0; max-width: none; }
.showcase-page .project-reel-art-meta { grid-area: meta; flex-wrap: wrap; gap: 8px; }
.showcase-page .project-reel-case { grid-area: case; }
.showcase-page .project-reel-mark {
  grid-area: mark;
  font-size: clamp(2.5rem, 4.5vw, 5.5rem);
  line-height: 1.12;
  letter-spacing: -.04em;
  white-space: normal;
  overflow-wrap: anywhere;
}
.showcase-page .project-reel-tech { grid-area: tech; align-content: start; align-self: start; }
.showcase-page .project-reel-tech span { overflow-wrap: anywhere; }
.showcase-page .project-reel-proof { grid-area: proof; width: auto; min-height: 0; padding: 16px; align-content: start; box-shadow: 6px 6px 0 #c9ff42; }
.showcase-page .project-reel-proof > strong { margin-top: 16px; line-height: 1.2; }
.showcase-page .project-reel-route { grid-area: route; flex-wrap: wrap; padding: 14px; gap: 8px; line-height: 1.5; border-radius: 10px; }
.showcase-page .project-reel-copy { min-height: 0; padding: 24px 20px; gap: 14px; }
.showcase-page .project-reel-copy h2 { line-height: 1.16; }
.showcase-page .project-reel-copy p { display: block; max-height: none; overflow: visible; -webkit-line-clamp: unset; }
.showcase-page .project-reel-nav button { min-height: 48px; padding: 12px 4px; }
.showcase-page .project-reel > footer button { min-width: 44px; min-height: 44px; height: auto; padding: 12px; border-radius: 12px; }
.showcase-page .project-workbench { height: auto; min-height: 0; }
.showcase-page .project-feature-copy { min-height: 0; }
.showcase-page .intake-display { height: auto; min-height: 0; grid-template-rows: auto auto auto; }
.showcase-page .intake-display-copy h3 { line-height: 1.15; }
.showcase-page .intake-display > footer { display: flex; flex-wrap: wrap; }
.showcase-page .intake-routes { grid-template-rows: auto repeat(4, auto) 4px; }
.showcase-page .intake-routes > button { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; min-height: 88px; }
.showcase-page .intake-routes > button > span { min-width: 0; }
.showcase-page .project-passport { grid-template-rows: auto auto auto auto auto; }
.showcase-page .project-passport-metric { min-height: min-content; }
.showcase-page .project-passport-metric strong { line-height: 1.12; }
.showcase-page .project-rail button { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; }
.showcase-page .project-rail button small { white-space: normal; overflow-wrap: anywhere; }
.showcase-page .project-filter button { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 50px; height: auto; padding: 14px 18px; overflow-wrap: anywhere; }
.showcase-page .project-filter button > span { white-space: nowrap; }
.showcase-page .team-directory-profile { height: auto; min-height: 0; }
.showcase-page .team-directory-mark { gap: 24px; }
.showcase-page .team-directory-mark > i { font-size: clamp(3rem, 6vw, 7rem); line-height: 1.15; overflow-wrap: anywhere; }
.showcase-page .role-story > footer { grid-template-columns: minmax(0, 1fr); }
.showcase-page .faculty-focus { grid-template-rows: auto auto auto; }
.showcase-page .faculty-directory { grid-template-rows: auto auto 3px auto; }
.showcase-page :is(.faculty-focus, .faculty-directory) > :is(header, footer) { min-height: 58px; padding: 16px 24px; gap: 12px; flex-wrap: wrap; line-height: 1.5; }
.showcase-page .faculty-heading { align-items: start; }

.showcase-page .team-assembly { container-type: inline-size; }
.showcase-page .assembly-stage { min-height: 0; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; }
.showcase-page .assembly-caption { position: relative; inset: auto; grid-row: 1; }
.showcase-page .assembly-caption.is-output { justify-self: end; }
.showcase-page .assembly-layers { position: relative; inset: auto; display: grid; gap: 12px; grid-column: 1 / -1; }
.showcase-page .assembly-layer {
  position: relative;
  inset: auto;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 16px;
  margin-left: min(var(--inset), 8%);
  transform: none;
  border-radius: 12px;
  line-height: 1.5;
}
.showcase-page .assembly-layer > :is(span, strong, small) { grid-column: 1; min-width: 0; }
.showcase-page .assembly-layer > i { grid-column: 2; grid-row: 1 / 4; }
.showcase-page .assembly-layer.is-active { margin-left: 0; transform: none; }
.showcase-page .assembly-result { position: relative; inset: auto; grid-column: 1 / -1; width: 100%; min-width: 0; border-radius: 12px; line-height: 1.5; }
.showcase-page .assembly-result > small { grid-column: 1 / -1; grid-row: auto; font-size: .75rem; }
@container (min-width: 32rem) {
  .showcase-page .assembly-layer { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 12px; }
  .showcase-page .assembly-layer > :is(span, strong, small, i) { grid-column: auto; grid-row: auto; }
}
.showcase-page .academic-lead-body { min-width: 0; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); }
.showcase-page .academic-lead-copy { min-width: 0; overflow-wrap: anywhere; }
.showcase-page .team-format-grid article { min-width: 0; overflow-wrap: anywhere; }

/* Dialog content scrolls inside a comfortable inset, including short screens. */
.hsdt-app-header .hsdt-app-search { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
.experience-dialog[open] { padding: clamp(16px, 3vw, 32px); }
.experience-dialog > header { gap: 16px; margin-bottom: 20px; }
.experience-dialog h2 { line-height: 1.2; overflow-wrap: anywhere; }
.experience-dialog .dialog-body { padding: 6px; margin: -6px; }
.experience-dialog .practice-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.experience-dialog .practice-list button { overflow-wrap: anywhere; }
.experience-dialog .practice-detail h3 { line-height: 1.25; }
.experience-dialog .search-results { max-height: none; padding: 4px; }
.experience-dialog .search-results a { min-width: 0; overflow-wrap: anywhere; }
.experience-dialog .search-field input { min-height: 54px; height: auto; padding-block: 14px; }
.showcase-page .remove-compare { width: 44px; height: 44px; }
.code-lab-page :is(.lab-language-switch button, .lab-editor-tabs button,
  .lab-sidebar-head button, .lab-file, .lab-console-head button, .lab-ai-close,
  .lab-sidebar-toggle) { min-height: 44px; height: auto; }
.code-lab-page :is(.lab-editor-toolbar, .lab-editor-tabs, .lab-console-head) { height: auto; min-height: 48px; }
.ai-lab-page .ai-chat-head button { min-height: 44px; }
.ai-lab-page .ai-composer-actions button { min-width: 44px; width: 44px; height: 44px; }
.ai-lab-page .ai-welcome h1 { line-height: 1.15; }
.code-lab-page .lab-editor-panel { grid-template-rows: auto auto minmax(160px, 1fr) minmax(180px, auto); }
.code-lab-page .lab-editor-toolbar { flex-wrap: wrap; grid-template-rows: max-content max-content; gap: 12px; padding: 12px; }
.code-lab-page .lab-language-switch { flex-wrap: wrap; grid-auto-rows: max-content; min-width: 0; height: auto; }
.code-lab-page .lab-language-switch button { padding: 12px; line-height: 1.4; }
.code-lab-page .lab-run-controls { flex-wrap: wrap; gap: 10px; min-width: 0; }
.code-lab-page .lab-run-button { min-height: 48px; height: auto; padding-block: 12px; }
.code-lab-page .lab-file-actions button { min-width: 44px; min-height: 44px; height: auto; }
.code-lab-page .lab-explorer > header :is([data-new-file], [data-download-project]) { width: 44px; height: 44px; }
.code-lab-page .lab-file-name { white-space: nowrap; min-width: 0; }
.code-lab-page :is(.lab-file-create, .lab-file-rename) { grid-template-columns: 24px minmax(0, 1fr) 44px 44px; }
.code-lab-page :is(.lab-file-create, .lab-file-rename) > button { width: 44px; min-height: 44px; height: auto; }
.code-lab-page :is(.lab-file-create, .lab-file-rename) input { min-height: 44px; height: auto; padding: 10px; line-height: 1.4; }
.code-lab-page .lab-console { grid-template-rows: auto minmax(100px, 1fr); }
.code-lab-page .lab-console-head { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
.code-lab-page .lab-console-head > div { flex-wrap: wrap; gap: 12px; min-width: 0; }
.code-lab-page .lab-ai-context { min-height: 0; height: auto; grid-template-columns: minmax(0, 1fr); }
.code-lab-page .lab-ai-context strong { line-height: 1.5; overflow-wrap: anywhere; }
.code-lab-page .lab-ai-head { position: relative; }
.code-lab-page .lab-ai-head > div { min-width: 0; }
.code-lab-page .lab-ai-head strong { line-height: 1.3; overflow-wrap: anywhere; }
.code-lab-page .lab-ai-panel { grid-template-rows: repeat(3, max-content) minmax(100px, 1fr) max-content max-content; }

@media (max-width: 1199px) {
  .showcase-page :is(.showcase-hero, .institute-hero) { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .showcase-page :is(.showcase-hero, .institute-hero) h1 { max-width: 1000px; font-size: clamp(2.25rem, 7.5vw, 5rem); }
  .showcase-page :is(.project-reel, .team-assembly, .trajectory-map, .academic-lead-card) { width: calc(100% - 2 * var(--brand-gutter)); max-width: 780px; margin: 0; }
}
@media (max-width: 767px) {
  .code-lab-page { overflow: auto; }
  .code-lab-page .code-lab-shell { height: auto; min-height: 100dvh; grid-template-rows: var(--app-header-height) auto auto; }
  .code-lab-page .lab-workspace { height: auto; grid-template-rows: 140px auto; }
  .code-lab-page .lab-editor-panel { min-height: 640px; grid-template-rows: max-content max-content minmax(260px, 1fr) auto; }
  .showcase-page .faculty-heading { grid-template-columns: minmax(0, 1fr); }
  .showcase-page .faculty-heading > * { grid-column: 1; grid-row: auto; }
  .showcase-page :is(.faculty-board, .faculty-focus-stage, .department-grid,
    .team-directory-profile, .team-members-grid) { grid-template-columns: minmax(0, 1fr); }
  .showcase-page .faculty-index { width: 100%; }
  .showcase-page .project-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); overflow: visible; }
  .showcase-page .project-filter button { min-width: 0; white-space: normal; gap: 12px; line-height: 1.4; }
  .showcase-page .project-reel-art { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'meta' 'case' 'mark' 'tech' 'proof' 'route'; }
  .showcase-page .academic-lead-body { grid-template-columns: minmax(0, 1fr); }
  .showcase-page .academic-lead-mark { min-height: 200px; gap: 24px; }
  .showcase-page .academic-lead-mark strong { font-size: 4rem; line-height: 1.1; }
  .showcase-page .program-page-workbench { min-height: 0; }
  .showcase-page .program-page-directory { min-height: 0; grid-template-rows: auto auto auto 3px; }
  .showcase-page .program-page-directory ol { max-height: 28rem; }
  .showcase-page .program-page-display dl { grid-template-columns: minmax(0, 1fr); }
  .showcase-page .team-format-grid { grid-template-columns: minmax(0, 1fr); }
  .code-lab-page .lab-language-switch { display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
  .code-lab-page .lab-language-switch button { min-width: 0; width: 100%; }
}
@media (max-width: 480px) {
  .showcase-page .showcase-kicker { flex-wrap: wrap; gap: 12px; }
  .showcase-page .showcase-kicker i { display: none; }
  .showcase-page .assembly-stage { padding: 16px; }
  .showcase-page .assembly-caption { grid-row: auto; grid-column: 1 / -1; }
  .showcase-page .trajectory-stage { padding: 20px; }
  .showcase-page .trajectory-stage { grid-template-columns: minmax(0, 1fr); }
  .showcase-page :is(.trajectory-origin, .trajectory-node, .trajectory-output) { width: 100%; grid-column: 1; grid-row: auto; }
  .experience-dialog .practice-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 480px) {
  .experience-dialog[open] { margin: 12px auto; max-height: calc(100dvh - 24px); }
}
