:root {
  --paper: #f1eee5;
  --paper-deep: #e7e1d5;
  --ink: #11100e;
  --muted: #6e695f;
  --line: rgba(17, 16, 14, .18);
  --line-strong: rgba(17, 16, 14, .42);
  --amber: #c96820;
  --amber-pale: #f1d4b9;
  --white: #fffdf8;
  --shadow: 0 24px 70px rgba(34, 27, 17, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% 8%, rgba(201, 104, 32, .14), transparent 24rem),
    radial-gradient(rgba(17, 16, 14, .16) .7px, transparent .8px),
    var(--paper);
  background-size: auto, 22px 22px, auto;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 58%, rgba(255,255,255,.3) 58% 59%, transparent 59%);
  opacity: .55;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }

.topbar {
  position: relative;
  z-index: 3;
  width: min(1360px, calc(100% - 64px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  font: 800 clamp(1.25rem, 2vw, 1.65rem)/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: -.07em;
}

.topbar nav { display: flex; align-items: center; gap: 22px; font-size: .78rem; letter-spacing: .08em; }
.topbar nav a { position: relative; padding: 10px 0; }
.topbar nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 4px; height: 1px; background: var(--amber); transition: right .25s ease; }
.topbar nav a:hover::after, .topbar nav a:focus-visible::after { right: 0; }
.topbar nav span { color: var(--amber); }

main { position: relative; z-index: 1; width: min(1360px, calc(100% - 64px)); margin: 0 auto; }

.page-intro {
  min-height: 410px;
  padding: 76px 0 58px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  align-items: end;
  gap: 9vw;
  border-bottom: 1px solid var(--line-strong);
}

.eyebrow { margin: 0 0 14px; color: var(--amber); font: 700 .68rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.page-intro h1 { margin: 0; max-width: 820px; font: 500 clamp(3.2rem, 6.4vw, 6.6rem)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
.blur-title { display: block; min-height: 1.96em; }
.blur-line { display: flex; width: max-content; max-width: 100%; white-space: nowrap; }
.blur-line-outline { color: transparent; -webkit-text-stroke: 1.4px var(--ink); }
.blur-word {
  display: inline-block;
  opacity: 1;
  filter: none;
  transform: none;
  will-change: transform, filter, opacity;
}
.blur-word + .blur-word { margin-left: .24em; }
.blur-title.is-prepared .blur-word {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(-24px);
}
.blur-title.is-active .blur-word {
  animation: blur-word-in .72s cubic-bezier(.2, .75, .22, 1) calc(var(--blur-index) * .115s) both;
}
.blur-title.is-settled .blur-word {
  opacity: 1;
  filter: none;
  transform: none;
  will-change: auto;
}
.intro-copy > p { margin: 0; max-width: 530px; color: #38342e; font-size: clamp(.98rem, 1.2vw, 1.08rem); line-height: 1.9; }
.intro-copy dl { margin: 38px 0 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.intro-copy dl div { padding: 16px 0 0; }
.intro-copy dt { color: var(--muted); font: 700 .62rem/1 ui-monospace, monospace; letter-spacing: .13em; }
.intro-copy dd { margin: 8px 0 0; font-size: .85rem; }

.guestbook-layout { display: grid; grid-template-columns: minmax(340px, .72fr) minmax(0, 1.28fr); gap: 0; border-bottom: 1px solid var(--line-strong); }
.composer { padding: 58px 54px 76px 0; border-right: 1px solid var(--line-strong); }
.message-stream { min-width: 0; padding: 58px 0 76px 54px; }
@media (min-width: 769px) and (min-height: 760px) { .composer { position: sticky; top: 0; align-self: start; } }

.panel-heading { display: flex; align-items: flex-start; gap: 20px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
.panel-heading h2 { margin: 0; font: 500 clamp(2rem, 3.3vw, 3rem)/1 Georgia, "Songti SC", serif; letter-spacing: -.045em; }
.panel-index { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 50%; font: 700 .63rem/1 ui-monospace, monospace; }

form { margin-top: 42px; }
.kind-picker { margin: 0; padding: 0; border: 0; }
.kind-picker legend { margin-bottom: 10px; color: var(--muted); font-size: .73rem; }
.kind-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind-picker legend { grid-column: 1 / -1; }
.kind-picker label { position: relative; cursor: pointer; }
.kind-picker input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.kind-picker label > span { min-height: 82px; display: flex; flex-direction: column; justify-content: center; padding: 13px 15px; border: 1px solid var(--line); background: rgba(255,253,248,.38); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.kind-picker strong { font-size: .88rem; }
.kind-picker small { margin-top: 7px; color: var(--muted); font-size: .67rem; line-height: 1.4; }
.kind-picker input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.kind-picker input:checked + span small { color: rgba(255,255,255,.65); }
.kind-picker input:focus-visible + span { outline: 3px solid var(--amber-pale); outline-offset: 3px; }

.privacy-note { min-height: 42px; margin: 13px 0 26px; padding: 11px 13px; border-left: 2px solid var(--amber); color: #534b41; background: rgba(201,104,32,.07); font-size: .7rem; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { margin-bottom: 20px; }
.field label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; font-size: .75rem; }
.field label span { color: var(--muted); font-size: .62rem; font-weight: 400; }
.field label b { color: var(--ink); font-weight: 600; }
.field input, .field textarea { width: 100%; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; padding: 12px 2px; color: var(--ink); background: transparent; outline: 0; }
.field textarea { min-height: 154px; resize: vertical; line-height: 1.75; }
.field input:focus, .field textarea:focus { border-color: var(--amber); box-shadow: 0 1px 0 var(--amber); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #a43627; }
.field-error { min-height: 16px; margin: 6px 0 0; color: #923828; font-size: .65rem; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.submit-button, .load-more { position: relative; overflow: hidden; border: 1px solid var(--ink); cursor: pointer; transition: transform .2s ease, color .2s ease, background .2s ease; }
.submit-button::before, .load-more::before { content: ""; position: absolute; inset: -120% 45% -120% -65%; transform: rotate(18deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.52), transparent); transition: transform .55s ease; }
.submit-button:hover::before, .load-more:hover::before { transform: translateX(280%) rotate(18deg); }
.submit-button { width: 100%; min-height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: var(--paper); background: var(--ink); font-weight: 650; }
.submit-button:hover { transform: translateY(-2px); }
.submit-button:disabled { cursor: wait; opacity: .58; transform: none; }
.form-status { min-height: 42px; margin: 13px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.form-status.success { color: #4f5e2f; }
.form-status.error { color: #923828; }

.stream-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.stream-heading > p { max-width: 180px; margin: 5px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.55; text-align: right; }
.message-card { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 22px; padding: 31px 0; border-bottom: 1px solid var(--line); animation: reveal .45s ease both; }
.message-avatar { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(255,253,248,.48); font: 600 1rem/1 Georgia, serif; }
.message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.message-name { font-weight: 700; font-size: .88rem; overflow-wrap: anywhere; }
.message-date { color: var(--muted); font: 600 .61rem/1 ui-monospace, monospace; letter-spacing: .08em; }
.message-content { margin: 15px 0 0; color: #292620; font-size: .92rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.owner-reply { margin-top: 22px; padding: 17px 19px; border-left: 2px solid var(--amber); background: rgba(255,253,248,.54); }
.reply-meta { display: flex; justify-content: space-between; gap: 15px; color: var(--amber); font: 700 .62rem/1.3 ui-monospace, monospace; letter-spacing: .08em; }
.reply-content { margin: 10px 0 0; color: #453e35; font-size: .82rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-state { padding: 78px 24px; text-align: center; border-bottom: 1px solid var(--line); }
.empty-state strong { display: block; font: 500 1.5rem/1.2 Georgia, serif; }
.empty-state span { display: block; margin-top: 9px; color: var(--muted); font-size: .75rem; }
.load-more { width: 100%; margin-top: 22px; min-height: 51px; background: transparent; }
.load-more:hover { color: var(--paper); background: var(--ink); }

footer { position: relative; z-index: 1; width: min(1360px, calc(100% - 64px)); min-height: 92px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font: 600 .61rem/1 ui-monospace, monospace; letter-spacing: .1em; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--amber-pale); outline-offset: 3px; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blur-word-in {
  0% { opacity: 0; filter: blur(10px); transform: translateY(-24px); }
  52% { opacity: .58; filter: blur(5px); transform: translateY(4px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@media (max-width: 960px) {
  .page-intro { grid-template-columns: 1fr; gap: 45px; }
  .intro-copy { max-width: 650px; }
  .guestbook-layout { grid-template-columns: minmax(300px, .88fr) minmax(0, 1.12fr); }
  .composer { padding-right: 34px; }
  .message-stream { padding-left: 34px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 768px) {
  .topbar, main, footer { width: min(100% - 36px, 680px); }
  .topbar { min-height: 70px; }
  .topbar nav a:not(:first-of-type), .topbar nav span { display: none; }
  .page-intro { min-height: 0; padding: 58px 0 48px; }
  .page-intro h1 { font-size: clamp(3rem, 13.5vw, 5.2rem); line-height: 1; }
  .guestbook-layout { display: block; }
  .composer { position: static; padding: 48px 0 58px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .message-stream { padding: 48px 0 58px; }
  .field-row { grid-template-columns: 1fr 1fr; gap: 18px; }
}

@media (max-width: 520px) {
  .page-intro h1 { font-size: clamp(2.2rem, 11vw, 3rem); line-height: 1.02; letter-spacing: -.055em; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .kind-picker { grid-template-columns: 1fr; }
  .kind-picker label > span { min-height: 68px; }
  .stream-heading { display: block; }
  .stream-heading > p { max-width: none; margin-top: 16px; text-align: left; }
  .message-card { grid-template-columns: 42px minmax(0, 1fr); gap: 14px; }
  .message-avatar { width: 40px; height: 40px; }
}

@media (max-width: 390px) {
  .topbar, main, footer { width: calc(100% - 28px); }
  .page-intro { padding-top: 46px; }
  .panel-heading { gap: 13px; }
  .panel-index { width: 30px; height: 30px; }
  .message-content { font-size: .87rem; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
}

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