/* ─────────────────────────────────────────────────────────
   星屑手帐 · shared components
   ───────────────────────────────────────────────────────── */

/* ══ Header ═══════════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-h);
  background: var(--c-paper);
  border-bottom: 1px solid transparent;
  transition:
    border-color var(--dur-mid) var(--ease-out),
    background-color var(--dur-mid) var(--ease-out);
}

.site-header.is-scrolled {
  border-bottom-color: var(--c-line);
  background: var(--c-paper);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-right: auto;
}

.brand__mark {
  width: 42px;
  height: 42px;
  transition: transform 600ms var(--ease-out);
}

.brand:hover .brand__mark {
  transform: rotate(14deg);
}

.brand__name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
}

.brand__latin {
  display: block;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.22em;
  color: var(--c-muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.6vw, 38px);
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  color: var(--c-ink-soft);
  transition: color var(--dur-fast) var(--ease-out);
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 1px;
  background: var(--c-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-mid) var(--ease-out);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--c-ink);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-guest-actions {
  display: flex;
  align-items: center;
}

.header-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--c-ink-soft);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.header-search:hover {
  background: var(--c-paper-deep);
  color: var(--c-ink);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--c-ink-soft);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.theme-toggle:hover {
  background: var(--c-paper-deep);
  color: var(--c-ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
}

.theme-toggle .icon {
  width: 19px;
  height: 19px;
}

.mobile-theme-row {
  display: none;
}

.mobile-theme-toggle {
  display: none;
}

.mobile-theme-row__label {
  color: var(--c-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

.theme-toggle__sun {
  display: none;
}

html[data-theme="light"] .theme-toggle__sun {
  display: inline;
}

html[data-theme="light"] .theme-toggle__moon {
  display: none;
}

/* 用户菜单 */
.user-menu {
  position: relative;
}

.user-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  color: var(--c-ink-soft);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.user-button:hover,
.user-button[aria-expanded="true"] {
  border-color: var(--c-line-strong);
  background: var(--c-paper-soft);
}

.user-button__name {
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: 208px;
  padding: 7px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-1);
  animation: dropdown-in 180ms var(--ease-out);
}

.user-dropdown__head {
  padding: 10px 11px 11px;
  border-bottom: 1px solid var(--c-line);
  margin-bottom: 4px;
}

.user-dropdown__name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.3;
}

.user-dropdown__role {
  display: block;
  margin-top: 3px;
  font-size: var(--text-2xs);
  letter-spacing: 0.12em;
  color: var(--c-muted);
  text-transform: uppercase;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-sm);
  text-align: left;
  color: var(--c-ink-soft);
}

.user-dropdown__item:hover {
  background: var(--c-paper-deep);
  color: var(--c-ink);
}

.message-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 3px;
  right: 2px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 2px solid var(--c-paper);
  border-radius: 99px;
  background: var(--c-accent);
  color: #fffaf2;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.user-dropdown__item .message-badge {
  position: static;
  margin-left: auto;
  border: 0;
}

.message-badge--dot {
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid var(--c-paper);
}

.message-badge[hidden] {
  display: none !important;
}

.user-dropdown__item--danger {
  color: var(--c-danger);
}

.user-dropdown__divider {
  height: 1px;
  margin: 4px 7px;
  background: var(--c-line);
}

.mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  background: transparent;
}

/* 移动菜单 */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 90;
  display: none;
  padding: 26px var(--gutter) 40px;
  background: var(--c-paper);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-menu.is-open {
  display: flex;
  flex-direction: column;
  animation: menu-in 240ms var(--ease-out);
}

.mobile-menu__nav {
  display: grid;
}

.mobile-menu__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 2px;
  border-bottom: 1px solid var(--c-line);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  line-height: 1.3;
}

.mobile-menu__link small {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  color: var(--c-muted);
  text-transform: uppercase;
}

.mobile-menu__footer {
  margin-top: auto;
  padding-top: 32px;
  display: grid;
  gap: 10px;
}

.mobile-menu__meta {
  padding-top: 18px;
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--c-muted);
  white-space: pre-line;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ══ Footer ═══════════════════════════════════════════════ */

/* ★ 页脚也尽量少固定样式：想换底色/字色可以直接改下面几项，
   也可以去 tokens.css 改全站颜色。 */
:root {
  --footer-bg: var(--c-paper-soft);
  --footer-border: var(--c-line);
  --footer-text: var(--c-ink);
  --footer-muted: var(--c-muted);
  --footer-gap: clamp(24px, 5vw, 64px);
}

.site-footer {
  position: relative;
  margin-top: clamp(56px, 8vw, 96px);
  border-top: 1px solid var(--footer-border);
  background: var(--footer-bg);
  color: var(--footer-text);
}

.footer-inner {
  padding-block: clamp(32px, 5vw, 52px) 22px;
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.45fr) minmax(120px, 0.45fr);
  gap: var(--footer-gap);
  align-items: start;
}

.footer-brand__name {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  line-height: 1.3;
  color: var(--footer-text);
}

.footer-brand__name:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.footer-brand__latin {
  margin-top: 4px;
  color: var(--footer-muted);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: 1.5;
  letter-spacing: 0.16em;
}

.footer-tagline {
  margin-top: 12px;
  max-width: 30em;
  color: var(--footer-muted);
  font-size: var(--text-sm);
  line-height: 1.8;
}

.footer-note {
  margin-top: 8px;
  max-width: 32em;
  color: var(--footer-muted);
  font-size: var(--text-xs);
  line-height: 1.8;
}

.footer-heading {
  margin-bottom: 10px;
  color: var(--footer-muted);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.08em;
}

.footer-links {
  display: grid;
  gap: 4px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  color: var(--footer-text);
  font-size: var(--text-sm);
  line-height: 1.5;
  opacity: 0.72;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--footer-border);
  color: var(--footer-muted);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.footer-admin,
.footer-icp {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--footer-muted);
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-admin:hover,
.footer-icp:hover {
  color: var(--footer-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .header-search,
  .header-guest-actions {
    display: none;
  }

  .footer-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .header-actions > .theme-toggle {
    display: none;
  }

  .mobile-menu__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-theme-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
  }

  .mobile-theme-toggle {
    display: inline-flex;
    width: 38px;
    height: 38px;
    border-color: var(--c-line);
    background: var(--c-surface);
  }

  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .brand__name {
    font-size: 1.175rem;
  }

  .brand__latin {
    font-size: 12px;
    letter-spacing: 0.16em;
  }

  .brand {
    gap: 9px;
  }

  .user-button__name {
    display: none;
  }

  .user-button {
    padding: 3px;
    border: 0;
  }

  .footer-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ══ Buttons / links ══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 11px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-align: center;
  transition:
    transform var(--dur-mid) var(--ease-out),
    background-color var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out),
    color var(--dur-mid) var(--ease-out),
    box-shadow var(--dur-mid) var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn--primary {
  background: var(--c-ink);
  color: var(--c-cream);
  box-shadow: 0 2px 0 rgba(29, 27, 44, 0.14);
}

.btn--primary:hover {
  background: var(--c-night-3);
  box-shadow: 0 8px 22px rgba(29, 27, 44, 0.16);
}

.btn--accent {
  background: var(--c-accent);
  color: #fff9f1;
}

.btn--accent:hover {
  background: var(--c-accent-deep);
}

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

.btn--ghost:hover {
  border-color: var(--c-ink);
  background: var(--c-paper-soft);
}

.btn--text {
  min-height: 44px;
  padding-inline: 2px;
  border-radius: 0;
  color: var(--c-ink);
  font-weight: 500;
}

.btn--text::after {
  content: "";
  width: 100%;
  height: 1px;
  position: absolute;
  left: 0;
  bottom: 7px;
  background: var(--c-ink);
  transform: scaleX(0.35);
  transform-origin: left;
  transition: transform var(--dur-mid) var(--ease-out);
}

.btn--text {
  position: relative;
  border-bottom-color: transparent;
}

.btn--text:hover {
  transform: none;
}

.btn--text:hover::after {
  transform: scaleX(1);
}

.btn--sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: var(--text-xs);
}

.btn--lg {
  min-height: 54px;
  padding: 14px 30px;
  font-size: var(--text-base);
}

.btn--icon {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn--block {
  width: 100%;
}

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading > * {
  opacity: 0.65;
}

.btn.is-loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-ink);
  border-bottom: 1px solid var(--c-line-strong);
  transition:
    gap var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out);
}

.link-arrow:hover {
  gap: 14px;
  border-color: var(--c-ink);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ══ Forms ════════════════════════════════════════════════ */

.field {
  display: grid;
  gap: 8px;
}

.field__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-ink);
}

.field__label .required {
  margin-left: 3px;
  color: var(--c-accent);
}

.field__hint {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--c-muted);
}

.field__error {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--c-danger);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--text-sm);
  line-height: 1.6;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--c-faint);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--c-line-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--c-ink);
  box-shadow: 0 0 0 3px rgba(49, 93, 138, 0.13);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(173, 55, 47, 0.09);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: var(--c-paper-deep);
  color: var(--c-muted);
  cursor: not-allowed;
}

.textarea {
  min-height: 132px;
  resize: vertical;
}

.textarea--sm {
  min-height: 84px;
}

.select {
  appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%),
    linear-gradient(135deg, var(--c-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 48px;
}

.input-wrap__action {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--c-muted);
}

.input-wrap__action:hover {
  color: var(--c-ink);
  background: var(--c-paper-deep);
}

.checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--c-ink-soft);
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--c-ink);
  flex: 0 0 auto;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(173, 55, 47, 0.25);
  border-radius: var(--radius-sm);
  background: var(--c-danger-soft);
  color: var(--c-danger);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.form-error .icon {
  margin-top: 2px;
}

/* ══ Small bits ═══════════════════════════════════════════ */

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-xs);
  background: var(--c-paper-soft);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  color: var(--c-ink-soft);
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.chip:hover {
  border-color: var(--c-ink);
  background: var(--c-paper-soft);
}

.chip.is-active {
  border-color: var(--c-ink);
  background: var(--c-ink);
  color: var(--c-cream);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--c-paper-deep);
  font-size: var(--text-2xs);
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--c-ink-soft);
  white-space: nowrap;
}

.badge--accent {
  background: var(--c-accent-soft);
  color: var(--c-accent-deep);
}

.badge--success {
  background: var(--c-success-soft);
  color: var(--c-success);
}

.badge--warning {
  background: var(--c-warning-soft);
  color: var(--c-warning);
}

.badge--muted {
  background: var(--c-paper-deep);
  color: var(--c-muted);
}

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  background: var(--c-night-2);
  color: var(--c-cream);
  object-fit: cover;
  overflow: hidden;
}

.avatar--sm {
  width: 30px;
  height: 30px;
}

.avatar--lg {
  width: 64px;
  height: 64px;
}

.avatar--xl {
  width: 96px;
  height: 96px;
}

.avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1;
  background: var(--c-night-2);
  color: var(--c-cream);
}

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--c-muted);
}

.meta__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta__item .icon {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.meta__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--c-line-strong);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-success);
}

.status-dot--pending {
  background: var(--c-warning);
}

/* ══ Note cards ═══════════════════════════════════════════ */

.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.note-card__cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
  background: var(--c-paper-deep);
}

.note-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}

.note-card:hover .note-card__cover img {
  transform: scale(1.035);
}

.note-card__cover--empty {
  background:
    radial-gradient(circle at 70% 28%, rgba(216, 179, 106, 0.45) 0 2px, transparent 3px),
    linear-gradient(145deg, var(--c-night-2), var(--c-night));
}

.note-card__cover--empty::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  background: var(--c-cream);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  opacity: 0.4;
}

.note-card__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 242, 0.16);
  pointer-events: none;
}

.note-card__index {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: rgba(245, 240, 230, 0.92);
  color: var(--c-ink);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
}

.note-card__body {
  padding: 20px 2px 0;
}

.note-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: var(--text-xs);
  color: var(--c-muted);
}

.note-card__category {
  color: var(--c-accent-deep);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.note-card__meta .meta__dot {
  flex: 0 0 auto;
}

.note-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.875rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.note-card__title a {
  display: inline;
  background-image: linear-gradient(var(--c-accent), var(--c-accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 400ms var(--ease-out);
}

.note-card:hover .note-card__title a {
  background-size: 100% 1px;
}

.note-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 9px;
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--c-muted);
}

.note-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: var(--text-xs);
  color: var(--c-muted);
}

.note-card__foot .icon {
  width: 14px;
  height: 14px;
}

.note-card__read {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 5vw, 64px);
}

@media (max-width: 700px) {
  .note-grid {
    grid-template-columns: 1fr;
  }
}

/* ══ Page heading ═════════════════════════════════════════ */

.page-hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 5vw, 58px);
  border-bottom: 1px solid var(--c-line);
}

.page-hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-6);
}

.page-hero__title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.5vw, 6.25rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: 0.01em;
}

.page-hero__title em {
  font-style: normal;
  color: var(--c-accent);
}

.page-hero__aside {
  max-width: 300px;
  padding-bottom: 10px;
  font-size: var(--text-sm);
  line-height: 1.9;
  color: var(--c-muted);
  text-align: right;
}

.page-hero__aside strong {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--c-ink);
}

@media (max-width: 760px) {
  .page-hero__row {
    display: block;
  }

  .page-hero__aside {
    margin-top: 18px;
    padding-bottom: 0;
    text-align: left;
  }
}

/* ══ Prose / content blocks ═══════════════════════════════ */

.prose {
  font-size: clamp(1rem, 1.15vw, 1.0625rem);
  line-height: 1.95;
  color: var(--c-ink-soft);
  overflow-wrap: anywhere;
}

.prose > * + * {
  margin-top: 1.35em;
}

.prose p {
  white-space: pre-line;
}

.prose h2,
.prose h3 {
  color: var(--c-ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.4;
  margin-top: 2.2em;
  margin-bottom: 0.9em;
  letter-spacing: 0.005em;
}

.prose h2 {
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
}

.prose h2::before {
  content: "";
  display: block;
  width: 30px;
  height: 2px;
  margin-bottom: 16px;
  background: var(--c-accent);
}

.prose h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

.prose blockquote {
  margin: 2.1em 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--c-accent);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.8;
  color: var(--c-ink);
  white-space: pre-line;
}

.prose blockquote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--c-muted);
}

.prose figure {
  margin: 2.4em 0;
}

.prose figure img,
.prose figure video {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-line);
  background: var(--c-night);
}

.prose figure video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.prose figcaption {
  margin-top: 12px;
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--c-muted);
  text-align: center;
}

.prose pre {
  overflow-x: auto;
  margin: 2.2em 0;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--c-night);
  color: var(--c-cream);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  tab-size: 2;
}

.prose pre code {
  font-family: inherit;
}

.prose hr {
  width: 100%;
  margin: 3em 0;
  border: 0;
  border-top: 1px solid var(--c-line);
}

.prose__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2.6em 0;
  color: var(--c-accent);
}

.prose__divider::before,
.prose__divider::after {
  content: "";
  width: 56px;
  height: 1px;
  background: var(--c-line);
}

.prose__divider .icon {
  width: 16px;
  height: 16px;
}

.prose a {
  color: var(--c-accent-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ══ Feedback ═════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
  background: var(--c-paper-soft);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--c-ink-soft);
}

.alert .icon {
  margin-top: 2px;
  flex: 0 0 auto;
}

.alert--success {
  border-color: rgba(60, 114, 87, 0.24);
  background: var(--c-success-soft);
  color: var(--c-success);
}

.alert--warning {
  border-color: rgba(145, 97, 29, 0.24);
  background: var(--c-warning-soft);
  color: var(--c-warning);
}

.alert--danger {
  border-color: rgba(173, 55, 47, 0.24);
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 36px 24px;
  border: 1px dashed var(--c-line-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--c-muted);
}

.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  color: var(--c-accent);
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.4;
  color: var(--c-ink);
}

.empty-state p {
  max-width: 32em;
  margin-top: 7px;
  font-size: var(--text-sm);
  line-height: 1.8;
}

.empty-state .btn {
  margin-top: 20px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--c-paper-deep);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 250, 242, 0.55), transparent);
  animation: shimmer 1.35s infinite;
}

.skeleton--text {
  height: 14px;
}

.skeleton--title {
  height: 26px;
}

.skeleton--block {
  height: 100%;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ══ Toast ════════════════════════════════════════════════ */

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10050;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid rgba(245, 239, 227, 0.15);
  border-radius: var(--radius-md);
  background: var(--c-ink);
  color: var(--c-cream);
  font-size: var(--text-sm);
  line-height: 1.65;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toast-in 260ms var(--ease-out);
}

.toast--error {
  background: var(--c-danger);
}

.toast--success {
  background: var(--c-success);
}

.toast__icon {
  margin-top: 2px;
  flex: 0 0 auto;
}

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -5px -4px 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.7;
}

.toast__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.toast.is-leaving {
  animation: toast-out 200ms var(--ease-out) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ══ Dialog ═══════════════════════════════════════════════ */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 22, 43, 0.58);
  backdrop-filter: blur(3px);
  animation: fade-in 180ms var(--ease-out);
}

.dialog {
  width: min(460px, 100%);
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: var(--shadow-2);
  animation: dialog-in 240ms var(--ease-out);
}

.dialog__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.35;
}

.dialog__body {
  margin-top: 12px;
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--c-muted);
  white-space: pre-line;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.dialog__actions .btn {
  min-width: 92px;
}

.btn--danger {
  background: var(--c-danger);
  color: #fff8f2;
}

.btn--danger:hover {
  background: #922a24;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

/* ══ 常用页面工具 ════════════════════════════════════════ */

.stack {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
}

.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }

.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-7 { margin-top: var(--sp-7); }

.rule {
  height: 1px;
  border: 0;
  background: var(--c-line);
}

.text-accent { color: var(--c-accent-deep); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: clamp(28px, 4vw, 48px);
}

.section-head__title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  font-weight: 400;
  line-height: 1.15;
}

.section-head__title em {
  font-style: normal;
  color: var(--c-accent);
}

.section-head__side {
  flex: 0 0 auto;
  padding-bottom: 7px;
}

@media (max-width: 640px) {
  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .section-head__side {
    padding-bottom: 0;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }
}

/* 320–380px 窄屏：让品牌和菜单按钮真正放得下 */
@media (max-width: 380px) {
  .header-inner {
    gap: 8px;
  }

  .brand {
    min-width: 0;
    gap: 9px;
  }

  .brand__name {
    font-size: 1.12rem;
    letter-spacing: 0.035em;
    white-space: nowrap;
  }

  .brand__latin {
    font-size: 12px;
    letter-spacing: 0.12em;
  }

  .header-actions {
    gap: 5px;
  }
}

/* ── PDF 附件块 ─────────────────────────────────────────── */
.prose-pdf {
  margin: 2.2em 0;
}

.prose-pdf__card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  color: var(--c-ink);
  text-decoration: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.prose-pdf__card:hover {
  border-color: var(--c-line-strong);
  background: var(--c-paper-soft);
}

.prose-pdf__card:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
}

.prose-pdf__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent-deep);
}

.prose-pdf__icon .icon {
  width: 20px;
  height: 20px;
}

.prose-pdf__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.prose-pdf__name {
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.4;
}

.prose-pdf__meta {
  color: var(--c-muted);
  font-size: var(--text-2xs);
  letter-spacing: 0.05em;
}

.prose-pdf__arrow {
  margin-left: auto;
  color: var(--c-muted);
  font-size: var(--text-lg);
}

.prose-pdf__caption {
  margin-top: 8px;
  color: var(--c-muted);
  font-size: var(--text-xs);
  text-align: center;
}
