/* Shared editor layout for posts, comments, replies and edits. */
.rhk-composer.rhk-unified{border:0;background:transparent;border-radius:0;margin:8px 0 18px;font:14px/1.6 var(--sans);color:#294138}
.rhk-unified [hidden]{display:none!important}
.rhk-unified .rhk-composer-surface{border:1px solid #cbd7cd;border-radius:8px;background:#fff;min-width:0}
.rhk-unified .rhk-composer-surface:focus-within{border-color:#8fa895}
.rhk-unified .rhk-format-panel{border-bottom:1px solid #dce3d8;border-radius:8px 8px 0 0;background:#f0f3eb}
.rhk-unified .rhk-toolbar{border-bottom:0;padding:6px 10px;background:transparent}
.rhk-unified .rhk-toolbar>button,.rhk-unified .rhk-extra-tools>button,.rhk-unified .rhk-extra-tools select,.rhk-unified .rhk-more-tools>summary{min-height:40px;font-size:13px}
.rhk-unified .rhk-linkfield{border-top:1px solid #dce3d8;border-bottom:0}
.rhk-unified .rhk-editor{border-radius:8px 8px 0 0;overflow:hidden}
.rhk-unified .rhk-editor .ql-editor{min-height:220px;max-height:50dvh;padding:18px;font-size:16px;line-height:1.8}
.rhk-unified.rhk-compact .rhk-editor .ql-editor{min-height:140px;max-height:40dvh}
.rhk-unified .rhk-editor .ql-editor.ql-blank:before{left:18px;right:18px;color:#809187;font-size:14px;line-height:1.8}
.rhk-unified .rhk-compose-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;border-top:1px solid #dce3d8;background:#fbfcf9;border-radius:0 0 8px 8px}
.rhk-unified .rhk-compose-tools{display:flex;align-items:center;gap:3px;min-width:0}
.rhk-unified .rhk-compose-actions button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px;padding:8px 10px;margin:0;border:0;border-radius:5px;background:transparent;color:#526d5f;font:13px/1.4 var(--sans);white-space:nowrap;cursor:pointer;text-decoration:none;letter-spacing:normal}
.rhk-unified .rhk-compose-actions button:hover,.rhk-unified .rhk-compose-actions button[aria-pressed=true],.rhk-unified .rhk-compose-actions button[aria-expanded=true]{background:#eaf0e6;color:#2f5544}
.rhk-unified .rhk-compose-actions svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;flex:none}
.rhk-unified .rhk-compose-actions .rhk-gif-trigger{font-weight:500!important;position:relative}
.rhk-unified .rhk-gif-trigger.has-selection:after{content:'';width:4px;height:4px;border-radius:50%;background:#a45e43;position:absolute;right:5px;top:8px}
.rhk-unified .rhk-preview-toggle{flex:none}
.rhk-unified .rhk-composer-meta{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;margin-top:8px}
.rhk-unified .rhk-caption,.rhk-unified .rhk-counter{padding:0;margin:0;color:#697e70;font:12px/1.6 var(--sans)}
.rhk-unified .rhk-counter{margin-left:auto;white-space:nowrap;font-variant-numeric:tabular-nums}
.rhk-unified .rhk-status{padding:0;min-height:0;margin-top:4px;color:#697e70;font-size:12px}
.rhk-unified .rhk-status:empty{display:none}
.rhk-unified .rhk-att-list{margin:0;padding:0 16px 14px;gap:8px}
.rhk-unified .rhk-att{width:144px;padding:7px;font-size:12px;line-height:1.5;background:#f8faf5}
.rhk-unified .rhk-att button{min-height:36px;font-size:12px}
.rhk-unified .rhk-gif-picker{margin:0;font-size:13px}
.rhk-unified .rhk-gif-panel{margin:0 16px 14px;max-width:none;border-radius:7px}
.rhk-unified .rhk-gif-selected{margin:0 16px 14px;display:flex;align-items:flex-start;gap:10px;flex-wrap:wrap}
.rhk-unified .rhk-gif-selected .rhk-gif-media{width:240px;margin:0}
.rhk-unified .rhk-gif-selected .rhk-gif-remove{margin:0;min-height:40px}
.rhk-unified .rhk-gif-panel button{min-height:40px}
.rhk-unified .rhk-preview{min-height:220px;padding:18px;border:0;background:#fff;border-radius:8px 8px 0 0;overflow-wrap:anywhere}
.rhk-unified.rhk-compact .rhk-preview{min-height:140px}
.rhk-unified .rhk-preview .article-body{font-size:16px;line-height:1.8;max-width:100%}
.rhk-unified .rhk-preview .rhk-att-list{padding:0;margin-top:12px}
.rhk-unified .rhk-preview .rhk-att-list:empty{display:none}
.rhk-unified .rhk-banner{border:1px solid #dbcba9;margin-bottom:8px;border-radius:6px}
.rhk-unified .rhk-banner button{min-height:40px}

/* The post dialog uses the same paper, spacing and supporting controls. */
dialog.compose-dialog{width:min(760px,calc(100% - 32px));padding:24px 28px;background:#f5f6f0;border-radius:10px}
.compose-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.compose-dialog-header h2{font-family:var(--sans);font-size:20px;font-weight:600;line-height:1.4;margin:0}
.compose-dialog-header .close-button{flex:none}
.compose-dialog #post-form{margin:0}
.compose-dialog #post-form .rhk-unified{margin-bottom:8px}
.compose-dialog #post-form .rhk-unified .ql-editor{min-height:180px}

/* Additions group: title/album/tags below body */
.compose-additions{margin:8px 0 0}
.compose-additions>.optional-title{margin-bottom:8px}
.compose-additions .optional-tags{margin:0}
.compose-additions .optional-tags>summary,.compose-additions .optional-title>summary{min-height:36px;padding:5px 0;color:#526d5f;font-size:13px}
.compose-additions .album-compose-context{margin:4px 0 8px;font-size:13px}
.compose-additions .optional-album{margin:0 0 8px}
/* Collapsed summaries show selected values */
.compose-additions .optional-title>summary .title-preview,
.compose-additions .optional-tags>summary .tags-preview,
.compose-additions .optional-album>summary .album-preview{color:var(--ink,#223747);font-weight:500;margin-left:6px}

/* Identity section */
.compose-dialog .writer-fields{margin-top:12px;border-top:1px solid #d8e0d4;padding-top:12px}
.compose-dialog .writer-memory-fields{margin:0;gap:14px}
/* Compact remembered identity */
.writer-compact-identity{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:14px;line-height:1.5;padding:4px 0}
.writer-compact-identity strong{font-weight:600}
.writer-compact-identity .saved-pw-badge{font-size:12px;color:#526d5f}
.writer-compact-identity .text-button{font-size:13px;padding:4px 0;min-height:36px}

/* Submit row: footnote, error, button */
.compose-submit-row{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap;margin-top:14px}
.compose-submit-row .form-footnote{margin:0;font-size:12px;color:#64796c;flex:1 1 auto}
.compose-submit-row .form-footnote .text-button{font-size:12px;min-height:36px}
.compose-submit-row .form-error{margin:0;flex:0 0 100%;order:1}
.compose-submit-row .form-error:empty{display:none}
.compose-submit-row .submit-button{width:auto;min-width:120px;display:flex;padding:10px 20px;margin:0}

/* Post-only options stay in a compact row until a field is needed. */
.compose-dialog .compose-additions{display:flex;flex-wrap:wrap;align-items:flex-start;gap:0 16px;min-width:0}
.compose-dialog .compose-additions>details{flex:0 1 auto;min-width:0;max-width:100%;margin:0}
.compose-dialog .compose-additions>details[open]{flex-basis:100%}
.compose-dialog .compose-additions>details>summary{width:auto;max-width:100%;min-height:44px;padding:10px 0;line-height:1.6;word-break:keep-all;overflow-wrap:anywhere;white-space:normal;font-size:13px;color:#52665f}
.compose-dialog .compose-additions>details>label{margin:4px 0 12px}
.compose-dialog .compose-additions .album-compose-context{display:none}
.compose-dialog .writer-compact-identity{gap:4px 12px}
.compose-dialog .writer-compact-identity strong{min-width:0;overflow-wrap:anywhere}
.compose-dialog .writer-compact-identity .text-button,.compose-dialog .form-footnote .text-button,.compose-dialog .signed-writer .text-button{min-height:44px}
.compose-dialog .writer-memory-fields .remember-choice{min-height:44px;align-items:center;padding:8px 0}
.compose-dialog .writer-memory-fields .remember-choice input[type=checkbox]{align-self:center;margin:0}
.compose-dialog .writer-memory-fields .password-memory-value{height:auto;min-height:50px;flex-wrap:wrap}
.compose-dialog .writer-memory-fields .password-memory-value .text-button{min-height:44px}
.compose-dialog .signed-writer{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin:0;font-size:14px}
.compose-dialog .compose-submit-row .form-error{order:0}
.compose-dialog .compose-submit-row .form-error:not(:empty){padding:8px 0}
.compose-dialog .rhk-counter{font-size:12px;color:#52665f}

@media(max-width:600px){
  dialog.compose-dialog{padding:18px 16px;width:calc(100% - 20px)}
  .compose-dialog-header h2{font-size:18px}
  .compose-dialog .writer-memory-fields{grid-template-columns:1fr;gap:12px}
  .compose-submit-row .submit-button{min-width:110px}
  .rhk-unified .rhk-editor .ql-editor{min-height:190px;padding:14px}
  .compose-dialog #post-form .rhk-unified .ql-editor{min-height:180px}
  .rhk-unified.rhk-compact .rhk-editor .ql-editor{min-height:140px}
  .rhk-unified .rhk-editor .ql-editor.ql-blank:before{left:14px;right:14px}
  .rhk-unified .rhk-att-list{padding:0 12px 12px}
  .rhk-unified .rhk-att{width:calc(50% - 4px)}
  .rhk-unified .rhk-gif-panel,.rhk-unified .rhk-gif-selected{margin:0 12px 12px}
  .rhk-unified .rhk-compose-actions{padding:5px 6px;gap:2px}
  .rhk-unified .rhk-compose-tools{gap:0}
  .rhk-unified .rhk-compose-actions button{padding:8px;font-size:12px;gap:5px}
  .rhk-unified .rhk-preview{min-height:190px;padding:14px}
  .rhk-unified.rhk-compact .rhk-preview{min-height:140px}
}
@media(max-width:420px){
  .rhk-unified .rhk-preview-toggle .rhk-tool-label{display:none}
  .rhk-unified .rhk-caption,.rhk-unified .rhk-counter{font-size:11px}
  .rhk-unified .rhk-toolbar{padding:5px 6px;gap:0}
  .rhk-unified .rhk-toolbar>button{padding:5px 7px;font-size:12px}
  .rhk-unified .rhk-more-tools{width:100%;margin-left:0}
  .rhk-unified .rhk-more-tools>summary{justify-content:flex-end}
}

/* Post tools fit a narrow modal; reply tool wrapping remains unchanged. */
#post-form .rhk-compose-tools:has(.rhk-poll-toggle){flex:1 1 auto}
#post-form .rhk-compose-actions{gap:2px}
/* Focusing a tool must not resize and recenter the dialog before pointer-up. */
body.composer-focus #post-form.rhk-focus-form .rhk-editor .ql-editor{min-height:min(180px,var(--rhk-editor-avail,40dvh))!important;max-height:min(50dvh,var(--rhk-editor-avail,40dvh))!important}

#post-form .ql-editor.ql-blank::before{color:#52665f}
.compose-dialog #post-form label{color:var(--ink,#223747)}

.compose-dialog .writer-memory-fields label,.compose-dialog .memory-field-title,.compose-dialog .password-memory-value{line-height:1.5}
.compose-dialog .close-button{width:auto;height:auto;min-width:44px;min-height:44px;line-height:1}

/* Editing needs a writing-sized surface, with controls outside the scroll area. */
#manage-dialog{width:min(820px,calc(100% - 48px));max-width:none;max-height:calc(100dvh - 48px);padding:0;overflow:hidden;background:var(--paper);border-radius:12px}
#manage-dialog[open]{display:flex;flex-direction:column}
#manage-dialog .manage-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex:none;padding:16px 24px;border-bottom:1px solid var(--line)}
#manage-dialog .manage-dialog-header h2{margin:0;font:600 22px/1.4 var(--sans);letter-spacing:0;outline:none}
#manage-dialog .close-button{flex:none;width:44px;height:44px;line-height:1}
#manage-form{min-height:0;overflow:auto;overscroll-behavior:contain;scroll-padding-block:16px 88px;margin:0;padding:16px 24px 0}
#manage-form .rhk-unified .ql-editor{min-height:180px;max-height:36dvh;overflow-y:auto}
#manage-form .rhk-unified.rhk-compact .ql-editor{min-height:140px;max-height:36dvh}
#manage-form .manage-actions{position:sticky;bottom:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:16px;margin:16px -24px 0;padding:14px 24px;background:var(--paper);border-top:1px solid var(--line)}
#manage-form .manage-actions button{min-height:44px}
@media(max-width:600px){
 #manage-dialog{width:calc(100% - 20px);max-height:calc(100dvh - max(12px,env(safe-area-inset-top,0px)) - max(12px,env(safe-area-inset-bottom,0px)))}
 #manage-dialog .manage-dialog-header{padding:10px 16px}
 #manage-dialog .manage-dialog-header h2{font-size:20px}
 #manage-form{padding:12px 16px 0}
 #manage-form .manage-actions{margin-inline:-16px;padding:12px 16px}
}

/* Keep pointer-down and pointer-up on the same controls when focus mode ends. */
body.composer-focus #manage-form.rhk-focus-form .rhk-editor .ql-editor{min-height:min(180px,var(--rhk-editor-avail,36dvh))!important;max-height:min(36dvh,var(--rhk-editor-avail,36dvh))!important}
body.composer-focus #manage-form.rhk-focus-form .rhk-compact .rhk-editor .ql-editor{min-height:min(140px,var(--rhk-editor-avail,36dvh))!important}

#manage-form .optional-title{margin-bottom:12px}
#manage-form .optional-title>summary,#manage-form .optional-album>summary{min-height:44px;padding-block:10px;overflow-wrap:anywhere}
