:root {
  color-scheme: dark;
  --paper: #11111b;
  --panel: #191925;
  --ink: #f3edf1;
  --muted: #b7b1c6;
  --quiet: #a39bb6;
  --accent: #e7b2a0;
  --line: #343145;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --site-width: 1160px;
  --site-gutter: 1.5rem;
  --header-height: 76px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  isolation: isolate;
  min-height: 100svh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 system-ui, -apple-system, sans-serif;
}

body::before {
  --background-art: url("/assets/sherry-background-desktop.webp");
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgb(17 17 27 / 28%), transparent 32%, rgb(17 17 27 / 25%) 65%, var(--paper)),
    linear-gradient(90deg, rgb(17 17 27 / 30%), rgb(17 17 27 / 12%) 60%, transparent),
    var(--background-art);
  background-position: right center;
  background-size: cover;
  background-repeat: no-repeat;
  content: "";
}

body:has(.reading-shell, .account-main)::before { opacity: .38; }

.site-snow {
  position: fixed;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (max-width: 900px) and (orientation: portrait) {
  body::before {
    --background-art: url("/assets/sherry-background-mobile.webp");
    background-position: 72% center;
  }
}

@media (forced-colors: active) {
  body::before, .site-snow { display: none; }
}

a { color: inherit; }

a:focus-visible, .about-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.shell {
  width: min(var(--site-width), calc(100% - 2 * var(--site-gutter)));
  margin-inline: auto;
}

.site-header, .site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-header { min-height: var(--header-height); }

.site-search {
  display: flex;
  flex: 0 1 clamp(12rem, 25vw, 19rem);
  min-width: 0;
  margin-inline-start: auto;
  border: 1px solid #58536e;
  border-radius: 9px;
  background: var(--panel);
}

.site-search:focus-within { border-color: var(--accent); }

.site-search input, .site-search button {
  min-height: 42px;
  border: 0;
  background: transparent;
  font: inherit;
}

.site-search input {
  flex: 1;
  min-width: 0;
  padding: .45rem .7rem;
  color: var(--ink);
}

.site-search input::placeholder { color: var(--muted); }
.site-search input:focus { outline: none; }

.site-search button {
  padding-inline: .75rem;
  border-inline-start: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  color: var(--accent);
  cursor: pointer;
}

.site-search button:hover { background: #302639; }
.site-search button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.site-header a, .site-footer a { text-decoration: none; }
.site-header a, .site-footer a, .about-trigger { transition: color 160ms ease; }
.site-header a:hover, .site-footer a:hover, .about-trigger:hover { color: var(--accent); }

.about-trigger {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

body:has(.about:popover-open) .about-trigger { color: var(--accent); }

.brand {
  display: inline-flex;
  gap: .7rem;
  align-items: center;
  font-weight: 650;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid #967275;
  border-radius: 50%;
  color: var(--accent);
  font: 650 1.05rem/1 var(--serif);
}

nav {
  display: flex;
  gap: clamp(1rem, 4vw, 2.25rem);
  color: var(--muted);
  font-size: .95rem;
}

h1, h2 { margin: 0; }

.journal {
  max-width: 1060px;
  min-height: calc(100svh - var(--header-height) - 64px);
  padding-block: clamp(1rem, 3vw, 2.5rem) clamp(2.5rem, 6vw, 5rem);
}

.journal-hero {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid #5e485c;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(8 8 18 / 36%);
}

.journal-hero::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgb(17 17 27 / 64%), transparent 75%);
  pointer-events: none;
  content: "";
}

.journal-banner {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  object-position: 60% 45%;
}

.journal-welcome {
  position: absolute;
  z-index: 1;
  inset: 0 clamp(.85rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(.45rem, 1.5vw, 1rem);
  color: var(--ink);
  font: 700 clamp(1.05rem, 3.1vw, 2rem)/1.35 var(--serif);
  text-align: center;
  text-shadow: 0 1px 5px #11111b;
}

.journal-social {
  display: flex;
  gap: clamp(.2rem, 1.4vw, .65rem);
}

.journal-social a, .journal-social button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: rgb(17 17 27 / 35%);
  cursor: pointer;
}

.journal-social :is(a, button):is(:hover, :focus-visible) {
  border-color: var(--accent);
  background: rgb(17 17 27 / 75%);
}

.journal-social img { display: block; filter: invert(1); }

.journal-contact {
  width: min(19rem, calc(100% - 2rem));
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
}

.journal-contact::backdrop { background: rgb(17 17 27 / 38%); }
.journal-contact-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.journal-contact-actions > * {
  min-height: 42px;
  padding: .4rem .65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: inherit;
  font: inherit;
}
.journal-contact input { flex: 1; min-width: 0; }
.journal-contact button { color: var(--accent); cursor: pointer; }
.journal-contact p { margin: .5rem 0 0; color: var(--muted); font-size: .875rem; }
.journal-contact p:empty { margin: 0; }

#notes {
  max-width: 740px;
  margin: clamp(1.75rem, 5vw, 3.75rem) auto 0;
  scroll-margin-top: 1rem;
}

.journal-heading { text-shadow: 0 2px 14px #11111b, 0 1px 4px #11111b; }
#notes .entries-empty { text-shadow: 0 1px 5px #11111b; }

@media (max-width: 600px) {
  .journal-hero { border-radius: 14px; }
  .journal-banner { aspect-ratio: 16 / 9; }
}

h2, .journal-heading {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  line-height: 1.25;
}

.entries {
  display: grid;
  gap: clamp(1.1rem, 3vw, 1.75rem);
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.entries-empty { margin: 1.25rem 0 0; color: var(--muted); }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .8rem;
  color: var(--quiet);
  font-size: .875rem;
}

.post-meta time { font-variant-numeric: tabular-nums; }
.post-meta a, .back-link { color: var(--accent); text-underline-offset: .2em; }

.entry-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 1px solid #4a3d53;
  border-radius: 15px;
  background: rgb(25 25 37 / 96%);
  box-shadow: 0 8px 24px rgb(9 8 17 / 35%);
}

.entry-card:focus-within { border-color: var(--accent); }
.entry-image { overflow: hidden; }
.entry-copy { padding: clamp(1rem, 3vw, 1.6rem); }

.entry-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.entry-title a { text-decoration: none; }
.entry-title a::after { position: absolute; inset: 0; content: ""; }
.entry-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.entry-summary { margin: .4rem 0 0; color: var(--muted); }

.entry-card .post-meta { margin-top: .45rem; }
.entry-card .post-meta a { position: relative; z-index: 1; overflow-wrap: anywhere; }

.entry-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: .5rem .75rem;
  margin-top: .6rem;
}

.entry-footer .entry-summary {
  flex: 1 1 12rem;
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin: 0;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .journal-hero { animation: entry-arrive 520ms cubic-bezier(.2, .7, .25, 1) both; }
  .entry-arrived { animation: entry-arrive 460ms cubic-bezier(.2, .7, .25, 1) both; }

  @keyframes entry-arrive {
    from { opacity: .48; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @media (hover: hover) {
    .entry-card { transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
    .entry-cover { transition: transform 420ms cubic-bezier(.2, .7, .25, 1); }

    .entry-card:hover {
      transform: translateY(-3px);
      border-color: #806275;
      box-shadow: 0 14px 36px rgb(9 8 17 / 52%);
    }

    .entry-card:hover .entry-cover { transform: scale(1.035); }
  }
}

.reading-shell {
  max-width: 740px;
  min-height: calc(100svh - var(--header-height) - 67px);
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.search-query { margin: .7rem 0 0; color: var(--muted); overflow-wrap: anywhere; }
.search-results .entry-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(4.5rem, 16vw, 8rem);
  align-items: start;
  gap: .75rem;
  padding: clamp(.85rem, 2.5vw, 1.15rem);
}

.search-results .entry-copy { grid-area: 1 / 1; padding: 0; }
.search-results .entry-image { grid-area: 1 / 2; border-radius: 7px; }

.friend-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  align-items: start;
  gap: .9rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

.friend-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.friend-card:hover, .friend-card:focus-within { border-color: var(--accent); }
.friend-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
  padding: 1rem;
  border-radius: inherit;
  text-decoration: none;
}
.friend-link h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
.friend-link p { margin: .25rem 0 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.friend-avatar { border: 1px solid var(--line); border-radius: 50%; background: var(--paper); object-fit: cover; }
.friend-arrow { align-self: start; color: var(--accent); }
.friend-feed { display: inline-block; margin: 0 1rem .85rem; color: var(--accent); font-size: .875rem; }

.page-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.back-link { display: inline-block; margin-bottom: 1rem; font-size: .875rem; }
.post-header { padding-bottom: 1.35rem; border-bottom: 1px solid var(--line); }
.post-header .post-meta { margin-top: .85rem; }
.post-author { margin-top: .75rem; }

.post-body {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.post-body h2, .post-body h3 { margin-top: 1.8em; }
.post-body a { color: var(--accent); text-underline-offset: .2em; }

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-block: 1.5rem;
  border-radius: 10px;
}

.post-body blockquote {
  margin-inline: 0;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--line);
  color: var(--muted);
}

.post-body pre { overflow: auto; padding: 1rem; border-radius: 8px; background: var(--panel); }

.post-discussion {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}

.discussion-heading, .comment-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
}

.discussion-heading { justify-content: space-between; }
.discussion-heading h2 span { color: var(--quiet); font: .95rem system-ui, sans-serif; }

.discussion-like {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  padding: .35rem .85rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
}

button.discussion-like { cursor: pointer; }
button.discussion-like:hover, .discussion-like[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.comment-actions .discussion-like { min-height: 36px; padding: .25rem .65rem; font-size: .85rem; }
.post-discussion button[aria-disabled="true"] { cursor: progress; }
.discussion-error { margin: .35rem 0 0; color: #f8c5cc; font-size: .875rem; }
.discussion-error a { color: inherit; }
@media (prefers-reduced-motion: no-preference) {
  button.discussion-like { transition: color 160ms ease, border-color 160ms ease, transform 160ms ease; }
  button.discussion-like:active { transform: scale(.96); }
}

button.discussion-like:focus-visible, .comment-actions summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.discussion-sign-in a, .comment-parent { color: var(--accent); text-underline-offset: .2em; }
.comment-form { display: grid; gap: .5rem; justify-items: start; margin-top: 1rem; }
.comment-form textarea { width: 100%; resize: vertical; }

.discussion-comments {
  display: grid;
  gap: .65rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.discussion-comment {
  min-width: 0;
  padding: .75rem clamp(.65rem, 3vw, 1rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  scroll-margin-top: 1rem;
}

.discussion-comment:target { border-color: var(--accent); }
.discussion-reply { margin-inline-start: clamp(.65rem, 4vw, 1.75rem); border-inline-start: 2px solid #675773; }
.discussion-deleted { color: var(--muted); font-size: .9rem; }
.comment-heading time, .comment-parent { font-size: .8rem; }
.comment-heading time { color: var(--muted); }
.comment-parent { overflow-wrap: anywhere; }
.comment-text { margin: .2rem 0 .45rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem 1rem; }
.comment-actions details[open] { flex-basis: 100%; }
.comment-actions summary { width: fit-content; min-height: 32px; color: var(--accent); cursor: pointer; }
.comment-reply-form .comment-form { margin: .3rem 0 0; }
.comment-delete-form summary, .comment-delete-form .comment-delete-button { color: #f0aab4; }
.comment-delete-form .comment-delete-button { border-color: #965b65; }

.about {
  position: fixed;
  inset: var(--header-height) max(var(--site-gutter), calc((100% - var(--site-width)) / 2)) auto auto;
  width: min(21rem, calc(100% - 2 * var(--site-gutter)));
  max-height: calc(100svh - var(--header-height) - var(--site-gutter));
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 30%);
  opacity: 0;
  transform: translateY(-.45rem) scale(.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 180ms ease, transform 200ms ease, display 200ms allow-discrete, overlay 200ms allow-discrete;
}

.about:popover-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@starting-style {
  .about:popover-open {
    opacity: 0;
    transform: translateY(-.45rem) scale(.98);
  }
}

.about h2 { font-size: 1.45rem; }

.about-copy { padding: 1.3rem 1.5rem; }
.about p { margin: .5rem 0 0; color: var(--muted); }

.about-illustration {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--line);
  object-fit: cover;
  object-position: 86% 35%;
}

.site-footer {
  justify-content: flex-end;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: .875rem;
}

@media (max-width: 700px) {
  :root {
    --site-gutter: 1rem;
    --header-height: 112px;
  }

  .site-header { flex-wrap: wrap; gap: .6rem .75rem; padding-block: .65rem; }
  .site-header .brand { flex-basis: 100%; }
  .site-header nav { flex: none; }
  .site-search { flex: 1 1 0; margin-inline-start: 0; }
}

@media (max-width: 420px) {
  .site-header nav { gap: .5rem; font-size: .875rem; }
  .site-search input { padding-inline: .45rem; }
  .site-search button { padding-inline: .5rem; }
  .brand { gap: .45rem; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .about, .about-trigger, .site-header a, .site-footer a { transition: none; }
}

nav a[aria-current="page"] { color: var(--accent); }

.account-main {
  display: grid;
  justify-items: center;
  align-items: center;
  min-height: calc(100svh - var(--header-height) - 67px);
  padding-block: 2.5rem;
}

.account-card {
  width: min(100%, 29rem);
  padding: clamp(1.25rem, 5vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.account-card h1 {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: .04em;
}

.account-description, .account-switch {
  margin: .75rem 0 0;
  color: var(--muted);
}

.account-form {
  display: grid;
  gap: .5rem;
  margin-top: 1.4rem;
}

.account-form label:not(:first-child) { margin-top: .5rem; }

.account-form input, .profile-form textarea, .comment-form textarea {
  width: 100%;
  min-height: 44px;
  padding: .65rem .8rem;
  border: 1px solid #58536e;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.account-form small { color: var(--muted); font-size: .85rem; }
.account-button:focus-visible, .account-form input:focus-visible,
.profile-form textarea:focus-visible, .comment-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-settings { width: min(100%, 36rem); }

.account-profile-header, .member-heading {
  display: flex;
  align-items: center;
  gap: clamp(.75rem, 3vw, 1.25rem);
  overflow-wrap: anywhere;
}

.account-profile-header { margin-top: 1.2rem; }
.account-profile-header .back-link { margin: 0; }
.profile-handle { margin: .2rem 0 0; color: var(--muted); }
.profile-form textarea { min-height: 6rem; resize: vertical; }
#avatar-status:empty { position: absolute; }

.profile-avatar {
  display: block;
  flex: none;
  width: 5.5rem;
  height: 5.5rem;
  border: 1px solid #675773;
  border-radius: 50%;
  background: #302639;
  object-fit: cover;
}

.profile-avatar-initial {
  display: grid;
  place-items: center;
  color: var(--accent);
  font: 650 1.85rem/1 var(--serif);
}

.profile-link {
  display: inline-flex;
  min-height: 44px;
  max-width: 100%;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.profile-link .profile-avatar { width: 2rem; height: 2rem; font-size: .9rem; }
.profile-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-link:hover { color: var(--accent); }
.entry-author { position: relative; z-index: 1; max-width: min(100%, 11rem); }
.entry-author .profile-link {
  display: flex;
  padding: .25rem .75rem .25rem .35rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--paper);
}

.member-card {
  padding: clamp(1.15rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.member-card .page-title { font-size: clamp(1.55rem, 5vw, 2.6rem); }
.member-bio { margin: 1rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.member-details { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .85rem; color: var(--muted); }
.member-details a { color: var(--accent); overflow-wrap: anywhere; }
.member-posts { margin-top: clamp(1.75rem, 5vw, 3rem); }

.account-button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #26191f;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.account-form .account-button { margin-top: .75rem; }
.account-button:hover { background: #f1c5b6; }
.profile-form .account-button:disabled { opacity: .65; cursor: wait; }

.account-button.secondary {
  background: transparent;
  color: var(--accent);
}

.account-button.secondary:hover { background: #2f2737; }
.account-switch { margin-top: 1.25rem; }
.account-switch a { color: var(--accent); text-underline-offset: .2em; }

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}

.account-error {
  padding: .65rem .8rem;
  border: 1px solid #965b65;
  border-radius: 6px;
  background: #36212c;
  color: #f8c5cc;
}

.pagination {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--accent);
}

.feed-pagination {
  justify-content: center;
  align-items: center;
}

[data-feed-next] {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .45rem 1rem;
  border: 1px solid #71596a;
  border-radius: 2rem;
  background: var(--panel);
  text-decoration: none;
}

[data-feed-next]:hover { border-color: var(--accent); }
#feed-status { margin: .65rem 0 0; text-align: center; color: var(--muted); }
#feed-status:empty { margin: 0; }

.writing-heading, .account-heading, .editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .85rem;
}

.writing-heading, .account-heading { justify-content: space-between; }

.editor-import {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.editor-import label, .editor-import small:not(:empty) { display: block; }

.editor-import input {
  max-width: 100%;
  margin-top: .45rem;
  font: inherit;
}

.editor-import small:not(:empty) { margin-top: .45rem; color: var(--muted); }
.editor-form label span { color: var(--quiet); font-size: .85rem; }

.editor-image-tools:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .75rem;
}

.editor-image-tools .account-button { margin: 0; }
.editor-image-tools .account-button:disabled { opacity: .65; cursor: wait; }

.post-image-preview:not([hidden]) {
  display: flex;
  gap: .55rem;
  min-width: 0;
  margin: 0;
  padding: .15rem 0 .45rem;
  overflow-x: auto;
  list-style: none;
}

.post-image-preview li { flex: 0 0 auto; }
.post-image-preview img {
  display: block;
  width: 6.5rem;
  height: 4.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  object-fit: contain;
}

.editor-form textarea {
  width: 100%;
  min-height: 15rem;
  padding: .75rem .8rem;
  border: 1px solid #58536e;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.editor-form textarea:focus-visible, .editor-import input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.editor-notice { color: var(--accent); }
.editor-actions { margin-top: .35rem; }

.entry-cover, .post-cover, #cover-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--panel);
}

.post-cover { margin-top: 1.5rem; border-radius: 10px; }

.cover-field {
  min-width: 0;
  margin: .85rem 0 .3rem;
  padding: .85rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cover-field legend { padding-inline: .35rem; }
.cover-field legend span { color: var(--accent); font-size: .85rem; }

.cover-field label, .cover-field small { display: block; }
.cover-field small { margin-top: .45rem; }

.cover-field input[type="file"] {
  min-height: 0;
  margin-top: .35rem;
  padding: .45rem;
  text-overflow: ellipsis;
}

#cover-preview { max-width: 22rem; border-radius: 6px; }

.crop-dialog {
  width: min(39rem, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  overflow: auto;
  padding: clamp(1rem, 4vw, 1.6rem);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.crop-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.crop-dialog p { margin: .65rem 0 1rem; color: var(--muted); }

.crop-frame {
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  background: var(--paper);
}

.crop-frame::after {
  --guide-color: rgb(255 255 255 / 55%);
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--guide-color), var(--guide-color)) 33.333% 0 / 1px 100% no-repeat,
    linear-gradient(var(--guide-color), var(--guide-color)) 66.667% 0 / 1px 100% no-repeat,
    linear-gradient(var(--guide-color), var(--guide-color)) 0 33.333% / 100% 1px no-repeat,
    linear-gradient(var(--guide-color), var(--guide-color)) 0 66.667% / 100% 1px no-repeat;
  content: "";
}

.crop-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.crop-frame canvas:active { cursor: grabbing; }
.crop-frame canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.avatar-crop-dialog { width: min(26rem, calc(100% - 2rem)); }
.avatar-crop-frame { width: min(100%, 18rem); margin-inline: auto; }
.avatar-crop-frame::after {
  background: none;
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: 50%;
  box-shadow: 0 0 0 18rem rgb(17 17 27 / 65%);
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-block: 1rem;
}

.crop-zoom input { flex: 1; min-width: 0; min-height: 32px; accent-color: var(--accent); }
.crop-dialog .editor-actions { justify-content: flex-end; }
.crop-dialog button:disabled { opacity: .65; cursor: wait; }
