/* 古韵乐坊 — shared ink-and-paper styles */

:root {
  --paper: #f3ead7;
  --paper-light: #f8f1e2;
  --paper-2: #ebdfc6;
  --paper-3: #ddcdaa;
  --ink: #221e1a;
  --ink-2: #463f37;
  --ink-3: #776c5e;
  --ink-4: #a5987f;
  --line: rgba(34, 30, 26, 0.16);
  --line-strong: rgba(34, 30, 26, 0.32);
  --zhu: #b5362a;        /* 朱砂 vermilion */
  --zhu-deep: #8e271e;
  --zhu-wash: rgba(181, 54, 42, 0.1);
  --dai: #3e5b58;        /* 黛青 indigo-green */
  --gold: #a5824a;
  --font-xing: "Xingkai SC", "STXingkai", "华文行楷", "Kaiti SC", "STKaiti", "KaiTi", serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", serif;
  --font-song: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px -24px rgba(60, 40, 20, 0.45);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-song);
  font-size: 15px;
  line-height: 1.7;
  background-color: var(--paper);
  background-image:
    url("/assets/img/paper-grain.svg"),
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 251, 240, 0.75), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, rgba(140, 105, 60, 0.16), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-kai); font-weight: 400; letter-spacing: 0.06em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--zhu); outline-offset: 2px; }
::selection { background: rgba(181, 54, 42, 0.2); }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

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

/* ── scenery ── */
.landscape {
  position: fixed; left: 0; right: 0; bottom: 0; height: 52vh; z-index: 0;
  background: url("/assets/img/mountains.svg") center bottom / cover no-repeat;
  pointer-events: none;
}
.plum {
  position: fixed; top: -6px; right: -18px; z-index: 0;
  width: min(380px, 42vw); pointer-events: none;
  transform: scaleX(-1);
  opacity: 0.92;
}
.sun {
  position: fixed; z-index: 0; pointer-events: none;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 70, 52, 0.55) 0 55%, rgba(196, 70, 52, 0) 72%);
  filter: blur(1px);
}

/* ── seal 印章 ── */
.seal {
  --size: 64px;
  display: inline-flex; flex-wrap: wrap;
  writing-mode: vertical-rl;
  align-content: center; justify-content: center;
  width: var(--size); height: var(--size);
  padding: 6px;
  color: #f7e7d6;
  background: var(--zhu);
  border-radius: 6px;
  box-shadow: inset 0 0 0 3px var(--zhu), inset 0 0 0 5px rgba(247, 231, 214, 0.85);
  font-family: var(--font-kai);
  font-weight: 700;
  font-size: calc(var(--size) * 0.36);
  line-height: 1.05;
  letter-spacing: 0;
  filter: url(#seal-texture);
  transform: rotate(-4deg);
  user-select: none;
  flex-shrink: 0;
}
.seal--sm { --size: 40px; padding: 4px; font-size: 15px; box-shadow: inset 0 0 0 2px var(--zhu), inset 0 0 0 3.5px rgba(247, 231, 214, 0.85); }
.seal--one { font-size: calc(var(--size) * 0.6); }
.seal--white { /* 白文印: carved characters show paper */
  color: var(--zhu); background: transparent;
  box-shadow: inset 0 0 0 3px var(--zhu);
}

/* ── buttons ── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 40px; padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--font-kai);
  font-size: 16px;
  letter-spacing: 0.12em;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); background: rgba(255, 255, 255, 0.35); }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }

.btn--primary {
  color: #fbefe2;
  border-color: var(--zhu-deep);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08)),
    var(--zhu);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 20px -10px rgba(142, 39, 30, 0.8);
}
.btn--primary:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.1)), var(--zhu-deep); border-color: var(--zhu-deep); }
.btn--primary:disabled { opacity: 0.6; }

.btn--ink { color: var(--paper-light); background: var(--ink); border-color: var(--ink); }
.btn--ink:hover { background: var(--ink-2); }

.btn--sm { min-height: 32px; padding: 0 12px; font-size: 14px; letter-spacing: 0.08em; }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: 20px; letter-spacing: 0.4em; }
.btn--block { width: 100%; }

.link-btn {
  border: 0; background: none; padding: 0;
  color: var(--zhu); font-family: var(--font-kai); letter-spacing: 0.06em;
  white-space: nowrap; flex-shrink: 0;
}
.link-btn:hover { color: var(--zhu-deep); text-decoration: underline; text-underline-offset: 4px; }
.link-btn:disabled { color: var(--ink-4); cursor: not-allowed; text-decoration: none; }

/* ── form fields ── */
.field { display: block; }
.field + .field { margin-top: 20px; }
.field-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 6px;
  font-family: var(--font-kai); font-size: 15px; color: var(--ink-2); letter-spacing: 0.1em;
}
.field-label small { font-family: var(--font-song); font-size: 12px; color: var(--ink-3); letter-spacing: 0; }

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 252, 244, 0.55);
  padding: 9px 12px;
  line-height: 1.6;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.input::placeholder,
.textarea::placeholder { color: var(--ink-4); }
.input:focus,
.textarea:focus,
.select:focus { outline: none; border-color: var(--zhu); background: rgba(255, 252, 244, 0.85); box-shadow: 0 0 0 3px var(--zhu-wash); }
.textarea { resize: vertical; min-height: 92px; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* ── range ── */
.range { width: 100%; appearance: none; -webkit-appearance: none; height: 22px; background: transparent; }
.range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--ink-2) var(--fill, 50%), var(--paper-3) var(--fill, 50%));
}
.range::-moz-range-track { height: 3px; border-radius: 2px; background: var(--paper-3); }
.range::-moz-range-progress { height: 3px; background: var(--ink-2); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%;
  background: var(--zhu); border: 3px solid var(--paper-light); box-shadow: 0 0 0 1px var(--zhu-deep);
}
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--zhu); border: 3px solid var(--paper-light); box-shadow: 0 0 0 1px var(--zhu-deep); }
.range:disabled { opacity: 0.35; }

/* ── toast ── */
.toast-wrap {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: var(--radius);
  background: rgba(34, 30, 26, 0.92);
  color: var(--paper-light);
  font-family: var(--font-kai); letter-spacing: 0.06em;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease-out;
}
.toast--error { background: rgba(142, 39, 30, 0.95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

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