/* East Star Mortgage — hero motion + card polish (additive layer, 2026-11-09c)
   Loads AFTER premium-2026.css. Remove this file's <link> (and hero-motion-2026.js)
   to roll back; nothing else depends on it.
   Motion uses the individual `scale` / `translate` properties because
   premium-2026.css pins `transform:none!important` on .hero-scene. */

/* ---------- 1. Hero copy entrance (pure CSS, no markup change) ---------- */
@keyframes es-rise{from{opacity:0;translate:0 18px}to{opacity:1;translate:0 0}}
@keyframes es-title-reveal{from{opacity:.01;translate:0 14px}to{opacity:1;translate:0 0}}

@media (prefers-reduced-motion:no-preference){
  body.home-premium .hero .hero-content>:is(.premium-eyebrow,.hero-text,.hero-complex-line,.mobile-hero-actions,.goal-chooser,.premium-hero-proof,.hero-actions){
    animation:es-rise .45s cubic-bezier(.2,.7,.2,1) both!important;
  }
  body.home-premium .hero .hero-content>#page-title{animation:es-title-reveal .5s cubic-bezier(.2,.7,.2,1) both!important}
  body.home-premium .hero .hero-content>.premium-eyebrow{animation-delay:0s!important}
  body.home-premium .hero .hero-content>.hero-text{animation-delay:.1s!important}
  body.home-premium .hero .hero-content>.hero-complex-line{animation-delay:.34s!important}
  body.home-premium .hero .hero-content>.mobile-hero-actions{animation-delay:.14s!important}
  body.home-premium .hero .hero-content>.goal-chooser{animation-delay:.18s!important}
  body.home-premium .hero .hero-content>.premium-hero-proof{animation-delay:.22s!important}
  body.home-premium .hero .hero-content>.hero-actions{animation-delay:.64s!important}

  /* ---------- 2. Ken Burns on the active photo (needs hero-motion-2026.js) ---------- */
  @keyframes es-kenburns-a{from{scale:1;translate:0 0}to{scale:1.08;translate:-1% -.6%}}
  @keyframes es-kenburns-b{from{scale:1.08;translate:1% 0}to{scale:1;translate:0 0}}
  @keyframes es-kenburns-c{from{scale:1;translate:0 0}to{scale:1.08;translate:.8% -.8%}}

  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion .hero-scene{
    transition:opacity 1.1s ease!important;
    will-change:opacity,scale,translate;
    backface-visibility:hidden;
  }
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion .hero-scene:is(.is-active,.es-leaving){
    animation:es-kenburns-a 7s linear both!important;
  }
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion picture:nth-of-type(2) .hero-scene:is(.is-active,.es-leaving){animation-name:es-kenburns-b!important}
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion picture:nth-of-type(3) .hero-scene:is(.is-active,.es-leaving){animation-name:es-kenburns-c!important}
  body.home-premium.hero-motion-paused .hero.es-motion .hero-scene{animation-play-state:paused!important}
}
/* Phones: the photo is a small card, so the drift is larger and quicker to read as motion. */
@media (max-width:720px) and (prefers-reduced-motion:no-preference){
  @keyframes es-kenburns-m-a{from{scale:1;translate:0 0}to{scale:1.16;translate:-3% -2%}}
  @keyframes es-kenburns-m-b{from{scale:1.16;translate:3% 0}to{scale:1;translate:0 0}}
  @keyframes es-kenburns-m-c{from{scale:1;translate:0 0}to{scale:1.16;translate:3% -2%}}
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion .hero-scene:is(.is-active,.es-leaving){animation:es-kenburns-m-a 4.5s ease-out both!important}
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion picture:nth-of-type(2) .hero-scene:is(.is-active,.es-leaving){animation-name:es-kenburns-m-b!important}
  body.home-premium .hero.hero-viewport-fit.has-cinematic-scenes.es-motion picture:nth-of-type(3) .hero-scene:is(.is-active,.es-leaving){animation-name:es-kenburns-m-c!important}
}

/* ---------- 3. Stage control: label + progress line per stage (built by hero-motion-2026.js) ---------- */
@keyframes es-fill{from{scale:0 1}to{scale:1 1}}
body.home-premium .hero .es-hero-stages{
  position:absolute;right:84px;bottom:24px;z-index:3;display:flex;align-items:stretch;gap:2px;
  padding:4px 8px;border-radius:14px;border:1px solid rgba(255,255,255,.18);
  background:rgba(14,34,56,.72);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
}
body.home-premium .hero:not(.has-cinematic-scenes) .es-hero-stages{display:none}
body.home-premium .hero .es-stage{
  appearance:none;-webkit-appearance:none;margin:0;border:0;background:none;cursor:pointer;
  display:flex;flex-direction:column;justify-content:center;gap:7px;
  min-width:112px;min-height:44px;padding:6px 10px;border-radius:8px;text-align:left;
  color:rgba(255,255,255,.78);font-family:inherit;font-size:12px;font-weight:500;line-height:1.2;letter-spacing:.02em;
  white-space:nowrap;transition:color .2s ease;
}
body.home-premium .hero .es-stage:hover,
body.home-premium .hero .es-stage[aria-current=true]{color:#fff}
body.home-premium .hero .es-stage[aria-current=true]{font-weight:600}
body.home-premium .hero .es-stage:focus-visible{outline:2px solid #fff;outline-offset:2px}
body.home-premium .hero .es-stage-line{position:relative;display:block;height:2px;border-radius:2px;background:rgba(255,255,255,.32);overflow:hidden}
body.home-premium .hero .es-stage-line i{position:absolute;inset:0;display:block;background:#fff;transform-origin:0 50%;scale:0 1}
body.home-premium .hero .es-stage.is-done .es-stage-line i{scale:1 1}
body.home-premium .hero .es-stage.is-current .es-stage-line i{animation:es-fill var(--es-dur,4s) linear both}
body.home-premium.hero-motion-paused .hero .es-stage-line i{animation-play-state:paused}
body.home-premium .hero .es-stage-now{display:none}
@media (max-width:720px){
  /* photo card on phones: 20px margin, 16:10 — sit in its bottom-right corner */
  body.home-premium .hero .es-hero-stages{
    right:28px;bottom:auto;top:calc(20px + (100vw - 40px) * .625 - 52px);
    align-items:center;gap:0;padding:0 6px 0 14px;border-radius:999px;
  }
  body.home-premium .hero .es-stage-now{display:block;margin-right:6px;color:#fff;font-size:12px;font-weight:600;line-height:1;white-space:nowrap}
  body.home-premium .hero .es-stage{min-width:0;width:30px;padding:0 4px}
  body.home-premium .hero .es-stage-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
}
@media (prefers-reduced-motion:reduce){body.home-premium .hero .es-hero-stages{display:none!important}}

/* ---------- 4. Card polish (hover-capable devices only) ---------- */
@media (hover:hover) and (prefers-reduced-motion:no-preference){
  body.home-premium .goal-choice{
    transition:transform .28s cubic-bezier(.2,.7,.2,1),background .2s ease,box-shadow .28s ease,border-color .28s ease;
  }
  body.home-premium .goal-choice:hover{transform:translateY(-3px);box-shadow:0 16px 32px rgba(6,20,36,.32)}
  body.home-premium .goal-choice.goal-flexible:hover{background:rgba(14,34,56,.82);border-color:#fff}
  body.home-premium .goal-choice svg:last-child{transition:translate .28s cubic-bezier(.2,.7,.2,1)}
  body.home-premium .goal-choice:hover svg:last-child{translate:4px 0}

  body.home-premium #loan-programs .loan-program-card{
    transition:transform .28s cubic-bezier(.2,.7,.2,1),box-shadow .28s ease,border-color .28s ease;
  }
  body.home-premium #loan-programs .loan-program-card:hover{
    transform:translateY(-4px);box-shadow:0 18px 40px rgba(14,34,56,.10);
  }
}

/* ---------- 5. Program icons in a soft tile (desktop layout only) ---------- */
@media (min-width:901px){
  body.home-premium #loan-programs .loan-program-card .loan-icon{
    display:grid;place-items:center;width:52px;height:52px;border-radius:14px;
    background:var(--es-paper)!important;color:var(--es-navy)!important;
    transition:background .28s ease,color .28s ease;
  }
  body.home-premium #loan-programs .loan-program-card .loan-icon svg{width:26px;height:26px;stroke-width:1.5}
  body.home-premium #loan-programs .loan-program-card:hover .loan-icon{background:var(--es-navy)!important;color:#fff!important}
}

/* ---------- 6. Calculator cards: icon beside the number ---------- */
body.home-premium .scenario-tool-card{position:relative}
body.home-premium .scenario-tool-card .es-tool-icon{position:absolute;top:22px;right:22px;display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:rgba(255,255,255,.08);color:#fff;transition:background .25s ease,color .25s ease}
body.home-premium .scenario-tool-card .es-tool-icon svg{width:24px;height:24px;stroke-width:1.5}
body.home-premium .scenario-tool-card:hover .es-tool-icon{background:#fff;color:var(--es-navy)}
body.home-premium .scenario-tool-card strong{padding-right:52px}

/* ---------- 7. Tighter rhythm after the simplified hero (desktop/tablet) ---------- */
@media (min-width:721px){
  body.home-premium .hero.hero-viewport-fit{min-height:680px!important}
  body.home-premium #loan-programs.loan-programs-section{padding-top:72px!important}
}

/* ---------- 8. Office photos open large (office-lightbox-2026.js) ---------- */
body.home-premium #visit-office .office-photo-card{position:relative}
body.home-premium #visit-office .es-zoom{
  position:absolute;inset:0;z-index:2;display:block;width:100%;height:100%;margin:0;padding:0;
  border:0;border-radius:inherit;background:transparent;cursor:zoom-in;
}
body.home-premium #visit-office .es-zoom:focus-visible{outline:3px solid var(--es-red);outline-offset:3px}
body.home-premium #visit-office .es-zoom-badge{
  position:absolute;top:12px;right:12px;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;
  background:rgba(14,34,56,.72);color:#fff;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  opacity:.9;transition:opacity .2s ease,transform .2s ease;
}
body.home-premium #visit-office .es-zoom-badge svg{width:20px;height:20px}
@media (hover:hover){
  body.home-premium #visit-office .es-zoom-badge{opacity:0}
  body.home-premium #visit-office .es-zoom:is(:hover,:focus-visible) .es-zoom-badge{opacity:1;transform:scale(1.05)}
  body.home-premium #visit-office .office-photo-card img{transition:transform .4s ease}
  body.home-premium #visit-office .office-photo-card:hover img{transform:scale(1.03)}
}
html.es-lightbox-open{overflow:hidden}
.es-lightbox{
  width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;border:0;
  background:transparent;color:#fff;overflow:hidden;
}
.es-lightbox::backdrop{background:rgba(6,16,30,.88)}
.es-lightbox[open]{display:grid;place-items:center;animation:es-lb-in .22s ease both}
@keyframes es-lb-in{from{opacity:0}to{opacity:1}}
.es-lightbox-figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:14px;max-width:min(1100px,calc(100vw - 32px))}
.es-lightbox-figure img{
  display:block;max-width:100%;max-height:calc(100vh - 140px);width:auto;height:auto;
  border-radius:12px;box-shadow:0 24px 60px rgba(0,0,0,.45);background:#0E2238;
}
.es-lightbox-figure figcaption{font:600 13px/1.4 Inter,system-ui,sans-serif;letter-spacing:.06em;text-transform:uppercase;color:#e1e6ec}
.es-lightbox-btn{
  position:absolute;display:grid;place-items:center;width:48px;height:48px;padding:0;border-radius:50%;
  border:1px solid rgba(255,255,255,.35);background:rgba(14,34,56,.6);color:#fff;cursor:pointer;
  transition:background .2s ease,border-color .2s ease;
}
.es-lightbox-btn:hover{background:rgba(14,34,56,.9);border-color:#fff}
.es-lightbox-btn:focus-visible{outline:3px solid #fff;outline-offset:2px}
.es-lightbox-close{top:20px;right:20px}
.es-lightbox-prev{left:20px;top:50%;translate:0 -50%}
.es-lightbox-next{right:20px;top:50%;translate:0 -50%}
@media (max-width:720px){
  .es-lightbox-prev,.es-lightbox-next{top:auto;bottom:24px;translate:none}
  .es-lightbox-prev{left:calc(50% - 60px)}
  .es-lightbox-next{right:calc(50% - 60px)}
  .es-lightbox-figure img{max-height:calc(100vh - 220px)}
}
@media (prefers-reduced-motion:reduce){.es-lightbox[open]{animation:none}}
html.es-lightbox-open .mobile-mortgage-cta{visibility:hidden!important}
