/* =========================================================
   余白 · Yubai Notes
   A quiet editorial theme, written by hand.
   ========================================================= */

:root {
  --paper: #f4f0e6;
  --paper-soft: #f8f4ea;
  --paper-deep: #ebe4d5;
  --ink: #202a23;
  --ink-soft: #3b463d;
  --muted: #5e665d;
  --muted-light: #747b70;
  --line: #d8d0c0;
  --line-soft: #e5ded0;
  --green: #2f5141;
  --green-deep: #1d352a;
  --green-soft: #e4ebe2;
  --rust: #ae542f;
  --rust-soft: #f4e3d7;
  --gold: #d8b967;
  --white: #fbf8f1;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --shadow-soft: 0 18px 50px rgba(32, 42, 35, 0.07);
  --shadow-card: 0 14px 34px rgba(32, 42, 35, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 3px;
  --header-h: 82px;
  --admin-header-h: 66px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(900px 520px at 92% -5%, rgba(216, 185, 103, 0.12), transparent 65%),
    radial-gradient(700px 500px at -10% 35%, rgba(47, 81, 65, 0.045), transparent 60%);
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--green-deep);
  background: #ded09a;
}

h1, h2, h3, h4, h5, h6, p, dl, dd, figure, blockquote {
  margin: 0;
}

ul, ol {
  padding: 0;
  margin: 0;
}

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

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.18;
  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='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.14'/%3E%3C/svg%3E");
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  padding: 10px 16px;
  color: var(--paper);
  background: var(--green-deep);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.muted {
  color: var(--muted);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.eyebrow-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rust);
}

.eyebrow-light {
  color: rgba(244, 240, 230, 0.72);
}

.eyebrow-light .eyebrow-dot {
  background: var(--gold);
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-color: #bdb4a3;
  border-radius: 3px;
  color: var(--muted);
  background: var(--paper-soft);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(47, 81, 65, 0.35);
  color: var(--green);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.2s ease, border-color 0.2s ease, gap 0.2s ease;
}

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

.label-optional {
  color: var(--muted-light);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.meta-dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line);
}

.nowrap {
  white-space: nowrap;
}

.copy-icon {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
  opacity: 0.65;
}

.copy-icon::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
  background: var(--paper);
}

/* ---------- Buttons & forms ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 21px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.035em;
  line-height: 1.2;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s var(--ease),
    box-shadow 0.2s ease;
}

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

.button-primary {
  color: var(--paper-soft);
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 7px 18px rgba(47, 81, 65, 0.16);
}

.button-primary:hover {
  background: var(--green-deep);
  border-color: var(--green-deep);
  box-shadow: 0 10px 24px rgba(47, 81, 65, 0.22);
}

.button-secondary {
  color: var(--green);
  background: transparent;
  border-color: var(--line);
}

.button-secondary:hover {
  background: var(--white);
  border-color: #b9b09e;
}

.button-danger {
  color: var(--white);
  background: var(--rust);
  border-color: var(--rust);
}

.button-danger:hover {
  background: #8f4125;
  border-color: #8f4125;
}

.button-block {
  width: 100%;
}

.field {
  margin-bottom: 18px;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.035em;
}

.field input,
.field textarea,
.settings-card input,
.settings-card textarea,
.side-card input,
.side-card textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  color: var(--ink);
  background: var(--paper-soft);
  font-size: 14px;
  line-height: 1.55;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder,
.field textarea::placeholder,
.side-card input::placeholder,
.side-card textarea::placeholder {
  color: #8a8170;
}

.field input:focus,
.field textarea:focus,
.settings-card input:focus,
.settings-card textarea:focus,
.side-card input:focus,
.side-card textarea:focus {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(47, 81, 65, 0.08);
}

.field textarea,
.side-card textarea {
  resize: vertical;
}

.field-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

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

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 58px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  padding: 5px 8px;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--rust);
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid #e0b7a3;
  border-left: 3px solid var(--rust);
  color: #813b22;
  background: var(--rust-soft);
  font-size: 12.5px;
  line-height: 1.6;
}

.form-alert > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  color: var(--white);
  background: var(--rust);
  font-family: var(--mono);
  font-size: 10px;
}

/* ---------- Public header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  border-bottom: 1px solid rgba(216, 208, 192, 0.62);
  background: rgba(244, 240, 230, 0.86);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(246, 242, 232, 0.94);
  box-shadow: 0 12px 34px rgba(32, 42, 35, 0.055);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 64px));
  height: var(--header-h);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--green);
  color: var(--green);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.35s var(--ease);
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rust);
}

.brand:hover .brand-mark {
  color: var(--paper);
  background: var(--green);
  transform: rotate(-3deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

.brand-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.main-nav > a {
  position: relative;
  padding: 6px 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  transition: color 0.2s ease;
}

.main-nav > a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}

.main-nav > a:hover,
.main-nav > a.is-active {
  color: var(--green);
}

.main-nav > a:hover::after,
.main-nav > a.is-active::after {
  transform: scaleX(1);
}

.main-nav .nav-owner {
  padding: 7px 12px;
  border: 1px solid var(--line);
  color: var(--green);
  font-size: 10.5px;
}

.main-nav .nav-owner::after {
  display: none;
}

.main-nav .nav-owner:hover {
  border-color: var(--green);
  background: rgba(47, 81, 65, 0.055);
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  margin-top: 96px;
  padding: 64px 0 28px;
  overflow: hidden;
  color: rgba(244, 240, 230, 0.78);
  background: var(--green-deep);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -80px;
  width: 500px;
  height: 500px;
  border: 1px solid rgba(244, 240, 230, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.footer-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 34px 60px;
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 470px;
}

.footer-seal {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(244, 240, 230, 0.42);
  color: rgba(244, 240, 230, 0.88);
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
}

.footer-title {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.06em;
}

.footer-tagline {
  margin-top: 6px;
  color: rgba(244, 240, 230, 0.54);
  font-size: 12.5px;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 10px 24px;
  padding-top: 8px;
}

.footer-links a {
  color: rgba(244, 240, 230, 0.58);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--paper);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  grid-column: 1 / -1;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(244, 240, 230, 0.12);
  color: rgba(244, 240, 230, 0.38);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.footer-copy {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

.footer-beian {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid rgba(244, 240, 230, 0.09);
  text-align: center;
}

.footer-beian .icp-link {
  padding-bottom: 2px;
  color: rgba(244, 240, 230, 0.74);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 240, 230, 0.36);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-beian .icp-link:hover {
  color: var(--paper);
  border-color: rgba(244, 240, 230, 0.72);
}

.legal-strip {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 14px 24px 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  background: var(--paper);
  font-family: var(--mono);
  line-height: 1.5;
  text-align: center;
}

.legal-copy {
  color: var(--muted-light);
  font-size: 8.5px;
  letter-spacing: 0.06em;
}

.legal-strip .icp-link {
  color: var(--green);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 81, 65, 0.4);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-strip .icp-link:hover {
  color: var(--rust);
  border-color: var(--rust);
}

.footer-watermark {
  position: absolute;
  right: -18px;
  bottom: -78px;
  z-index: 1;
  color: rgba(244, 240, 230, 0.038);
  font-family: var(--serif);
  font-size: clamp(160px, 25vw, 300px);
  line-height: 0.8;
  letter-spacing: -0.06em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* ---------- Home hero ---------- */

.home-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.home-hero::before {
  content: "NOTES";
  position: absolute;
  top: 44px;
  right: -30px;
  color: rgba(47, 81, 65, 0.035);
  font-family: var(--serif);
  font-size: 180px;
  line-height: 1;
  letter-spacing: -0.08em;
  pointer-events: none;
  user-select: none;
}

.home-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 350px;
  gap: clamp(44px, 7vw, 96px);
  align-items: end;
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 92px 0 76px;
}

.hero-copy {
  padding-bottom: 8px;
}

.hero-title {
  margin: 26px 0 28px;
  font-family: var(--serif);
  font-size: clamp(54px, 6.9vw, 96px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.accent-word {
  position: relative;
  display: inline-block;
  color: var(--green);
}

.accent-word::after {
  content: "";
  position: absolute;
  right: 0.02em;
  bottom: 0.09em;
  left: 0.02em;
  height: 0.085em;
  border-radius: 50%;
  background: var(--rust);
  opacity: 0.72;
  transform: rotate(-1.2deg);
}

.hero-lede {
  max-width: 490px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.015em;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 38px;
}

.circle-link {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.circle-link-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--green);
  border-radius: 50%;
  font-size: 17px;
  transition: color 0.25s ease, background-color 0.25s ease, transform 0.35s var(--ease);
}

.circle-link:hover .circle-link-icon {
  color: var(--paper);
  background: var(--green);
  transform: translateY(3px);
}

.index-card {
  position: relative;
  padding: 25px 25px 22px;
  border: 1px solid #cec5b3;
  border-top: 3px solid var(--rust);
  background: #fbf7ed;
  box-shadow: 12px 16px 0 rgba(47, 81, 65, 0.055);
  transform: rotate(1.1deg);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.index-card:hover {
  box-shadow: 8px 12px 0 rgba(47, 81, 65, 0.06);
  transform: rotate(0deg) translateY(-4px);
}

.index-card-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
}

.index-rule {
  height: 1px;
  margin: 18px 0;
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 9px);
}

.index-facts {
  display: grid;
  gap: 13px;
}

.index-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.index-facts dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.index-facts dd {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13.5px;
  text-align: right;
}

.index-facts dd span {
  color: var(--muted);
  font-size: 10px;
}

.index-latest {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.index-latest-label {
  color: var(--rust);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.index-latest strong {
  max-width: 250px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  transition: color 0.2s ease;
}

.index-latest:hover strong {
  color: var(--rust);
}

.index-latest-date {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
}

.index-latest.is-empty {
  min-height: 140px;
}

.index-latest.is-empty strong {
  margin-top: 8px;
  color: var(--muted);
  font-size: 17px;
}

.index-stamp {
  position: absolute;
  right: 18px;
  bottom: 15px;
  padding: 3px 5px;
  border: 1px solid rgba(174, 84, 47, 0.55);
  color: rgba(174, 84, 47, 0.64);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
  transform: rotate(-5deg);
  pointer-events: none;
}

/* ---------- Notes index ---------- */

.notes-section {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 68px 0 20px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 34px;
  margin-bottom: 24px;
}

.section-head h2 {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(36px, 4vw, 46px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 4px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s ease;
}

.search-form:focus-within {
  border-color: var(--green);
}

.search-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.search-form input {
  min-width: 0;
  flex: 1;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
}

.search-form input::placeholder {
  color: #8a8170;
}

.search-form button {
  padding: 2px 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.search-form button:hover {
  color: var(--rust);
}

.result-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 24px 0 38px;
}

.tag-filter a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tag-filter a:hover {
  border-color: var(--line);
  color: var(--green);
}

.tag-filter a.is-active {
  border-color: var(--green);
  color: var(--paper);
  background: var(--green);
}

.tag-count {
  color: currentColor;
  font-family: var(--mono);
  font-size: 8px;
  opacity: 0.55;
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 24px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.filter-summary strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
}

.filter-summary a {
  color: var(--rust);
  font-size: 11px;
}

/* ---------- Featured note ---------- */

.featured-note {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 50px;
  gap: 30px;
  margin-bottom: 24px;
  padding: 38px 42px;
  overflow: hidden;
  color: var(--paper);
  background: var(--green-deep);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.featured-note::before {
  content: "";
  position: absolute;
  top: -160px;
  right: 8%;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(244, 240, 230, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.featured-note::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 185, 103, 0.55));
}

.featured-note:hover {
  box-shadow: 0 22px 48px rgba(29, 53, 42, 0.18);
  transform: translateY(-3px);
}

.card-cover-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.featured-number {
  padding-top: 2px;
  border-right: 1px solid rgba(244, 240, 230, 0.14);
  color: rgba(244, 240, 230, 0.34);
  font-family: var(--serif);
  font-size: 43px;
  font-weight: 400;
  line-height: 1;
}

.featured-content {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.featured-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.latest-label {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
}

.featured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.featured-tags a {
  position: relative;
  z-index: 3;
  padding: 2px 8px;
  border: 1px solid rgba(244, 240, 230, 0.17);
  border-radius: 999px;
  color: rgba(244, 240, 230, 0.62);
  font-size: 9.5px;
  pointer-events: auto;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.featured-tags a:hover {
  color: var(--paper);
  border-color: rgba(244, 240, 230, 0.5);
}

.featured-content h3 {
  max-width: 750px;
  margin: 17px 0 12px;
  color: #fbf7ec;
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 43px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.featured-content > p {
  max-width: 660px;
  color: rgba(244, 240, 230, 0.6);
  font-size: 13.5px;
  line-height: 1.85;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.featured-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
  color: rgba(244, 240, 230, 0.44);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.045em;
}

.featured-meta .meta-dot {
  background: rgba(244, 240, 230, 0.26);
}

.featured-read {
  display: inline-flex;
  gap: 7px;
  margin-left: 18px;
  color: rgba(244, 240, 230, 0.78);
  letter-spacing: 0.06em;
}

.featured-arrow {
  align-self: flex-start;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(244, 240, 230, 0.24);
  border-radius: 50%;
  color: rgba(244, 240, 230, 0.7);
  font-size: 18px;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s var(--ease);
}

.featured-note:hover .featured-arrow {
  color: var(--green-deep);
  background: var(--paper);
  transform: rotate(5deg);
}

/* ---------- Note cards ---------- */

.note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 284px;
  padding: 26px 27px 23px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.52);
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}

.note-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 27px;
  width: 32px;
  height: 2px;
  background: var(--green);
  opacity: 0;
  transform: scaleX(0.3);
  transform-origin: left;
  transition: opacity 0.3s ease, transform 0.35s var(--ease);
}

.note-card:hover {
  border-color: #c4baa6;
  background: var(--white);
  box-shadow: var(--shadow-card);
  transform: translateY(-4px);
}

.note-card:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

.note-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
}

.note-card-index {
  color: var(--rust);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0;
}

.note-card h3 {
  margin: 20px 0 11px;
  font-family: var(--serif);
  font-size: clamp(23px, 2.3vw, 29px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.note-card:hover h3 {
  color: var(--green);
}

.note-card-excerpt {
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.85;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.note-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 22px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.card-tags a {
  position: relative;
  z-index: 3;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(47, 81, 65, 0.055);
  font-size: 9.5px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.card-tags a:hover {
  color: var(--paper);
  background: var(--green);
}

.card-reading {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ---------- Empty / pagination ---------- */

.empty-state {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 78px 24px 72px;
  border: 1px dashed #cfc5b2;
  text-align: center;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #b6ac99;
  font-family: var(--serif);
  font-size: 27px;
}

.empty-state h3,
.library-empty h3 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
}

.empty-state p,
.library-empty p {
  max-width: 430px;
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}

.page-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.page-arrow:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--white);
}

.page-arrow.is-disabled {
  opacity: 0.38;
}

.page-numbers {
  display: flex;
  gap: 3px;
}

.page-numbers a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 36px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.page-numbers a:hover {
  color: var(--green);
}

.page-numbers a.is-current {
  color: var(--paper);
  background: var(--green);
}

.page-caption {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
}

/* ---------- Note detail ---------- */

.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 200;
  height: 2px;
  background: transparent;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--rust);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.note-main {
  padding: 46px 0 20px;
}

.note-shell {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 720px;
  margin: 0 auto 54px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.breadcrumb a {
  color: var(--green);
}

.breadcrumb a:hover {
  color: var(--rust);
}

.breadcrumb span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto 34px;
  padding: 13px 16px;
  border: 1px solid #dfbca8;
  border-left: 3px solid var(--rust);
  color: #7d3f29;
  background: var(--rust-soft);
  font-size: 12px;
}

.draft-badge {
  padding: 2px 7px;
  color: var(--paper);
  background: var(--rust);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.draft-banner a {
  margin-left: auto;
  color: var(--rust);
  font-weight: 500;
}

.note-header {
  max-width: 720px;
  margin: 0 auto 58px;
}

.note-header h1 {
  margin: 20px 0 20px;
  font-family: var(--serif);
  font-size: clamp(44px, 5.8vw, 72px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.note-deck {
  max-width: 680px;
  margin-bottom: 25px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.8;
  letter-spacing: 0.01em;
}

.note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.045em;
}

.meta-author {
  color: var(--ink-soft);
}

.meta-edit {
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(47, 81, 65, 0.35);
  color: var(--green);
}

.meta-edit:hover {
  color: var(--rust);
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 21px;
}

.note-tags a {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  font-size: 9.5px;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.note-tags a:hover {
  border-color: var(--green);
  background: rgba(47, 81, 65, 0.055);
}

.article-layout {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.article-aside {
  position: absolute;
  top: 4px;
  right: calc(100% + 54px);
  width: 152px;
}

.article-aside-inner {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.aside-label {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
}

.aside-meta {
  width: 100%;
  margin: 5px 0 8px;
}

.aside-meta > div {
  margin-bottom: 10px;
}

.aside-meta dt {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.aside-meta dd {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.45;
}

.aside-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  text-align: left;
  transition: color 0.2s ease;
}

.aside-action:hover {
  color: var(--green);
}

.aside-ornament {
  margin-top: 20px;
  color: rgba(47, 81, 65, 0.1);
  font-family: var(--serif);
  font-size: 54px;
  line-height: 1;
}

.article-body {
  min-height: 200px;
}

.empty-content {
  padding: 40px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
  text-align: center;
}

/* ---------- Prose ---------- */

.prose {
  color: #2a332d;
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 2;
  letter-spacing: 0.012em;
  overflow-wrap: break-word;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose > *:last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 1.55em;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.018em;
  scroll-margin-top: 110px;
}

.prose h2 {
  margin: 2.4em 0 0.85em;
  font-size: 1.55em;
}

.prose h3 {
  margin: 2em 0 0.65em;
  font-size: 1.24em;
}

.prose h4 {
  margin: 1.8em 0 0.55em;
  font-size: 1.06em;
}

.prose h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  margin-bottom: 18px;
  background: var(--rust);
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose em {
  color: var(--ink-soft);
}

.prose a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-color: rgba(174, 84, 47, 0.48);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.prose a:hover {
  color: var(--rust);
  background: rgba(216, 185, 103, 0.14);
}

.prose ul,
.prose ol {
  margin: 0 0 1.55em;
  padding-left: 1.45em;
}

.prose li {
  margin-bottom: 0.4em;
  padding-left: 0.15em;
}

.prose li::marker {
  color: var(--rust);
  font-size: 0.8em;
}

.prose blockquote {
  position: relative;
  margin: 2em 0;
  padding: 20px 26px 20px 30px;
  border-left: 3px solid var(--rust);
  color: #4a5149;
  background: rgba(235, 228, 213, 0.66);
  font-size: 1.02em;
}

.prose blockquote::before {
  content: "“";
  position: absolute;
  top: 4px;
  left: 9px;
  color: rgba(174, 84, 47, 0.25);
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1;
}

.prose blockquote p {
  margin-bottom: 0.7em;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.16em 0.4em;
  border-radius: 2px;
  color: #30513f;
  background: #e8e1d1;
  font-family: var(--mono);
  font-size: 0.82em;
}

.prose pre {
  position: relative;
  margin: 2em 0;
  padding: 22px 24px;
  overflow-x: auto;
  border-radius: var(--radius);
  color: #ebe5d7;
  background: var(--green-deep);
  font-size: 13px;
  line-height: 1.78;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border: 1px solid rgba(244, 240, 230, 0.25);
  border-radius: 2px;
  color: rgba(244, 240, 230, 0.65);
  background: rgba(244, 240, 230, 0.06);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.prose pre:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  background: rgba(244, 240, 230, 0.13);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2.2em auto;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.prose figure {
  margin: 2.2em 0;
}

.prose figure img {
  margin: 0 auto;
}

.prose figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.6;
  text-align: center;
}

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

.prose table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.7;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  border-bottom-width: 2px;
  color: var(--ink);
  background: rgba(235, 228, 213, 0.55);
  font-weight: 600;
}

.prose tr:hover td {
  background: rgba(251, 248, 241, 0.58);
}

.prose ul:has(> li > input[type="checkbox"]) {
  padding-left: 0.2em;
  list-style: none;
}

.prose li:has(> input[type="checkbox"]) {
  margin-left: 0.1em;
  list-style: none;
}

.prose li:has(> input[type="checkbox"])::marker {
  content: "";
}

.prose input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0 8px 0 0;
  vertical-align: -1px;
  accent-color: var(--green);
}

.prose dl {
  margin: 1.5em 0;
}

.prose dt {
  font-weight: 600;
}

.prose dd {
  margin: 0 0 0.8em 1.4em;
  color: var(--muted);
}

.prose mark {
  padding: 0 0.15em;
  background: rgba(216, 185, 103, 0.38);
}

.prose kbd {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--paper-soft);
  font-family: var(--mono);
  font-size: 0.76em;
}

/* ---------- Note footer / adjacent ---------- */

.note-footer {
  max-width: 720px;
  margin: 76px auto 0;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.end-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 34px;
}

.end-mark span {
  width: 48px;
  height: 1px;
  background: var(--line);
}

.end-mark b {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
}

.note-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.adjacent-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  max-width: 900px;
  margin: 58px auto 0;
}

.adjacent-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 21px 23px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.42);
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.3s var(--ease);
}

.adjacent-card:hover {
  border-color: #bfb5a1;
  background: var(--white);
  transform: translateY(-2px);
}

.adjacent-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
}

.adjacent-card strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
}

.adjacent-next {
  text-align: right;
}

/* ---------- Auth ---------- */

.auth-page {
  background: var(--paper);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh;
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 42px 52px 30px;
  overflow: hidden;
  color: var(--paper);
  background:
    radial-gradient(700px 500px at 88% 8%, rgba(216, 185, 103, 0.08), transparent 65%),
    var(--green-deep);
}

.auth-visual::before {
  content: "余";
  position: absolute;
  right: -35px;
  bottom: -85px;
  color: rgba(244, 240, 230, 0.035);
  font-family: var(--serif);
  font-size: 390px;
  line-height: 1;
  pointer-events: none;
}

.auth-visual::after {
  content: "";
  position: absolute;
  top: 23%;
  right: -190px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(244, 240, 230, 0.07);
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.06em;
}

.auth-brand .brand-mark {
  border-color: rgba(244, 240, 230, 0.42);
  color: var(--paper);
}

.auth-brand .brand-mark::after {
  background: var(--gold);
}

.auth-quote {
  position: relative;
  z-index: 2;
  max-width: 490px;
  margin-top: auto;
  padding: 80px 0 30px;
}

.auth-quote h1 {
  margin: 20px 0 22px;
  color: #fbf7ec;
  font-family: var(--serif);
  font-size: clamp(44px, 4.9vw, 65px);
  font-weight: 500;
  line-height: 1.17;
  letter-spacing: -0.04em;
}

.auth-quote > p:last-child {
  max-width: 390px;
  color: rgba(244, 240, 230, 0.57);
  font-size: 13px;
  line-height: 1.9;
}

.auth-art {
  position: relative;
  z-index: 2;
  height: 170px;
  margin: 4px 0 18px;
}

.paper-stack {
  position: absolute;
  left: 6px;
  bottom: 0;
  width: 245px;
  height: 150px;
  border: 1px solid rgba(244, 240, 230, 0.17);
  background: rgba(244, 240, 230, 0.055);
}

.paper-stack-back {
  transform: rotate(-7deg) translate(18px, 8px);
  opacity: 0.55;
}

.paper-stack-mid {
  transform: rotate(3deg) translate(40px, -3px);
  opacity: 0.7;
}

.paper-stack-front {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 27px 25px;
  background: rgba(244, 240, 230, 0.1);
  transform: rotate(-1.5deg) translate(10px, -12px);
  backdrop-filter: blur(2px);
}

.paper-line {
  display: block;
  width: 100%;
  height: 1px;
  background: rgba(244, 240, 230, 0.18);
}

.paper-line-short {
  width: 40%;
  margin-bottom: 5px;
  background: rgba(216, 185, 103, 0.55);
}

.paper-line-mid {
  width: 65%;
}

.paper-sign {
  align-self: flex-end;
  margin-top: auto;
  color: rgba(244, 240, 230, 0.38);
  font-family: var(--serif);
  font-size: 17px;
}

.auth-visual-foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid rgba(244, 240, 230, 0.11);
  color: rgba(244, 240, 230, 0.34);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.09em;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 46px 48px;
  background: var(--paper);
}

.auth-form-wrap {
  width: min(100%, 382px);
}

.auth-form-wide {
  width: min(100%, 500px);
}

.auth-back {
  display: inline-flex;
  margin-bottom: 56px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.auth-back:hover {
  color: var(--green);
}

.auth-form-wrap h2 {
  margin: 15px 0 8px;
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-intro {
  margin-bottom: 31px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  margin-top: 4px;
}

.auth-form .button {
  margin-top: 8px;
}

.auth-hint {
  margin-top: 25px;
  padding-top: 19px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.auth-rss {
  display: inline-flex;
  gap: 7px;
  margin-top: 17px;
  color: var(--green);
  font-size: 11px;
}

.auth-rss:hover {
  color: var(--rust);
}

.setup-form .field {
  margin-bottom: 16px;
}

.setup-steps {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0;
  max-width: 330px;
  margin: 8px 0 25px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 0;
  border-top: 1px solid rgba(244, 240, 230, 0.09);
  color: rgba(244, 240, 230, 0.34);
}

.setup-step span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.setup-step p {
  font-family: var(--serif);
  font-size: 13px;
}

.setup-step.is-current {
  color: rgba(244, 240, 230, 0.75);
}

.setup-step.is-current span {
  color: var(--gold);
}

/* ---------- Admin shell ---------- */

.admin {
  background-color: #f3efe5;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 90;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 234, 0.92);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  width: min(1360px, calc(100% - 64px));
  height: var(--admin-header-h);
  margin: 0 auto;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark-small {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.admin-brand-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.admin-brand-name {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.admin-brand-label {
  padding: 1px 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 46px;
}

.admin-nav a {
  position: relative;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.admin-nav a:hover {
  color: var(--green);
  background: rgba(47, 81, 65, 0.045);
}

.admin-nav a.is-active {
  color: var(--green);
  background: rgba(47, 81, 65, 0.07);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.view-site-link {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.view-site-link:hover {
  color: var(--green);
}

.logout-form {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.link-button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.link-button:hover {
  color: var(--rust);
}

.admin-main {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 46px 0 100px;
}

.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.admin-page-head h1 {
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: clamp(40px, 4.8vw, 54px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.page-lede {
  color: var(--muted);
  font-size: 13px;
}

.admin-narrow {
  width: min(850px, calc(100% - 64px));
}

/* ---------- Flash ---------- */

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  padding: 12px 14px;
  border: 1px solid #bdcdb9;
  border-left: 3px solid var(--green);
  color: #304c3a;
  background: #e8eee2;
  font-size: 12px;
  animation: flash-in 0.55s var(--ease) both;
}

.flash-error {
  border-color: #e0b7a3;
  border-left-color: var(--rust);
  color: #813b22;
  background: var(--rust-soft);
}

.flash-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--paper);
  background: var(--green);
  font-family: var(--mono);
  font-size: 9px;
}

.flash-error .flash-icon {
  background: var(--rust);
}

.flash-message {
  flex: 1;
}

.flash-close {
  padding: 0 3px;
  border: 0;
  color: currentColor;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  opacity: 0.5;
}

.flash-close:hover {
  opacity: 1;
}

.flash.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* ---------- Dashboard ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 34px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  min-height: 142px;
  padding: 20px 20px 17px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.54);
}

.stat-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.stat-value {
  margin: 10px 0 auto;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
}

.stat-value-text {
  max-width: 170px;
  margin-top: 13px;
  font-size: 18px;
  line-height: 1.5;
}

.stat-note {
  color: var(--muted);
  font-size: 9.5px;
}

.stat-card-link {
  position: relative;
  overflow: hidden;
  color: var(--paper);
  border-color: var(--green-deep);
  background: var(--green-deep);
  transition: background-color 0.25s ease, transform 0.3s var(--ease);
}

.stat-card-link::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(244, 240, 230, 0.1);
  border-radius: 50%;
}

.stat-card-link:hover {
  background: #28483a;
  transform: translateY(-2px);
}

.stat-card-link .stat-label {
  color: rgba(244, 240, 230, 0.48);
}

.stat-card-link .stat-value-text {
  color: var(--paper);
  font-family: var(--serif);
}

.stat-card-link .stat-note {
  color: rgba(244, 240, 230, 0.55);
}

.library {
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.4);
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.status-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.status-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 11.5px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.status-tabs a span {
  font-family: var(--mono);
  font-size: 8px;
  opacity: 0.6;
}

.status-tabs a:hover {
  color: var(--green);
}

.status-tabs a.is-active {
  color: var(--paper);
  background: var(--green);
}

.status-tabs a.is-active span {
  opacity: 0.7;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 235px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.admin-search:focus-within {
  border-color: var(--green);
}

.admin-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11.5px;
}

.admin-search input::placeholder {
  color: #8a8170;
}

.admin-search button {
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
}

.library-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 22px 20px 16px;
}

.library-heading h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.library-total {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
}

.clear-search {
  margin-left: auto;
  color: var(--rust);
  font-size: 10px;
}

.library-table-head,
.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 118px 156px;
  gap: 18px;
  align-items: center;
}

.library-table-head {
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(235, 228, 213, 0.45);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.library-row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.2s ease;
}

.library-row:last-child {
  border-bottom: 0;
}

.library-row:hover {
  background: rgba(255, 253, 248, 0.7);
}

.library-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.status-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 9px;
  border-radius: 50%;
}

.status-dot-published {
  background: var(--green);
}

.status-dot-draft {
  border: 1px solid #aa9f8c;
  background: transparent;
}

.library-note-copy {
  min-width: 0;
}

.library-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.library-title:hover {
  color: var(--rust);
}

.library-note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.library-note-meta span:not(.muted):not(.meta-separator) {
  color: #788876;
}

.meta-separator {
  color: var(--line);
}

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-pill-published {
  color: #2f5141;
  background: #e2ebe0;
}

.status-pill-draft {
  color: #7f7460;
  background: #eee8dc;
}

.library-updated {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.library-actions {
  display: flex;
  justify-content: flex-end;
  gap: 13px;
}

.library-actions a {
  color: var(--muted);
  font-size: 10.5px;
  transition: color 0.2s ease;
}

.library-actions a:hover {
  color: var(--green);
}

.library-actions a.is-danger:hover {
  color: var(--rust);
}

.library-empty {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 66px 24px;
  text-align: center;
}

.library-empty .button {
  margin-top: 2px;
}

/* ---------- Editor ---------- */

.editor-page .admin-main {
  width: min(1400px, calc(100% - 56px));
  padding-top: 22px;
}

.editor-form {
  margin: 0;
}

.editor-topbar {
  position: sticky;
  top: var(--admin-header-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 0 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 239, 229, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.editor-back {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.editor-back:hover {
  color: var(--green);
}

.editor-topbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.save-indicator {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-indicator.is-dirty {
  color: var(--rust);
}

.save-indicator.is-saved {
  color: var(--green);
}

.editor-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.editor-top-actions .button {
  min-height: 38px;
  padding: 8px 15px;
  font-size: 11.5px;
}

.editor-view-link {
  margin-right: 6px;
  color: var(--muted);
  font-size: 10.5px;
}

.editor-view-link:hover {
  color: var(--green);
}

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 314px;
  gap: 24px;
  align-items: start;
  min-width: 0;
}

.editor-main-col {
  min-width: 0;
}

.editor-alert,
.editor-main-col > .flash {
  margin-bottom: 14px;
}

.editor-title-wrap {
  position: relative;
  padding: 8px 2px 15px;
}

.editor-title {
  display: block;
  width: 100%;
  min-height: 64px;
  padding: 2px 0 8px;
  overflow: hidden;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink);
  background: transparent;
  font-family: var(--serif);
  font-size: clamp(34px, 3.6vw, 46px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.editor-title::placeholder {
  color: #948b7a;
}

.editor-title-rule {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, var(--line) 70%, transparent 100%);
}

.markdown-editor {
  border: 1px solid var(--line);
  background: var(--paper-soft);
  box-shadow: 0 10px 30px rgba(32, 42, 35, 0.035);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.markdown-editor:focus-within {
  border-color: #bcb3a0;
  box-shadow: 0 14px 34px rgba(32, 42, 35, 0.055);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(235, 228, 213, 0.35);
}

.toolbar-label {
  padding: 0 9px 0 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.editor-toolbar button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 29px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--ink-soft);
  background: transparent;
  font-family: var(--mono);
  font-size: 10.5px;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.editor-toolbar button:hover {
  border-color: var(--line);
  color: var(--green);
  background: var(--paper-soft);
}

.toolbar-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--line);
}

.toolbar-spacer {
  flex: 1;
}

.toolbar-hint {
  padding: 0 4px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
}

.markdown-input {
  display: block;
  width: 100%;
  min-height: 560px;
  padding: 24px 26px;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--ink-soft);
  background: transparent;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.95;
  tab-size: 2;
}

.markdown-input::placeholder {
  color: #8f8675;
}

.editor-statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  background: rgba(235, 228, 213, 0.26);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.statusbar-dot {
  color: var(--line);
}

.statusbar-spacer {
  flex: 1;
}

.autosave-status {
  color: var(--muted-light);
}

.autosave-status.is-dirty {
  color: var(--rust);
}

.restore-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid #d9c48e;
  background: #f1e8ca;
  color: #6f5d2d;
  font-size: 11px;
}

.restore-icon {
  font-size: 14px;
}

.restore-bar button {
  padding: 2px 8px;
  border: 1px solid #bfa964;
  color: #5e4e24;
  background: rgba(255, 253, 245, 0.5);
  font-size: 10px;
}

.restore-bar .restore-discard {
  margin-left: auto;
  border-color: transparent;
  color: #8f7c48;
  background: transparent;
}

.editor-footnote {
  margin-top: 13px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.editor-sidebar {
  position: sticky;
  top: calc(var(--admin-header-h) + 74px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - var(--admin-header-h) - 90px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.side-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.65);
}

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.side-card .field-hint {
  margin-top: 7px;
  font-size: 9.5px;
}

.side-card input {
  padding: 9px 10px;
  font-size: 12px;
}

.side-card textarea {
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.65;
}

.status-switch {
  display: grid;
  gap: 7px;
}

.status-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.status-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.status-option-body {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  background: rgba(244, 240, 230, 0.35);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.status-option-body > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.status-option-body strong {
  font-size: 11px;
  font-weight: 500;
}

.status-option-body small {
  color: var(--muted);
  font-size: 9px;
}

.status-option-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border: 1px solid #a99e8b;
  border-radius: 50%;
}

.status-option input:checked + .status-option-body {
  border-color: var(--green);
  background: #e9eee5;
}

.status-option input:checked + .status-option-body .status-option-dot {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 2px #e9eee5;
}

.status-option input:focus-visible + .status-option-body {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

.side-details {
  padding: 0;
}

.side-details summary {
  padding: 15px 16px;
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.side-details summary::-webkit-details-marker {
  display: none;
}

.details-chevron {
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.side-details[open] .details-chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}

.details-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line-soft);
}

.details-body > .field-label {
  margin-top: 12px;
}

.slug-field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.slug-field span {
  padding-left: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  white-space: nowrap;
}

.slug-field input {
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 10.5px;
}

.slug-field:focus-within {
  border-color: var(--green);
}

.meta-list {
  margin: 13px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.meta-list > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-size: 9px;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  font-family: var(--mono);
  font-size: 8.5px;
  text-align: right;
}

.side-card-tips {
  background: rgba(235, 228, 213, 0.35);
}

.markdown-tips {
  list-style: none;
}

.markdown-tips li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 9px;
}

.markdown-tips li:last-child {
  border-bottom: 0;
}

.markdown-tips code {
  color: var(--green);
  font-family: var(--mono);
  font-size: 9px;
}

.markdown-tips span {
  color: var(--muted);
}

.side-danger {
  border-color: #ddc1b2;
  background: #f7ece4;
}

.side-danger p {
  margin-bottom: 6px;
  color: #7d4c37;
  font-size: 10px;
}

.side-danger a {
  color: var(--rust);
  font-size: 10.5px;
}

.side-danger a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Preview modal ---------- */

body.modal-open {
  overflow: hidden;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 35, 28, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.preview-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  height: min(860px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid #cac0ad;
  background: var(--paper);
  box-shadow: 0 34px 90px rgba(15, 28, 21, 0.28);
  animation: preview-in 0.4s var(--ease) both;
}

@keyframes preview-in {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.preview-eyebrow {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.11em;
}

.preview-close {
  padding: 5px 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10.5px;
}

.preview-close:hover {
  color: var(--rust);
}

.preview-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
}

.preview-article {
  width: min(700px, calc(100% - 80px));
  margin: 0 auto;
  padding: 56px 0 80px;
}

.preview-deck {
  margin: -22px 0 34px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
}

.preview-article h1 {
  margin: 18px 0 38px;
  font-family: var(--serif);
  font-size: clamp(36px, 4.3vw, 52px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.preview-loading {
  padding: 30px 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Delete ---------- */

.delete-card {
  margin-top: 26px;
  padding: clamp(30px, 5vw, 54px);
  border: 1px solid #d9bfae;
  background:
    linear-gradient(135deg, rgba(244, 227, 215, 0.35), transparent 55%),
    var(--paper-soft);
  box-shadow: var(--shadow-soft);
}

.danger-eyebrow {
  color: var(--rust);
}

.danger-eyebrow .eyebrow-dot {
  background: var(--rust);
}

.delete-card h1 {
  margin: 14px 0 12px;
  font-family: var(--serif);
  font-size: clamp(34px, 4.4vw, 48px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.delete-lede {
  max-width: 570px;
  color: var(--muted);
  font-size: 13px;
}

.delete-note-preview {
  margin: 32px 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--rust);
  background: rgba(251, 248, 241, 0.7);
}

.delete-note-preview h2 {
  margin: 12px 0 7px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.4;
}

.delete-note-preview > p {
  color: var(--muted);
  font-size: 12px;
}

.delete-note-meta {
  display: block;
  margin-top: 13px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8.5px;
}

.delete-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.delete-actions form {
  margin: 0;
}

.delete-alternative {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10.5px;
}

/* ---------- Settings ---------- */

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

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.settings-column,
.settings-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-aside {
  position: sticky;
  top: calc(var(--admin-header-h) + 24px);
}

.settings-card {
  padding: 26px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.55);
}

.settings-card-head {
  margin-bottom: 21px;
}

.settings-card h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.settings-card-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.settings-card .field:last-of-type {
  margin-bottom: 20px;
}

.settings-info-list {
  margin: 18px 0 22px;
}

.settings-info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.settings-info-list dt {
  color: var(--muted);
}

.settings-info-list dd {
  color: var(--ink-soft);
}

.settings-info-list a {
  color: var(--green);
}

.settings-note {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.export-actions {
  display: flex;
  flex-direction: column;
}

.export-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.export-link:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.export-link:hover strong {
  color: var(--rust);
}

.export-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  color: var(--green);
  font-family: var(--mono);
  font-size: 8.5px;
}

.export-link > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.export-link strong {
  font-size: 10.5px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.export-link small {
  color: var(--muted);
  font-size: 9px;
}

.export-link > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.settings-security {
  background: rgba(228, 235, 226, 0.35);
}

.settings-security p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

/* ---------- Error ---------- */

.error-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 28px 0;
  border-bottom: 1px solid var(--line-soft);
}

.error-main {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  width: min(780px, calc(100% - 48px));
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 70px 0;
  text-align: center;
}

.error-code {
  margin-bottom: 4px;
  color: rgba(47, 81, 65, 0.075);
  font-family: var(--serif);
  font-size: clamp(120px, 23vw, 230px);
  font-weight: 500;
  line-height: 0.85;
  letter-spacing: -0.07em;
  user-select: none;
}

.error-main .eyebrow {
  justify-content: center;
}

.error-main h1 {
  margin: 18px 0 13px;
  font-family: var(--serif);
  font-size: clamp(35px, 4.8vw, 50px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.error-message {
  max-width: 470px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 27px;
}

.error-ornament {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 55px;
}

.error-ornament span {
  width: 42px;
  height: 1px;
  background: var(--line);
}

.error-ornament b {
  color: var(--muted-light);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
}

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

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

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

.js .hero-title.reveal {
  transition-delay: 0.07s;
}

.js .hero-lede.reveal {
  transition-delay: 0.14s;
}

.js .hero-actions.reveal {
  transition-delay: 0.21s;
}

.js .index-card.reveal {
  transition-delay: 0.15s;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .article-aside {
    display: none;
  }

  .note-header {
    max-width: 720px;
  }

  .home-hero-inner {
    grid-template-columns: minmax(0, 1.3fr) 320px;
    gap: 52px;
  }

  .hero-title {
    font-size: clamp(52px, 7vw, 82px);
  }
}

@media (max-width: 1020px) {
  .home-hero-inner {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 36px;
  }

  .index-card {
    padding: 22px 21px 20px;
  }

  .home-hero::before {
    font-size: 130px;
  }

  .admin-nav {
    margin-left: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 126px;
  }

  .editor-workspace {
    grid-template-columns: minmax(0, 1fr) 285px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 72px;
  }

  .auth-shell {
    align-content: start;
    grid-template-columns: 1fr;
  }

  .auth-visual {
    height: 78px;
    min-height: 78px;
    padding: 22px 30px;
  }

  .auth-visual::before,
  .auth-visual::after,
  .auth-quote,
  .auth-art,
  .setup-steps,
  .auth-visual-foot {
    display: none;
  }

  .auth-brand {
    font-size: 16px;
  }

  .auth-brand .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .auth-panel {
    align-items: flex-start;
    min-height: calc(100vh - 78px);
    padding: 42px 28px 60px;
  }

  .auth-form-wrap {
    margin: 0 auto;
  }

  .auth-back {
    margin-bottom: 38px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-aside {
    position: static;
  }

  .library-table-head {
    display: none;
  }

  .library-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "note status"
      "meta meta"
      "actions actions";
    gap: 8px 16px;
    padding: 17px 20px;
  }

  .library-note {
    grid-area: note;
  }

  .library-status {
    grid-area: status;
  }

  .library-updated {
    grid-area: meta;
    padding-left: 17px;
  }

  .library-actions {
    grid-area: actions;
    justify-content: flex-start;
    padding-left: 17px;
  }

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

  .editor-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .side-details {
    grid-column: span 2;
  }

  .side-card-tips,
  .side-danger {
    grid-column: span 2;
  }

  .editor-topbar {
    top: var(--admin-header-h);
  }
}

@media (max-width: 820px) {
  .home-hero-inner {
    grid-template-columns: 1fr;
    gap: 46px;
    padding: 66px 0 56px;
  }

  .index-card {
    width: min(100%, 420px);
    transform: rotate(0.7deg);
  }

  .home-hero::before {
    top: 28px;
    font-size: 95px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .section-tools {
    width: 100%;
    justify-content: space-between;
    padding-bottom: 0;
  }

  .search-form {
    flex: 1;
    width: auto;
    max-width: 360px;
  }

  .featured-note {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 20px;
    padding: 30px 27px;
  }

  .featured-number {
    font-size: 32px;
  }

  .featured-arrow {
    display: none;
  }

  .note-grid {
    grid-template-columns: 1fr;
  }

  .note-card {
    min-height: 250px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .footer-links {
    justify-content: flex-start;
    padding-top: 0;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 7px;
  }

  .admin-header-inner {
    width: calc(100% - 40px);
  }

  .admin-brand-name {
    display: none;
  }

  .admin-nav {
    margin-left: 16px;
  }

  .admin-nav a {
    padding: 7px 9px;
  }

  .view-site-link {
    display: none;
  }

  .admin-main {
    width: calc(100% - 40px);
    padding-top: 32px;
  }

  .admin-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
  }

  .admin-search {
    width: 100%;
  }

  .editor-page .admin-main {
    width: calc(100% - 32px);
  }

  .editor-topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .editor-topbar-center {
    order: 3;
    width: 100%;
  }

  .editor-top-actions {
    margin-left: auto;
  }

  .editor-top-actions .button {
    min-height: 36px;
  }

  .editor-view-link {
    display: none;
  }

  .markdown-input {
    min-height: 480px;
    padding: 19px 18px;
  }

  .editor-title {
    font-size: 36px;
  }

  .note-main {
    padding-top: 30px;
  }

  .note-shell {
    width: calc(100% - 40px);
  }

  .breadcrumb {
    margin-bottom: 38px;
  }

  .note-header {
    margin-bottom: 42px;
  }

  .note-header h1 {
    font-size: clamp(38px, 7.4vw, 56px);
  }

  .note-deck {
    font-size: 16.5px;
  }

  .prose {
    font-size: 17.5px;
    line-height: 1.95;
  }

  .adjacent-notes {
    grid-template-columns: 1fr;
  }

  .adjacent-card:empty {
    display: none;
  }

  .adjacent-next {
    text-align: left;
  }

  .delete-card {
    padding: 30px 22px;
  }

  .settings-card {
    padding: 22px;
  }

  .preview-modal {
    padding: 0;
  }

  .preview-panel {
    width: 100%;
    height: 100vh;
    border: 0;
  }

  .preview-article {
    width: calc(100% - 44px);
    padding: 40px 0 60px;
  }
}

@media (max-width: 620px) {
  .header-inner {
    width: calc(100% - 36px);
  }

  .brand-sub {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .brand-name {
    font-size: 18px;
  }

  .main-nav {
    gap: 17px;
  }

  .main-nav > a {
    font-size: 10.5px;
  }

  .main-nav .nav-owner {
    padding: 6px 9px;
  }

  .home-hero-inner,
  .notes-section,
  .footer-inner {
    width: calc(100% - 36px);
  }

  .home-hero-inner {
    padding: 52px 0 46px;
  }

  .hero-title {
    font-size: 43px;
    line-height: 1.1;
  }

  .hero-lede {
    font-size: 15.5px;
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    margin-top: 30px;
  }

  .index-card {
    padding: 21px 20px 18px;
  }

  .notes-section {
    padding-top: 50px;
  }

  .section-head h2 {
    font-size: 34px;
  }

  .section-tools {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .search-form {
    width: 100%;
    max-width: none;
  }

  .tag-filter {
    margin-bottom: 30px;
  }

  .featured-note {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 26px 22px;
  }

  .featured-number {
    padding: 0 0 7px;
    border-right: 0;
    border-bottom: 1px solid rgba(244, 240, 230, 0.14);
    font-size: 22px;
  }

  .featured-content h3 {
    font-size: 28px;
  }

  .featured-read {
    width: 100%;
    margin-left: 0;
  }

  .note-card {
    min-height: 235px;
    padding: 23px 21px 20px;
  }

  .note-card h3 {
    font-size: 25px;
  }

  .note-card-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .page-caption {
    width: 100%;
    margin-left: 0;
  }

  .site-footer {
    margin-top: 68px;
    padding-top: 46px;
  }

  .footer-brand {
    gap: 13px;
  }

  .footer-seal {
    width: 40px;
    height: 40px;
    font-size: 21px;
  }

  .footer-title {
    font-size: 21px;
  }

  .note-shell {
    width: calc(100% - 36px);
  }

  .note-header h1 {
    font-size: clamp(31px, 9vw, 38px);
  }

  .note-meta {
    font-size: 8.5px;
  }

  .note-footer-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .prose {
    font-size: 17px;
    line-height: 1.92;
  }

  .prose h2 {
    font-size: 1.4em;
  }

  .prose blockquote {
    padding: 17px 20px 17px 24px;
  }

  .prose pre {
    margin-left: -6px;
    margin-right: -6px;
    padding: 18px 16px;
    font-size: 12px;
  }

  .code-copy {
    opacity: 1;
  }

  .auth-panel {
    padding: 32px 22px 50px;
  }

  .auth-form-wrap h2 {
    font-size: 36px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .admin-header-inner {
    width: calc(100% - 28px);
  }

  .admin-brand {
    gap: 8px;
  }

  .admin-brand-label {
    display: none;
  }

  .admin-nav {
    gap: 0;
    margin-left: 10px;
  }

  .admin-nav a {
    padding: 7px 8px;
    font-size: 10.5px;
  }

  .admin-nav a[href="/admin/notes/new"] {
    display: none;
  }

  .admin-header-actions {
    gap: 8px;
  }

  .logout-form {
    padding-left: 9px;
  }

  .admin-main {
    width: calc(100% - 28px);
    padding-bottom: 70px;
  }

  .admin-page-head h1 {
    font-size: 39px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    min-height: 118px;
    padding: 15px;
  }

  .stat-value {
    font-size: 35px;
  }

  .stat-value-text {
    font-size: 15px;
  }

  .stat-note {
    font-size: 8.5px;
  }

  .status-tabs {
    overflow-x: auto;
  }

  .status-tabs a {
    white-space: nowrap;
  }

  .library-heading {
    padding-left: 15px;
    padding-right: 15px;
  }

  .library-row {
    padding: 15px;
  }

  .library-updated,
  .library-actions {
    padding-left: 17px;
  }

  .library-actions {
    gap: 18px;
  }

  .edit-or-page .button {
    width: 100%;
  }

  .editor-page .admin-main {
    width: calc(100% - 24px);
    padding-top: 14px;
  }

  .editor-top-actions {
    gap: 5px;
  }

  .editor-top-actions .button {
    padding: 8px 11px;
    font-size: 10.5px;
  }

  .editor-top-actions .kbd {
    display: none;
  }

  .editor-title {
    font-size: 32px;
  }

  .editor-sidebar {
    grid-template-columns: 1fr;
  }

  .side-details,
  .side-card-tips,
  .side-danger {
    grid-column: auto;
  }

  .editor-toolbar {
    padding: 6px;
  }

  .toolbar-label,
  .toolbar-hint {
    display: none;
  }

  .markdown-input {
    min-height: 430px;
    padding: 16px 14px;
    font-size: 13px;
  }

  .editor-footnote {
    display: none;
  }

  .preview-article {
    width: calc(100% - 34px);
  }

  .delete-card {
    margin-top: 18px;
  }

  .delete-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .delete-actions .button,
  .delete-actions form {
    width: 100%;
  }

  .delete-actions form .button {
    width: 100%;
  }

  .settings-card {
    padding: 20px;
  }

  .settings-head .text-link {
    align-self: flex-start;
  }

  .error-top {
    width: calc(100% - 36px);
  }

  .error-top .brand-sub {
    display: none;
  }

  .flash {
    align-items: flex-start;
  }
}

@media (max-width: 400px) {
  .hero-title {
    font-size: 34px;
  }

  .main-nav {
    gap: 13px;
  }

  .main-nav .nav-owner {
    padding: 6px 7px;
  }

  .admin-brand-name {
    display: none;
  }
}

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

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Print ---------- */

@media print {
  @page {
    margin: 18mm;
  }

  body {
    color: #111;
    background: #fff;
    font-size: 11pt;
  }

  .paper-grain,
  .reading-progress,
  .site-header,
  .site-footer,
  .article-aside,
  .breadcrumb,
  .draft-banner,
  .note-footer-actions,
  .adjacent-notes,
  .skip-link,
  .note-tags {
    display: none !important;
  }

  .note-main,
  .note-shell,
  .article-layout {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .note-header {
    max-width: none;
    margin: 0 0 8mm;
  }

  .note-header h1 {
    font-size: 26pt;
    color: #000;
  }

  .prose {
    color: #111;
    font-size: 11pt;
    line-height: 1.75;
  }

  .prose a {
    color: #111;
    text-decoration: none;
  }

  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: var(--mono);
    font-size: 8pt;
    color: #555;
  }

  .prose pre {
    color: #111;
    background: #f1f1f1;
    border: 1px solid #ddd;
  }

  .prose pre code {
    color: #111;
  }

  .note-footer {
    margin-top: 12mm;
  }
}
