/* 幻云界 v4.1 · 幻云志 / 友邻名片墙 */

.friends-container {
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 72px;
}

.friends-hero,
.friend-apply-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid rgba(166, 132, 75, .26);
  border-radius: 16px;
  background:
    radial-gradient(75% 110% at 92% 0%, rgba(183, 102, 60, .1), transparent 58%),
    linear-gradient(130deg, rgba(255,252,244,.93), rgba(246,237,220,.9));
  box-shadow: 0 18px 40px rgba(92, 66, 35, .1);
}

.friends-kicker {
  color: #a14f32;
  font: 10px "JetBrains Mono", "Cascadia Code", monospace;
  letter-spacing: .2em;
}

.friends-title {
  margin: 9px 0 10px;
  color: #28251e;
  font: 600 clamp(32px, 5vw, 50px) "Noto Serif SC", "Songti SC", serif;
  letter-spacing: .06em;
}

.friends-lead {
  max-width: 700px;
  margin: 0;
  color: #766a58;
  line-height: 1.9;
}

.friends-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 26px 0 14px;
}

.friends-head h2 {
  margin: 0;
  color: #302a20;
  font: 600 21px "Noto Serif SC", "Songti SC", serif;
}

.friends-meta {
  color: #8b7960;
  font: 11px "JetBrains Mono", "Cascadia Code", monospace;
}

.friends-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.friends-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.friend-filter {
  padding: 7px 12px;
  border: 1px solid rgba(151, 119, 67, .28);
  border-radius: 999px;
  background: rgba(255, 252, 244, .78);
  color: #79694e;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.friend-filter:hover,
.friend-filter.active {
  border-color: #9e4c2f;
  background: #9e4c2f;
  color: #fff8ee;
}

.friends-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.main-section .friends-wall {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.friend-card {
  display: flex;
  min-width: 0;
  min-height: 148px;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(159, 128, 78, .24);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255,253,248,.96), rgba(248,241,228,.93));
  color: #302b23;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(92, 66, 35, .08);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

/* 兼容旧版幻云志样式里的同名容器类与滚动入场规则。 */
.friends-wall > .friend-card {
  opacity: 1 !important;
  transform: none;
}

.friend-card:hover {
  transform: translateY(-3px);
  border-color: rgba(159, 76, 47, .62);
  box-shadow: 0 14px 30px rgba(92, 66, 35, .13);
}

.friends-wall > .friend-card:hover {
  transform: translateY(-3px);
}

.friend-card__head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.friend-card__logo {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(151, 119, 67, .25);
  border-radius: 50%;
  background: #efe4d0;
  color: #8e4931;
}

.friend-card__logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-card__initial {
  font: 600 14px "Noto Serif SC", "Songti SC", serif;
}

.friend-card__identity {
  min-width: 0;
}

.friend-card__identity h3 {
  margin: 0 0 4px;
  overflow: hidden;
  color: #2f2920;
  font: 600 15px "Noto Serif SC", "Songti SC", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-card__identity span {
  display: block;
  overflow: hidden;
  color: #9a8567;
  font: 9px "JetBrains Mono", "Cascadia Code", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-card > p {
  margin: 0;
  color: #746b5e;
  font-size: 12px;
  line-height: 1.65;
}

.friend-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: #977a51;
  font-size: 10px;
}

.friend-card__tags {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-card__arrow {
  color: #9e4c2f;
  white-space: nowrap;
}

.friend-card--compact {
  min-height: 0;
  gap: 8px;
  padding: 11px;
}

.friend-card--compact .friend-card__logo {
  width: 30px;
  height: 30px;
}

.friend-card--compact .friend-card__identity h3 {
  font-size: 13px;
}

.friend-card--compact > p,
.friend-card--compact .friend-card__foot {
  display: none;
}

/* friends.html：介绍名片压缩到原视觉面积的一半左右 */
.friends-page .friends-wall {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.friends-page .friend-card {
  min-height: 92px;
  gap: 7px;
  padding: 11px;
  border-radius: 9px;
}

.friends-page .friend-card__head {
  gap: 7px;
}

.friends-page .friend-card__logo {
  width: 30px;
  height: 30px;
}

.friends-page .friend-card__initial {
  font-size: 12px;
}

.friends-page .friend-card__identity h3 {
  margin-bottom: 2px;
  font-size: 13px;
}

.friends-page .friend-card__identity span {
  font-size: 8px;
}

.friends-page .friend-card > p {
  font-size: 10.5px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
}

.friends-page .friend-card__foot {
  gap: 5px;
  font-size: 9px;
}

.friends-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.friends-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid rgba(151, 119, 67, .3);
  border-radius: 999px;
  background: rgba(255,252,244,.8);
  color: #7d5338;
  font-size: 13px;
  text-decoration: none;
}

.friends-action--primary {
  border-color: #8e4931;
  background: #8e4931;
  color: #fff8ee;
}

.friend-apply-shell {
  width: min(760px, calc(100% - 40px));
  margin: 28px auto 72px;
}

.friend-apply-form {
  display: grid;
  gap: 15px;
  margin-top: 20px;
  padding: 24px;
  border: 1px solid rgba(159, 128, 78, .24);
  border-radius: 14px;
  background: rgba(255,252,246,.9);
  box-shadow: 0 12px 30px rgba(92, 66, 35, .09);
}

.friend-apply-field {
  display: grid;
  gap: 7px;
  color: #4d4538;
  font-size: 13px;
}

.friend-apply-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.friend-apply-field input,
.friend-apply-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(151, 119, 67, .26);
  border-radius: 8px;
  background: #fffdf8;
  color: #302b23;
  font: inherit;
  outline: none;
}

.friend-apply-field textarea {
  min-height: 108px;
  resize: vertical;
}

.friend-apply-field input:focus,
.friend-apply-field textarea:focus {
  border-color: #9e4c2f;
  box-shadow: 0 0 0 3px rgba(158, 76, 47, .1);
}

.friend-apply-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.friend-apply-submit {
  justify-self: start;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: #8e4931;
  color: #fff8ee;
  font: inherit;
  cursor: pointer;
}

.friend-apply-submit:disabled {
  cursor: wait;
  opacity: .6;
}

.friend-apply-status {
  min-height: 22px;
  color: #7d6e58;
  font-size: 13px;
}

.friend-apply-status.is-error {
  color: #a53f32;
}

.friend-apply-status.is-success {
  color: #47755b;
}

.friends-footnote {
  margin: 14px 0 0;
  color: #8b7d69;
  font-size: 12px;
  line-height: 1.8;
}

body[data-section="chronicle"].dark .friends-hero,
body[data-section="chronicle"].dark .friend-apply-hero,
body[data-section="chronicle"].dark .friend-card,
body[data-section="chronicle"].dark .friend-apply-form {
  border-color: rgba(212, 181, 124, .18);
  background: rgba(30, 32, 29, .92);
  color: #ece5d6;
}

body[data-section="chronicle"].dark .friends-title,
body[data-section="chronicle"].dark .friends-head h2,
body[data-section="chronicle"].dark .friend-card__identity h3 {
  color: #f0e7d7;
}

body[data-section="chronicle"].dark .friends-lead,
body[data-section="chronicle"].dark .friend-card > p,
body[data-section="chronicle"].dark .friend-apply-field {
  color: #bbb09e;
}

@media (max-width: 1080px) {
  .friends-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .friends-page .friends-wall {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .friends-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .friends-page .friends-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .friends-container,
  .friend-apply-shell {
    width: min(100% - 24px, 1120px);
  }

  .friends-hero,
  .friend-apply-hero {
    padding: 26px 20px;
  }

  .friends-toolbar,
  .friends-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .friends-wall {
    grid-template-columns: 1fr;
  }

  .main-section .friends-wall {
    grid-template-columns: 1fr;
  }

  .friends-page .friends-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .friend-apply-grid {
    grid-template-columns: 1fr;
  }
}
