/* ===== 색: 모드에 따라 이 값만 바뀐다 ===== */
:root {
  --radius: 16px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --sans: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1026;
  --card: #151b3a;
  --gold: #e6c36a;
  --text: #f3efe2;
  --muted: #a9adc4;
  --line: rgba(230, 195, 106, 0.28);
  --line-strong: rgba(230, 195, 106, 0.65);
  --on-gold: #0b1026;
  --input-bg: #0f1530;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --glow: radial-gradient(circle at 88% 6%, rgba(230, 195, 106, 0.22), transparent 38%);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #faf6ea;
  --card: #ffffff;
  --gold: #8a6612;
  --text: #26233a;
  --muted: #5b5f7a;
  --line: rgba(138, 102, 18, 0.28);
  --line-strong: rgba(138, 102, 18, 0.6);
  --on-gold: #ffffff;
  --input-bg: #fffdf6;
  --shadow: 0 8px 24px rgba(60, 45, 10, 0.12);
  --glow: radial-gradient(circle at 88% 6%, rgba(230, 195, 106, 0.35), transparent 40%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  line-height: 1.55;
  color: var(--text);
  background: var(--glow), var(--bg);
  transition: background-color .3s, color .3s;
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button { font: inherit; }

/* 밤하늘의 별: 다크 모드에서만 */
html[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .8;
  background-image:
    radial-gradient(1.5px 1.5px at 6% 12%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 14% 38%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 22% 8%, #f6e7b4 50%, transparent 52%),
    radial-gradient(1px 1px at 31% 24%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 40% 6%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 47% 31%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 55% 15%, #f6e7b4 50%, transparent 52%),
    radial-gradient(1px 1px at 63% 42%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 71% 9%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 78% 27%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 93% 20%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 96% 46%, #f6e7b4 50%, transparent 52%),
    radial-gradient(1px 1px at 9% 62%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 18% 78%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 88% 70%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 95% 90%, #fff 50%, transparent 52%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .5; } to { opacity: .95; } }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ===== 헤더 ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
}
.brand svg { width: 28px; height: 28px; }

/* 라이트·다크 토글 */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 32px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background-color .3s, border-color .3s;
}
.theme-toggle svg { position: relative; z-index: 1; width: 16px; height: 16px; transition: color .25s; }
.theme-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  transition: transform .25s;
}
.theme-toggle[aria-checked="true"]::after { transform: translateX(32px); }
.theme-toggle[aria-checked="true"] .icon-moon { color: var(--on-gold); }
.theme-toggle[aria-checked="false"] .icon-sun { color: var(--on-gold); }

/* ===== 히어로 ===== */
.hero { text-align: center; padding: 34px 0 26px; }
.hero svg { width: 60px; height: 60px; color: var(--gold); }
.hero h1 {
  margin: 10px 0 6px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: .06em;
}
.hero p { margin: 0; color: var(--muted); }
.divider {
  max-width: 520px;
  height: 1px;
  margin: 0 auto 30px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ===== 검색·분류 ===== */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-bottom: 8px; }
.search { position: relative; flex: 0 1 340px; min-width: 220px; }
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  transition: background-color .3s, border-color .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--line-strong); }
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.cat-btn .ico svg { display: block; width: 18px; height: 18px; }
.cat-btn:hover { border-color: var(--line-strong); }
.cat-btn[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--on-gold);
  font-weight: 700;
}
.result-msg { min-height: 1.7em; margin: 8px 2px 14px; color: var(--gold); font-weight: 600; }

/* ===== 카드 + 장바구니 ===== */
.shop { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, background-color .3s;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.card-cat { display: flex; align-items: center; gap: 7px; color: var(--gold); font-size: .85rem; font-weight: 600; }
.card-cat .ico svg { display: block; width: 20px; height: 20px; }
.card-name { margin: 6px 0 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.card-price { margin-top: auto; align-self: flex-end; color: var(--gold); font-size: 1.05rem; font-weight: 700; }
.btn-add {
  padding: 9px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: transparent;
  color: var(--gold);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.btn-add:hover { background: var(--gold); color: var(--on-gold); }

.cart {
  position: sticky;
  top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: background-color .3s;
}
.cart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cart-head h2 { margin: 0; font-family: var(--serif); font-size: 1.2rem; color: var(--gold); }
.btn-clear {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: .85rem;
  cursor: pointer;
}
.btn-clear:hover:not(:disabled) { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-clear:disabled { opacity: .4; cursor: not-allowed; }
.cart-empty { margin: 12px 0; color: var(--muted); }
.cart-list { max-height: 52vh; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.cart-item { padding: 12px 0; border-top: 1px solid var(--line); }
.cart-item-name { font-weight: 600; overflow-wrap: anywhere; }
.cart-item-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.qty { display: inline-flex; align-items: center; gap: 10px; }
.qty button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  line-height: 1;
  cursor: pointer;
}
.qty button:hover { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.qty-num { min-width: 1.5em; text-align: center; font-variant-numeric: tabular-nums; }
.cart-line-price { color: var(--gold); font-weight: 600; }
.cart-total {
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
  text-align: right;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

/* ===== 후기 ===== */
.section-title { margin: 0 0 16px; font-family: var(--serif); font-size: 1.6rem; color: var(--gold); }
.reviews { margin-top: 56px; }
.review-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: background-color .3s;
}
.field label { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 600; }
.count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.field input, .field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  transition: background-color .3s, border-color .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--line-strong); }
.field textarea { min-height: 88px; resize: vertical; }
.btn-primary {
  justify-self: end;
  padding: 10px 28px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.review-list { display: grid; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.review {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: background-color .3s;
}
.review-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.review-nick { font-weight: 700; color: var(--gold); overflow-wrap: anywhere; }
.review-date { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.review-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-empty { margin: 18px 0 0; color: var(--muted); }

/* ===== 영업 안내·푸터 ===== */
.info { margin-top: 56px; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}
.info-grid > div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: background-color .3s;
}
.info-grid dt { color: var(--gold); font-size: .85rem; font-weight: 600; }
.info-grid dd { margin: 4px 0 0; }
.site-footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .9rem; }
.noscript { margin: 20px 0; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; text-align: center; }

/* ===== 좁은 화면 (PC 중심이지만 깨지지 않게) ===== */
@media (max-width: 1000px) {
  .shop { grid-template-columns: 1fr; }
  .cart { position: static; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px 32px; }
  .grid { grid-template-columns: 1fr; }
  .search { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
