/* =============================================================
   Tasaciones Inmobiliarias Page
   Tema Piedrangular

   Sections:
     1. Banner            (.tas-banner)
     2. Page wrapper      (.tas-page-wrapper)
     3. Page layout grid  (.tas-page-layout)
     4. Service cards     (.tas-service-card / .tas-detail-box)
     5. Sidebar           (.tas-sidebar / .tas-nav__link / .tas-download__link)
     6. Sidebar form      (.tas-sidebar-form)
     7. Responsive
   ============================================================= */


/* =============================================================
   1. BANNER
   ============================================================= */

.tas-banner {
    position: relative;
    min-height: 480px;
    background-color: var(--color-navy, #0a1f3d);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
}

.tas-banner__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        rgba(5, 18, 46, 0.88) 0%,
        rgba(5, 18, 46, 0.65) 55%,
        rgba(5, 18, 46, 0.45) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.tas-banner__inner {
    position: relative;
    z-index: 2;
    padding: 96px 0 72px;
}

.tas-banner__title {
    font-size: clamp(2.25rem, 6vw, 4rem);
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin: 0 0 28px;
}

.tas-banner__breadcrumb {
    display: inline-block;
    background-color: var(--color-navy, #0a1f3d);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 11px 22px;
    line-height: 1;
}


/* =============================================================
   2. PAGE WRAPPER
   ============================================================= */

.tas-page-wrapper {
    background-color: #eef1f8;
    padding: clamp(40px, 6vw, 64px) 0 clamp(60px, 8vw, 100px);
}


/* =============================================================
   3. PAGE LAYOUT GRID
   ============================================================= */

.tas-page-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: clamp(24px, 3vw, 40px);
    align-items: start; /* Required for position: sticky on sidebar */
}


/* =============================================================
   4. SERVICE CARDS
   ============================================================= */

.tas-content {
    display: flex;
    flex-direction: column;
    gap: clamp(24px, 3vw, 36px);
    min-width: 0; /* Prevent grid blowout */
}

/* Card container */
.tas-service-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(10, 31, 61, 0.08);
    overflow: hidden;
    /* Scroll-margin offsets the sticky header when navigating to anchor */
    scroll-margin-top: 130px;
}

/* Image */
.tas-service-card__image-wrap {
    width: 100%;
    overflow: hidden;
}

.tas-service-card__image {
    width: 100%;
    height: clamp(220px, 28vw, 380px);
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.tas-service-card:hover .tas-service-card__image {
    transform: scale(1.02);
}

.tas-service-card__image-wrap--placeholder {
    height: clamp(180px, 22vw, 300px);
    background: linear-gradient(135deg, #d9e4f5 0%, #b8cdf0 100%);
}

/* Card body */
.tas-service-card__body {
    padding: clamp(24px, 3vw, 36px);
}

/* Title */
.tas-service-card__title {
    font-size: clamp(1.25rem, 2.5vw, 1.625rem);
    font-weight: 800;
    color: var(--color-primary, #1a4ddb);
    line-height: 1.3;
    margin: 0 0 16px;
    text-wrap: balance;
}

/* Description */
.tas-service-card__desc {
    color: #444;
    font-size: 0.9375rem;
    line-height: 1.8;
    margin: 0 0 clamp(20px, 3vw, 28px);
}

/* Two-column detail blocks */
.tas-service-card__details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(12px, 2vw, 20px);
}

/* Individual detail box */
.tas-detail-box {
    background-color: var(--color-section-blue, #1a3a99);
    border-radius: 6px;
    padding: clamp(16px, 2.5vw, 24px) clamp(14px, 2vw, 20px);
}

.tas-detail-box__heading {
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 14px;
    line-height: 1.3;
}

.tas-detail-box__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tas-detail-box__list li {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.8125rem;
    line-height: 1.6;
    padding-left: 16px;
    position: relative;
}

.tas-detail-box__list li::before {
    content: '•';
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}


/* =============================================================
   5. SIDEBAR
   ============================================================= */

.tas-sidebar {
    position: sticky;
    top: 120px;
    /*
     * max-height matches top exactly: sidebar fills from 120px to the bottom
     * of the viewport, giving every available pixel to the scroll area.
     * Using 120px (not 140px) prevents the previous 20px dead-zone that
     * was cutting the last item in each box.
     */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 16px);
    min-width: 0;
    /*
     * padding-bottom ensures the WhatsApp button at the very bottom of the
     * form is never flush against the scroll boundary and is always fully
     * visible. Increased from 16px to 24px for extra safety.
     */
    padding-bottom: 24px;
    /* Thin scrollbar on supporting browsers — keeps UX clean */
    scrollbar-width: thin;
    scrollbar-color: rgba(26, 77, 219, 0.25) transparent;
}

.tas-sidebar::-webkit-scrollbar {
    width: 4px;
}

.tas-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.tas-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(26, 77, 219, 0.25);
    border-radius: 4px;
}

/* Generic sidebar box */
.tas-sidebar__box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 14px rgba(10, 31, 61, 0.08);
    /*
     * overflow: clip instead of overflow: hidden.
     * Both clip content to the rounded border-box visually, but clip does NOT
     * create a new block formatting context. This means the browser can
     * correctly compute each box's natural height when the outer sidebar
     * calculates its total scrollable content length — eliminating the
     * last-item truncation that hidden caused.
     */
    overflow: clip;
}

.tas-sidebar__box-title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--color-primary, #1a4ddb);
    margin: 0;
    padding: 14px 16px 11px;
    border-bottom: 1px solid #eef1f8;
}

/* ---- Nav box ---- */
.tas-sidebar__box--nav {
    /* No extra overrides needed */
}

/* Inner wrapper — gives padding around the button list and creates the gap between pills */
.tas-sidebar__box--nav nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 10px 10px;
}

.tas-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: var(--color-primary, #1a4ddb);
    border-radius: 8px;     /* pill shape matching target design */
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    padding: 9px 12px 9px 14px;
    transition: background-color 0.2s ease;
    /* No border-bottom — gap between items handles visual separation */
}

.tas-nav__link:hover,
.tas-nav__link:focus-visible {
    background-color: var(--color-primary-hover, #1540c0);
    outline: none;
    color: #fff;
}

/* Active state updated by JS as user scrolls */
.tas-nav__link.is-active {
    background-color: var(--color-navy, #061539);
}

.tas-nav__label {
    flex: 1;
    word-break: break-word;
}

/* Chevron — styled as a small rounded container to match target UI */
.tas-nav__chevron {
    flex-shrink: 0;
    align-self: center;
    display: block;
    width: 22px;
    height: 22px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    opacity: 1;
}

/* ---- Downloads box ---- */
.tas-sidebar__box--downloads {
    /* Padding handled by title + download links */
}

.tas-download__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;     /* matches nav link horizontal padding for visual alignment */
    text-decoration: none;
    color: var(--color-primary, #1a4ddb);
    font-size: 0.875rem;    /* same scale as nav labels */
    font-weight: 700;
    border-bottom: 1px solid #eef1f8;
    transition: background-color 0.18s ease;
    cursor: pointer;
}

.tas-download__link:last-child {
    border-bottom: none;
}

.tas-download__link:hover:not(.tas-download__link--disabled),
.tas-download__link:focus-visible:not(.tas-download__link--disabled) {
    background-color: #f5f7ff;
    outline: none;
}

.tas-download__link--disabled {
    opacity: 0.45;
    cursor: default;
}

.tas-download__icon {
    flex-shrink: 0;
    color: #e04040;  /* PDF red */
}

.tas-download__label {
    flex: 1;
}

.tas-download__arrow {
    flex-shrink: 0;
    color: var(--color-primary, #1a4ddb);
    opacity: 0.7;
}

/* ---- Form box ---- */
.tas-sidebar__box--form {
    /* No extra overrides needed */
}

.tas-sidebar__box--form .tas-sidebar__box-title {
    /* Same as generic title */
}


/* =============================================================
   6. SIDEBAR FORM
   ============================================================= */

.tas-sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: clamp(14px, 2vw, 20px) clamp(16px, 2vw, 20px) clamp(16px, 2vw, 22px);
}

/* Two-field inline row */
.tas-sidebar-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Submit — WhatsApp green */
.tas-sidebar-form__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    background-color: #25a244;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.125rem;
}

.tas-sidebar-form__submit:hover {
    background-color: #1e8c3a;
}

.tas-sidebar-form__submit:focus-visible {
    outline: 3px solid rgba(37, 162, 68, 0.4);
    outline-offset: 2px;
}

/* Reuse .form-field__* from contact.css (loaded globally) */


/* =============================================================
   7. RESPONSIVE
   ============================================================= */

/* Tablet — tighten sidebar */
@media (max-width: 1100px) {
    .tas-page-layout {
        grid-template-columns: 1fr 320px;
    }
}

/* Below 900px — stack to single column */
@media (max-width: 900px) {
    .tas-page-layout {
        grid-template-columns: 1fr;
    }

    /* Sidebar loses sticky behaviour — reset viewport-constrained rules */
    .tas-sidebar {
        position: static;
        top: auto;
        max-height: none;
        overflow-y: visible;
        padding-bottom: 0;
    }

    /* Service card image height adjust */
    .tas-service-card__image {
        height: clamp(200px, 40vw, 320px);
    }

    /* Detail boxes may stack on narrow screens */
    .tas-service-card__details {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile — single column detail boxes */
@media (max-width: 560px) {
    .tas-service-card__details {
        grid-template-columns: 1fr;
    }

    .tas-sidebar-form__row {
        grid-template-columns: 1fr;
    }

    .tas-service-card__body {
        padding: 20px 16px 24px;
    }
}

@media (max-width: 400px) {
    .tas-banner__title {
        font-size: 1.875rem;
    }
}
