/* ============================================================
 * 汉 · 文字装饰组件 (Typography Decorations)
 * 书法笔触标题、印章文字标记、对联双行、毛笔签名等
 *
 * 使用方式：
 *   <h1 class="han-title-brush">书法标题</h1>
 *   <span class="han-seal-text">印</span>
 *   <div class="han-couplet">...</div>
 * ============================================================ */


/* ========================================================
 * 1. 书法笔触标题 (Brush Title)
 * 模拟毛笔笔触的标题样式
 * ====================================================== */

/* 基础书法标题 */
.han-title-brush {
  font-family: var(--han-font-kai);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  color: var(--han-color-text-primary);
  letter-spacing: var(--han-ls-widest);
  line-height: var(--han-lh-tight);
  position: relative;
  display: inline-block;
}

/* 毛笔笔触下划线 */
.han-title-brush::after {
  content: "";
  display: block;
  width: 0;
  height: 3px;
  margin-top: var(--han-space-3);
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--han-color-ink-700) 15%,
    var(--han-color-ink-500) 50%,
    var(--han-color-ink-700) 85%,
    transparent 100%
  );
  border-radius: 50%;
  filter: blur(0.5px);
  transition: width var(--han-duration-slower) var(--han-ease-out);
}

/* 悬停显示笔触 */
.han-title-brush:hover::after,
.han-title-brush.is-revealed::after {
  width: 100%;
}

/* 印章装饰标题 */
.han-title-with-seal {
  display: flex;
  align-items: flex-end;
  gap: var(--han-space-4);
}

.han-title-with-seal .han-title-brush {
  margin-bottom: 0;
}

.han-title-with-seal .han-stamp {
  flex-shrink: 0;
}

/* 竖排书法标题 */
.han-title-vertical {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: var(--han-space-4);
  line-height: var(--han-lh-normal);
  font-family: var(--han-font-kai);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
}

.han-title-vertical::after {
  display: none;
}


/* ========================================================
 * 2. 印章文字标记 (Seal Text Mark)
 * 用于文字内嵌印章效果
 * ====================================================== */

/* 基础印章文字 */
.han-seal-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 var(--han-space-1);
  background: var(--han-color-accent-control);
  color: var(--han-color-on-accent);
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-xs);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  letter-spacing: 0;
  border-radius: var(--han-radius-sm);
  transform: rotate(-5deg);
  box-shadow: var(--han-shadow-seal);
  vertical-align: baseline;
  line-height: 1;
}

/* 圆形印章文字 */
.han-seal-text--circle {
  border-radius: 50%;
}

/* 金边印章文字 */
.han-seal-text--gold {
  border: var(--han-border-width) solid var(--han-color-gold-500);
  background: var(--han-color-accent-control);
}

/* 墨色印章文字 */
.han-seal-text--ink {
  background: var(--han-color-ink-700);
}

/* 大号印章文字 */
.han-seal-text--lg {
  min-width: 36px;
  height: 36px;
  font-size: var(--han-fs-sm);
}

/* 斑驳印章效果 */
.han-seal-text--aged {
  position: relative;
}

.han-seal-text--aged::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.2) 0%, transparent 20%),
    radial-gradient(circle at 70% 70%, rgba(0,0,0,0.15) 0%, transparent 15%);
  border-radius: inherit;
  pointer-events: none;
}


/* ========================================================
 * 3. 对联双行布局 (Couplet Layout)
 * 传统对联样式
 * ====================================================== */

/* 对联容器 */
.han-couplet {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--han-space-6);
  align-items: start;
  padding: var(--han-space-6) var(--han-space-4);
  background: var(--han-color-bg-surface);
  border: var(--han-border);
  border-radius: var(--han-radius-lg);
  position: relative;
}

/* 对联装饰 */
.han-couplet::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: var(--han-border-width) solid var(--han-color-gold-300);
  border-radius: calc(var(--han-radius-lg) - 4px);
  pointer-events: none;
  opacity: 0.5;
}

/* 上联 */
.han-couplet__top {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-xl);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  color: var(--han-color-text-primary);
  letter-spacing: var(--han-space-3);
  line-height: var(--han-lh-loose);
  text-align: center;
}

/* 中间装饰 */
.han-couplet__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--han-space-3);
}

.han-couplet__center .han-stamp {
  transform: rotate(-3deg);
}

.han-couplet__center .han-seal-text {
  font-size: var(--han-fs-sm);
  height: 32px;
  min-width: 32px;
}

/* 下联 */
.han-couplet__bottom {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-xl);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  color: var(--han-color-text-primary);
  letter-spacing: var(--han-space-3);
  line-height: var(--han-lh-loose);
  text-align: center;
}

/* 横批 */
.han-couplet--horizontal {
  grid-template-columns: 1fr;
  text-align: center;
}

.han-couplet--horizontal .han-couplet__top,
.han-couplet--horizontal .han-couplet__bottom {
  writing-mode: horizontal-tb;
  letter-spacing: var(--han-space-4);
}

/* 小型对联 */
.han-couplet--sm .han-couplet__top,
.han-couplet--sm .han-couplet__bottom {
  font-size: var(--han-fs-md);
}


/* ========================================================
 * 4. 毛笔签名 (Brush Signature)
 * 模拟作者落款签名
 * ====================================================== */

.han-signature {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--han-space-2);
  font-family: var(--han-font-kai);
}

.han-signature__text {
  font-size: var(--han-fs-lg);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  color: var(--han-color-text-primary);
  font-style: italic;
  letter-spacing: var(--han-ls-wide);
  position: relative;
}

/* 签名笔触效果 */
.han-signature__text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--han-color-ink-700) 0%,
    var(--han-color-ink-500) 50%,
    transparent 100%
  );
  border-radius: 50%;
}

.han-signature__seal {
  margin-left: var(--han-space-1);
}

/* 大号签名 */
.han-signature--lg .han-signature__text {
  font-size: var(--han-fs-2xl);
}


/* ========================================================
 * 5. 文字强调装饰 (Text Emphasis)
 * 中国风文字高亮和强调效果
 * ====================================================== */

/* 朱批效果 - 类似古代书籍的朱笔批注 */
.han-annotation {
  position: relative;
  padding: var(--han-space-1) var(--han-space-2);
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-sm);
  color: var(--han-color-accent-text);
  background: var(--han-color-bg-elevated);
  border: var(--han-border-width) dashed var(--han-color-accent-control);
  border-radius: var(--han-radius-sm);
}

/* 印章式标注 */
.han-seal-annotation {
  display: inline-flex;
  align-items: center;
  gap: var(--han-space-1);
  padding: var(--han-space-1) var(--han-space-3);
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-xs);
  color: var(--han-color-on-accent);
  background: var(--han-color-accent-control);
  border-radius: var(--han-radius-sm);
  transform: rotate(-2deg);
}

.han-seal-annotation::before {
  content: "「";
  color: var(--han-color-gold-300);
}

.han-seal-annotation::after {
  content: "」";
  color: var(--han-color-gold-300);
}

/* 引用标记 */
.han-classical-quote {
  position: relative;
  padding: var(--han-space-4) var(--han-space-6);
  margin: var(--han-space-6) 0;
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-lg);
  color: var(--han-color-text-secondary);
  line-height: var(--han-lh-loose);
  background: var(--han-color-bg-surface);
  border: var(--han-border);
  border-left: 3px solid var(--han-color-vermilion-500);
  border-radius: var(--han-radius-md);
}

.han-classical-quote::before {
  content: "「";
  position: absolute;
  top: -8px;
  left: var(--han-space-4);
  font-size: var(--han-fs-3xl);
  color: var(--han-color-vermilion-400);
  line-height: 1;
}

.han-classical-quote::after {
  content: "」";
  position: absolute;
  bottom: -12px;
  right: var(--han-space-4);
  font-size: var(--han-fs-3xl);
  color: var(--han-color-vermilion-400);
  line-height: 1;
}


/* ========================================================
 * 6. 诗词排版 (Poetry Layout)
 * 传统诗词、文言文排版
 * ====================================================== */

/* 诗词段落 - 竖排 */
.han-poem-vertical {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-lg);
  line-height: var(--han-lh-loose);
  letter-spacing: var(--han-space-3);
  color: var(--han-color-text-primary);
  max-height: 600px;
}

/* 诗词段落 - 横排居中 */
.han-poem-centered {
  text-align: center;
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-lg);
  line-height: var(--han-lh-loose);
  letter-spacing: var(--han-space-2);
  color: var(--han-color-text-primary);
  max-width: 600px;
  margin: 0 auto;
}

.han-poem-centered p {
  text-indent: 0;
  margin-bottom: var(--han-space-3);
}

/* 诗词注释 */
.han-poem-note {
  margin-top: var(--han-space-5);
  padding-top: var(--han-space-3);
  border-top: var(--han-border-width) dashed var(--han-color-border);
  font-family: var(--han-font-song);
  font-size: var(--han-fs-sm);
  color: var(--han-color-text-tertiary);
  line-height: var(--han-lh-relaxed);
}


/* ========================================================
 * 7. 装饰文字块 (Decorative Text Block)
 * 段落装饰
 * ====================================================== */

/* 墨色块 - 用于标题前的装饰 */
.han-ink-block {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background: var(--han-color-ink-700);
  border-radius: 2px;
  margin-right: var(--han-space-3);
  vertical-align: baseline;
}

/* 渐变墨色块 */
.han-ink-block--gradient {
  background: linear-gradient(
    180deg,
    var(--han-color-ink-700) 0%,
    var(--han-color-ink-500) 50%,
    var(--han-color-ink-300) 100%
  );
}

/* 金色装饰块 */
.han-gold-block {
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--han-color-gold-500);
  margin-right: var(--han-space-3);
  vertical-align: baseline;
}

/* 朱红装饰块 */
.han-vermilion-block {
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--han-color-vermilion-500);
  margin-right: var(--han-space-3);
  vertical-align: baseline;
}


/* ========================================================
 * 8. 标题组 (Title Group)
 * 副标题 + 主标题 + 装饰
 * ====================================================== */

.han-title-group {
  position: relative;
  margin-bottom: var(--han-space-7);
}

.han-title-group__subtitle {
  display: block;
  font-family: var(--han-font-song);
  font-size: var(--han-fs-sm);
  color: var(--han-color-text-tertiary);
  letter-spacing: var(--han-ls-wider);
  margin-bottom: var(--han-space-2);
  text-transform: none;
}

.han-title-group__main {
  font-family: var(--han-font-kai);
  font-size: var(--han-fs-3xl);
  font-weight: var(--han-title-weight, var(--han-fw-bold));
  color: var(--han-color-text-primary);
  letter-spacing: var(--han-ls-wider);
  line-height: var(--han-lh-snug);
  margin-bottom: var(--han-space-3);
}

.han-title-group__en {
  display: block;
  font-family: var(--han-font-sans);
  font-size: var(--han-fs-xs);
  color: var(--han-color-text-tertiary);
  letter-spacing: var(--han-ls-widest);
  text-transform: uppercase;
}

/* 带装饰线的标题组 */
.han-title-group--lined::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  margin-top: var(--han-space-4);
  background: linear-gradient(
    90deg,
    var(--han-color-vermilion-500) 0%,
    var(--han-color-gold-500) 50%,
    var(--han-color-ink-700) 100%
  );
  border-radius: 2px;
}


/* ========================================================
 * 9. 响应式调整
 * ====================================================== */

@media (max-width: 768px) {
  .han-couplet {
    grid-template-columns: 1fr;
    gap: var(--han-space-4);
  }

  .han-couplet__top,
  .han-couplet__bottom {
    writing-mode: horizontal-tb;
    letter-spacing: var(--han-space-2);
  }

  .han-title-group__main {
    font-size: var(--han-fs-2xl);
  }

  .han-seal-text--lg {
    min-width: 32px;
    height: 32px;
  }
}
