/* Desktop adaptation of the restored site.
   Reference: 2560 x 1440 CSS pixels at 100% display scaling.
   Native layout only: no page zoom or transform-based viewport scaling. */
body.desktop-responsive {
  --desktop-gutter: clamp(24px, 5.55vw, 80px);
  --desktop-content: 1460px;
}

body.desktop-responsive :is(.hero-copy, .hero-console, .dossier-grid > section,
  .research-cards, .research-logic-panel, .studio-copy, .studio-gallery,
  .paper-switch-stage, .project-process-stage) { min-width: 0; }

/* Cap wide screens at the reference composition; keep a shared content edge. */
body.desktop-responsive #profile > .foundation-inner,
body.desktop-responsive #evidence > .evidence-grid,
body.desktop-responsive #research > :is(.section-heading, .cockpit, .research-chain),
body.desktop-responsive #projects > :is(.section-heading, .studio-tabs, .studio-shell),
body.desktop-responsive #reader > .section-heading {
  width: min(var(--desktop-content), calc(100% - 2 * var(--desktop-gutter))) !important;
  margin-inline: auto !important;
}

body.desktop-responsive .support-matrix :is(header, section, strong, p, dl, dt, dd) {
  min-width: 0;
  max-width: 100%;
}
body.desktop-responsive .support-matrix-head > :is(strong, p),
body.desktop-responsive .support-copy-list dd {
  white-space: normal !important;
  overflow-wrap: anywhere;
}
body.desktop-responsive .support-copy-list > div { min-width: 0; }
body.desktop-responsive .support-matrix-head { overflow: hidden; }
body.desktop-responsive .research-logic-panel {
  justify-content: flex-start;
  padding-top: 24px;
}

body.desktop-responsive .reader-stage {
  width: min(1280px, calc(100% - 2 * clamp(24px, 3vw, 52px)));
}
body.desktop-responsive .page-strip { max-width: calc(100% - 2 * var(--desktop-gutter)); }
body.desktop-responsive .reader-carousel { min-width: 0; }
body.desktop-responsive .lightbox figure { min-width: 0; max-width: 100%; }
body.desktop-responsive .lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 144px);
  object-fit: contain;
}

/* Retain the two-column desktop hero, including compact laptop windows. */
@media (min-width: 980px) {
  body.desktop-responsive .hero {
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr) !important;
    gap: clamp(32px, 5vw, 76px) !important;
    padding-inline: max(clamp(40px, 6vw, 92px), calc((100% - 2360px) / 2)) !important;
    min-height: clamp(680px, 100svh, 920px) !important;
    height: auto !important;
  }
  body.desktop-responsive .hero-copy { container-type: inline-size; }
  body.desktop-responsive .hero-console { width: 100% !important; }
  body.desktop-responsive .hero h1 { font-size: clamp(78px, 8.4vw, 138px) !important; }
  body.desktop-responsive .hero h1 > span:last-child { font-size: clamp(40px, 4.2vw, 72px) !important; }
  body.desktop-responsive .hero .hero-type-title {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: clamp(36px, 4vw, 78px) !important;
    font-size: min(78px, 9cqi) !important;
    min-height: 1.15em !important;
    height: 1.15em !important;
    white-space: nowrap;
  }
  body.desktop-responsive .hero-text { max-width: min(760px, 100%) !important; }

  body.desktop-responsive .undergraduate-foundation .foundation-card {
    width: min(620px, calc((100% - 160px) / 2)) !important;
    left: auto !important;
    right: auto !important;
  }
  body.desktop-responsive .undergraduate-foundation .foundation-card-01 { margin: 0 28px 0 auto !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card-02 { margin: -235px auto 0 38px !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card-03 { margin: -228px 58px 0 auto !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card-04 { margin: -228px auto 0 38px !important; }

  body.desktop-responsive .resume-dossier .paper-list li {
    height: auto !important;
    min-height: var(--paper-card-height, 550px) !important;
  }
  body.desktop-responsive .resume-dossier .paper-list li > * { flex-shrink: 0; }
  body.desktop-responsive .support-matrix {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(124px, auto) repeat(2, minmax(104px, auto)) !important;
    height: auto !important;
  }
  body.desktop-responsive .support-matrix-head { grid-area: 1 / 1 / 2 / -1 !important; }
  body.desktop-responsive .support-matrix > section:nth-of-type(1) { grid-area: 2 / 1 / 3 / 3 !important; }
  body.desktop-responsive .support-matrix > section:nth-of-type(2) { grid-area: 2 / 3 / 3 / 5 !important; }
  body.desktop-responsive .support-matrix > section:nth-of-type(3) { grid-area: 2 / 5 / 3 / 7 !important; }
  body.desktop-responsive .support-matrix > section:nth-of-type(4) { grid-area: 3 / 1 / 4 / 4 !important; }
  body.desktop-responsive .support-matrix > section:nth-of-type(5) { grid-area: 3 / 4 / 4 / 7 !important; }
  body.desktop-responsive .cockpit { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) !important; gap: 24px !important; }
  body.desktop-responsive .studio.active { grid-template-columns: minmax(250px, .8fr) minmax(0, 2.2fr) !important; }
  body.desktop-responsive .studio-copy { container-type: inline-size; }
  body.desktop-responsive .studio-copy h3 { font-size: clamp(26px, 10.25cqi, 38px) !important; }
  body.desktop-responsive .studio-gallery { align-content: center; }
  body.desktop-responsive .studio-gallery button { aspect-ratio: 3552 / 1443; }
  body.desktop-responsive .studio-gallery img { width: 100%; height: 100%; object-fit: contain; }
}

/* Restore the original rising silhouette whenever all five cards share a row.
   DOM order differs from visual order; min-height lets long copy remain visible. */
@media (min-width: 1280px) {
  body.desktop-responsive .resume-dossier .paper-list { align-items: end; }
  body.desktop-responsive .resume-dossier .paper-list li:nth-child(5) { --paper-card-height: 470px; }
  body.desktop-responsive .resume-dossier .paper-list li:nth-child(2) { --paper-card-height: 490px; }
  body.desktop-responsive .resume-dossier .paper-list li:nth-child(3) { --paper-card-height: 510px; }
  body.desktop-responsive .resume-dossier .paper-list li:nth-child(4) { --paper-card-height: 530px; }
  body.desktop-responsive .resume-dossier .paper-list li:nth-child(1) { --paper-card-height: 550px; }
}

/* A readable sidebar stays beside the article from 980px upward. */
@media (min-width: 980px) {
  body.desktop-responsive.paper-capability-page .paper-switch-main,
  body.desktop-responsive.project-process-page .project-process-main {
    width: min(1480px, calc(100% - 2 * clamp(24px, 3.4vw, 56px))) !important;
    grid-template-columns: clamp(220px, 21vw, 300px) minmax(0, 1fr) !important;
    align-items: start !important;
  }
  body.desktop-responsive.paper-capability-page .paper-switch-main { gap: clamp(24px, 3vw, 44px) !important; }
  body.desktop-responsive.project-process-page .project-process-main { gap: clamp(24px, 2.2vw, 32px) !important; }
  body.desktop-responsive :is(.paper-switch-nav, .project-process-nav) {
    position: sticky !important;
    top: 78px !important;
    max-height: calc(100dvh - 94px) !important;
    min-height: 0 !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  body.desktop-responsive .paper-switch-nav { grid-template-columns: minmax(0, 1fr) !important; }
  body.desktop-responsive .paper-switch-nav button { width: 100%; min-width: 0; }
  body.desktop-responsive .paper-switch-nav button :is(strong, small) {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}

/* Content-driven breakpoints: cards need room for their full academic titles. */
@media (min-width: 980px) and (max-width: 1279px) {
  body.desktop-responsive .resume-dossier .paper-list { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 20px !important; }
  body.desktop-responsive .resume-dossier .paper-list li { min-height: 490px !important; }
  body.desktop-responsive .dossier-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body.desktop-responsive .dossier-grid > section:first-child,
  body.desktop-responsive .support-matrix { grid-column: 1 / -1 !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card {
    width: calc(50% - 28px) !important;
    padding: 26px 24px 18px !important;
  }
  body.desktop-responsive .undergraduate-foundation .foundation-card:nth-of-type(odd) { margin-right: 0 !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card:nth-of-type(even) { margin-left: 0 !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-path-wrap { margin-top: 0 !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-header { margin-bottom: 36px !important; }
  body.desktop-responsive .support-matrix > section { padding: 14px !important; }
  body.desktop-responsive .support-copy-list { margin-left: 0 !important; }
  body.desktop-responsive .support-copy-list > div { grid-template-columns: 64px minmax(0, 1fr) !important; }
  body.desktop-responsive .paper-switch-nav button {
    grid-template-columns: 34px minmax(0, 1fr) !important;
    padding: 14px 10px !important;
    min-height: 86px !important;
  }
  body.desktop-responsive .paper-switch-nav button strong { font-size: 14px !important; }
  body.desktop-responsive .paper-switch-nav button small { font-size: 11px !important; }
  body.desktop-responsive .paper-switch-nav button span { width: 28px !important; height: 28px !important; }
  body.desktop-responsive .paper-panel-head h2 { width: 100% !important; padding-right: 0 !important; }
  body.desktop-responsive .paper-panel-head .paper-document-actions { position: static !important; margin-top: 18px !important; }
  body.desktop-responsive.project-process-page { --project-inset: 26px; }
  body.desktop-responsive .project-storyline ol { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body.desktop-responsive .question-grid.three,
  body.desktop-responsive .capability-grid { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Short desktop windows retain reachable navigation without obscuring content. */
@media (min-width: 980px) and (max-height: 800px) {
  body.desktop-responsive.project-process-page .project-process-main { padding-top: 38px !important; }
  body.desktop-responsive .project-process-nav { max-height: calc(100dvh - 128px) !important; }
  body.desktop-responsive .paper-switch-nav { padding-top: 8px !important; }
  body.desktop-responsive .paper-switch-intro { margin-bottom: 14px !important; padding-bottom: 16px !important; }
  body.desktop-responsive .paper-switch-nav button { min-height: 78px !important; padding-block: 12px !important; }
}

/* Narrow desktop windows / high browser zoom: reflow instead of clipping. */
@media (max-width: 979px) {
  body.desktop-responsive { --desktop-gutter: clamp(20px, 4vw, 36px); }
  body.desktop-responsive .hero { grid-template-columns: minmax(0, 1fr) !important; padding-inline: var(--desktop-gutter) !important; gap: 36px !important; }
  body.desktop-responsive .hero-copy, body.desktop-responsive .hero-console { width: 100% !important; max-width: 720px !important; top: auto !important; margin-inline: auto !important; }
  body.desktop-responsive .hero .hero-type-title { width: 100% !important; min-width: 0 !important; max-width: 100% !important; font-size: clamp(26px, 5.3vw, 50px) !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-path-wrap { min-height: 0 !important; margin-top: 36px !important; }
  body.desktop-responsive .undergraduate-foundation .foundation-card { width: 100% !important; max-width: 720px !important; margin: 24px auto !important; left: auto !important; right: auto !important; }
  body.desktop-responsive .foundation-path { display: none !important; }
  body.desktop-responsive .dossier-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body.desktop-responsive .dossier-grid > section:first-child { grid-column: 1 / -1 !important; }
  body.desktop-responsive .resume-dossier .paper-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 18px !important; }
  body.desktop-responsive .resume-dossier .paper-list li { height: auto !important; min-height: 500px !important; }
  body.desktop-responsive .support-matrix { grid-column: 1 / -1 !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-template-rows: auto !important; }
  body.desktop-responsive .support-matrix-head { grid-area: auto / 1 / auto / -1 !important; }
  body.desktop-responsive .support-matrix > section { grid-area: auto !important; padding: 18px !important; }
  body.desktop-responsive .support-copy-list { margin-left: 0 !important; }
  body.desktop-responsive .support-copy-list > div { grid-template-columns: 64px minmax(0, 1fr) !important; }
  body.desktop-responsive .cockpit { grid-template-columns: minmax(0, 1fr) !important; gap: 20px !important; }
  body.desktop-responsive .research-chain { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body.desktop-responsive .studio.active { grid-template-columns: minmax(0, 1fr) !important; }
  body.desktop-responsive .paper-switch-main,
  body.desktop-responsive.project-process-page .project-process-main { width: calc(100% - 2 * var(--desktop-gutter)) !important; grid-template-columns: minmax(0, 1fr) !important; gap: 28px !important; }
  body.desktop-responsive .paper-switch-nav,
  body.desktop-responsive .project-process-nav { position: static !important; max-height: none !important; min-width: 0; }
  body.desktop-responsive .paper-switch-nav { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; padding-right: 0 !important; }
  body.desktop-responsive .paper-switch-intro { grid-column: 1 / -1; }
  body.desktop-responsive .paper-switch-nav button { margin-bottom: 0 !important; min-width: 0; }
  body.desktop-responsive .paper-redesign-panel { min-width: 0; }
}

@media (max-width: 639px) {
  body.desktop-responsive .resume-dossier .paper-list,
  body.desktop-responsive .support-matrix,
  body.desktop-responsive .paper-switch-nav { grid-template-columns: minmax(0, 1fr) !important; }
  body.desktop-responsive .resume-dossier .paper-list li { min-height: 0 !important; }
}
