/* Shared — 主站与写作子站逐字节相同的组件与页面规则
   从 components.css / pages.css 中抽取；两站加载顺序一致：
     base.css → shared.css → components.css → pages.css
   注意：header 排版、footer 结构、hero 尺寸等两站存在信息架构差异的规则不在此文件，
   各自留在 components.css / pages.css。 */

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--sp-6) 0;
  background: var(--paper);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title:hover {
  border-bottom: none;
}

.site-header nav {
  display: flex;
  gap: var(--sp-7);
}

.site-header nav a:hover {
  color: var(--ink);
  border-bottom: none;
}

/* ---------- Sections ---------- */
.section {
  padding: var(--sp-10) 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--ink);
  padding-bottom: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.section-header h2 {
  font-weight: 200;
}

.section-header .t-meta {
  flex-shrink: 0;
}

.about-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--grey-3);
}

/* ---------- Contact list ---------- */
/* 索引行：行间与块底部都不画线（6 行各一条会密成刻度表，收尾线也多余），
   整块靠 section-header 的上墨线与自身留白界定边界 */
.contact-list {
  display: flex;
  flex-direction: column;
}

/* 逐行紧贴的 key-value：不设共享列，值直接跟在标签右侧。
   联系方式是逐行读的（找邮箱就只看邮箱那行），不需要纵向对齐，
   而一旦对齐，最长标签会把其余各行的值与标签拉开一大段空白。 */
.contact-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-6);
  padding: var(--sp-4) 0;
}

.contact-label {
  flex-shrink: 0;
  transition: color 0.2s;
}

.contact-item:hover .contact-label,
.contact-item:focus-within .contact-label {
  color: var(--ink);
}

/* 链接与可复制项常态外观一致（都不带下划线），差异只由尾部标记表达；
   悬停/聚焦整行时下划线一并浮出 */
.contact-value {
  min-width: 0;
  font-size: 1rem;
  font-weight: 400;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.contact-item:hover .contact-value,
.contact-item:focus-within .contact-value {
  border-bottom-color: var(--ink);
}

/* 值尾部行为标记：站外链接 ↗、站内链接 →；可复制项用复制图标（见下） */
a.contact-value::after {
  content: "↗";
  display: inline-block;
  margin-left: var(--sp-3);
  font-family: var(--mono);
  font-size: 0.85em;
  line-height: 1;
  color: var(--grey-3);
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s;
}

a.contact-value[href^="/"]::after {
  content: "→";
}

.contact-item:hover a.contact-value::after,
.contact-item:focus-within a.contact-value::after {
  opacity: 1;
  transform: translateX(2px);
}

.contact-copy {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
}

.contact-copy::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.5;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.contact-copy:hover::after,
.contact-item:hover .contact-copy::after,
.contact-item:focus-within .contact-copy::after {
  opacity: 1;
}

.contact-copy.copied::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  opacity: 1;
}

/* 小屏手机：标签与值改为上下结构，避免长值（邮箱）被挤断 */
@media (max-width: 480px) {
  .contact-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }
}

/* ---------- GitHub Alerts ---------- */
.markdown-alert {
  border-left: 3px solid var(--grey-2);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-7);
  background: var(--grey-1);
}

.markdown-alert p {
  margin-bottom: 0;
  max-width: none;
}

.markdown-alert-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
  color: var(--ink);
}

.markdown-alert-title svg {
  flex-shrink: 0;
  fill: currentColor;
}

/* Tier 1: informational */
.markdown-alert-note,
.markdown-alert-tip {
  border-left-color: var(--grey-3);
}

/* Tier 2: action required */
.markdown-alert-important,
.markdown-alert-warning,
.markdown-alert-caution {
  border-left-color: var(--ink);
  border-left-width: 4px;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: var(--sp-10) 0 var(--sp-8);
  margin-top: var(--sp-10);
}

.footer-masthead {
  border-top: 2px solid var(--ink);
  padding-top: var(--sp-6);
}

.footer-tagline {
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--grey-3);
  max-width: 36ch;
  margin: 0;
  justify-self: end;
  text-align: right;
}

/* ---------- Page hero ---------- */
.hero {
  padding: var(--sp-11) 0 var(--sp-10);
}

.hero-label {
  color: var(--grey-3);
  margin-bottom: var(--sp-7);
}

.hero-desc {
  font-family: var(--sans);
  font-size: max(13px, 1vw);
  line-height: 1.6;
  color: var(--grey-3);
  font-weight: 300;
  max-width: 36ch;
  margin-top: var(--sp-6);
}

.hero h1 {
  margin-bottom: var(--sp-7);
}

.hero .lead {
  margin-bottom: var(--sp-8);
}

.split-left-content {
  position: relative;
  z-index: 1;
}

.split-left-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,.22);
}

/* ---------- Rules list ---------- */
.rules-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rule-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-7);
  align-items: start;
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--grey-2);
}

.rule-item.accent-bottom {
  border-bottom: 2px solid var(--ink);
}

.rule-num {
  font-family: var(--sans);
  font-weight: 200;
  font-size: min(4.4vw, 7.8vh);
  line-height: .9;
  color: var(--ink);
}

.rule-body h3 {
  font-family: var(--sans);
  font-weight: 400;
  font-size: max(18px, 1.8vw);
  line-height: 1.2;
  letter-spacing: -.015em;
  margin-bottom: var(--sp-3);
}

.rule-body p {
  font-family: var(--sans);
  font-size: max(12px, .92vw);
  line-height: 1.6;
  color: var(--grey-3);
  font-weight: 300;
}
