/* Corruption — the CSS has been corrupted: sideways text, wrong sizes, misaligned everything */

@keyframes glitch-pos {
    0%, 90%, 100% { transform: translateX(0) skewX(0deg); }
    91%            { transform: translateX(-6px) skewX(-2deg); }
    93%            { transform: translateX(8px) skewX(1deg); }
    95%            { transform: translateX(-3px) skewX(3deg); }
    97%            { transform: translateX(5px) skewX(-1deg); }
}

@keyframes color-corrupt {
    0%, 85%, 100% { filter: none; }
    86%  { filter: hue-rotate(90deg) contrast(2); }
    88%  { filter: invert(1); }
    90%  { filter: hue-rotate(200deg) saturate(5); }
    92%  { filter: none; }
}

@keyframes flicker-text {
    0%, 97%, 100% { opacity: 1; }
    98%            { opacity: 0.1; }
    99%            { opacity: 0.7; }
}

body, input, button, textarea, select {
    background-color: #f0e800;
    color: #1a0050;
    font-family: 'Arial', sans-serif;
    font-size: 10pt;
}

/* Horizontal stripes of pure clashing colors */
body {
    background: repeating-linear-gradient(
        180deg,
        #f0e800 0px,
        #f0e800 40px,
        #ff3366 40px,
        #ff3366 80px,
        #00ffcc 80px,
        #00ffcc 120px,
        #cc00ff 120px,
        #cc00ff 160px,
        #ff6600 160px,
        #ff6600 200px
    );
    min-height: 100vh;
}

/* Full wrapper is slightly rotated and glitching */
.wrapper {
    transform: rotate(-0.6deg);
    animation: glitch-pos 8s step-end infinite;
    transform-origin: 50% 0;
    position: relative;
    z-index: 1;
}

/* Header looks wrong: oversized, misaligned text, conflicting colors */
header {
    background: #1a0050;
    color: #ff3366;
    border-bottom: 8px solid #00ffcc;
    border-top: 2px solid #f0e800;
    border-radius: 0 0 40px 0;
    text-align: right;
    padding-right: 40px;
    animation: color-corrupt 12s step-end infinite;
    font-size: 9pt;

    a {
        color: #f0e800;
        text-decoration: none;
        font-size: 18pt;
        font-family: 'Times New Roman', serif;
        font-style: italic;
        text-shadow: 3px 3px 0 #ff3366, -3px -3px 0 #00ffcc;
    }
}

.subheader {
    background: #ff3366;
    border-bottom: 6px solid #1a0050;
    border-left: 20px solid #f0e800;
    text-align: center;

    .title {
        transform: skewX(-5deg);
        display: inline-block;
    }
    .title, .title a {
        color: #1a0050;
        font-family: 'Courier New', monospace;
        font-size: 20pt;
        font-weight: bold;
        text-shadow: 2px 2px 0 #00ffcc;
        text-decoration: none;
    }
}

.board, .post, .thread, .thread-warning, .flashed-message, .recent-post {
    border-top: none;
    border-bottom: none;
    margin-bottom: 6px;
    position: relative;
}

/* Every nth-child has wildly different sizing, fonts, and positioning */
.board:nth-child(5n+1), .post:nth-child(5n+1), .thread:nth-child(5n+1), .recent-post:nth-child(5n+1) {
    background: #00ffcc;
    color: #1a0050;
    font-family: 'Impact', sans-serif;
    font-size: 16pt;
    margin-left: -12px;
    border: 5px solid #1a0050;
    border-right: 20px solid #ff3366;
    transform: rotate(1.2deg);
    padding: 20px;
}

.board:nth-child(5n+2), .post:nth-child(5n+2), .thread:nth-child(5n+2), .recent-post:nth-child(5n+2) {
    background: #cc00ff;
    color: #f0e800;
    font-family: 'Georgia', serif;
    font-size: 8pt;
    margin-left: 40px;
    border: 1px dashed #f0e800;
    transform: rotate(-2.5deg) scaleX(0.9);
    padding: 6px;
    max-width: 70%;
}

.board:nth-child(5n+3), .post:nth-child(5n+3), .thread:nth-child(5n+3), .recent-post:nth-child(5n+3) {
    background: #ff6600;
    color: #1a0050;
    font-family: 'Courier New', monospace;
    font-size: 13pt;
    border: 8px double #1a0050;
    margin-left: 80px;
    transform: rotate(0.5deg);
    /* Sideways card via writing-mode */
    writing-mode: horizontal-tb;
    max-width: 60%;
}

.board:nth-child(5n+4), .post:nth-child(5n+4), .thread:nth-child(5n+4), .recent-post:nth-child(5n+4) {
    background: #1a0050;
    color: #00ffcc;
    font-family: 'Arial Black', sans-serif;
    font-size: 22pt;
    border: 3px solid #f0e800;
    border-left: none;
    margin-left: -30px;
    transform: rotate(-0.8deg);
    text-transform: uppercase;
    padding: 8px 40px 8px 8px;
    animation: flicker-text 5s step-end infinite;
}

.board:nth-child(5n+0), .post:nth-child(5n+0), .thread:nth-child(5n+0), .recent-post:nth-child(5n+0) {
    background: #f0e800;
    color: #ff3366;
    font-family: 'Comic Sans MS', cursive;
    font-size: 9pt;
    border-bottom: 4px solid #cc00ff;
    border-top: 4px solid #cc00ff;
    margin-left: 20px;
    transform: rotate(3.5deg);
    max-width: 75%;
}

/* Sideways posts: every 7th post is rotated 90 degrees */
.post:nth-child(7n) {
    writing-mode: vertical-rl;
    max-height: 260px;
    min-width: 80px;
    overflow: hidden;
    float: left;
    margin-right: 16px;
    margin-bottom: 16px;
    transform: rotate(0deg);
}
.post:nth-child(7n+4) {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    max-height: 200px;
    min-width: 70px;
    overflow: hidden;
    float: right;
    margin-left: 16px;
    transform: rotate(180deg);
}

.posts::after { content: ''; display: block; clear: both; }

.board .name, .thread .name, .recent-post .name,
.recent-posts-header h2 a, .recent-attachments h2 a {
    font-family: 'Times New Roman', serif;
    font-size: 14pt;
    font-style: italic;
    text-decoration: none;
    color: inherit;
}

:is(.subheader .right .button, form input[type=submit]) {
    background: #f0e800;
    border: 4px solid #1a0050;
    color: #1a0050;
    border-radius: 0 20px 0 20px;
    font-size: 13pt;
    font-family: 'Impact', sans-serif;
    text-transform: uppercase;
    letter-spacing: 3px;
    transform: rotate(-3deg);
    display: inline-block;

    &:hover { background: #1a0050; color: #f0e800; transform: rotate(2deg) scale(1.1); }
}

a { color: #1a0050; text-decoration: underline wavy; font-weight: bold; }
a:visited { color: #550066; }

.sort-bar {
    background: #cc00ff;
    color: #f0e800;
    padding: 6px 12px;
    margin-bottom: 8px;
    transform: rotate(-1deg) skewX(-3deg);
    display: inline-block;
    font-family: 'Courier New', monospace;
    a { color: #00ffcc; font-size: 14pt; font-weight: bold; &.sort-active { color: #f0e800; } }
}

.pager {
    a, span, span.current {
        background: #ff3366;
        border: 3px solid #f0e800;
        color: #f0e800;
        border-radius: 0;
        font-family: 'Impact', sans-serif;
        font-size: 14pt;
        transform: rotate(-1deg);
        display: inline-block;
        box-shadow: 4px 4px 0 #1a0050;
    }
    span.current { background: #1a0050; border-color: #00ffcc; color: #00ffcc; }
    a:hover { background: #1a0050; transform: rotate(2deg) scale(1.1); }
}

.posts .post-meta {
    background: #00ffcc;
    border-top: 4px dashed #1a0050;
    color: #1a0050;

    a { color: #1a0050; font-weight: bold; }
}

.recent-attachments-gallery .recent-attachment {
    background: #f0e800;
    border: 4px solid #ff3366;
    transform: rotate(-2deg);
    box-shadow: 6px 6px 0 #1a0050;
}

.form, form {
    background: #f0e800;
    border: 6px solid #1a0050;
    transform: rotate(0.5deg);
    box-shadow: 8px 8px 0 #ff3366;
}

input[type=text], input[type=password], input[type=number], textarea, select {
    background: #fff;
    border: 3px solid #1a0050;
    color: #1a0050;
    border-radius: 0;
    font-family: 'Courier New', monospace;
}

.board .description, .thread .author, .thread .time, .thread .reply-count, .thread .view-count { color: inherit; opacity: .8; }
.post .author { font-weight: bold; color: inherit; }
.post .time { color: inherit; opacity: .7; }
.post .time a { color: inherit; opacity: .7; text-decoration: none; }
.thread .time a { color: inherit; opacity: .7; text-decoration: none; }

.post .text { .greentext { color: inherit; font-style: italic; } }
mark { background: #ff3366; color: #f0e800; border: 2px solid #1a0050; }
footer, footer a { color: #1a0050; font-size: 8pt; font-family: 'Courier New', monospace; }
footer { transform: rotate(1.5deg); display: inline-block; margin-left: 40px; }
.thread-warning { background: #ff3366; border: 5px solid #f0e800; color: #f0e800; font-family: 'Impact', sans-serif; }
h3 { color: #cc00ff; font-family: 'Times New Roman', serif; font-size: 18pt; }
.boards h2, .recent-posts-header h2, .recent-attachments h2 {
    color: #ff3366;
    font-family: 'Impact', sans-serif;
    font-size: 24pt;
    background: #1a0050;
    padding: 4px 12px;
    transform: skewX(-4deg);
    display: inline-block;
    letter-spacing: 3px;
    box-shadow: 6px 4px 0 #f0e800;
}
.ip_hash { background: #ff3366 !important; color: #f0e800 !important; }
