:root {
    --paper: #f4f1ea;
    --paper-light: #faf8f3;
    --ink: #20201e;
    --muted: #77736d;
    --faint: #aaa49a;
    --line: #d8d2c7;
    --accent: #a64032;
    --max-width: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background: linear-gradient(rgba(68, 62, 53, .025) 1px, transparent 1px), var(--paper);
    background-size: 100% 8px;
    font-family: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 15px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, textarea, input, select { font: inherit; }
button { color: inherit; }

.site-header {
    display: flex;
    width: min(calc(100% - 48px), var(--max-width));
    height: 90px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-family: Georgia, serif; letter-spacing: .04em; }
.brand__seal { display: grid; width: 34px; height: 34px; place-items: center; background: var(--accent); color: var(--paper-light); font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; }
.site-header nav { display: flex; align-items: center; gap: 30px; font-size: 15px; }
.site-header nav > a { color: var(--muted); }
.site-header nav > a:hover { color: var(--accent); }
.manage-button { padding: 9px 16px; border: 1px solid var(--ink); background: transparent; cursor: pointer; transition: background 180ms ease, color 180ms ease; }
.manage-button:hover { background: var(--ink); color: var(--paper-light); }
.logout-button { padding: 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.logout-button:hover { border-color: var(--accent); color: var(--accent); }

main { width: min(calc(100% - 48px), var(--max-width)); margin: 0 auto; }
.intro {
    position: relative;
    display: grid;
    min-height: 440px;
    grid-template-columns: 90px 1fr 220px;
    align-items: center;
    gap: 44px;
    border-bottom: 1px solid var(--ink);
}
.intro__index { display: flex; height: 190px; align-items: center; gap: 15px; color: var(--faint); font-family: Georgia, serif; font-size: 15px; letter-spacing: .18em; writing-mode: vertical-rl; }
.intro__index span:first-child { color: var(--accent); font-size: 15px; }
.intro__index i { width: 1px; height: 50px; background: var(--line); }
.eyebrow { margin: 0 0 15px; color: var(--accent); font-size: 15px; letter-spacing: .2em; }
.intro h1 { margin: 0; font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: clamp(72px, 10vw, 118px); font-weight: 500; letter-spacing: -.08em; line-height: 1; }
.intro__copy > p:last-child { margin: 25px 0 0; color: var(--muted); font-size: 15px; }
.intro__mark { position: relative; display: grid; width: 190px; height: 190px; place-items: center; justify-self: end; border: 1px solid var(--line); border-radius: 50%; }
.intro__mark::after { position: absolute; width: 120%; height: 1px; background: var(--accent); content: ""; transform: rotate(-28deg); }
.intro__mark > span { z-index: 1; padding: 0 8px; background: var(--paper); font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 72px; }
.intro__mark small { position: absolute; right: 18px; bottom: 18px; color: var(--muted); font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 15px; letter-spacing: .18em; line-height: 1.6; }

.feed { padding: 90px 0 120px; }
.feed__toolbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 44px; }
.feed__toolbar h2 { margin: 0; font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 34px; font-weight: 500; }
.feed__filters { display: flex; align-items: center; gap: 22px; color: var(--faint); font-size: 15px; }
.feed__filters button { padding: 3px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; cursor: pointer; }
.feed__filters button.is-active { border-color: var(--accent); color: var(--accent); }
.preview-notice, .publish-notice { margin-bottom: 24px; padding: 11px 15px; border-left: 2px solid var(--accent); background: rgba(166, 64, 50, .05); color: var(--muted); font-size: 15px; }
.publish-notice { border-color: #506b57; background: rgba(80, 107, 87, .07); color: #506b57; }
.manage-toolbar { display: flex; margin-bottom: 30px; padding: 16px 18px; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--accent); background: rgba(166, 64, 50, .04); }
.manage-toolbar > div { display: flex; flex-direction: column; }
.manage-toolbar strong { color: var(--accent); font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 15px; font-weight: 500; }
.manage-toolbar span { color: var(--muted); font-size: 15px; }
.manage-toolbar button { padding: 8px 13px; border: 1px solid var(--accent); background: var(--accent); color: white; cursor: pointer; }
.timeline { position: relative; padding-left: 72px; }
.timeline::before { position: absolute; top: 8px; bottom: 0; left: 18px; width: 1px; background: var(--line); content: ""; }
.timeline__empty { min-height: 180px; padding: 52px 0; color: var(--muted); font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 16px; }
.post { position: relative; display: grid; min-height: 190px; grid-template-columns: 150px 1fr; gap: 48px; padding: 0 0 54px; }
.post[data-hidden="true"] { display: none; }
.is-managing .post[data-hidden="true"] { display: grid; opacity: .5; }
.post::before { position: absolute; top: 8px; left: -59px; width: 11px; height: 11px; border: 3px solid var(--paper); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); content: ""; }
.post__date { margin: 0; font-family: Georgia, serif; }
.post__date strong { display: block; font-size: 34px; font-weight: 400; line-height: 1; }
.post__date span { color: var(--muted); font-size: 15px; letter-spacing: .12em; }
.post__body { padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.post__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--faint); font-size: 15px; }
.post__tag { padding: 2px 8px; border: 1px solid var(--line); color: var(--accent); }
.post__hidden-label { padding: 2px 8px; background: var(--ink); color: var(--paper-light); }
.post__content { max-width: 650px; margin: 0; font-size: 15px; line-height: 2; white-space: pre-wrap; }
.post__images { display: grid; max-width: 680px; margin-top: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.post__images.is-single { grid-template-columns: minmax(0, 520px); }
.post__images.is-three .post__image-button:first-child { grid-row: span 2; }
.post__images.is-three .post__image-button:first-child img { height: 100%; }
.post__image-button { display: block; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); background: #e8e3da; cursor: zoom-in; }
.post__image-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post__images img { display: block; width: 100%; aspect-ratio: 4 / 3; background: #e8e3da; object-fit: cover; transition: transform 260ms ease; }
.post__image-button:hover img { transform: scale(1.025); }
.post__images.is-single .post__image-button { max-width: 520px; }
.post__images.is-single img { aspect-ratio: auto; max-height: 560px; object-fit: contain; }
.post__time { display: block; margin-top: 20px; color: var(--faint); font-family: Georgia, serif; font-size: 15px; letter-spacing: .12em; }
.post__controls { display: none; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.is-managing .post__controls { display: flex; }
.post__controls button { padding: 6px 11px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.post__controls button:hover { border-color: var(--ink); color: var(--ink); }
.post__controls .delete-button:hover { border-color: var(--accent); color: var(--accent); }

.site-footer { display: flex; width: min(calc(100% - 48px), var(--max-width)); min-height: 150px; margin: 0 auto; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.site-footer p { margin: 0; }
.site-footer p span { color: var(--accent); }
.site-footer a:hover { color: var(--accent); }

.composer { width: min(calc(100% - 32px), 620px); padding: 0; border: 1px solid var(--ink); background: var(--paper-light); color: var(--ink); box-shadow: 0 24px 80px rgba(32, 32, 30, .18); }
.composer::backdrop { background: rgba(32, 32, 30, .48); backdrop-filter: blur(3px); }
.composer form { padding: 32px; }
.composer__heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.composer__heading p { margin: 0; color: var(--accent); font-family: Georgia, serif; font-size: 15px; letter-spacing: .2em; }
.composer__heading h2 { margin: 3px 0 0; font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; font-size: 30px; font-weight: 500; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: transparent; font-size: 22px; cursor: pointer; }
.composer label { display: block; color: var(--muted); font-size: 15px; }
.composer textarea, .composer input, .composer select { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); outline: none; }
.composer textarea { padding: 14px; resize: vertical; }
.composer input, .composer select { height: 42px; padding: 0 11px; }
.composer textarea:focus, .composer input:focus, .composer select:focus { border-color: var(--accent); }
.image-upload { margin-top: 18px; }
.image-upload__heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.image-upload__heading > span { color: var(--faint); font-size: 15px; }
.image-upload__button { display: inline-flex !important; width: fit-content; padding: 7px 12px; border: 1px solid var(--line); color: var(--ink) !important; cursor: pointer; transition: border-color 180ms ease, color 180ms ease; }
.image-upload__button:hover { border-color: var(--accent); color: var(--accent) !important; }
.image-upload > input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.image-preview { display: grid; margin-top: 12px; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.image-preview:empty { display: none; }
.image-preview__item { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.image-preview__item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-preview__remove { position: absolute; top: 5px; right: 5px; display: grid; width: 24px; height: 24px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: rgba(32, 32, 30, .82); color: white; cursor: pointer; line-height: 1; }
.image-error { margin: 8px 0 0; color: var(--accent); font-size: 15px; }
.publish-error { margin: 16px 0 -5px; padding: 9px 11px; border-left: 2px solid var(--accent); background: rgba(166, 64, 50, .05); color: var(--accent); font-size: 15px; }
.composer__meta { display: grid; margin-top: 18px; grid-template-columns: 1fr 1fr; gap: 16px; }
.composer__footer { display: flex; align-items: center; justify-content: space-between; margin-top: 26px; color: var(--faint); font-size: 15px; }
.composer__footer b { font-weight: 400; }
.publish-button { padding: 11px 20px; border: 1px solid var(--accent); background: var(--accent); color: white; cursor: pointer; }
.publish-button:disabled { opacity: .55; cursor: wait; }

.image-viewer { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(18, 18, 17, .96); color: white; }
.image-viewer[open] { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; }
.image-viewer::backdrop { background: rgba(18, 18, 17, .72); }
.image-viewer figure { display: grid; width: 100%; height: 100%; margin: 0; padding: 48px 16px 26px; place-items: center; grid-template-rows: 1fr auto; gap: 15px; }
.image-viewer img { display: block; max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; }
.image-viewer figcaption { color: rgba(255, 255, 255, .58); font-family: Georgia, serif; font-size: 15px; letter-spacing: .15em; }
.image-viewer__close { position: fixed; top: 20px; right: 22px; z-index: 2; width: 42px; height: 42px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%; background: transparent; color: white; font-size: 25px; cursor: pointer; }
.image-viewer__nav { width: 48px; height: 48px; justify-self: center; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; background: transparent; color: white; cursor: pointer; }
.image-viewer__nav:disabled { opacity: .2; cursor: default; }

@media (max-width: 720px) {
    .site-header, main, .site-footer { width: min(calc(100% - 32px), var(--max-width)); }
    .site-header nav > a { display: none; }
    .intro { min-height: 390px; grid-template-columns: 45px 1fr; gap: 22px; }
    .intro__mark { display: none; }
    .intro h1 { font-size: 78px; }
    .feed { padding: 70px 0 90px; }
    .timeline { padding-left: 42px; }
    .timeline::before { left: 8px; }
    .post { grid-template-columns: 1fr; gap: 20px; padding-bottom: 38px; }
    .post::before { left: -39px; }
    .post__date strong { display: inline; margin-right: 8px; font-size: 25px; }
    .post__body { padding-bottom: 30px; }
    .post__images { grid-template-columns: 1fr 1fr; }
    .manage-toolbar { align-items: flex-start; flex-direction: column; }
    .composer form { padding: 24px; }
    .image-upload__heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .image-viewer[open] { grid-template-columns: 48px 1fr 48px; }
    .image-viewer figure { padding: 60px 4px 22px; }
    .image-viewer__nav { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
