/* attach: showthread.php,newthread.php,newreply.php,editpost.php */
/* pb-thread.css: thread pages and the posting forms. Builds on pb-base.css tokens; redefines none of them. */

/* ---------- Thread head ---------- */
.page-head .btn { flex: none; }
.page-head .desc { margin: 0; width: 100%; color: var(--muted); font-size: 14px; order: 3; }
.thread-side .card { margin-bottom: 14px; }

/* ---------- Post ---------- */
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; scroll-margin-top: 120px; }
.post.unapproved_post, .post.deleted_post { border-style: dashed; opacity: .85; }
.post .head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.post .head > * { min-width: 0; }
.post .head .avatar { width: 48px; height: 48px; }
.avatar-link { flex: none; border-radius: 50%; }
.who { flex: 1 1 0; }
.who-name { font-weight: 700; }
.who-name a { color: inherit; }
.role { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); margin-inline-start: 6px; font-weight: 500; white-space: nowrap; }
.role:empty { display: none; }
.who-meta { font-size: 13px; color: var(--muted); line-height: 1.7; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; }
.who-meta .fa { color: var(--link); }
.who-meta div, .who-meta span.smalltext { display: inline; }
.who-meta br { display: none; }
.who-meta img { display: inline-block; vertical-align: middle; max-height: 22px; width: auto; }
.who-meta span:empty { display: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #b9c2bc; vertical-align: middle; margin-inline-start: 4px; }
.dot.on { background: #2f9e62; }
.when { margin-inline-start: auto; font-size: 13px; color: var(--muted); text-align: left; white-space: nowrap; flex: none; }
.when a { color: var(--muted); }
.when .posted-from { display: inline-block; vertical-align: middle; }
.when input[type=checkbox] { vertical-align: middle; margin: 0 6px 0 0; }

/* Body: the reading column. Long posts must stay readable on phones, and nothing may widen the page. */
.post .body { padding: 16px 18px; font-size: 16px; line-height: 2.05; overflow-wrap: break-word; }
/* Per-post subjects are mostly "RE: <thread title>": kept in the HTML, not shown */
.post-subj { display: none; }
.post_body { min-width: 0; }
.post_body > .float_left:empty, .post_body > .float_right:empty { display: none; }
.post_body img, .post_body video, .post_body iframe, .post_body embed, .post_body object, .post_body audio { max-width: 100% !important; }
.post_body img { height: auto; display: inline-block; vertical-align: middle; }
.post_body img[src*="smilies"] { max-height: 2em; }
.post_body video, .post_body iframe { display: block; height: auto; border-radius: 8px; margin: 8px 0; }
.post_body iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.post_body .pb-video { width: 100%; max-width: 640px !important; aspect-ratio: 530 / 350; background: #000; }
.post_body .pb-audio { width: 100%; max-width: 470px; display: block; margin: 8px 0; }
/* Tables, quotes and code scroll inside the post instead of pushing the page wide */
.post_body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post_body td, .post_body th { border: 1px solid var(--line); padding: 4px 8px; }
.post_body blockquote { margin: 0 0 12px; padding: 10px 14px; background: var(--bg); border-radius: 8px; font-size: 14px; line-height: 1.95; color: var(--muted); max-width: 100%; overflow-x: auto; }
.post_body blockquote cite { display: block; font-style: normal; font-weight: 700; color: var(--ink); font-size: 13px; }
.post_body blockquote cite > span { float: left; font-weight: 400; color: var(--muted); }
.post_body .codeblock { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); max-width: 100%; }
.post_body .codeblock .title { padding: 4px 12px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.post_body .codeblock .body, .post_body pre { direction: ltr; text-align: left; overflow-x: auto; padding: 10px 12px; margin: 0; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre; overflow-wrap: normal; }
.post_body .codeblock code { white-space: pre; }
.post_body fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 14px; min-width: 0; max-width: 100%; overflow-x: auto; }
.post_body legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.post_body ul, .post_body ol { padding-inline-start: 1.4em; }
.post_body .spoiler, .post_body .hide_until_thanks { max-width: 100%; overflow-x: auto; }
.post_meta { font-size: 12px; color: var(--muted); }
.post_meta:empty, .post_meta span:empty { display: none; }
.edited_post { display: block; margin-top: 8px; }

/* Attachments */
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.post .attachment { display: inline-block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.att { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; min-height: 44px; }
.att .fa { color: var(--link); font-size: 18px; }
.att-name { font-weight: 700; overflow-wrap: anywhere; direction: ltr; }
.att-meta { color: var(--muted); white-space: nowrap; }
.att-meta img { display: inline-block; vertical-align: middle; }

/* Signature: quieter than the post */
.sig { margin-top: 16px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; line-height: 1.9; color: var(--muted); max-height: 220px; overflow: auto; overflow-wrap: anywhere; }
.sig-h { font-size: 12px; margin-bottom: 4px; }
.sig img { max-width: 100% !important; height: auto; display: inline-block; }

/* Thanks list: plugin markup (thx_list); the thanks plugin shows and hides it */
.thx_list { font-size: 13px; color: var(--muted); padding: 0 18px 12px; line-height: 1.9; overflow-wrap: anywhere; }
.thx_list .thx_list_lable::before { content: "\f004"; font-family: FontAwesome; color: var(--accent); margin-inline-end: 6px; }
.thx_list b { font-weight: 500; }
.tyl { padding: 0 18px; }
.tyl td { display: block; padding: 0 0 12px; font-size: 13px; color: var(--muted); }

/* Action row. Plugin buttons (thanks) arrive as plain links, so style every link in the row. */
.acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); align-items: center; }
.acts .end { margin-inline-start: auto; }
.acts > a, .acts .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; white-space: nowrap; text-decoration: none; transition: transform 160ms var(--ease-out), background-color 150ms ease; -webkit-tap-highlight-color: transparent; }
.acts > a:active { transform: scale(0.97); }
.acts > a .fa { color: var(--link); }
.acts > a img { max-height: 20px; width: auto; display: inline-block; }
@media (hover: hover) and (pointer: fine) { .acts > a:hover { background: var(--chip); text-decoration: none; } }
.post .popup_menu { z-index: 5; }

/* firstpost separator (pb_firstpost on page 2+) */
.pb-firstpost-sep { width: 100%; border: 0; margin: 4px 0 14px !important; border-collapse: collapse; }
.pb-firstpost-sep td { background: var(--chip) !important; color: var(--link); border-radius: var(--radius); padding: 10px 16px; font-size: 14px; text-align: center; border: 0; }
.pb-ad { margin: 0 0 14px; text-align: center; overflow: hidden; }
.pb-ad img { display: inline-block; height: auto; }

/* ---------- Pager (MyBB multipage markup) ---------- */
.pager:empty { display: none; }
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 8px 0 14px; flex-wrap: wrap; font-size: 14px; }
.pagination .pages { color: var(--muted); font-size: 13px; width: 100%; text-align: center; }
.pagination a, .pagination_current { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: transform 160ms var(--ease-out); }
.pagination a:active { transform: scale(0.97); }
.pagination_current { background: var(--link); color: #fff; border-color: var(--link); font-weight: 700; }
.pagination a.go_page { min-width: 44px; padding: 0; }
.pagination .go_page img { width: 12px; height: auto; }
.pagination .drop_go_page { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

/* ---------- Under the posts ---------- */
.thread-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.thread-nav .float_right { float: none; margin-inline-start: auto; }
.thread-nav form { display: flex; gap: 6px; flex-wrap: wrap; }
.thread-nav .textbox { min-height: 44px; }
.mod-tools { margin-bottom: 18px; font-size: 14px; }
.mod-tools form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.mod-tools select { min-height: 44px; max-width: 100%; }
.tool-list { list-style: none; margin: 0; padding: 6px 0; }
.tool-list li a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; color: var(--ink); }
.tool-list .fa { color: var(--link); }
.similar { list-style: none; margin: 0; padding: 4px 0; }
.similar li { padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.7; }
.similar li:last-child { border-bottom: 0; }
.similar .t { display: block; font-size: 14px; font-weight: 500; }
.browsing { font-size: 13px; color: var(--muted); padding: 10px 16px; }

/* ---------- Quick reply ---------- */
.reply-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.reply-box-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.reply-box-h .fa { color: var(--link); }
.reply-box-h .expander { margin-inline-start: auto; cursor: pointer; width: 20px; height: auto; }
.reply-box textarea { width: 100%; min-height: 140px; }
.reply-opts { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 14px; }
.reply-opts label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.reply-box .form-acts { margin-top: 10px; }
.multiquote-bar { font-size: 13px; color: var(--muted); padding: 6px 0; }

/* ---------- Posting forms: MyBB rows (loginbox, posticons, captcha, poll...) stack as label over field ---------- */
.post-form .card { padding: 18px; }
.pb-rows, .pb-rows > tbody, .pb-rows > tbody > tr, .pb-rows > tbody > tr > td, .pb-rows > tbody > tr > th { display: block; width: auto !important; border: 0; background: none; padding: 0; text-align: right; }
.pb-rows { width: 100%; }
.pb-rows > tbody > tr { margin-bottom: 14px; }
.pb-rows > tbody > tr > td:first-child:not(:only-child) { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.pb-rows .smalltext { font-size: 13px; color: var(--muted); font-weight: 400; }
.pb-rows input.textbox, .pb-rows select { min-height: 46px; }
.pb-rows input[name=subject] { width: 100%; }
.pb-rows label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 400; }
.pb-rows .thead, .pb-rows .tcat { font-weight: 700; padding: 0; }
.pb-rows img { display: inline-block; vertical-align: middle; }
.post-form textarea#message { width: 100%; height: 45vh; min-height: 220px; }
.pb-rows > tbody > tr > td:first-child:not(:only-child) label { min-height: 0; font-weight: 700; }
.post-form #message + .sceditor-container, .sceditor-container { width: 100% !important; max-width: 100%; }
.sceditor-container { border-radius: 8px; overflow: hidden; }
.sceditor-toolbar { display: flex; flex-wrap: wrap; }
.smilie-box img, .pb-rows #smilies img { display: inline-block; }
.post-form .tborder { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.post-form .tborder td, .post-form .tborder th { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.post-form .tborder .thead { background: none; font-weight: 700; font-size: 16px; }
.post-form .tborder .tcat { background: var(--bg); font-size: 13px; color: var(--muted); }
.post-form .fileupload { max-width: 100%; }
.uploader-link img { display: inline-block; margin-top: 8px; }
.danger-zone { margin-top: 8px; }
.danger-zone summary { cursor: pointer; padding: 12px 18px; min-height: 44px; font-weight: 700; color: var(--accent); }
.danger-zone .card-b { padding: 0 18px 18px; font-size: 14px; }
.post-form .form-acts { margin: 6px 0 18px; }
#preview, .post-form > table.tborder:first-child { max-width: 100%; }

/* Thread review under the reply form */
.post-form .tfixed { table-layout: fixed; }
.post-form .tfixed td div[id^="pid_"] { overflow-wrap: anywhere; max-height: 300px; overflow: auto; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
	.post .head { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
	.post .head .avatar { width: 40px; height: 40px; }
	.when { width: 100%; margin: 0; text-align: right; }
	.post .body { padding: 14px; font-size: 16px; line-height: 2; }
	.thx_list { padding: 0 14px 12px; }
	.acts { padding: 8px 14px; gap: 6px; }
	/* Labels go visually only: screen readers still get them */
	.acts .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.acts .end { margin-inline-start: 0; }
	.acts > a { min-width: 44px; min-height: 44px; padding: 0 10px; }
	.reply-box { padding: 14px; }
	.post-form .card { padding: 14px; }
	.post-form .tborder td { display: block; width: auto !important; }
	.pagination .pagination_previous, .pagination .pagination_next { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.acts > a:active, .pagination a:active { transform: none; }
}
