@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: 'Manrope', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
  --bg: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #2d2d2d;
  --muted: #6f6f6f;
  --muted-2: #a0a0a0;
  --line: #e5e5e5;
  --line-strong: #0a0a0a;
  --surface: #f5f5f5;
  --surface-2: #ececec;
  --invert-bg: #0a0a0a;
  --invert-ink: #ffffff;
  --danger: #b42318;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --header-h: 84px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --ink: #f5f5f5;
  --ink-soft: #d6d6d6;
  --muted: #9a9a9a;
  --muted-2: #666666;
  --line: #1f1f1f;
  --line-strong: #f5f5f5;
  --surface: #0c0c0c;
  --surface-2: #141414;
  --invert-bg: #f5f5f5;
  --invert-ink: #000000;
  --danger: #ff8f87;
  color-scheme: dark;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); font-size: 16px; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--muted-2); }
::-webkit-scrollbar-track { background: var(--bg); }

.page { position: relative; min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 32px; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }
.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; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); border: 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-dot { width: 6px; height: 6px; background: var(--ink); display: inline-block; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color .2s, color .2s;
}
.text-link:hover { border-color: currentColor; }
.text-link .icon { transition: transform .25s var(--ease); }
.text-link:hover .icon { transform: translate(2px, -2px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn .icon { transition: transform .3s var(--ease); }
.btn:hover .icon { transform: translateX(2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--bg); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: background-color .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--ink-soft);
}
.input, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background-color .2s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus { border-color: var(--ink); }
.hint { font-size: 11px; line-height: 1.6; color: var(--muted); }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { height: auto; min-height: 46px; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 12px; color: var(--ink-soft); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; width: 36px; height: 20px; border: 1px solid var(--line); background: var(--bg); flex-shrink: 0; transition: background .2s, border-color .2s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--muted); transition: transform .24s var(--ease), background .2s; }
.switch input:checked + .switch-track { background: var(--ink); border-color: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--bg); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- status ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.status::before { content: ''; width: 4px; height: 4px; background: currentColor; }
.status-ok { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.status-warn { border-color: var(--ink); color: var(--ink); }
.status-soon { border-color: var(--line); color: var(--muted); }
.status-muted { border-color: var(--line); color: var(--muted-2); }
.status-important { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.status-info, .status-notice, .status-warning { border-color: var(--line); color: var(--muted); }

/* ---------- custom select ---------- */
.ui-select { position: relative; }
.ui-select-native {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}
.js .ui-select-native { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.ui-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.ui-select-trigger:hover { border-color: var(--ink); }
.ui-select.is-open .ui-select-trigger { border-color: var(--ink); }
.ui-select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select-chevron { display: flex; color: var(--muted); transition: transform .24s var(--ease); }
.ui-select.is-open .ui-select-chevron { transform: rotate(180deg); }
.ui-select-trigger.is-placeholder .ui-select-value { color: var(--muted-2); }
.ui-select-pop {
  position: fixed;
  z-index: 1200;
  max-height: min(340px, 62vh);
  overflow: hidden;
  padding: 4px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .22s var(--ease);
}
.ui-select-pop.is-open { opacity: 1; transform: none; }
.ui-select-list { max-height: calc(min(340px, 62vh) - 10px); overflow-y: auto; overscroll-behavior: contain; }
.ui-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color .15s, color .15s;
}
.ui-select-option:hover, .ui-select-option.is-focus { background: var(--surface); color: var(--ink); }
.ui-select-option.is-selected { background: var(--ink); color: var(--bg); }
.ui-select-option.is-selected::after { content: '✓'; margin-left: auto; font-size: 11px; }
.ui-select-option[disabled] { opacity: .4; pointer-events: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); opacity: 0; transition: opacity .25s ease; }
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .82); }
.modal-panel {
  position: relative;
  width: min(840px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  opacity: 0;
  filter: blur(12px);
  transform: translateY(18px);
  transition: opacity .28s var(--ease), filter .45s var(--ease), transform .38s var(--ease);
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { opacity: 1; filter: blur(0); transform: none; }
.modal-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.modal-label { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.modal-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); color: var(--ink); transition: background-color .2s, color .2s, border-color .2s; }
.modal-close:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.modal-loading { display: flex; align-items: center; gap: 10px; padding: 48px 24px; color: var(--muted); font-size: 13px; }
.spinner { width: 14px; height: 14px; border: 1.5px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-media { aspect-ratio: 16 / 7; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-media { position: relative; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); color: var(--ink); flex-shrink: 0; }
.modal-icon .icon { width: 22px; height: 22px; }
.project-modal-placeholder { position: relative; }
.modal-content { padding: 26px; }
.modal-head { display: flex; align-items: flex-start; justify-content: flex-start; gap: 18px; }
.modal-head > div:last-child { flex: 1; min-width: 0; }
.modal-title { font-size: clamp(24px, 3vw, 38px); line-height: 1.08; letter-spacing: -.045em; font-weight: 700; }
.modal-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.modal-body { margin-top: 22px; font-size: 14px; line-height: 1.85; color: var(--ink-soft); }
.modal-body p { margin-bottom: .9em; }
.modal-body ul, .modal-body ol { margin: 0 0 .9em; padding-left: 1.2em; }
.modal-body ul { list-style: square; }
.modal-body ol { list-style: decimal; }
.modal-body li { margin: .35em 0; }
.modal-body h3, .modal-body h4 { margin: 1.4em 0 .5em; font-size: 1rem; color: var(--ink); }
.modal-body a { text-decoration: underline; text-underline-offset: 3px; }
.modal-body blockquote { margin: 1em 0; padding-left: 14px; border-left: 2px solid var(--ink); color: var(--muted); }
.modal-body code { font-family: var(--mono); font-size: .9em; background: var(--surface); padding: 2px 5px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal-foot.is-end { justify-content: flex-end; }
.modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.modal-tags span { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line); padding: 4px 7px; color: var(--muted); }

/* ---------- toast ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1300; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-size: 12.5px;
  animation: toast-in .3s var(--ease);
}
.toast.is-out { animation: toast-out .22s ease forwards; }
.toast .icon { margin-top: 1px; }
.toast-error { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; filter: blur(8px); transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: 24px; }
.pager-btn, .pager-num { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid transparent; font-size: 12px; color: var(--muted); }
.pager-num:hover, .pager-btn:hover { border-color: var(--line); color: var(--ink); }
.pager-num.is-active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.pager-btn.is-disabled { opacity: .3; pointer-events: none; }
.pager-gap { color: var(--muted-2); }

/* ---------- theme toggle ---------- */
.theme-toggle { position: relative; }
.theme-toggle .theme-sun, .theme-toggle .theme-moon { position: absolute; transition: transform .4s var(--ease), opacity .25s; }
.theme-toggle .theme-sun { transform: rotate(0) scale(1); opacity: 1; }
.theme-toggle .theme-moon { transform: rotate(-80deg) scale(.4); opacity: 0; }
[data-theme="dark"] .theme-toggle .theme-sun { transform: rotate(80deg) scale(.4); opacity: 0; }
[data-theme="dark"] .theme-toggle .theme-moon { transform: rotate(0) scale(1); opacity: 1; }

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt-expand::view-transition-new(root) { z-index: 2; animation: vt-expand .56s cubic-bezier(.4,0,.2,1) both; }
html.theme-vt-expand::view-transition-old(root) { z-index: 1; }
html.theme-vt-collapse::view-transition-old(root) { z-index: 3; animation: vt-collapse .56s cubic-bezier(.4,0,.2,1) both; }
html.theme-vt-collapse::view-transition-new(root) { z-index: 2; }
@keyframes vt-expand { from { clip-path: circle(0px at var(--vt-x) var(--vt-y)); } to { clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y)); } }
@keyframes vt-collapse { from { clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y)); } to { clip-path: circle(0px at var(--vt-x) var(--vt-y)); } }

/* ---------- reveal / blur ---------- */
[data-reveal] {
  opacity: 0;
  filter: blur(11px);
  transform: translate3d(0, 28px, 0) scale(.99);
  transition: opacity .85s var(--ease), filter .95s var(--ease), transform .95s var(--ease);
  transition-delay: var(--d, 0ms);
}
[data-reveal="fade"] { transform: none; }
[data-reveal="left"] { transform: translate3d(-24px, 12px, 0) scale(.99); }
[data-reveal="right"] { transform: translate3d(24px, 12px, 0) scale(.99); }
[data-reveal].in { opacity: 1; filter: blur(0); transform: none; }
.js-blur-img { opacity: 0; filter: blur(16px); transform: scale(1.02); transition: opacity .8s var(--ease), filter .9s var(--ease), transform .9s var(--ease); }
.js-blur-img.is-loaded { opacity: 1; filter: blur(0); transform: none; }

@media (max-width: 720px) {
  .container { padding: 0 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal-panel { max-height: 92vh; }
  .modal-content { padding: 20px; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-reveal], .js-blur-img { filter: none; opacity: 1; transform: none; }
}
