/* brutalist-base.css -- the brutalist theme's replacement for master.css.
 *
 * Brutalist does not restyle the site; it removes the styling so the browser's
 * own rendering shows through. That is impossible to do by layering overrides
 * on top of the normal stylesheets (scrollbars can't be un-styled, appearance
 * and border rules win on specificity, and the reset is global), so the normal
 * stylesheets are disabled entirely and this file takes their place.
 *
 * Only the layout that the page's JS depends on is kept. Everything visual is
 * the browser default.
 *
 * Loaded by theme.js only while data-theme="brutalist".
 */

/* ===== DEFAULTS ===== */
/* Deliberately minimal: no reset of margins/padding, no box-sizing change, no
   custom scrollbar, no font-face. The point is that the browser decides. */

/* The column flex on body is layout, not decoration: the normal themes use it
   to centre page-level children, which is what keeps the "Back to the catalog"
   link centred at the bottom of a thread. Keep it. */
body {
    background: #ffffff;
    color: #000000;
    font-family: serif;
    font-size: 16px;
    line-height: normal;
    padding: 8px;                /* the browser's own default */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Links: the default look. Blue, underlined, purple once visited. */
a {
    color: #0000ee;
    text-decoration: underline;
}

a:visited {
    color: #551a8b;
}

a:hover,
a:active {
    color: #ee0000;
}

/* Headings and paragraphs get their default margins back. */
h1, h2, h3, h4, h5, h6, p, ul, ol, li, blockquote, dl, dd, dt, figure, table {
    margin: revert;
    padding: revert;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
}

/* ===== TEXT THAT MUST STAY MONOSPACE ===== */
/* The ASCII banner is drawn with box-drawing characters; it only aligns in a
   fixed-width font. This is the one place where a specific font is required
   rather than left to the browser. */
#ascii-banner,
#daily-message {
    font-family: monospace;
    font-size: 1.2vw;
    white-space: pre;
    color: #000000;
    text-shadow: none;
    line-height: 1.1;
    margin: 0;
    padding: 0;
}

@media (max-width: 768px) {
    #ascii-banner,
    #daily-message {
        font-size: 2.5vw;
    }
}

.banner-container {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

/* ===== FORMS ===== */
/* Native widgets. No appearance overrides, no custom borders, no colours. */
input,
textarea,
select,
button {
    font-family: revert;
    font-size: revert;
    color: revert;
    background-color: revert;
    border: revert;
    border-radius: revert;
    padding: revert;
    appearance: auto;
}

/* The file input is hidden by the markup itself (style="display: none") and
   its <label> is the visible control. The label must stay a real, visible,
   clickable box -- hiding the icon or collapsing it to a bare link leaves the
   page with no way to attach media. Keep it a plain bordered button with the
   icon visible. */
.custom-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 34px;
    padding: 4px 8px;
    background: revert;
    color: revert;
    border: revert;
    cursor: pointer;
}

.custom-file-upload:hover {
    background: revert;
    color: revert;
}

.custom-file-upload svg {
    display: block;
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

#fileNameDisplay {
    font-size: revert;
    color: #000000;
    text-align: left;
    min-height: 0;
}

/* ===== LAYOUT THE JS DEPENDS ON ===== */
/* These keep the page's structure working without imposing any styling. */

#formContainer {
    width: 90vw;
    margin: 20px auto;
}

#formInputContainer {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

#messageInput {
    flex: 1;
    width: auto;
}

#formExtras {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

#signatureStuff {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.button-toolbar {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
    justify-content: center;
}

#threadsContainer {
    display: flex;
    flex-wrap: wrap;
    width: 90vw;
    justify-content: center;
    gap: 20px;
    margin: 20px auto;
}

/* Thread preview cards. The border is what separates one card from the next
   on the index page, so it has to stay -- a hairline rule, no colour, no
   radius, no shadow, no hover lift. */
.threadContainer {
    width: 30vh;
    height: 30vh;
    padding: 8px;
    overflow: hidden;
    border: 1px solid #000000;
    background: #ffffff;
    cursor: pointer;
}

.threadContainer:hover {
    border-color: #000000;
    transform: none;
    box-shadow: none;
}

.threadBody {
    padding: 0;
    height: 80%;
    overflow: auto;
}

.postCount {
    font-size: 14px;
    color: #000000;
}

/* Full message text. No line clamp here: this is shared by the index preview
   cards and the messageboard, and a clamp on the messageboard truncated real
   posts with an ellipsis. The 5-line clamp for the index previews is applied
   in brutalist-index.css, where it belongs.

   padding-top is the gap between the metadata rule and the body text; the
   normal themes get it from --padding (10px) in messageboard.css. Without it
   the text sits right under the underline. margin-bottom matches the original
   too. */
.message {
    font-size: revert;
    margin-bottom: 8px;
    padding-top: 10px;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
}

/* Metadata strip under a thread preview. On the index card the metadata sits
   BELOW the message, so the rule goes on top of it. On the messageboard the
   metadata sits ABOVE the message, so the rule goes underneath instead -- see
   the .messageContainer rule below. Keeping these separate is what stops a
   post from getting a line both above and below its usernames. */
.threadContainer .messageMetadata {
    border-top: 1px solid #808080;
    padding: 4px 0 0 0;
    font-size: 14px;
    color: #000000;
    text-align: right;
}

.messageMediaThumbnail {
    width: 100%;
    max-width: 200px;
    cursor: pointer;
    border: none;
}

/* ===== MESSAGEBOARD POSTS ===== */
/* Each post is a bordered block. The metadata strip sits at the TOP of the
   post (signature left, timestamp right) and a rule separates it from the
   body -- that is the original layout, and without these rules the signature
   and hash drift to the right-hand side and the separators disappear. */
.messageContainer {
    border: 1px solid #808080;
    padding: 12px;
    margin-bottom: 10px;
    max-width: 70vw;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: #000000;
}

.messageBody {
    display: inline-block;
}

/* Messageboard post header: signature left, timestamp right, single rule
   UNDERNEATH separating it from the message body. No border-top here. */
.messageContainer > .messageMetadata {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    border-top: none;
    border-bottom: 1px solid #808080;
    padding-bottom: 5px;
    margin-top: 5px;
    font-size: 14px;
    color: #000000;
    text-align: left;
}

.signature {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-align: left;
    font-size: 16px;
    font-weight: bold;
    color: #000000;
    cursor: pointer;
}

.hash {
    font-size: 10px;
    color: #808080;
}

.timestamp {
    display: flex;
    flex-direction: row;
    gap: 10px;
    text-align: right;
    font-size: 14px;
    color: #000000;
}

.messageId {
    color: #0000ee;
    text-decoration: underline;
    cursor: pointer;
}

.backlinks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    color: #000000;
    margin: 4px 0;
}

.messageMedia {
    max-width: 100%;
    margin-top: 10px;
    border: 1px solid #808080;
}

/* Reply previews and quotes inside a post. */
.reply-preview,
.reply-to-you {
    border-left: 3px solid #808080;
    padding-left: 8px;
    margin: 4px 0;
    color: #000000;
}

/* Drag-and-drop target feedback. */
#formContainer.drag-over {
    outline: 2px dashed #000000;
}

/* ===== FOOTER / SWITCHER ===== */
.site-footer {
    margin-top: 20px;
    padding-bottom: 20px;
    text-align: center;
}

/* Swatch buttons. They have no text content, so the browser's default button
   padding leaves them about 14px wide -- too small to hit. The size is set
   explicitly here; the fill colour comes from theme.js as an inline
   background, and the active one gets a plain black ring. */
.theme-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0 2px;
    border: 1px solid #000000;
    border-radius: 0;
    cursor: pointer;
    vertical-align: middle;
}

/* The switcher keeps its swatch colours: that is the only way to tell the
   buttons apart. The active one gets a plain black ring instead of a glow. */
.theme-btn.active {
    outline: 2px solid #000000;
    outline-offset: 1px;
}

/* ===== MODALS ===== */
/* The media modal is opened by JS, which sets `modal.style.display = "block"`.
   It must NOT be a flex container: the image is panned by dragging, and the
   drag handler moves it by writing `style.left` / `style.top` in px on top of
   a `translate(-50%, -50%)` transform. A flex parent lays the image out
   itself and ignores those offsets, so the image cannot be moved. Block
   layout with `margin: auto` (as in the original) keeps the drag working. */
.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    padding-top: 2%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999;
}

.modal-content {
    display: block;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 80vw;
    max-height: 80vh;
    background: #ffffff;
    border: 1px solid #000000;
}

/* The pannable media. `position: absolute` is required: the drag handler
   writes left/top in px and a translate(-50%, -50%) centres it, neither of
   which applies to a statically positioned element. */
#modalImage,
#modalVideo {
    position: absolute;
    max-width: 80vw;
    max-height: 80vh;
    cursor: grab;
    user-select: none;
}

#modalAudio {
    width: 90%;
    max-width: 600px;
    height: 54px;
    border: none;
}

/* The close button is a normal in-flow sibling of the media, and the media is
   absolutely positioned, so the button is the only thing in flow. `.modal-
   content` gives it `margin: auto`, which centres it horizontally in the
   modal. Do not float it -- the media is out of flow, so a float has nothing
   to sit beside and lands in the wrong place. */
#modalClose {
    display: block;
    margin: 0 auto;
    cursor: pointer;
    padding: 4px 16px;
    font-family: revert;
    font-size: revert;
    color: revert;
    background-color: revert;
    border: revert;
    appearance: auto;
}

/* ===== MISC ===== */
#popup-blocker-notice {
    color: #cc0000;
    border: 1px solid #cc0000;
    padding: 8px;
    max-width: 800px;
    margin: 10px 0;
}

.loading,
.empty-state {
    color: #000000;
    text-align: center;
    padding: 16px;
}

.nav-bar,
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 16px 0;
    flex-wrap: wrap;
}
