:root {
  --paper: #ffffff;
  --paper-deep: #f4f4f2;
  --paper-lift: #fafaf9;
  --ink: #111111;
  --ink-2: #3c3c39;
  --muted: #85857e;
  --line: rgba(17, 17, 17, 0.1);
  --line-strong: rgba(17, 17, 17, 0.22);
  --accent: #b0452c;
  --accent-soft: rgba(176, 69, 44, 0.07);
  --danger: #b3261e;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Songti SC",
    "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
    Arial, sans-serif;
  --shadow: 0 44px 100px -56px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:has(dialog[open]) {
  overflow: hidden;
}

::selection {
  background: rgba(17, 17, 17, 0.12);
}

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

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------- 登录 ------------------------------- */

.login {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: hidden;
  background:
    radial-gradient(58% 46% at 72% 26%, #fbfbf9 0%, rgba(251, 251, 249, 0) 72%),
    var(--paper);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 25% 25%;
  mask-image: radial-gradient(62% 54% at 50% 46%, #000 0%, transparent 76%);
  opacity: 0.55;
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  text-align: center;
  animation: rise 1s var(--ease) both;
}

.login-title {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(66px, 13vw, 100px);
  line-height: 1;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}

.login-rule {
  width: 30px;
  height: 1px;
  margin: 34px auto 0;
  background: var(--line-strong);
}

#login-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 58px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.35s var(--ease);
}

#login-form:focus-within {
  border-color: var(--ink);
}

#password {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 2px;
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0.2em;
  color: var(--ink);
  outline: none;
}

#password::placeholder {
  letter-spacing: 0.1em;
  color: #a6a69f;
}

.login-submit {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.login-submit:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.login-submit:active {
  transform: scale(0.94);
}

.login-error {
  min-height: 22px;
  margin: 16px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.login-error.shake {
  animation: shake 0.45s var(--ease);
}

.login-foot {
  margin: 58px 0 0;
  font-size: 9px;
  letter-spacing: 0.4em;
  color: var(--muted);
}

/* ------------------------------- 页头 ------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  animation: fade-down 0.7s var(--ease) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.22em;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #9a9a93;
  cursor: pointer;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease),
    background 0.25s var(--ease);
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-lift);
}

/* ------------------------------- 按钮 ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.16em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.28s var(--ease), color 0.28s var(--ease),
    border-color 0.28s var(--ease), transform 0.28s var(--ease);
}

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

.btn-solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn-solid:hover {
  background: #333330;
  border-color: #333330;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8f1d17;
  border-color: #8f1d17;
}

.btn-compact {
  padding: 10px 18px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ------------------------------- 主内容 ------------------------------- */

.page {
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(52px, 9vh, 88px) 0 clamp(30px, 4vh, 44px);
  border-bottom: 1px solid var(--line);
  animation: rise 0.8s var(--ease) 0.05s both;
}

.hero-stat {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.hero-count {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 92px);
  line-height: 0.82;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums tabular-nums;
}

.hero-unit {
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--muted);
}

.hero-meta {
  margin: 0 0 9px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------- 时间线 ------------------------------- */

.timeline {
  position: relative;
  padding: 36px 0 64px 34px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 44px;
  bottom: 64px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0,
    var(--line-strong) 3%,
    var(--line-strong) 94%,
    transparent 100%
  );
}

.year-block {
  margin-bottom: 4px;
}

.year-head {
  display: flex;
  align-items: baseline;
  gap: 15px;
  margin: 14px 0 38px;
}

.year-head:first-child {
  margin-top: 0;
}

.year-num {
  font-family: var(--serif);
  font-size: clamp(38px, 5.4vw, 52px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.year-label {
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--muted);
}

.entry {
  position: relative;
  padding-bottom: clamp(48px, 6.5vh, 68px);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.entry.in {
  opacity: 1;
  transform: none;
}

.entry::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 7px;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

.entry:hover::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.entry-head {
  position: relative;
  padding-right: 84px;
}

.entry-date {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.entry-date::before {
  content: "";
  width: 13px;
  height: 1px;
  background: var(--line-strong);
}

.entry-title {
  margin: 9px 0 0;
  font-family: var(--serif);
  font-size: clamp(23px, 2.8vw, 29px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.015em;
  word-break: break-word;
}

.entry-content {
  max-width: 60ch;
  margin: 14px 0 0;
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.entry-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  max-width: 720px;
  margin-top: 22px;
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--paper-deep);
  overflow: hidden;
  cursor: zoom-in;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), filter 0.4s var(--ease);
}

.thumb:hover img {
  transform: scale(1.04);
  filter: brightness(1.02);
}

.entry-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.entry:hover .entry-actions,
.entry:focus-within .entry-actions {
  opacity: 1;
  transform: none;
}

.mini-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #a3a39c;
  cursor: pointer;
  transition: color 0.25s var(--ease), background 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.mini-btn:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-lift);
}

.mini-btn.danger:hover {
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.24);
  background: rgba(179, 38, 30, 0.04);
}

/* ------------------------------- 空状态 ------------------------------- */

.empty {
  padding: 84px 0 108px;
  text-align: center;
  animation: rise 0.8s var(--ease) both;
}

.empty-title {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.site-footer {
  display: flex;
  justify-content: flex-end;
  padding: 26px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--muted);
}

/* ------------------------------- 弹窗 ------------------------------- */

dialog.sheet,
dialog.confirm {
  width: min(660px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(17, 17, 17, 0.06);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}

dialog.confirm {
  width: min(420px, calc(100vw - 32px));
}

dialog::backdrop {
  background: rgba(17, 17, 17, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

dialog[open] {
  animation: sheet-in 0.42s var(--ease) both;
}

.sheet-inner {
  max-height: min(88vh, 900px);
  padding: clamp(26px, 4.5vw, 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-head {
  margin-bottom: 32px;
}

.sheet-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.sheet-divider {
  height: 1px;
  margin: 6px 0 26px;
  background: var(--line);
}

.field {
  margin-bottom: 24px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  outline: none;
  transition: border-color 0.3s var(--ease);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #b0b0a8;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.9;
}

.field input[type="date"] {
  font-family: var(--serif);
  letter-spacing: 0.08em;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.4;
  cursor: pointer;
}

.hint {
  margin: 8px 0 0;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.hint.ok {
  color: #5a7357;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 24px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease),
    background 0.3s var(--ease);
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.drag {
  border-color: var(--ink);
  background: var(--paper-lift);
  color: var(--ink);
  outline: none;
}

.dropzone svg {
  opacity: 0.55;
}

.dropzone-hint {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.previews:empty {
  display: none;
}

.preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--paper-deep);
  overflow: hidden;
}

.preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview .bar-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: rgba(17, 17, 17, 0.12);
}

.preview .bar {
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.2s linear;
}

.preview .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.58);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}

.preview:hover .remove,
.preview:focus-within .remove {
  opacity: 1;
}

.preview .remove:hover {
  background: var(--danger);
}

.preview .badge-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  background: rgba(17, 17, 17, 0.66);
  color: #fff;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.upload-note {
  margin: 10px 0 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.confirm-inner {
  padding: clamp(26px, 4.5vw, 36px);
}

.confirm-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.confirm-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--muted);
}

/* ------------------------------- 灯箱 / 提示 ------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(12, 12, 12, 0.95);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.lightbox.open {
  opacity: 1;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
  transform: scale(0.985);
  transition: transform 0.4s var(--ease);
}

.lightbox.open img {
  transform: scale(1);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  z-index: 400;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  max-width: calc(100vw - 48px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
  z-index: 500;
}

/* ------------------------------- 动画 ------------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.987);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

/* ------------------------------- 响应式 ------------------------------- */

@media (max-width: 720px) {
  .site-header {
    padding: 14px 18px;
  }

  .brand-name {
    font-size: 18px;
    letter-spacing: 0.18em;
  }

  .btn-label {
    display: none;
  }

  .btn-compact {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
  }

  .hero {
    padding: 42px 0 26px;
  }

  .hero-count {
    font-size: 58px;
  }

  .hero-unit {
    font-size: 9px;
    letter-spacing: 0.24em;
  }

  .hero-meta {
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  .timeline {
    padding: 28px 0 48px 24px;
  }

  .timeline::before {
    left: 3px;
    top: 36px;
    bottom: 48px;
  }

  .entry::before {
    left: -24px;
  }

  .entry-head {
    padding-right: 0;
  }

  .entry-actions {
    position: static;
    margin-top: 9px;
    opacity: 1;
    transform: none;
  }

  .entry-images {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .year-head {
    margin-bottom: 30px;
  }

  .entry {
    padding-bottom: 44px;
  }

  .field {
    margin-bottom: 21px;
  }

  dialog.sheet,
  dialog.confirm {
    width: calc(100vw - 24px);
    max-height: 92vh;
  }

  .sheet-inner {
    max-height: 92vh;
  }

  .site-footer {
    padding-bottom: 28px;
  }

  .toast {
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

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