/* ============================================
   토토원 — Global Stylesheet
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; overflow-x: hidden; }
body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  word-break: break-word;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* --- Tokens --- */
:root {
  --primary: #3B6BF5;
  --primary-hover: #2D5AE0;
  --primary-light: rgba(59,107,245,0.08);
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2028;
  --text-sub: #6B7280;
  --text-muted: #9CA3AF;
  --radius: 8px;
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.07);
  --header-h: 52px;
  --max-w: 1200px;
  --gap: 14px;
}

/* --- Text --- */
.t-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.4; }
.t-body  { font-size: 14px; font-weight: 400; color: var(--text-sub); line-height: 1.5; }
.t-sub   { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.t-small { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* --- Layout --- */
.wrap { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.body { margin-top: calc(var(--header-h) + 20px); padding-bottom: 40px; flex: 1; }

/* --- Card --- */
.card { background: var(--surface); border-radius: var(--radius); }

/* --- Button --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 14px; font-weight: 600;
  border-radius: var(--radius); height: 38px; padding: 0 16px;
  cursor: pointer; border: none; white-space: nowrap;
}
.btn.--sm { height: 34px; font-size: 13px; }
.btn.--primary { background: var(--primary); color: #fff; }
.btn.--primary:hover { background: var(--primary-hover); }
.btn.--outline { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn.--outline:hover { background: #f3f4f6; }
.btn.--full { width: 100%; }

/* ============================================
   4-COL GRID (PC 4열, Mobile 2열)
   ============================================ */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

/* ============================================
   INDEX — 이미지 카드
   ============================================ */
.img-card {
  display: block; position: relative;
  border-radius: var(--radius); overflow: hidden;
  background: #f3f4f6; aspect-ratio: 4/3;
  border-top: 3px solid var(--primary);
}
.img-card img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform .25s;
}
.img-card:hover img { transform: scale(1.03); }
.img-card-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  font-size: 13px; font-weight: 700; color: #fff;
}

/* 배너 문의 카드 */
.img-card.--inquiry {
  border: 2px dashed var(--border); border-top: 2px dashed var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.inquiry-text {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
}
.img-card.--inquiry:hover { border-color: var(--primary); }
.img-card.--inquiry:hover .inquiry-text { color: var(--primary); }

.s-card.--inquiry-card {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-top: 2px dashed var(--border);
  min-height: 200px;
}
.inquiry-slot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
}
.s-card.--inquiry-card:hover { border-color: var(--primary); }
.s-card.--inquiry-card:hover .inquiry-slot { color: var(--primary); }

/* ============================================
   SAFETY — 보증업체 카드
   ============================================ */
.s-card {
  overflow: hidden; transition: box-shadow .2s;
  border-top: 3px solid var(--primary);
}
.s-card:hover { box-shadow: var(--shadow-hover); }

.s-img {
  width: 100%; aspect-ratio: 4/3;
  background: #f3f4f6; overflow: hidden;
}
.s-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.s-inner { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.s-name {
  font-size: 16px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; text-align: center;
}

.s-code {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 8px 0;
  background: var(--primary-light);
  border: 1px solid rgba(59,107,245,0.12);
  border-radius: var(--radius);
  cursor: pointer; transition: all .15s;
}
.s-code:hover { background: rgba(59,107,245,0.12); }
.s-code-text {
  font-size: 15px; font-weight: 700; color: var(--primary);
  font-family: 'SF Mono', 'Consolas', monospace;
  letter-spacing: 1.5px;
}
.s-code-icon { color: var(--primary); opacity: 0.4; transition: opacity .15s; }
.s-code:hover .s-code-icon { opacity: 1; }
.s-code.--copied { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.15); }
.s-code.--copied .s-code-text { color: #10B981; }
.s-code.--copied .s-code-icon { color: #10B981; opacity: 1; }

.s-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}

/* ============================================
   SORT BAR
   ============================================ */
.sort-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sort-tabs {
  display: flex;
  background: var(--surface); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.sort-tab {
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: color .15s, background .15s;
}
.sort-tab:hover { color: var(--text); }
.sort-tab.--on { color: #fff; background: var(--primary); }
.sort-tab + .sort-tab { border-left: 1px solid var(--border); }

/* ============================================
   HEADER
   ============================================ */
.hdr {
  position: fixed; top: 0; left: 0; width: 100%;
  height: var(--header-h); background: var(--surface);
  border-bottom: 1px solid var(--border); z-index: 100;
}
.hdr-inner {
  display: flex; align-items: center; height: 100%;
  max-width: var(--max-w); margin: 0 auto; padding: 0 20px;
}
.hdr-logo {
  font-size: 18px; font-weight: 900; color: var(--primary);
  letter-spacing: -0.3px; flex-shrink: 0;
}
.hdr-nav { display: flex; align-items: center; margin-left: 32px; height: 100%; }
.hdr-nav a {
  display: flex; align-items: center; height: 100%;
  padding: 0 14px; font-size: 14px; font-weight: 500; color: var(--text-sub);
}
.hdr-nav a:hover { color: var(--text); }
.hdr-nav a.--active { color: var(--primary); font-weight: 700; }

/* ============================================
   FOOTER
   ============================================ */
.ftr { background: #1F2028; padding: 32px 0; }
.ftr-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.ftr-logo { font-size: 16px; font-weight: 800; color: #fff; opacity: .6; }
.ftr-links { display: flex; align-items: center; gap: 16px; }
.ftr-links a { color: rgba(255,255,255,0.4); }
.ftr-links a:hover { color: rgba(255,255,255,0.7); }

/* ============================================
   MOBILE BOTTOM NAV
   ============================================ */
.bnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px; background: var(--surface);
  border-top: 1px solid var(--border); z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; font-weight: 500;
  color: var(--text-muted);
}
.bnav-item.--active { color: var(--primary); }
.bnav-item.--active svg { stroke-width: 2.2; }

/* ============================================
   DETAIL PAGE
   ============================================ */

/* 카드 테두리 */
.v-card {
  border: 1px solid var(--border);
  margin-bottom: var(--gap);
}

/* 정보 테이블 */
.v-table { width: 100%; border-collapse: collapse; }
.v-table th,
.v-table td {
  padding: 15px 20px; font-size: 14px;
  text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.v-table tr:last-child th,
.v-table tr:last-child td { border-bottom: none; }
.v-table th {
  width: 130px; font-weight: 600; color: var(--text);
  background: var(--bg); white-space: nowrap;
}
.v-table td { color: var(--text); }

.v-link { color: var(--primary); font-weight: 500; word-break: break-all; }
.v-link:hover { text-decoration: underline; }

/* 상세정보 본문 */
.v-detail-img {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.v-detail-img img { max-width: 100%; display: inline-block; vertical-align: bottom; }

.v-prose { padding: 28px 24px; }
.v-prose h2 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 28px 0 10px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.v-prose h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.v-prose p {
  font-size: 14px; color: var(--text-sub);
  line-height: 1.8; margin-bottom: 12px;
}
.v-prose p:last-child { margin-bottom: 0; }
.v-prose b { color: var(--primary); font-weight: 700; }
.v-prose a { color: var(--primary); font-weight: 600; }
.v-prose a:hover { text-decoration: underline; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .bnav { display: flex; }
  .body { padding-bottom: 72px; }
  .ftr { padding-bottom: 72px; }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  :root { --header-h: 48px; --gap: 10px; }
  .hdr-nav { display: none; }
  .wrap { padding: 0 12px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sort-tab { padding: 6px 10px; font-size: 12px; }
  .s-inner { padding: 10px; gap: 8px; }
  .s-name { font-size: 14px; }
  .s-code { padding: 6px 0; }
  .s-code-text { font-size: 13px; }
  .s-btns { gap: 5px; }
  .s-btns .btn { font-size: 13px; height: 30px; }

  .v-table th { width: 100px; padding: 12px 14px; font-size: 13px; }
  .v-table td { padding: 12px 14px; font-size: 13px; }
  .v-detail-img img { width: 100%; }
  .v-prose { padding: 20px 16px; }
}

/* ============================================
   BLOG LIST
   ============================================ */
.blog-list { display: flex; flex-direction: column; gap: var(--gap); }

.blog-card {
  display: flex; overflow: hidden;
  transition: box-shadow .2s;
}
.blog-card:hover { box-shadow: var(--shadow-hover); }

.blog-thumb {
  flex-shrink: 0; width: 240px;
  background: #f3f4f6; overflow: hidden;
}
.blog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.blog-body { padding: 20px 24px; flex: 1; min-width: 0; }

@media (max-width: 640px) {
  .blog-card { flex-direction: column; }
  .blog-thumb { width: 100%; aspect-ratio: 16/9; }
  .blog-body { padding: 14px 16px; }
}

/* ============================================
   BLOG POST
   ============================================ */
.post { max-width: 100%; }

.post-head {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px 24px; margin-bottom: var(--gap);
}
.post-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  line-height: 1.4; letter-spacing: -0.3px; margin-top: 8px;
}

/* 목차 */
.post-toc { padding: 18px 24px; margin-bottom: var(--gap); }
.post-toc-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.post-toc ol {
  list-style: decimal; padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.post-toc a {
  font-size: 14px; color: var(--primary); font-weight: 500;
}
.post-toc a:hover { text-decoration: underline; }

/* 본문 */
.post-content {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px 24px;
}
.post-content h2 {
  font-size: 18px; font-weight: 800; color: var(--text);
  margin: 32px 0 12px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.post-content h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.post-content h3 {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin: 20px 0 8px;
}
.post-content p {
  font-size: 15px; line-height: 1.75; color: var(--text-sub);
  margin-bottom: 12px;
}
.post-content a { color: var(--primary); font-weight: 600; }
.post-content a:hover { text-decoration: underline; }

.post-img { margin: 20px 0; border-radius: var(--radius); overflow: hidden; }
.post-img img { width: 100%; display: block; }

/* FAQ */
.post-faq { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.faq-item {
  background: #f9fafb; border-radius: var(--radius);
  padding: 16px 18px;
}
.faq-q {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 8px;
}
.faq-a {
  font-size: 14px; line-height: 1.7; color: var(--text-sub);
}

@media (max-width: 640px) {
  .post-head { padding: 20px 16px; }
  .post-title { font-size: 18px; }
  .post-toc { padding: 14px 16px; }
  .post-content { padding: 20px 16px; }
  .post-content h2 { font-size: 16px; }
}