/* ==========================================================
   TEXT + IMAGE SECTION  (theme-aware, mobile-first)
   Themes: Ivory Luxe, Aurora, Emerald Mist ...
   Optional override per section: style="--ti-pad-y: 32px"
========================================================== */

/* ---------- base / variables ---------- */
.ti-section{
    --ti-bg: var(--section-primary-bg, #fbfdfb);
    --ti-heading: var(--text-primary, #1d3528);
    --ti-text: var(--text-secondary, #5a6d63);
    --ti-eyebrow: var(--brand-secondary, #2d9d58);
    --ti-accent: var(--button-primary-bg, linear-gradient(135deg,#3bb76b,#228b45));
    --ti-lines: 6;                                   /* mobile read-more lines */

    background: var(--ti-bg);
    /* padding-block: var(--ti-pad-y, clamp(36px, 6vw, 72px)); */
    padding-top: var(--ti-pad-top, 5px);
    padding-bottom: var(--ti-pad-bottom, clamp(36px, 0vw, 72px));
    overflow: hidden;
}

.ti-section[data-bg="tint"]{
    --ti-bg: var(--section-secondary-bg, #eef8f0);
}

.ti-section[data-bg="dark"]{
    --ti-bg: var(--section-dark-bg, #1d4735);
    --ti-heading: var(--text-light, #fff);
    --ti-text: rgba(255,255,255,.82);
    --ti-eyebrow: var(--brand-accent, #8bcf7b);
}

/* ---------- layout ---------- */
.ti-container{
    max-width: var(--container-width, 1320px);
    margin-inline: auto;
    padding-inline: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 28px;
}

.ti-media,
.ti-content{
    min-width: 0;
}

/* ---------- media ---------- */
.ti-media{
    position: relative;
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
}

.ti-media-frame{
    position: relative;
    z-index: 1;
    border-radius: 16px;
}

/* offset gradient frame (default: image left => frame right/neeche) */
.ti-media-frame::before{
    content: "";
    position: absolute;
    inset: 12px -10px -12px 10px;
    border-radius: inherit;
    background: var(--ti-accent);
    opacity: .85;
    z-index: -1;
    transition: inset .35s ease;
}

.ti-media-frame img,
.ti-media-frame video,
.ti-placeholder{
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 11;
    object-fit: cover;
    border-radius: inherit;
    box-shadow: var(--shadow-lg, 0 25px 60px rgba(34,139,69,.18));
    background: var(--surface-tertiary, #eef8f0);
    transition: transform .6s ease;
}

.ti-placeholder{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted, #87978e);
    border: 2px dashed var(--border-primary, #dcefe2);
    box-shadow: none;
}
.ti-placeholder i{ font-size: 36px; }

/* badge */
.ti-badge{
    position: absolute;
    left: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--surface-glass, rgba(255,255,255,.82));
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    color: var(--on-surface-glass, var(--text-primary, #1d3528));
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-md, 0 14px 35px rgba(34,139,69,.12));
}
.ti-badge:empty{ display: none; }

/* ---------- content ---------- */
.ti-eyebrow{
    display: inline-block;
    margin-bottom: 10px;
    padding: 5px 12px;
    border-radius: var(--radius-full, 9999px);
    background: var(--surface-tertiary, #eef8f0);
    border: 1px solid var(--border-secondary, rgba(52,168,83,.12));
    color: var(--ti-eyebrow);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ti-eyebrow:empty{ display: none; }

.ti-section[data-bg="dark"] .ti-eyebrow{
    background: rgba(255,255,255,.1);
    border-color: var(--border-light, rgba(255,255,255,.22));
}

.ti-heading{
    margin: 0 0 12px;
    color: var(--ti-heading);
    font-size: clamp(22px, 5.6vw, 36px);
    line-height: 1.2;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.ti-heading::after{
    content: "";
    display: block;
    width: 54px;
    height: 3px;
    margin-top: 12px;
    border-radius: 4px;
    background: var(--ti-accent);
}

.ti-text{
    color: var(--ti-text);
    font-size: 15px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.ti-text p{ margin: 0 0 12px; }
.ti-text p:last-child{ margin-bottom: 0; }
.ti-text ul,
.ti-text ol{ margin: 0 0 12px; padding-left: 20px; }
.ti-text a{
    color: var(--brand-primary, #34a853);
    text-decoration: underline;
}

/* ---------- points (checklist) ---------- */
.ti-points{
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.ti-points li{
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--ti-text);
    font-size: 15px;
    line-height: 1.5;
}

.ti-points li i{
    flex: 0 0 24px;
    height: 24px;
    margin-top: 1px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ti-accent);
    color: var(--button-primary-text, #fff);
    font-size: 11px;
    box-shadow: var(--shadow-sm, 0 6px 15px rgba(34,139,69,.08));
}

.ti-section[data-bg="dark"] .ti-points li{ color: rgba(255,255,255,.9); }

/* ---------- button ---------- */
.ti-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 22px;
    padding: 13px 22px;
    border-radius: var(--radius-full, 9999px);
    background: var(--ti-accent);
    color: var(--button-primary-text, #fff);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-md, 0 14px 35px rgba(34,139,69,.12));
    transition: var(--transition, .35s ease);
}
.ti-btn i{ transition: transform .3s ease; }

/* ---------- read more (mobile only) ---------- */
/* desktop/tablet: clamp nahi, button nahi */
.ti-text.category-discription.is-clamped{
    display: block;
    -webkit-line-clamp: unset;
            line-clamp: unset;
    max-height: none;
    overflow: visible;
}
.ti-text + .rm-btn{ display: none; }

/* ---------- reveal animation ---------- */
.ti-section [data-reveal]{
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .8s ease, transform .8s ease;
}

/* ---------- Tablet & up (>= 576px) ---------- */
@media (min-width: 576px){
    .ti-container{ padding-inline: 20px; gap: 36px; }

    .ti-points{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
    .ti-points:has(li:nth-child(7)){ grid-template-columns: minmax(0, 1fr); }

    .ti-btn{ width: auto; }
}

/* ---------- Tablet (<= 991px): content bhi centered width me ---------- */
@media (max-width: 991.98px){
    .ti-content{ width: 100%; max-width: 640px; margin-inline: auto; }
}

/* ---------- Mobile only (<= 767px) ---------- */
@media (max-width: 767.98px){

    /* ~6 lines clamp + halka fade */
    .ti-text.category-discription.is-clamped{
        max-height: calc(var(--ti-lines) * 1.75em);
        overflow: hidden;
        -webkit-mask-image: linear-gradient(#000 62%, transparent 100%);
                mask-image: linear-gradient(#000 62%, transparent 100%);
    }

    .ti-text + .rm-btn{
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-top: 6px;
        padding: 8px 0;
        min-height: 40px;
        font-size: 14.5px;
        font-weight: 700;
        text-decoration: none;
        color: var(--brand-secondary, #2d9d58);
    }
    .ti-section[data-bg="dark"] .ti-text + .rm-btn{ color: var(--brand-accent, #8bcf7b); }
    .ti-text + .rm-btn[hidden]{ display: none; }

    /* chevron: More = neeche, Less = upar */
    .ti-text + .rm-btn::after{
        content: "";
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-2px);
        transition: transform .25s ease;
    }
    .ti-text + .rm-btn[aria-expanded="true"]::after{
        transform: rotate(-135deg) translateY(-2px);
    }
}

/* ---------- Small phones (<= 380px) ---------- */
@media (max-width: 380px){
    .ti-container{ padding-inline: 14px; }
    .ti-heading{ font-size: 21px; }
}

/* ---------- Tablet landscape+ (>= 768px) ---------- */
@media (min-width: 768px){
    .ti-media-frame,
    .ti-media-frame img,
    .ti-media-frame video,
    .ti-placeholder{ border-radius: var(--radius-lg, 22px); }

    .ti-media-frame img,
    .ti-media-frame video,
    .ti-placeholder{ aspect-ratio: 4 / 3; }

    .ti-media-frame::before{ inset: 16px -14px -16px 14px; }

    .ti-badge{
        left: 20px; bottom: 20px;
        padding: 12px 20px;
        font-size: 15px;
        border-radius: var(--radius-md, 14px);
    }

    .ti-eyebrow{ font-size: 13px; padding: 6px 16px; margin-bottom: 14px; }
    .ti-heading{ margin-bottom: 18px; }
    .ti-heading::after{ width: 70px; height: 4px; margin-top: 16px; }

    .ti-text{ font-size: 16.5px; line-height: 1.85; }
    .ti-text p{ margin-bottom: 16px; }
    .ti-points li{ font-size: 15.5px; }

    .ti-btn{ margin-top: 28px; padding: 14px 30px; }
}

/* ---------- Desktop (>= 992px): 2 columns ---------- */
@media (min-width: 992px){

    .ti-container{
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: clamp(40px, 5vw, 70px);
    }

    .ti-media{ max-width: none; margin-inline: 0; }
    .ti-content{ max-width: none; margin-inline: 0; }

    /* image right side */
    .ti-section[data-side="right"] .ti-media{ order: 2; }
    .ti-section[data-side="right"] .ti-media-frame::before{ inset: 16px 14px -16px -14px; }

    /* side se aane wali reveal animation */
    .ti-section [data-reveal="media"]{ transform: translateX(-40px); }
    .ti-section[data-side="right"] [data-reveal="media"]{ transform: translateX(40px); }
}

/* ---------- Hover (sirf mouse devices) ---------- */
@media (hover: hover){
    .ti-media:hover .ti-media-frame img,
    .ti-media:hover .ti-media-frame video{ transform: scale(1.02); }

    .ti-media:hover .ti-media-frame::before{ inset: 10px -8px -10px 8px; }
    .ti-section[data-side="right"] .ti-media:hover .ti-media-frame::before{ inset: 10px 8px -10px -8px; }

    .ti-btn:hover{
        background: var(--button-primary-hover, linear-gradient(135deg,#228b45,#176d36));
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg, 0 25px 60px rgba(34,139,69,.18));
    }
    .ti-btn:hover i{ transform: translateX(4px); }
}

/* ---------- reveal: visible / editor (hamesha end me, taaki upar ke transform ko override kare) ---------- */
.ti-section.ti-visible [data-reveal]{
    opacity: 1;
    transform: none;
}
.ti-section.ti-visible [data-reveal="content"]{ transition-delay: .15s; }

/* builder editor me hamesha visible */
.ti-section.ti-editor [data-reveal]{
    opacity: 1 !important;
    transform: none !important;
}

@media (prefers-reduced-motion: reduce){
    .ti-section [data-reveal]{
        opacity: 1;
        transform: none;
        transition: none;
    }
}