/* ============================================
   OPENING INTRO – "Sunrise Skyline"
   A warm sunrise glows up behind a city skyline that draws
   itself line by line; the windows light up one row at a time while
   the Mahodadhi Homes logo settles inside a golden ring. The screen
   then slides up to reveal the site (~3.7s, skippable).
   Home page only. Played once per browser session.
   ============================================ */

#mh-intro {
  --mi-navy: #1d2a78;
  --mi-gold: #d99a3f;
  --mi-gold-light: #f2c777;
  --mi-cream: #fffaf0;

  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf9 0%, #fbf1df 62%, #f6e3c2 100%);
  transition: transform .85s cubic-bezier(.76, 0, .24, 1), box-shadow .85s ease, visibility 0s linear .86s;
  cursor: pointer;
  /* Safety net: if scripts fail, the intro still gets out of the way */
  animation: mi-failsafe .01s linear 6.5s forwards;
}

@keyframes mi-failsafe { to { visibility: hidden; opacity: 0; pointer-events: none; } }

#mh-intro.is-leaving {
  transform: translateY(-101%);
  box-shadow: 0 3px 0 var(--mi-gold), 0 24px 70px rgba(217, 154, 63, .5);
  visibility: hidden;
  pointer-events: none;
}

html.mh-intro-skip #mh-intro { display: none; }
html.intro-playing { overflow: hidden; }

/* ---------- Sun glow ---------- */
.mi-sun {
  position: absolute;
  left: 50%;
  bottom: 6vh;
  width: min(120vmin, 1100px);
  height: min(120vmin, 1100px);
  margin-left: calc(min(120vmin, 1100px) / -2);
  margin-bottom: calc(min(120vmin, 1100px) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 190, 92, .62) 0%, rgba(247, 190, 92, .28) 34%, rgba(247, 190, 92, 0) 66%);
  opacity: 0;
  transform: translateY(35%) scale(.55);
  animation: mi-sun-rise 2s cubic-bezier(.2, .7, .2, 1) .2s forwards;
}

@keyframes mi-sun-rise { to { opacity: 1; transform: translateY(-4%) scale(1); } }

/* ---------- Skyline ---------- */
.mh-skyline {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: clamp(170px, 34vh, 360px);
}

.mh-ground, .mh-bl {
  fill: none;
  stroke: var(--mi-navy);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.mh-ground { animation: mi-draw 1.2s ease-out .1s forwards; }

.mh-bl { animation: mi-draw 1.3s cubic-bezier(.4, .1, .2, 1) calc(.25s + var(--i, 0) * .045s) forwards; }

.mh-bf {
  fill: var(--mi-cream);
  opacity: 0;
  animation: mi-fade .7s ease calc(.75s + var(--i, 0) * .04s) forwards;
}

.mh-w {
  fill: none;
  stroke-width: 8;
  stroke-dasharray: 6 6;
  opacity: 0;
  animation: mi-win .6s ease var(--d, 1.4s) forwards;
}

@keyframes mi-draw { to { stroke-dashoffset: 0; } }
@keyframes mi-fade { to { opacity: 1; } }
@keyframes mi-win  { 0% { opacity: 0; } 55% { opacity: 1; } 70% { opacity: .55; } 100% { opacity: .95; } }

/* ---------- Centre stack ---------- */
.mi-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -10vh;
  text-align: center;
}

.mi-eyebrow {
  margin: 0 0 1.4rem;
  color: #8d5723;
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  animation: mi-rise .8s ease 1s forwards;
}

.mi-badge {
  position: relative;
  width: clamp(210px, 28vmin, 270px);
  height: clamp(210px, 28vmin, 270px);
  display: grid;
  place-items: center;
}

.mi-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mi-ring-a {
  fill: none;
  stroke: var(--mi-gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  animation: mi-draw 1.4s cubic-bezier(.4, .1, .2, 1) .45s forwards;
}

.mi-ring-b {
  fill: none;
  stroke: var(--mi-gold-light);
  stroke-width: 1.4;
  stroke-dasharray: 1.5 9;
  stroke-linecap: round;
  opacity: 0;
  transform-origin: 50% 50%;
  animation: mi-fade .8s ease 1.3s forwards, mi-spin 14s linear infinite;
}

@keyframes mi-spin { to { transform: rotate(360deg); } }

.mi-badge::before {          /* soft white disc behind the logo */
  content: "";
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffaf0 70%, rgba(255, 250, 240, 0) 100%);
  box-shadow: 0 14px 50px rgba(217, 154, 63, .28);
  opacity: 0;
  transform: scale(.7);
  animation: mi-pop .9s cubic-bezier(.2, 1.2, .3, 1) .7s forwards;
}

.mi-logo {
  position: relative;
  width: 56%;
  height: auto;
  opacity: 0;
  transform: translateY(14px) scale(.9);
  animation: mi-logo-in .9s cubic-bezier(.2, 1, .3, 1) .95s forwards;
}

@keyframes mi-pop     { to { opacity: 1; transform: scale(1); } }
@keyframes mi-logo-in { to { opacity: 1; transform: none; } }
@keyframes mi-rise    { to { opacity: 1; transform: none; } }

.mi-progress {
  width: 150px;
  height: 2px;
  margin-top: 1.7rem;
  border-radius: 2px;
  background: rgba(29, 42, 120, .12);
  overflow: hidden;
  opacity: 0;
  animation: mi-fade .4s ease .6s forwards;
}

.mi-progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--mi-gold), var(--mi-gold-light));
  transform: scaleX(0);
  transform-origin: left center;
  animation: mi-bar 2.3s cubic-bezier(.45, .1, .25, 1) .6s forwards;
}

@keyframes mi-bar { to { transform: scaleX(1); } }

/* ---------- Skip ---------- */
.mi-skip {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 3;
  padding: 8px 16px;
  border: 1px solid rgba(29, 42, 120, .25);
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  color: var(--mi-navy);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.mi-skip:hover { background: var(--mi-navy); color: #fff; }
.mi-skip:focus-visible { outline: 3px solid var(--mi-gold); outline-offset: 2px; }

/* ---------- Hero waits for the intro, then plays its own reveal ---------- */
html.intro-playing .hero-eyebrow,
html.intro-playing .hero-title,
html.intro-playing .hero-description,
html.intro-playing .hero-cta,
html.intro-playing .hero-trust {
  animation-play-state: paused !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .mi-eyebrow { font-size: .62rem; letter-spacing: .26em; margin-bottom: 1.1rem; }
  .mi-center { margin-top: -12vh; }
  .mi-skip { right: 14px; top: 14px; }
  .mi-progress { width: 120px; margin-top: 1.4rem; }
}

@media (max-height: 520px) {
  .mi-eyebrow { display: none; }
  .mi-badge { width: 150px; height: 150px; }
  .mh-skyline { height: 30vh; }
}

/* ---------- Reduced motion: calm, short fade ---------- */
@media (prefers-reduced-motion: reduce) {
  #mh-intro { transition: opacity .4s ease; }
  #mh-intro.is-leaving { transform: none; opacity: 0; box-shadow: none; }
  .mi-sun, .mh-bf, .mh-w, .mi-eyebrow, .mi-badge::before, .mi-logo, .mi-progress, .mi-progress i, .mi-ring-b {
    animation-duration: .01s !important; animation-delay: 0s !important;
  }
  .mh-ground, .mh-bl, .mi-ring-a { animation-duration: .01s !important; animation-delay: 0s !important; }
  .mi-ring-b { animation: mi-fade .01s forwards; }
}
