/* Vox Administratus front door. Sits on top of vox.css (the shared
   phosphor hardware look used by Logios and Taktikon). */

html, body { height: auto; min-height: 100%; }

body.vox {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    transition: opacity 0.05s;
}

/* The travelling scan bar from the original page. vox.css owns ::after. */
body.vox::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: color-mix(in srgb, var(--phosphor) 14%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--phosphor) 30%, transparent);
    animation: scanline 6s linear infinite;
    z-index: 51;
    pointer-events: none;
    will-change: transform;
}
:root.no-scanlines body.vox::before { display: none; }

@keyframes scanline {
    0%   { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}

a { color: inherit; }

/* ── FRONT DOOR ─────────────────────────────────────────────────── */

.container {
    width: 100%;
    max-width: 820px;
    padding: clamp(28px, 7vh, 64px) 20px 48px;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: flicker 8s infinite;
}

@keyframes flicker {
    0%,  19%  { opacity: 0.96; }
    20%       { opacity: 0.9; }
    20.5%     { opacity: 0.96; }
    21%       { opacity: 0.88; }
    21.5%     { opacity: 0.96; }
    60%       { opacity: 0.91; }
    60.5%     { opacity: 0.96; }
    100%      { opacity: 0.96; }
}

.header {
    font-size: clamp(2.4rem, 8vw, 3.6rem);
    font-weight: normal;
    margin: 0;
    letter-spacing: 0.22em;
    line-height: 1;
    padding-left: 0.22em; /* balance the trailing letter-spacing */
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 4px var(--phosphor-2), 0 0 10px color-mix(in srgb, var(--phosphor) 35%, transparent); }
    50%      { text-shadow: 0 0 6px var(--phosphor), 0 0 18px color-mix(in srgb, var(--phosphor) 45%, transparent); }
}
:root.no-glow .header { animation: none; text-shadow: none; }

.container .divider {
    margin: 22px 0;
    font-size: 1.4rem;
    letter-spacing: 4px;
    color: var(--phosphor-2);
    overflow: hidden;
    white-space: nowrap;
}

.status {
    font-size: 1.35rem;
    margin: 10px 0;
    letter-spacing: 3px;
}

.message {
    font-size: 1.2rem;
    margin: 28px auto;
    line-height: 1.5;
    letter-spacing: 2px;
    max-width: 640px;
}
.message.thought { color: var(--phosphor-2); }

.warning {
    color: var(--hostile);
    margin: 34px 0;
    font-size: 1.2rem;
    letter-spacing: 2px;
    animation: warning-blink 2s ease-in-out infinite;
    text-shadow: 0 0 6px color-mix(in srgb, var(--hostile) 55%, transparent);
}

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

.footer {
    font-size: 1.5rem;
    letter-spacing: 4px;
}

.awaiting {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cursor {
    display: inline-block;
    width: 12px;
    height: 20px;
    background: var(--phosphor);
    margin-left: 6px;
    vertical-align: -2px;
    animation: vox-blink 1s step-end infinite;
    box-shadow: var(--glow);
}

@keyframes glitch {
    0%   { transform: translate(0); }
    20%  { transform: translate(-2px, 2px); }
    40%  { transform: translate(-2px, -2px); }
    60%  { transform: translate(2px, 2px); }
    80%  { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}
.glitch { animation: glitch 0.3s ease-in-out; }

/* ── MENU ───────────────────────────────────────────────────────── */

.menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 560px;
    margin: 30px auto 6px;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    letter-spacing: 2px;
    padding: 8px 14px;
    text-decoration: none;
    text-align: left;
    white-space: nowrap;
}
.menu-btn .k {
    color: var(--dim);
    border: 1px solid var(--faint);
    padding: 0 6px;
    font-size: 1rem;
}
.menu-btn:hover .k, .menu-btn:focus-visible .k { color: var(--phosphor); border-color: var(--dim); }
.menu-btn.sealed {
    color: var(--faint);
    border-color: var(--faint);
    border-style: dashed;
    text-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}
.menu-btn.sealed .k { color: var(--faint); border-color: var(--faint); }


/* ── SECTION WINDOW ─────────────────────────────────────────────── */

.window {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    animation: window-in 0.18s steps(4);
}
.window[hidden] { display: none !important; }

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

.window-bar {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px clamp(16px, 4vw, 40px) 10px;
    padding-top: max(18px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--dim);
}
.w-title { font-size: 1.7rem; letter-spacing: 0.14em; }
#window-close { white-space: nowrap; flex-shrink: 0; }
.w-sub   { color: var(--dim); letter-spacing: 0.08em; font-size: 1rem; margin-top: 2px; }

.window-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px clamp(16px, 4vw, 40px) 40px;
    padding-bottom: max(40px, env(safe-area-inset-bottom));
    scrollbar-width: thin;
    scrollbar-color: var(--dim) var(--bg);
}
.window-inner { max-width: 860px; margin: 0 auto; }

/* Category tabs */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.tab { text-decoration: none; }
.tab[aria-pressed='true'] { background: var(--faint); border-color: var(--phosphor); }
.tab .n { color: var(--dim); margin-left: 4px; }

/* Registry */
.cat-head {
    color: var(--dim);
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--faint);
    margin: 22px 0 10px;
    padding-bottom: 2px;
    font-size: 1.1rem;
}
.cat-head:first-child { margin-top: 0; }
.empty { color: var(--dim); padding: 6px 0 4px; letter-spacing: 0.06em; }

.record {
    border: 1px solid var(--faint);
    padding: 12px 14px 14px;
    margin-bottom: 12px;
    background: color-mix(in srgb, var(--bg-2) 60%, transparent);
}
.record:hover { border-color: var(--dim); }
.record-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
}
.record .rid  { color: var(--dim); }
.record .name { font-size: 1.6rem; letter-spacing: 0.12em; }
.record .sub  { color: var(--phosphor-2); letter-spacing: 0.06em; }
.record .sig  { margin-left: auto; color: var(--dim); white-space: nowrap; }
.record .sig.ok   { color: var(--phosphor); }
.record .sig.bad  { color: var(--hostile); }
.record p {
    margin: 8px 0 12px;
    line-height: 1.3;
    max-width: 70ch;
    text-shadow: none;
    color: color-mix(in srgb, var(--phosphor) 85%, var(--bg));
}
.record .btn { text-decoration: none; display: inline-block; }

/* Dispatch list */
.dispatch-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px 16px;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid var(--faint);
}
.dispatch-row .rid   { color: var(--dim); }
.dispatch-row .title { font-size: 1.35rem; letter-spacing: 0.06em; }
.dispatch-row .meta  { grid-column: 2 / 3; color: var(--dim); }
.dispatch-row .sum   { grid-column: 2 / 3; text-shadow: none; line-height: 1.3; }
.dispatch-row .btn   { grid-row: 1 / span 3; grid-column: 3; align-self: center; text-decoration: none; }

/* Dispatch reader */
.article { max-width: 68ch; margin: 0 auto; }
.article .stamp {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 14px;
    color: var(--dim);
    border: 1px dashed var(--faint);
    padding: 8px 12px;
    margin-bottom: 18px;
}
.article .stamp b { font-weight: normal; color: var(--phosphor-2); }
.article h2 { font-weight: normal; font-size: 1.9rem; letter-spacing: 0.08em; margin: 0 0 14px; line-height: 1.05; }
.article h3 { font-weight: normal; font-size: 1.25rem; letter-spacing: 0.12em; color: var(--phosphor-2); margin: 26px 0 6px; }
.article p, .article li {
    font-size: 1.22rem;
    line-height: 1.4;
    text-shadow: none;
    color: color-mix(in srgb, var(--phosphor) 88%, var(--bg));
}
.article ul { padding-left: 1.2em; }
.article li { margin: 6px 0; }
.article code {
    font-family: var(--font);
    color: var(--hostile);
    background: var(--ghost);
    padding: 0 4px;
    word-break: break-all;
}
.article .back { margin-top: 28px; }

/* Correspondence */
.corr p { font-size: 1.22rem; line-height: 1.4; max-width: 62ch; text-shadow: none; }
.corr .seal { color: var(--dim); }
.corr .big { font-size: 1.3rem; padding: 6px 16px; margin: 6px 0 18px; }
.corr .addr { color: var(--phosphor-2); word-break: break-all; }
.channels { list-style: none; padding: 0; margin: 0; }
.channels li { padding: 6px 0; border-bottom: 1px solid var(--faint); }
.channels a { text-decoration: none; display: flex; gap: 16px; }
.channels a .l { color: var(--dim); min-width: 7.5em; }
.channels a:hover .s, .channels a:focus-visible .s { text-decoration: underline; }

/* ── TERMINAL OVERLAY ───────────────────────────────────────────── */

#terminal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 48;
    flex-direction: column;
    overflow: hidden;
}
#terminal-overlay.active { display: flex; }

#terminal-header {
    flex-shrink: 0;
    padding: 18px 30px 10px;
    padding-top: max(18px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--dim);
    text-align: center;
    position: relative;
}
#terminal-header .t-title { font-size: 1.5rem; letter-spacing: 6px; }
#terminal-header .t-sub   { font-size: 0.95rem; letter-spacing: 3px; color: var(--dim); margin-top: 4px; }
#terminal-close { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 20px; font-size: 0.95rem; }

#terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 18px 30px;
    font-size: 1.15rem;
    line-height: 1.35;
    letter-spacing: 1px;
    scrollbar-width: thin;
    scrollbar-color: var(--dim) var(--bg);
}

.t-line          { margin: 1px 0; white-space: pre-wrap; word-break: break-word; }
.t-line.prompt   { color: var(--phosphor); }
.t-line.output   { color: var(--phosphor-2); }
.t-line.error    { color: var(--alarm); }
.t-line.info     { color: var(--hostile); }
.t-line.divider  { color: var(--dim); letter-spacing: 2px; }
.t-line.link a {
    color: var(--phosphor);
    text-decoration: none;
    border-bottom: 1px solid var(--dim);
}
.t-line.link a:hover { border-bottom-color: var(--phosphor); }

#terminal-input-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 12px 30px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--dim);
    gap: 10px;
}
#terminal-input-row .t-prompt-char { white-space: nowrap; font-size: 1.2rem; }

#terminal-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--phosphor);
    font-family: var(--font);
    font-size: 1.25rem;
    letter-spacing: 2px;
    caret-color: var(--phosphor);
    text-transform: uppercase;
    text-shadow: var(--glow);
}
#terminal-input::placeholder { color: var(--dim); }

/* ── LOCKOUT SCREEN ─────────────────────────────────────────────── */

#lockout-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: flicker 8s infinite;
}
.lockout-inner { max-width: 720px; width: 90%; text-align: center; padding: 40px 20px; }
.lockout-header {
    color: var(--alarm);
    font-size: 1.7rem;
    letter-spacing: 4px;
    margin: 18px 0;
    animation: warning-blink 1.5s ease-in-out infinite;
    text-shadow: 0 0 8px color-mix(in srgb, var(--alarm) 60%, transparent);
}
.lockout-body {
    color: var(--alarm);
    font-size: 1.2rem;
    letter-spacing: 2px;
    line-height: 1.6;
    margin: 22px 0;
}
.lockout-timer  { color: var(--hostile); font-size: 1.3rem; letter-spacing: 3px; margin: 18px 0; }
.lockout-divider { color: color-mix(in srgb, var(--alarm) 45%, var(--bg)); letter-spacing: 2px; overflow: hidden; white-space: nowrap; }

/* ── BOOT (extends vox.css .boot) ───────────────────────────────── */

.boot { z-index: 300; font-size: 1.3rem; }
.boot .ok   { color: var(--phosphor); }
.boot .dots { color: var(--dim); }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .header                { letter-spacing: 0.12em; padding-left: 0.12em; }
    .divider               { font-size: 1rem; margin: 16px 0; }
    .status                { font-size: 1.1rem; letter-spacing: 2px; }
    .message               { font-size: 1.05rem; letter-spacing: 1px; }
    .warning               { font-size: 1rem; letter-spacing: 1px; }
    .menu                  { grid-template-columns: 1fr; }
    .menu-btn              { font-size: 1.2rem; }
    .w-title               { font-size: 1.3rem; letter-spacing: 0.06em; }
    .w-sub                 { font-size: 0.9rem; letter-spacing: 0.03em; }
    .dispatch-row          { grid-template-columns: 1fr; }
    .dispatch-row .meta,
    .dispatch-row .sum     { grid-column: 1; }
    .dispatch-row .btn     { grid-row: auto; grid-column: 1; justify-self: start; }
    .record .sig           { margin-left: 0; width: 100%; }
    #terminal-output       { padding: 12px 14px; font-size: 1rem; }
    #terminal-input-row    { padding: 10px 14px 16px; }
    #terminal-header       { padding: 14px 14px 8px; text-align: left; }
    #terminal-header .t-title { font-size: 1.05rem; letter-spacing: 2px; padding-right: 110px; }
    #terminal-header .t-sub   { font-size: 0.8rem; letter-spacing: 1px; padding-right: 110px; }
    #terminal-close        { right: 12px; }
    .lockout-header        { font-size: 1.2rem; letter-spacing: 2px; }
    .lockout-body          { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    body.vox::before, .container, .header, .warning, .window { animation: none; }
}
