/* Forum skin for the vBulletin style "Graphite". Colours and fonts of the vB classes come from the style itself
   (tools/forum/style_sync.php); this file adds the page frame, spacing, buttons and the small-screen layout.
   The site header and footer (#ts-h, #ts-f) are styled by /assets/ts/site-legacy.css. */

body {
  margin: 0;
  background: var(--paper, #F5F3EE);
  color: var(--ink, #1F2329);
  -webkit-text-size-adjust: 100%;
}
/* vBulletin sets a fixed font on td, th, p and li: the site header and footer keep their own. */
#ts-h p, #ts-h li, #ts-h td, #ts-h th, #ts-f p, #ts-f li, #ts-f td, #ts-f th { font: inherit; }

#ts-forum {
  max-width: var(--wrap, 1320px);
  margin: 0 auto;
  padding: 28px var(--gutter, 32px) 8px;
  box-sizing: border-box;
  line-height: 1.45;
}
#ts-forum td, #ts-forum th { line-height: 1.45; }
#ts-forum hr { border: 0; height: 1px; color: var(--line) !important; background-color: var(--line) !important; }
#ts-forum a { text-underline-offset: 2px; }
#ts-forum a:hover { text-decoration: underline; }

/* Tables: thin warm rules instead of the blue frame. Cell borders that vBulletin writes inline follow the same colour. */
#ts-forum .tborder { border-radius: 4px; }
#ts-forum td[style*="solid"], #ts-forum div[style*="solid"] { border-color: var(--line) !important; }
#ts-forum td.tcat, #ts-forum div.tcat {
  padding: 11px 14px;
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  border-left: 3px solid var(--rust);
}
#ts-forum .tcat .normal, #ts-forum .tcat .smallfont { font-family: var(--f-text); text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--mist); }
#ts-forum td.thead, #ts-forum th.thead, #ts-forum div.thead {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}
#ts-forum .thead a { text-decoration: none; }
#ts-forum td.tfoot { padding: 9px 14px; }
#ts-forum .tfoot a { text-decoration: none; }
#ts-forum .tfoot a:hover { text-decoration: underline; }

/* Forum list (home and sub-forums). */
#ts-forum td.alt1Active div > a:has(> strong) { font-size: 17px; font-weight: 700; color: var(--ink); text-decoration: none; }
#ts-forum td.alt1Active div > a:has(> strong):hover { color: var(--rust-ink); text-decoration: underline; }
#ts-forum td.alt1Active .smallfont { color: var(--ink-2); }
#ts-forum td.alt1Active > div + div.smallfont { margin-top: 2px; }

/* Thread list. */
#ts-forum a[id^="thread_title_"] { font-size: 16px; font-weight: 700; color: var(--ink); text-decoration: none; }
#ts-forum a[id^="thread_title_"]:hover { color: var(--rust-ink); text-decoration: underline; }
#ts-forum a[id^="thread_title_"]:visited { color: var(--ink-2); }
#ts-forum td[id^="td_threadtitle_"] .smallfont { color: var(--ink-3); margin-top: 2px; }

/* Breadcrumb bar. */
#ts-forum .navbar { font-size: 14px; color: var(--ink-2); }
#ts-forum .navbar a { color: var(--ink-2); }
#ts-forum .navbar a:hover { color: var(--rust-ink); }
#ts-forum .navbar strong { display: inline-block; margin-top: 4px; font: 800 26px/1.12 var(--f-display); color: var(--ink); }
#ts-forum img[src*="/misc/navbits_"] { display: none; }

/* Menu strip under the breadcrumb and the small tool menus. */
#ts-forum td.vbmenu_control { padding: 8px 12px; letter-spacing: .05em; text-transform: uppercase; }
#ts-forum td.vbmenu_control a:hover { text-decoration: none; color: var(--rust-ink); }
.vbmenu_popup { border-radius: 4px; box-shadow: 0 10px 28px rgba(26, 29, 34, .16); overflow: hidden; }
.vbmenu_popup td { padding: 8px 12px; }
.vbmenu_popup td.thead { padding: 7px 12px; }

/* Thread tools bar above the posts has no title: keep it light. */
#ts-forum table:has(#threadtools) td.tcat { background: var(--paper-2); border-left-color: var(--paper-2); }

/* Posts. */
#ts-forum #posts table.tborder { margin-bottom: 4px; }
#ts-forum a.bigusername { font-family: var(--f-display); font-size: 21px; font-weight: 700; color: var(--ink); text-decoration: none; }
#ts-forum a.bigusername:hover { color: var(--rust-ink); }
#ts-forum td[id^="td_post_"] { padding: 14px 18px; }
#ts-forum div[id^="post_message_"] { font-size: 16px; line-height: 1.62; max-width: 82ch; overflow-wrap: anywhere; }
#ts-forum div[id^="post_message_"] img, #ts-forum td[id^="td_post_"] fieldset img { max-width: 100%; height: auto; }
#ts-forum td[id^="td_post_"] > .smallfont:first-child strong { font-size: 15px; }
/* Quotes and code inside posts. */
#ts-forum div[id^="post_message_"] td.alt2[style*="inset"] { border: 0 !important; border-left: 3px solid var(--line-2) !important; background: var(--paper-2); padding: 10px 14px; font-size: 15px; }
#ts-forum div[id^="post_message_"] pre.alt2 { border: 1px solid var(--line) !important; background: #fff; padding: 10px 12px; font: 13px/1.5 Consolas, "Liberation Mono", monospace; }
#ts-forum pre, #ts-forum .alt2 > pre { max-width: 100%; overflow: auto; box-sizing: border-box; }
#ts-forum div[style*="width:640px"], #ts-forum pre[style*="width:640px"] { max-width: 100%; }

/* Page numbers. */
#ts-forum .pagenav .vbmenu_control { background: transparent; color: var(--ink-3); font-weight: 600; text-transform: none; letter-spacing: 0; }
#ts-forum .pagenav td.alt1, #ts-forum .pagenav td.alt2 { padding: 4px 9px; }
#ts-forum .pagenav td.alt2 { background: var(--rust-btn); color: #fff; font-weight: 700; }
#ts-forum .pagenav td.alt2 * { color: #fff; }
#ts-forum .pagenav a { font-weight: 600; }

/* Forms. */
#ts-forum .bginput, #ts-forum textarea, #ts-forum select, .vbmenu_popup .bginput {
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
  box-sizing: border-box;
}
#ts-forum .bginput:focus, #ts-forum textarea:focus, #ts-forum select:focus { outline: 2px solid var(--rust); outline-offset: 0; border-color: var(--rust); }
#ts-forum select { padding: 4px 6px; }
.button, #ts-forum input[type="submit"], #ts-forum input[type="reset"] {
  border: 0;
  border-radius: 2px;
  background: var(--rust-btn);
  color: #fff;
  padding: 7px 16px;
  font: italic 800 15px/1.1 var(--f-display);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}
.button:hover, #ts-forum input[type="submit"]:hover { background: var(--rust-ink); }
#ts-forum input[type="reset"], #ts-forum input.button[name="preview"], #ts-forum input.button[name="cancel"] { background: var(--graphite-2); }
#ts-forum fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px 12px; }
#ts-forum legend { padding: 0 6px; font-weight: 600; }
#ts-forum .panel { border-radius: 4px; }
#ts-forum .panelsurround { padding: 14px; }

/* Bottom of the vBulletin area: time note, links bar and licence lines, muted. */
#ts-forum form[action$="index.php"] > table.page td.tfoot { border-radius: 4px; }
#ts-forum > .smallfont, #ts-forum form .smallfont[align="center"] { color: var(--ink-3); }
#ts-f { margin-top: 40px; }
/* Archive page links added after the footer by vBSEO. */
body > div.smallfont[style*="z-index"] {
  margin: 0;
  padding: 10px var(--gutter, 32px) 18px;
  background: var(--pit, #1A1D22);
  color: var(--graphite-3);
  font-size: 11px;
  line-height: 1.8;
}
body > div.smallfont[style*="z-index"] a { color: var(--graphite-3); text-decoration: none; }
body > br { display: none; }

/* Small screens: one readable column. Counts, icons and last-post columns step aside; posts stack. */
@media (max-width: 760px) {
  #ts-forum { padding: 18px var(--gutter, 16px) 8px; }
  #ts-forum td, #ts-forum th { font-size: 15px; }
  #ts-forum .smallfont { font-size: 13px; }

  /* Breadcrumb row: the login form and the welcome box step aside (log in, account and messages are in the menu). */
  #ts-forum table.tborder:has(.navbar) > tbody > tr > td + td { display: none; }
  #ts-forum .navbar strong { font-size: 21px; }

  /* Menu strip: one row that scrolls sideways instead of running off the screen. */
  #ts-forum div.tborder:has(> table td.vbmenu_control) { overflow-x: auto; scrollbar-width: none; }
  #ts-forum div.tborder > table:has(td.vbmenu_control),
  #ts-forum div.tborder > table:has(td.vbmenu_control) > tbody { display: block; }
  #ts-forum div.tborder > table:has(td.vbmenu_control) > tbody > tr { display: flex; }
  #ts-forum div.tborder > table:has(td.vbmenu_control) td.vbmenu_control { flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }

  /* Title bars with tool menus (forum tools, search this forum): title on its own line, tools below. */
  #ts-forum table.tborder:has(> tbody > tr > td.tcat + td.vbmenu_control),
  #ts-forum table.tborder:has(> tbody > tr > td.tcat + td.vbmenu_control) > tbody { display: block; }
  #ts-forum table.tborder:has(> tbody > tr > td.tcat + td.vbmenu_control) > tbody > tr { display: flex; flex-wrap: wrap; }
  #ts-forum table.tborder:has(> tbody > tr > td.tcat + td.vbmenu_control) td.tcat { flex: 1 1 100%; box-sizing: border-box; }
  #ts-forum table.tborder:has(> tbody > tr > td.tcat + td.vbmenu_control) td.vbmenu_control { flex: 1 1 auto; text-align: center; font-size: 12px; }
  #ts-forum table:has(#threadtools) td.tcat { display: none; }

  /* Forum list: forum name and description only. */
  #ts-forum tr:has(> td.alt1Active) > td:not(.alt1Active),
  #ts-forum table:has(td.alt1Active) > thead > tr > td:not(:nth-child(2)) { display: none; }
  #ts-forum td.alt1Active { padding: 12px; }

  /* Thread list: title and starter only. */
  #ts-forum #threadslist td:nth-child(1), #ts-forum #threadslist td:nth-child(2),
  #ts-forum #threadslist td:nth-child(n+4),
  #ts-forum #threadslist tr:has(> td.thead) { display: none; }
  #ts-forum #threadslist td[id^="td_threadtitle_"] { padding: 12px; }
  #ts-forum #threadslist .smallfont[style*="nowrap"] { white-space: normal !important; }

  /* Posts: author line on top, message full width. */
  #ts-forum #posts table[id^="post"], #ts-forum #posts table[id^="post"] > tbody { display: block; width: 100%; }
  #ts-forum #posts table[id^="post"] > tbody > tr { display: flex; flex-wrap: wrap; }
  #ts-forum #posts table[id^="post"] > tbody > tr > td { display: block; box-sizing: border-box; }
  #ts-forum #posts table[id^="post"] > tbody > tr:first-child > td:first-child { flex: 1 1 auto; }
  #ts-forum #posts table[id^="post"] > tbody > tr:first-child > td:last-child { flex: 0 0 auto; }
  #ts-forum #posts td.alt2[width="175"] { width: 100% !important; flex: 1 1 100%; padding: 10px 12px; border: 0 !important; border-bottom: 1px solid var(--line) !important; }
  #ts-forum #posts td.alt2[width="175"] > div > .smallfont,
  #ts-forum #posts td.alt2[width="175"] > .smallfont:nth-of-type(n+2) { display: none; }
  #ts-forum #posts td[id^="td_post_"] { flex: 1 1 100%; width: 100%; padding: 12px; border: 0 !important; }
  #ts-forum #posts table[id^="post"] > tbody > tr:last-child > td { flex: 1 1 auto; }
  #ts-forum div[id^="post_message_"] { font-size: 16px; }

  /* Post editor: full width, toolbar scrolls sideways, smilies box hidden. */
  #ts-forum table:has(> tbody > tr > td.vBulletin_editor) { width: 100%; table-layout: fixed; }
  #ts-forum .vBulletin_editor > .controlbar { overflow-x: auto; }
  #ts-forum textarea[id^="vB_Editor_"], #ts-forum iframe[id^="vB_Editor_"] { width: 100% !important; box-sizing: border-box; }
  #ts-forum td.controlbar:has(> fieldset[id$="_smiliebox"]) { display: none; }
  #ts-forum .panelsurround, #ts-forum .panel { padding: 8px; }
  /* Form pages (reply, new thread, register, search, user CP): block layout so nothing is wider than the screen. */
  #ts-forum table.tborder:has(> tbody > tr > td.panelsurround),
  #ts-forum table.tborder:has(> tbody > tr > td.panelsurround) > tbody,
  #ts-forum table.tborder:has(> tbody > tr > td.panelsurround) > tbody > tr,
  #ts-forum table.tborder:has(> tbody > tr > td.panelsurround) > tbody > tr > td { display: block; box-sizing: border-box; width: auto; }
  #ts-forum fieldset { min-width: 0; overflow-x: auto; }
  #ts-forum .bginput, #ts-forum select, #ts-forum textarea { max-width: 100%; }
  #ts-forum table.panel, #ts-forum table.panel > tbody, #ts-forum table.panel > tbody > tr,
  #ts-forum table.panel > tbody > tr > td { display: block; width: auto; }
  #ts-forum table.panel > tbody > tr > td + td { margin-top: 10px; }
  /* User CP and private messages: the page content first, the long menu of the control panel under it. */
  #ts-forum table:has(> tbody > tr[valign="top"] > td > table.tborder a[href$="usercp.php"]),
  #ts-forum table:has(> tbody > tr[valign="top"] > td > table.tborder a[href$="usercp.php"]) > tbody { display: block; }
  #ts-forum table:has(> tbody > tr[valign="top"] > td > table.tborder a[href$="usercp.php"]) > tbody > tr { display: flex; flex-direction: column-reverse; }
  #ts-forum table:has(> tbody > tr[valign="top"] > td > table.tborder a[href$="usercp.php"]) > tbody > tr > td { display: block; width: auto !important; padding: 0 !important; margin-bottom: 18px; }
  #ts-forum table:has(> tbody > tr[valign="top"] > td > table.tborder a[href$="usercp.php"]) table.tborder { width: 100%; }
  #ts-forum td.tcat > span[style*="float"] { display: none; }

  /* Wide fixed-width boxes from the old templates. */
  #ts-forum table[width="640"], #ts-forum table[style*="width:640px"], #ts-forum div[style*="width:640px"] { width: 100% !important; }
  #ts-forum pre { width: auto !important; }
  body > div.smallfont[style*="z-index"] { padding-left: 16px; padding-right: 16px; }
}
