/*
 * wo7fi OS — Terminal Upgrade Pack
 * Load this file AFTER styles.css.
 */
@keyframes terminal-up-line-in {
  from { opacity: 0; transform: translateY(7px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes terminal-up-sweep {
  0% { transform: translateY(-120%); opacity: 0; }
  12%, 72% { opacity: 1; }
  100% { transform: translateY(620%); opacity: 0; }
}

@keyframes terminal-up-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(52, 217, 255, 0); }
  50% { box-shadow: 0 0 26px rgba(52, 217, 255, 0.2); }
}

@keyframes terminal-up-radar {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes terminal-up-matrix {
  from { background-position: 0 -240px, 0 0; }
  to { background-position: 0 240px, 0 0; }
}

.stage-page[data-id="terminal"] .stage-page-body {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 55%, rgba(239, 24, 36, 0.12), transparent 3px),
    radial-gradient(circle at 16% 10%, rgba(52, 217, 255, 0.09), transparent 34%),
    linear-gradient(180deg, #04080d, #061019 62%, #030609);
}

.terminal-upgraded {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 10%, rgba(52, 217, 255, 0.12), transparent 28%),
    radial-gradient(circle at 72% 82%, rgba(86, 255, 107, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(4, 9, 14, 0.98), rgba(3, 7, 11, 0.97));
}

.terminal-upgraded::before {
  content: "";
  position: absolute;
  inset: 40px 0 54px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.58;
  background:
    linear-gradient(rgba(52, 217, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 217, 255, 0.028) 1px, transparent 1px);
  background-size: 100% 18px, 44px 44px;
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.terminal-upgraded::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 40px;
  height: 70px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(52, 217, 255, 0.075), transparent);
  animation: terminal-up-sweep 5.6s linear infinite;
}

.terminal-upgraded.is-matrix::before {
  opacity: 0.78;
  background:
    repeating-linear-gradient(180deg, rgba(86, 255, 107, 0.18) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(86, 255, 107, 0.08) 35px, transparent 37px);
  animation: terminal-up-matrix 8s linear infinite;
}

.terminal-upgraded .terminal-header {
  position: relative;
  z-index: 3;
  min-height: 44px;
  border-bottom-color: rgba(52, 217, 255, 0.26);
  background:
    linear-gradient(90deg, rgba(52, 217, 255, 0.1), transparent 36%, rgba(239, 24, 36, 0.07)),
    rgba(5, 10, 15, 0.93);
}

.terminal-upgraded .terminal-header-label::after {
  content: "  // core shell deluxe";
  color: rgba(52, 217, 255, 0.76);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.terminal-mainframe {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  gap: 12px;
  padding: 12px;
}

.terminal-output-shell {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(52, 217, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 4% 0%, rgba(52, 217, 255, 0.1), transparent 32%),
    rgba(4, 9, 14, 0.62);
  box-shadow: inset 0 0 34px rgba(52, 217, 255, 0.045);
}

.terminal-lines-upgraded {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 10px;
  font-size: clamp(12px, 0.88vw, 14px);
  line-height: 1.58;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 217, 255, 0.42) transparent;
}

.terminal-lines-upgraded::-webkit-scrollbar { width: 7px; }
.terminal-lines-upgraded::-webkit-scrollbar-track { background: transparent; }
.terminal-lines-upgraded::-webkit-scrollbar-thumb { background: rgba(52, 217, 255, 0.42); border-radius: 999px; }

.terminal-up-line {
  opacity: 0;
  animation: terminal-up-line-in 0.24s ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

.terminal-system-line { color: #82f7a0; }
.terminal-warn { color: #ffcb57; }
.terminal-scan { color: #67e8f9; }
.terminal-matrix-on { color: #56ff6b; text-shadow: 0 0 14px rgba(86, 255, 107, 0.42); }

.term-title { color: #34d9ff; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.term-dim { color: #8b97a7; }
.term-ok { color: #56ff6b; }
.term-logo { color: #34d9ff; display: inline-block; line-height: 1.1; text-shadow: 0 0 20px rgba(52, 217, 255, 0.18); }

.terminal-inline-cmd {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #56ff6b;
  font: inherit;
  white-space: pre;
  cursor: pointer;
}
.terminal-inline-cmd:hover { color: #34d9ff; text-decoration: underline; }

.terminal-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid rgba(52, 217, 255, 0.15);
  background: rgba(2, 6, 10, 0.56);
}
.terminal-quick-chips button,
.terminal-suggest-row {
  border: 1px solid rgba(52, 217, 255, 0.22);
  background: rgba(52, 217, 255, 0.07);
  color: #bdefff;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
}
.terminal-quick-chips button {
  min-height: 25px;
  padding: 0 10px;
  font-size: 10px;
}
.terminal-quick-chips button:hover {
  color: #04141a;
  background: #34d9ff;
  border-color: #34d9ff;
  transform: translateY(-1px);
}

.terminal-sidecar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.terminal-side-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(52, 217, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(52, 217, 255, 0.085), transparent 42%),
    rgba(7, 13, 20, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.terminal-side-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.035), transparent);
  transform: translateX(-100%);
  animation: terminal-up-sweep 7.5s linear infinite;
}
.terminal-core-card { animation: terminal-up-glow 3.8s ease-in-out infinite; }
.terminal-side-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #34d9ff;
  font: 800 10px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.terminal-side-title span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ef1824;
  box-shadow: 0 0 14px rgba(239, 24, 36, 0.86);
}
.terminal-side-card dl { display: grid; gap: 7px; margin: 0; }
.terminal-side-card dl div,
.mini-service {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font: 700 10px/1.2 'JetBrains Mono', monospace;
}
.terminal-side-card dt { color: #8b97a7; }
.terminal-side-card dd { margin: 0; color: #56ff6b; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.terminal-mini-services { display: grid; gap: 8px; }
.mini-service { padding: 7px 8px; border-radius: 8px; background: rgba(3, 8, 12, 0.55); border: 1px solid rgba(148, 163, 184, 0.14); }
.mini-service b { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #eef2f6; }
.mini-service span { color: #56ff6b; }
.mini-service.is-warn span { color: #ffcb57; }

.terminal-radar-card {
  flex: 1;
  min-height: 160px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
}
.terminal-radar {
  position: relative;
  width: min(150px, 80%);
  aspect-ratio: 1;
  border-radius: 999px;
  border: 1px solid rgba(52, 217, 255, 0.28);
  background:
    radial-gradient(circle, transparent 0 24%, rgba(52,217,255,0.13) 25% 26%, transparent 27% 49%, rgba(52,217,255,0.11) 50% 51%, transparent 52%),
    linear-gradient(90deg, transparent 49%, rgba(52,217,255,0.22) 50%, transparent 51%),
    linear-gradient(transparent 49%, rgba(52,217,255,0.22) 50%, transparent 51%);
}
.terminal-radar i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48%;
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(86, 255, 107, 0.86), transparent);
  animation: terminal-up-radar 3.6s linear infinite;
}
.terminal-radar span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #56ff6b;
  box-shadow: 0 0 16px rgba(86,255,107,0.72);
}
.terminal-radar span:nth-child(2) { left: 33%; top: 28%; }
.terminal-radar span:nth-child(3) { right: 27%; top: 58%; background: #34d9ff; }
.terminal-radar span:nth-child(4) { left: 55%; bottom: 20%; background: #ffcb57; }
.terminal-radar-card p { margin: 0; color: #8b97a7; font: 700 10px/1 'JetBrains Mono', monospace; }

.terminal-input-deck {
  position: relative;
  z-index: 4;
  min-height: 0;
}
.terminal-suggest {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px;
  pointer-events: auto;
}
.terminal-suggest-row {
  min-width: 0;
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(5, 12, 18, 0.94);
  text-align: left;
}
.terminal-suggest-row span { color: #56ff6b; font-size: 10px; }
.terminal-suggest-row small { color: #8b97a7; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terminal-suggest-row.is-selected,
.terminal-suggest-row:hover { border-color: rgba(52, 217, 255, 0.72); background: rgba(52, 217, 255, 0.12); }

.terminal-upgraded .terminal-form {
  position: relative;
  z-index: 5;
  min-height: 54px;
  border-top-color: rgba(52, 217, 255, 0.32);
  background: rgba(4, 8, 13, 0.96);
}
.terminal-upgraded .terminal-form::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #34d9ff, #56ff6b, transparent);
}
.terminal-upgraded .terminal-prompt { color: #56ff6b; text-shadow: 0 0 12px rgba(86,255,107,0.45); }
.terminal-upgraded .terminal-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(52, 217, 255, 0.22);
  border-radius: 6px;
  background: rgba(52, 217, 255, 0.035);
}
.terminal-upgraded .terminal-input:focus {
  border-color: #34d9ff;
  box-shadow: 0 0 0 3px rgba(52,217,255,0.1), 0 0 22px rgba(52,217,255,0.08) inset;
}

.wo7fi-os.theme-light .terminal-upgraded,
.wo7fi-os.theme-light .stage-page[data-id="terminal"] .stage-page-body {
  background: linear-gradient(180deg, #eef5fb, #dfeaf4);
}
.wo7fi-os.theme-light .terminal-output-shell,
.wo7fi-os.theme-light .terminal-side-card,
.wo7fi-os.theme-light .terminal-suggest-row,
.wo7fi-os.theme-light .terminal-upgraded .terminal-form {
  background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 980px) {
  .terminal-mainframe { grid-template-columns: 1fr; }
  .terminal-sidecar { display: none; }
  .terminal-suggest { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .terminal-mainframe { padding: 8px; }
  .terminal-lines-upgraded { font-size: 12px; padding: 12px; }
  .terminal-suggest { display: none; }
  .terminal-upgraded .terminal-header-label::after { content: ""; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-upgraded::after,
  .terminal-side-card::before,
  .terminal-core-card,
  .terminal-radar i,
  .terminal-up-line,
  .terminal-upgraded.is-matrix::before { animation: none !important; opacity: 1; }
}

/* Lost-place terminal pass: intentionally quiet, worn and text-led. */
.stage-page[data-id="terminal"] .stage-page-body,
.terminal-upgraded {
  background: #090a09;
}

.terminal-upgraded {
  background-image:
    radial-gradient(ellipse at 50% 5%, rgba(111, 132, 78, 0.07), transparent 42%),
    linear-gradient(180deg, #0c0e0c 0%, #070807 100%);
}

.terminal-upgraded::before {
  inset: 0;
  opacity: .22;
  background: repeating-linear-gradient(0deg, rgba(202, 219, 174, .04) 0 1px, transparent 1px 4px);
  mask-image: none;
}
.terminal-upgraded::after { display: none; }

.terminal-upgraded .terminal-header {
  min-height: 42px;
  border-bottom-color: rgba(146, 161, 115, .28);
  background: rgba(16, 18, 15, .96);
}
.terminal-upgraded .terminal-header-label::after {
  content: "  // archive shell";
  color: #777f64;
}

.terminal-mainframe {
  grid-template-columns: minmax(0, 1fr) 185px;
  gap: 0;
  padding: 0;
}
.terminal-upgraded .terminal-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 185px;
  gap: 0;
  padding: 0;
}
.terminal-output-shell {
  border: 0;
  border-right: 1px solid rgba(146, 161, 115, .18);
  border-radius: 0;
  background: rgba(7, 8, 7, .72);
  box-shadow: none;
}
.terminal-upgraded .terminal-output-shell { display: flex; flex-direction: column; min-height: 0; }
.terminal-lines-upgraded {
  padding: 28px 30px;
  color: #c6ccb8;
  font-size: 13px;
  line-height: 1.85;
  text-shadow: 0 0 6px rgba(191, 212, 143, .11);
  scrollbar-color: #626b4e transparent;
}
.terminal-up-line { animation: none; opacity: 1; }
.terminal-system-line { color: #a9bd80; }
.terminal-warn { color: #c2a868; }
.term-title, .term-logo { color: #c2c9ad; text-shadow: none; }
.term-ok, .terminal-matrix-on { color: #a9bd80; text-shadow: none; }
.terminal-scan { color: #b5a678; }

.terminal-quick-chips {
  gap: 14px;
  padding: 11px 30px;
  border-top-color: rgba(146, 161, 115, .15);
  background: rgba(12, 14, 11, .94);
}
.terminal-quick-chips button,
.terminal-suggest-row {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8b9d6e;
}
.terminal-quick-chips button::before { content: "./"; color: #5f684d; }
.terminal-quick-chips button:hover { color: #d8dfc7; background: transparent; transform: none; }

.terminal-sidecar { gap: 0; background: rgba(13, 15, 12, .88); }
.terminal-side-card {
  border: 0;
  border-bottom: 1px solid rgba(146, 161, 115, .16);
  border-radius: 0;
  padding: 20px 16px;
  background: transparent;
  box-shadow: none;
}
.terminal-side-card::before { display: none; }
.terminal-core-card { animation: none; }
.terminal-side-title { color: #8f9d71; font-weight: 700; }
.terminal-side-title span { width: 5px; height: 5px; background: #ad9c65; box-shadow: none; }
.terminal-side-card dt { color: #717966; }
.terminal-side-card dd { color: #b6c38e; }
.mini-service { padding: 0; border: 0; border-radius: 0; background: transparent; color: #aeb5a1; }
.mini-service b { color: #aeb5a1; font-weight: 500; }
.mini-service span, .mini-service.is-warn span { color: #a9996b; }
.terminal-radar-card { display: none; }

.terminal-upgraded .terminal-form {
  min-height: 52px;
  border-top-color: rgba(146, 161, 115, .25);
  background: #0b0d0a;
}
.terminal-upgraded .terminal-form::before { display: none; }
.terminal-upgraded .terminal-prompt { color: #a9bd80; text-shadow: none; }
.terminal-upgraded .terminal-input {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d5dac9;
}
.terminal-upgraded .terminal-input:focus { border: 0; box-shadow: none; }

@media (max-width: 980px) {
  .terminal-mainframe { grid-template-columns: 1fr; }
  .terminal-sidecar { display: none; }
  .terminal-lines-upgraded { padding: 22px 18px; }
  .terminal-quick-chips { padding-inline: 18px; }
}

/* Keep the terminal in the same wo7fi brand palette as the rest of the site. */
.terminal-upgraded {
  background-image:
    radial-gradient(ellipse at 50% 5%, rgba(18, 217, 227, 0.08), transparent 42%),
    linear-gradient(180deg, #090b12 0%, #05070d 100%);
}
.terminal-upgraded::before { background:repeating-linear-gradient(0deg, rgba(18,217,227,.035) 0 1px, transparent 1px 4px); }
.terminal-upgraded .terminal-header { border-bottom-color:rgba(24,123,231,.32); }
.terminal-upgraded .terminal-header-label::after { color:#778fd5; }
.terminal-output-shell { border-right-color:rgba(24,123,231,.22); background:rgba(5,8,15,.75); }
.terminal-lines-upgraded { color:#d9efff; text-shadow:0 0 7px rgba(18,217,227,.14); scrollbar-color:#3975cf transparent; }
.terminal-system-line, .term-ok, .terminal-matrix-on { color:#12d9e3; }
.terminal-warn, .terminal-scan { color:#bc5bdd; }
.term-title, .term-logo { color:#72b4ff; }
.terminal-quick-chips { border-top-color:rgba(24,123,231,.2); background:rgba(7,11,21,.95); }
.terminal-quick-chips button { color:#72b4ff; }
.terminal-quick-chips button::before { color:#aa25c4; }
.terminal-quick-chips button:hover { color:#12d9e3; }
.terminal-sidecar { background:rgba(8,12,22,.9); }
.terminal-side-card { border-bottom-color:rgba(24,123,231,.2); }
.terminal-side-title { color:#72b4ff; }
.terminal-side-title span { background:#aa25c4; }
.terminal-side-card dt { color:#8398ba; }
.terminal-side-card dd { color:#12d9e3; }
.mini-service b { color:#d9efff; }
.mini-service span, .mini-service.is-warn span { color:#72b4ff; }
.terminal-upgraded .terminal-form { border-top-color:rgba(24,123,231,.32); background:#070a12; }
.terminal-upgraded .terminal-prompt { color:#12d9e3; }

/* Calm terminal: readable text, restrained blue structure, no neon treatment. */
.terminal-upgraded { background:#080d16; background-image:none; }
.terminal-upgraded::before { display:none; }
.terminal-upgraded .terminal-header { background:#0a101a; border-bottom-color:#202c40; }
.terminal-upgraded .terminal-header-label::after { color:#70839d; }
.terminal-output-shell { background:#080d16; border-right-color:#202c40; }
.terminal-lines-upgraded { color:#d9e2ef; text-shadow:none; scrollbar-color:#385779 transparent; }
.terminal-system-line { color:#cbd8e8; }
.terminal-warn { color:#a989d6; }
.terminal-scan,
.term-title,
.term-logo,
.term-ok,
.terminal-matrix-on { color:#82addd; text-shadow:none; }
.terminal-quick-chips { border-top-color:#202c40; background:#0a101a; }
.terminal-quick-chips button { color:#7899bc; }
.terminal-quick-chips button::before { color:#657a98; }
.terminal-quick-chips button:hover { color:#dce8f7; }
.terminal-sidecar { background:#0a101a; }
.terminal-side-card { border-bottom-color:#202c40; }
.terminal-side-title { color:#9db4d0; }
.terminal-side-title span { background:#657a98; }
.terminal-side-card dt { color:#72839a; }
.terminal-side-card dd { color:#bdcde0; }
.mini-service b { color:#cbd8e8; }
.mini-service span,
.mini-service.is-warn span { color:#7899bc; }
.terminal-upgraded .terminal-form { background:#0a101a; border-top-color:#202c40; }
.terminal-upgraded .terminal-prompt { color:#82addd; }
.terminal-upgraded .terminal-input { color:#e1eaf6; }
.terminal-upgraded .terminal-input:focus { box-shadow:inset 0 -1px 0 #5b91d0; }

/* The terminal output owns scrolling; the prompt always stays accessible. */
.terminal-upgraded .terminal-lines-upgraded { min-height:0; overscroll-behavior:contain; }
