/* ============================================================
   RPOM · 树莓派中文版杂志（非官方）
   响应式 + 深色模式 静态站点样式
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --text: #1a1d24;
  --text-soft: #5b6472;
  --accent: #c51a4a;       /* 树莓红 */
  --accent-strong: #a3143d;
  --accent-2: #2bb673;     /* 完成绿 */
  --border: #e6e8ec;
  --card: #ffffff;
  --card-soft: #fafbfc;
  --shadow: 0 8px 28px rgba(20, 20, 40, 0.08);
  --shadow-hover: 0 14px 40px rgba(20, 20, 40, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-soft: #15181f;
  --text: #e8eaed;
  --text-soft: #9aa3b2;
  --accent: #ff4d6d;
  --accent-strong: #ff6b85;
  --accent-2: #34d399;
  --border: #262b35;
  --card: #161a22;
  --card-soft: #1b202a;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 14px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.brand-logo { width: 34px; height: 34px; border-radius: 8px; }
.brand-name { font-size: 1.15rem; }
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 22px;
  font-weight: 600;
  color: var(--text-soft);
}
.nav-links a:hover { color: var(--accent); }
.theme-toggle {
  margin-left: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  transition: transform 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover { transform: rotate(20deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  min-height: 78vh;
  display: flex;
  align-items: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("/assets/images/hero.jpg");
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    rgba(10, 12, 18, 0.92) 0%,
    rgba(10, 12, 18, 0.72) 45%,
    rgba(10, 12, 18, 0.35) 100%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 80px 20px;
  max-width: 780px;
}
.badge-unofficial {
  display: inline-block;
  background: rgba(255, 77, 109, 0.16);
  border: 1px solid rgba(255, 77, 109, 0.55);
  color: #ffd7df;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 18px;
}
.hero-title {
  /* 上限 3rem(48px)：13 个全角字 ≈ 624px，可稳居 780px 盒子(内容宽 740px)单行；
     下限 1.5rem 兼容小屏手机；中间随视口 5vw 缩放。 */
  font-size: clamp(1.5rem, 5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 14px;
  font-weight: 800;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.4);
}
.hero-sub {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  margin: 0 0 16px;
  color: #e9ecf2;
}
.hero-desc {
  font-size: 1rem;
  color: #d4d9e2;
  margin: 0 0 28px;
  max-width: 560px;
}
.hero-desc strong { color: #ffd7df; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(197, 26, 74, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); background: var(--accent-strong); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}
.btn-ghost:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.22); }

/* ---------- Section ---------- */
.section-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  margin: 0 0 8px;
  text-align: center;
}
.section-note {
  text-align: center;
  color: var(--text-soft);
  margin: 0 auto 36px;
  max-width: 620px;
}
.section-note strong { color: var(--accent); }

.issues, .contact { padding: 72px 0; }
.issues { background: var(--bg); }
.contact { background: var(--bg-soft); }

/* ---------- Issue grid ---------- */
.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}
.issue-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.issue-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.issue-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--card-soft);
  display: block;
}
.issue-body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.issue-num {
  font-size: 1.05rem;
  font-weight: 800;
}
.issue-status {
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.status-done { color: var(--accent-2); }
.status-wip { color: var(--text-soft); }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.status-wip .status-dot {
  background: #f5a623;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.issue-flag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(245, 166, 35, 0.95);
  color: #1a1d24;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.issue-flag.done {
  background: var(--accent-2);
  color: #04241a;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px;
  max-width: 860px;
  margin: 0 auto;
}
.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.contact-card h3 { margin: 14px 0 4px; font-size: 1.1rem; }
.contact-card p { margin: 0; color: var(--text-soft); font-size: 0.9rem; }
.qr-wrap {
  width: 168px;
  height: 168px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}
.qr-wrap img { width: 100%; height: 100%; object-fit: contain; }
.email-wrap {
  width: 168px;
  height: 168px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #7a0f2c);
  color: #fff;
}
.email-glyph { font-size: 4rem; }
.email-link {
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
}
.email-link:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 40px 0 48px;
  text-align: center;
}
.footer-inner { max-width: 760px; }
.footer-brand {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 0 10px;
}
.footer-disclaimer {
  color: var(--text-soft);
  font-size: 0.86rem;
  margin: 0 auto 14px;
  max-width: 640px;
}
.footer-disclaimer strong { color: var(--accent); }
.footer-beian {
  font-size: 0.84rem;
  margin: 0 0 8px;
}
.footer-beian a { color: var(--text-soft); border-bottom: 1px dashed var(--border); }
.footer-beian a:hover { color: var(--accent); }
.beian-sep { margin: 0 10px; color: var(--text-soft); }
.footer-copy {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin: 0;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.6);
  backdrop-filter: blur(3px);
  animation: fade 0.25s ease;
}
.modal-card {
  position: relative;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 40px 34px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: pop 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--accent); }
.modal-spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.modal-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
}
.modal-text { margin: 0; color: var(--text-soft); font-size: 0.92rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-links { gap: 16px; }
  .hero-content { padding: 56px 16px; }
  .issues, .contact { padding: 54px 0; }
  .issue-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
