/*
Theme Name: Showroom — 부품 디지털 쇼룸
Theme URI: https://maenbal.kr/
Author: psyone
Description: 가방 이미지에서 부품을 눌러 제품으로 들어가는 디지털 쇼룸 테마. 페이지빌더를 쓰지 않고 필요한 기능만 담았다 — 제품(CPT) · 부품 유형(taxonomy) · 가방-부품 연결(이미지맵) · CSV 일괄 등록.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
License: GPL v2 or later
Text Domain: oksung-showroom
*/

:root {
  --oks-ink: #1b1d21;
  --oks-muted: #6b7280;
  --oks-line: #e5e7eb;
  --oks-bg: #ffffff;
  --oks-soft: #f7f8fa;
  --oks-accent: #1a4d8f;
  --oks-accent-soft: #eaf1fa;
  --oks-radius: 10px;
  --oks-maxw: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --oks-ink: #e8eaed;
    --oks-muted: #9aa1ab;
    --oks-line: #2b3039;
    --oks-bg: #14161a;
    --oks-soft: #1b1e24;
    --oks-accent: #6fa8f5;
    --oks-accent-soft: #1d2a3d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--oks-bg);
  color: var(--oks-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }
a { color: inherit; }

.oks-wrap {
  max-width: var(--oks-maxw);
  margin: 0 auto;
  padding-inline: 20px;
}

/* ── 헤더 ───────────────────────────────── */
.oks-header {
  border-bottom: 1px solid var(--oks-line);
  position: sticky;
  top: 0;
  background: var(--oks-bg);
  z-index: 50;
}
.oks-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.oks-logo {
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  font-size: 1.05rem;
}
.oks-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.oks-nav a {
  text-decoration: none;
  color: var(--oks-muted);
  font-size: 0.92rem;
}
.oks-nav a:hover { color: var(--oks-ink); }

/* ── 쇼룸 (가방 이미지 + 핫스팟) ──────────── */
.oks-showroom {
  padding-block: 28px 40px;
}
.oks-showroom h1 {
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.oks-showroom .oks-lede {
  color: var(--oks-muted);
  margin: 0 0 22px;
  font-size: 0.98rem;
}

.oks-stage {
  position: relative;
  display: block;
  max-width: 100%;
  border-radius: var(--oks-radius);
  overflow: hidden;
  background: var(--oks-soft);
  border: 1px solid var(--oks-line);
}
.oks-stage img { display: block; width: 100%; }

.oks-hotspot {
  position: absolute;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 6px;
  background: rgba(26,77,143,0.18);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.oks-hotspot:hover,
.oks-hotspot:focus-visible {
  background: rgba(26,77,143,0.42);
  transform: scale(1.03);
  outline: none;
}
.oks-hotspot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(20,22,26,0.92);
  color: #fff;
  font-size: 0.76rem;
  padding: 4px 8px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.oks-hotspot:hover .oks-hotspot-label,
.oks-hotspot:focus-visible .oks-hotspot-label { opacity: 1; }

/* 🔴 터치 기기 — 390px 실측에서 잡은 것
 *
 * 가방 사진이 화면 폭에 맞춰 줄면 핫스팟도 같이 줄어 22px 안팎이 된다.
 * 손가락으로 누르기엔 작다(권장 최소 44px). 보이는 상자는 그대로 두고
 * 눌리는 영역만 중앙 기준으로 44×44 를 보장한다.
 *
 * 그리고 라벨은 숨긴다 — 그 크기에서는 글자가 안 읽히고 흰 덩어리로만 보였다.
 * 대신 가운데 점을 찍어 "누를 수 있는 자리"를 알린다. */
@media (hover: none) {
  .oks-hotspot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }
  .oks-hotspot {
    background: rgba(26,77,143,0.30);
    border-color: rgba(255,255,255,0.95);
  }
  .oks-hotspot-label { display: none; }
  .oks-hotspot::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(20,22,26,0.45);
  }
}

/* ── 유형 목록 ──────────────────────────── */
.oks-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 8px;
}
.oks-type-chip {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--oks-line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.88rem;
  color: var(--oks-muted);
  background: var(--oks-bg);
}
.oks-type-chip:hover { border-color: var(--oks-accent); color: var(--oks-accent); }
.oks-type-chip.is-active {
  background: var(--oks-accent);
  border-color: var(--oks-accent);
  color: #fff;
}

/* ── 제품 그리드 ────────────────────────── */
.oks-grid {
  display: grid;
  /* 🔴 390px 실측에서 고친 것 — minmax(180px) 이면 모바일이 1열이 되어
   *    제품 22개에 세로 9,590px 이 나왔다. 300종이면 훑다가 지친다.
   *    부품 도식은 작아도 구별되므로 모바일은 2열로 간다. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-block: 22px 44px;
  list-style: none;
  margin: 0;
}
@media (min-width: 560px) {
  .oks-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
  }
}
.oks-card {
  border: 1px solid var(--oks-line);
  border-radius: var(--oks-radius);
  overflow: hidden;
  background: var(--oks-bg);
  transition: box-shadow .2s ease, transform .2s ease;
}
.oks-card:hover {
  box-shadow: 0 10px 28px -16px rgba(0,0,0,0.35);
  transform: translateY(-2px);
}
.oks-card a { text-decoration: none; display: block; }
.oks-card-thumb {
  aspect-ratio: 1 / 1;
  max-width: 100%;
  background: var(--oks-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.oks-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.oks-card-thumb .oks-noimg { color: var(--oks-muted); font-size: 0.8rem; }
.oks-card-body { padding: 10px 12px 14px; }
@media (min-width: 560px) { .oks-card-body { padding: 12px 14px 16px; } }
.oks-card-type {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--oks-accent);
  margin: 0 0 4px;
}
.oks-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* ── 제품 상세 ──────────────────────────── */
.oks-single { padding-block: 28px 56px; }
.oks-single-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 760px) {
  .oks-single-top { grid-template-columns: 1fr; gap: 20px; }
}
.oks-single-img {
  border: 1px solid var(--oks-line);
  border-radius: var(--oks-radius);
  overflow: hidden;
  background: var(--oks-soft);
  aspect-ratio: 1 / 1;
  max-width: 100%;
}
.oks-single-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.oks-single h1 { font-size: clamp(1.3rem, 3vw, 1.8rem); margin: 0 0 10px; letter-spacing: -0.02em; }

.oks-spec {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px;
  font-size: 0.92rem;
}
.oks-spec th, .oks-spec td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--oks-line);
  vertical-align: top;
}
.oks-spec th {
  width: 34%;
  color: var(--oks-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── 담기 / 문의 ────────────────────────── */
.oks-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--oks-accent);
  background: var(--oks-accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.oks-btn.is-ghost { background: transparent; color: var(--oks-accent); }
.oks-btn.is-added { background: var(--oks-accent-soft); color: var(--oks-accent); }

.oks-mylist-bar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: none;
}
.oks-mylist-bar.is-on { display: block; }
.oks-mylist-bar a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--oks-ink);
  color: var(--oks-bg);
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.5);
}
.oks-mylist-count {
  background: var(--oks-accent);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
}

/* ── 푸터 ───────────────────────────────── */
.oks-footer {
  border-top: 1px solid var(--oks-line);
  padding-block: 26px 40px;
  color: var(--oks-muted);
  font-size: 0.86rem;
}

.oks-empty {
  padding: 48px 0;
  color: var(--oks-muted);
  text-align: center;
}

/* ── 문의 폼 (모달) ──────────────────────── */
.oks-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.oks-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.oks-modal[hidden] { display: none !important; }
.oks-modal-back { position: absolute; inset: 0; background: rgba(10,12,16,0.55); }
.oks-modal-box {
  position: relative;
  background: var(--oks-bg);
  color: var(--oks-ink);
  border-radius: 14px;
  border: 1px solid var(--oks-line);
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  padding: 24px 22px 20px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.5);
}
.oks-modal-box h2 { margin: 0 0 14px; font-size: 1.2rem; letter-spacing: -0.02em; }
.oks-modal-x {
  position: absolute; top: 10px; right: 12px;
  background: none; border: 0; font-size: 1.6rem; line-height: 1;
  color: var(--oks-muted); cursor: pointer; padding: 6px 10px;
}

.oks-inq-items {
  background: var(--oks-soft);
  border: 1px solid var(--oks-line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.oks-inq-items-head { margin: 0 0 6px; font-weight: 600; }
.oks-inq-items ul { margin: 0; padding-left: 18px; color: var(--oks-muted); }
.oks-inq-items li { margin: 2px 0; }

.oks-inq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .oks-inq-grid { grid-template-columns: 1fr; } }
.oks-inq-form label { display: block; font-size: 0.86rem; color: var(--oks-muted); }
.oks-inq-form input, .oks-inq-form textarea {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--oks-line);
  border-radius: 8px;
  background: var(--oks-bg);
  color: var(--oks-ink);
  font: inherit;
  font-size: 0.95rem;
}
.oks-inq-form input:focus, .oks-inq-form textarea:focus {
  outline: 2px solid var(--oks-accent); outline-offset: 1px; border-color: transparent;
}
.oks-inq-msg { margin-top: 12px; }
.oks-inq-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.oks-inq-note { margin: 10px 0 0; font-size: 0.82rem; color: var(--oks-muted); }

/* ── 결과 알림 ──────────────────────────── */
.oks-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 300; max-width: min(460px, calc(100% - 32px));
  padding: 13px 18px; border-radius: 10px;
  font-size: 0.92rem; font-weight: 600;
  box-shadow: 0 14px 36px -14px rgba(0,0,0,0.5);
}
.oks-toast.is-ok { background: #14532d; color: #eafff1; }
.oks-toast.is-warn { background: #7c2d12; color: #fff3e8; }
