/* ================= 공통 ================= */

/* SUIT 폰트(SIL OFL 1.1, fonts/SUIT-OFL.txt): 외부 CDN 없이 직접 제공 */
@font-face {
  font-family: "SUIT Variable";
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/SUIT-Variable.woff2") format("woff2");
}

:root {
  --font: "SUIT Variable", SUIT, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);

  /* 공개 페이지(라이트, 미니멀) */
  --p-bg: #ffffff;
  --p-text: #111111;
  --p-text-2: #555555;
  --p-text-3: #767676;
  --p-line: #e5e5e5;
  --p-surface: #f3f3f3;
  --p-accent: #ef7c1c;     /* 로고 주황 */
  --p-tg: #229ed9;         /* 텔레그램 */

  /* 예전 다크 값(관리 페이지 일부가 참조) */
  --bg: #111113;
  --surface: #1a1a1d;
  --surface-2: #26262b;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #f2b43c;       /* 오래된 레코드 레이블의 금색 */
  --accent-ink: #1a1305;
  --tg: #2aabee;

  /* 관리 페이지(라이트) */
  --ink: #1d1d1f;
  --paper: #f5f5f7;
  --muted: #6e6e73;
  --rule: #d2d2d7;
  --danger: #c4302b;
  --ok: #248a3d;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= 공개 페이지 =================
   기준값
   글자 크기: 12 / 14 / 15 / 16 / 20 / 32px
   행간: 본문 1.6, 카드 제목 1.4, 큰 제목 1.3
   자간: 큰 제목 -0.03em, 제목 -0.02em, 본문 -0.01em, 작은 라벨 0
   간격: 4px 배수
*/

body.public {
  background: var(--p-bg); color: var(--p-text);
  letter-spacing: -0.01em; line-height: 1.6;
}
.public :focus-visible { outline: 2px solid var(--p-text); outline-offset: 2px; }
.wrap, .topbar-in, .tabs-in, .listing, .foot { max-width: 1440px; margin-left: auto; margin-right: auto; }

/* 상단 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--p-line);
}
.topbar-in {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 72px; padding: 0 var(--gutter);
}
.logo { flex: none; display: flex; align-items: center; height: 24px; }
.logo-img { display: block; height: 20px; width: auto; }
.topbar-actions { display: flex; align-items: center; gap: 24px; min-width: 0; }

/* 검색: 위아래 대칭인 상자라서 로고, 아이콘과 같은 중심선에 놓임 */
.search {
  display: flex; align-items: center; gap: 4px;
  width: 280px; height: 40px; padding: 0 4px 0 14px;
  border: 1px solid var(--p-line); background: var(--p-bg);
  transition: border-color 160ms ease;
}
.search:focus-within { border-color: var(--p-text); }
.search input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; outline: 0; background: transparent;
  color: var(--p-text); font: inherit; font-size: 14px; line-height: 1; letter-spacing: -0.01em;
}
.search input::placeholder { color: var(--p-text-3); }
.search input:focus, .search input:focus-visible { outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.icon-btn {
  flex: none; width: 32px; height: 32px; padding: 0; margin: 0;
  border: 0; background: none; color: var(--p-text); cursor: pointer;
  display: grid; place-items: center;
}
.i-search { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.search-toggle { display: none; }
.tg {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 32px;
  font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: -0.01em;
  text-decoration: none; color: var(--p-text);
}
.tg-icon { flex: none; width: 24px; height: 24px; display: block; }
.tg:hover span { text-decoration: underline; text-underline-offset: 4px; }

/* 휴대폰: 로고 | 검색 아이콘, 텔레그램 아이콘. 검색은 아래 줄로 펼침 */
@media (max-width: 720px) {
  .topbar-in { height: 56px; gap: 16px; }
  .logo-img { height: 17px; }
  .topbar-actions { gap: 8px; margin-right: -4px; }
  .tg { width: 32px; justify-content: center; }
  .tg span { display: none; }
  .search-toggle { display: grid; }
  .search {
    display: none; position: absolute; left: 0; right: 0; top: 56px;
    width: auto; height: 52px; padding: 0 calc(var(--gutter) - 4px) 0 var(--gutter);
    border: 0; border-top: 1px solid var(--p-line); border-bottom: 1px solid var(--p-line);
  }
  .search input { font-size: 16px; }   /* iOS 확대 방지 */
  .topbar.is-search .search { display: flex; }
  .topbar.is-search .tabs { margin-top: 52px; }
}

/* 장르 탭 */
.tabs { border-top: 1px solid var(--p-line); }
.tabs-in {
  display: flex; gap: 28px; overflow-x: auto;
  padding: 0 var(--gutter);
  scrollbar-width: none;
}
.tabs-in::-webkit-scrollbar { display: none; }
.tab {
  flex: none; position: relative;
  padding: 14px 0 13px;
  font-size: 15px; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em;
  color: var(--p-text-2); text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--p-text); }
.tab.is-on { color: var(--p-text); font-weight: 700; }
.tab.is-on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--p-text); }

/* 첫 화면 소개 */
.listing { padding: 0 var(--gutter) 96px; }
.banner { padding: 64px 0 56px; border-bottom: 1px solid var(--p-line); }
.banner h1 {
  margin: 0; font-size: 32px; font-weight: 700; line-height: 1.3; letter-spacing: -0.03em;
}
.banner p { margin: 12px 0 0; font-size: 16px; line-height: 1.6; color: var(--p-text-2); }
.banner-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 28px;
  height: 48px; padding: 0 24px 0 18px;
  background: var(--p-tg); color: #fff; text-decoration: none;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  transition: background-color 160ms ease;
}
.banner-link:hover { background: #1e96d4; }
.banner-link .tg-icon { width: 22px; height: 22px; }

/* 목록 머리 */
.list-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 40px 0 24px;
}
.list-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
.shop-select select {
  appearance: none; -webkit-appearance: none;
  padding: 0 20px 0 0; border: 0; background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='1.8'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center / 14px;
  color: var(--p-text); font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; cursor: pointer;
  max-width: 50vw; text-align: right; text-align-last: right; field-sizing: content;
}
.shop-select { flex: none; }

/* 격자: 5 / 4 / 3 / 2열 */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 48px 24px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1199px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 899px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 12px; } }

/* 카드 */
.card { display: block; color: var(--p-text); text-decoration: none; }
.card-art { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--p-surface); }
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: opacity 200ms ease; }
.card:hover .card-art img { opacity: 0.86; }
.card-note {
  position: absolute; left: 0; bottom: 0; max-width: 100%;
  padding: 4px 8px; background: var(--p-text); color: #fff;
  font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-body { padding-top: 14px; }
.card-meta {
  margin: 0; display: flex; gap: 8px; min-width: 0;
  font-size: 12px; line-height: 1.5; letter-spacing: 0; color: var(--p-text-3);
}
.card-shop { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta span:last-child { flex: none; }
.card-meta .fresh { color: var(--p-accent); font-weight: 700; letter-spacing: 0.02em; }
.card-album {
  margin: 6px 0 0; font-size: 15px; font-weight: 600; line-height: 1.4; letter-spacing: -0.02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .card-album { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.card-artist {
  margin: 2px 0 0; font-size: 14px; line-height: 1.5; color: var(--p-text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-buy { margin: 10px 0 0; display: flex; align-items: baseline; gap: 8px; min-width: 0; line-height: 1.5; }
.card-buy .price { flex: none; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.card-buy .fmt { min-width: 0; font-size: 12px; color: var(--p-text-3); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 이미지 없는 항목: 레코드 판 */
.record {
  position: absolute; inset: 12%; border-radius: 50%;
  background:
    radial-gradient(circle, var(--p-surface) 0 3%, var(--p-accent) 3.3% 17%, transparent 17.4%),
    repeating-radial-gradient(circle, #161616 0 1.5px, #2a2a2a 1.5px 3px);
}

.empty { padding: 64px 0; color: var(--p-text-2); font-size: 15px; }
.empty p { margin: 0 0 24px; }
.btn-line {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; min-width: 160px; padding: 0 32px;
  border: 1px solid var(--p-text); color: var(--p-text); background: transparent;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}
.btn-line:hover { background: var(--p-text); color: #fff; }
.pager { display: flex; justify-content: center; gap: 8px; padding-top: 72px; }

.foot {
  padding: 40px var(--gutter) 64px; border-top: 1px solid var(--p-line);
  font-size: 12px; line-height: 1.6; letter-spacing: 0; color: var(--p-text-3);
}
.foot p { margin: 0; }
.foot-brand { margin-bottom: 8px !important; font-size: 13px; font-weight: 700; color: var(--p-text); letter-spacing: -0.01em; }

@media (max-width: 720px) {
  .tabs-in { gap: 22px; }
  .tab { font-size: 14px; padding: 12px 0 11px; }
  .banner { padding: 40px 0 36px; }
  .banner h1 { font-size: 24px; }
  .banner p { font-size: 14px; }
  .list-head { padding: 32px 0 20px; }
  .list-title { font-size: 18px; }
  .card-body { padding-top: 10px; }
  .card-album { font-size: 14px; }
  .card-artist { font-size: 13px; }
  .card-buy .price { font-size: 13px; }
  .pager { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-art img, .btn-line { transition: none; }
}

/* ================= 관리 페이지 ================= */

.admin { background: var(--paper); color: var(--ink); min-height: 100vh; }
.admin :focus-visible { outline-color: #0071e3; }
.admin-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px var(--gutter);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10;
}
.admin-bar .brand { font-weight: 800; text-decoration: none; margin-right: auto; letter-spacing: -0.02em; }
.admin-bar nav { display: flex; gap: 18px; }
.admin-bar nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.admin-bar nav a.is-on { color: var(--ink); }
.admin-bar form { margin: 0; }
.admin-bar button { font: inherit; font-size: 0.9rem; background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.admin-main { padding: 28px var(--gutter) 60px; max-width: 1200px; }
.admin-main h1 { font-size: 1.75rem; font-weight: 800; margin: 0 0 18px; letter-spacing: -0.025em; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head-row h1 { margin: 0; }

.btn, button.btn {
  display: inline-block; font: inherit; font-weight: 600;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; text-decoration: none; cursor: pointer;
}
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; color: var(--ok); background: #e8f5ec; }
.flash--error, .errors { color: var(--danger); background: #fbeceb; }
.errors { padding: 12px 16px 12px 34px; border-radius: 12px; margin: 0 0 18px; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; padding: 4px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #ececf0; vertical-align: top; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.grow { white-space: normal; min-width: 240px; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 44px; height: 44px; object-fit: cover; display: block; background: #e8e8ed; border-radius: 6px; }
.status-ok { color: var(--ok); }
.status-bad { color: var(--danger); }
.status-off { color: var(--muted); }
.small { font-size: 0.82rem; color: var(--muted); }
.tag { display: inline-block; font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; background: #e8e8ed; color: var(--muted); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input, .filters button { font: inherit; font-size: 0.92rem; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; background: #fff; color: var(--ink); }
.filters button { background: var(--ink); color: #fff; border-color: var(--ink); cursor: pointer; }

.form { max-width: 680px; display: grid; gap: 18px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field input[type=text], .field input[type=url], .field input[type=number], .field input[type=password],
.field select, .field textarea {
  font: inherit; padding: 11px 14px; border: 1px solid var(--rule); border-radius: 10px; background: #fff; width: 100%; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2); }
.field textarea { min-height: 160px; font-variant-numeric: tabular-nums; }
.field .hint { font-size: 0.85rem; color: var(--muted); margin: 0; }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.two { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.admin .pager { padding-top: 24px; }

.login { max-width: 380px; margin: 14vh auto; padding: 0 var(--gutter); }
.login h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
