/* ========================================
   공지사항 스와이프 팝업
======================================== */

:root {
  --notice-popup-width: 640px;
  --notice-popup-gutter: 16px;
  --notice-popup-padding: 24px;
  --notice-adrop-padding: 8px;
  --notice-popup-color: #fa6f22;
  --notice-popup-radius: 28px;
}

body.popup-open {
  overflow: hidden;
}

.popup-overlay,
.popup-overlay *,
.popup-overlay *::before,
.popup-overlay *::after {
  box-sizing: border-box;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  padding: 0 var(--notice-popup-gutter);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.58);
}

.popup-overlay[hidden] {
  display: none !important;
}

.popup-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--notice-popup-width);
  min-width: 0;
  height: min(calc(100vh - 24px), 760px);
  height: min(calc(100dvh - 24px), 760px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  background: #fff;
  border-radius: var(--notice-popup-radius) var(--notice-popup-radius) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16);
}

.sheet-handle {
  flex: 0 0 auto;
  width: 50px;
  height: 5px;
  margin: 10px auto 18px;
  border-radius: 10px;
  background: #c4c4c4;
}

.popup-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  padding: 10px var(--notice-popup-padding) 16px;
}

.popup-header h2 {
  min-width: 0;
  margin: 0;
  color: #111;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.slide-count {
  flex: 0 0 auto;
  margin-left: 16px;
  color: #888;
  font-size: 14px;
  line-height: 1;
}

.slide-count strong {
  color: var(--notice-popup-color);
}

.slide-count[hidden],
.slide-dots[hidden] {
  display: none !important;
}

.notice-track {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 180px;
  height: min(60vh, 540px);
  height: min(60dvh, 540px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: pan-y;
  transition: height 0.25s ease;
}

.notice-track::-webkit-scrollbar {
  display: none;
}

.notice-track.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
  user-select: none;
}

.notice-track.is-dragging * {
  user-select: none;
}

.notice-slide {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0 var(--notice-popup-padding);
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.notice-body {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 8px 0 24px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #222;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: keep-all;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #aaa transparent;
}

.notice-body::-webkit-scrollbar {
  width: 5px;
}

.notice-body::-webkit-scrollbar-track {
  background: transparent;
}

.notice-body::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #aaa;
}

.notice-body h3 {
  margin: 0 0 24px;
  color: #111;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.notice-body h4 {
  margin: 0 0 14px;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.notice-body p {
  margin: 0 0 22px;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.notice-body img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 0 20px;
  object-fit: contain;
}

.notice-slide--layer-link .notice-body {
  cursor: pointer;
}

.notice-slide--layer-link .notice-body:focus-visible {
  outline: 3px solid rgba(250, 111, 34, 0.45);
  outline-offset: -3px;
}

.notice-body a {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.notice-caption {
  color: #666;
  font-style: italic;
}

.slide-dots {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 20px;
  margin: 4px 0 14px;
}

.slide-dot {
  display: block;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d5d5d5;
  cursor: pointer;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.slide-dot.active {
  width: 20px;
  border-radius: 8px;
  background: var(--notice-popup-color);
}

.popup-action {
  flex: 0 0 auto;
  width: 100%;
  padding: 0 var(--notice-popup-padding) 24px;
}

.popup-action.is-hidden {
  display: none;
}

.detail-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  color: #fff;
  background: var(--notice-popup-color);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.detail-button[hidden] {
  display: none !important;
}

.detail-button:hover {
  background: #e95f13;
}

.popup-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px var(--notice-popup-padding)
    calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid #eee;
  background: #f7f7f7;
}

.popup-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #111;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.detail-button:focus-visible,
.popup-footer button:focus-visible,
.slide-dot:focus-visible {
  outline: 3px solid rgba(250, 111, 34, 0.35);
  outline-offset: 3px;
}

/* Adrop 배너 전용 */
.notice-slide--adrop {
  padding-right: var(--notice-adrop-padding);
  padding-left: var(--notice-adrop-padding);
  overflow: hidden;
}

.notice-slide--adrop .notice-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  scrollbar-width: none;
}

.notice-slide--adrop .notice-body::-webkit-scrollbar {
  display: none;
}

.notice-slide--adrop .notice-body > div,
.notice-slide--adrop .notice-body a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.notice-slide--adrop .notice-body img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center;
  cursor: pointer;
}

@media (max-width: 480px) {
  :root {
    --notice-popup-gutter: 12px;
    --notice-popup-padding: 16px;
    --notice-adrop-padding: 6px;
    --notice-popup-radius: 24px;
  }

  .popup-sheet {
    height: auto;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .notice-track {
    flex: 0 1 auto;
    height: min(calc(100vw - 36px), 540px);
  }
}

@media (max-height: 650px) {
  .sheet-handle {
    margin-top: 8px;
    margin-bottom: 10px;
  }

  .popup-header {
    padding-top: 6px;
    padding-bottom: 10px;
  }

  .slide-dots {
    margin-top: 2px;
    margin-bottom: 8px;
  }

  .popup-action {
    padding-bottom: 14px;
  }

  .detail-button {
    min-height: 46px;
  }

  .popup-footer {
    padding-top: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup-sheet,
  .notice-track,
  .slide-dot {
    transition: none;
  }

  .notice-track {
    scroll-behavior: auto;
  }
}