/*
Theme Name: awesome.init
Theme URI: https://codeberg.org/chokan/awesome.init
Author: chokan
Description: Browser terminal interface. Pages become commands. Zero config.
Requires at least: 6.1
Tested up to: 6.7
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: awesome-init
Tags: one-column, custom-colors
*/

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

:root {
    --ai-bg: #0d0d0d;
    --ai-fg: #33ff33;
    --ai-dim: #1a8c1a;
    --ai-font: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono',
               'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
               'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
    --ai-size: clamp(13px, 1.4vw, 16px);
    --ai-line: 1.4;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--ai-bg);
    color: var(--ai-fg);
    font-family: var(--ai-font);
    font-size: var(--ai-size);
    line-height: var(--ai-line);
}

a {
    color: var(--ai-fg);
    text-decoration: underline;
}

a:hover {
    text-decoration: none;
}

/* ---- Terminal layout ---- */
#ai-terminal {
    padding: 1rem;
    max-width: 900px;
}

#ai-output {
    padding-bottom: 0.5rem;
}

.ai-line {
    display: block;
    word-break: break-word;
    min-height: 1em;
    white-space: pre-wrap;
}

.ai-echo {
    opacity: 0.65;
}

.ai-dim,
.ai-system {
    color: var(--ai-dim);
}

.ai-boot {
    opacity: 0.9;
}

/* ---- Input line ---- */
#ai-input-line {
    display: flex;
    align-items: center;
    gap: 1ch;
    padding-top: 0.2rem;
}

#ai-prompt-text {
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

#ai-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ai-fg);
    font-family: var(--ai-font);
    font-size: var(--ai-size);
    line-height: var(--ai-line);
    outline: none;
    caret-color: var(--ai-fg);
    padding: 0 0 0 0.5ch;
    margin: 0;
    min-width: 0;
}

/* ---- Blinking cursor (used in 404) ---- */
.ai-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    background: var(--ai-fg);
    animation: ai-blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
}

@keyframes ai-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Phosphor color presets ---- */
body.ai-amber {
    --ai-fg: #ffb000;
    --ai-dim: #8c6000;
}

body.ai-white {
    --ai-fg: #e0e0e0;
    --ai-dim: #777;
}

body.ai-blue {
    --ai-fg: #44aaff;
    --ai-dim: #1a5280;
}

/* ---- Glitch effect (CSS only, optional) ---- */
.ai-glitch {
    animation: ai-glitch 8s infinite;
}

@keyframes ai-glitch {
    0%, 94%, 100% { text-shadow: none; clip-path: none; }
    95% { text-shadow: 2px 0 #f00, -2px 0 #00f; clip-path: inset(10% 0 80% 0); }
    96% { text-shadow: -2px 0 #f00, 2px 0 #00f; clip-path: inset(60% 0 20% 0); }
    97% { text-shadow: none; clip-path: none; }
    98% { text-shadow: 1px 0 #f00; clip-path: inset(40% 0 50% 0); }
}

/* ---- 404 ---- */
#ai-404 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    max-width: 900px;
}

#ai-404-msg {
    white-space: pre-wrap;
    margin-bottom: 2rem;
}

#ai-404-hint {
    color: var(--ai-dim);
    animation: ai-blink 1.5s step-end infinite;
}

/* ---- No-JS fallback ---- */
.ai-nojs-form {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

.ai-nojs-form label {
    white-space: nowrap;
}

.ai-nojs-form input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--ai-fg);
    color: var(--ai-fg);
    font-family: var(--ai-font);
    font-size: var(--ai-size);
    outline: none;
    padding: 0 0.25rem;
    min-width: 0;
}

.ai-nojs-form button {
    background: transparent;
    border: 1px solid var(--ai-fg);
    color: var(--ai-fg);
    font-family: var(--ai-font);
    font-size: var(--ai-size);
    cursor: pointer;
    padding: 0 0.5rem;
    margin-left: 0.5rem;
}

.ai-nojs-nav ul {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.ai-nojs-nav li::before {
    content: '> ';
}

/* ---- Admin bar offset (administrators only) ---- */
.admin-bar #ai-terminal,
.admin-bar #ai-404 {
    padding-top: calc(1rem + 32px);
}

@media (max-width: 782px) {
    .admin-bar #ai-terminal,
    .admin-bar #ai-404 {
        padding-top: calc(1rem + 46px);
    }
}

