/* 与首页同一套配色和字体；下载站用首页第五张卡片的陶土色作强调色。 */
:root {
  color-scheme: light;
  --page: #f8f7f2;
  --ink: #273c32;
  --muted: #647067;
  --line: #dfe3da;
  --accent: #8a4630;
  --accent-soft: #f5e9e2;
  --accent-line: #e5cfc3;
  --surface: #fffefa;
  --danger: #a33a2c;
  --ok: #2e654b;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); }
a { color: inherit; }
svg { display: block; }
::selection { color: #183e2e; background: #d5e5d5; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.page-shell { width: min(960px, calc(100% - 64px)); margin-inline: auto; }

.skip-link {
  position: absolute; z-index: 10; top: 12px; left: 12px;
  padding: 12px 20px; border-radius: 6px; color: #fff; background: #24533b;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: 96px; border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 680; letter-spacing: 0.06em; text-decoration: none;
}
.site-mark { width: 27px; height: 27px; color: #365f46; }
.wordmark-domain { font-weight: 400; color: var(--muted); }
.header-link { font-size: 14px; color: var(--muted); text-decoration: none; }
.header-link:hover { color: var(--ink); text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.muted { color: var(--muted); }

.intro { padding-block: 64px 36px; animation: rise 600ms var(--ease-out) backwards; }
.eyebrow {
  display: flex; align-items: center; gap: 9px; margin: 0 0 18px;
  font-size: 13px; letter-spacing: 0.06em; color: #59665d;
}
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
h1 {
  margin: 0; font-size: clamp(36px, 5vw, 56px); font-weight: 650;
  line-height: 1.2; letter-spacing: -0.06em;
}
.intro-copy { margin: 18px 0 0; font-size: 16px; line-height: 1.9; color: var(--muted); }
@keyframes rise { from { opacity: 0; translate: 0 14px; } }

.status { margin: 0 0 24px; color: var(--muted); }

/* ---------- 公开资源列表 ---------- */

.resource-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.resource {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 24px; border: 1px solid var(--accent-line); border-radius: 14px;
  background: var(--surface);
  animation: rise 500ms var(--ease-out) backwards;
  transition: border-color 240ms ease, box-shadow 320ms var(--ease-out);
}
.resource:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--accent-line)); box-shadow: 0 16px 32px -26px rgba(138, 70, 48, 0.6); }
.resource:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.resource-main { min-width: 0; }
.resource-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.resource-title { margin: 0; font-size: 20px; font-weight: 620; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.resource-description { margin: 8px 0 0; line-height: 1.7; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.resource-meta { margin: 8px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.resource-action { flex-shrink: 0; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; white-space: nowrap; border: 1px solid transparent;
}
.badge-public { color: var(--ok); background: #e8efe4; border-color: #c4d5c6; }
.badge-locked { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.badge-pending { color: #7a5a12; background: #f6eed7; border-color: #e5d3a3; }

.unlock-form { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 340px; }
.unlock-form input.key-input { width: 180px; }
.unlock-form .form-error { flex-basis: 100%; text-align: right; }

/* ---------- 表单控件 ---------- */

input:not([type="radio"]):not([type="file"]), textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd5cc; border-radius: 8px;
  font: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid #225b3f; outline-offset: 2px;
}

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 18px; border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms ease;
}
.button:active { transform: scale(0.97); }
.button:disabled { opacity: 0.55; cursor: progress; }
.button.primary { color: #fffaf6; background: var(--accent); }
.button.primary:hover { background: #723826; }
.button.ghost { color: var(--ink); background: transparent; border-color: #cfd5cc; }
.button.ghost:hover { background: #eef1ea; }
.button.danger { color: var(--danger); background: transparent; border-color: #e3c2bc; }
.button.danger:hover { background: #fbecea; }

.form-error { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--danger); }
.form-error.ok { color: var(--ok); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- 后台 ---------- */

.admin main { padding-block: 32px 64px; display: grid; gap: 24px; }
.admin #workspace { display: grid; gap: 24px; }
.panel { padding: 26px 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.panel h1 { font-size: 26px; letter-spacing: -0.03em; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.login-panel { max-width: 420px; margin: 40px auto 0; width: 100%; }
.stack { display: grid; gap: 8px; }
.stack > label, .stack label { font-size: 14px; font-weight: 550; }
.stack label > input, .stack label > textarea { margin-top: 6px; font-weight: 400; }
.stack .button[type="submit"] { justify-self: start; margin-top: 6px; }
.visibility { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0; padding: 0; border: 0; }
.visibility legend { margin-bottom: 8px; font-size: 14px; font-weight: 550; }
.visibility label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.key-row { display: grid; gap: 8px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 180px; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

.admin-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.admin-resource { display: grid; gap: 10px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.admin-resource-head { display: flex; justify-content: space-between; gap: 16px; }
.admin-resource .resource-title { font-size: 17px; }
.admin-resource .resource-description { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; justify-content: flex-end; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-actions .button { min-height: 34px; padding: 5px 14px; font-size: 14px; }
.edit-form { padding-top: 10px; border-top: 1px dashed var(--line); }

.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 56px; padding-block: 32px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px; letter-spacing: 0.08em;
}
.site-footer > :last-child > span { margin-left: 9px; color: #8a6b33; }

@media (max-width: 680px) {
  .page-shell { width: calc(100% - 32px); }
  .site-header { min-height: 76px; }
  .wordmark { font-size: 12px; gap: 10px; }
  .intro { padding-block: 40px 28px; }
  .resource { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px; }
  .resource-action .button { width: 100%; }
  .unlock-form { max-width: none; justify-content: stretch; }
  .unlock-form input.key-input { width: auto; flex: 1; min-width: 0; }
  .unlock-form .form-error { text-align: left; }
  .panel { padding: 20px 18px; }
  .admin-resource-head { flex-direction: column; }
  .badges { justify-content: flex-start; }
  .header-actions { gap: 10px; }
  .header-actions .muted { display: none; }
}

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