/* =========================================================
   组件层：自研轮播 / 卡片 / 表单 / 富文本
   ========================================================= */

/* ---------------- 自研轮播 ---------------- */
.sg-slider { position: relative; overflow: hidden; }

.sg-slider__track {
  display: flex;
  will-change: transform;
  transition: transform .9s var(--sg-ease);
}

.sg-slider__slide { flex: 0 0 auto; position: relative; }

/* 淡入模式：所有 slide 重叠 */
.sg-slider--fade .sg-slider__track { display:block; transform: none !important; }

.sg-slider--fade .sg-slider__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.2s var(--sg-ease), visibility 1.2s;
}

.sg-slider--fade .sg-slider__slide:first-child { position: relative; }

.sg-slider--fade .sg-slider__slide.is-active { opacity: 1; visibility: visible; z-index: 2; }

/* 暂时禁用过渡：量取 slide 基础宽度（measureBaseWidths）与
   拖动底部选择框时使用，否则会读到动画中途的值 */
.sg-slider--no-anim,
.sg-slider--no-anim *,
.sg-slider--no-anim *::before,
.sg-slider--no-anim *::after { transition: none !important; }

/* 圆点 */
.sg-slider__dots { display: flex; align-items: center; gap: 10px; }

.sg-slider__dot {
  width: 28px;
  height: 2px;
  background: currentColor;
  opacity: .3;
  transition: opacity .45s var(--sg-ease), width .45s var(--sg-ease);
}

.sg-slider__dot.is-active { opacity: 1; width: 44px; }

/* 进度条 */
.sg-slider__bar { position: relative; height: 2px; background: rgba(0, 0, 0, .12); flex: 1; }
.sg-slider__bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--sg-theme); transition: width .3s linear; }

/* ---------------- 案例卡片 ---------------- */
.sg-work-card { display: block; }

.sg-work-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--sg-dark);
}

/* 图片槽内层（原站 .box）：默认铺满；首页案例条会另给固定高度做放大动画 */
.sg-work-card__box { width: 100%; height: 100%; }

.sg-work-card__media .sg-media__bg { transition: transform 1.4s var(--sg-ease); }
.sg-work-card:hover .sg-media__bg { transform: scale(1.06); }

.sg-work-card__info { padding-top: clamp(12px, 1.0417vw, 21px); }

.sg-work-card__tag {
  font-size: var(--sg-fs-14);
  color: var(--sg-theme);
  letter-spacing: .12em;
}

.sg-work-card__title {
  margin-top: 6px;
  font-size: var(--sg-fs-20);
  font-weight: 700;
  line-height: 1.5;
}

.sg-work-card__caption {
  margin-top: 8px;
  color: var(--sg-text-weak);
  font-size: var(--sg-fs-14);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- 设计师卡片 ---------------- */
.sg-designer-card { display: block; text-align: center; }

.sg-designer-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--sg-dark);
}

.sg-designer-card:hover .sg-media__bg { transform: scale(1.06); }

.sg-designer-card__name {
  margin-top: clamp(10px, .8333vw, 18px);
  font-size: var(--sg-fs-18);
  font-weight: 700;
  line-height: 1.6;
}

.sg-designer-card__role { color: var(--sg-text-weak); font-size: var(--sg-fs-14); }

.sg-designer-card__meta {
  margin-top: 6px;
  color: var(--sg-text-weak);
  font-size: var(--sg-fs-14);
  line-height: 1.7;
}

/* ---------------- 文章卡片 ---------------- */
.sg-article-card {
  display: block;
  background: #fff;
  transition: transform .6s var(--sg-ease), box-shadow .6s var(--sg-ease);
}

.sg-article-card:hover { transform: translateY(-6px); box-shadow: 0 16px 40px rgba(0, 0, 0, .08); }

.sg-article-card__media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--sg-dark); }
.sg-article-card__body { padding: clamp(16px, 1.25vw, 26px); }
.sg-article-card__date { color: var(--sg-text-weak); font-size: var(--sg-fs-14); letter-spacing: .08em; }

.sg-article-card__title {
  margin-top: 8px;
  font-size: var(--sg-fs-20);
  font-weight: 700;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-article-card__desc {
  margin-top: 10px;
  color: var(--sg-text-weak);
  font-size: var(--sg-fs-14);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- 表单 ---------------- */
.sg-form { display: grid; gap: clamp(14px, 1.0417vw, 21px); }

.sg-form__row { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(14px, 1.0417vw, 21px); }

.sg-form__field { position: relative; }

.sg-form__label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--sg-fs-14);
  color: var(--sg-text-weak);
  letter-spacing: .04em;
}

.sg-form__input,
.sg-form__textarea {
  width: 100%;
  padding: 0 16px;
  height: 52px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: var(--sg-fs-16);
  transition: border-color .4s var(--sg-ease);
}

.sg-form__textarea { height: auto; min-height: 140px; padding: 14px 16px; resize: vertical; line-height: 1.8; }

.sg-form__input:focus,
.sg-form__textarea:focus { border-color: var(--sg-theme); }

.sg-form__error { margin-top: 6px; color: #c0392b; font-size: var(--sg-fs-14); }

.sg-form__hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

.sg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 180px;
  height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--sg-theme);
  color: #fff;
  font-size: var(--sg-fs-16);
  letter-spacing: .1em;
  transition: all .5s var(--sg-ease);
}

.sg-btn:hover { background: var(--sg-text); }
.sg-btn[disabled] { opacity: .6; pointer-events: none; }

.sg-btn--ghost { background: transparent; color: var(--sg-text); border: 1px solid var(--sg-line); }
.sg-btn--ghost:hover { background: var(--sg-theme); color: #fff; border-color: var(--sg-theme); }

/* 全局提示条 */
.sg-toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 200;
  transform: translate(-50%, -20px);
  padding: 12px 26px;
  border-radius: 999px;
  background: rgba(49, 47, 48, .94);
  color: #fff;
  font-size: var(--sg-fs-14);
  opacity: 0;
  visibility: hidden;
  transition: all .45s var(--sg-ease);
}

.sg-toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.sg-toast.is-error { background: rgba(192, 57, 43, .95); }

/* ---------------- 富文本 ---------------- */
.sg-rich { font-size: var(--sg-fs-16); line-height: 2; color: var(--sg-text); }
.sg-rich p { margin-bottom: 1em; }
.sg-rich img { margin: 1.2em auto; width: 100%; height: auto; }
.sg-rich h2 { font-size: var(--sg-fs-24); font-weight: 700; margin: 1.4em 0 .6em; }
.sg-rich h3 { font-size: var(--sg-fs-20); font-weight: 700; margin: 1.2em 0 .5em; }
.sg-rich ul { list-style: disc; padding-left: 1.4em; margin-bottom: 1em; }
.sg-rich ol { list-style: decimal; padding-left: 1.4em; margin-bottom: 1em; }
.sg-rich a { color: var(--sg-theme); text-decoration: underline; }
.sg-rich blockquote {
  margin: 1.2em 0;
  padding: .6em 1.2em;
  border-left: 3px solid var(--sg-theme);
  color: var(--sg-text-weak);
  background: rgba(255, 255, 255, .6);
}

/* ---------------- 空状态 ---------------- */
.sg-empty {
  padding: clamp(48px, 5.2083vw, 100px) 0;
  text-align: center;
  color: var(--sg-text-weak);
  font-size: var(--sg-fs-16);
}

/* ---------------- 图片占位 ---------------- */
.sg-ph {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .12) 25%, transparent 25%) -20px 0/40px 40px,
    linear-gradient(225deg, rgba(255, 255, 255, .12) 25%, transparent 25%) -20px 0/40px 40px,
    var(--sg-dark);
}

@media screen and (max-width: 980px) {
  .sg-form__row { grid-template-columns: 1fr; }
  .sg-btn { width: 100%; }
}