:root {
  --bg: #201e1d;
  --panel: #2a2725;
  --panel-2: #242220;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f0ec;
  --text-dim: #a8a49d;
  --text-mute: #6f6b65;
  --accent: #ec3013;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Noto Serif SC", "Source Serif 4", Georgia, "Songti SC", serif;
}

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

html, body { background: var(--bg); color: var(--text); }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a { color: inherit; }

/* nav */

.nav {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  z-index: 10;
}

.nav button {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  writing-mode: vertical-rl;
  transition: color 0.15s;
}

.nav button:hover,
.nav button.active {
  color: var(--text);
}

.nav .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.nav-compose {
  font-size: 12px;
  color: var(--text-mute);
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}

.nav-compose:hover {
  opacity: 1;
  color: var(--accent);
}

@media (max-width: 860px) {
  #app { padding-top: 72px; }
}

/* shelf */

.shelf {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shelf-hero {
  position: relative;
  background: repeating-linear-gradient(135deg, #2c2926, #2c2926 10px, #262421 10px, #262421 20px);
  background-size: cover;
  background-position: center;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 40vh;
}

@media (max-width: 860px) {
  .shelf-hero { min-height: 34vh; }
}

.shelf-hero-top {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.85);
}

/* The fixed nav floats over this corner. Above 860px the two share a band and
   the nav's dot lands on 更换封面; below it #app's 72px top padding already
   clears the nav, so the offset would only add dead space. */
@media (min-width: 861px) {
  .shelf-hero-top { margin-top: 36px; }
}

.cover-btn {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cover-btn:hover { color: var(--text); }

.shelf-hero-title {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 500;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.shelf-hero-sub {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.85);
}

.shelf-hero-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.85);
}

.shelf-list {
  padding: 32px;
}

.shelf-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.shelf-list-label {
  font-size: 11px;
  color: var(--text-mute);
}

.shelf-list-intro {
  margin-top: 8px;
  color: var(--text-dim);
}

.shelf-rows {
  column-width: 320px;
  column-gap: 40px;
}

.entry-row-title {
  transition: color 0.15s;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  break-inside: avoid;
}

.entry-row:hover .entry-row-title { color: var(--accent); }

.entry-row.pinned .entry-row-title { color: var(--text); }

.entry-row-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  width: 28px;
  flex: none;
}

.entry-row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-row-pin {
  flex: none;
  font-size: 11px;
  color: var(--accent);
}

.entry-row-author {
  flex: none;
  font-size: 11px;
  color: var(--text-dim);
}

.entry-row-type {
  flex: none;
  font-size: 11px;
  color: var(--text-mute);
}

/* memory */

.memory {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .memory { grid-template-columns: 1fr; }
}

.memory-sidebar {
  padding: 32px 24px;
  border-right: 1px solid var(--line);
}

.memory-search {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 4px;
}

.memory-section-label {
  margin: 24px 0 10px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}

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

.chip {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
}

.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(236, 48, 19, 0.1);
}

.memory-count {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-mute);
}

.memory-main {
  padding: 32px;
  overflow-y: auto;
}

.memory-month-label {
  font-size: 11px;
  color: var(--text-mute);
  margin: 24px 0 6px;
}

.memory-month-label:first-child { margin-top: 0; }

.memory-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.memory-row:hover .entry-row-title { color: var(--accent); }

.memory-row-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  width: 34px;
  flex: none;
  white-space: nowrap;
}

.memory-row-type {
  font-size: 11px;
  color: var(--text-mute);
  width: 40px;
  flex: none;
  white-space: nowrap;
}

.memory-row .entry-row-title {
  min-width: 30%;
}

.memory-row-tags {
  font-size: 11px;
  color: var(--text-mute);
  flex: 0 1 auto;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Below ~560px there isn't room for date + type + title + tags on one line
   without the fixed-width columns shrinking and wrapping ("笔记" splitting
   into two lines), which throws off every row's title start position. Give
   the title its own full-width line instead so titles line up consistently. */
@media (max-width: 560px) {
  .memory-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .memory-row .entry-row-title {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
  }

  .memory-row-tags {
    order: 4;
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.empty-state {
  padding: 60px 0;
  color: var(--text-dim);
}

.empty-state a { color: var(--accent); }

/* musings */

.musings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  cursor: pointer;
}

@media (max-width: 860px) {
  .musings { grid-template-columns: 1fr; }
  .musings-visual { min-height: 45vh; }
}

.musings-visual {
  background: var(--panel);
}

.musings-visual.bg-stripes {
  background: repeating-linear-gradient(45deg, #37332f, #37332f 8px, #2c2926 8px, #2c2926 16px);
}

.musings-visual.bg-photo {
  background-size: cover;
  background-position: center;
}

.musings-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.entry-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.entry-title {
  margin: 12px 0 16px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
}

.entry-author {
  display: inline-block;
  margin: -10px 0 16px;
  font-size: 12px;
  color: var(--text-mute);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.entry-author:hover { color: var(--text); }

.entry-body {
  color: var(--text-dim);
  max-width: 46ch;
  white-space: pre-wrap;
}

.entry-tags {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-mute);
}

.musings-hint {
  margin-top: 28px;
  font-size: 11px;
  color: var(--text-mute);
}

/* about */

.about {
  max-width: 520px;
  padding: 80px 32px;
}

.about-kicker {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}

.about-lead {
  margin: 16px 0 28px;
  font-size: 16px;
  line-height: 1.6;
}

.about p { color: var(--text-dim); margin-bottom: 14px; }

.about-authors {
  margin-top: 32px;
  border-top: 1px solid var(--line);
}

.about-author {
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.about-author-row {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  margin-top: 16px;
}

.about-author-photo {
  width: 208px;
  flex: 0 0 208px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--line);
  filter: grayscale(1);
}

.about-author-name {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.about-author-role {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-mute);
}

.about-author-row p {
  font-size: 13px;
  line-height: 1.7;
  max-width: 60ch;
}

.about-author.highlight .about-author-photo {
  filter: grayscale(0);
  transition: filter 0.6s ease;
}

@media (max-width: 560px) {
  .about-author-row { flex-direction: column; gap: 16px; }
  .about-author-photo { width: 156px; flex-basis: auto; }
}

.about-meta {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.about-meta-label {
  font-size: 11px;
  color: var(--text-mute);
}

.about-meta-value { margin-top: 4px; }

.about-links a {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
}

.about-links a:hover { color: var(--accent); }

/* entry detail */

.entry-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .entry-view { grid-template-columns: 1fr; }
  .entry-view-visual { min-height: 45vh; }
}

.entry-view.no-photo { grid-template-columns: 1fr; }

.entry-view-visual {
  background: var(--panel);
  background-size: cover;
  background-position: center;
}

.entry-view-visual.bg-stripes {
  background-image: repeating-linear-gradient(45deg, #37332f, #37332f 8px, #2c2926 8px, #2c2926 16px);
}

.entry-view-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 640px;
}

.entry-nav {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-mute);
}

.entry-nav button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.entry-nav button:hover { border-color: var(--accent); color: var(--accent); }

.entry-nav-links {
  display: flex;
  gap: 10px;
  margin-left: 8px;
}

.entry-nav-links button:not([style*="border"]) {
  border: none;
  width: auto;
  height: auto;
}

/* travel journal entry */

.travel-entry {
  max-width: 900px;
  margin: 0 auto;
}

.travel-hero {
  position: relative;
  min-height: 76vh;
  background: var(--panel);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}

.travel-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 8, 0.05) 0%, rgba(10, 9, 8, 0.05) 45%, rgba(10, 9, 8, 0.92) 100%);
  pointer-events: none;
}

.travel-hero-inner {
  position: relative;
  z-index: 1;
  padding: 40px 40px 44px;
  width: 100%;
}

.travel-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.travel-title {
  margin: 14px 0 10px;
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.15;
  font-weight: 600;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.travel-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--text-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.travel-hero-caption {
  margin-top: 16px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-mute);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.travel-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 22px 40px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-mute);
}

.travel-byline a {
  display: inline;
  margin: 0;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.travel-byline a:hover { color: var(--accent); }

.travel-article {
  padding: 48px 40px 8px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.travel-article p {
  margin-bottom: 24px;
}

.travel-article p:first-of-type::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: 0.85;
  padding: 0.05em 0.08em 0 0;
  font-weight: 700;
  color: var(--text);
}

.travel-gallery-label {
  margin: 16px 40px 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.travel-gallery {
  padding: 20px 40px 48px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.travel-gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.travel-gallery-item img:hover { opacity: 0.88; }

.travel-gallery-item figcaption {
  margin: 10px 2px 0;
  font-family: var(--sans);
  font-size: 12px;
  font-style: italic;
  color: var(--text-mute);
}

@media (max-width: 640px) {
  .travel-hero { min-height: 56vh; }
  .travel-hero-inner,
  .travel-byline,
  .travel-article {
    padding-left: 22px;
    padding-right: 22px;
  }
  .travel-gallery-label { margin-left: 22px; margin-right: 22px; }
  .travel-gallery {
    grid-template-columns: 1fr;
    padding-left: 22px;
    padding-right: 22px;
  }
}

/* travel photo lightbox */

.travel-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  background: rgba(10, 9, 8, 0.92);
  cursor: zoom-out;
}

.travel-lightbox.open { display: flex; }

.travel-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 2px;
}

.travel-lightbox-caption {
  margin-top: 18px;
  max-width: 60ch;
  font-size: 13px;
  font-style: italic;
  color: var(--text-dim);
  text-align: center;
}

.travel-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 15px;
}

.travel-lightbox-close:hover { color: var(--text); border-color: var(--accent); }

/* compose */

.compose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
}

@media (max-width: 860px) {
  .compose { grid-template-columns: 1fr; height: auto; }
}

.compose-preview {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-size: cover;
  background-position: center;
  min-height: 320px;
  position: sticky;
  top: 0;
  height: 100vh;
}

@media (max-width: 860px) {
  .compose-preview { position: static; height: auto; }
}

.compose-preview .entry-meta,
.compose-preview .entry-title,
.compose-preview .entry-body {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.85);
}

.compose-form {
  padding: 40px;
  border-left: 1px solid var(--line);
  height: 100vh;
  overflow-y: auto;
}

@media (max-width: 860px) {
  .compose-form { height: auto; overflow-y: visible; }
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.field input[type="text"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 9px 10px;
  font-size: 13px;
  border-radius: 4px;
  font-family: var(--sans);
}

.field textarea { resize: vertical; }

.field-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  color: var(--text) !important;
  cursor: pointer;
  margin-bottom: 0 !important;
}

.field-checkbox input { accent-color: var(--accent); }

.field-photo {
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  display: block;
}

.field-photo input { display: none; }

.photo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.photo-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.photo-item-thumb {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: cover;
  border-radius: 3px;
}

.photo-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-item-caption {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 3px;
  font-family: var(--sans);
  resize: vertical;
}

.photo-item.uploading .photo-item-thumb { opacity: 0.5; }

.photo-item-status {
  font-size: 11px;
  color: var(--text-mute);
}

.photo-item-status.error { color: #e88; }

.photo-item-actions {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-mute);
}

.photo-item-actions button:hover { color: var(--text); }
.photo-item-actions button:disabled { opacity: 0.3; cursor: default; }
.photo-item-remove:hover { color: var(--accent) !important; }

.publish-btn {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  font-size: 13px;
  margin-top: 8px;
}

.publish-btn:hover { background: rgba(236, 48, 19, 0.1); }

.publish-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.compose-status {
  margin-top: 14px;
  font-size: 12px;
}

.compose-status.error {
  color: #e88;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(238, 136, 136, 0.12);
  border: 1px solid rgba(238, 136, 136, 0.4);
}
.compose-status.ok { color: #8e8; }

.compose-status a { color: var(--accent); }

/* admin visitor count */

.shelf-hero-tally {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.shelf-visitors {
  color: var(--text-mute);
  opacity: 0.8;
  transition: opacity 0.15s, color 0.15s;
}

.shelf-visitors:hover {
  opacity: 1;
  color: var(--text-dim);
}

/* Nothing to open into, so it should not invite a click. */
.shelf-visitors.is-plain {
  cursor: default;
}

.shelf-visitors.is-plain:hover {
  opacity: 0.8;
  color: var(--text-mute);
}

/* The display:flex below outranks the UA's [hidden]{display:none}, so the
   collapsed state has to be spelled out or the panel never closes. */
.visitor-places[hidden] {
  display: none;
}

/* Opens upward, over the cover photo, rather than in the flow — the hero is a
   space-between column, so an inline list squeezes the title block instead. */
.visitor-places {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-height: 34vh;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(16, 15, 14, 0.82);
  backdrop-filter: blur(6px);
  color: var(--text-mute);
  white-space: nowrap;
}

.visitor-place {
  display: flex;
  gap: 14px;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.visitor-place span:last-child {
  min-width: 24px;
  text-align: right;
  color: var(--text-dim);
}

.memory-row-reads {
  margin-left: auto;
  padding-left: 10px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  text-align: right;
  min-width: 34px;
}

.memory-row:hover .memory-row-reads { color: var(--text-dim); }

.entry-reads {
  font-family: var(--mono);
  color: var(--text-mute);
}
