/* The site terminal ("Ask the machine").
   It keeps its own dark look, like a screen set into the page.
   Colours: phosphor green for output, and a blue -> teal -> yellow ramp
   for the top edge and the start-up banner. */
.term-window { position: relative; max-width: 920px; border: 1px solid #1e3a2a; border-radius: 10px; background: #020503 linear-gradient(90deg, #5b7cff, #2fe3c5, #ffe45c) 0 0 / 100% 2px no-repeat; color: #7dffa5; font: 400 14.5px/1.7 "IBM Plex Mono", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", ui-monospace, monospace; letter-spacing: 0; text-align: left; text-shadow: 0 0 7px rgba(125, 255, 165, 0.28); overflow: hidden; box-shadow: 0 14px 30px -22px rgba(2, 5, 3, 0.6); transition: border-color 0.2s, box-shadow 0.2s; }
.term-window:focus-within { border-color: #7dffa5; box-shadow: 0 0 0 1px rgba(125, 255, 165, 0.25), 0 14px 30px -22px rgba(2, 5, 3, 0.6); }
/* Scanlines and a soft vignette. Purely decorative, never in the way of a click. */
.term-window::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.032) 0 1px, transparent 1px 3px), radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.42) 100%); }
.term-window ::selection { background: #7dffa5; color: #020503; text-shadow: none; }

.term-window .term-bar { display: flex; align-items: center; gap: 16px; padding: 10px 20px 8px; border-bottom: 1px solid #12261a; color: #3fae68; font-size: 12.5px; line-height: 1.5; text-shadow: none; }
.term-window .term-title { margin-right: auto; color: #7dffa5; white-space: nowrap; }
.term-window .term-keys { display: flex; gap: 16px; white-space: nowrap; }
.term-window .term-bar kbd { display: inline-block; min-width: 1.5em; margin-right: 2px; padding: 0 5px; font: inherit; text-align: center; color: #7dffa5; background: none; border: 1px solid #1e3a2a; border-radius: 4px; box-shadow: none; }

.term-window .term-out { height: min(60vh, 540px); overflow-y: auto; padding: 18px 20px 6px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #1e3a2a transparent; }
.term-window .term-out::-webkit-scrollbar { width: 8px; }
.term-window .term-out::-webkit-scrollbar-thumb { background: #1e3a2a; border-radius: 4px; }
.term-window .term-out p { margin: 0 0 4px; max-width: none; font: inherit; color: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-window .term-out .echo { color: #d7ffe4; }
.term-window .term-out .echo::before { content: "visitor@shengweichan:~$ "; color: #3fae68; }
.term-window .term-out .gap { height: 10px; }
.term-window .term-out a { color: #d7ffe4; text-decoration: underline; text-underline-offset: 3px; }
.term-window .term-out a:hover { color: #ffe45c; }
.term-window .term-out .warn { color: #ffe45c; text-shadow: 0 0 7px rgba(255, 228, 92, 0.3); }
.term-window .term-out .k { color: #ffe45c; text-shadow: 0 0 7px rgba(255, 228, 92, 0.3); }
.term-window .term-out .dim { color: #3fae68; }
.term-window .term-out .h { color: #d7ffe4; font-weight: 600; }
.term-window .term-out .kv { display: flex; }
.term-window .term-out .kv .k { flex: 0 0 auto; }
.term-window .term-out .kv .v { flex: 1 1 0; min-width: 0; }
/* The name in ASCII art; each row takes the next step of the ramp. */
.term-window .term-out .banner { margin: 0; line-height: 1.18; white-space: pre; overflow-wrap: normal; font-weight: 500; }
.term-window .term-out .b0 { color: #5b7cff; text-shadow: 0 0 8px rgba(91, 124, 255, 0.5); }
.term-window .term-out .b1 { color: #49a5e8; text-shadow: 0 0 8px rgba(73, 165, 232, 0.45); }
.term-window .term-out .b2 { color: #38ced1; text-shadow: 0 0 8px rgba(56, 206, 209, 0.4); }
.term-window .term-out .b3 { color: #59e3b0; text-shadow: 0 0 8px rgba(89, 227, 176, 0.4); }
.term-window .term-out .b4 { color: #ace486; text-shadow: 0 0 8px rgba(172, 228, 134, 0.35); }
.term-window .term-out .b5 { color: #ffe45c; text-shadow: 0 0 8px rgba(255, 228, 92, 0.35); }

.term-window .term-form { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 20px 16px; border-top: 1px solid #12261a; }
.term-window .term-prompt { flex: none; color: #3fae68; font: inherit; }
.term-window .term-form input { flex: 1; min-width: 0; margin: 0; padding: 4px 0; font: inherit; color: #d7ffe4; text-shadow: inherit; background: none; border: 0; border-radius: 0; box-shadow: none; caret-color: #7dffa5; caret-shape: block; }
.term-window .term-form input::placeholder { color: #3fae68; opacity: 0.55; }
.term-window .term-form input:focus { outline: none; }

.term-chips { display: flex; flex-wrap: wrap; gap: 8px; max-width: 920px; margin-top: 14px; }
.term-chips button { font: 500 13.5px/1 "IBM Plex Mono", ui-monospace, monospace; color: #7dffa5; background: #020503; border: 1px solid #1e3a2a; border-radius: 6px; padding: 9px 12px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.term-chips button::before { content: "$ "; color: #3fae68; }
.term-chips button:hover { border-color: #7dffa5; }
.term-chips button:active { color: #020503; background: #7dffa5; }
.term-chips button:active::before { color: #020503; }
.term-chips button:focus-visible { outline: 2px solid #7dffa5; outline-offset: 2px; }

/* In the page flow (a section with a terminal in it) */
.term-section .term-window { margin-top: 18px; }

/* The dock: a launcher in the bottom-right corner, and the panel it opens. */
.term-dock { position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 90; }
.term-launch { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 12px 15px 11px; font: 500 14px/1 "IBM Plex Mono", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", ui-monospace, monospace; letter-spacing: 0; color: #d7ffe4; background: #020503 linear-gradient(90deg, #5b7cff, #2fe3c5, #ffe45c) 0 0 / 100% 2px no-repeat; border: 1px solid #1e3a2a; border-radius: 10px; box-shadow: 0 12px 30px -12px rgba(2, 5, 3, 0.7); cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.term-launch[hidden], .term-panel[hidden] { display: none; }
.term-launch:hover { border-color: #7dffa5; transform: translateY(-1px); }
.term-launch:focus-visible { outline: 2px solid #7dffa5; outline-offset: 3px; box-shadow: 0 0 0 5px #020503, 0 12px 30px -12px rgba(2, 5, 3, 0.7); }
.term-launch-icon { color: #7dffa5; font-weight: 600; }
.term-caret { animation: term-blink 1.1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
.term-panel { width: min(780px, calc(100vw - 40px)); animation: term-pop 0.16s ease-out; }
@keyframes term-pop { from { opacity: 0; transform: translateY(10px); } }
.term-panel .term-window { max-width: none; box-shadow: 0 26px 70px -18px rgba(2, 5, 3, 0.8), 0 0 0 1px rgba(2, 5, 3, 0.25); }
.term-panel .term-out { height: min(56vh, 520px, calc(100vh - 270px)); }
.term-panel .term-chips { position: relative; z-index: 1; max-width: none; margin: 0; padding: 0 20px 16px; }
.term-window .term-close { flex: none; margin: -4px -8px -4px 0; padding: 4px 9px; font: 400 20px/1 "IBM Plex Mono", ui-monospace, monospace; color: #7dffa5; background: none; border: 0; border-radius: 6px; cursor: pointer; }
.term-window .term-close:hover { color: #020503; background: #7dffa5; }
.term-window .term-close:focus-visible { outline: 2px solid #7dffa5; outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  .term-caret, .term-panel { animation: none; }
  .term-launch { transition: none; }
}

@media (max-width: 860px) {
  .term-window { font-size: 13.5px; }
  .term-window .term-prompt { display: none; }
  .term-window .term-form::before { content: "$"; color: #3fae68; }
  .term-window .term-keys { display: none; }
  .term-window .term-out { padding: 16px 16px 6px; }
  .term-window .term-bar, .term-window .term-form { padding-left: 16px; padding-right: 16px; }
  .term-dock { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .term-launch { padding: 14px 15px 13px; font-size: 15px; }
  .term-launch-label { display: none; }
  .term-panel { width: calc(100vw - 24px); }
  .term-panel .term-out { height: min(48vh, 420px, calc(100vh - 300px)); }
  .term-panel .term-chips { padding: 0 16px 14px; }
}
@media (hover: none) {
  .term-window .term-keys { display: none; }
}
@media print {
  .term-section, .term-dock { display: none; }
}
