/* ==========================================================================
   부팔러 (bupaller.com) — Adaptive (Light/Dark), Responsive, Marketing-Grade UI
   ========================================================================== */

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f1f2eb;
  --surface-3: #e5e9e1;
  --border: #dfe3d9;
  --border-strong: #bec9bf;
  --text: #172e27;
  --text-2: #465951;
  --text-3: #5a6c63;
  --accent: #285646;
  --accent-hover: #1c4438;
  --accent-soft: rgba(40, 86, 70, .09);
  --gold: #805c25;
  --gold-soft: rgba(184, 139, 53, 0.12);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.11);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --hero-grad: radial-gradient(1200px 600px at 82% -10%, rgba(29, 78, 216, 0.13), transparent 60%),
               radial-gradient(900px 500px at 8% 10%, rgba(184, 139, 53, 0.11), transparent 55%);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.12);
  --radius: 18px;
  --radius-sm: 11px;
  --max-w: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111c18;
    --surface: #192823;
    --surface-2: #20342d;
    --surface-3: #293f35;
    --border: #31483e;
    --border-strong: #4a6054;
    --text: #f5f4e9;
    --text-2: #bec9bf;
    --text-3: #a5b7aa;
    --accent: #a4d7b8;
    --accent-hover: #c1e4cc;
    --accent-soft: rgba(164, 215, 184, .12);
    --gold: #dfb35c;
    --gold-soft: rgba(223, 179, 92, 0.14);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --hero-grad: radial-gradient(1200px 600px at 82% -10%, rgba(59, 130, 246, 0.22), transparent 60%),
                 radial-gradient(900px 500px at 8% 10%, rgba(223, 179, 92, 0.16), transparent 55%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111c18;
  --surface: #192823;
  --surface-2: #20342d;
  --surface-3: #293f35;
  --border: #31483e;
  --border-strong: #4a6054;
  --text: #f5f4e9;
  --text-2: #bec9bf;
  --text-3: #a5b7aa;
  --accent: #a4d7b8;
  --accent-hover: #c1e4cc;
  --accent-soft: rgba(164, 215, 184, .12);
  --gold: #dfb35c;
  --gold-soft: rgba(223, 179, 92, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --hero-grad: radial-gradient(1200px 600px at 82% -10%, rgba(59, 130, 246, 0.22), transparent 60%),
               radial-gradient(900px 500px at 8% 10%, rgba(223, 179, 92, 0.16), transparent 55%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.wordmark { font-family: Georgia, "DejaVu Serif", "Times New Roman", serif; font-weight: 500; font-size: 1.9rem; line-height: 1; letter-spacing: -.06em; }
.brand-ko { color: var(--text-2); border-left: 1px solid var(--border-strong); padding-left: 10px; font-size: .85rem; font-weight: 650; }
.brand { white-space: nowrap; }
#themeToggle { font-size: 1.3rem; padding: 4px 8px; line-height: 1.2; }
[hidden] { display: none !important; }
.hub-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 22px; align-items: start; }
.hub-inquiry { position: sticky; top: 88px; }
@media (max-width: 760px) {
  .hub-layout { grid-template-columns: 1fr; }
  .hub-inquiry { position: static; }
}
@media (max-width: 560px) {
  .brand-ko { font-size: .76rem; padding-left: 5px; }
  .brand { gap: 5px; }
  .brand img { width: 28px; height: 28px; }
  .wordmark { font-size: 1.48rem; }
  .topbar .nav-actions { gap: 3px; }
  .topbar-inner { padding-inline: 12px; gap: 6px; }
  .topbar #userCreditPill { display: none; }
  .topbar .btn-sm { padding: 6px 8px; }
}
@media (max-width: 360px) { .topbar .brand-ko { display: none; } }
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-2);
}
.nav-links a:hover { color: var(--text); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--surface);
  box-shadow: none;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-gold {
  background: linear-gradient(135deg, #c89d47, #a57925);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(184, 139, 53, 0.32);
}
.btn-gold:hover { filter: brightness(1.06); }
.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 13px; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.pill-gold { background: var(--gold-soft); color: var(--gold); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* Hero */
.hero {
  background: var(--hero-grad);
  padding: 64px 0 72px;
  border-bottom: 1px solid var(--border);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 44px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.3vw, 3.35rem);
  line-height: 1.16;
  letter-spacing: -0.04em;
  margin: 16px 0 18px;
  font-weight: 900;
}
.hero h1 .highlight {
  background: linear-gradient(120deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-desc {
  font-size: 1.08rem;
  color: var(--text-2);
  margin: 0 0 28px;
  max-width: 580px;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.metric-val { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.03em; }
.metric-lbl { font-size: 0.8rem; color: var(--text-3); }

/* Cards & Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-elevated { box-shadow: var(--shadow-md); }
.card-title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.muted-sm { color: var(--text-3); font-size: 0.85rem; }

/* Sections */
.section { padding: 76px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head h2 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -0.035em;
  line-height: 1.22;
  margin: 10px 0 12px;
  font-weight: 900;
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }

/* Threads Mockup Card */
.threads-mock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}
.threads-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.threads-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #172e27, #285646);
  color: #fff; font-weight: 900; display: grid; place-items: center;
}
.threads-body { font-size: 0.95rem; line-height: 1.65; white-space: pre-line; margin: 0 0 14px; }
.threads-reply {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  font-size: 0.85rem;
}

/* Calculator */
.calc-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.calc-slider { width: 100%; accent-color: var(--accent); margin: 12px 0; }
.calc-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.calc-cell {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
}
.calc-cell.win {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Pricing */
.pricing-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.pricing-card.featured {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}
.price-num { font-size: 2.1rem; font-weight: 900; letter-spacing: -0.04em; margin: 10px 0 4px; }
.check-list { list-style: none; padding: 0; margin: 18px 0 24px; display: grid; gap: 10px; font-size: 0.92rem; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); }
.check-list li::before { content: "✓"; color: var(--success); font-weight: 900; flex-shrink: 0; }

/* Listing Cards */
.listing-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.listing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.listing-cover {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.listing-cover img { width: 100%; height: 100%; object-fit: cover; }
.listing-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.listing-price { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.03em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Legal Trust Banner */
.legal-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: 0.88rem;
  color: var(--text-2);
}

/* Forms */
.form-grid { display: grid; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 110px; resize: vertical; }
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--text-2);
  cursor: pointer;
}
.checkbox-row input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); }

/* Studio Layout */
.studio-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}
.studio-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.studio-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
}
.studio-nav-btn:hover { background: var(--surface-2); color: var(--text); }
.studio-nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.studio-main { padding: 28px; max-width: 1160px; width: 100%; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Carousel Gallery */
.carousel-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.carousel-slide {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.carousel-slide img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

/* Discount Bar */
.discount-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 10px 0;
}
.discount-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
}

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-weight: 800; color: var(--text-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* Toast */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 44px 0;
  font-size: 0.85rem;
  color: var(--text-3);
}

/* Responsive */
@media (max-width: 960px) {
  .hero-grid, .grid-3, .grid-4, .studio-shell { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .studio-sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .studio-nav-btn { width: auto; white-space: nowrap; }
  .studio-main { padding: 18px; }
}
@media (max-width: 640px) {
  .grid-2, .form-row-2, .calc-compare, .hero-metrics { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 48px; }
  .section { padding: 52px 0; }
}
