/* ==========================================================================
   学生福利包 · 样式表
   设计思路：浅色米白底 + 墨绿主色，卡片化、圆角柔和、信息密度适中；
   深色模式跟随系统，也可手动切换。全站零图片，首屏体积可控。
   ========================================================================== */

:root {
  --bg: #f5f7f3;
  --bg-soft: #ecefe9;
  --surface: #ffffff;
  --surface-2: #fafbf8;
  --ink: #14181a;
  --ink-2: #3d474e;
  --muted: #6d7a80;
  --line: #e2e6df;
  --line-strong: #cfd6cb;
  --accent: #12846b;
  --accent-ink: #0b6853;
  --accent-soft: #e3f3ec;
  --amber: #b0691a;
  --amber-soft: #fdf0dc;
  --danger: #b23a3a;
  --danger-soft: #fbe9e9;
  --shadow-sm: 0 1px 2px rgba(20, 30, 25, .05);
  --shadow-md: 0 10px 26px -18px rgba(20, 40, 32, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1220px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0c0f11;
  --bg-soft: #121719;
  --surface: #151b1e;
  --surface-2: #1a2125;
  --ink: #eef2f0;
  --ink-2: #c3ccc9;
  --muted: #8d9a97;
  --line: #232b2e;
  --line-strong: #2e383c;
  --accent: #4fd1ab;
  --accent-ink: #7fe3c6;
  --accent-soft: #14312a;
  --amber: #e2a75f;
  --amber-soft: #2f2517;
  --danger: #ef8b8b;
  --danger-soft: #351d1d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 14px 30px -20px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

/* 有 hidden 属性就必须真的隐藏：否则会被下面的 display:grid / block 规则盖掉 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 页面顶部一层极淡的渐变，避免纯色显得单调 */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 320px;
  background:
    radial-gradient(120% 100% at 18% 0%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 62%),
    radial-gradient(90% 100% at 92% 0%, color-mix(in srgb, var(--amber) 10%, transparent) 0%, transparent 58%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 520px) {
  .wrap { padding: 0 14px; }
}

/* ---------------------------------------------------------------- 顶部栏 */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 6px 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-text em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .3px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .18s, color .18s, transform .18s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }

html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
/* 深色模式下品牌底色变浅，图标改用深色，避免「浅底白字」看不清 */
html[data-theme="dark"] .brand-mark { color: #06120e; }

/* ---------------------------------------------------------------- 首屏 */

.hero {
  position: relative;
  z-index: 1;
  padding: 44px 0 22px;
  max-width: 720px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4.4vw, 42px);
  line-height: 1.22;
  letter-spacing: -.6px;
  font-weight: 700;
}

.hero-accent {
  background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--accent) 26%, transparent) 62%);
  padding: 0 2px;
}

.hero-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 60ch;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

@media (max-width: 640px) {
  .hero { padding-top: 30px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-sub { font-size: 14px; }
}

/* ---------------------------------------------------------------- 筛选区 */

.controls {
  position: sticky;
  top: 62px;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px 0 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.search-box {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 10px 0 12px;
  height: 46px;
  transition: border-color .18s, box-shadow .18s;
}
.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.search-icon { color: var(--muted); flex: 0 0 auto; }

#searchInput {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  height: 100%;
}
#searchInput::placeholder { color: var(--muted); opacity: .85; }
#searchInput::-webkit-search-cancel-button { display: none; }

.clear-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 0;
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
}
.clear-btn:hover { color: var(--ink); }

.select {
  flex: 0 0 auto;
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  padding: 0 12px;
  cursor: pointer;
  outline-offset: 2px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 14px;
}
.chips::-webkit-scrollbar { display: none; }

/* 内容超出可视宽度时，右侧做一层淡出，暗示「还能往右滑」 */
.chips.is-scrollable {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s;
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
html[data-theme="dark"] .chip[aria-selected="true"] { color: #08130f; }
.chip .num {
  font-size: 11.5px;
  opacity: .72;
  font-variant-numeric: tabular-nums;
}

.chips-benefit { padding-top: 8px; }
.chips-benefit .chip { height: 30px; font-size: 12.5px; }
.chips-benefit .chip[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent-ink);
}

.result-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px 0;
  font-size: 13px;
  color: var(--muted);
}
.result-count { color: var(--ink-2); }
.result-count em {
  font-style: normal;
  color: var(--accent-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.result-hint { text-align: right; font-size: 12px; }

/* ---------------------------------------------------------------- 卡片 */

.grid {
  display: grid;
  gap: 14px;
  padding: 16px 0 8px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
  min-height: 168px;
  cursor: pointer; /* 卡片不是链接，但用小手提示「可以点」 */
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 45%);
  transition: opacity .2s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: var(--shadow-md);
}
/* 键盘聚焦时给一圈明显的描边，不然光靠阴影看不出焦点在哪 */
.card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 3px;
}
.card:hover::after,
.card:focus-visible::after { opacity: 1; }

.card.is-unavailable { opacity: .72; }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.mono {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.4px;
  color: #fff;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.card-title {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-title h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -.2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title .cat {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .2px;
}

.card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
}
.badge.is-amber { background: var(--amber-soft); color: var(--amber); }
.badge.is-muted { background: var(--bg-soft); color: var(--muted); }
.badge.is-danger { background: var(--danger-soft); color: var(--danger); }

.card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--line) 85%, transparent);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.card-go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-ink);
  font-weight: 600;
  flex: 0 0 auto;
}
.card-go svg { transition: transform .18s ease; }
.card:hover .card-go svg { transform: translate(2px, -2px); }

/* ---------------------------------------------------------------- 状态提示 */

.state-box {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-2);
}
.state-box h4 {
  margin: 14px 0 6px;
  font-size: 16px;
  color: var(--ink);
}
.state-box p {
  margin: 0 auto;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 52ch;
}
.state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent);
}
.state-box code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.load-more {
  display: block;
  margin: 18px auto 30px;
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .16s, transform .16s;
}
.load-more:hover { border-color: var(--line-strong); }
.load-more:active { transform: scale(.98); }

/* 加载骨架：数据还没到的时候先撑出卡片的形状，避免页面跳动 */
.skeleton {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
  min-height: 168px;
  overflow: hidden;
  position: relative;
}
.sk-line {
  height: 12px;
  border-radius: 6px;
  background: var(--bg-soft);
  margin-bottom: 10px;
}
.sk-line.w60 { width: 60%; }
.sk-line.w85 { width: 85%; }
.sk-line.w40 { width: 40%; }
.sk-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface-2) 70%, transparent) 50%, transparent 80%);
  animation: shimmer 1.35s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-60%); }
  to { transform: translateX(60%); }
}

/* ---------------------------------------------------------------- 页脚 */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 26px 0 40px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--muted);
}
.footer-note { max-width: 62ch; }
.footer-note strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 4px;
  letter-spacing: .3px;
}
.footer-note p { margin: 0; line-height: 1.7; }
.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   详情页（offer.html）
   ========================================================================== */

.detail-wrap {
  position: relative;
  z-index: 1;
  padding-top: 16px;
  padding-bottom: 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 16px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
}
.breadcrumb a:hover { color: var(--accent-ink); }
.crumb-sep { color: var(--line-strong); }
.crumb-current { color: var(--muted); }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
  max-width: 880px;
}

@media (max-width: 560px) {
  .detail-card { padding: 18px; border-radius: 16px; }
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mono-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 23px;
}

.detail-head-text { min-width: 0; }
.detail-cat {
  display: inline-block;
  font-size: 11.5px;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-head-text h1 {
  margin: 0;
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.28;
  letter-spacing: -.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-summary {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.78;
  color: var(--ink-2);
}

.detail-tags { margin-top: 12px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
}

@media (max-width: 560px) {
  .info-grid { grid-template-columns: 1fr; }
}

.info-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.info-item dt {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 3px;
  letter-spacing: .2px;
}
.info-item dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.status-pill.is-ok { background: var(--accent-soft); color: var(--accent-ink); }
.status-pill.is-amber { background: var(--amber-soft); color: var(--amber); }
.status-pill.is-danger { background: var(--danger-soft); color: var(--danger); }
.status-pill.is-muted { background: var(--bg-soft); color: var(--muted); }

.mono-host {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.claim-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
}
.claim-box h2 {
  margin: 0 0 4px;
  font-size: 12.5px;
  letter-spacing: .3px;
  color: var(--accent-ink);
}
.claim-box p { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s, border-color .18s, transform .18s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
html[data-theme="dark"] .btn-primary { color: #06130f; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
html[data-theme="dark"] .btn-primary:hover { color: #04100c; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-primary:active,
.btn-ghost:active { transform: scale(.98); }
.btn-primary:hover,
.btn-ghost:hover { text-decoration: none; }

.detail-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}
.detail-note b { color: var(--ink-2); font-weight: 600; }

.detail-source {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--line) 85%, transparent);
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.detail-source a { color: var(--muted); }
.detail-source a:hover { color: var(--accent-ink); }

.state-action { margin-top: 16px; }
.state-box .btn-primary { height: 42px; font-size: 14px; }
