/* Дома на главной */
.houses-section {
    background-color: #000;
    color: #fff;
    padding: 40px 0 50px;
    text-align: center;
    overflow: visible;
}

.houses-section-title {
    font-size: 1.8rem;
    margin-bottom: 28px;
    color: var(--color-yellow, #f5c518);
}

.houses-rows {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 40px;
}

.houses-list {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.house-card {
    --house-cap-height: 10px;
    position: relative;
    width: 200px;
    flex-shrink: 0;
    cursor: pointer;
    overflow: visible;
    transition: transform 0.35s ease;
}

.house-card:hover {
    transform: translateY(-6px);
}

.house-card-shell {
    position: relative;
    width: calc(100% + 20px);
    margin: 0 -10px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-ui, 12px) var(--radius-ui, 12px) 0 0;
    overflow: hidden;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.35));
    transition: filter 0.35s ease;
}

.house-card-shell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--house-cap-height) + 14px);
    background-color: var(--house-color, #fff);
    border-radius: var(--radius-ui, 12px) var(--radius-ui, 12px) 0 0;
    z-index: 0;
    pointer-events: none;
}

.house-card:hover .house-card-shell {
    filter:
        drop-shadow(0 14px 32px rgba(0, 0, 0, 0.55))
        drop-shadow(0 0 22px color-mix(in srgb, var(--house-color, #f5c518) 35%, transparent));
}

.house-card-cap {
    position: relative;
    z-index: 2;
    height: var(--house-cap-height);
    flex-shrink: 0;
    background-color: var(--house-color, #fff);
    border-radius: var(--radius-ui, 12px) var(--radius-ui, 12px) 0 0;
    transition: box-shadow 0.35s ease;
}

.house-card:hover .house-card-cap {
    box-shadow: 0 0 14px color-mix(in srgb, var(--house-color, #f5c518) 45%, transparent);
}

.house-card-surface {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 400px;
    margin-top: -1px;
    border-radius: var(--radius-ui, 12px);
    overflow: hidden;
    background: #161616;
    border: 2px solid #3a3a3a;
    border-top: none;
    box-sizing: border-box;
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.house-card:hover .house-card-surface {
    border-color: var(--house-color, #f5c518);
}

.house-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-ui, 12px);
    transition: transform 0.5s ease;
}

.house-card:hover .house-card-bg {
    transform: scale(1.06);
}

.house-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-ui, 12px);
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.1) 40%,
        rgba(0, 0, 0, 0.75) 100%
    );
    transition: background 0.35s ease;
}

.house-card:hover .house-card-bg::after {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.05) 40%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

.house-card-banner {
    position: absolute;
    top: calc(var(--house-cap-height) + 14px);
    left: 0;
    width: 66px;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    border-radius: 4px;
    transform: translateX(-28%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
    z-index: 3;
    border: 2px solid transparent;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.house-card:hover .house-card-banner {
    transform: translateX(-28%) translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.65);
}

.house-card-meta {
    position: absolute;
    top: 14px;
    right: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}

.house-card-players {
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

.house-card-server {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

.house-card-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 12px 16px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.house-card-name-wrap {
    width: 100%;
    min-height: var(--house-name-max-height, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.house-card-motto {
    margin: 0 0 6px;
    font-size: 0.7rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.75);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
}

.house-card-name {
    display: inline-block;
    margin: 0 auto;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    white-space: nowrap;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
    transition: color 0.35s ease, text-shadow 0.35s ease;
}

.house-card:hover .house-card-name {
    color: var(--house-color, #f5c518);
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.85),
        0 0 12px color-mix(in srgb, var(--house-color, #f5c518) 40%, transparent);
}

/* Модальное окно дома */
.house-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
    box-sizing: border-box;
}

.house-modal.active {
    display: flex;
}

.house-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.house-modal-content {
    position: relative;
    --house-cap-height: 10px;
    width: calc(100% + 20px);
    max-width: 1120px;
    height: 88vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: visible;
    box-shadow: none;
    animation: houseModalAppear 0.3s ease-out;
}

.house-modal-cap {
    height: var(--house-cap-height);
    flex-shrink: 0;
    background-color: var(--house-modal-color, var(--color-yellow, #f5c518));
    border-radius: var(--radius-ui, 12px) var(--radius-ui, 12px) 0 0;
}

.house-modal-inner {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-black, #000);
    border-radius: 0 0 var(--radius-ui, 12px) var(--radius-ui, 12px);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}


@keyframes houseModalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.house-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0;
    color: transparent;
}

.house-modal-close::before,
.house-modal-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.house-modal-close::before {
    transform: rotate(45deg);
}

.house-modal-close::after {
    transform: rotate(-45deg);
}

.house-modal-close:hover::before,
.house-modal-close:hover::after {
    background: #ff4444;
}

.house-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.house-modal-banner {
    grid-column: 2;
    grid-row: 1;
    flex-shrink: 0;
    width: 112px;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    border-radius: var(--radius-ui, 12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border: 2px solid transparent;
    margin-top: 3px;
    margin-left: 16px;
    margin-right: 5px;
    align-self: start;
    justify-self: end;
}

.house-modal-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.house-modal-image-container {
    flex: 0 0 auto;
    height: 100%;
    aspect-ratio: 9 / 16;
    background: #0a0a0a;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.house-modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.house-modal-right {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    min-width: 0;
    background: var(--color-black, #000);
    padding: 0 2.5rem 2.5rem;
    box-sizing: border-box;
}

.house-modal-header {
    display: contents;
}

.house-modal-header-text {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    min-width: 0;
    text-align: left;
    padding-right: 1rem;
}

.house-modal-description-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-yellow, #f5c518) #333;
}

.house-modal-description-wrap::-webkit-scrollbar {
    width: 6px;
}

.house-modal-description-wrap::-webkit-scrollbar-track {
    background: #333;
    border-radius: 3px;
}

.house-modal-description-wrap::-webkit-scrollbar-thumb {
    background: var(--color-yellow, #f5c518);
    border-radius: 3px;
}

.house-modal-name {
    color: var(--color-yellow, #f5c518);
    font-size: 2.75rem;
    margin: 5px 0 0.5rem;
    line-height: 1.2;
    font-weight: 600;
}

.house-modal-lord {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.house-modal-motto {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.425rem;
    font-style: italic;
    margin: 0;
    line-height: 1.4;
}

.house-modal-description {
    color: var(--color-white, #fff);
    line-height: 1.6;
    font-size: 1.125rem;
    margin: 0;
    max-width: 480px;
    text-align: left;
}

@media (max-width: 1024px) {
    .house-modal {
        padding: 1.25rem;
    }

    .house-modal-content {
        max-width: 96%;
        height: 90vh;
        max-height: 90vh;
    }

    .house-modal-image-container {
        height: 100%;
    }

    .house-modal-right {
        padding: 0 1.75rem 1.75rem;
    }

    .house-modal-header-text {
        padding-right: 0.75rem;
    }

    .house-modal-header {
        padding-right: 0;
        margin-bottom: 0;
    }

    .house-modal-name {
        font-size: 2.35rem;
    }

    .house-modal-lord {
        font-size: 1.25rem;
    }

    .house-modal-motto {
        font-size: 1.2rem;
    }

    .house-modal-description {
        font-size: 0.94rem;
        max-width: 100%;
    }

    .house-modal-banner {
        width: 96px;
    }
}

@media (max-width: 768px) {
    .houses-rows {
        gap: 32px;
    }

    .houses-list {
        gap: 32px;
        row-gap: 44px;
        padding: 0 24px;
    }

    .house-card {
        width: 170px;
        margin: 0 8px;
    }

    .house-card-surface {
        height: 340px;
    }

    .house-card-banner {
        width: 57px;
    }

    .house-modal {
        padding: 0.75rem;
        align-items: center;
    }

    .house-modal-content {
        height: auto;
        max-height: 94vh;
        display: flex;
        flex-direction: column;
    }

    .house-modal-body {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .house-modal-image-container {
        width: 100%;
        height: auto;
        aspect-ratio: 9 / 16;
        max-height: 40vh;
    }

    .house-modal-right {
        flex: 1;
        min-height: 0;
        padding: 0 1.25rem 1.25rem;
        overflow: hidden;
    }

    .house-modal-header {
        margin-bottom: 0;
    }

    .house-modal-header-text {
        padding-right: 0.75rem;
    }

    .house-modal-description-wrap {
        max-height: none;
        padding-top: 0.75rem;
    }

    .house-modal-name {
        font-size: 2rem;
    }

    .house-modal-lord {
        font-size: 1.15rem;
    }

    .house-modal-motto {
        font-size: 1.05rem;
    }

    .house-modal-description {
        font-size: 0.825rem;
        text-align: left;
        max-width: none;
    }

    .house-modal-banner {
        width: 72px;
        margin-left: 0;
    }

    .house-modal-close {
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
    }

    .house-modal-close::before,
    .house-modal-close::after {
        width: 16px;
    }
}

@media (max-width: 480px) {
    .houses-list {
        gap: 28px;
        row-gap: 40px;
        padding: 0 20px;
    }

    .house-card {
        margin: 0 10px;
    }

    .house-modal {
        padding: 0.5rem;
    }

    .house-modal-content {
        max-height: 96vh;
    }

    .house-modal-inner {
        border-radius: 0 0 var(--radius-ui, 12px) var(--radius-ui, 12px);
    }

    .house-modal-image-container {
        max-height: 36vh;
    }

    .house-modal-right {
        padding: 0 1rem 1rem;
    }

    .house-modal-header {
        margin-bottom: 0;
    }

    .house-modal-header-text {
        padding-right: 0.5rem;
    }

    .house-modal-description-wrap {
        padding-top: 0.75rem;
    }

    .house-modal-name {
        font-size: 1.65rem;
        margin-top: 5px;
    }

    .house-modal-lord {
        font-size: 1rem;
    }

    .house-modal-motto {
        font-size: 0.9rem;
    }

    .house-modal-description {
        font-size: 0.71rem;
        line-height: 1.5;
    }

    .house-modal-banner {
        width: 52px;
        margin-left: 0;
    }

    .house-modal-close {
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
    }

    .house-modal-close::before,
    .house-modal-close::after {
        width: 14px;
    }
}
