/* Terminal but make it witchy~ */

:root {
    --background: #0a0a0a;
    --panel: #050507;
    --accent: #dd46ee;
    --main-color: #dd46ee;
    --access-font: #101010;
    --muted: #7c828c;
    --token-bg: rgba(221, 70, 238, 0.2);
    --token-border: rgba(221, 70, 238, 0.4);
    --border: #27302d;
}

@font-face {
    font-family: "Modeseven-L3n5";
    src: url("https://raw.githubusercontent.com/Mordraga/BarazhadHost/main/Terminal/Modeseven-L3n5.ttf") format("truetype");
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    height: 100vh;
    padding: 0;
    overflow: hidden;
    background: var(--background);
    color: var(--main-color);
    font-family: "Modeseven-L3n5", monospace;
    font-size: clamp(1rem, 1.1vw, 1.25rem);
}

.screen {
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    border: 2px solid var(--border);
    background: var(--panel);
    display: grid;
    grid-template-rows: 1fr auto;
}

.terminalPage {
    position: relative;
    isolation: isolate;
    min-height: 0;
    padding: clamp(1rem, 2vw, 2rem);
    margin: 5px;
    border: var(--accent), solid;
    border-radius: 10px;
    line-height: 1.65;
    overflow-x: hidden;
    overflow-y: auto;
}

.terminalPage::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.14;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.16) 0 1px,
            rgba(0, 0, 0, 0) 1px 3px
    );
    animation: scanlineDrift 10s linear infinite;
}

.terminalPage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0.18;
    background: linear-gradient(
        to bottom,
        rgba(221, 70, 238, 0) 0%,
        rgba(221, 70, 238, 0.22) 50%,
        rgba(221, 70, 238, 0) 100%
    );
    background-repeat: no-repeat;
    background-size: 100% 36%;
    background-position: 0 -160%;
    animation: crtSweep 7s linear infinite;
}

.terminalPage > * {
    position: relative;
    z-index: 1;
}

h1,
h2,
h3,
h4 {
    font-size: 1.25rem;
}

h1 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    text-decoration: underline;
    letter-spacing: 0.02em;
    text-shadow: 0.4px 0 currentColor;
}

p {
    margin: 0;
    max-width: 100ch;
    margin-top: 15px;
}

codeblock {
    display: inline-block;
    color: var(--access-font);
    background: var(--main-color);
    border: 1px solid var(--token-border);
    padding: 0.09em 0.28em;
    cursor: pointer;
    transition: transform 200ms ease, background-color 200ms ease;
}

codeblock:hover {
    transform: scale(1.08);
    background: #ff78ff;
}

.terminalLog {
    margin-top: 0;
}

.terminalLog p {
    margin: 0 0 0.5rem;
    max-width: none;
}

@keyframes terminalTyping {
    from {
        clip-path: inset(0 100% 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}

.terminalLog .terminalLine--typing {
    clip-path: inset(0 100% 0 0);
    animation: terminalTyping var(--typing-duration, 420ms) steps(var(--typing-steps, 24), end) forwards;
}

.terminalLog .echo {
    color: var(--muted);
}


.terminalToken {
    display: inline-block;
    font: inherit;
    color: var(--access-font);
    background: var(--main-color);
    border: 1px solid var(--token-border);
    padding: 0.05em 0.28em;
    margin: 0 0.12em;
    text-decoration: none;
    cursor: pointer;
    transition: transform 200ms ease, background-color 200ms ease;
}

.terminalToken:hover,
.terminalToken:focus-visible {
    background: #ff78ff;
    transform: scale(1.08);
    outline: none;
}

.terminalToken--path {
    appearance: none;
}

.toastStack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 40;
    width: min(32rem, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.commandToast {
    width: 100%;
    border: 2px solid var(--token-border);
    background: rgba(5, 5, 7, 0.96);
    color: var(--main-color);
    padding: 0.9rem 1rem;
    box-shadow: 0 0 0 1px rgba(221, 70, 238, 0.15), 0 18px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: auto;
}

.commandToast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.commandToast__message {
    margin: 0;
}

.redirectToast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 30;
    width: min(32rem, calc(100vw - 2rem));
    border: 2px solid var(--token-border);
    background: rgba(5, 5, 7, 0.96);
    color: var(--main-color);
    padding: 0.9rem 1rem;
    box-shadow: 0 0 0 1px rgba(221, 70, 238, 0.15), 0 18px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.redirectToast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.redirectToast__message {
    margin: 0;
}

.redirectToast__destination {
    margin: 0.25rem 0 0.75rem;
    color: var(--muted);
}

.redirectToast__actions {
    display: flex;
    gap: 0.5rem;
}

.redirectToast__button {
    border: 1px solid var(--token-border);
    background: var(--main-color);
    color: var(--access-font);
    font: inherit;
    line-height: 1;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
}

.redirectToast__button:hover,
.redirectToast__button:focus-visible {
    background: #ff78ff;
    outline: none;
}

.redirectToast__button--subtle {
    background: transparent;
    color: var(--main-color);
}

.redirectToast__button--subtle:hover,
.redirectToast__button--subtle:focus-visible {
    background: rgba(221, 70, 238, 0.2);
}

.input-button-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.7rem 1.25rem;
    border-top: 2px solid var(--border);
}

.prompt {
    flex: 0 0 auto;
}

.inputShell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    min-width: 12ch;
    max-width: 86ch;
    width: 12ch;
    outline: none;
    cursor: text;
}

.inputShell.is-focused {
    text-shadow: 0 0 1px var(--accent);
}

.keyboardCapture {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: auto;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    font: inherit;
    z-index: 1;
    appearance: none;
    -webkit-appearance: none;
    -webkit-text-fill-color: transparent;
}

.promptText,
.cursor {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.promptText {
    color: var(--main-color);
    white-space: pre;
}

.promptText--placeholder {
    color: var(--muted);
}

.cursor {
    display: inline-block;
    flex: 0 0 auto;
    width: 0.62em;
    height: 1em;
    margin-left: 0.04em;
    background: var(--accent);
    vertical-align: -0.12em;
    opacity: 1;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

@keyframes scanlineDrift {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 6px;
    }
}

@keyframes crtSweep {
    from {
        background-position: 0 -160%;
    }

    to {
        background-position: 0 160%;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    body {
        font-size: 0.92rem;
    }

    .terminalPage {
        padding: 0.75rem;
        line-height: 1.5;
    }

    .terminalLog p {
        margin: 0 0 0.42rem;
    }

    .input-button-wrapper {
        min-height: 3.1rem;
        padding: 0.5rem 0.75rem;
    }

    .inputShell {
        min-width: 10ch;
        max-width: 74ch;
    }

    .toastStack {
        right: 0.6rem;
        bottom: 0.6rem;
        width: calc(100vw - 1.2rem);
    }

    .redirectToast {
        right: 0.6rem;
        bottom: 0.6rem;
        width: calc(100vw - 1.2rem);
    }
}
