/* IPO MANTRA PHASE 18 - HOME ONLY RESTORE
   Loaded only by Views/Home/Index.cshtml.
   Restores the accepted Phase-7 Home geometry and leaves every inner page alone. */

@media (min-width:1100px){
  html:has(.im5-hero){
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
  }
  html:has(.im5-hero) body{
    zoom:.90!important;
    width:111.111111%!important;
    max-width:111.111111%!important;
    margin:0!important;
    padding:0!important;
    overflow-x:hidden!important;
  }

  body:has(.im5-hero) .im5-shell,
  body:has(.im5-hero) .im5-nav,
  body:has(.im5-hero) .im5-hero-inner,
  body:has(.im5-hero) .im5-stats-row,
  body:has(.im5-hero) .im5-main-grid,
  body:has(.im5-hero) .im5-bottom-grid{
    width:calc(100% - 32px)!important;
    max-width:1680px!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }

  body:has(.im5-hero) .im5-nav{
    height:94px!important;
    padding:0!important;
  }
  body:has(.im5-hero) .im5-search-pill{
    width:235px!important;
    min-width:210px!important;
    flex:0 0 235px!important;
  }
  body:has(.im5-hero) .im5-hero{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    border-radius:0!important;
  }
  body:has(.im5-hero) .im5-hero-inner{
    grid-template-columns:47% 53%!important;
    padding-top:116px!important;
  }
  body:has(.im5-hero) .im5-hero-copy{
    padding-top:20px!important;
    min-width:0!important;
    position:relative!important;
    z-index:10!important;
  }
  body:has(.im5-hero) .im5-scene{
    min-width:0!important;
    overflow:visible!important;
  }
  body:has(.im5-hero) .im5-feature-row{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:10px!important;
    margin:14px 0 18px!important;
  }
  body:has(.im5-hero) .im5-hero-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:14px!important;
    position:relative!important;
    z-index:12!important;
  }
  body:has(.im5-hero) .im5-btn{
    width:auto!important;
    min-width:0!important;
    height:48px!important;
    padding:0 24px!important;
  }
  body:has(.im5-hero) .im5-stats-row{margin-top:-20px!important}
  body:has(.im5-hero) .im5-main-grid{margin-top:18px!important}
  body:has(.im5-hero) .im5-bottom-grid{margin-top:18px!important;margin-bottom:42px!important}

  /* Keep the 3D scene out of the text/button column on desktop. */
  body:has(.im5-hero) .im5-exchange{left:44px!important}
  body:has(.im5-hero) .im5-ipo-3d{right:118px!important}
}

@media (min-width:1441px){
  body:has(.im5-hero) .im5-hero{height:560px!important}
  body:has(.im5-hero) .im5-hero-inner{grid-template-columns:44% 56%!important;padding-top:120px!important}
  body:has(.im5-hero) .im5-hero h1{font-size:54px!important}
  body:has(.im5-hero) .im5-hero p{font-size:18px!important;max-width:680px!important}
  body:has(.im5-hero) .im5-scene{transform:scale(1.06)!important;transform-origin:center bottom!important}
}

@media (min-width:901px) and (max-width:1180px){
  body:has(.im5-hero) .im5-shell,
  body:has(.im5-hero) .im5-nav,
  body:has(.im5-hero) .im5-hero-inner,
  body:has(.im5-hero) .im5-stats-row,
  body:has(.im5-hero) .im5-main-grid,
  body:has(.im5-hero) .im5-bottom-grid{
    width:calc(100% - 24px)!important;
    max-width:none!important;
  }
  body:has(.im5-hero) .im5-nav{gap:16px!important}
  body:has(.im5-hero) .im5-links{gap:14px!important}
  body:has(.im5-hero) .im5-links>a,
  body:has(.im5-hero) .im5-drop>a{font-size:13px!important}
  body:has(.im5-hero) .im5-brand{width:165px!important;height:72px!important}
  body:has(.im5-hero) .im5-hero-inner{grid-template-columns:46% 54%!important}
  body:has(.im5-hero) .im5-exchange{
    left:25px!important;
    transform:skewY(-3deg) scale(.9)!important;
    transform-origin:bottom left!important;
  }
  body:has(.im5-hero) .im5-ipo-3d{right:100px!important;font-size:100px!important}
}

@media (max-width:1099px){
  html:has(.im5-hero) body{
    zoom:1!important;
    width:100%!important;
    max-width:100%!important;
  }
}

@media (max-width:900px){
  body:has(.im5-hero) .im5-shell,
  body:has(.im5-hero) .im5-nav,
  body:has(.im5-hero) .im5-hero-inner,
  body:has(.im5-hero) .im5-stats-row,
  body:has(.im5-hero) .im5-main-grid,
  body:has(.im5-hero) .im5-bottom-grid{
    width:calc(100% - 20px)!important;
    max-width:none!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }
  body:has(.im5-hero) .im5-nav{height:82px!important;gap:10px!important}
  body:has(.im5-hero) .im5-brand{width:142px!important;height:66px!important}
  body:has(.im5-hero) .im5-menu{display:block!important;margin-left:auto!important}
  body:has(.im5-hero) .im5-search-pill{display:none!important}
  body:has(.im5-hero) .im5-hero{height:auto!important;min-height:760px!important}
  body:has(.im5-hero) .im5-hero-inner{
    padding-top:102px!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    height:auto!important;
  }
  body:has(.im5-hero) .im5-hero-copy{padding:4px 4px 0!important}
  body:has(.im5-hero) .im5-hero h1{
    font-size:clamp(38px,7vw,48px)!important;
    line-height:1.04!important;
  }
  body:has(.im5-hero) .im5-hero p{max-width:720px!important}
  body:has(.im5-hero) .im5-scene{
    height:330px!important;
    min-height:330px!important;
    margin-top:2px!important;
    overflow:hidden!important;
  }
  body:has(.im5-hero) .im5-stats-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    margin-top:-18px!important;
  }
  body:has(.im5-hero) .im5-market-today{grid-column:1/-1!important}
  body:has(.im5-hero) .im5-main-grid{grid-template-columns:1fr!important}
  body:has(.im5-hero) .im5-open-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:has(.im5-hero) .im5-upcoming-panel{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    column-gap:18px!important;
  }
  body:has(.im5-hero) .im5-upcoming-panel .im5-panel-head{grid-column:1/-1!important}
  body:has(.im5-hero) .im5-bottom-grid{grid-template-columns:1fr!important}
}

@media (max-width:600px){
  body:has(.im5-hero) .im5-shell,
  body:has(.im5-hero) .im5-nav,
  body:has(.im5-hero) .im5-hero-inner,
  body:has(.im5-hero) .im5-stats-row,
  body:has(.im5-hero) .im5-main-grid,
  body:has(.im5-hero) .im5-bottom-grid{width:calc(100% - 16px)!important}

  body:has(.im5-hero) .im5-nav{height:76px!important}
  body:has(.im5-hero) .im5-brand{width:126px!important;height:62px!important}
  body:has(.im5-hero) .im5-hero{min-height:810px!important}
  body:has(.im5-hero) .im5-hero-inner{padding-top:90px!important}
  body:has(.im5-hero) .im5-trust{font-size:11px!important;line-height:1.35!important}
  body:has(.im5-hero) .im5-trust:after{display:none!important}
  body:has(.im5-hero) .im5-hero h1{
    font-size:36px!important;
    letter-spacing:-1.2px!important;
    margin-top:10px!important;
  }
  body:has(.im5-hero) .im5-hero p{font-size:14px!important;line-height:1.55!important}
  body:has(.im5-hero) .im5-feature-row{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    margin:12px 0 14px!important;
  }
  body:has(.im5-hero) .im5-feature-row span{
    height:40px!important;
    font-size:9.5px!important;
    padding-right:7px!important;
  }
  body:has(.im5-hero) .im5-hero-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  body:has(.im5-hero) .im5-btn{
    width:100%!important;
    justify-content:center!important;
    height:46px!important;
    padding:0 14px!important;
    font-size:13px!important;
  }
  body:has(.im5-hero) .im5-scene{
    height:275px!important;
    min-height:275px!important;
    margin-top:10px!important;
  }
  body:has(.im5-hero) .im5-stats-row{
    grid-template-columns:1fr!important;
    padding:8px!important;
    border-radius:16px!important;
    margin-top:-14px!important;
  }
  body:has(.im5-hero) .im5-open-cards{grid-template-columns:1fr!important}
  body:has(.im5-hero) .im5-upcoming-panel{display:block!important}
  body:has(.im5-hero) .im5-date-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media (max-width:390px){
  body:has(.im5-hero) .im5-hero{min-height:830px!important}
  body:has(.im5-hero) .im5-hero h1{font-size:32px!important}
  body:has(.im5-hero) .im5-feature-row{grid-template-columns:1fr!important}
  body:has(.im5-hero) .im5-scene{height:250px!important;min-height:250px!important}
}

/* =========================================================
   PHASE 18B - HOME RIGHT SIDE ALIGNMENT ONLY
   Fixes right-side clipping on desktop without touching any inner page.
   ========================================================= */
@media (min-width:1100px){

  /* Give Home sections a little more equal breathing room on both sides. */
  body:has(.im5-hero) .im5-hero-inner,
  body:has(.im5-hero) .im5-stats-row,
  body:has(.im5-hero) .im5-main-grid,
  body:has(.im5-hero) .im5-bottom-grid{
    width:calc(100% - 76px)!important;
    max-width:1620px!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }

  /* Pull the decorative 3D market scene safely inward from the right edge. */
  body:has(.im5-hero) .im5-scene{
    transform:translateX(-34px) scale(.96)!important;
    transform-origin:right bottom!important;
  }
  body:has(.im5-hero) .im5-skyline{right:24px!important}
  body:has(.im5-hero) .im5-floor{right:6px!important}
  body:has(.im5-hero) .im5-ipo-3d{right:158px!important}
  body:has(.im5-hero) .im5-chart-bars{right:48px!important}
  body:has(.im5-hero) .im5-arrow{right:34px!important}
  body:has(.im5-hero) .im5-bull{right:8px!important}

  /* Last stats card: keep subtitle fully visible instead of clipping. */
  body:has(.im5-hero) .im5-stats-row{
    grid-template-columns:repeat(4,minmax(0,1fr)) minmax(270px,1.45fr)!important;
  }
  body:has(.im5-hero) .im5-market-today{
    min-width:0!important;
    overflow:hidden!important;
    padding-right:22px!important;
  }
  body:has(.im5-hero) .im5-market-today>div{
    min-width:0!important;
    max-width:100%!important;
  }
  body:has(.im5-hero) .im5-market-today small{
    display:block!important;
    white-space:normal!important;
    line-height:1.25!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }

  /* Upcoming panel must stay completely inside the Home content shell. */
  body:has(.im5-hero) .im5-main-grid{
    grid-template-columns:minmax(0,3.2fr) minmax(285px,1.15fr)!important;
  }
  body:has(.im5-hero) .im5-upcoming-panel{
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
  }
  body:has(.im5-hero) .im5-panel-head a{
    flex:0 0 auto!important;
    white-space:nowrap!important;
  }
}

/* Ordinary 1366/1440 laptop screens need slightly stronger scene clearance. */
@media (min-width:1100px) and (max-width:1450px){
  body:has(.im5-hero) .im5-scene{
    transform:translateX(-48px) scale(.92)!important;
  }
  body:has(.im5-hero) .im5-ipo-3d{right:166px!important}
  body:has(.im5-hero) .im5-chart-bars{right:56px!important}
  body:has(.im5-hero) .im5-arrow{right:44px!important}
  body:has(.im5-hero) .im5-bull{right:18px!important}
}

