@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    color-scheme: dark;
    --bg: #04070a;
    --panel: #071016;
    --line: #12303a;
    --text: #d9fbff;
    --muted: #61808a;
    --cyan: #00f5ff;
    --green: #59ff8b;
    --pink: #ff3df2;
}


/* CLI-selectable color themes */
:root[data-theme="default"] {
    --bg: #04070a;
    --panel: #071016;
    --line: #12303a;
    --text: #d9fbff;
    --muted: #61808a;
    --cyan: #00f5ff;
    --green: #59ff8b;
    --pink: #ff3df2;
}

:root[data-theme="c64"] {
    --bg: #25236b;
    --panel: #34328a;
    --line: #7776d9;
    --text: #aaa9ff;
    --muted: #7776bb;
    --cyan: #b8b7ff;
    --green: #8fe388;
    --pink: #e7a3ff;
}

:root[data-theme="amiga"] {
    --bg: #07101b;
    --panel: #0b1726;
    --line: #24445f;
    --text: #d7ecff;
    --muted: #7192ad;
    --cyan: #4db8ff;
    --green: #7cffbc;
    --pink: #ff78cb;
}

:root[data-theme="atari"] {
    --bg: #100b08;
    --panel: #1a120c;
    --line: #5a3b20;
    --text: #ffe4bb;
    --muted: #aa8158;
    --cyan: #ffb347;
    --green: #b6ff66;
    --pink: #ff6b35;
}

:root[data-theme="edgerunner"] {
    --bg: #071014;
    --panel: #0c171c;
    --line: #28434d;
    --text: #e9ffff;
    --muted: #7a9398;
    --cyan: #f6ff00;
    --green: #00f5d4;
    --pink: #ff2d95;
}

:root[data-theme="hackers"] {
    --bg: #020504;
    --panel: #06100b;
    --line: #163b27;
    --text: #d8ffe7;
    --muted: #557b63;
    --cyan: #39ff14;
    --green: #00ff8c;
    --pink: #ff2ad4;
}

/* Light/dark is independent of the selected accent theme. */
:root[data-mode="light"] {
    --bg: #e8edf0;
    --panel: #f6f9fa;
    --line: #a7bbc2;
    --text: #142027;
    --muted: #657981;
}

:root[data-mode="dark"] {
    color-scheme: dark;
}

:root[data-mode="light"] {
    color-scheme: light;
}

:root[data-mode="light"] body {
    background:
        linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px),
        radial-gradient(circle at 50% -20%, rgba(255,255,255,.95) 0, transparent 48%),
        var(--bg);
}

:root[data-mode="light"] .month {
    background: rgba(255,255,255,.72);
}

:root[data-mode="light"] .day {
    color: #43555d;
    border-color: rgba(80,110,120,.24);
}

:root[data-mode="light"] body::before,
:root[data-mode="light"] body::after {
    opacity: .10;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(rgba(0,245,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,245,255,.025) 1px, transparent 1px),
        radial-gradient(circle at 50% -20%, #0b2530 0, transparent 45%),
        var(--bg);
    background-size: 28px 28px, 28px 28px, auto, auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

a { color: inherit; }

.shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 2vw 14px;
}

.topbar {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 9px;
}

.identity {
    position: relative;
    min-width: 0;
    flex: 1 1 0;
    max-width: 100%;
    overflow: hidden;
}

.brand-terminal {
    position: relative;
    display: flex;
    align-items: baseline;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    gap: 0;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    cursor: text;
    transform: translateY(-5px);
    font-family: "VT323", "Courier New", monospace;
    animation: phosphor-flicker 9s infinite;
}

.brand-prefix {
    color: var(--cyan);
    font-size: clamp(2.8rem, 5.2vw, 4.8rem);
    line-height: .82;
    font-weight: 400;
    letter-spacing: .015em;
    text-shadow:
        0 0 1px rgba(0,245,255,.50),
        0 0 3px rgba(0,245,255,.16);
}

.brand-command-wrap {
    display: inline-flex;
    align-items: baseline;
    min-width: 1ch;
    max-width: 42vw;
    padding-right: 12px;
    overflow: visible;
}

#terminal-input {
    width: 0;
    min-width: 0;
    max-width: 38vw;
    border: 0;
    outline: 0;
    padding: 0;
    background: transparent;
    color: var(--cyan);
    font-family: "VT323", "Courier New", monospace;
    font-size: clamp(2.8rem, 5.2vw, 4.8rem);
    line-height: .82;
    font-weight: 400;
    letter-spacing: .015em;
    text-shadow:
        0 0 1px rgba(0,245,255,.50),
        0 0 3px rgba(0,245,255,.16);
    caret-color: transparent;
}

#terminal-input:not(:placeholder-shown) {
    width: min(38vw, 16ch);
}

.terminal-hint {
    display: inline-block;
    margin-left: .18em;
    color: var(--muted);
    font-family: "VT323", "Courier New", monospace;
    font-size: clamp(2.8rem, 5.2vw, 4.8rem);
    line-height: .82;
    font-weight: 400;
    letter-spacing: .015em;
    opacity: .72;
    text-shadow: none;
    white-space: nowrap;
    pointer-events: none;
    transform: none;
}

.terminal-hint[hidden] {
    display: none;
}

.cursor {
    display: inline-block;
    color: var(--cyan);
    font-family: "VT323", "Courier New", monospace;
    font-size: clamp(2.8rem, 5.2vw, 4.8rem);
    line-height: .82;
    font-weight: 400;
    transform: translateY(.02em);
    text-shadow:
        0 0 1px rgba(0,245,255,.55),
        0 0 3px rgba(0,245,255,.14);
    animation:
        cursor-blink .82s steps(1, end) infinite;
}

@keyframes cursor-blink {
    0%, 46% { opacity: 1; }
    47%, 100% { opacity: 0; }
}

.tagline {
    margin-top: 5px;
    color: var(--muted);
    letter-spacing: .25em;
    font-size: .68rem;
}

.terminal-output {
    position: absolute;
    display: block;
    left: 0;
    top: 0;
    transform: none;
    min-width: 0;
    max-width: none;
    margin-left: 0;
    color: var(--pink);
    font-family: "VT323", "Courier New", monospace;
    font-size: clamp(1.55rem, 2.6vw, 2.5rem);
    line-height: .9;
    letter-spacing: .01em;
    text-shadow:
        0 0 4px rgba(255,61,242,.9),
        0 0 12px rgba(255,61,242,.55);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    text-overflow: clip;
    scrollbar-width: none;
    scroll-behavior: smooth;
    vertical-align: baseline;
}

.nav-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 2px;
    flex: 0 0 auto;
    min-width: max-content;
    position: relative;
    z-index: 2;
}

.theme-indicator {
    color: var(--pink);
    font-family: "VT323", "Courier New", monospace;
    font-size: clamp(1.55rem, 2.6vw, 2.5rem);
    line-height: .9;
    letter-spacing: .01em;
    text-transform: none;
    white-space: nowrap;
    text-shadow:
        0 0 4px rgba(255,61,242,.9),
        0 0 12px rgba(255,61,242,.55);
    transform: none;
    margin: 0;
}

.year-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1rem;
    padding-bottom: 4px;
}

.year-nav a {
    color: var(--cyan);
    text-decoration: none;
    font-size: 1.55rem;
}

.year-nav strong { color: var(--green); }

.calendar-grid {
    display: grid;
    margin-top: 5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.month {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background: linear-gradient(180deg, rgba(8,20,26,.96), rgba(4,10,14,.96));
    border: 1px solid var(--line);
    box-shadow: inset 0 0 28px rgba(0,245,255,.025);
    padding: 8px 10px;
}

.month h2 {
    margin: 0 0 5px;
    color: var(--cyan);
    font-size: .82rem;
    line-height: 1;
    letter-spacing: .16em;
}

.month h2 span { color: var(--pink); }

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .52rem;
    text-align: center;
}

.days {
    display: grid;
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 3px;
    min-height: 0;
}

.week-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    min-height: 0;
}

.day {
    position: relative;
    min-width: 0;
    min-height: 0;
    border: 1px solid rgba(18,48,58,.5);
    padding: 2px 3px;
    font-size: .61rem;
    color: #88a9b1;
    overflow: hidden;
    z-index: 1;
}

.day.empty {
    border-color: transparent;
    background: transparent;
}

.number {
    position: relative;
    z-index: 5;
}

.week-events {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    pointer-events: none;
    z-index: 3;
}

.event-span {
    grid-column: var(--span-start) / var(--span-end);
    position: relative;
    display: block;
    min-width: 0;
    border: 2px solid var(--event-color);
    border-radius: 7px;
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    box-shadow:
        inset 0 0 10px color-mix(in srgb, var(--event-color) 36%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--event-color) 16%, transparent),
        0 0 5px color-mix(in srgb, var(--event-color) 100%, transparent),
        0 0 11px color-mix(in srgb, var(--event-color) 78%, transparent),
        0 0 20px color-mix(in srgb, var(--event-color) 42%, transparent);
    animation: event-frame-flicker 7s infinite;
}

.event-span::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--event-color) 10%, transparent) 0%,
            color-mix(in srgb, var(--event-color) 50%, transparent) 50%,
            color-mix(in srgb, var(--event-color) 100%, transparent) 100%
        );
}

.event-span-icon-overlay {
    position: absolute;
    z-index: 2;
    right: 6px;
    top: 50%;
    width: 25px;
    height: 25px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 1;
    pointer-events: none;
}

.event-span-icon-overlay svg {
    width: 25px;
    height: 25px;
    display: block;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.event-span:focus-visible {
    outline: 1px dashed var(--text);
    outline-offset: -4px;
}


@keyframes event-frame-flicker {
    0%, 100% {
        opacity: .96;
        filter: brightness(1);
    }
    49% {
        opacity: .94;
        filter: brightness(.98);
    }
    50% {
        opacity: .80;
        filter: brightness(1.13);
    }
    51% {
        opacity: .96;
        filter: brightness(1);
    }
}

.event-tooltip {
    position: fixed;
    z-index: 10020;
    width: max-content;
    max-width: min(340px, calc(100vw - 20px));
    padding: 10px 12px 9px;
    border: 1px solid var(--cyan);
    background: color-mix(in srgb, var(--panel) 96%, black);
    color: var(--text);
    box-shadow:
        0 0 0 1px rgba(0,0,0,.7),
        0 0 18px color-mix(in srgb, var(--cyan) 22%, transparent);
    pointer-events: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.35;
}

.event-tooltip[hidden] {
    display: none;
}

.event-tooltip-title {
    color: var(--cyan);
    font-family: "VT323", "Courier New", monospace;
    font-size: 1.35rem;
    line-height: 1;
}

.event-tooltip-meta {
    margin-top: 4px;
    color: var(--pink);
    font-size: .68rem;
    letter-spacing: .04em;
}

.event-tooltip-description {
    margin-top: 7px;
    color: var(--text);
    font-size: .72rem;
}

.event-tooltip-action {
    margin-top: 8px;
    color: var(--green);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

footer {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;
    color: var(--muted);
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}

/* CRT atmosphere */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255,255,255,.040) 0px,
            rgba(255,255,255,.040) 1px,
            rgba(0,0,0,.10) 2px,
            rgba(0,0,0,.10) 4px
        );
    mix-blend-mode: screen;
    opacity: .40;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(0,245,255,.008) 48%,
            rgba(255,255,255,.012) 50%,
            rgba(0,245,255,.006) 52%,
            transparent 100%
        );
    background-size: 100% 11px;
    opacity: .10;
    animation: crt-roll 14s linear infinite;
}

.crt-title {
    text-shadow: 0 0 1px rgba(255,255,255,.55);
}

@keyframes phosphor-flicker {
    0%, 100% { opacity: 1; filter: brightness(1); }
    49% { opacity: .997; filter: brightness(.997); }
    50% { opacity: .988; filter: brightness(.988); }
    51% { opacity: 1; filter: brightness(1); }
}

@keyframes crt-roll {
    from { transform: translateY(-11px); }
    to { transform: translateY(11px); }
}

@media (prefers-reduced-motion: reduce) {
    .brand-terminal,
    .cursor,
    .event-span,
    body::after {
        animation: none !important;
    }
}

/* Admin */
.admin-shell {
    width: min(980px, calc(100% - 32px));
    margin: 40px auto;
}

.admin-card {
    background: rgba(7,16,22,.95);
    border: 1px solid var(--line);
    padding: 22px;
    margin-bottom: 18px;
}

.admin-card h1,
.admin-card h2 { color: var(--cyan); margin-top: 0; }

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: .78rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.admin-shell input,
textarea,
select,
button {
    width: 100%;
    background: #03080b;
    color: var(--text);
    border: 1px solid #1a414c;
    padding: 11px 12px;
    font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

button, .button {
    display: inline-block;
    width: auto;
    cursor: pointer;
    text-decoration: none;
    color: #001014;
    background: var(--cyan);
    border: 0;
    font-weight: 800;
    padding: 10px 14px;
}

.button.secondary { background: #163039; color: var(--text); }
.button.danger { background: var(--pink); color: #150014; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.event-list {
    width: 100%;
    border-collapse: collapse;
}

.event-list th, .event-list td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.error { color: var(--pink); }

/* On a normal desktop/laptop viewport, the entire year fits without scrolling. */
@media (min-width: 1101px) and (min-height: 650px) {
    html, body { height: 100%; overflow: hidden; }

    .shell {
        height: 100dvh;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .shell.demo-mode {
        grid-template-rows: auto auto minmax(0, 1fr) auto;
    }

    .calendar-grid {
        min-height: 0;
        height: 100%;
        grid-template-rows: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .brand-command-wrap { max-width: 44vw; }
}

@media (max-width: 520px) {
    .calendar-grid { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; }
    .brand-terminal { white-space: normal; flex-wrap: wrap; }
    #terminal-input { max-width: 70vw; }
}


.terminal-suggestion {
    color: var(--pink);
    padding: 0 .04em;
}

.terminal-suggestion.selected {
    color: var(--bg);
    background: var(--pink);
    text-shadow: none;
    box-shadow: 0 0 5px color-mix(in srgb, var(--pink) 45%, transparent);
}


.terminal-suggestion-list {
    display: inline-block;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    will-change: transform, opacity;
}






.terminal-suggestion-list.snap-next {
    animation: suggestion-snap-next 280ms cubic-bezier(.18,.86,.25,1);
}

.terminal-suggestion-list.snap-prev {
    animation: suggestion-snap-prev 280ms cubic-bezier(.18,.86,.25,1);
}

@keyframes suggestion-snap-next {
    0%   { transform: translateX(28px); }
    70%  { transform: translateX(-4px); }
    88%  { transform: translateX(1.5px); }
    100% { transform: translateX(0); }
}

@keyframes suggestion-snap-prev {
    0%   { transform: translateX(-28px); }
    70%  { transform: translateX(4px); }
    88%  { transform: translateX(-1.5px); }
    100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .terminal-suggestion-list.snap-next,
    .terminal-suggestion-list.snap-prev {
        animation: none !important;
    }
}


.terminal-suggestion-list.manual-list {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.terminal-output::-webkit-scrollbar {
    display: none;
}


/* Impressum + privacy */
.legal-page {
    width: min(920px, 96vw);
    margin: 0 auto;
    padding: 34px 0 60px;
}

.legal-page h1,
.legal-page h2 {
    font-family: "VT323", "Courier New", monospace;
    font-weight: 400;
}

.legal-page h1 {
    margin: 0 0 22px;
    color: var(--cyan);
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    line-height: .9;
}

.legal-page h2 {
    margin: 28px 0 8px;
    color: var(--pink);
    font-size: 1.8rem;
}

.legal-page p,
.legal-page address {
    max-width: 76ch;
    line-height: 1.65;
    color: var(--text);
}

.legal-page address {
    font-style: normal;
}

.legal-back {
    display: inline-block;
    margin-top: 28px;
    color: var(--cyan);
    text-decoration: none;
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer a:hover,
.legal-back:hover {
    text-decoration: underline;
}
