/* ============================================================
   betterkite.github.io — design system
   Dark-first, single-locale (zh-CN), no build step.
   ============================================================ */

:root {
  --bg: #0a0d14;
  --bg-raise: #10141f;
  --bg-card: #131826;
  --bg-card-hover: #171d2e;
  --line: rgba(148, 163, 196, 0.14);
  --line-strong: rgba(148, 163, 196, 0.28);
  --text: #e8ebf4;
  --text-mute: #9aa3b8;
  --text-faint: #6b7488;
  --accent: #7c8cff;
  --accent-2: #3fd0e0;
  --accent-soft: rgba(124, 140, 255, 0.12);
  --ok: #4ade80;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 40px rgba(2, 5, 12, 0.45);
  --font:
    "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(124, 140, 255, 0.09), transparent 60%),
    radial-gradient(900px 480px at -10% 30%, rgba(63, 208, 224, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: 0.01em;
  margin: 0 0 0.6rem;
}

a {
  color: var(--accent-2);
}

.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;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Header ─────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(10, 13, 20, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 16px rgba(124, 140, 255, 0.35);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.header-nav a {
  color: var(--text-mute);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.18s ease;
}

.header-nav a:hover {
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 38px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.nav-toggle-bar {
  height: 2px;
  border-radius: 2px;
  background: var(--text-mute);
}

/* ── Hero ───────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

.hero-kicker {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--accent-2);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.hero-desc {
  max-width: 56ch;
  color: var(--text-mute);
  font-size: 1.02rem;
  margin: 0 0 1.4rem;
}

.hero-desc strong {
  color: var(--text);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}

.chip {
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-mute);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.chip--accent {
  color: #cdd4ff;
  background: var(--accent-soft);
  border-color: rgba(124, 140, 255, 0.4);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem;
  border-radius: 11px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5f74f5);
  border: none;
  box-shadow: 0 6px 22px rgba(99, 116, 245, 0.35);
}

.btn--primary:hover {
  box-shadow: 0 8px 28px rgba(99, 116, 245, 0.5);
}

.btn--ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
  background: var(--bg-card);
}

.btn--lg {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

/* hero visual */

.hero-visual {
  position: relative;
  min-height: 300px;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}

.orb--one {
  width: 260px;
  height: 260px;
  top: -40px;
  right: -30px;
  background: rgba(124, 140, 255, 0.5);
}

.orb--two {
  width: 220px;
  height: 220px;
  bottom: -50px;
  left: -20px;
  background: rgba(63, 208, 224, 0.38);
}

.code-panel {
  position: relative;
  z-index: 1;
  margin-top: clamp(1rem, 3vw, 2.4rem);
  background: rgba(13, 17, 27, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.code-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.code-panel-head span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line-strong);
}

.code-panel-head span:nth-child(1) { background: #ff5f57; }
.code-panel-head span:nth-child(2) { background: #febc2e; }
.code-panel-head span:nth-child(3) { background: #28c840; }

.code-panel-head em {
  margin-left: auto;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.code-panel pre {
  margin: 0;
  padding: 1rem 1.1rem 1.2rem;
  overflow-x: auto;
}

.code-panel code {
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.85;
  color: var(--text);
}

.tok-cmt { color: var(--text-faint); }
.tok-key { color: var(--accent); }
.tok-ok { color: var(--ok); }
.tok-num { color: var(--accent-2); }

/* ── Stats ──────────────────────────────────────────────── */

.stats {
  padding: 2.2rem 0 0.4rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.05rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--text), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-mute);
}

/* ── Sections shared ────────────────────────────────────── */

section {
  scroll-margin-top: 84px;
}

.entries,
.work,
.stack,
.projects-page,
.writing-page {
  padding: clamp(3rem, 7vw, 4.6rem) 0 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.section-tag {
  display: inline-block;
  margin-bottom: 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--accent-2);
}

.section-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
}

.section-sub {
  margin: 0;
  color: var(--text-mute);
  font-size: 0.95rem;
  max-width: 46ch;
}

.noscript-note {
  color: var(--text-mute);
}

/* ── Entry cards ────────────────────────────────────────── */

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 1.5rem 1.3rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.entry-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: var(--bg-card-hover);
}

.entry-card:hover::before {
  opacity: 1;
}

.entry-kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.entry-card h3 {
  font-size: 1.2rem;
}

.entry-card p {
  margin: 0;
  color: var(--text-mute);
  font-size: 0.92rem;
}

.entry-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.entry-points span {
  padding: 0.18rem 0.6rem;
  font-size: 0.76rem;
  color: var(--text-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.entry-link {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-2);
}

/* ── Filters + project cards ────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-btn {
  padding: 0.34rem 0.85rem;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text-mute);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.filter-btn.is-active {
  color: #fff;
  background: var(--accent-soft);
  border-color: rgba(124, 140, 255, 0.45);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 140, 255, 0.42);
  background: var(--bg-card-hover);
}

.project-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 21 / 9;
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(124, 140, 255, 0.28), transparent 70%),
    radial-gradient(380px 160px at 90% 100%, rgba(63, 208, 224, 0.2), transparent 70%),
    #0d1220;
  border-bottom: 1px solid var(--line);
}

.project-cover-mark {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, #cdd4ff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.project-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.55rem;
  padding: 1.15rem 1.25rem 1.25rem;
}

.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.project-name {
  font-size: 1.12rem;
  font-weight: 700;
}

.status-pill {
  flex-shrink: 0;
  padding: 0.14rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill--active {
  color: #baf7d0;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.status-pill--wip {
  color: #ffe3ab;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.project-summary {
  margin: 0;
  color: var(--text-mute);
  font-size: 0.9rem;
  flex: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.tag {
  padding: 0.16rem 0.58rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-mute);
  background: rgba(148, 163, 196, 0.07);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.case-link {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
}

.case-link:hover {
  text-decoration: underline;
}

.ghost-link {
  color: var(--text-mute);
  text-decoration: none;
}

.ghost-link:hover {
  color: var(--text);
}

.grid-empty {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

/* ── Stack strip ────────────────────────────────────────── */

.stack-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stack-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.95rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stack-list strong {
  font-size: 0.96rem;
}

.stack-list span {
  font-size: 0.83rem;
  color: var(--text-mute);
}

/* ── Contact ────────────────────────────────────────────── */

.contact {
  margin-top: clamp(3rem, 7vw, 4.6rem);
  padding: clamp(3rem, 6vw, 4.2rem) 0;
  background:
    radial-gradient(700px 300px at 80% 20%, rgba(124, 140, 255, 0.12), transparent 65%),
    var(--bg-raise);
  border-block: 1px solid var(--line);
}

.contact-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
}

.contact-inner h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.contact-desc {
  margin: 0.4rem 0 0;
  color: var(--text-mute);
  max-width: 44ch;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.section-tag--light {
  color: var(--accent-2);
}

/* ── Footer ─────────────────────────────────────────────── */

.footer {
  padding: 1.6rem 0 2rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.footer-top {
  color: var(--text-mute);
  text-decoration: none;
}

.footer-top:hover {
  color: var(--text);
}

/* ── Project detail pages ───────────────────────────────── */

.detail-hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 2.4rem;
  border-bottom: 1px solid var(--line);
}

.detail-breadcrumb {
  margin: 0 0 1.2rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.detail-breadcrumb a {
  color: var(--text-mute);
  text-decoration: none;
}

.detail-breadcrumb a:hover {
  color: var(--text);
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.1rem 0 1.4rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.detail-body {
  padding: 2.6rem 0 3rem;
}

.detail-body section {
  margin-bottom: 2.6rem;
}

.detail-body h2 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.prose {
  color: var(--text-mute);
  font-size: 0.98rem;
}

.prose strong {
  color: var(--text);
}

.feature-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.feature-table th,
.feature-table td {
  text-align: left;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line);
  vertical-align: top;
}

.feature-table th {
  width: 200px;
  color: var(--text);
  background: var(--bg-card);
  white-space: nowrap;
}

.feature-table td {
  color: var(--text-mute);
}

.figure-frame {
  margin: 0;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.figure-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.figcap {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.decision-list {
  display: grid;
  gap: 0.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.decision-list li {
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.decision-list strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.decision-list p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-mute);
}

.cmd-box {
  display: block;
  padding: 0.9rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--accent-2);
  background: #0d1120;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
}

/* ── Writing page ───────────────────────────────────────── */

.writing-empty {
  padding: 2.2rem;
  text-align: center;
  color: var(--text-mute);
  background: var(--bg-card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.plan-list {
  display: grid;
  gap: 0.7rem;
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
}

.plan-list li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 0.93rem;
}

.plan-list .plan-status {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent-2);
}

/* ── 404 ────────────────────────────────────────────────── */

.notfound {
  min-height: 68vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.notfound h1 {
  font-size: clamp(3rem, 10vw, 5rem);
  margin-bottom: 0.4rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.notfound p {
  color: var(--text-mute);
  margin: 0 0 1.6rem;
}

/* ── Reveal on scroll ───────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 880px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 240px;
    order: 2;
  }

  .orb--one {
    right: 10%;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .header-nav {
    position: absolute;
    top: 100%;
    right: 1rem;
    left: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.6rem;
    background: var(--bg-raise);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
  }

  .header-nav.is-open {
    display: flex;
  }

  .header-nav a {
    padding: 0.55rem 0.8rem;
    border-radius: 9px;
  }

  .header-nav a:hover {
    background: var(--bg-card);
  }

  .contact-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
