:root {
  --bg: #f3eee6;
  --paper: #fffaf3;
  --ink: #1f1a16;
  --muted: #6d645c;
  --line: #e4d9cc;
  --accent: #c45c26;
  --accent-soft: #f3d9c8;
  --shadow: 0 10px 30px rgba(47, 32, 18, 0.06);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: "Telma-Variable", "Noto Sans SC", "PingFang SC", sans-serif;
  font-weight: 600;
  background:
    radial-gradient(1200px 500px at 10% -10%, #f8e7d6 0%, transparent 55%),
    radial-gradient(800px 400px at 100% 0%, #e8efe6 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: center;
}

.hero-copy {
  max-width: 640px;
  min-width: 0;
}

.portrait {
  position: relative;
  margin: 0;
  width: 210px;
}

.portrait img {
  display: block;
  width: 210px;
  height: 268px;
  object-fit: cover;
  object-position: 50% 8%;
  border-radius: 22px;
  border: 3px solid #fff8ee;
  box-shadow:
    0 18px 40px rgba(47, 32, 18, 0.18),
    0 0 0 1px rgba(196, 92, 38, 0.18);
  transform: rotate(2.2deg);
}

.portrait figcaption {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  font-family: "Telma-Variable", "Noto Serif SC", serif;
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 900;
  line-height: 1.15;
  margin: 12px 0 16px;
  letter-spacing: 0.02em;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  margin-bottom: 28px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.search:focus-within {
  border-color: #d29a72;
  box-shadow: var(--shadow), 0 0 0 3px rgba(196, 92, 38, 0.12);
}

.search svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}

.search input::placeholder {
  color: #9a9086;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 18px;
}

.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

.chip:hover {
  border-color: #cbb8a6;
  background: #fff;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
  min-height: 188px;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #d7c4b0;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card.is-featured {
  background:
    linear-gradient(165deg, #fff6ea 0%, #f8e4d0 55%, #fffaf3 100%);
  border-color: #e2b48a;
  box-shadow: 0 14px 36px rgba(196, 92, 38, 0.14);
}

.card.is-featured .badge {
  background: var(--ink);
  color: #fff6ea;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.badge {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card h2 {
  font-family: "Telma-Variable", "Noto Serif SC", serif;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
}

.card p {
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}

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

.tag {
  font-size: 12px;
  color: #7a7169;
  background: #f0e8dd;
  padding: 2px 8px;
  border-radius: 999px;
}

.go {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.empty {
  padding: 48px 8px;
  color: var(--muted);
}

.foot {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.foot code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #efe6da;
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--ink);
}

.copy {
  margin-top: 8px;
}


/* 实时时钟 */
.live-clock {
  margin-top: 18px;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 2px;
  background: rgba(255, 250, 243, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.live-clock-label { color: var(--muted); font-size: 12px; }
.live-clock strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.live-clock > span:last-child {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

/* 在线留言 */
.guestbook {
  margin-top: 56px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(255, 246, 234, 0.92), rgba(255, 250, 243, 0.96));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.guestbook-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; margin-bottom: 22px;
}
.guestbook h2 {
  font-family: "Telma-Variable", "Noto Serif SC", serif; font-size: 30px; font-weight: 900; line-height: 1.25;
  margin: 7px 0 8px;
}
.guestbook-intro { color: var(--muted); font-size: 14px; }
.online-dot {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  color: #537354; background: #eaf3e9; border: 1px solid #d3e5d1;
  border-radius: 999px; padding: 5px 10px; font-size: 12px;
}
.online-dot i {
  width: 7px; height: 7px; display: block; border-radius: 50%;
  background: #5d9b5e; box-shadow: 0 0 0 4px rgba(93, 155, 94, 0.12);
}
.message-form {
  padding: 18px; background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line); border-radius: 16px;
}
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 7px; }
.form-row label > span { font-size: 12px; color: var(--muted); }
.form-row input, .form-row textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 16px;
  outline: 0; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row input { padding: 10px 12px; }
.form-row textarea { min-height: 88px; padding: 10px 12px; resize: vertical; }
.form-row input:focus-visible, .form-row textarea:focus-visible {
  border-color: #d29a72; box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.09);
}
.form-actions {
  margin-top: 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.form-status { color: var(--muted); font-size: 12px; }
.form-status[data-type="warning"] { color: #9a6a1d; }
.form-status[data-type="error"] { color: #b1442d; }
.form-status[data-type="success"] { color: #4d7b50; }
.submit-message {
  border: 0; border-radius: 999px; padding: 9px 18px;
  background: var(--ink); color: #fffaf3; font: inherit; font-size: 14px;
  cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease;
}
.submit-message:hover:not(:disabled) { transform: translateY(-1px); }
.submit-message:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.submit-message:disabled { opacity: 0.55; cursor: wait; }
.messages { margin-top: 18px; display: grid; gap: 10px; }
.message-item {
  padding: 16px 18px; background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line); border-radius: 14px;
}
.message-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.message-top strong { font-size: 14px; }
.message-top time { color: #a0978e; font-size: 11px; white-space: nowrap; }
.message-item p {
  margin-top: 6px; color: var(--muted); font-size: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.messages-empty { padding: 20px 8px; color: var(--muted); font-size: 13px; }
.setup-hint {
  padding: 16px 18px; border-radius: 14px; background: #fff6e8;
  border: 1px solid #ecd8b8; color: #806a4d; font-size: 13px;
}
.setup-hint strong { display: block; color: var(--ink); margin-bottom: 4px; }
.setup-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1e3cf; padding: 1px 5px; border-radius: 5px; color: var(--ink);
}

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

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 24px;
  }

  .portrait {
    order: -1;
    width: 132px;
  }

  .portrait img {
    width: 132px;
    height: 168px;
    transform: rotate(1.4deg);
  }

  .portrait figcaption {
    margin-top: 10px;
  }

  .guestbook {
    padding: 20px;
  }
  .guestbook-head {
    flex-direction: column;
    gap: 12px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .live-clock {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(1080px, calc(100% - 28px));
    padding-top: 36px;
  }

  .card {
    min-height: 0;
  }
}

/* 留言板连接状态 */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: #806a4d;
  background: #fff6e8;
  border: 1px solid #ecd8b8;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}
.sync-status i {
  width: 7px;
  height: 7px;
  display: block;
  border-radius: 50%;
  background: currentColor;
}
.sync-status.success { color: #537354; background: #eaf3e9; border-color: #d3e5d1; }
.sync-status.error { color: #a53f32; background: #fff0ed; border-color: #f0c7c0; }
.message-contact { margin-top: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
