/* ------------------------------------------------------------------
   册集 CEJI — base
   ------------------------------------------------------------------ */

:root {
  --paper: #f4efe5;
  --paper-raised: #fbf8f1;
  --paper-deep: #ebe3d4;
  --ink: #211e18;
  --ink-soft: #4e493f;
  --muted: #857c6d;
  --muted-light: #a89e8e;
  --line: rgba(33, 30, 24, 0.14);
  --line-soft: rgba(33, 30, 24, 0.08);
  --accent: #b4512e;
  --accent-deep: #8d3b1e;
  --accent-soft: #f0d9ca;
  --sage: #3f5747;
  --sage-deep: #26382c;
  --gold: #b08a56;
  --cream: #f6efe2;

  --sans: "Inter", "SF Pro SC", "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --container: 1240px;
  --gutter: 32px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow-sm: 0 2px 6px rgba(33, 30, 24, 0.05);
  --shadow-md: 0 18px 45px -24px rgba(33, 30, 24, 0.35);
  --shadow-lg: 0 40px 90px -40px rgba(33, 30, 24, 0.5);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-height: 78px;
}

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

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

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

body,
button,
input,
textarea,
select {
  font-family: var(--sans);
}

h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

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

button {
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

input, textarea, select {
  color: inherit;
  font: inherit;
}

::selection {
  background: var(--accent);
  color: var(--cream);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

.serif {
  font-family: var(--serif);
}

.mono {
  font-family: var(--mono);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Brand ------------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  color: var(--cream);
  display: grid;
  place-items: center;
  transition: transform 0.5s var(--ease);
}

.brand:hover .brand-mark {
  transform: rotate(-5deg) translateY(-1px);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-word {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  color: var(--ink);
}

.brand-latin {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-left: -2px;
  margin-top: 8px;
}

.section {
  position: relative;
  padding: 120px 0;
}

.section-head {
  max-width: 760px;
}

.section-head h2 {
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 650;
  margin-top: 18px;
}

.section-lead {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.85;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 248, 241, 0.6);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(180, 81, 46, 0.12);
}

/* Buttons ---------------------------------------------------------- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--cream);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 550;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.35s var(--ease), background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.35s var(--ease);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  transition: transform 0.35s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -14px rgba(33, 30, 24, 0.5);
}

.btn:hover svg {
  transform: translateX(3px);
}

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

.btn-primary {
  --btn-bg: var(--ink);
  --btn-fg: var(--cream);
}

.btn-primary:hover {
  --btn-bg: #0f0d0a;
}

.btn-secondary {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: var(--line);
}

.btn-secondary:hover {
  --btn-bg: var(--ink);
  --btn-fg: var(--cream);
  --btn-border: var(--ink);
}

.btn-quiet {
  --btn-bg: transparent;
  --btn-fg: var(--ink-soft);
}

.btn-quiet:hover {
  --btn-bg: rgba(33, 30, 24, 0.05);
  --btn-fg: var(--ink);
  box-shadow: none;
}

.btn-text {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  padding-left: 4px;
  padding-right: 4px;
}

.btn-text:hover {
  box-shadow: none;
}

.btn-cream {
  --btn-bg: var(--cream);
  --btn-fg: var(--ink);
}

.btn-cream:hover {
  --btn-bg: #fffaf0;
}

.btn-outline-cream {
  --btn-bg: transparent;
  --btn-fg: var(--cream);
  --btn-border: rgba(246, 239, 226, 0.35);
}

.btn-outline-cream:hover {
  --btn-bg: rgba(246, 239, 226, 0.1);
}

.btn-sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-lg {
  min-height: 52px;
  padding: 0 26px;
  font-size: 15px;
}

.btn-icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  margin-right: 2px;
}

.btn-icon-circle svg {
  width: 12px;
  height: 12px;
  margin-left: 2px;
}

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

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 550;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: gap 0.3s var(--ease), border-color 0.2s ease;
}

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

/* Grain ------------------------------------------------------------ */

.page-grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* Reveal ----------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* Art palettes ----------------------------------------------------- */

.art-palette-0 {
  background:
    radial-gradient(120% 100% at 82% 8%, rgba(229, 176, 112, 0.62), transparent 56%),
    radial-gradient(90% 80% at 8% 96%, rgba(36, 23, 16, 0.8), transparent 60%),
    linear-gradient(148deg, #7b4a2b 0%, #3c2418 58%, #1f1510 100%);
}

.art-palette-1 {
  background:
    radial-gradient(100% 90% at 80% 6%, rgba(210, 193, 153, 0.45), transparent 55%),
    radial-gradient(90% 80% at 10% 98%, rgba(11, 24, 17, 0.82), transparent 62%),
    linear-gradient(150deg, #526d59 0%, #2c4334 56%, #17271d 100%);
}

.art-palette-2 {
  background:
    radial-gradient(110% 100% at 82% 4%, rgba(164, 199, 219, 0.5), transparent 56%),
    radial-gradient(90% 80% at 10% 98%, rgba(9, 20, 29, 0.82), transparent 62%),
    linear-gradient(150deg, #47667e 0%, #263d50 56%, #14222d 100%);
}

.art-palette-3 {
  background:
    radial-gradient(110% 100% at 80% 4%, rgba(230, 166, 126, 0.55), transparent 56%),
    radial-gradient(90% 80% at 10% 98%, rgba(34, 18, 14, 0.82), transparent 62%),
    linear-gradient(150deg, #8c4a32 0%, #562b20 56%, #2c1712 100%);
}

.art-palette-4 {
  background:
    radial-gradient(110% 100% at 82% 4%, rgba(235, 218, 182, 0.55), transparent 56%),
    radial-gradient(90% 80% at 10% 98%, rgba(32, 26, 16, 0.82), transparent 62%),
    linear-gradient(150deg, #85724f 0%, #574834 56%, #2c2418 100%);
}

.art-palette-5 {
  background:
    radial-gradient(110% 100% at 80% 4%, rgba(205, 178, 218, 0.45), transparent 56%),
    radial-gradient(90% 80% at 10% 98%, rgba(22, 14, 27, 0.85), transparent 62%),
    linear-gradient(150deg, #5d4a6b 0%, #392b44 56%, #201725 100%);
}

.art-palette-0,
.art-palette-1,
.art-palette-2,
.art-palette-3,
.art-palette-4,
.art-palette-5 {
  position: relative;
  overflow: hidden;
}

.art-palette-0::after,
.art-palette-1::after,
.art-palette-2::after,
.art-palette-3::after,
.art-palette-4::after,
.art-palette-5::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  opacity: 0.3;
  pointer-events: none;
}

/* Shared UI ------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 550;
  color: var(--ink-soft);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.badge.is-live {
  color: #486a4c;
  border-color: rgba(72, 106, 76, 0.24);
  background: rgba(72, 106, 76, 0.07);
}

.badge.is-draft {
  color: #967046;
  border-color: rgba(150, 112, 70, 0.25);
  background: rgba(150, 112, 70, 0.06);
}

.badge.is-free {
  color: var(--accent);
  border-color: rgba(180, 81, 46, 0.25);
  background: rgba(180, 81, 46, 0.06);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-raised);
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
  background: rgba(33, 30, 24, 0.05);
  color: var(--ink);
  border-color: rgba(33, 30, 24, 0.24);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn.is-dark {
  border-color: rgba(246, 239, 226, 0.2);
  color: rgba(246, 239, 226, 0.72);
}

.icon-btn.is-dark:hover {
  background: rgba(246, 239, 226, 0.09);
  color: var(--cream);
  border-color: rgba(246, 239, 226, 0.38);
}

.btn-block {
  width: 100%;
}

.btn-danger {
  --btn-bg: #9b3b2c;
  --btn-fg: #fff6ee;
}

.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: var(--line);
}

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

.btn:disabled,
.btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

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

/* Forms ------------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field > label .optional {
  font-weight: 400;
  color: var(--muted-light);
  margin-left: 3px;
}

.input,
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(251, 248, 241, 0.7);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

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

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

.field input:focus,
.field textarea:focus,
.field select:focus,
.input:focus {
  border-color: rgba(33, 30, 24, 0.55);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(33, 30, 24, 0.055);
}

.field-hint {
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-error {
  display: none;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(155, 59, 44, 0.22);
  background: rgba(155, 59, 44, 0.06);
  color: #8d3528;
  font-size: 12px;
  line-height: 1.6;
}

.form-error.is-visible {
  display: block;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  margin: 2px 0 0;
  accent-color: var(--ink);
}

/* Modal ------------------------------------------------------------ */

body.has-modal {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 17, 13, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid rgba(33, 30, 24, 0.14);
  border-radius: 20px;
  box-shadow: 0 60px 120px -50px rgba(0, 0, 0, 0.65);
  transform: translateY(14px) scale(0.985);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.25s ease;
  overflow: hidden;
}

.modal-backdrop.is-open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal.is-wide {
  max-width: 720px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h3 {
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.modal-head p {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}

.modal-head .icon-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
}

.modal-head .icon-btn svg {
  width: 15px;
  height: 15px;
}

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--line-soft);
}

.modal-foot .modal-foot-note {
  margin-right: auto;
  font-size: 10.5px;
  color: var(--muted);
}

.modal-actions-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Toast ------------------------------------------------------------ */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(27, 24, 19, 0.94);
  color: var(--cream);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 16px 36px -18px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.3s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: #8d3528;
}

.toast.is-success::before {
  content: "✓";
  font-size: 10px;
  color: #b5d0b4;
}

/* Loading / empty -------------------------------------------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(33, 30, 24, 0.07);
}

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

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 54px 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(251, 248, 241, 0.4);
}

.empty-state-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(33, 30, 24, 0.05);
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.empty-state-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
}

.empty-state p {
  max-width: 360px;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}

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

/* Utilities -------------------------------------------------------- */

.hidden {
  display: none !important;
}

.nowrap {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 13px;
}

@media (max-width: 720px) {
  :root {
    --gutter: 20px;
    --nav-height: 68px;
  }
  .section {
    padding: 82px 0;
  }
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    max-height: 92dvh;
    border-radius: 20px 20px 14px 14px;
  }
  .modal-head {
    padding: 20px 20px 15px;
  }
  .modal-body {
    padding: 18px 20px;
  }
  .modal-foot {
    padding: 14px 20px 18px;
  }
}

