:root {
  --bg: #f6f4f1;
  --bg-accent: #f2f7ff;
  --surface: #ffffff;
  --line: #e5e0d9;
  --text: #1d1c1a;
  --muted: #6f6a64;
  --accent: #000000;
  --accent-pressed: #111111;
  --pill-bg: #ffffff;
  --pill-border: #ddd7d1;
  --pill-shadow: 0 4px 12px rgba(16, 24, 40, 0.06);
  --card-shadow: none;
  --card-radius: clamp(1px, 0.6vw, 5px);
  --nav-height: 44px;
  --container: 1200px;
  --card-scale: 0.72;
  --card-width: 280px;
  --card-gap: 12px;
  --font-sans: "Space Grotesk", "Noto Sans SC", sans-serif;
}

html {
  overflow-y: scroll;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: #ffffff;
  line-height: 1.5;
  overflow-x: clip;
}

body[data-page="projects"] {
  --font-sans: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  font-family: inherit;
}

.container {
  width: min(var(--container), 100% - 32px);
  margin: 0 auto;
}

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

.site-header {
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(229, 224, 217, 0.6);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.02);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.site-header.is-nav-dark {
  background: rgb(44, 44, 41);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--nav-height);
  gap: 24px;
}

.brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.brand-label {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.25;
  padding-block: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 220ms ease;
}

.site-header.is-nav-dark .brand-label {
  color: #f2f2f2;
}

.top-nav {
  display: flex;
  gap: 36px;
  align-items: center;
  min-height: var(--nav-height);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding: 8px 0;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--muted);
  transition: color 220ms ease;
}

.nav-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: background-color 220ms ease, transform 220ms ease;
}

.nav-btn.is-active {
  color: var(--accent);
}

.nav-btn.is-active::after {
  transform: scaleX(1);
}

.site-header.is-nav-dark .nav-btn {
  color: rgba(242, 242, 242, 0.78);
}

.site-header.is-nav-dark .nav-btn.is-active {
  color: #ffffff;
}

.site-header.is-nav-dark .nav-btn::after {
  background: #ffffff;
}

.lang-toggle {
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 220ms ease, border-color 220ms ease;
}

.site-header.is-nav-dark .lang-toggle {
  color: #f2f2f2;
  border-color: rgba(242, 242, 242, 0.62);
}

.filters {
  padding: 32px 0 52px;
}

.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-compact-row,
.filter-mobile-menu {
  width: 100%;
}

.filter-menu-toggle {
  display: none;
}

.filter-btn {
  border: none;
  background: var(--pill-bg);
  color: var(--muted);
  padding: 8px 34px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  transform: translateY(-1px);
}

.filter-btn.is-active {
  background: var(--accent);
  color: #ffffff;
}

.filter-btn.is-active:focus-visible,
.filter-btn.is-active:hover {
  background: var(--accent-pressed);
}

.projects {
  padding: 8px 0 64px;
}

.site-footer-copy {
  max-width: 900px;
  margin: 4px auto 56px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

.site-footer-copy.has-range-bg {
  position: relative;
  isolation: isolate;
  z-index: 0;
  margin-bottom: 0;
  padding-bottom: 56px;
}

.site-footer-copy.has-range-bg::before,
.site-footer-copy.has-range-bg::after {
  content: "";
  position: absolute;
  left: 50%;
  width: var(--footer-tail-fill-width, 100dvw);
  transform: translateX(-50%);
  background: var(--footer-tail-fill-color, transparent);
  pointer-events: none;
  z-index: -2;
}

.site-footer-copy.has-range-bg::before {
  top: 0;
  bottom: 0;
}

.site-footer-copy.has-range-bg::after {
  top: 100%;
  height: var(--footer-tail-fill-height, 0px);
}

.site-footer-copy.has-range-bg > * {
  position: relative;
  z-index: 1;
}

.site-footer-copy[hidden] {
  display: none !important;
}

.site-footer-copy p {
  margin: 0 0 8px;
}

.site-footer-copy .detail-columns-block {
  display: grid;
  grid-template-columns: repeat(var(--columns-count, 2), minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 20px);
  margin: 1rem 0;
}

.site-footer-copy .detail-columns-cell {
  min-height: calc(1.8em + clamp(24px, 3vw, 36px));
  padding: clamp(12px, 1.5vw, 18px);
  border-radius: 12px;
  background: var(--columns-bg, transparent);
}

.site-footer-copy .detail-columns-cell > :first-child {
  margin-top: 0 !important;
}

.site-footer-copy .detail-columns-cell > :last-child {
  margin-bottom: 0 !important;
}

.site-footer-copy a {
  color: #1d4ed8;
  text-decoration: underline;
}

.page-line-anchor {
  display: block;
  height: 0;
  margin: 0;
  scroll-margin-top: calc(var(--nav-height) + 16px);
  pointer-events: none;
  visibility: hidden;
}

.page-range-host {
  position: relative;
  isolation: isolate;
}

.page-range-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.page-range-block {
  position: absolute;
  left: 50%;
  width: 100vw;
  width: 100dvw;
  transform: translateX(-50%);
  background: var(--line-bg-color, transparent);
}

.page-range-host > :not(.page-range-layer) {
  position: relative;
  z-index: 1;
}

.page-line-background {
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.page-line-background::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  width: 100dvw;
  height: 100%;
  transform: translateX(-50%);
  background: var(--line-bg-color, transparent);
  pointer-events: none;
  z-index: -1;
}

.site-footer-copy.has-range-bg .page-line-background::before {
  width: var(--footer-tail-fill-width, 100dvw);
}

.masonry {
  position: relative;
  width: 100%;
}

.card {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: var(--card-width);
  margin: 0;
  background: var(--surface);
  border: 0.5px solid #efefef;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  opacity: 0;
  transform: translateY(12px);
  animation: cardIn 480ms ease forwards;
  will-change: transform, opacity;
}

.card-media {
  background: #f0ede8;
}

.card-body {
  padding: 16px 18px 18px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 0.96rem;
  font-weight: 600;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta-dot {
  font-size: 1.1rem;
  line-height: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f4f1ed;
  color: #5b5751;
  font-size: 0.75rem;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 48px 0 64px;
  font-size: 1rem;
}

.local-open-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 16, 22, 0.5);
  backdrop-filter: blur(2px);
}

.local-open-modal[hidden] {
  display: none !important;
}

.local-open-dialog {
  width: min(560px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.local-open-dialog h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.local-open-intro {
  margin: 0;
  color: var(--muted);
}

.local-open-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.local-open-actions .editor-primary,
.local-open-actions .editor-secondary {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.local-open-actions .editor-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.local-open-actions .editor-secondary {
  background: #ffffff;
  color: var(--text);
}

.local-open-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.local-open-status[data-tone="error"] {
  color: #a02626;
}

.local-open-status[data-tone="success"] {
  color: #1a7f37;
}

.local-open-help {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.local-open-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.local-open-help-body {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.local-open-help-body p {
  margin: 0 0 6px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1000px) {
  :root {
    --card-width: 240px;
    --card-gap: 10px;
  }

  .top-nav {
    gap: 24px;
  }
}

@media (max-width: 720px) {
  :root {
    --nav-height: 44px;
    --card-scale: 1;
    --card-width: 200px;
    --card-gap: 9px;
  }

  .header-inner {
    align-items: center;
    min-height: var(--nav-height);
    padding-bottom: 0;
  }

  .brand {
    align-items: center;
  }

  .top-nav {
    align-self: stretch;
  }

  .nav-btn {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.25;
  }

  .nav-btn::after {
    bottom: 0;
  }

  .brand-label {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.02em;
    padding: 8px 0;
  }

  .filter-buttons {
    display: block;
  }

  .filter-compact-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .filter-compact-row .filter-btn {
    padding-left: 28px;
    padding-right: 28px;
  }

  .filter-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--pill-border);
    background: #ffffff;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
  }

  .filter-menu-toggle:hover,
  .filter-menu-toggle:focus-visible {
    transform: translateY(-1px);
  }

  .filter-menu-toggle.is-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
  }

  .filter-mobile-menu {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .filter-btn {
    padding: 7px 26px;
    font-size: 0.88rem;
  }

  .site-footer-copy .detail-columns-block {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :root {
    --card-width: 170px;
    --card-gap: 8px;
  }

  .container {
    width: min(var(--container), 100% - 24px);
  }

  .top-nav {
    gap: 18px;
  }

  .card-meta {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 2px;
    column-gap: 8px;
  }

  .card-meta.is-stacked {
    flex-direction: column;
    align-items: flex-start;
    row-gap: 2px;
    column-gap: 0;
  }

  .card-meta > :first-child {
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-meta time {
    white-space: nowrap;
  }

  .card-meta.is-stacked .meta-dot {
    display: none;
  }

  .site-footer-copy {
    font-size: 0.88rem;
    line-height: 1.72;
  }

  .site-footer-copy.has-range-bg {
    padding-bottom: 44px;
  }
}

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

  .card {
    opacity: 1;
    transform: none;
  }
}
