/* ==========================================================
   Varsha Sahakari - responsive layout + EMI calculator
   Loaded last (after home.css and animations.css).
   Breakpoints: 1100 (small laptop), 860 (tablet / phone nav),
                640 (large phone), 420 (small phone)
   ========================================================== */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
body { overflow-x: hidden }
img, video { max-width: 100%; height: auto }
h1, h2, h3, h4, p, a, td, th, dd, dt, label { overflow-wrap: break-word }
button, .solid, .ghost { touch-action: manipulation }

/* hero picture beside the text */
.hero > img { flex: 0 1 auto; max-width: min(40%, 420px); margin-right: 6% }

/* ---------- EMI calculator ---------- */
.emi-wrap { max-width: 1040px; margin: 0 auto }
.emi {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin: 2rem 0 1.5rem
}
.emi-form, .emi-result {
    background: var(--cream);
    border: 1px solid #f3d3dd;
    border-radius: 14px;
    padding: 1.6rem
}
.emi-field { display: block; margin-bottom: 1.3rem }
.emi-field:last-child { margin-bottom: 0 }
.emi-lab { display: block; font-weight: 700; font-size: .8rem; color: var(--navy); margin-bottom: .35rem }
.emi input[type=number], .emi select {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid #c9d2e6;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 1rem;
    min-height: 44px
}
.emi input[type=number]:focus, .emi select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(230,0,69,.15) }
.emi-row { display: grid; grid-template-columns: 1fr 140px; gap: .6rem }
.emi input[type=range] {
    width: 100%;
    margin: .7rem 0 0;
    accent-color: var(--brand);
    cursor: pointer
}
.emi-wrap p.emi-big { color: var(--brand); max-width: none }
.emi-wrap p.emi-big-lab { color: var(--navy); max-width: none }
.emi-result { background: #fff; border-color: #dbe3f3; box-shadow: 0 10px 30px rgba(2,58,133,.08) }
.emi-big-lab { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--navy) }
.emi-big {
    margin: .2rem 0 1.2rem;
    font: 900 clamp(2rem, 6vw, 2.8rem)/1.1 Montserrat, Mukta, sans-serif;
    color: var(--brand);
    overflow-wrap: anywhere
}
.emi-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #e8ecf5 }
.emi-bar i { background: var(--navy); transition: width .5s var(--ease-out, ease) }
.emi-bar b { background: var(--brand); transition: width .5s var(--ease-out, ease) }
.emi-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: .7rem 0 1.2rem; font-size: .8rem; color: var(--mut) }
.emi-legend em { font-style: normal; font-weight: 800; color: #000 }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; text-decoration: none }
.dot.p { background: var(--navy) }
.dot.i { background: var(--brand) }
.emi-sum { margin: 0 }
.emi-sum > div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid #e3e8f3 }
.emi-sum dt, .emi-sum dd { margin: 0; padding: 0; border: 0; font-size: .9rem }
.emi-sum dt { font-weight: 600; color: var(--mut) }
.emi-sum dd { font-weight: 800; text-align: right; overflow-wrap: anywhere }
.emi-sum .tot dt, .emi-sum .tot dd { color: var(--navy); font-size: 1rem }
.note.center, .btnrow.center { text-align: center; justify-content: center; margin-left: auto; margin-right: auto }

/* ---------- 1100px : small laptops ---------- */
@media (max-width: 1100px) {
    .hero-text { margin-left: 12% }
    .hero-art { right: 10% }
    .content { padding: 3.5rem 6% }
    .four { grid-template-columns: 1fr 1fr 1fr }
}

/* ---------- 860px : tablets and phones (top bar layout) ---------- */
@media (max-width: 860px) {
    .rail { padding: 0 .9rem; gap: .5rem }
    .rail-top { display: flex; align-items: center; gap: .6rem; grid-auto-flow: column }
    .rail-logo img { width: 36px }
    .rail-name {
        font-size: .68rem;
        line-height: 1.15;
        white-space: normal;
        text-align: right;
        margin-right: 7.4rem;
        max-width: 36vw
    }
    .lang-toggle { top: .55rem; right: .7rem }
    .lang-toggle span { padding: .22rem .6rem }

    .menu { padding: 4.2rem 1.4rem 2rem }
    .menu .close { left: .9rem; right: auto; top: .55rem }
    .menu .cols { grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem }
    .menu a { padding: .4rem 0 }

    .hero { flex-direction: column; align-items: flex-start; min-height: 0 }
    .hero-text { margin: 0; padding: 3.5rem 7% 1.5rem }
    .hero > img { max-width: 62%; margin: 0 auto 2.5rem }
    .hero-art { display: none }
    .script { font-size: clamp(4rem, 20vw, 8rem); left: 4%; top: 2% }

    .treat { padding: 3.5rem 1rem }
    .three { gap: 2.2rem; margin: 2.5rem 0 }
    .meet { min-height: 0 }
    .why { padding: 3.5rem 1rem }

    .emi { grid-template-columns: 1fr }
    .page-hero { padding: 2.5rem 1rem; min-height: 180px }
    .content { padding: 2.5rem 5% }
    .content.narrow { padding: 2.5rem 1.1rem }
    .four { grid-template-columns: 1fr 1fr }
    .touch { padding: 3.5rem 6% 3rem }
}

/* ---------- 640px : phones ---------- */
@media (max-width: 640px) {
    body { font-size: 14.5px }
    .hero h1 { font-size: clamp(1.9rem, 9.5vw, 2.8rem) }
    .hero > img { max-width: 78% }
    .spaced { letter-spacing: .3em; font-size: .75rem }
    .page-hero .spaced { letter-spacing: .25em }

    .three { flex-direction: column; align-items: center; gap: 2rem }
    .three a, .treat .three a { width: 100%; max-width: 280px }
    .treat .three a img.scheme-img { width: 100%; height: auto; aspect-ratio: 11 / 8 }
    .why .three > div { width: 100%; max-width: 300px }

    .loan-table th, .loan-table td, table th, table td { padding: .5rem .55rem; font-size: .8rem }
    .scroll { margin-left: -.2rem; margin-right: -.2rem }
    .dg-cards { gap: 1rem }
    .dg-card { width: 100% }
    .ab { padding: 2rem 1rem 3rem }
    .ab-cards, .ab-cards.small { grid-template-columns: 1fr }

    .contact-card { flex-direction: row; padding: 1rem }
    .contact-form input, .contact-form textarea, .stack input, .stack textarea { font-size: 16px }

    .emi-form, .emi-result { padding: 1.1rem; border-radius: 12px }
    .emi-row { grid-template-columns: 1fr 118px }
    .emi-sum > div { flex-direction: column; gap: .1rem }
    .emi-sum dd { text-align: left }

    .btnrow { flex-direction: column; align-items: stretch }
    .btnrow .solid, .btnrow .ghost { text-align: center; padding: .8rem 1rem }
    .btnrow.center { align-items: stretch }

    .copy { letter-spacing: .1em; line-height: 1.7 }
    .foot { padding: 1.4rem 1rem 1.8rem }
    .four { grid-template-columns: 1fr }
    .menu .cols { grid-template-columns: 1fr }
}

/* ---------- 420px : small phones ---------- */
@media (max-width: 420px) {
    .rail-name { max-width: 32vw; font-size: .62rem; margin-right: 6.9rem }
    .lang-toggle span { padding: .2rem .5rem; font-size: .7rem }
    .hero-text { padding-left: 6%; padding-right: 6% }
    .panel { padding: 2.5rem 7% }
    .panel h3 { font-size: 1.5rem }
    .page-hero h1 { font-size: 1.7rem }
    .emi-big { font-size: 1.9rem }
}

/* large screens: keep the content from stretching too wide */
@media (min-width: 1700px) {
    body { font-size: 16px }
    .content { padding-left: 10%; padding-right: 10% }
}

/* landscape phones: don't let the hero eat the whole screen */
@media (max-height: 480px) and (orientation: landscape) {
    .hero { min-height: 0 }
    .hero-text { padding-top: 2rem }
    .menu { padding-top: 3.4rem }
}
