/*
Theme Name: MacDownload
Theme URI: https://example.com/macdownload
Author: WorkBuddy
Author URI: https://www.workbuddy.cn
Description: 专为 Mac 软件下载站设计的 WordPress 主题。内置软件自定义文章类型、版本/大小/系统要求字段、下载次数统计、下载记录与短代码按钮，界面采用简洁的 macOS 风格。
Version: 1.1.0
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: macdownload
*/

:root {
  --md-accent: #0071e3;
  --md-accent-hover: #0058b0;
  --md-bg: #f5f5f7;
  --md-surface: #ffffff;
  --md-text: #1d1d1f;
  --md-muted: #6e6e73;
  --md-border: #e5e5ea;
  --md-radius: 18px;
  --md-radius-sm: 12px;
  --md-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --md-shadow-hover: 0 14px 40px rgba(0, 0, 0, 0.10);
  --md-container: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--md-bg);
  color: var(--md-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--md-accent); text-decoration: none; }
a:hover { color: var(--md-accent-hover); }
button, input, select { font: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 12px; font-weight: 650; letter-spacing: -0.02em; }

.md-container { width: min(calc(100% - 40px), var(--md-container)); margin: 0 auto; }
.md-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.md-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.md-header-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.md-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--md-text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.md-brand:hover { color: var(--md-text); }
.md-brand-mark {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #343634, #111211);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.md-brand .custom-logo { max-height: 34px; width: auto; }
.md-nav { flex: 1; }
.md-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0; padding: 0;
  overflow: hidden;
  white-space: nowrap;
}
.md-menu a { color: #424245; font-size: 14px; font-weight: 500; }
.md-menu a:hover { color: var(--md-accent); }
.md-menu .current-menu-item > a { color: var(--md-accent); }
.md-header-search {
  position: relative;
  flex-shrink: 0;
  width: 220px;
}
.md-header-search input[type="search"] {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--md-text);
  outline: none;
  font-size: 13px;
  transition: border-color .2s, background .2s;
}
.md-header-search input[type="search"]:focus { background: #fff; border-color: var(--md-accent); }
.md-header-search button {
  position: absolute; right: 4px; top: 4px;
  width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--md-muted);
  cursor: pointer;
  line-height: 1;
}
.md-header-search button:hover { color: var(--md-accent); }

/* ---------- Hero ---------- */
.md-hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 88px;
  text-align: center;
  background: radial-gradient(900px 420px at 50% -10%, #e8f2ff 0%, rgba(232,242,255,0) 70%), #fff;
  border-bottom: 1px solid var(--md-border);
}
.md-hero::after {
  content: "";
  position: absolute; left: 50%; bottom: -90px;
  width: 720px; height: 180px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(0,113,227,.09), transparent 70%);
  pointer-events: none;
}
.md-hero-inner { position: relative; z-index: 1; }
.md-eyebrow {
  display: inline-block;
  padding: 5px 14px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--md-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
}
.md-hero h1 {
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.045em;
  margin-bottom: 16px;
}
.md-hero p {
  max-width: 620px;
  margin: 0 auto 30px;
  color: var(--md-muted);
  font-size: 17px;
}
.md-hero-search {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 7px;
  background: #fff;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  box-shadow: var(--md-shadow);
}
.md-hero-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 0 16px;
  font-size: 15px;
  background: transparent;
}
.md-hero-search button {
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  background: var(--md-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.md-hero-search button:hover { background: var(--md-accent-hover); color: #fff; }
.md-hero-stats {
  margin-top: 26px;
  display: flex; justify-content: center; gap: 36px;
  color: var(--md-muted);
  font-size: 13px;
}
.md-hero-stats strong { color: var(--md-text); font-size: 15px; }

/* ---------- Sections ---------- */
.md-section { padding: 56px 0 12px; }
.md-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.md-section-head h2 { font-size: 26px; margin: 0; }
.md-section-head p { margin: 4px 0 0; color: var(--md-muted); font-size: 14px; }
.md-section-more { font-size: 14px; font-weight: 500; white-space: nowrap; }

.md-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.md-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  background: #fff;
  color: var(--md-text);
  font-size: 13px;
  font-weight: 500;
  transition: all .18s;
}
.md-chip:hover { border-color: var(--md-accent); color: var(--md-accent); transform: translateY(-1px); }
.md-chip.active { background: var(--md-accent); border-color: var(--md-accent); color: #fff; }

/* ---------- Software cards ---------- */
.md-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.md-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  background: var(--md-surface);
  box-shadow: var(--md-shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  overflow: hidden;
}
.md-card:hover { transform: translateY(-4px); box-shadow: var(--md-shadow-hover); border-color: transparent; }
.md-card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.md-app-icon {
  width: 62px; height: 62px;
  flex: 0 0 62px;
  border-radius: 15px;
  object-fit: cover;
  background: linear-gradient(145deg, #f0f0f2, #e2e2e6);
  box-shadow: 0 3px 10px rgba(0,0,0,.08), inset 0 0 0 1px rgba(255,255,255,.7);
}
.md-app-icon-placeholder {
  width: 62px; height: 62px; flex: 0 0 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #4a4a4f, #1c1c1e);
  color: #fff; font-size: 24px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.md-card-title { font-size: 16px; margin: 1px 0 4px; }
.md-card-title a { color: var(--md-text); }
.md-card-title a:hover { color: var(--md-accent); }
.md-card-sub { color: var(--md-muted); font-size: 12px; line-height: 1.5; }
.md-card-excerpt {
  color: var(--md-muted);
  font-size: 13px;
  margin: 0 0 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}
.md-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.md-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: #f0f2f5;
  color: #55575c;
  font-size: 11px;
  line-height: 1.6;
}
.md-tag-accent { background: rgba(0,113,227,.09); color: var(--md-accent); }
.md-card-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--md-border);
}
.md-download-count { color: var(--md-muted); font-size: 12px; }
.md-card-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0,113,227,.09);
  color: var(--md-accent);
  font-size: 12px;
  font-weight: 600;
}
.md-card:hover .md-card-btn { background: var(--md-accent); color: #fff; }
.md-card .md-download-btn { padding: 7px 14px; font-size: 12px; border-radius: 999px; }
.md-badge-featured {
  position: absolute; top: 14px; right: 14px;
  padding: 3px 10px; border-radius: 999px;
  background: #ff9500; color: #fff; font-size: 10px; font-weight: 700;
}

/* ---------- Listing ---------- */
.md-page-head {
  padding: 46px 0 30px;
  background: #fff;
  border-bottom: 1px solid var(--md-border);
}
.md-page-head h1 { font-size: 32px; margin-bottom: 6px; }
.md-page-head p { color: var(--md-muted); margin: 0; }
.md-breadcrumb { font-size: 13px; color: var(--md-muted); margin-bottom: 14px; }
.md-breadcrumb a { color: var(--md-muted); }
.md-breadcrumb a:hover { color: var(--md-accent); }
.md-breadcrumb span { margin: 0 8px; opacity: .5; }
.md-listing { padding: 32px 0 60px; }
.md-pagination { margin-top: 40px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.md-pagination .page-numbers {
  min-width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--md-border); border-radius: 10px;
  background: #fff; color: var(--md-text); font-size: 13px;
}
.md-pagination .page-numbers.current { background: var(--md-accent); border-color: var(--md-accent); color: #fff; }
.md-pagination .page-numbers:hover { border-color: var(--md-accent); color: var(--md-accent); }
.md-empty {
  grid-column: 1 / -1;
  padding: 70px 20px; text-align: center;
  border: 1px dashed var(--md-border); border-radius: var(--md-radius);
  background: #fff; color: var(--md-muted);
}

/* ---------- Single ---------- */
.md-single { padding: 32px 0 70px; }
.md-single-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.md-single-hero {
  display: flex; gap: 22px; align-items: flex-start;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  margin-bottom: 24px;
}
.md-single-icon {
  width: 96px; height: 96px; flex: 0 0 96px;
  border-radius: 22px; object-fit: cover;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.md-single-icon-placeholder {
  width: 96px; height: 96px; flex: 0 0 96px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px;
  background: linear-gradient(145deg, #4a4a4f, #1c1c1e);
  color: #fff; font-size: 38px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.md-single-hero h1 { font-size: 28px; margin: 2px 0 6px; }
.md-single-desc { color: var(--md-muted); font-size: 14px; margin: 0 0 14px; }
.md-single-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.md-single-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.md-download-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px;
  border: 0; border-radius: 999px;
  background: var(--md-accent); color: #fff;
  font-size: 14px; font-weight: 650;
  cursor: pointer;
  transition: transform .16s, background .16s;
}
.md-download-btn:hover { background: var(--md-accent-hover); color: #fff; transform: translateY(-1px); }
.md-download-btn-secondary { background: #ececee; color: var(--md-text); }
.md-download-btn-secondary:hover { background: #e0e0e3; color: var(--md-text); }
.md-download-btn-lg { padding: 14px 34px; font-size: 15px; }
.md-copy-link {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 16px; border-radius: 999px;
  border: 1px solid var(--md-border); background: #fff;
  color: var(--md-text); font-size: 13px; cursor: pointer;
}
.md-copy-link:hover { border-color: var(--md-accent); color: var(--md-accent); }
.md-download-meta { color: var(--md-muted); font-size: 12px; margin-left: 4px; }

.md-panel {
  background: #fff;
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--md-shadow);
}
.md-panel h2 { font-size: 20px; margin-bottom: 16px; }
.md-panel h3 { font-size: 16px; }
.md-panel p:last-child { margin-bottom: 0; }
.md-panel img { border-radius: 12px; margin-bottom: 14px; }
.md-info-list { margin: 0; }
.md-info-list div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--md-border);
  font-size: 13px;
}
.md-info-list div:last-child { border-bottom: 0; }
.md-info-list dt { color: var(--md-muted); }
.md-info-list dd { margin: 0; font-weight: 550; text-align: right; }
.md-screenshots { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.md-screenshots a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--md-border); }
.md-screenshots img { width: 100%; border-radius: 0; margin: 0; transition: transform .3s; }
.md-screenshots a:hover img { transform: scale(1.03); }
.md-related-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.md-related-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--md-border); border-radius: 14px;
  background: #fff;
}
.md-related-item:hover { border-color: var(--md-accent); }
.md-related-item .md-app-icon, .md-related-item .md-app-icon-placeholder { width: 44px; height: 44px; flex-basis: 44px; border-radius: 11px; font-size: 17px; }
.md-related-item strong { display: block; font-size: 13px; color: var(--md-text); line-height: 1.4; }
.md-related-item span { color: var(--md-muted); font-size: 11px; }

.md-content { font-size: 15px; color: #2c2c2e; }
.md-content h2, .md-content h3 { margin-top: 30px; }
.md-content ul, .md-content ol { padding-left: 22px; }
.md-content li { margin-bottom: 6px; }
.md-content pre { background: #f2f2f5; padding: 16px; border-radius: 12px; overflow: auto; }
.md-content blockquote { margin: 20px 0; padding: 8px 18px; border-left: 3px solid var(--md-accent); background: #f7f9fc; color: var(--md-muted); }

/* ---------- Historical versions ---------- */
.md-version-list-front { display: flex; flex-direction: column; gap: 10px; }
.md-version-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--md-border); border-radius: 12px; background: #fff;
}
.md-version-item:hover { border-color: var(--md-accent); }
.md-version-main { min-width: 0; }
.md-version-main strong { display: block; font-size: 14px; }
.md-version-meta { display: block; color: var(--md-muted); font-size: 12px; margin-top: 2px; }
.md-version-notes { margin: 6px 0 0; color: var(--md-muted); font-size: 12px; }
.md-version-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.md-version-side .md-download-btn { padding: 7px 16px; font-size: 12px; }
@media (max-width: 520px) {
  .md-version-item { flex-direction: column; align-items: flex-start; }
  .md-version-side { align-items: flex-start; }
}

/* ---------- Generic page / comments ---------- */
.md-page { padding: 46px 0 70px; }
.md-page-main { background: #fff; border: 1px solid var(--md-border); border-radius: var(--md-radius); padding: 36px; box-shadow: var(--md-shadow); }
.md-comments { margin-top: 32px; }
.md-comments h2 { font-size: 20px; }
.md-comments textarea, .md-comments input[type="text"], .md-comments input[type="email"], .md-comments input[type="url"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--md-border); border-radius: 10px; background: #fff; outline: none;
}
.md-comments .submit { background: var(--md-accent); color: #fff; border: 0; border-radius: 999px; padding: 10px 24px; cursor: pointer; font-weight: 600; }

/* ---------- Footer ---------- */
.md-footer {
  margin-top: 40px;
  padding: 38px 0 30px;
  border-top: 1px solid var(--md-border);
  background: #fff;
  color: var(--md-muted);
  font-size: 13px;
}
.md-footer-inner { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.md-footer-nav { list-style: none; display: flex; gap: 18px; margin: 0; padding: 0; }
.md-footer-nav a { color: var(--md-muted); }
.md-footer-nav a:hover { color: var(--md-accent); }
.md-footer p { margin: 8px 0 0; }
.md-notice {
  margin-top: 20px; padding: 12px 16px; border-radius: 10px;
  background: #fff8e6; color: #8a5a00; font-size: 12px;
}

/* ---------- Toast ---------- */
.md-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  padding: 10px 20px; border-radius: 999px;
  background: rgba(29,29,31,.92); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.md-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .md-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .md-single-layout { grid-template-columns: minmax(0,1fr) 280px; }
}
@media (max-width: 780px) {
  .md-header-inner { gap: 14px; }
  .md-menu { gap: 14px; overflow-x: auto; }
  .md-header-search { width: 150px; }
  .md-hero { padding: 56px 0 64px; }
  .md-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .md-single-layout { grid-template-columns: 1fr; }
  .md-single-hero { flex-direction: column; }
  .md-section { padding-top: 40px; }
}
@media (max-width: 520px) {
  .md-container { width: min(calc(100% - 28px), var(--md-container)); }
  .md-header-search { display: none; }
  .md-grid { grid-template-columns: 1fr; }
  .md-hero-search { flex-direction: column; border-radius: 18px; }
  .md-hero-search button { width: 100%; }
  .md-hero-stats { gap: 18px; }
  .md-screenshots, .md-related-grid { grid-template-columns: 1fr; }
  .md-page-main { padding: 24px 20px; }
  .md-section-head { flex-direction: column; align-items: flex-start; }
}
