/* AI: the tty49 dial-up BBS. CGA palette, ANSI logon banner, the butler at the front door,
   the board in a double-ruled frame and a sysop menu. Every rule stays inside the AI window. */
.window[data-site="ai"] {
  --cga-black: #000;
  --cga-blue: #0000aa;
  --cga-cyan: #55ffff;
  --cga-yellow: #ffff55;
  --cga-magenta: #ff55ff;
  --cga-green: #55ff55;
  --cga-gray: #c4c4c4;
  --cga-white: #fff;
  --door-cream: #fff8de;
  --door-ink: #1c4238;
  border: 4px double #55ffff;
}
.window[data-site="ai"] > .bar { background: linear-gradient(90deg, #0000aa, #00007a); }
.window[data-site="ai"] > .window-body { background: var(--cga-blue); color: var(--cga-white); }
.window[data-site="ai"] ::selection { background: var(--cga-cyan); color: var(--cga-black); }

/* A page or maximized window grows the board down to the status bar. */
.window[data-site="ai"] .bbs { display: flex; flex-direction: column; flex: 1 0 auto; }
.window[data-site="ai"] .bbs-board { flex: 1 0 auto; }

/* Logon banner */
.window[data-site="ai"] .bbs-banner {
  padding: clamp(.75rem, 2.5cqi, 1.5rem) clamp(.75rem, 3cqi, 2rem) .75rem;
  background: var(--cga-black);
  border-bottom: 2px solid var(--cga-cyan);
  text-align: center;
}
.window[data-site="ai"] .bbs-logo {
  display: inline-block;
  margin: 0;
  font: 400 clamp(.4rem, 2cqi, 1.05rem)/1 Consolas, "Cascadia Mono", "Lucida Console", "DejaVu Sans Mono", "Noto Sans Mono", "Courier New", monospace;
  text-align: left;
  white-space: pre;
}
.window[data-site="ai"] .ansi-row-0, .window[data-site="ai"] .ansi-row-1 { color: var(--cga-cyan); }
.window[data-site="ai"] .ansi-row-2, .window[data-site="ai"] .ansi-row-3 { color: var(--cga-magenta); }
.window[data-site="ai"] .ansi-row-4, .window[data-site="ai"] .ansi-row-5 { color: var(--cga-yellow); }
.window[data-site="ai"] .bbs-tagline {
  margin: .75rem auto 0;
  max-width: 62ch;
  color: var(--cga-gray);
  font: .875rem/1.5 var(--mono);
}
.window[data-site="ai"] .bbs-tagline strong { color: var(--cga-white); }
.window[data-site="ai"] .bbs-fiction { color: var(--cga-green); }
.window[data-site="ai"] .bbs-swatches {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  max-width: 36rem;
  height: .6rem;
  margin: .75rem auto 0;
}
.window[data-site="ai"] .bbs-swatches i { background: var(--swatch); }
.window[data-site="ai"] .bbs-swatches i:nth-child(1) { --swatch: #000; outline: 1px solid #555; outline-offset: -1px; }
.window[data-site="ai"] .bbs-swatches i:nth-child(2) { --swatch: #0000aa; }
.window[data-site="ai"] .bbs-swatches i:nth-child(3) { --swatch: #00aa00; }
.window[data-site="ai"] .bbs-swatches i:nth-child(4) { --swatch: #00aaaa; }
.window[data-site="ai"] .bbs-swatches i:nth-child(5) { --swatch: #aa0000; }
.window[data-site="ai"] .bbs-swatches i:nth-child(6) { --swatch: #aa00aa; }
.window[data-site="ai"] .bbs-swatches i:nth-child(7) { --swatch: #aa5500; }
.window[data-site="ai"] .bbs-swatches i:nth-child(8) { --swatch: #aaaaaa; }
.window[data-site="ai"] .bbs-swatches i:nth-child(9) { --swatch: #555555; }
.window[data-site="ai"] .bbs-swatches i:nth-child(10) { --swatch: #5555ff; }
.window[data-site="ai"] .bbs-swatches i:nth-child(11) { --swatch: #55ff55; }
.window[data-site="ai"] .bbs-swatches i:nth-child(12) { --swatch: #55ffff; }
.window[data-site="ai"] .bbs-swatches i:nth-child(13) { --swatch: #ff5555; }
.window[data-site="ai"] .bbs-swatches i:nth-child(14) { --swatch: #ff55ff; }
.window[data-site="ai"] .bbs-swatches i:nth-child(15) { --swatch: #ffff55; }
.window[data-site="ai"] .bbs-swatches i:nth-child(16) { --swatch: #fff; }

/* The butler's front door: an Ask Jeeves band in cream, the one light surface on the board. */
.window[data-site="ai"] .butler-door {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem 1.5rem;
  padding: clamp(.85rem, 2.5cqi, 1.5rem) clamp(.75rem, 3cqi, 2rem);
  background: var(--door-cream);
  color: var(--door-ink);
  border-bottom: 6px double var(--cga-blue);
}
.window[data-site="ai"] .butler { flex: none; width: clamp(64px, 9cqi, 96px); height: auto; }
.window[data-site="ai"] .butler-copy { flex: 0 1 34rem; min-width: 0; }
.window[data-site="ai"] .butler-title { margin: 0; font: italic 700 clamp(1.75rem, 4.5cqi, 2.75rem)/1.05 Georgia, "Times New Roman", serif; color: #1b5548; }
.window[data-site="ai"] .butler-pitch { margin: .4rem 0 .6rem; max-width: 60ch; font: 1rem/1.5 Georgia, "Times New Roman", serif; text-wrap: pretty; }
.window[data-site="ai"] .butler-form { min-width: 0; max-width: 100%; }
.window[data-site="ai"] .butler-form label { font: 600 .875rem/1.4 Arial, sans-serif; }
.window[data-site="ai"] .butler-form > div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .25rem; }
.window[data-site="ai"] .butler-form input {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 22rem;
  min-height: 2.25rem;
  padding: .35rem .5rem;
  font: 1rem Arial, sans-serif;
  color: var(--door-ink);
  background: #fff;
  border: 2px inset #8a9c8f;
}
.window[data-site="ai"] .butler-form input::placeholder { color: #50655c; }
.window[data-site="ai"] .butler-form .button { min-height: 2.25rem; display: inline-grid; place-items: center; }
.window[data-site="ai"] .butler-hourglass { width: 1.05rem; height: 1.3rem; background: #79502c; clip-path: polygon(0 0,100% 0,58% 50%,100% 100%,0 100%,42% 50%); }

/* The board: terminal in a double cyan frame, sysop menu in a double yellow one. */
.window[data-site="ai"] .bbs-board {
  display: grid;
  gap: clamp(.6rem, 2cqi, 1.25rem);
  align-items: start;
  padding: clamp(.6rem, 2.5cqi, 1.5rem);
  background: var(--cga-blue);
}
@container window-body (min-width: 52rem) {
  .window[data-site="ai"] .bbs-board { grid-template-columns: minmax(0, 1fr) 17rem; }
}
.window[data-site="ai"] .terminal {
  min-width: 0;
  padding: clamp(.75rem, 2.5cqi, 1.5rem);
  background: var(--cga-black);
  color: var(--cga-gray);
  border: 6px double var(--cga-cyan);
}
.window[data-site="ai"] .terminal h1 { color: var(--cga-yellow); }
.window[data-site="ai"] .terminal :is(a, label, .tty-prompt) { color: var(--cga-cyan); }
.window[data-site="ai"] .terminal kbd { color: var(--cga-white); }
.window[data-site="ai"] .terminal :is(.tty-motd, .tty-ls span, .reconstructed) { color: var(--cga-gray); }
.window[data-site="ai"] .terminal :is(.tty-help dt, .tty-props dt) { color: var(--cga-magenta); }
.window[data-site="ai"] .terminal .tty-quotes blockquote::before { color: var(--cga-green); }
.window[data-site="ai"] .terminal .terminal-glyph { color: #7393ec; background: var(--cga-black); }
.window[data-site="ai"] .terminal-input { border-top: 1px dashed var(--cga-cyan); }
.window[data-site="ai"] .terminal input { color: var(--cga-white); caret-color: var(--cga-yellow); background: var(--cga-black); border: 1px solid var(--cga-cyan); }
.window[data-site="ai"] .terminal input::placeholder { color: #9a9a9a; }
.window[data-site="ai"] .terminal :focus-visible { outline: 2px solid var(--cga-yellow); outline-offset: 2px; }

.window[data-site="ai"] .sysop-menu {
  padding: .75rem .9rem;
  background: var(--cga-blue);
  color: var(--cga-white);
  border: 6px double var(--cga-yellow);
  font: .9375rem/1.5 var(--mono);
}
.window[data-site="ai"] .sysop-title {
  margin: -1.45rem auto .5rem;
  width: max-content;
  max-width: 100%;
  padding-inline: .5rem;
  background: var(--cga-blue);
  color: var(--cga-yellow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.window[data-site="ai"] .sysop-menu ul { margin: 0; padding: 0; list-style: none; }
.window[data-site="ai"] .sysop-menu li { padding-block: .1rem; }
.window[data-site="ai"] .sysop-menu b { color: var(--cga-cyan); }
.window[data-site="ai"] .sysop-menu kbd { font: inherit; color: var(--cga-white); }
.window[data-site="ai"] .sysop-note { margin: .6rem 0 0; color: #d6d6ff; font-size: .8125rem; }
.window[data-site="ai"] .sysop-doors { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed #5555ff; }
.window[data-site="ai"] .sysop-doors a { display: inline-block; padding-block: .2rem; color: var(--cga-yellow); }
.window[data-site="ai"] .sysop-doors a:visited { color: #ffd0ff; }
.window[data-site="ai"] .sysop-menu :focus-visible { outline: 2px solid var(--cga-white); outline-offset: 2px; }

/* Status line, Telix style: cyan bar, black text, ALT-Z on the right. */
.window[data-site="ai"] > .statusbar { gap: 0; padding: 0; background: #00aaaa; color: #000; font: .8125rem/1.6 var(--mono); }
.window[data-site="ai"] > .statusbar span { border: 0; border-inline-end: 1px solid #005f5f; padding: .15rem .7rem; }
.window[data-site="ai"] > .statusbar span:last-child { border: 0; background: #000; color: #55ffff; }

/* On the small desktop window the terminal is the whole board; the logon screen waits for Maximize. */
.crt .window[data-site="ai"]:not([data-maximized]) :is(.bbs-banner, .butler-door, .sysop-menu) { display: none; }
.crt .window[data-site="ai"]:not([data-maximized]) .bbs-board { padding: 0; }
.crt .window[data-site="ai"]:not([data-maximized]) .terminal { border-width: 0; }

@media (pointer: coarse) {
  .window[data-site="ai"] .butler-form :is(input, .button) { min-height: 44px; }
  .window[data-site="ai"] .butler-form label { display: flex; align-items: center; min-height: 44px; }
  .window[data-site="ai"] .sysop-doors a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (prefers-reduced-motion: no-preference) {
  .window[data-site="ai"] .butler { transform-origin: bottom; animation: butler-bow 3.6s ease-in-out infinite; }
  .window[data-site="ai"] .butler-hourglass { animation: butler-wait 2.4s steps(2, end) infinite; }
  .window[data-site="ai"] .bbs-swatches i { animation: ansi-cycle 2.4s steps(1, end) infinite; }
  .window[data-site="ai"] .bbs-swatches i:nth-child(odd) { animation-delay: -1.2s; }
  .window[data-site="ai"] .sysop-title::after { content: "█"; margin-inline-start: .3em; animation: bbs-cursor 1s steps(1, end) infinite; }
}
@keyframes butler-bow { 0%, 65%, 100% { transform: none; } 78% { transform: translateY(5px) rotate(12deg); } }
@keyframes butler-wait { to { transform: rotate(360deg); } }
@keyframes ansi-cycle { 50% { filter: hue-rotate(180deg) brightness(1.2); } }
@keyframes bbs-cursor { 50% { opacity: 0; } }
