/* v11 — Samsung-safe light rendering, zero horizontal overflow, richer hero crops */
:root{
  color-scheme:only light;
  supported-color-schemes:light;
  --ui-paper:#fbfcfc;
  --ui-text:#0b2739;
}

html{
  width:100%;
  max-width:100%;
  overflow-x:hidden!important;
  background-color:var(--ui-paper)!important;
  color-scheme:only light;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  position:relative;
  width:100%;
  min-width:0;
  max-width:100%;
  overflow-x:hidden!important;
  overscroll-behavior-x:none;
  background-color:var(--ui-paper)!important;
  color:var(--ui-text);
  color-scheme:only light;
}
@supports (overflow:clip){
  html,body{overflow-x:clip!important}
  .portal,.hero,.slides,.hero-slide,.academic-band,.course-showcase,.site-footer{overflow-x:clip}
}

/* Keep media and long scientific strings inside the physical viewport. */
img,svg,video,canvas,iframe{max-width:100%}
.site-header,.header-inner,main,.page-main,.hero,.slides,.hero-slide,.site-footer{max-width:100%}
.header-inner,.header-inner>*,.identity,.identity>span:last-child,.main-nav,
.hero-content,.portal-grid>*,.course-showcase>*,.course-preview>*,.academic-band>*,
.resource-grid>*,.world-grid>*,.footer-top>*,.cv-intro>*,.publication-card>*{min-width:0}
.publication-card h3,.paper-links span,.research-equation p,.resource-hero h1,
.world-card h3,.course-card h2,.reference-page h2,.articles-page h2{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* A negative decorative mark was the main mobile spill candidate. */
body[data-page=home] .portal{overflow:hidden}
body[data-page=home] .portal:before{left:4px}

/* Prevent browser/OS auto-darkening from turning light cards into unreadable surfaces. */
.site-header,.main-nav{background-color:#fff;color:#0b2739;color-scheme:only light}
.page-main,.cv-page{background-color:#fbfcfc;color:#0b2739;color-scheme:only light}
input,select,textarea{background-color:#fff;color:#0b2739;color-scheme:only light}
button{color-scheme:only light}

@media (prefers-color-scheme:dark){
  :root,html,body{color-scheme:only light;background-color:#fbfcfc!important;color:#0b2739}
  .site-header,.main-nav{background-color:#fff!important;color:#0b2739!important}
  .page-main,.cv-page{background-color:#fbfcfc!important;color:#0b2739}
  body[data-page=home] .course-showcase{background-color:#f1f6f7!important;color:#0b2739}
  .featured{background:linear-gradient(180deg,#eef5f6 0%,#eaf2f4 100%)!important;color:#0b2739}
  .resource-card:not(.trauma-card),.reference-page article,.articles-page article,
  .course-card,.course-preview article,.expertise-cloud span,.library-head input{
    background-color:#fff!important;
    color:#0b2739!important;
  }
  .course-audience>div,.cv-affiliation,.file-box{background-color:#eef5f6!important;color:#0b2739!important}
}

@media(max-width:820px){
  .header-inner{width:100%;min-width:0}
  .identity{flex:1 1 auto;overflow:hidden}
  .identity strong,.identity small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .menu-toggle,.header-contact{flex:0 0 auto}
}

@media(max-width:520px){
  .header-inner{
    width:100%;
    padding-right:max(14px,env(safe-area-inset-right));
    padding-left:max(14px,env(safe-area-inset-left));
    gap:8px;
  }
  .identity{gap:9px}
  .identity strong{font-size:12px}
  .identity small{font-size:8.5px;max-width:160px}
  .portrait-mark{flex:0 0 39px}
  .menu-toggle{flex-basis:40px;width:40px}
  .header-contact{flex-basis:38px}
  body[data-page=home] .portal:before{display:none}
  body[data-page=home] .hero-content{box-sizing:border-box;max-width:100%!important}
  body[data-page=home] .hero-actions{max-width:100%;gap:10px}
  body[data-page=home] .hero-actions .primary{min-width:0;gap:12px;padding-inline:12px}
  body[data-page=home] .hero-controls{max-width:calc(100% - 28px)}
}

@media(max-width:370px){
  .header-inner{padding-inline:11px;gap:6px}
  .identity small{display:none}
  .portrait-mark{flex-basis:37px;width:37px;height:37px}
  body[data-page=home] .hero-content{padding-inline:18px}
  body[data-page=home] .hero h1,body[data-page=home] .hero h2{font-size:29px!important}
  body[data-page=home] .hero-actions .primary{font-size:11px}
  body[data-page=home] .hero-actions .link{font-size:10px}
}
