/*
Theme Name: WordCamp Sofia 2026 CTF
Author: ux2.dev
Description: The CTF's theme, built on the ux2dev brand tokens (brand/tokens.css).
Version: 0.8.0
Requires PHP: 8.3
*/

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--soft);
    font-family: var(--font-mono);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-on-dark);
}

.js main,
.js .site-head {
    visibility: hidden;
}

/* Out of the flow, so the content stays centred on the page. */
.site-head {
    position: absolute;
    inset: 32px 0 auto;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px;
}

.site-head img {
    display: block;
    height: 24px;
    width: auto;
    filter: invert(1);
}

main {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px;
}

main.centered {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

main.wide {
    max-width: 880px;
    padding-top: 112px;
    padding-bottom: 80px;
}


.site-head:has(~ main.wide) {
    max-width: 880px;
}

h1 {
    margin: 0 0 16px;
    font: 700 clamp(64px, 14vw, 120px)/1 var(--font-sans);
    letter-spacing: -0.04em;
    color: var(--accent-on-dark);
}

h1 span {
    display: inline-block;
}

h1.page-title {
    font-size: clamp(40px, 8vw, 64px);
}

p {
    margin: 0 0 32px;
    font-size: 17px;
    line-height: 1.6;
}

code {
    color: var(--white);
    word-break: break-all;
}

form.line {
    display: flex;
    border-bottom: 2px solid var(--ink-3);
}

form.line:focus-within {
    border-color: var(--accent);
}

input {
    flex: 1;
    min-width: 0;
    padding: 14px 0;
    border: 0;
    background: none;
    color: var(--white);
    font: 18px var(--font-mono);
    outline: none;
}

button {
    padding: 0 4px 0 16px;
    border: 0;
    background: none;
    color: var(--accent-on-dark);
    font: 600 18px var(--font-mono);
    cursor: pointer;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nope,
.yes {
    margin: 16px 0 0;
    font-size: 14px;
}

.nope {
    color: var(--w2);
}

.yes {
    color: var(--accent-on-dark);
}

.nope:empty {
    display: none;
}

.muted {
    font-size: 14px;
    color: #9a9a9a;
}

.go {
    font-weight: 600;
    text-decoration: none;
}

.go:hover {
    text-decoration: underline;
}

.kicker {
    margin: 0 0 8px;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a9a9a;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---- warp (front page → /register/) ---- */

.warp-stars,
.warp-flash {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.warp-stars {
    z-index: 40;
}

.warp-flash {
    z-index: 50;
    background: var(--accent);
    opacity: 0;
}

html.warp-in::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--accent);
    opacity: var(--flash, 1);
    pointer-events: none;
}

/* ---- /play/ ---- */

.run-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.clock {
    margin: 0;
    font: 700 clamp(48px, 10vw, 80px)/1 var(--font-sans);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    color: var(--white);
}

.flash {
    margin: 0 0 24px;
    font-size: 16px;
}

.stages {
    margin: 0 0 40px;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--ink-3);
}

.stage {
    padding: 18px 0;
    border-bottom: 1px solid var(--ink-3);
}

.stage:not(.current),
.stage-row {
    display: flex;
    gap: 16px;
    align-items: baseline;
}

.stage .n {
    width: 1.5em;
    color: #9a9a9a;
}

.stage .title {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 20px;
    font-weight: 600;
    color: var(--white);
}

.stage .split {
    font-variant-numeric: tabular-nums;
}

.stage.done .split {
    color: var(--accent-on-dark);
}

.stage.locked {
    opacity: 0.45;
}

.stage.current {
    padding: 24px 0 28px;
}

.stage.current .title {
    font-size: 28px;
}

.stage.current > p,
.stage.current > form,
.stage.current > .hints {
    margin-left: calc(1.5em + 16px);
}

.tagline {
    margin: 8px 0 16px;
    color: #9a9a9a;
    font-style: italic;
}

.clue {
    color: var(--accent-on-dark);
}

.hints {
    margin-top: 20px;
}

.hints form {
    display: inline-block;
    margin: 0 12px 8px 0;
}

.hint-btn {
    padding: 8px 12px;
    border: 1px solid var(--ink-3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--soft);
}

.hint-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.hint {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--w2);
}

.resume summary {
    cursor: pointer;
    color: #9a9a9a;
}

.resume input {
    width: 100%;
    font-size: 13px;
    border-bottom: 1px solid var(--ink-3);
}

/* ---- /leaderboard/ ---- */

.solving {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 14px;
    color: #9a9a9a;
}

.solving b {
    color: var(--white);
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.board {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.board th,
.board td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--ink-3);
    text-align: left;
}

.board th {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a9a9a;
}

.board .handle {
    color: var(--white);
    font-weight: 600;
}

.board .official {
    color: var(--accent-on-dark);
    font-weight: 600;
}

.blood {
    color: var(--w3);
}

/* ---- /plugin-inspector/: a light wp-admin lookalike ---- */

.inspector {
    padding: 24px;
    border-radius: 12px;
    background: #f0f0f1;
    color: #3c434a;
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.inspector h1 {
    margin: 0 0 12px;
    font-family: inherit;
    font-size: 23px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
    color: #1d2327;
}

.inspector .notice {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 4px solid #00a32a;
    background: #fff;
}

.inspector .subsubsub {
    display: flex;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

.inspector .subsubsub a {
    color: #2271b1;
    text-decoration: none;
}

.inspector .subsubsub a.current {
    color: #1d2327;
    font-weight: 600;
}

.inspector .subsubsub li + li::before {
    content: '|';
    margin-right: 8px;
    color: #a7aaad;
}

.inspector .count {
    color: #50575e;
    font-weight: 400;
}

.inspector .plugins {
    width: 100%;
    border: 1px solid #c3c4c7;
    border-collapse: collapse;
    background: #fff;
}

.inspector .plugins th,
.inspector .plugins td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f1;
    text-align: left;
    vertical-align: top;
}

.inspector .plugins tr.active td {
    background: #f0f6fc;
}

.inspector .plugins tr.active td:first-child {
    box-shadow: inset 4px 0 0 #72aee6;
}

.inspector strong {
    color: #1d2327;
}

.inspector .row-actions {
    font-size: 13px;
}

.inspector .row-actions a {
    color: #2271b1;
}

.inspector .row-actions .disabled {
    color: #a7aaad;
}

.inspector .footnote {
    margin: 12px 0 0;
    font-size: 13px;
    color: #646970;
}

/* ---- /cookie-jar/ ---- */

.go-btn {
    padding: 12px 18px;
    border: 1px solid var(--accent);
    border-radius: 10px;
}

.jar {
    margin: 0 0 32px;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--white);
}

.jar:empty {
    display: none;
}

@media (max-width: 640px) {
    .run-head {
        flex-direction: column;
    }

    .stage.current > p,
    .stage.current > form,
    .stage.current > .hints {
        margin-left: 0;
    }
}

/* ---- </> view source (every page) ---- */

.source-btn {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 30;
    padding: 8px 12px;
    border: 1px solid var(--ink-3);
    border-radius: 8px;
    background: var(--ink-2);
    color: #9a9a9a;
    font-size: 14px;
}

.source-btn:hover {
    color: var(--accent-on-dark);
}

.source {
    width: min(100vw - 24px, 960px);
    height: min(100vh - 24px, 720px);
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid var(--ink-3);
    border-radius: 12px;
    background: var(--ink-2);
    color: var(--soft);
}

.source[open] {
    display: flex;
    flex-direction: column;
}

.source::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.source-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid var(--ink-3);
}

.source-bar p {
    margin: 0;
    font-size: 13px;
    color: #9a9a9a;
}

.source-bar button {
    padding: 6px 10px;
    font-size: 14px;
}

.source pre {
    flex: 1;
    margin: 0;
    padding: 16px;
    overflow: auto;
    font: 12px/1.5 var(--font-mono);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---- /ask-wapuu/ ---- */

.chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.msg.user {
    align-self: flex-end;
    background: var(--accent);
    color: var(--on-accent);
}

.msg.wapuu {
    align-self: flex-start;
    background: var(--ink-2);
    border: 1px solid var(--ink-3);
    color: var(--soft);
}

.chat-page form.line button:disabled {
    opacity: 0.4;
    cursor: wait;
}

.chat-page form.line {
    margin-bottom: 32px;
}

/* ---- loading states (assets/busy.js, home.js, wapuu.js, cookie-jar.js) ---- */

button {
    position: relative;
}

/* The label stays (so the button keeps its size) but goes invisible under the spinner. */
button.is-busy {
    color: transparent !important;
    pointer-events: none;
}

button.is-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid var(--accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: ctf-spin 0.7s linear infinite;
}

/* The line forms' arrow buttons sit off-centre (left padding); centre the spinner on the glyph. */
form.line button.is-busy::after {
    left: calc(50% + 6px);
}

.msg.typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 14px 16px;
}

.msg.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: ctf-dot 1.1s ease-in-out infinite;
}

.msg.typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.msg.typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ctf-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ctf-dot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    button.is-busy::after {
        animation-duration: 2s;
    }

    .msg.typing span {
        animation: none;
        opacity: 0.6;
    }
}

/* ---- /play/: prize contact ---- */

.contact {
    margin: 0 0 40px;
    padding: 24px;
    border: 1px solid var(--ink-3);
    border-radius: 16px;
}

.contact h2 {
    margin: 0 0 8px;
    font: 600 22px/1.3 var(--font-sans);
    color: var(--white);
}

.contact p {
    margin-bottom: 16px;
    font-size: 15px;
}

.contact .consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #9a9a9a;
    cursor: pointer;
}

.contact .consent input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    padding: 0;
    accent-color: var(--accent);
}
