/* ==================================================================
   Simble-builder 프런트 스타일 (그리드 + 위젯)
   디자인 토큰(--sb-*)은 data/simble/cache/tokens.*.css 에서 주입됨
   ================================================================== */

.sb-section { position: relative; }
.sb-section + .sb-section { margin-top: var(--sb-section-gap, 64px); }

.sb-container {
  width: 100%;
  max-width: var(--sb-container, 1280px);
  margin-inline: auto;
  padding-inline: 20px;
}
.sb-section--full > .sb-container { max-width: none; padding-inline: 0; }

.sb-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
}
.sb-col { grid-column: span 12; min-width: 0; }

@media (min-width: 768px) {
  .sb-col--1  { grid-column: span 1; }
  .sb-col--2  { grid-column: span 2; }
  .sb-col--3  { grid-column: span 3; }
  .sb-col--4  { grid-column: span 4; }
  .sb-col--5  { grid-column: span 5; }
  .sb-col--6  { grid-column: span 6; }
  .sb-col--7  { grid-column: span 7; }
  .sb-col--8  { grid-column: span 8; }
  .sb-col--9  { grid-column: span 9; }
  .sb-col--10 { grid-column: span 10; }
  .sb-col--11 { grid-column: span 11; }
  .sb-col--12 { grid-column: span 12; }
}

.sb-widget + .sb-widget { margin-top: 16px; }

/* ---- 제목 ---- */
.sb-heading { margin: 0 0 8px; font-weight: 700; letter-spacing: -0.02em; color: var(--sb-text, #0f172a); }
h1.sb-heading { font-size: 2.5rem; }
h2.sb-heading { font-size: 2rem; }
h3.sb-heading { font-size: 1.5rem; }
h4.sb-heading { font-size: 1.25rem; }
.sb-heading__sub { margin: 0; color: var(--sb-muted, #64748b); }

/* ---- 리치 텍스트 ---- */
.sb-richtext { line-height: 1.7; color: var(--sb-text, #0f172a); overflow-wrap: break-word; }
.sb-richtext img { max-width: 100%; height: auto; border-radius: var(--sb-radius, 12px); }

/* ---- 이미지 ---- */
.sb-image { margin: 0; }
.sb-image--left   { text-align: left; }
.sb-image--center { text-align: center; }
.sb-image--right  { text-align: right; }
.sb-image img { max-width: 100%; height: auto; border-radius: var(--sb-radius, 12px); }
.sb-image--empty {
  display: grid; place-items: center; min-height: 140px;
  border: 2px dashed var(--sb-border, #e2e8f0); border-radius: var(--sb-radius, 12px);
  color: var(--sb-muted, #64748b); font-size: 0.875rem;
}

/* ---- 버튼 ---- */
.sb-btnwrap--left   { text-align: left; }
.sb-btnwrap--center { text-align: center; }
.sb-btnwrap--right  { text-align: right; }
.sb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: calc(var(--sb-radius, 12px) * 0.75);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 1px solid transparent;
}
.sb-btn:hover { transform: translateY(-1px); }
.sb-btn--sm { padding: 8px 16px; font-size: 0.875rem; }
.sb-btn--md { padding: 12px 24px; font-size: 1rem; }
.sb-btn--lg { padding: 16px 32px; font-size: 1.0625rem; }
.sb-btn--solid { background: var(--sb-primary, #4f46e5); color: #fff; }
.sb-btn--solid:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--sb-primary, #4f46e5) 35%, transparent); }
.sb-btn--outline { border-color: var(--sb-primary, #4f46e5); color: var(--sb-primary, #4f46e5); background: transparent; }
.sb-btn--outline:hover { background: color-mix(in srgb, var(--sb-primary, #4f46e5) 8%, transparent); }
.sb-btn--ghost { color: var(--sb-primary, #4f46e5); background: transparent; }

/* ---- 여백 / 구분선 ---- */
.sb-gap { height: var(--sb-gap-h, 40px); }
@media (max-width: 767px) { .sb-gap { height: var(--sb-gap-hm, 24px); } }
.sb-divider { border: 0; border-top: 1px solid var(--sb-border, #e2e8f0); margin: 8px auto; }

/* ---- 최신글 ---- */
.sb-latest__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 1.125rem;
}
.sb-latest__more { font-size: 0.8125rem; color: var(--sb-muted, #64748b); text-decoration: none; }
.sb-latest__more:hover { color: var(--sb-primary, #4f46e5); }
.sb-latest__list { list-style: none; margin: 0; padding: 0; }
.sb-latest__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--sb-border, #e2e8f0);
}
.sb-latest__item a {
  display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1;
  color: var(--sb-text, #0f172a); text-decoration: none;
}
.sb-latest__item a:hover .sb-latest__subject { color: var(--sb-primary, #4f46e5); }
.sb-latest__subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-latest__cmt {
  flex: none; font-size: 0.6875rem; font-weight: 700; color: #fff;
  background: var(--sb-primary, #4f46e5); border-radius: 999px; padding: 1px 7px;
}
.sb-latest__date { flex: none; font-size: 0.8125rem; color: var(--sb-muted, #64748b); }
.sb-latest__empty { padding: 24px 0; text-align: center; color: var(--sb-muted, #64748b); }

.sb-latest--card .sb-latest__list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.sb-latest--card .sb-latest__item {
  flex-direction: column; align-items: flex-start;
  border: 1px solid var(--sb-border, #e2e8f0); border-radius: var(--sb-radius, 12px);
  padding: 16px; transition: box-shadow 0.15s ease, transform 0.15s ease;
  background: var(--sb-surface, #f8fafc);
}
.sb-latest--card .sb-latest__item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
.sb-latest--card .sb-latest__subject { white-space: normal; }

/* ---- 배너 / 히어로 ---- */
.sb-banner {
  display: grid; align-items: center;
  background-size: cover; background-position: center;
  border-radius: var(--sb-radius, 12px); overflow: hidden;
  position: relative; color: var(--sb-text, #0f172a);
}
.sb-banner--overlay { color: #fff; }
.sb-banner--overlay::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.25), rgba(2, 6, 23, 0.55));
}
.sb-banner__inner { position: relative; padding: 48px 32px; max-width: 720px; margin-inline: auto; }
.sb-banner--left   .sb-banner__inner { margin-inline: 0 auto; text-align: left; }
.sb-banner--center .sb-banner__inner { text-align: center; }
.sb-banner--right  .sb-banner__inner { margin-inline: auto 0; text-align: right; }
.sb-banner__title { margin: 0 0 12px; font-size: clamp(1.75rem, 4vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
.sb-banner__text { margin: 0 0 24px; font-size: clamp(1rem, 2vw, 1.1875rem); opacity: 0.92; }

/* ---- 에러 플레이스홀더 (관리자에게만 노출) ---- */
.sb-widget-missing {
  padding: 16px; border: 1px dashed #f59e0b; border-radius: 8px;
  background: #fffbeb; color: #92400e; font-size: 0.875rem;
}

/* ---- 슬라이더 / 탑비주얼 ---- */
.sb-slider {
  position: relative; overflow: hidden;
  height: var(--sb-slider-h, 480px);
  border-radius: var(--sb-radius, 12px);
}
.sb-slider--full { border-radius: 0; }
.sb-slider__track { display: flex; height: 100%; transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1); }
.sb-slider__slide {
  position: relative; flex: 0 0 100%; height: 100%;
  background-size: cover; background-position: center;
  display: grid; place-items: center;
}
.sb-slider--fade .sb-slider__track { display: block; }
.sb-slider--fade .sb-slider__slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease;
}
.sb-slider--fade .sb-slider__slide.is-active { opacity: 1; z-index: 1; }
.sb-slider--overlay .sb-slider__slide::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(2,6,23,0.2), rgba(2,6,23,0.55));
}
.sb-slider__content {
  position: relative; z-index: 2; text-align: center; color: #fff;
  padding: 24px; max-width: 760px;
}
.sb-slider__title {
  margin: 0 0 12px; font-size: clamp(1.75rem, 4.5vw, 3.25rem);
  font-weight: 800; letter-spacing: -0.03em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.sb-slider__text { margin: 0 0 24px; font-size: clamp(1rem, 2vw, 1.25rem); opacity: 0.94; }
.sb-slider__arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,0.22); color: #fff; font-size: 26px; line-height: 1;
  backdrop-filter: blur(6px); transition: background 0.15s;
  display: grid; place-items: center;
}
.sb-slider__arrow:hover { background: rgba(255,255,255,0.4); }
.sb-slider__arrow--prev { left: 16px; }
.sb-slider__arrow--next { right: 16px; }
.sb-slider__dots {
  position: absolute; left: 0; right: 0; bottom: 18px; z-index: 3;
  display: flex; justify-content: center; gap: 8px;
}
.sb-slider__dot {
  width: 9px; height: 9px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255,255,255,0.45); padding: 0; transition: width 0.25s, background 0.25s;
}
.sb-slider__dot.is-active { width: 26px; background: #fff; }

/* ---- 스크롤 등장 애니메이션 ---- */
[data-sb-anim] { opacity: 0; will-change: transform, opacity; }
[data-sb-anim="fade"]    { transition: opacity 0.7s ease; }
[data-sb-anim="up"]      { transform: translateY(36px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-sb-anim="down"]    { transform: translateY(-36px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-sb-anim="left"]    { transform: translateX(48px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-sb-anim="right"]   { transform: translateX(-48px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-sb-anim="zoom"]    { transform: scale(0.92); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-sb-anim].sb-anim-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-sb-anim] { opacity: 1; transform: none; transition: none; }
}

/* ---- 배너 위젯 ---- */
.sb-banners { display: grid; gap: 16px; }
.sb-banners--cols-2 { grid-template-columns: repeat(2, 1fr); }
.sb-banners--cols-3 { grid-template-columns: repeat(3, 1fr); }
.sb-banners--cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 767px) {
  .sb-banners--cols-3, .sb-banners--cols-4 { grid-template-columns: repeat(2, 1fr); }
}
.sb-banners__item { display: block; border-radius: var(--sb-radius, 12px); overflow: hidden; }
.sb-banners__item img { display: block; width: 100%; height: auto; transition: transform 0.3s ease; }
.sb-banners__item:hover img { transform: scale(1.03); }

/* ---- 상품 리스트 위젯 ---- */
.sb-products__head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.sb-products__title { margin: 0; font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em; }
.sb-products__more { font-size: 0.8125rem; color: var(--sb-muted, #64748b); text-decoration: none; }
.sb-products__more:hover { color: var(--sb-primary, #4f46e5); }
.sb-products__grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(var(--sb-prod-cols, 4), 1fr);
}
@media (max-width: 991px) { .sb-products__grid { grid-template-columns: repeat(2, 1fr); } }
.sb-product { text-decoration: none; color: inherit; display: block; }
.sb-product__thumb {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--sb-radius, 12px); background: var(--sb-surface, #f8fafc);
  border: 1px solid var(--sb-border, #e2e8f0);
}
.sb-product__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.sb-product:hover .sb-product__thumb img { transform: scale(1.05); }
.sb-product__badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--sb-primary, #4f46e5); color: #fff;
  font-size: 0.6875rem; font-weight: 700; border-radius: 999px; padding: 3px 9px;
}
.sb-product__name {
  margin: 10px 0 4px; font-size: 0.9375rem; font-weight: 600;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.sb-product__price { font-weight: 800; color: var(--sb-text, #0f172a); }
.sb-product__price del { font-weight: 400; color: var(--sb-muted, #64748b); margin-right: 6px; font-size: 0.8125rem; }
.sb-products__empty { padding: 40px 0; text-align: center; color: var(--sb-muted, #64748b); }
