/* Phone gallery layouts; desktop presentation remains in its existing stylesheets. */
@media (max-width:760px) {
  :is(#ic-gallery,#undergraduate-gallery) {padding:58px 20px 48px;min-width:0;scroll-margin-top:90px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-section-heading {margin-bottom:26px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-section-heading h2 {font-size:clamp(31px,8.5vw,42px);line-height:1.16;letter-spacing:-1.2px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-section-heading>p {font-size:14px;line-height:1.75}
  :is(#ic-gallery,#undergraduate-gallery) .ic-gallery-toolbar {display:block;margin-bottom:25px;padding-bottom:18px;min-width:0}
  :is(#ic-gallery,#undergraduate-gallery) .ic-filters {display:flex;flex-wrap:nowrap;gap:8px;max-width:100%;overflow-x:auto;overflow-y:hidden;padding:4px 2px 10px;scrollbar-width:thin;overscroll-behavior-x:contain}
  :is(#ic-gallery,#undergraduate-gallery) .ic-filters button {flex:0 0 auto;min-height:44px;font-size:12px;line-height:1.35;padding:10px 14px;white-space:nowrap}
  :is(#ic-gallery,#undergraduate-gallery) .ic-filters button>span {font-size:11px;margin-left:6px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-results {display:block;font-size:12px;margin-top:9px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-accordion-track {align-items:stretch;gap:0;max-width:100%;scroll-snap-type:x proximity;padding-bottom:12px;touch-action:auto}
  :is(#ic-gallery,#undergraduate-gallery) .ic-card,:is(#ic-gallery,#undergraduate-gallery) .ic-card.is-active {flex:0 0 calc(100% - 28px);max-width:360px;height:auto;min-height:430px;scroll-snap-align:start;overflow:hidden}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-toggle {padding:22px 20px 58px;min-height:44px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-card.is-active .ic-panel-toggle {padding-bottom:15px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-title {font-size:23px;line-height:1.22}
  :is(#ic-gallery,#undergraduate-gallery) .ic-card.is-active .ic-panel-title {font-size:27px;line-height:1.18}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-category {font-size:11px;line-height:1.55;letter-spacing:.025em}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-details {padding:0 20px 58px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-details>p {font-size:14px;line-height:1.75;margin-bottom:20px;max-width:none}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-open {min-height:44px;padding:11px 17px;font-size:13px;gap:25px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-preview {left:20px;top:18px;font-size:9px;letter-spacing:.07em;max-width:calc(100% - 40px)}
  :is(#ic-gallery,#undergraduate-gallery) .ic-panel-number {font-size:12px;right:20px;bottom:20px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-controls {gap:8px;flex-wrap:wrap;padding-top:19px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-hint {flex-basis:100%;font-size:12px;line-height:1.6;margin:0 0 6px;order:0}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-progress {min-width:20px;max-width:none;order:1}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-count {font-size:11px;min-width:44px;order:2}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-controls>button {min-width:44px;width:44px;height:44px;min-height:44px;font-size:18px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-controls>.ic-showcase-play {width:auto;min-width:75px;padding:0 11px;font-size:12px;order:3}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-prev {order:4}
  :is(#ic-gallery,#undergraduate-gallery) .ic-showcase-next {order:5}
  :is(#ic-gallery,#undergraduate-gallery) .ic-gallery-footnote {font-size:13px;line-height:1.7;align-items:flex-start;gap:10px}
  :is(#ic-gallery,#undergraduate-gallery) .ic-gallery-footnote p {flex-basis:calc(100% - 25px)}
  :is(#ic-gallery,#undergraduate-gallery) .ic-gallery-footnote a {display:inline-flex;align-items:center;gap:12px;min-height:44px;font-size:13px;padding:0 0 0 15px}

  /* Top-layer dialogs occupy the phone viewport, above the bottom navigation. */
  .ic-viewer,.robotics-project-dialog {position:fixed;inset:0;margin:0;width:100vw;max-width:100vw;height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;border:0;border-radius:0;padding:0;overflow:hidden}
  .ic-viewer[open] {display:grid;grid-template-rows:auto minmax(0,1fr) auto}
  .ic-viewer-head {position:relative;top:auto;gap:14px;padding:calc(14px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 14px max(16px,env(safe-area-inset-left,0px));min-width:0}
  .ic-viewer-head>div {min-width:0}
  .ic-viewer-head h2 {font-size:20px;line-height:1.3;letter-spacing:-.4px;overflow-wrap:anywhere}
  .ic-viewer-head small {font-size:11px;line-height:1.5;letter-spacing:0;overflow-wrap:anywhere}
  .ic-viewer-close {width:44px;height:44px;min-width:44px;min-height:44px;font-size:28px}
  .ic-viewer-layout {display:flex;flex-direction:column;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain}
  .ic-viewer-visual {flex:none;border-right:0;min-width:0}
  .ic-zoom-toolbar {flex-wrap:wrap;justify-content:flex-start;gap:8px;padding:14px 16px;font-size:13px}
  .ic-zoom-toolbar>span:first-child {display:block;flex-basis:100%;font-size:11px;line-height:1.4;margin:0 0 3px;letter-spacing:.08em}
  .ic-zoom-toolbar button {min-width:44px;height:44px;min-height:44px;padding:0 14px;font-size:14px}
  .ic-zoom-value {min-width:45px;font-size:13px;text-align:center}
  .ic-viewer-stage {height:clamp(170px,45dvh,360px);flex:none;touch-action:auto}
  .ic-viewer-caption {font-size:13px;line-height:1.75;padding:18px 20px}
  .ic-original-image {min-height:44px;display:inline-flex;align-items:center;padding:8px 0;font-size:13px}
  .ic-viewer-details {display:block;padding:24px 20px 30px}
  .ic-viewer-details h3 {font-size:13px;line-height:1.6;margin:24px 0 10px}
  .ic-viewer-details h3:first-child {margin-top:0}
  .ic-viewer-details p,.ic-viewer-details li {font-size:14px;line-height:1.8}
  .ic-viewer-details>div+div {margin-top:27px}
  .ic-viewer-status {font-size:14px;line-height:1.75;padding:14px}
  .ic-viewer-foot {position:relative;gap:10px;background:#111923;padding:12px max(16px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));border-top:1px solid #405061}
  .ic-viewer-foot button {min-height:44px;font-size:13px;padding:10px 16px}
  .ic-viewer-foot>span {font-size:12px;white-space:nowrap;min-width:48px;text-align:center}

  /* Keep robotics imagery separate from readable project text on a phone. */
  #robotics-profile.robotics-showcase {padding:110px 20px 48px;min-width:0}
  #robotics-profile .profile-section-heading>p,#robotics-profile .robotics-context {font-size:14px;line-height:1.75}
  #robotics-profile .robotics-context {margin-bottom:26px}
  #robotics-profile .robotics-carousel {display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;aspect-ratio:auto;min-height:0;max-width:100%;border-radius:16px;touch-action:auto;background:#121b25}
  #robotics-profile .robotics-slide {position:relative;inset:auto;grid-column:1/-1;grid-row:1;display:flex;flex-direction:column;min-width:0}
  #robotics-profile .robotics-slide[hidden] {display:none!important}
  #robotics-profile .robotics-slide-image {position:relative;inset:auto;z-index:0;width:100%;height:auto;aspect-ratio:16/10;object-fit:cover;object-position:center center;flex:none;touch-action:pan-y pinch-zoom}
  #robotics-profile .robotics-slide::after {display:none}
  #robotics-profile .robotics-slide-content {position:relative;inset:auto;max-width:none;padding:24px 20px 20px;background:#121b25}
  #robotics-profile .robotics-slide-meta {font-size:11px;line-height:1.65;letter-spacing:.035em;margin-bottom:14px;overflow-wrap:anywhere}
  #robotics-profile .robotics-slide h3 {font-size:clamp(28px,7.6vw,35px);line-height:1.17;letter-spacing:-.8px;margin-bottom:17px;max-width:none;text-wrap:normal}
  #robotics-profile .robotics-slide-summary {font-size:14px;line-height:1.8;max-width:none;margin-bottom:23px}
  #robotics-profile .robotics-read-more {font-size:14px;min-height:46px;padding:11px 19px;gap:28px}
  #robotics-profile .robotics-media-label {left:12px;top:12px;max-width:calc(100% - 120px);min-height:44px;padding:8px 10px;font-size:8px;line-height:1.5;letter-spacing:.04em}
  #robotics-profile .robotics-play {right:12px;top:12px;min-height:44px;min-width:80px;justify-content:center;padding:8px 11px;font-size:12px}
  #robotics-profile .robotics-index {position:static;grid-column:1;grid-row:2;align-self:center;padding:0 0 18px 20px;margin:0;font-size:12px;letter-spacing:.12em}
  #robotics-profile .robotics-navigation {position:static;grid-column:2;grid-row:2;justify-self:end;gap:10px;padding:0 18px 18px 8px}
  #robotics-profile .robotics-navigation button {width:46px;height:46px;min-width:44px;min-height:44px;font-size:22px}
  #robotics-profile .robotics-project-selectors {display:flex;flex-direction:column;gap:0;border-top:1px solid #35424f;margin-top:24px}
  #robotics-profile .robotics-selector {display:flex;align-items:center;gap:15px;padding:16px 14px;min-height:74px;border-top:0;border-bottom:1px solid #35424f;min-width:0;border-radius:0}
  #robotics-profile .robotics-selector>.robotics-selector-number {font-size:12px;margin:0;flex:none}
  #robotics-profile .robotics-selector-copy {min-width:0}
  #robotics-profile .robotics-selector strong {font-size:14px;line-height:1.55}
  #robotics-profile .robotics-selector small {display:block;font-size:12px;line-height:1.6;margin-top:4px}
  #robotics-profile .robotics-selector.is-active {background:#18232f}
  #robotics-profile .robotics-selector::before {left:0;right:auto;top:13px;bottom:13px;width:2px;height:auto;transform:scaleY(0);transform-origin:top}
  #robotics-profile .robotics-selector.is-active::before {transform:scaleY(1)}
  #robotics-profile .profile-record-note {font-size:13px;line-height:1.75;margin-top:25px}
  .robotics-project-dialog[open] {display:grid;grid-template-rows:auto minmax(0,1fr)}
  .robotics-dialog-header {position:relative;top:auto;gap:14px;padding:calc(14px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 14px max(16px,env(safe-area-inset-left,0px))}
  .robotics-dialog-header>div {min-width:0}
  .robotics-dialog-header h2 {font-size:22px;line-height:1.3;letter-spacing:-.5px;overflow-wrap:anywhere}
  .robotics-dialog-header .entry-label {font-size:10px;line-height:1.6;overflow-wrap:anywhere}
  .robotics-dialog-close {width:44px;height:44px;min-width:44px;min-height:44px;font-size:28px}
  .robotics-dialog-body {display:block;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;padding-bottom:env(safe-area-inset-bottom,0px)}
  .robotics-dialog-visual img {height:auto;max-height:none;width:100%;aspect-ratio:16/9;object-fit:contain}
  .robotics-dialog-visual>span {font-size:10px;line-height:1.6;letter-spacing:.04em;padding:14px 18px}
  .robotics-dialog-notes {padding:24px 20px 30px}
  .robotics-dialog-notes h3 {font-size:13px;line-height:1.6}
  .robotics-dialog-notes p {font-size:14px;line-height:1.85}
  .robotics-dialog-notes .profile-tag-row>span {font-size:12px;line-height:1.5;padding:6px 10px}
}
@media (max-width:760px) and (max-height:480px) {
  .ic-viewer-head,.robotics-dialog-header {padding-top:calc(10px + env(safe-area-inset-top,0px));padding-bottom:10px}
  .ic-viewer-head h2,.robotics-dialog-header h2 {font-size:19px}
  .ic-viewer-head small,.robotics-dialog-header .entry-label {font-size:10px}
  .ic-viewer-foot {padding-top:8px;padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
  .ic-viewer-stage {height:210px}
}
