/*
Theme Name: SoftRepo
Theme URI: https://github.com/typecho/typecho
Description: A dark software repository theme for Typecho, focused on software listings, multi-version downloads, and mobile-first readability.
Version: 0.1.0
Author: Cursor
Author URI: https://github.com/typecho/typecho
License: GPL-2.0
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Typecho Compatible: 1.2+
*/

:root {
  --bg: #070b11;
  --bg-elevated: #0f1520;
  --bg-card: #121a27;
  --bg-card-2: #161f2e;
  --border: #243146;
  --text: #e9eef7;
  --muted: #93a0b4;
  --primary: #4ea1ff;
  --primary-strong: #2f7de1;
  --success: #27c48f;
  --warning: #f5b84b;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --max-width: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(78, 161, 255, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(39, 196, 143, 0.08), transparent 22%),
    var(--bg);
  color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(78, 161, 255, 0.28); }
.container { width: min(calc(100% - 32px), var(--max-width)); margin: 0 auto; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }
.site-header, .site-footer { border-color: var(--border); }
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(7, 11, 17, 0.82);
  border-bottom: 1px solid var(--border);
}
.header-inner, .footer-inner, .content-grid { display: grid; gap: 24px; }
.header-inner { grid-template-columns: auto auto 1fr auto; align-items: center; padding: 18px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; letter-spacing: .4px; }
.brand-mark {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7dc0ff); color: #fff; box-shadow: var(--shadow);
}
.brand-text { white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; color: var(--muted); }
.nav-link {
  padding: 10px 12px; border-radius: 12px; transition: .2s ease; border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.04); }
.nav-toggle { display: none; }
.search-form { display: flex; gap: 10px; justify-content: flex-end; }
.search-form input {
  min-width: 240px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); outline: none;
}
.search-form input:focus { border-color: rgba(78, 161, 255, .6); box-shadow: 0 0 0 3px rgba(78, 161, 255, .12); }
.button, button, input[type="submit"] {
  border: 1px solid transparent; border-radius: 12px; padding: 12px 16px;
  background: var(--primary); color: #fff; cursor: pointer; transition: .2s ease;
}
.button:hover, button:hover, input[type="submit"]:hover { background: var(--primary-strong); }
.page-hero { padding: 36px 0 12px; }
.page-hero--archive { padding-bottom: 18px; }
.page-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
  font-weight: 700;
}
.page-title { margin: 0 0 10px; font-size: clamp(1.6rem, 3vw, 2.6rem); }
.page-desc { margin: 0; color: var(--muted); max-width: 760px; }
.archive-stats { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.archive-count { color: var(--muted); font-size: .94rem; }
.empty-state { padding: 28px; display: grid; gap: 14px; }
.empty-state h2 { margin: 0; }
.empty-state p { margin: 0; color: var(--muted); }
.software-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 18px 0 40px; }
.software-card, .panel {
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 18%), var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.software-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.software-card:hover { transform: translateY(-4px); border-color: rgba(78, 161, 255, .35); box-shadow: 0 18px 48px rgba(0, 0, 0, .42); }
.software-card__cover { display: block; background: var(--bg-card-2); }
.software-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--bg-card-2); }
.software-card__placeholder {
  width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center;
  color: rgba(233, 238, 247, .42); font-size: 2rem; font-weight: 700; letter-spacing: 2px;
}
.software-card__body { padding: 18px; display: grid; gap: 12px; }
.software-card__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.software-card__title-row h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.software-card__title-row h2 a:hover { color: #fff; }
.software-card__excerpt { margin: 0; color: var(--muted); min-height: 3.4em; }
.software-card__meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .92rem; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: rgba(78, 161, 255, .12); color: #c9e0ff; border: 1px solid rgba(78, 161, 255, .18);
  font-size: .84rem;
}
.button--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.button--ghost:hover { background: rgba(255,255,255,.04); border-color: rgba(78, 161, 255, .25); }
.software-card__footer { margin-top: auto; padding: 0 18px 18px; display: flex; gap: 10px; }
.software-card__footer .button { flex: 1; text-align: center; }
.content-grid { grid-template-columns: minmax(0, 1fr) 320px; padding: 24px 0 40px; }
.article { padding: 24px; }
.article h1, .article h2, .article h3 { line-height: 1.25; }
.article h1 { margin-top: 0; }
.article p, .article li { color: #d3dbea; }
.article section + section { margin-top: 28px; }
.detail-hero { margin-bottom: 28px; }
.detail-hero__badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(78, 161, 255, .2); background: rgba(78, 161, 255, .1);
  color: #c9e0ff; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; color: var(--muted); }
.detail-meta__item {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
}
.detail-section { padding-top: 8px; }
.section-head { margin-bottom: 14px; }
.section-head h2 { margin-bottom: 6px; }
.section-head p { margin: 0; color: var(--muted); }
.detail-content { color: #d3dbea; line-height: 1.8; }
.detail-content--boxed {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
}
.detail-nav {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px;
}
.detail-nav a {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255,255,255,.02); color: var(--muted);
}
.detail-nav a:hover { color: var(--text); border-color: rgba(78, 161, 255, .35); }
.detail-nav.is-sticky {
  position: sticky; top: 74px; z-index: 20;
  padding: 12px; border: 1px solid var(--border); border-radius: 14px;
  background: rgba(7, 11, 17, .94); backdrop-filter: blur(18px);
}
.panel { padding: 20px; }
.detail-sidebar h3 { margin-top: 0; }
.detail-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.detail-list li {
  display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.detail-list li:last-child { border-bottom: 0; }
.detail-list span { color: var(--muted); }
.download-group { display: grid; gap: 14px; }
.download-version {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; background: rgba(255,255,255,.02); overflow: hidden;
}
.download-version summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; background: rgba(255,255,255,.03);
}
.download-version summary::-webkit-details-marker { display: none; }
.download-version summary strong { display: block; font-size: 1rem; }
.download-version summary span { color: var(--muted); font-size: .92rem; }
.download-version[open] summary { background: rgba(78, 161, 255, .08); }
.download-version[open] summary strong { color: #fff; }
.download-size { color: var(--text) !important; }
.download-version__body { padding: 18px; display: grid; gap: 14px; }
.download-links { display: flex; flex-wrap: wrap; gap: 10px; }
.download-links .button { min-width: 120px; }
.download-link { box-shadow: none; }
.download-link:hover { transform: translateY(-1px); }
.download-note { margin: 0; color: var(--muted); }
.download-code {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
}
.download-code code { color: #fff; }
.copy-code {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
}
.copy-code:hover { border-color: rgba(78, 161, 255, .32); }
.download-version--empty { padding: 16px; color: var(--muted); }
.footer-inner {
  padding: 28px 0 40px;
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--muted);
}
.footer-brand strong { display: block; color: var(--text); margin-bottom: 6px; }
.footer-brand p { margin: 0; }
.footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 999px;
  background: rgba(7, 11, 17, .9); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); opacity: 0; pointer-events: none; transform: translateY(12px) scale(.96);
  transition: opacity .2s ease, transform .2s ease, border-color .2s ease;
}
.back-to-top--visible { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.back-to-top:hover { border-color: rgba(78, 161, 255, .35); }
.back-to-top__icon {
  width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%;
  background: rgba(78, 161, 255, .12); color: #c9e0ff; font-weight: 700;
}
.back-to-top__text { font-size: .92rem; }
.pagination { display: flex; gap: 10px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card);
}
@media (max-width: 1100px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .software-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { grid-template-columns: 1fr; justify-items: stretch; }
  .brand { justify-content: flex-start; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg-elevated); color: var(--text);
  }
  .nav {
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 12px 0 4px;
  }
  .nav.nav--open { display: flex; }
  .search-form { width: 100%; }
  .search-form input { min-width: 0; flex: 1; }
  .software-grid { grid-template-columns: 1fr; }
  .software-card__title-row { flex-direction: column; }
  .software-card__excerpt { min-height: auto; }
  .software-card__footer { flex-direction: column; }
  .archive-stats { align-items: flex-start; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-meta { align-items: flex-start; }
  .site-shell { --theme-accent: var(--primary); }
  .button, input[type="submit"] { background: var(--theme-accent); }
  .button:hover, input[type="submit"]:hover { background: color-mix(in srgb, var(--theme-accent) 85%, #000); }
  .back-to-top {
    right: 16px; bottom: 16px; padding: 10px 12px;
  }
  .back-to-top__text { display: none; }
}
