/* 치숙의 돌사랑 - 모바일 전용 보정
   기존 styles.css / community.css 디자인을 유지하면서 작은 화면에서만 덮어씁니다. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

@media (max-width: 900px) {
  .site-header {
    padding: 14px 18px;
    gap: 12px;
  }

  .site-header nav {
    gap: 12px;
    font-size: 12px;
  }

  .brand small {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    padding: 22px 18px 52px !important;
  }

  .hero-media {
    width: 100%;
    height: min(58vh, 560px) !important;
    min-height: 340px;
  }

  .hero-media img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  .hero-copy {
    max-width: none !important;
    text-align: center;
  }

  .hero-copy .eyebrow {
    margin-bottom: 12px;
  }

  .hero h1 {
    font-size: clamp(38px, 11vw, 58px) !important;
    line-height: 1.13 !important;
    margin: 12px 0 20px !important;
  }

  .hero h1 span {
    display: block;
  }

  .hero-copy > p:not(.eyebrow) {
    max-width: 560px !important;
    margin-left: auto;
    margin-right: auto;
    font-size: 15px;
    line-height: 1.85;
  }

  .primary-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .intro {
    padding: 72px 22px !important;
  }

  .intro h2 {
    font-size: clamp(28px, 8vw, 40px) !important;
    line-height: 1.35;
  }

  .intro > p:last-child {
    font-size: 15px;
    line-height: 1.9 !important;
  }

  .gallery-section {
    padding: 56px 16px 90px !important;
  }

  .gallery-heading {
    align-items: flex-end;
    gap: 16px;
  }

  .gallery-heading h2 {
    font-size: clamp(30px, 8vw, 42px) !important;
  }

  .controls {
    flex-direction: column;
    gap: 14px !important;
  }

  .controls select {
    width: 100%;
    min-width: 0 !important;
    min-height: 44px;
  }

  .search-box {
    min-height: 44px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 28px 16px !important;
  }

  .card-image {
    overflow: hidden;
  }

  .card-image img {
    object-fit: contain !important;
    transform: none !important;
  }

  .card-info h3 {
    line-height: 1.45;
  }

  .card-description {
    font-size: 14px;
    line-height: 1.75 !important;
  }

  .card-actions,
  .community-actions {
    gap: 8px !important;
  }

  .card-shorts,
  .card-view-button,
  .community-button,
  .community-submit {
    min-height: 44px;
  }

  .guestbook-section {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .guestbook-form,
  .comment-form {
    grid-template-columns: 1fr !important;
  }

  .comment-dialog {
    width: min(94vw, 680px) !important;
    max-height: 90dvh;
    margin: auto;
  }

  .comment-panel {
    padding: 24px 18px !important;
    max-height: 88dvh;
    overflow-y: auto;
  }

  input,
  textarea,
  select,
  button {
    font-size: 16px; /* iOS 자동 확대 방지 */
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: center;
    flex-wrap: wrap;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding-top: 12px !important;
  }

  .hero-media {
    height: 48vh !important;
    min-height: 300px;
  }

  .hero h1 {
    font-size: clamp(36px, 13vw, 50px) !important;
  }

  .gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 34px !important;
  }

  .work-card {
    width: 100%;
  }

  .card-info {
    padding-top: 16px !important;
  }

  .card-info h3 {
    font-size: 21px !important;
  }

  .card-meta,
  .card-subtitle {
    font-size: 13px;
    line-height: 1.6;
  }

  .card-description {
    font-size: 15px;
    line-height: 1.8 !important;
  }

  .card-actions,
  .community-actions {
    flex-wrap: wrap;
  }

  .card-shorts,
  .community-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .guestbook-heading h2 {
    font-size: 34px;
  }
}

@media (max-width: 390px) {
  .site-header {
    padding-left: 13px;
    padding-right: 13px;
  }

  .brand strong {
    font-size: 15px;
  }

  .site-header nav {
    font-size: 11px;
    gap: 8px;
  }

  .hero-media {
    min-height: 270px;
  }

  .gallery-section {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}


}


/* =========================================================
   작품 탐색 UI 최종 디자인 — PC + 모바일 공통
   ========================================================= */

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

.mobile-collection-nav {
  display: grid !important;
  grid-template-columns: 220px 260px;
  justify-content: end;
  gap: 10px;
  margin: -22px 0 34px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mobile-all-button,
.mobile-jump-select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border: 1px solid #a88a5c !important;
  border-radius: 0 !important;
  background: rgba(248,245,239,.82) !important;
  color: #4b4033 !important;
  font-family: Pretendard, "Noto Sans KR", sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: .015em;
  box-shadow: none !important;
  outline: none;
}

.mobile-all-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px !important;
  cursor: pointer;
}

.mobile-all-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #2b261f;
  color: #fff;
  font-size: 10px !important;
  line-height: 1;
}

.mobile-jump-select-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.mobile-jump-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 38px 0 14px !important;
  cursor: pointer;
}

.mobile-jump-select-wrap::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-57%);
  color: #8e6e40;
  font-size: 17px;
  pointer-events: none;
}

.mobile-all-button:hover,
.mobile-jump-select:hover,
.mobile-jump-select:focus {
  background: #eee6d9 !important;
  border-color: #8f7043 !important;
}

/* 전체 작품 인덱스 팝업 */
.mobile-collection-dialog {
  width: min(90vw, 760px);
  max-height: 84vh;
  padding: 0;
  border: 0;
  background: #ece5d9;
  color: #211d18;
  box-shadow: 0 30px 90px rgba(0,0,0,.42);
}

.mobile-collection-dialog::backdrop {
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(3px);
}

.mobile-collection-panel {
  max-height: 84vh;
  overflow-y: auto;
  padding: 26px 22px 30px;
}

.mobile-collection-head {
  position: sticky;
  top: -26px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -26px -22px 20px;
  padding: 22px 22px 16px;
  background: rgba(236,229,217,.97);
  border-bottom: 1px solid rgba(126,113,93,.18);
  backdrop-filter: blur(8px);
}

.mobile-collection-head h2 {
  margin: 5px 0 0;
  font-family: "Noto Serif KR", serif;
  font-size: 28px;
  font-weight: 600;
}

.mobile-collection-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(126,113,93,.28);
  background: #f8f5ef;
  color: #2b261f;
  font-size: 27px !important;
  line-height: 1;
  cursor: pointer;
}

.mobile-collection-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 9px;
}

.mobile-index-card {
  min-height: 82px;
  padding: 11px 10px;
  border: 1px solid rgba(126,113,93,.2);
  background: #f8f5ef;
  color: #211d18;
  text-align: left;
  cursor: pointer;
}

.mobile-index-card span {
  display: block;
  margin-bottom: 7px;
  color: #9a7642;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
}

.mobile-index-card strong {
  display: block;
  font-family: "Noto Serif KR", serif;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  word-break: keep-all;
}

.mobile-index-card:hover {
  background: #eee6d9;
  border-color: rgba(154,118,66,.45);
}

/* 모바일에서는 두 컨트롤을 더 단순하고 넓게 */
@media (max-width: 620px) {
  .mobile-collection-nav {
    grid-template-columns: 1fr 1fr !important;
    justify-content: stretch;
    gap: 8px !important;
    margin: 18px 0 26px !important;
    padding: 0 !important;
  }

  .mobile-all-button,
  .mobile-jump-select {
    height: 46px;
    min-height: 46px;
    font-size: 13px !important;
  }

  .mobile-collection-dialog {
    width: min(94vw, 520px);
    max-height: 88dvh;
  }

  .mobile-collection-panel {
    max-height: 88dvh;
    padding: 20px 15px 24px;
  }

  .mobile-collection-head {
    top: -20px;
    margin: -20px -15px 16px;
    padding: 18px 15px 14px;
  }

  .mobile-collection-grid {
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 8px;
  }

  .mobile-index-card {
    min-height: 76px;
  }

  .mobile-index-card strong {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .mobile-collection-nav {
    grid-template-columns: 1fr !important;
  }

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


/* =========================================================
   모바일 메인 대표 수석 최종 보정
   - 이미지 전체 표시
   - 고정 높이/최소 높이 제거
   - 어떤 모바일 비율에서도 잘림 방지
   ========================================================= */
@media (max-width: 620px) {
  .hero {
    padding: 92px 18px 52px !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .hero-media {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .hero-media::before,
  .hero-media::after {
    pointer-events: none;
  }

  .hero-media img {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
  }
}

@media (max-width: 390px) {
  .hero {
    padding-top: 88px !important;
  }

  .hero-media {
    min-height: 0 !important;
  }

  .hero-media img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
  }
}


/* =========================================================
   모바일 소개 제목: 정확히 2줄 + 가운데 정렬
   기존 대표 이미지 보정은 건드리지 않음
   ========================================================= */
.intro-title {
  text-align: center;
}

.intro-title span {
  display: inline;
}

@media (max-width: 620px) {
  .intro-title {
    width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
  }

  .intro-title span {
    display: block;
    width: 100%;
    text-align: center !important;
  }

  .intro-title span:last-child {
    white-space: nowrap;
  }
}
