/*
 * ART MARKET 작품 목록·상세·홈 화면
 * 미술관 벽처럼 여백을 넓게 쓰고, 이미지는 원래 비율을 유지한다.
 * 그리드는 CSS 다단(columns)과 grid만 사용한다. 외부 프레임워크 없음.
 */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.button--small {
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
}

.button--ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--ink);
}

.button--ghost:hover {
    background: var(--ink);
    color: var(--bg);
}

.badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.empty,
.note-muted,
.count {
    color: var(--muted);
    font-size: 0.92rem;
}

.section {
    padding: clamp(3rem, 7vw, 5.5rem) 0 0;
}

.section--tight {
    padding-top: clamp(2.5rem, 5vw, 4rem);
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.section-head h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

/* 검색 (헤더) */
.header-search {
    display: flex;
    gap: 0.5rem;
    flex: 1 1 16rem;
    max-width: 22rem;
    align-items: center;
}

.header-search input,
.toolbar input,
.toolbar select {
    min-height: 2.5rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line);
    background: var(--field, #fffdf9);
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    border-radius: 0;
}

.header-search input {
    flex: 1;
    min-width: 0;
}

.header-search input:focus-visible,
.toolbar input:focus-visible,
.toolbar select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 홈 히어로: 글과 대표 작품을 비대칭으로 배치 */
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
    padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.hero-text h1 {
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    max-width: 11em;
}

.hero-text .lead {
    margin-top: 1.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2.25rem;
}

.hero-figure {
    position: relative;
    display: block;
    margin: 0;
    transform: translateY(1.5rem);
}

.hero-figure img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: var(--field, #fffdf9);
    box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(28, 27, 25, 0.45);
}

.hero-caption {
    display: block;
    margin-top: 0.7rem;
    color: var(--muted);
    font-size: 0.85rem;
}

/* 작품 그리드 (다단 masonry) */
.masonry {
    columns: 3 14rem;
    column-gap: clamp(1rem, 2.5vw, 2rem);
}

.work {
    break-inside: avoid;
    margin: 0 0 clamp(2rem, 4vw, 3rem);
}

.work-image {
    display: block;
    background: var(--field, #fffdf9);
}

.work-image img {
    width: 100%;
    height: auto;
    transition: opacity 0.2s ease;
}

.work-image:hover img {
    opacity: 0.88;
}

.work-image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    padding: 1rem;
    border: 1px dashed var(--line);
    color: var(--muted);
    text-align: center;
}

.work-meta {
    padding-top: 0.75rem;
}

.work-title {
    font-family: var(--serif);
    font-size: 1.12rem;
    line-height: 1.35;
}

.work-title a {
    text-decoration: none;
}

.work-artist,
.work-price {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.work-price {
    color: var(--ink);
}

.work.is-sold .work-image img {
    filter: grayscale(0.35);
}

/* 인기 작품: 높이를 엇갈리게 */
.popular-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(1rem, 2.5vw, 2rem);
    align-items: start;
}

.popular-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
}

.popular-item img {
    width: 100%;
    height: auto;
    background: var(--field, #fffdf9);
}

.popular-item--1 {
    margin-top: 2.5rem;
}

.popular-item--2 {
    margin-top: 1rem;
}

.popular-title {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.3;
}

.popular-artist {
    color: var(--muted);
    font-size: 0.85rem;
}

/* 카테고리 목록 */
.category-index {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1.5rem 2rem;
}

.category-index li {
    padding-top: 0.75rem;
    border-top: 2px solid var(--ink);
}

.category-index > li > a {
    font-family: var(--serif);
    font-size: 1.3rem;
    text-decoration: none;
}

.category-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.category-sub a {
    text-decoration: none;
}

.category-sub a:hover {
    color: var(--accent);
}

/* 목록 화면 */
.listing {
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 4rem;
}

.listing-head {
    margin-bottom: 2rem;
}

.listing-head h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.listing-head .lead {
    margin-top: 0.9rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}

.chips a {
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--line);
    text-decoration: none;
}

.chips a[aria-current="page"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.toolbar-field--search {
    flex: 1 1 16rem;
}

.toolbar-field--search input {
    width: 100%;
}

.count {
    margin: 1rem 0 2rem;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 3rem;
    font-size: 0.95rem;
}

.pager-disabled {
    color: var(--line);
}

.pager-state {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* 작품 상세 */
.show {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
    padding: clamp(2rem, 5vw, 3.5rem) 0 4rem;
}

.show-gallery {
    position: sticky;
    top: 1.5rem;
}

.show-main {
    margin: 0;
    background: var(--field, #fffdf9);
    text-align: center;
}

.show-main img {
    width: 100%;
    max-height: 78vh;
    object-fit: contain;
    margin-inline: auto;
}

.show-main--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 22rem;
    border: 1px dashed var(--line);
    color: var(--muted);
}

.thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.thumb {
    width: 4.5rem;
    height: 4.5rem;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--field, #fffdf9);
    cursor: pointer;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb[aria-current="true"] {
    border-color: var(--accent);
    border-width: 2px;
}

.show-info h1 {
    margin-top: 0.4rem;
    font-size: clamp(2rem, 4.5vw, 3rem);
}

.show-artist {
    margin-top: 0.75rem;
    font-size: 1.05rem;
}

.show-price {
    margin-top: 1.25rem;
    font-family: var(--serif);
    font-size: 1.5rem;
}

.facts {
    margin: 2rem 0 0;
    border-top: 1px solid var(--line);
}

.facts > div {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
}

.show-actions {
    margin-top: 2rem;
    display: grid;
    gap: 0.9rem;
}

.favorite-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.favorite-count {
    color: var(--muted);
    font-size: 0.92rem;
}

.favorite-message {
    width: 100%;
    min-height: 1.2em;
    color: var(--accent);
    font-size: 0.9rem;
}

.show-description {
    grid-column: 1 / -1;
    max-width: 44rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--line);
}

.show-description h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.show-description p {
    font-size: 1rem;
    line-height: 1.85;
}

/* 반응형 */
@media (max-width: 900px) {
    .hero-grid,
    .show {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-figure {
        transform: none;
    }

    .show-gallery {
        position: static;
    }

    .popular-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .popular-item--1,
    .popular-item--2 {
        margin-top: 0;
    }
}

@media (max-width: 600px) {
    .header-search {
        max-width: none;
        width: 100%;
    }

    .masonry {
        columns: 2 9rem;
    }

    .facts > div {
        grid-template-columns: 5.5rem minmax(0, 1fr);
    }

    .section-head {
        align-items: center;
    }
}
