/* ============================================
   HERITAGE REFINED SECTION STYLES
   ============================================ */

.heritage-refined-section {
    position: relative;
    width: 100%;
    padding: 100px 20px;
    background: #FFFFFF;
    overflow: visible;
    overflow-x: hidden;
}

/* Ensure component and its children don't create unexpected overflow */
.heritage-refined-section,
.heritage-refined-section * {
    box-sizing: border-box;
}

.heritage-refined-inner {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 80px;
}

/* Tabs Controls */
.heritage-refined-tabs {
    display: flex;
    gap: 16px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.heritage-tab-button {
    background: transparent;
    border: none;
    color: var(--Black, #181818);
    font-family: "General Sans Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
}

.heritage-tab-button.is-active,
.heritage-tab-button:focus {
    color: var(--Brown, #833C1E);
}

.heritage-tab-button.is-active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -8px;
    height: 3px;
    background: var(--Brown, #833C1E);
    border-radius: 2px;
}

/* Header */
.heritage-refined-header {
    display: flex;
    flex-direction: column;
    gap: 32px;
    text-align: center;
    align-items: center;
}

.heritage-refined-title {
    color: var(--Black, #181818);
    font-family: Costaline, serif;
    font-size: 64px;
    font-weight: 100;
    line-height: 1.7;
    margin: 0;
}

.heritage-refined-description {
    color: var(--Black, #181818);
    font-family: "General Sans Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: normal;
    max-width: 100%;
    margin: 0;
}

/* Main Content Area */
.heritage-refined-content {
    position: relative;
    height: 448px;
    display: flex;
    gap: 0;
}

/* Heritage Image Left Side */
.heritage-refined-image-left {
    width: 320.899px;
    height: 426.59px;
    padding-right: 20px;
    z-index: 1;
    position: relative;
}

.heritage-image {
    position: relative;
    left: 0;
    top: 0;
    width: 276.889px;
    height: 422.312px;
    object-fit: cover;
    max-width: 100%;
    display: block;
}

/* Make images and decorative vectors scale down to avoid pushing the layout wider */
.heritage-house-image-wrapper img,
.heritage-margin,
.heritage-house-margin {
    max-width: 100%;
    display: block;
}

/* Height 100% only for left and right margins */
.heritage-margin-left,
.heritage-margin-right,
.heritage-house-margin-left,
.heritage-house-margin-right {
    height: 100%;
}

.heritage-image-reflection {
    position: absolute;
    left: 25.1px;
    top: 295.79px;
    width: 276.889px;
    height: 130.797px;
    overflow: hidden;
    transform: scaleY(-1);
}

.heritage-image-reflected {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.heritage-image-fade {
    position: absolute;
    left: 28.52px;
    top: 354.78px;
    width: 288.095px;
    height: 71.81px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #FFFFFF 100%);
    z-index: 2;
}

/* Mission and Vision Boxes Container */
.heritage-refined-boxes {
    position: relative;
    display: flex;
    padding-left: 20px;
    flex-direction: column;
    gap: 85px;
}

/* Hide non-active panels when JS is enabled (progressive enhancement) */
.heritage-box[hidden] {
    display: none !important;
}

/* Individual Heritage Box */
.heritage-box {
    position: relative;
    width: 788px;
    background: transparent;
    padding: 28px 24px;
}

.heritage-box-mission {
    min-height: 120px;
}

.heritage-box-vision {
    /* allow the vision box to grow/shrink with its content */
    min-height: 0;
}

/* Black Margins for Boxes */
.heritage-margin {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.heritage-margin-top {
    top: -1px;
    left: -1px;
    right: -1px;
    width: calc(100% + 2px);
    height: auto;
}

.heritage-margin-left {
    top: -1px;
    left: -1px;
    bottom: -1px;
    width: auto;
    height: calc(100% + 2px);
}

.heritage-margin-right {
    top: -1px;
    right: -1px;
    bottom: -1px;
    width: auto;
    height: calc(100% + 2px);
}

.heritage-margin-bottom {
    bottom: -1px;
    left: -1px;
    right: -1px;
    width: calc(100% + 2px);
    height: auto;
}

/* Glass Icon */
.heritage-glass-icon-wrapper {
    position: absolute;
    right: 35px;
    top: -35px;
    width: 55.306px;
    height: 88px;
    background: #FFFFFF;
    overflow: hidden;
    z-index: 1;
}

.heritage-box-vision .heritage-glass-icon-wrapper {
    left: 27px;
    top: -36px;
}

.heritage-glass-icon {
    position: absolute;
    left: 10px;
    top: 0;
    width: 40.233px;
    height: 60.229px;
    object-fit: contain;
    z-index: 0;
}

/* Box Content */
.heritage-box-content {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 707px;
    max-width: calc(100% - 80px);
    padding: 0;
    z-index: 10;
}

.heritage-box-text {
    color: var(--Black, #181818);
    font-family: "General Sans Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 32px;
    margin: 0;
    text-align: left;
    z-index: 10;
}

.heritage-highlight {
    color: var(--Brown, #833C1E);
    font-family: "Alamendro", serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.1;
}

/* Bottom House Image */
.heritage-house-image-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
}

.heritage-house-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center center;
}

/* Grey Margins for House Image */
.heritage-house-margin {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.heritage-house-margin-top {
    top: -1px;
    left: -1px;
    right: -1px;
    width: calc(100% + 2px);
    height: auto;
}

.heritage-house-margin-left {
    top: -1px;
    left: -1px;
    bottom: -1px;
    width: auto;
    height: calc(100% + 2px);
}

.heritage-house-margin-right {
    top: -1px;
    right: -1px;
    bottom: -1px;
    width: auto;
    height: calc(100% + 2px);
}

.heritage-house-margin-bottom {
    bottom: -1px;
    left: -1px;
    right: -1px;
    width: calc(100% + 2px);
    height: auto;
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .heritage-refined-inner {
        max-width: 90%;
    }

    .heritage-refined-title {
        font-size: 48px;
    }

    .heritage-refined-description {
        font-size: 16px;
    }

    .heritage-refined-content {
        height: auto;
        flex-direction: column;
        gap: 40px;
    }

    .heritage-refined-image-left {
        position: relative;
        left: auto;
        margin: 0 auto 40px auto;
        width: 200px;
        height: auto;
        padding-right: 0;
    }

    .heritage-image {
        width: 100%;
        height: auto;
        position: static;
        left: auto;
        top: auto;
        margin: 0;
    }

    .heritage-image-reflection,
    .heritage-image-fade {
        display: none;
    }

    .heritage-refined-boxes {
        margin-left: 0;
        display: flex;
        flex-direction: column;
        padding-left: 0;
        gap: 40px;
    }

    .heritage-box {
        width: 100%;
        height: auto !important;
        margin-top: 0 !important;
        padding: 40px 20px;
    }

    .heritage-box-content {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .heritage-house-image-wrapper {
        height: 449px;
    }

    .heritage-house-image {
        object-fit: cover;
        height: 100%;
    }
}

/* Mobile Responsive - Matches Figma 682-9991 */
@media (max-width: 768px) {
    .heritage-refined-section {
        padding: 72px 0 48px 0;
        background: #FFFFFF;
    }

    /* Prevent inner container from exceeding viewport width on small devices */
    .heritage-refined-inner {
        max-width: 100%;
        padding: 0;
        gap: 48px;
    }

    .heritage-refined-header {
        gap: 24px;
        padding: 0 32px;
    }

    .heritage-refined-title {
        font-size: 32px;
        color: #181818;
    }

    .heritage-refined-description {
        font-size: 16px;
        line-height: normal;
        color: #181818;
        width: min-content;
        min-width: 100%;
    }

    .heritage-refined-content {
        height: auto;
        flex-direction: column;
        gap: 0;
        width: 311px;
        margin: 0 auto;
    }

    .heritage-refined-image-left {
        display: block;
        width: 123px;
        height: auto;
        padding: 0;
        margin: 0 auto 84px auto;
    }

    .heritage-image {
        width: 123px;
        height: auto;
        position: static;
        margin: 0 auto;
    }

    .heritage-image-reflection,
    .heritage-image-fade {
        display: none;
    }

    .heritage-refined-boxes {
        margin-left: 0;
        padding: 0;
        gap: 40px;
        width: 311px;
    }

    .heritage-box {
        width: 311px;
        height: auto;
        margin-top: 0;
        padding: 32px 16px;
        background: #FFFFFF;
        border: 1px solid #181818;
    }

    .heritage-box-mission {
        height: 161px;
        margin-top: 0;
        padding: 32px 16px;
    }

    .heritage-box-vision {
        height: 216px;
        margin-top: 0;
        padding: 32px 16px;
    }

    .heritage-margin {
        display: block;
    }

    .heritage-glass-icon-wrapper {
        display: block;
        width: 58px;
        height: 88px;
    }

    .heritage-box-mission .heritage-glass-icon-wrapper {
        right: auto;
        left: auto;
        top: -35px;
    }

    .heritage-box-vision .heritage-glass-icon-wrapper {
        left: 11px;
        top: -36px;
    }

    .heritage-box-content {
        position: relative;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: none;
        width: 279.032px;
        padding: 0;
        z-index: 10;
    }

    .heritage-box-text {
        font-size: 16px;
        line-height: 24px;
        width: 100%;
        text-align: left;
        color: #181818;
        white-space: pre-wrap;
    }

    .heritage-highlight {
        font-size: 16px;
        color: #833C1E;
    }

    .heritage-house-image-wrapper {
        width: 311px;
        max-width: 311px;
        height: 449px;
        margin: 0 auto;
        padding: 0;
    }

    .heritage-house-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .heritage-house-margin {
        display: none;
    }
}