/* Importing VT323 font from Google Fonts to style text elements across the website */
@import url(https://fonts.googleapis.com/css?family=VT323);

:root {
    --terminal-accent: #83d8ff;
    --terminal-text: color-mix(in srgb, var(--terminal-accent) 45%, white);
    --terminal-glow: color-mix(in srgb, var(--terminal-accent) 65%, white);
    --terminal-glow-soft: color-mix(in srgb, var(--terminal-accent) 30%, transparent);
}

/* Definitions of keyframes for CSS animations used throughout the site */
@keyframes scroll {
    0% { height: 0; }
    100% { height: 100%; }
}

@keyframes blink {
    to { opacity: 0; }
}

@keyframes scan {
    from { top: 0; }
    to { top: 100%; }
}

@keyframes output-scan-out {
    from {
        clip-path: inset(0 0 0 0);
        opacity: 1;
        transform: translateY(0);
    }
    to {
        clip-path: inset(100% 0 0 0);
        opacity: 0;
        transform: translateY(10px);
    }
}

@keyframes output-scan-in {
    from {
        clip-path: inset(0 0 100% 0);
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        clip-path: inset(0 0 0 0);
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glow effect for webkit browsers using text-shadow transitions */
@-webkit-keyframes glow {
    from {
        text-shadow: 0 0 1px var(--terminal-glow-soft);
    }
    to {
        text-shadow: 0 0 1px var(--terminal-glow), 0 0 2px var(--terminal-glow-soft);
    }
}

@keyframes flicker {
    /* Consistent light flicker effect through opacity changes */
    0%, 5%, 10%, 15%, 75%, 80%, 85%, 90%, 95%, 100% { opacity: 0.05795; }
    20%, 25%, 30%, 35%, 40%, 60%, 65%, 70% { opacity: 0.15795; }
    45%, 50%, 55% { opacity: 0.25795; }
}

/* Global style rules applying to all elements */
* {
    box-sizing: border-box;
}

/* Base styles for html and body tags, setting font, background, and full height */
html, body {
    background: #383838;
    color: var(--terminal-text);
    font-size: 1.4em; /* Corrected to show latest declaration which will be applied */
    font-family: 'VT323', Courier;
    height: 100%;
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    overflow-x: hidden;
    overflow-y: overlay;
    animation: glow 5s ease-in-out infinite alternate; /* Ensures the glow effect is applied cross-browser */
}

/* Styling for custom scrollbars applied to the body */
body::-webkit-scrollbar { 
    width: 15px;
    z-index: 999;
    position: fixed;
} 

body::-webkit-scrollbar-track { 
    display: none;
}

body::-webkit-scrollbar-thumb { 
    background: color-mix(in srgb, var(--terminal-accent) 40%, transparent);
    border-radius: 20px;
    outline: #253d476c;
}

body::-webkit-scrollbar-thumb:hover { 
    background: #558ca58f; 
}

body::-webkit-scrollbar-button { 
    display: none; 
}

/* Unified styles for all heading elements */
h1, h2, h3, h4, h5, h6 { 
    font-weight: normal;
    margin: 0;
    text-transform: uppercase;
}

/* Link styles with hover effects */
a {
    color: white;    
    text-decoration: none;
}

a:hover {
    color: var(--terminal-text);
}

/* Button styling consistent with link styles */
button {
    color: white;
    text-decoration: none;
    font-size: 1.0em;
    font-family: 'VT323', Courier;
    text-transform: uppercase;
    background: none;
    border: none;
    animation: glow 5s ease-in-out infinite alternate;
    cursor: pointer; /* Corrected to include cursor property */
}

button:hover {
    color: var(--terminal-accent);
}

/* Paragraph styles ensuring consistent margin and line height */
p { 
    line-height: 100%;
    margin: 0; 
}

/* Animation applied to span elements */
span { 
    animation: blink 1s infinite;
}

/* Styles for unordered lists without list style */
ul {
    list-style: none;
}

/* Pseudo-elements for links and buttons in lists for additional styling */
ul a:before, p a:before,
ul button:before, p button:before {
    color: var(--terminal-accent);
    content: ' [ ';
}

ul a:after, p a:after,
ul button:after, p button:after {
    color: var(--terminal-accent);
    content: ' ] ';    
}

/* Header styles specifying margin and text transformation */
header.site {
    margin: 0 0 40px 0;
    text-transform: uppercase;
}

/* Navigation styles with consistent margin and width */
nav.site { 
    margin: 0 0 40px 0;
    width: 100%;
}

nav.site ul {
    padding: 0;
}

nav.site ul li {
    display: inline-block;
    padding: 0 10px;
    min-width: 250px;
}

/* Command-line interface styling at the bottom of the screen */
.command-line {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #000;
    z-index: 99;
}

/* Input styles for command-line interface */
#command-input {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--terminal-text);
    font-family: 'VT323', monospace;
    font-size: 20px;
}

/* Styles for a corner image with absolute positioning and z-index for layering */
#corner-image {
    position:absolute;
    top: 50px;
    right: 3%;
    width: 40%; /* or any appropriate size */
    max-width: 500px;
    height: auto; /* maintain aspect ratio */
    z-index: 10; /* ensure it's above other content */
}

#ooc {
    color: red;
}

#ghost-video {
    width: 1152px;
    height: 648px;
    max-width: 100%;
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

/* Overlay styles using gradients and fixed positioning */
.overlay {
    height: 1px;
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
}

.overlay:before {
    background: linear-gradient(#101010 50%, rgba(16, 16, 16, 0.2) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 6px 100%;
    content: "";
    display: block;
    pointer-events: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
}

.overlay:after {
    animation: flicker 0.30s infinite;
    background: rgba(16, 16, 16, 0.2);
    content: "";
    display: block;
    pointer-events: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
}

/* Wrapper styles for content containers */
.wrapper {
    animation: scroll 5s 1;
    margin: 0;
    overflow: hidden;
    padding: 0;
}

.output-error {
    text-align: center;
    color: red;
}

.admin-form {
    margin-top: 30px;
    max-width: 720px;
}

.admin-form h3 {
    margin: 20px 0 8px;
}

.admin-form label {
    display: block;
    margin: 12px 0;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    background: #202020;
    border: 1px solid var(--terminal-accent);
    color: var(--terminal-accent);
    display: block;
    font: inherit;
    margin-top: 4px;
    padding: 6px;
    text-transform: none;
    width: 100%;
}

.admin-form textarea {
    min-height: 90px;
    resize: vertical;
}

.admin-form button {
    border: 1px solid var(--terminal-accent);
    margin-top: 8px;
    padding: 4px 12px;
}

.admin-page .content {
    max-width: 1600px;
    z-index: 3;
    width: 100%;
}

.admin-header {
    border-bottom: 1px solid var(--terminal-accent);
    padding-bottom: 20px;
}

.admin-header #admin-logo {
    height: auto;
    max-width: 260px;
    position: absolute;
    right: 3%;
    top: 30px;
    width: 24%;
    z-index: 1;
}

.admin-header h1 {
    color: white;
    font-size: 1.8em;
    margin: 8px 0;
}

.admin-auth {
    max-width: 560px;
}

.admin-grid {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1fr) minmax(260px, 1fr);
}

.admin-panel {
    border-top: 1px solid var(--terminal-accent);
    min-width: 0;
    padding-top: 14px;
}

.admin-panel h2,
.admin-auth h2 {
    color: white;
    font-size: 1.15em;
    margin: 0 0 16px;
}

.admin-toolbar {
    align-items: center;
    border-bottom: 1px solid #28566a;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 0 12px;
}

.admin-toolbar button {
    border: 1px solid var(--terminal-accent);
    padding: 4px 10px;
}

.admin-settings-panel {
    margin-bottom: 24px;
}

.admin-settings-form {
    display: grid;
    gap: 12px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-settings-form .settings-field {
    min-width: 0;
}

.admin-settings-form button,
.admin-settings-form .admin-status {
    align-self: end;
}

.settings-logo-field {
    align-items: start;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 80px;
}

.settings-logo-field label,
.settings-logo-field input {
    grid-column: 1;
}

.settings-logo-field img {
    grid-column: 2;
    grid-row: 1 / span 2;
    max-height: 80px;
    max-width: 80px;
    object-fit: contain;
}

.admin-tokens-panel {
    margin-bottom: 24px;
}

.admin-token-form {
    max-width: 560px;
}

.issued-token-panel {
    background: #202020;
    border: 1px solid var(--terminal-accent);
    margin: 16px 0;
    max-width: 720px;
    padding: 12px;
}

.issued-token-panel p {
    color: #ffdd88;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.issued-token-panel code {
    color: white;
    display: block;
    font-size: 1.1em;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
    user-select: all;
}

.admin-token-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 16px;
}

.admin-token-entry {
    border: 1px solid #28566a;
    padding: 10px;
}

.admin-token-entry p {
    color: white;
    margin-bottom: 6px;
}

.admin-token-entry small {
    color: #6e9db0;
    display: block;
    font-size: 0.7em;
    margin-bottom: 8px;
}

.admin-command-list {
    max-height: 620px;
    overflow-y: auto;
    padding-right: 10px;
}

.admin-command-entry {
    border-bottom: 1px solid #28566a;
    padding: 10px 0;
}

.admin-command-entry h3 {
    color: white;
    font-size: 1em;
}

.admin-command-entry p {
    font-size: 0.8em;
    margin-top: 5px;
}

.field-hint {
    color: #6e9db0;
    font-size: 0.75em;
    font-style: normal;
    animation: none;
}

.field-example {
    color: #6e9db0;
    font-size: 0.75em;
    margin-top: 8px;
}

.menu-item-row {
    align-items: center;
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr 1fr auto;
    margin: 8px 0;
}

.menu-item-row input {
    margin-top: 0;
}

.admin-secondary {
    border: 1px solid #527d8d;
    color: #b4d9e6;
    font-size: 0.8em;
    padding: 4px 8px;
}

.admin-command-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.admin-status {
    min-height: 1.2em;
    margin-top: 12px;
}

.admin-status.is-error {
    color: #ff7777;
}

.terminal-preview {
    background: #202020;
    border: 1px solid #28566a;
    min-height: 220px;
    padding: 18px;
}

.terminal-preview video {
    max-width: 100%;
}

@media (max-width: 1100px) {
    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-preview-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 680px) {
    .admin-settings-form {
        display: block;
    }

    .admin-settings-form .settings-field {
        margin-bottom: 12px;
    }

    .admin-grid {
        display: block;
    }

    .admin-panel {
        margin-top: 28px;
    }
}

/* Styles for main content area, including animation */
.content {
    animation: scroll 3s 1;
    overflow: hidden;
    padding: 40px;
    position: relative;
    width: 95%;
}

/* Styles for scanline effects, using gradients for visual impact */
.scanline {
    animation: scroll 10s 5s infinite;
    background: -moz-linear-gradient(top, rgba(0,221,0,0) 0%, var(--terminal-accent) 50%, rgba(0,221,0,0) 100%);
    background: -webkit-linear-gradient(top, rgba(0,221,0,0) 0%, var(--terminal-accent) 50%, rgba(0,221,0,0) 100%);
    background: linear-gradient(to bottom, rgba(0,221,0,0) 0%, var(--terminal-accent) 50%, rgba(0,221,0,0) 100%);
    display: block;
    height: 20px;
    opacity: 0.05;
    position: absolute;
    left: 0;
    right: 0;
    top: -5%;
    z-index: 2;
    pointer-events: none;
}

/* Utility classes for clearing floats and applying uppercase text transformation */
.clear, .clearfix, .upper {
    clear: both;
    overflow: hidden;
    width: 100%;
    zoom: 1;  /* Specific to clearfix for containing floats */
    text-transform: uppercase; /* Specific to .upper */
}

.output-scan-out {
    animation: output-scan-out 180ms steps(8, end) forwards;
    overflow: hidden;
}

.output-scan-in {
    animation: output-scan-in 360ms steps(12, end) both;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}