/* ═══════════════════════════════════════════════
   CHOIX — 선택 피로 감소 UI
   Apple + Notion 스타일: 여백, 절제, 말 걸지 않음
   ═══════════════════════════════════════════════ */

/* ─── 기본 변수 ─────────────────────────────── */
:root {
  --cx-bg: #fafafa;
  --cx-surface: #ffffff;
  --cx-border: rgba(0, 0, 0, 0.07);
  --cx-text: #1a1a1a;
  --cx-text-sub: #6b7280;
  --cx-text-muted: #9ca3af;
  --cx-accent: #111;
  --cx-radius-card: 20px;
  --cx-radius-btn: 999px;
  --cx-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  --cx-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.12);
  --cx-transition: 0.15s ease;
  /* ★ 모바일 기본 480 → 데스크탑에서 미디어쿼리로 확장 */
  --cx-max-card: 480px;
  --cx-card-bg: #ffffff;
  --cx-radius: 16px;
}

/* ★ 데스크탑 카드 크기 단계별 확장 */
@media (min-width: 600px) {
  :root { --cx-max-card: 560px; }
}
@media (min-width: 800px) {
  :root { --cx-max-card: 640px; }
}

/* ─── 래퍼 ──────────────────────────────────── */
.cx-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--cx-bg);
  padding: 0 16px 48px;
}

.cx-wrap--detail,
.cx-wrap--profile {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ─── ★ 헤더 (로고 + 로그인) ────────────────── */
.cx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--cx-max-card);
  padding: 22px 0 4px;
}

/* ─── ★ choix 로고 ──────────────────────────── */
.cx-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 6px;
}

.cx-logo__img {
  height: 24px;
  width: auto;
  display: block;
}

/* SVG 로드 실패 시 텍스트로 fallback */
.cx-logo__text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--cx-text);
}

/* ─── ★ 로그인 버튼 ─────────────────────────── */
.cx-auth-btn {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--cx-text-sub);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--cx-radius-btn);
  border: 1px solid var(--cx-border);
  transition: background var(--cx-transition), color var(--cx-transition);
  white-space: nowrap;
}

.cx-auth-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--cx-text);
}

/* 로그인된 사용자 이메일 버튼 */
.cx-auth-btn--user {
  background: rgba(0, 0, 0, 0.04);
  color: var(--cx-text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 탭 ────────────────────────────────────── */
.cx-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 0 16px;
  width: 100%;
  max-width: var(--cx-max-card);
  justify-content: center;
}

.cx-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--cx-radius-btn);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--cx-text-sub);
  text-decoration: none;
  transition: background var(--cx-transition), color var(--cx-transition);
  border: 1px solid transparent;
}

.cx-tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--cx-text);
}

.cx-tab--active {
  background: var(--cx-accent);
  color: #fff;
  border-color: var(--cx-accent);
}

.cx-tab--active:hover {
  background: var(--cx-accent);
  color: #fff;
}

.cx-tab__icon {
  font-size: 0.9rem;
}

/* ─── 카드 컨테이너 ────────────────────────── */
.cx-card-container {
  width: 100%;
  max-width: var(--cx-max-card);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── 메인 카드 ─────────────────────────────── */
.cx-card {
  width: 100%;
  background: var(--cx-surface);
  border-radius: var(--cx-radius-card);
  border: 1px solid var(--cx-border);
  box-shadow: var(--cx-shadow);
  overflow: hidden;
  transition: box-shadow var(--cx-transition);
}

.cx-card__link {
  display: block;
  text-decoration: none;
}

.cx-card__img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f0;
  overflow: hidden;
}

.cx-card__img-wrap--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cx-card__img-placeholder {
  font-size: 2.5rem;
  opacity: 0.2;
}

.cx-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cx-card__link:hover .cx-card__img {
  transform: scale(1.02);
}

.cx-card__body {
  padding: 20px 20px 12px;
}

.cx-card__badges {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--cx-text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cx-card__title-link {
  text-decoration: none;
  color: inherit;
}

.cx-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--cx-text);
  margin: 0 0 8px;
}

.cx-card__title-link:hover .cx-card__title {
  opacity: 0.7;
}

.cx-card__meta {
  font-size: 0.8rem;
  color: var(--cx-text-sub);
  margin: 0;
}

/* ─── 카드 액션 버튼 ────────────────────────── */
.cx-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 18px;
}

.cx-btn-shuffle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cx-accent);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform var(--cx-transition), opacity var(--cx-transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cx-btn-shuffle:hover {
  opacity: 0.85;
}

.cx-btn-shuffle:active {
  transform: scale(0.92) rotate(-30deg);
}

.cx-btn-shuffle.htmx-request {
  animation: cx-spin 0.6s linear infinite;
}

@keyframes cx-spin {
  to { transform: rotate(360deg); }
}

.cx-btn-detail {
  font-size: 1.2rem;
  color: var(--cx-text-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--cx-radius-btn);
  transition: color var(--cx-transition), background var(--cx-transition);
  letter-spacing: 0.1em;
}

.cx-btn-detail:hover {
  background: rgba(0,0,0,0.04);
  color: var(--cx-text);
}

/* ─── 로그인 힌트 ────────────────────────────── */
.cx-login-hint {
  margin-top: 24px;
  text-align: center;
}

.cx-login-hint__link {
  font-size: 0.78rem;
  color: var(--cx-text-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--cx-border);
  padding-bottom: 1px;
  transition: color var(--cx-transition);
}

.cx-login-hint__link:hover {
  color: var(--cx-text-sub);
}

/* ─── 빈 상태 ────────────────────────────────── */
.cx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 64px 0;
  color: var(--cx-text-muted);
}

.cx-empty__icon {
  font-size: 2rem;
  opacity: 0.4;
}

.cx-empty__msg {
  font-size: 0.9rem;
  margin: 0;
}

/* ─── 상세 페이지 ────────────────────────────── */
.cx-detail-back {
  padding: 24px 0 8px;
  width: 100%;
}

.cx-back-link {
  font-size: 0.82rem;
  color: var(--cx-text-sub);
  text-decoration: none;
  transition: color var(--cx-transition);
}

.cx-back-link:hover {
  color: var(--cx-text);
}

.cx-detail {
  width: 100%;
  background: var(--cx-surface);
  border-radius: var(--cx-radius-card);
  border: 1px solid var(--cx-border);
  box-shadow: var(--cx-shadow);
  overflow: hidden;
  margin-bottom: 32px;
}

.cx-detail__img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f0f0f0;
}

.cx-detail__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cx-detail__body {
  padding: 24px;
}

.cx-detail__title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
  color: var(--cx-text);
  margin: 0 0 10px;
}

.cx-detail__meta {
  font-size: 0.82rem;
  color: var(--cx-text-sub);
  margin: 0 0 16px;
}

.cx-detail__desc {
  font-size: 0.92rem;
  color: var(--cx-text);
  line-height: 1.7;
  margin: 0 0 20px;
}

.cx-detail__actions {
  margin-top: 8px;
}

.cx-btn-go {
  display: inline-block;
  padding: 12px 24px;
  background: var(--cx-accent);
  color: #fff;
  border-radius: var(--cx-radius-btn);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--cx-transition);
}

.cx-btn-go:hover {
  opacity: 0.82;
  color: #fff;
}

/* ─── 관련 콘텐츠 ────────────────────────────── */
.cx-related {
  width: 100%;
  margin-bottom: 32px;
}

.cx-related__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cx-text-muted);
  margin: 0 0 16px;
}

.cx-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ─── 관련 카드 (소형) ──────────────────────── */
.cx-rcard {
  display: block;
  border-radius: 14px;
  border: 1px solid var(--cx-border);
  overflow: hidden;
  text-decoration: none;
  background: var(--cx-surface);
  transition: box-shadow var(--cx-transition), transform var(--cx-transition);
}

.cx-rcard:hover {
  box-shadow: var(--cx-shadow-hover);
  transform: translateY(-2px);
}

.cx-rcard__img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f0;
  overflow: hidden;
}

.cx-rcard__img-wrap--empty {
  background: #ebebeb;
}

.cx-rcard__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cx-rcard__body {
  padding: 10px 12px 12px;
}

.cx-rcard__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cx-text);
  margin: 0 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cx-rcard__meta {
  font-size: 0.72rem;
  color: var(--cx-text-muted);
  margin: 0;
}

/* ─── 프로필 ─────────────────────────────────── */
.cx-profile-header {
  padding: 32px 0 24px;
  width: 100%;
}

.cx-profile-header__name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cx-text);
  margin: 0 0 4px;
}

.cx-profile-header__sub {
  font-size: 0.82rem;
  color: var(--cx-text-sub);
  margin: 0;
}

.cx-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
  margin-bottom: 32px;
}

.cx-profile-footer {
  margin-top: 8px;
  padding-bottom: 16px;
}

/* ─── HTMX 트랜지션 ─────────────────────────── */
.cx-card-container.htmx-swapping {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.cx-card-container.htmx-settling {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ─── 다크모드 ──────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --cx-bg: #111;
    --cx-surface: #1c1c1e;
    --cx-border: rgba(255, 255, 255, 0.08);
    --cx-text: #f0f0f0;
    --cx-text-sub: #8e8e93;
    --cx-text-muted: #636366;
    --cx-accent: #f0f0f0;
    --cx-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --cx-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.45);
    --cx-card-bg: #1c1c1e;
  }

  .cx-btn-shuffle {
    background: #f0f0f0;
    color: #111;
  }

  .cx-btn-go {
    background: #f0f0f0;
    color: #111;
  }

  .cx-tab--active {
    background: #f0f0f0;
    color: #111;
    border-color: #f0f0f0;
  }

  .cx-auth-btn:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .cx-auth-btn--user {
    background: rgba(255, 255, 255, 0.06);
  }
}

/* ─── 모바일 ─────────────────────────────────── */
@media (max-width: 480px) {
  .cx-card__title {
    font-size: 1.1rem;
  }

  .cx-detail__title {
    font-size: 1.25rem;
  }

  .cx-tabs {
    gap: 2px;
  }

  .cx-tab {
    padding: 7px 14px;
    font-size: 0.78rem;
  }
}

/* ─── 아바타 버튼 (헤더 우상단) ──────────────────── */
.cx-auth-btn--avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--cx-text);
  color: var(--cx-bg);
  border: none;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity var(--cx-transition);
}
.cx-auth-btn--avatar:hover {
  opacity: 0.75;
  background: var(--cx-text);
  color: var(--cx-bg);
}

/* ─── 프로필 페이지 ──────────────────────────────── */
.cx-wrap--profile { max-width: 480px; }

.cx-profile {
  padding: 24px 0 60px;
  width: 100%;
  max-width: var(--cx-max-card);
}

.cx-profile__hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.cx-profile__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cx-text);
  color: var(--cx-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cx-profile__email {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--cx-text);
  margin: 0 0 4px;
}
.cx-profile__joined {
  font-size: 0.75rem;
  color: var(--cx-text-sub);
  margin: 0;
}

.cx-profile__stats {
  display: flex;
  margin-bottom: 28px;
  background: var(--cx-card-bg);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius);
  overflow: hidden;
}
.cx-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  border-right: 1px solid var(--cx-border);
}
.cx-stat:last-child { border-right: none; }
.cx-stat__num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cx-text);
  line-height: 1;
  margin-bottom: 5px;
}
.cx-stat__label {
  font-size: 0.68rem;
  color: var(--cx-text-sub);
  text-align: center;
}

.cx-profile__divider {
  height: 1px;
  background: var(--cx-border);
  margin-bottom: 24px;
}

.cx-profile__section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cx-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
}

.cx-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cx-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background var(--cx-transition);
}
.cx-history-item:hover { background: var(--cx-card-bg); }

.cx-history-item__thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cx-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cx-history-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cx-history-item__thumb-placeholder {
  font-size: 1rem;
  opacity: 0.35;
}
.cx-history-item__body { flex: 1; min-width: 0; }
.cx-history-item__title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--cx-text);
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-history-item__meta {
  font-size: 0.7rem;
  color: var(--cx-text-sub);
  margin: 0;
}
.cx-history-item__arrow {
  font-size: 1.1rem;
  color: var(--cx-text-sub);
  flex-shrink: 0;
}

.cx-empty__cta {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--cx-text-sub);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── 요즘 취향 섹션 ─────────────────────────── */
.cx-profile__taste {
  background: var(--cx-card-bg);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius);
  padding: 16px 18px 18px;
  margin-bottom: 24px;
}

.cx-taste__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cx-text-muted);
  margin: 0 0 8px;
}

.cx-taste__sentence {
  font-size: 0.9rem;
  color: var(--cx-text);
  margin: 0 0 12px;
  line-height: 1.5;
}

.cx-taste__sentence strong {
  color: var(--cx-text);
  font-weight: 700;
}

.cx-taste__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cx-taste__chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--cx-text);
  color: var(--cx-bg);
}

/* ─── 취향 칩 색상 (n번째 칩마다 다른 색) ────── */
.cx-taste__chip:nth-child(1)  { background: #ff6b6b; color: #fff; }
.cx-taste__chip:nth-child(2)  { background: #ff9f43; color: #fff; }
.cx-taste__chip:nth-child(3)  { background: #1dd1a1; color: #fff; }
.cx-taste__chip:nth-child(4)  { background: #54a0ff; color: #fff; }
.cx-taste__chip:nth-child(5)  { background: #a29bfe; color: #fff; }