/* ============================================================
   v2 —— 应用卡片 / 筛选条 / 主题开关
   依赖 bright.css 里的主题变量；暗色由 night.css 覆盖变量即可继承
   ============================================================ */

/* ---------- 筛选条 ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 17px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 3px 3px 0 rgba(43, 33, 25, 0.12);
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease), color 0.3s var(--ease);
}
.filter-chip:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(43, 33, 25, 0.16);
}
.filter-chip[aria-pressed="true"] {
  background: var(--redstone);
  border-color: var(--redstone-dark);
  color: #fff;
  box-shadow: 3px 3px 0 rgba(143, 31, 24, 0.35);
}
.filter-chip__num {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.72;
}
.filter-chip--jump { text-decoration: none; }
.filter-chip--jump .filter-chip__num { color: var(--redstone); opacity: 1; }

/* ---------- 红石横条（线框图里那条通栏）---------- */
.rs-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 26px;
  padding: 0;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: linear-gradient(180deg, #5a4a3a 0%, #453729 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 3px 3px 0 rgba(43, 33, 25, 0.14);
  overflow: hidden;
}
.rs-bar__wire {
  flex: 1;
  height: 4px;
  margin: 0 14px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--redstone) 0 14px,
    transparent 14px 26px
  );
  box-shadow: 0 0 6px var(--redstone-glow);
  animation: rs-flow 2.6s linear infinite;
}
@keyframes rs-flow {
  to { background-position: 26px 0; }
}
.rs-bar__label {
  flex: 0 0 auto;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffe9b8;
  white-space: nowrap;
}
.rs-bar__lamp {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-right: 14px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold), inset 0 0 3px #fff;
  animation: rs-lamp 1.8s ease-in-out infinite;
}
@keyframes rs-lamp {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 应用卡片网格 ---------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 rgba(43, 33, 25, 0.13);
  overflow: hidden;
  transition: transform 0.42s var(--ease), box-shadow 0.42s var(--ease),
    border-color 0.42s var(--ease);
}
.app-card:hover,
.app-card:focus-within {
  transform: translate(-3px, -5px);
  box-shadow: 8px 10px 0 rgba(43, 33, 25, 0.18);
  border-color: var(--redstone);
}

.app-card__hit {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

/* 封面 */
.app-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
  overflow: hidden;
}
.app-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transform: scale(1.001);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}
.app-card:hover .app-card__cover img {
  transform: scale(1.06);
}
.app-card__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(43, 33, 25, 0) 52%, rgba(43, 33, 25, 0.42) 100%);
  pointer-events: none;
}
.app-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.app-card__badge--game { background: var(--gold); }
.app-card__badge--tool { background: #bfe9ff; }
.app-card__go {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-size: 14px;
  color: var(--ink);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.app-card:hover .app-card__go,
.app-card:focus-within .app-card__go {
  opacity: 1;
  transform: translate(0, 0);
}

/* 正文 */
.app-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 14px 16px 0;
}
.app-card__head {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.app-card__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  object-fit: contain;
  padding: 6px;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 2px solid var(--ink);
  image-rendering: pixelated;
}
.app-card__names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-card__title {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.14rem;
  line-height: 1.28;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.app-card__by {
  display: block;
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.app-card__desc {
  display: -webkit-box;
  margin: 0;
  font-size: 13px;
  line-height: 1.68;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 标签 */
.app-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.app-card__tags > span,
.app-card__tags li {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* 无截图的封面：用红石元件拼一个生成式封面 */
.app-card__cover--gen {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 28% 18%, #3b2e22 0%, #221a13 58%, #14100c 100%);
}
.app-card__cover--gen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 212, 92, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 212, 92, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.app-card__cover--gen img {
  position: relative;
  z-index: 1;
  width: 84px;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  transform: none;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.55));
}
.app-card:hover .app-card__cover--gen img {
  transform: rotate(-4deg) scale(1.06);
}
.app-card--static:hover .app-card__cover--gen img {
  transform: none;
}

/* 底部数据行 */
.app-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 10px 16px;
  border-top: 2px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.app-card__foot b {
  font-weight: 700;
  color: var(--ink);
}
.app-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--redstone);
  transition: gap 0.3s var(--ease);
}
.app-card:hover .app-card__cta { gap: 7px; }

/* 无链接的纯展示卡 */
.app-card--static {
  cursor: default;
}
.app-card--static:hover {
  transform: none;
  box-shadow: 3px 3px 0 rgba(43, 33, 25, 0.13);
  border-color: var(--ink);
}
.app-card--static:hover .app-card__cover img { transform: scale(1.001); }
.app-card--static .app-card__cover img { filter: saturate(0.9); }
.app-card--static .app-card__cta {
  color: var(--ink-soft);
  font-weight: 400;
}
.app-card--static:hover .app-card__cta { gap: 4px; }

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(43, 33, 25, 0.14);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease);
}
.theme-toggle:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(43, 33, 25, 0.18);
}
.theme-toggle:focus-visible {
  outline: 3px solid var(--redstone);
  outline-offset: 2px;
}
.theme-toggle svg {
  width: 19px;
  height: 19px;
  display: block;
}
.theme-toggle__moon { display: none; }
html[data-theme="night"] .theme-toggle__sun { display: none; }
html[data-theme="night"] .theme-toggle__moon { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 700px) {
  .app-grid { grid-template-columns: 1fr; gap: 14px; }
  .filter-bar { gap: 8px; margin-bottom: 14px; }
  .filter-chip { padding: 8px 13px; font-size: 12.5px; }
  .rs-bar { height: 30px; margin-bottom: 18px; }
  .rs-bar__label { font-size: 9.5px; padding: 0 10px; }
  .app-card__title { font-size: 1.06rem; }
  .app-card__desc { font-size: 12.5px; }
}

@media (hover: none) {
  .app-card__go { opacity: 1; transform: none; }
  .app-card:hover { transform: none; box-shadow: 3px 3px 0 rgba(43, 33, 25, 0.13); }
  .app-card:hover .app-card__cover img { transform: scale(1.001); }
}

@media (prefers-reduced-motion: reduce) {
  .rs-bar__wire, .rs-bar__lamp { animation: none; }
  .app-card, .app-card__cover img, .app-card__go,
  .filter-chip, .theme-toggle, .app-card__cta {
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 夜间：图片类元素无法跟随变量，单独压暗 ---------- */
html[data-theme="night"] .hero-hills img {
  filter: brightness(0.42) saturate(0.62) hue-rotate(-6deg);
}
html[data-theme="night"] .cloud img {
  filter: brightness(0.32);
  opacity: 0.55;
}
html[data-theme="night"] .app-card__cover img {
  filter: brightness(0.88) saturate(0.92);
}
html[data-theme="night"] .app-card--static .app-card__cover img {
  filter: brightness(0.78) saturate(0.72);
}
html[data-theme="night"] .hero-card img {
  filter: brightness(0.82) saturate(0.92);
}

/* =========================================================
   v3 —— 顶部搜索 / 二级页导航标签 / 二级页页头
   ========================================================= */

/* ---------- 顶栏布局：搜索框绝对居中 ---------- */
.site-header__inner {
  position: relative;
}

.site-search {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 7px;
  width: clamp(220px, 30vw, 360px);
  height: 38px;
  padding: 0 10px 0 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper, #fffdf6);
  box-shadow: 3px 3px 0 rgba(43, 33, 25, 0.16);
  z-index: 3;
  transition: box-shadow 0.18s var(--ease, ease), border-color 0.18s var(--ease, ease);
}
.site-search:focus-within {
  border-color: var(--redstone, #c0392b);
  box-shadow: 3px 3px 0 rgba(192, 57, 43, 0.28);
}
.site-search__icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--ink-soft, #6b5c4a);
}
.site-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-body, inherit);
  font-size: 13px;
  color: var(--ink, #2b2119);
  outline: none;
  appearance: none;
}
.site-search__input::placeholder {
  color: #9a8b76;
}
.site-search__input::-webkit-search-cancel-button {
  cursor: pointer;
  filter: grayscale(1) opacity(0.5);
}
.site-search__hint {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-soft, #f3e9d6);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  color: var(--ink-soft, #6b5c4a);
}

/* ---------- 右上角二级页标签 ---------- */
.nav-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
}
.nav-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2, #cbb99a);
  background: var(--paper, #fffdf6);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #6b5c4a);
  white-space: nowrap;
  transition: transform 0.16s var(--ease, ease), border-color 0.16s var(--ease, ease),
    color 0.16s var(--ease, ease), background 0.16s var(--ease, ease);
}
.nav-tag span {
  font-size: 9px;
  opacity: 0.6;
}
.nav-tag:hover {
  transform: translateY(-1px);
  border-color: var(--redstone, #c0392b);
  color: var(--redstone, #c0392b);
}
.nav-tag:focus-visible {
  outline: 2px solid var(--redstone, #c0392b);
  outline-offset: 2px;
}

/* ---------- 二级页页头 ---------- */
.page-head {
  padding: clamp(96px, 12vh, 150px) 0 clamp(26px, 4vw, 44px);
}
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft, #6b5c4a);
  transition: color 0.16s var(--ease, ease), transform 0.16s var(--ease, ease);
}
.page-back:hover {
  color: var(--redstone, #c0392b);
  transform: translateX(-3px);
}
.page-title {
  margin: 10px 0 14px;
  font-family: var(--font-display, inherit);
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.12;
  color: var(--ink, #2b2119);
}
.page-desc {
  max-width: 46ch;
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-soft, #6b5c4a);
}

/* ---------- 搜不到结果 ---------- */
.work-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px dashed var(--line-2, #cbb99a);
  background: var(--paper, #fffdf6);
  font-size: 13.5px;
  color: var(--ink-soft, #6b5c4a);
}
.work-empty[hidden] {
  display: none;
}
.work-empty__reset {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2, #cbb99a);
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
}
.work-empty__reset:hover {
  border-color: var(--redstone, #c0392b);
  color: var(--redstone, #c0392b);
}

/* ---------- 夜间 ---------- */
html[data-theme="night"] .site-search {
  background: #121834;
  border-color: rgba(240, 222, 190, 0.28);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}
html[data-theme="night"] .site-search:focus-within {
  border-color: #ff5a45;
  box-shadow: 3px 3px 0 rgba(255, 90, 69, 0.3);
}
html[data-theme="night"] .site-search__input {
  color: #f2e7d5;
}
html[data-theme="night"] .site-search__input::placeholder {
  color: #a8987f;
}
html[data-theme="night"] .site-search__icon {
  color: #cfbfa5;
}
html[data-theme="night"] .site-search__hint {
  background: rgba(255, 255, 255, 0.08);
  color: #cfbfa5;
}
html[data-theme="night"] .nav-tag {
  background: transparent;
  border-color: rgba(240, 222, 190, 0.24);
  color: #cfbfa5;
}
html[data-theme="night"] .nav-tag:hover {
  border-color: #ff5a45;
  color: #ff8f7d;
}
html[data-theme="night"] .page-title {
  color: #f8efdf;
}
html[data-theme="night"] .work-empty {
  background: #121834;
  border-color: rgba(240, 222, 190, 0.24);
  color: #cfbfa5;
}

/* ---------- 窄屏：搜索框退回第二行 ---------- */
@media (max-width: 1020px) {
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .site-search {
    position: static;
    transform: none;
    order: 9;
    flex-basis: 100%;
    width: 100%;
    height: 36px;
    margin-top: 2px;
    box-shadow: none;
  }
  .nav-tags {
    margin-left: 8px;
  }
  .nav-tag {
    padding: 3px 7px;
    font-size: 10px;
  }
}
@media (max-width: 560px) {
  .nav-tags {
    display: none;
  }
}

/* ---------- 首屏介绍里的人名统一突出 ---------- */
.hero__lead strong {
  font-weight: 700;
  color: var(--ink, #2b2119);
  background: linear-gradient(180deg, transparent 62%, rgba(242, 163, 60, 0.42) 62%);
  padding: 0 1px;
}
html[data-theme="night"] .hero__lead strong {
  color: #ffd45c;
  background: linear-gradient(180deg, transparent 66%, rgba(255, 90, 69, 0.32) 66%);
}

/* ---------- 二级页：页头与内容之间不要留大段空白 ---------- */
.page-head + .section {
  padding-top: clamp(10px, 1.6vw, 22px);
}
.page-head {
  padding-bottom: clamp(14px, 2vw, 24px);
}

/* ---------- [hidden] 必须真的隐藏（.app-card 的 display 会盖掉 UA 样式） ---------- */
.app-card[hidden] {
  display: none;
}
