:root {
  color-scheme: light;
  --background: #f5f5f7;
  --surface: #ffffff;
  --material: rgba(255, 255, 255, 0.72);
  --liquid: rgba(255, 255, 255, 0.48);
  --liquid-edge: rgba(255, 255, 255, 0.8);
  --liquid-highlight: rgba(255, 255, 255, 0.58);
  --text: #20231f;
  --muted: #68706a;
  --line: rgba(29, 29, 31, 0.13);
  --accent: #2e6094;
  --scrim: rgba(0, 0, 0, 0.28);
  --reader-shadow: 0 24px 76px rgba(0, 0, 0, 0.2);
  font: 100%/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  background: #151914;
  --background: #000000;
  --surface: #1c1c1e;
  --material: rgba(28, 28, 30, 0.78);
  --liquid: rgba(36, 37, 40, 0.56);
  --liquid-edge: rgba(255, 255, 255, 0.17);
  --liquid-highlight: rgba(255, 255, 255, 0.12);
  --text: #eff0e9;
  --muted: #b5b7ad;
  --line: rgba(235, 235, 245, 0.16);
  --accent: #93b9e7;
  --scrim: rgba(0, 0, 0, 0.54);
  --reader-shadow: 0 24px 76px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { background: #e7ebc6; scroll-behavior: smooth; }
body { position: relative; min-height: 100vh; margin: 0; isolation: isolate; background: transparent; color: var(--text); transition: color 220ms ease; }
body::before, body::after { position: fixed; z-index: 0; pointer-events: none; content: ""; }
body::before { inset: 0; background: #c96d62; clip-path: polygon(0 0, 25% 0, 15% 21%, 0 34%); }
body::after { inset: 0; background: #6479b4; clip-path: polygon(100% 71%, 100% 100%, 78% 100%, 89% 87%); }
:root[data-theme="dark"] body::before { background: #4e3432; }
:root[data-theme="dark"] body::after { background: #2d3958; }
body.reader-active, body.chat-active { overflow: hidden; }
button, a { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }

.site-header { position: sticky; top: 0; z-index: 4; padding-top: 10px; pointer-events: none; }
.navigation { position: relative; display: flex; height: 52px; align-items: center; justify-content: space-between; overflow: hidden; padding: 0 20px; border: 1px solid var(--liquid-edge); border-radius: 18px; background: var(--liquid); box-shadow: 0 8px 24px rgba(26, 34, 35, 0.08), inset 0 1px 0 var(--liquid-highlight); backdrop-filter: blur(24px) saturate(170%); pointer-events: auto; transition: background 220ms ease, box-shadow 220ms ease, transform 220ms ease; }
.navigation::before { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(112deg, rgba(255, 255, 255, 0.36), transparent 36%, rgba(255, 255, 255, 0.14)); content: ""; }
.site-header.is-elevated .navigation { background: color-mix(in srgb, var(--liquid) 84%, var(--surface)); box-shadow: 0 12px 30px rgba(26, 34, 35, 0.14), inset 0 1px 0 var(--liquid-highlight); transform: translateY(1px); }
.navigation > * { position: relative; z-index: 1; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-size: 0.94rem; font-weight: 750; letter-spacing: 0.045em; }
.brand picture { display: block; width: 28px; height: 28px; }
.brand-mark { width: 28px; height: 28px; display: block; border-radius: 5px; object-fit: contain; }
.nav-actions { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 0.9rem; }
.nav-actions a:hover { color: var(--text); }
.text-button { min-width: 46px; border: 1px solid transparent; border-radius: 999px; padding: 6px 10px; background: transparent; transition: background 180ms ease, border-color 180ms ease; }
.text-button:hover { border-color: var(--liquid-edge); background: rgba(255, 255, 255, 0.18); }

main, .site-footer { position: relative; z-index: 1; }
main { padding: 64px 0 84px; }
.intro { display: grid; grid-template-columns: minmax(0, 700px) minmax(180px, 1fr); column-gap: clamp(42px, 7vw, 92px); align-items: end; }
.eyebrow { margin: 0 0 11px; color: var(--accent); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 710px; margin-bottom: 20px; font-size: clamp(2.35rem, 4vw, 3.9rem); font-weight: 640; line-height: 1.14; letter-spacing: -0.025em; }
.intro > .eyebrow, .intro > h1, .intro > p:nth-of-type(2) { grid-column: 1; }
.signature { max-width: 650px; font-family: "Songti SC", "STSong", "SimSun", serif; font-weight: 600; letter-spacing: 0.01em; line-height: 1.24; }
h2 { margin-bottom: 10px; font-size: clamp(1.6rem, 2.6vw, 2.15rem); font-weight: 650; line-height: 1.22; letter-spacing: -0.015em; }
.intro > p:nth-of-type(2) { max-width: 560px; margin-bottom: 48px; color: var(--muted); font-size: 1rem; line-height: 1.75; }
.profile-line { display: grid; grid-column: 2; grid-row: 1 / span 3; align-self: end; gap: 9px; margin: 0 0 48px; padding: 2px 0 2px 15px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 0.82rem; letter-spacing: 0.015em; scroll-margin-top: 88px; }

.featured-post { border-bottom: 1px solid var(--line); }
.featured-media { width: 100%; aspect-ratio: 16 / 7; border: 1px solid rgba(255, 255, 255, 0.38); border-radius: 6px; background-position: center; background-size: cover; box-shadow: 0 18px 40px rgba(27, 37, 35, 0.12); }
.featured-copy { display: grid; grid-template-columns: 172px minmax(0, 620px); column-gap: 34px; padding: 25px 0 34px; }
.post-meta { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.featured-copy .post-meta { grid-row: 1 / span 3; padding-top: 5px; }
.featured-copy h2 { grid-column: 2; margin-bottom: 8px; }
.featured-copy > p:last-of-type { grid-column: 2; margin-bottom: 20px; color: var(--muted); }
.featured-copy .primary-button { grid-column: 2; justify-self: start; }
.primary-button { border: 1px solid rgba(255, 255, 255, 0.52); border-radius: 999px; padding: 10px 17px; color: #fff; background: linear-gradient(to bottom, #3aa2ff, #0071e3); box-shadow: 0 7px 17px rgba(0, 113, 227, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.52); font-size: 0.9rem; font-weight: 650; transition: filter 160ms ease, transform 100ms ease, box-shadow 160ms ease; }
.primary-button:hover { box-shadow: 0 10px 22px rgba(0, 113, 227, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.62); filter: brightness(1.06); }

.essay-section { margin-top: 63px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 1.55rem; }
.section-heading span { color: var(--muted); font-size: 0.85rem; }
.post-list { border-top: 1px solid var(--line); }
.post-card { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 22px; align-items: center; margin: 0 -14px; padding: 18px 14px; border-bottom: 1px solid var(--line); border-radius: 8px; transition: background 180ms ease, box-shadow 180ms ease; }
.post-card:hover { background: var(--liquid); box-shadow: inset 0 1px 0 var(--liquid-highlight); }
.post-card-media { width: 150px; height: 96px; border-radius: 5px; background-position: center; background-size: cover; }
.post-card-copy h3 { margin: 2px 0 6px; font-size: 1.14rem; font-weight: 660; line-height: 1.3; letter-spacing: -0.01em; }
.post-card-copy p:last-child { margin: 0; color: var(--muted); font-size: 0.93rem; }
.link-button { padding: 8px 0 8px 10px; border: 0; color: var(--accent); background: transparent; font-size: 0.88rem; font-weight: 650; white-space: nowrap; }

.newsletter { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-top: 70px; padding: 31px; border: 1px solid var(--liquid-edge); border-radius: 8px; background: var(--liquid); box-shadow: inset 0 1px 0 var(--liquid-highlight), 0 14px 32px rgba(26, 34, 35, 0.07); backdrop-filter: blur(18px) saturate(150%); }
.newsletter h2 { margin-bottom: 7px; font-size: 1.4rem; }
.newsletter p:last-child { margin: 0; color: var(--muted); }
.site-footer { padding-bottom: 42px; color: var(--muted); font-size: 0.82rem; }

.scrim { position: fixed; inset: 0; z-index: 10; opacity: 0; pointer-events: none; background: var(--scrim); transition: opacity 180ms ease; }
.scrim.is-visible { opacity: 1; pointer-events: auto; }
.reader { --drawer-y: 110%; --origin-x: 50%; position: fixed; right: 0; bottom: 0; left: 0; z-index: 11; display: flex; width: min(760px, calc(100% - 32px)); max-height: min(78vh, 680px); margin: auto; flex-direction: column; overflow: auto; border: 1px solid var(--liquid-edge); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--liquid); box-shadow: var(--reader-shadow), inset 0 1px 0 var(--liquid-highlight); backdrop-filter: blur(32px) saturate(185%); opacity: 0; pointer-events: none; transform: translate3d(0, var(--drawer-y), 0); transform-origin: var(--origin-x) 100%; will-change: transform; }
.reader::before { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(112deg, rgba(255, 255, 255, 0.2), transparent 33%); content: ""; }
.reader > * { position: relative; z-index: 1; }
.reader.is-open { opacity: 1; pointer-events: auto; }
.reader-grip { display: flex; height: 30px; flex: 0 0 auto; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.reader-grip span { width: 38px; height: 5px; border-radius: 999px; background: var(--muted); opacity: 0.5; }
.reader-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 30px 14px; touch-action: none; }
.reader-header .eyebrow { margin: 0; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--liquid-edge); border-radius: 50%; background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 1px 0 var(--liquid-highlight); font-size: 1.45rem; line-height: 1; }
.reader-content { padding: 12px 30px 42px; }
.reader-content h2 { max-width: 610px; margin-bottom: 11px; font-size: clamp(2rem, 4.2vw, 3.1rem); }
.reader-content .post-meta { margin-bottom: 28px; }
.reader-content p { max-width: 610px; margin-bottom: 1.15em; color: var(--muted); font-size: 1.04rem; line-height: 1.75; }

.chat-launcher { position: fixed; right: 26px; bottom: 26px; z-index: 8; display: grid; width: 54px; height: 54px; place-items: center; border: 1px solid var(--liquid-edge); border-radius: 12px; background: var(--liquid); box-shadow: 0 12px 28px rgba(26, 34, 35, 0.16), inset 0 1px 0 var(--liquid-highlight); backdrop-filter: blur(20px) saturate(160%); transition: transform 180ms ease, box-shadow 180ms ease; }
.chat-launcher:hover { box-shadow: 0 16px 34px rgba(26, 34, 35, 0.22), inset 0 1px 0 var(--liquid-highlight); transform: translateY(-2px); }
.chat-launcher svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 12; }
.chat-launcher circle { fill: #c96d62; stroke: none; }
.chat-launcher::after { position: absolute; right: 0; bottom: calc(100% + 9px); width: max-content; padding: 6px 8px; border: 1px solid var(--liquid-edge); border-radius: 5px; background: var(--surface); color: var(--text); content: attr(data-tooltip); font-size: 0.76rem; opacity: 0; pointer-events: none; transform: translateY(3px); transition: opacity 150ms ease, transform 150ms ease; }
.chat-launcher:hover::after, .chat-launcher:focus-visible::after { opacity: 1; transform: translateY(0); }
.chat-scrim { position: fixed; inset: 0; z-index: 12; opacity: 0; pointer-events: none; background: var(--scrim); transition: opacity 180ms ease; }
.chat-scrim.is-visible { opacity: 1; pointer-events: auto; }
.chat-panel { position: fixed; right: 24px; bottom: 24px; z-index: 13; display: flex; width: min(420px, calc(100% - 48px)); height: min(650px, calc(100vh - 48px)); flex-direction: column; overflow: hidden; border: 1px solid var(--liquid-edge); border-radius: 8px; background: var(--liquid); box-shadow: var(--reader-shadow), inset 0 1px 0 var(--liquid-highlight); backdrop-filter: blur(28px) saturate(180%); opacity: 0; pointer-events: none; transform: translate3d(0, 24px, 0) scale(0.98); transform-origin: right bottom; transition: opacity 180ms ease, transform 260ms cubic-bezier(.2,.8,.2,1); }
.chat-panel.is-open { opacity: 1; pointer-events: auto; transform: translate3d(0, 0, 0) scale(1); }
.chat-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.chat-identity { display: flex; align-items: center; gap: 11px; }
.chat-mark { width: 38px; height: 38px; fill: none; stroke: var(--text); stroke-linecap: round; stroke-linejoin: round; stroke-width: 12; }
.chat-mark circle { fill: #c96d62; stroke: none; }
.chat-identity h2 { margin: 0; font-size: 1rem; letter-spacing: 0; }
.chat-identity p { margin: 2px 0 0; color: var(--muted); font-size: 0.76rem; }
.chat-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 12px; overflow-y: auto; padding: 18px 16px; }
.chat-message { max-width: 84%; padding: 10px 12px; border-radius: 8px; font-size: 0.92rem; line-height: 1.55; }
.chat-message.assistant { align-self: flex-start; border: 1px solid var(--liquid-edge); background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 1px 0 var(--liquid-highlight); }
.chat-message.user { align-self: flex-end; color: #fff; background: var(--accent); }
.chat-message.is-pending { color: var(--muted); font-size: 0.82rem; }
.chat-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.chat-form input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 7px; outline: none; padding: 10px 11px; color: var(--text); background: rgba(255, 255, 255, 0.18); }
.chat-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.chat-send { border: 0; border-radius: 7px; padding: 0 13px; color: #fff; background: var(--accent); font-size: 0.86rem; font-weight: 650; }
.chat-send:disabled { cursor: wait; opacity: 0.58; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:active { transform: scale(0.97); }

@media (min-width: 761px) and (max-width: 1100px) {
  .shell { width: min(100% - 64px, 920px); }
  main { padding-top: 56px; }
  h1 { max-width: 660px; font-size: clamp(2.8rem, 5.5vw, 3.75rem); }
  .intro { grid-template-columns: minmax(0, 1fr) 182px; column-gap: 38px; }
  .intro > p:nth-of-type(2) { max-width: 540px; margin-bottom: 43px; }
  .profile-line { margin-bottom: 42px; }
  .featured-media { aspect-ratio: 1.8 / 1; }
  .featured-copy { grid-template-columns: 132px minmax(0, 1fr); column-gap: 24px; padding-bottom: 29px; }
  .post-card { grid-template-columns: 128px minmax(0, 1fr) auto; gap: 18px; }
  .post-card-media { width: 128px; height: 88px; }
  .newsletter { margin-top: 58px; padding: 28px; }
  .reader { width: min(690px, calc(100% - 64px)); max-height: 80vh; }
  .reader-content { padding-right: 26px; padding-left: 26px; }
  body::before { clip-path: polygon(0 0, 20% 0, 12% 17%, 0 29%); }
  body::after { clip-path: polygon(100% 75%, 100% 100%, 75% 100%, 88% 87%); }
}

@media (max-width: 760px) {
  body::before, body::after { position: absolute; inset: auto; }
  body::before { top: 0; right: 0; left: 0; height: 430px; }
  body::after { right: 0; bottom: 0; left: 0; height: 460px; }
  .shell { width: min(100% - 28px, 1040px); }
  .navigation { padding: 0 14px; box-shadow: 0 5px 14px rgba(26, 34, 35, 0.08), inset 0 1px 0 var(--liquid-highlight); backdrop-filter: blur(12px) saturate(125%); }
  .nav-actions a { display: none; }
  main { padding-top: 50px; }
  .intro { display: block; }
  h1 { font-size: clamp(2.3rem, 10vw, 3.1rem); line-height: 1.16; }
  .signature { line-height: 1.27; }
  .profile-line { display: grid; gap: 6px; margin: -26px 0 38px; padding-top: 11px; font-size: 0.78rem; }
  .featured-media { aspect-ratio: 1.35 / 1; }
  .featured-copy { display: block; padding: 20px 0 30px; }
  .featured-copy .post-meta { padding: 0; margin-bottom: 11px; }
  .featured-copy > p:last-of-type { margin-bottom: 18px; }
  .post-card { grid-template-columns: 100px minmax(0, 1fr); gap: 14px; }
  .post-card-media { width: 100px; height: 84px; }
  .link-button { grid-column: 2; justify-self: start; padding: 0; }
  .newsletter { grid-template-columns: 1fr; gap: 18px; padding: 26px; backdrop-filter: none; box-shadow: inset 0 1px 0 var(--liquid-highlight); }
  .reader { width: 100%; max-height: 84vh; border-right: 0; border-left: 0; backdrop-filter: blur(18px) saturate(145%); }
  .reader-header { padding-right: 20px; padding-left: 20px; }
  .reader-content { padding: 10px 20px 34px; }
  .chat-launcher { right: 16px; bottom: 16px; width: 50px; height: 50px; backdrop-filter: blur(12px) saturate(125%); }
  .chat-panel { right: 0; bottom: 0; width: 100%; height: min(78vh, 620px); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 8px 8px 0 0; transform-origin: center bottom; }
  .chat-header { min-height: 70px; }
  body::before { clip-path: polygon(0 0, 35% 0, 18% 17%, 0 27%); }
  body::after { clip-path: polygon(100% 78%, 100% 100%, 63% 100%, 82% 89%); }
}

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

@media (prefers-reduced-transparency: reduce) {
  .navigation, .newsletter, .reader, .chat-launcher, .chat-panel { background: var(--surface); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  .site-header, .reader, .post-card { border-color: var(--text); }
}
