/* Shared interior surfaces */
.subpage {
  --interior-shadow: 0 3px 10px rgba(51, 36, 86, 0.035);
}
.subpage:has(
    #article-workspace,
    #g-list,
    #g-room,
    #author-page,
    #account-content
  ) {
  max-width: 960px;
  margin-top: clamp(23px, 3vw, 44px);
}
.subpage:has(.art-reading) {
  max-width: 850px;
}
.subpage .crumb {
  gap: 9px;
  overflow-wrap: anywhere;
}
.subpage .page-title {
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1.32;
}
.subpage .panel,
.dialog .panel {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-radius: 20px;
  box-shadow: var(--interior-shadow, 0 3px 10px rgba(51, 36, 86, 0.035));
}
.subpage .panel {
  padding: clamp(18px, 2.7vw, 30px);
}
.subpage .panel h2,
.subpage .panel h3 {
  color: var(--text);
  letter-spacing: -0.025em;
}
.subpage :is(.form-stack, .list-item) {
  min-width: 0;
}
.subpage .list-item > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.subpage .list-item div.muted {
  margin-top: 3px;
  font-size: 0.875rem;
}
.subpage .list-item a,
.subpage a.list-item {
  text-decoration: none;
}
.subpage :is(#account-content, #author-page) {
  gap: 18px;
}
.subpage :is(#account-content, #author-page) > .panel + .panel {
  margin-top: 0;
}

/* Fields are also used as group-form labels. Only actual controls receive a frame. */
:is(.subpage, .dialog) .form-stack label {
  color: var(--text);
}
:is(.subpage, .dialog) label.field {
  display: grid;
  gap: 7px;
  padding: 0;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}
:is(.subpage, .dialog)
  :is(
    input:not([type]),
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="search"],
    input[type="number"],
    textarea,
    select
  ) {
  border: 1px solid #cbc4d7;
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  min-height: 43px;
  box-shadow: inset 0 1px 2px rgba(49, 35, 73, 0.025);
  line-height: 1.45;
}
:is(.subpage, .dialog) :is(input, textarea)::placeholder {
  color: #776f83;
  opacity: 1;
}
:is(.subpage, .dialog) :is(input, textarea, select):focus-visible {
  outline: 2px solid var(--accent, #7053cd);
  outline-offset: 2px;
}
:is(.subpage, .dialog) :is(input[type="checkbox"], input[type="radio"]) {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  vertical-align: -0.14em;
  accent-color: var(--accent, #7053cd);
}
:is(.subpage, .dialog) select option {
  color: var(--text);
  background: white;
}

/* Dialogs and account management */
.overlay {
  background: rgba(43, 33, 62, 0.37);
  backdrop-filter: blur(5px);
}
.overlay .dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid #e1dae9;
  border-radius: 22px;
  padding: clamp(20px, 4vw, 30px);
  box-shadow:
    0 20px 76px rgba(43, 28, 71, 0.2),
    inset 0 1px white;
}
.dialog-head {
  margin-bottom: 21px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  color: var(--text);
  font-size: 1.32rem;
}
.dialog:has(#account-dialog) {
  max-width: 430px;
}
.dialog .menu-list > button {
  border-radius: 10px;
  padding: 11px;
  color: var(--text);
}
.dialog .menu-list > button:hover {
  background: var(--raised);
  color: var(--accent, #7053cd);
}
.dialog [data-account-error]:not([hidden]),
.art-feedback:not(:empty) {
  margin: 0;
  padding: 9px 12px;
  color: #842b48;
  background: #fff0f3;
  border-radius: 9px;
}
#account-dialog label.form-stack,
#account-content label.form-stack {
  display: grid;
  gap: 5px;
  font-weight: 600;
}
#account-dialog .form-stack label :is(.field, input, textarea),
#account-content .form-stack label :is(.field, input, textarea) {
  margin-top: 0;
}
#account-dialog .form-stack > button.primary {
  width: 100%;
  min-height: 43px;
}
#account-dialog form + .row {
  margin-top: 14px;
  column-gap: 14px;
  row-gap: 6px;
}
#account-dialog form + .row .btn {
  min-height: 34px;
  padding: 3px 0;
  color: var(--accent, #7053cd);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
#account-dialog form + .row .btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
#account-content .panel > h2 {
  margin-bottom: 16px;
}
#account-content form + .list-item {
  margin-top: 12px;
}
#account-content .panel > form > .btn {
  justify-self: start;
}
#account-content .panel > .row {
  margin-block: 12px 3px;
}
@media (min-width: 740px) {
  #account-content form:has([name="q"]):has([name="status"]) {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.5fr) auto;
    align-items: end;
  }
  #account-content form:has([name="q"]):has([name="status"]) [role="alert"] {
    grid-column: 1 / -1;
  }
}

/* Author profile */
#author-page .panel:first-child {
  background: linear-gradient(112deg, #f1ebfd 0, #faf8ff 53%, #fff 100%);
  border-color: #ded5ee;
}
#author-page .panel:first-child .row:first-child {
  gap: 15px;
}
#author-page .panel:first-child h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
}
#author-page .panel:first-child .g-avatar {
  width: 55px;
  height: 55px;
  font-size: 1.5rem;
}
#author-page .panel:first-child p {
  margin-top: 15px;
}
#author-page [data-actions] {
  margin-top: 16px;
}
#author-page [data-posts] {
  gap: 0;
}
#author-page [data-posts] a {
  color: var(--text);
  padding-block: 15px;
}
#author-page [data-posts] a:hover strong {
  color: var(--accent, #7053cd);
}
#author-page [data-posts] svg {
  color: var(--subtle);
  flex-shrink: 0;
}
#author-page [data-posts] .muted {
  font-size: 0.86rem;
  margin-top: 4px;
}

/* Article reader, lists and editor */
#article-workspace {
  width: 100%;
  min-width: 0;
}
.art-meta,
.art-tools,
.art-reader-picks,
.art-add,
.art-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}
#article-workspace .art-reading {
  padding: clamp(22px, 4.2vw, 43px);
}
.art-meta {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
}
.art-byline {
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.art-byline .author-link {
  color: var(--text);
  font-weight: 650;
  padding: 4px 0;
}
.art-byline .author-link:hover {
  color: var(--accent, #7053cd);
}
.art-board,
.art-tags span {
  border-radius: 20px;
  padding: 3px 9px;
  color: #60468f;
  background: #f1eafa;
}
.art-byline span + span:not(.art-board)::before {
  content: "·";
  margin-inline-end: 8px;
  color: var(--subtle);
}
.art-story {
  color: #332d3b;
  font-size: clamp(1rem, 1.7vw, 1.13rem);
  line-height: 1.95;
  overflow-wrap: anywhere;
}
.art-story p {
  margin: 1.15em 0;
  white-space: pre-wrap;
}
.art-story h3 {
  font-size: 1.18em;
  margin: 1.7em 0 0.65em;
}
.art-story figure {
  margin: 25px 0;
}
.art-story img,
.art-story video,
.art-mini {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 15px;
  background: var(--raised);
}
.art-tags {
  margin-top: 18px;
}
.art-file {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  max-width: 100%;
  padding: 11px 16px;
  margin: 8px 0;
  border: 1px solid #d9cfea;
  background: #f8f5fd;
  border-radius: 13px;
  color: #514078;
  text-decoration: none;
}
.art-file small {
  color: var(--muted);
  font-size: 0.78em;
}
.art-file .ic {
  flex-shrink: 0;
}
.art-tools {
  margin-top: 25px;
  padding-top: 19px;
  border-top: 1px solid var(--border);
}
.art-tools [aria-pressed="true"] {
  color: #543aa0;
  background: #eee8fc;
  border-color: #c7b6ed;
}
.art-comments {
  margin-top: 18px;
}
.art-comments h2 small {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 500;
}
.art-comment {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.art-comment[data-indented] {
  margin-inline-start: 16px;
  padding-inline-start: 13px;
  border-inline-start: 2px solid #d7c9ed;
}
.art-comment p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.art-comment small {
  color: var(--muted);
}
.art-compose {
  margin-top: 21px;
}
.art-compose label,
.art-editor legend {
  color: var(--text);
  font-weight: 650;
}
.art-input,
.art-select,
.art-editor textarea,
.art-comments textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  font: inherit;
  box-sizing: border-box;
}
.art-editor textarea,
.art-comments textarea {
  min-height: 95px;
  resize: vertical;
  line-height: 1.7;
}
.art-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.art-editor label,
.art-editor legend {
  font-weight: 600;
}
.art-editor {
  gap: 21px;
}
.art-editor legend {
  margin-bottom: 5px;
}
.art-editor fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.art-reader-picks {
  padding: 9px 0;
}
.art-reader-picks label {
  font-weight: 400;
  background: var(--raised);
  padding: 5px 9px;
  border-radius: 9px;
}
.art-editor .art-caption {
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--muted);
}
.art-block {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px;
  background: #faf9fc;
}
.art-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.art-block-head strong {
  font-size: 0.89rem;
  color: var(--muted);
}
.art-block-nav {
  display: flex;
  gap: 3px;
}
.art-block-nav button,
.art-text-button {
  padding: 4px 6px;
  color: #5f4b91;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.83rem;
  cursor: pointer;
}
.art-block-nav button:hover:not(:disabled),
.art-text-button:hover {
  background: #eee8f7;
}
.art-block-nav button:disabled {
  opacity: 0.45;
  cursor: default;
}
.art-upload {
  display: block;
  max-width: 100%;
  margin: 8px 0;
}
.art-upload::file-selector-button {
  border: 1px solid #cfc4e2;
  border-radius: 8px;
  background: #f4eefb;
  color: #503a75;
  padding: 6px 10px;
  margin-right: 8px;
  cursor: pointer;
}
.art-mini {
  max-height: 170px;
  margin-top: 8px;
}
.art-add {
  margin-top: 12px;
}
.art-actions {
  margin-top: 13px;
}
.art-editor > .art-actions {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.art-actions button:disabled {
  opacity: 0.5;
  cursor: progress;
}
.art-feedback:empty {
  display: none;
}
.art-list-item {
  display: block;
  width: 100%;
  padding: 15px 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.art-list-item:hover {
  background: #f7f4fc;
  border-radius: 9px;
}
.art-list-item strong,
.art-list-item small {
  display: block;
}
.art-list-item small {
  font-size: 0.83rem;
  margin-top: 5px;
  color: var(--muted);
}
.art-list .art-list-item:last-child {
  border-bottom-color: transparent;
}

@media (max-width: 650px) {
  .overlay .dialog {
    padding: 19px;
    border-radius: 17px;
  }
  .subpage .panel {
    border-radius: 16px;
  }
  .art-two {
    grid-template-columns: 1fr;
  }
  .art-tools .btn,
  .art-add .btn {
    padding-inline: 9px;
  }
  .art-file {
    display: flex;
  }
  .art-block-head {
    align-items: flex-start;
  }
  #article-workspace .art-reading {
    padding: 19px;
  }
  .art-byline {
    margin-bottom: 17px;
  }
  .art-story figure {
    margin: 16px 0;
  }
}

/* Article code blocks share a surface in the reader, preview and editor. */
.art-code,
.art-code-editor {
  --code-font: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas,
    "Liberation Mono", monospace;
  --code-edge: #d8d0e5;
  --code-surface: #faf9fd;
  --code-header: #f0ebf7;
  --code-ink: #30273d;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--code-edge);
  border-radius: 13px;
  background: var(--code-surface);
  color: var(--code-ink);
}
.art-story .art-code {
  margin: clamp(16px, 2.5vw, 24px) 0;
  overflow-wrap: normal;
}
.art-code-head,
.art-code-editor label.art-code-language {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 7px 14px;
  border-bottom: 1px solid var(--code-edge);
  border-radius: 12px 12px 0 0;
  background: var(--code-header);
  color: #534366;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}
.art-code-label {
  min-width: 0;
  font-family: var(--code-font);
  overflow-wrap: anywhere;
}
.art-code .art-code-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #c9bfda;
  border-radius: 8px;
  background: #fff;
  color: #513c75;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.art-code-copy:focus-visible,
.art-code-editor select.art-code-select:focus-visible {
  outline: 2px solid #7352ae;
  outline-offset: 2px;
}
.art-code pre,
.art-code-editor textarea.art-code-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 14px clamp(12px, 2.2vw, 20px);
  border: 0;
  border-radius: 0 0 12px 12px;
  background: var(--code-surface);
  color: var(--code-ink);
  font: 400 0.91rem/1.7 var(--code-font);
  font-variant-ligatures: none;
  tab-size: 4;
  text-align: left;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.art-code pre > code {
  display: block;
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
  tab-size: inherit;
}
.art-code pre:focus-visible,
.art-code-editor textarea.art-code-input:focus-visible {
  outline: 2px solid #7352ae;
  outline-offset: -3px;
}
.art-code-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 9px;
}
.art-code-editor label.art-code-language {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.art-code-editor select.art-code-select {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 4px 9px;
  border: 1px solid #c9bfda;
  border-radius: 8px;
  color: #49385e;
  background: #fff;
  font: 500 0.86rem/1.4 var(--code-font);
}
.art-code-editor textarea.art-code-input {
  min-height: 10rem;
  resize: vertical;
  box-shadow: none;
  caret-color: #64439d;
}
@media (hover: hover) {
  .art-code .art-code-copy:hover:not(:disabled) {
    border-color: #a593be;
    background: #f9f6ff;
    color: #412a64;
  }
}
@media (max-width: 650px) {
  .art-code-head,
  .art-code-editor label.art-code-language {
    gap: 8px;
    padding: 5px 10px;
  }
  .art-code .art-code-copy,
  .art-code-editor select.art-code-select {
    min-height: 42px;
  }
  .art-code-editor select.art-code-select,
  .art-code-editor textarea.art-code-input {
    font-size: 1rem;
  }
}

.art-code :is(.token.comment, .token.prolog, .token.doctype, .token.cdata) {
  color: #665f73;
  font-style: italic;
}
.art-code :is(.token.keyword, .token.atrule, .token.tag, .token.selector) {
  color: #684399;
}
.art-code :is(.token.string, .token.char, .token.attr-value, .token.inserted) {
  color: #286344;
}
.art-code :is(.token.function, .token.class-name, .token.builtin, .token.property) {
  color: #275983;
}
.art-code :is(.token.number, .token.boolean, .token.constant, .token.attr-name) {
  color: #8b4d28;
}
.art-code :is(.token.regex, .token.important, .token.symbol, .token.deleted) {
  color: #902f57;
}
.art-code :is(.token.punctuation, .token.operator, .token.entity) {
  color: #554765;
}
.art-code :is(.token.bold, .token.important) { font-weight: 700; }
.art-code .token.italic { font-style: italic; }
