/* ============================================================
   Search
   ============================================================ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: max(7vh, 50px);
}
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 9, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.14s ease-out;
}
.search-dialog {
  position: relative;
  width: min(690px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--panel-raised);
  border: 1px solid var(--line-mid);
  border-radius: 7px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
  overflow: hidden;
  animation: search-in 0.18s var(--ease-out);
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 13px 0 17px;
  height: 59px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
}
.search-input-row input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 15px;
}
.search-input-row input::placeholder {
  color: var(--faint);
}
.search-input-row kbd {
  font-size: 8px;
  padding: 3px 4px;
}
.search-filters {
  display: flex;
  gap: 3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.search-filters button {
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 5px 10px;
}
.search-filters button:hover {
  color: var(--fg);
  background: var(--bg-muted);
}
.search-filters button.is-active {
  color: var(--fg);
  background: var(--bg);
  border-color: var(--line);
  font-weight: 600;
}
.search-body {
  overflow-y: auto;
  min-height: 160px;
  padding: 9px;
  overscroll-behavior: contain;
}
.search-initial {
  padding: 12px 9px 18px;
}
.search-initial-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}
.search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-suggestions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: 3px;
  padding: 6px 9px;
  font-size: 11px;
}
.search-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}
.search-result {
  display: block;
  padding: 11px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.search-result:hover,
.search-result.is-selected {
  background: var(--bg-soft);
  border-color: var(--line);
}
.search-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 3px;
}
.search-result-title .search-scope {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 7.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  border: 1px solid var(--line);
  padding: 2px 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.search-result-title mark,
.search-result-snippet mark {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}
.search-result-snippet {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-path {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--faint);
}
.search-empty {
  padding: 38px 20px;
  text-align: center;
}
.search-empty svg {
  margin: 0 auto 10px;
  color: var(--faint);
}
.search-empty strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}
.search-empty p {
  color: var(--muted);
  font-size: 12px;
}
.search-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 38px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--faint);
  font-size: 9px;
}
.search-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.search-footer kbd {
  font-size: 8px;
  padding: 2px 3px;
}
.search-footer a {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}
.search-footer a:hover {
  color: var(--accent-strong);
}
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes search-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.99); }
}

/* ============================================================
   Reference
   ============================================================ */
.reference-page,
.blog-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter) 100px;
}
.reference-hero {
  padding: clamp(60px, 8vw, 100px) 0 clamp(45px, 6vw, 70px);
  border-bottom: 1px solid var(--line);
  max-width: 880px;
}
.reference-hero h1 {
  margin: 18px 0 20px;
  font-size: clamp(42px, 5.6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}
[lang="zh-Hans"] .reference-hero h1,
[lang="zh-Hant"] .reference-hero h1 {
  font-family: var(--font-sans);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.reference-hero > p {
  max-width: 700px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}
.reference-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 27px;
}
.reference-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  padding-top: 42px;
}
.reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.reference-card {
  padding: 22px 22px 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  transition: border-color 0.15s;
}
.reference-card:hover {
  border-color: var(--line-mid);
}
.reference-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-soft);
  color: var(--accent);
}
.reference-card h2 {
  font-size: 19px;
  margin-bottom: 8px;
}
.reference-card p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 15px;
}
.reference-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.reference-card li {
  border-bottom: 1px solid var(--line);
}
.reference-card li:last-child {
  border-bottom: 0;
}
.reference-card li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.reference-card li a:hover {
  color: var(--accent-strong);
}
.reference-aside {
  position: sticky;
  top: calc(var(--header-h) + var(--tabbar-h) + 26px);
  align-self: start;
}
.reference-aside-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 9px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.command-list {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.command-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.command-list a:last-child {
  border-bottom: 0;
}
.command-list a:hover {
  background: var(--bg-soft);
}
.command-list code {
  font-size: 9px;
  color: var(--fg-soft);
}
.command-list a:hover svg {
  color: var(--accent);
}
.reference-aside-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.reference-aside-note svg {
  flex-shrink: 0;
  color: var(--accent);
}

/* ============================================================
   Blog
   ============================================================ */
.blog-hero {
  padding: clamp(60px, 8vw, 96px) 0 40px;
  border-bottom: 1px solid var(--line);
}
.blog-hero h1 {
  font-size: clamp(48px, 6.4vw, 80px);
  margin: 15px 0 12px;
  letter-spacing: -0.055em;
}
[lang="zh-Hans"] .blog-hero h1,
[lang="zh-Hant"] .blog-hero h1 {
  font-family: var(--font-sans);
  letter-spacing: -0.045em;
}
.blog-hero p {
  color: var(--muted);
  font-size: 16px;
}
.blog-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 12px;
  padding: 32px 0;
}
.featured-post {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s;
}
.featured-post:hover {
  border-color: var(--accent);
}
.featured-post-visual {
  position: relative;
  min-height: 245px;
  background: #0b0a08;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.visual-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#2a2528 1px, transparent 1px), linear-gradient(90deg, #2a2528 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.6;
  mask-image: radial-gradient(circle at 50% 50%, #000, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000, transparent 80%);
}
.featured-post-visual img {
  position: relative;
  width: 135px;
  height: auto;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}
.visual-version {
  position: absolute;
  right: 18px;
  bottom: 16px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  border: 1px solid #3b3437;
  padding: 5px 7px;
}
.featured-post-content {
  padding: 24px 26px 26px;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 9.5px;
  color: var(--faint);
}
.post-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.post-category {
  color: var(--accent-strong);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.featured-post h2 {
  margin: 12px 0 11px;
  font-size: 31px;
  line-height: 1.08;
}
.featured-post p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}
.post-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 18px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent-strong);
}
.post-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.post-card {
  flex: 1;
  padding: 20px 21px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.post-card:hover {
  border-color: var(--accent);
  background: var(--accent-faint);
}
.post-card h3 {
  font-size: 19px;
  line-height: 1.2;
  margin: 10px 0 8px;
}
.post-card > p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.post-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
  color: var(--faint);
}
.post-tags {
  display: flex;
  gap: 5px;
}
.post-tags span {
  font-family: var(--font-mono);
  font-size: 8px;
  border: 1px solid var(--line);
  padding: 2px 5px;
  border-radius: 2px;
}
.blog-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 25px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
}
.blog-note h2 {
  font-size: 21px;
  margin-bottom: 7px;
}
.blog-note p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 660px;
}

/* ============================================================
   404
   ============================================================ */
.not-found {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 22px 100px;
  position: relative;
}
.not-found-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 12px;
}
.not-found-bun {
  width: 92px;
  opacity: 0.92;
  margin-bottom: 22px;
}
.not-found h1 {
  font-size: clamp(34px, 5vw, 52px);
  margin-bottom: 11px;
}
.not-found > p {
  color: var(--muted);
  font-size: 15px;
}
.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.not-found-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(400px, 100%);
  height: 42px;
  margin-top: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--faint);
  font-size: 12px;
}
.not-found-search kbd {
  margin-left: auto;
}

/* ============================================================
   Mobile panel
   ============================================================ */
.mobile-panel {
  position: fixed;
  inset: var(--header-h) 0 auto;
  z-index: 45;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.13);
  animation: slide-down 0.18s var(--ease-out);
}
.mobile-panel-inner {
  padding: 18px 22px 24px;
}
.mobile-panel nav {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.mobile-panel nav a {
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
}
.mobile-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-6px); }
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.hero-command-copy.is-copied {
  color: #50fa7b;
}

.mobile-panel:not([hidden]) {
  display: block;
}
