/* ---------------------------------------------------
ABOUT ME — terminal window (home page, section 04)
One terminal window on the right, the glitch background
stays free on the left. Panes: fact sheet on top, the
interactive shell (assets/js/terminal.js) below.
----------------------------------------------------- */
#section3 {
  background: transparent;
}

#section3 .fp-tableCell {
  display: block;
  height: 100% !important;
}

.tw-stage {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;       /* the black half on the right, the glitch nebula free on the left */
  font-family: 'Inconsolata', monospace;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}

.tw {
  width: 50%;                       /* exactly half: the divide matches the Research panel */
  min-width: 560px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 60px;               /* clears the fixed top bar */
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  background: #000;
  overflow: hidden;
}

/* on wide screens the panel grows but its content stays readable */
.tw-title, .tw-pane, .tw-status {
  width: 100%;
  max-width: 800px;
}

/* title line */
.tw-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
  flex-shrink: 0;
}

.tw-path { color: rgba(255, 255, 255, 0.6); }
.tw-path b { font-weight: 400; color: #86efac; }

.tw-num {
  font-family: 'Quicksand', sans-serif;
  font-size: 10.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.tw-num i { font-style: normal; color: rgba(255, 255, 255, 0.28); margin-right: 8px; }

/* panes */
.tw-panes {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tw-pane {
  padding: 20px 26px;
  min-height: 0;
}

.tw-pane--fetch {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 18px;
}

.tw-pane--shell {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tw-cmdline { margin: 0 0 10px; color: rgba(255, 255, 255, 0.42); }
.tw-ps { color: #86efac; white-space: nowrap; }
.tw-ps .tw-dir { color: #93c5fd; }
.tw-cmdline .tw-cmd { color: rgba(255, 255, 255, 0.85); }

/* fact sheet */
.tw-host { margin: 0 0 2px; font-size: 15px; color: #fff; }
.tw-host .tw-at { color: rgba(255, 255, 255, 0.42); }
.tw-rule { margin: 0 0 10px; color: rgba(255, 255, 255, 0.28); letter-spacing: -.5px; }

.tw-kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
  gap: 5px 16px;
  margin: 0;
}

.tw-kv dt { margin: 0; color: rgba(255, 255, 255, 0.42); }
.tw-kv dt::after { content: ':'; color: rgba(255, 255, 255, 0.28); }
.tw-kv dd { margin: 0; color: rgba(255, 255, 255, 0.85); overflow-wrap: anywhere; }
.tw-kv dt.tw-wide-key { grid-column: 1; }
.tw-kv dd.tw-wide { grid-column: 2 / -1; }
.tw-kv .tw-year { color: #86efac; }
.tw-kv .tw-sep { color: rgba(255, 255, 255, 0.28); margin: 0 6px; }

.tw-kv a,
.tw-kv a:visited {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
}

.tw-kv a:hover { color: #fff; text-decoration-color: #fff; }

.tw-swatches { display: flex; gap: 6px; margin-top: 14px; }
.tw-swatches i { display: block; width: 18px; height: 10px; border-radius: 2px; }

/* the shell (existing terminal markup lives inside .tw-out) */
.tw-out {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  line-height: 1.55;
}

.tw-out::-webkit-scrollbar { width: 5px; }
.tw-out::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255, 255, 255, 0.18); }

.tw-out .termial { font-family: inherit; overflow: visible; height: auto; }
.tw-out .termial .output span { line-height: inherit; }
.tw-out .terminal-text-input { color: rgba(255, 255, 255, 0.42); }
.tw-out .terminal-text-secondary { color: rgba(255, 255, 255, 0.35); }
.tw-out .terminal-text-link,
.tw-out .terminal-text-link:visited {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
}
.tw-out .terminal-text-link:hover { color: #fff; }

/* aligned "command output" rows for education / work / teaching */
.tw-date {
  display: inline-block;
  min-width: 7.5em;
  color: #86efac;
}

.tw-sub {
  display: block;
  padding-left: 7.5em;
  color: rgba(255, 255, 255, 0.42);
}

#terminalInput { margin-top: 6px; }
#terminalCursor { color: #fff; }

/* native input on phones (replaces the old on-screen keyboard) */
.tw-mobile {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-shrink: 0;
}

.tw-mobile input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 16px;                 /* prevents iOS zoom-on-focus */
  outline: none;
  caret-color: #fff;
}

.tw-mobile input::placeholder { color: rgba(255, 255, 255, 0.28); }

/* quick-command chips */
.tw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  flex-shrink: 0;
}

.tw-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tw-chip::before { content: '$ '; color: rgba(255, 255, 255, 0.28); }

.tw-chip:hover,
.tw-chip:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

/* status bar (tmux style) */
.tw-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
  flex-shrink: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.tw-status::-webkit-scrollbar { display: none; }
.tw-wins { display: flex; gap: 14px; }
.tw-wins a, .tw-wins a:visited { color: rgba(255, 255, 255, 0.42); text-decoration: none; }
.tw-wins a:hover { color: #fff; }
.tw-wins a.is-current { color: #86efac; }
.tw-wins a.is-current::after { content: '*'; }
.tw-clock { color: rgba(255, 255, 255, 0.28); }
.tw-clock b { font-weight: 400; color: rgba(255, 255, 255, 0.42); }

/* ---------------------------------------------------
TEXT GLITCH — reuses the cyan/magenta split from glitch.css
----------------------------------------------------- */
/* 1. the whole terminal text jitters on the background glitch's clock */
.tw-panes {
  animation: tw-glitch var(--time-anim, 25s) linear var(--delay-anim, 4s) infinite;
}

@keyframes tw-glitch {
  0%    { transform: translate3d(3px, 0, 0);  text-shadow: -2px 0 #00ffea, 2px 0 #fe3a7f; }
  .4%   { transform: translate3d(-2px, 0, 0); text-shadow: 2px 0 #00ffea, -2px 0 #fe3a7f; }
  .8%   { transform: translate3d(1px, 1px, 0) skewX(-2deg); text-shadow: -3px 0 #00ffea, 3px 0 #fe3a7f; }
  1.2%  { transform: none; text-shadow: none; }
  1.6%  { transform: translate3d(-3px, 0, 0); text-shadow: 2px 0 #fe3a7f, -2px 0 #00ffea; }
  2.4%  { transform: translate3d(2px, -1px, 0); text-shadow: -1px 0 #00ffea, 1px 0 #fe3a7f; }
  3.2%  { transform: none; text-shadow: none; }
  3.6%  { transform: translate3d(-2px, 0, 0) skewX(1deg); text-shadow: 3px 0 #00ffea, -3px 0 #fe3a7f; }
  4.4%, 100% { transform: none; text-shadow: none; }
}

/* 2. the hostname keeps a quiet, permanent glitch */
.g-text { position: relative; display: inline-block; }

.g-text::before,
.g-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  color: inherit;
  pointer-events: none;
}

.g-text::before { left: 2px; text-shadow: -1px 0 #00ffea; clip-path: inset(0 0 60% 0); animation: g-text-a 3.2s steps(1) infinite; }
.g-text::after  { left: -2px; text-shadow: 1px 0 #fe3a7f; clip-path: inset(55% 0 0 0); animation: g-text-b 3.2s steps(1) 1.1s infinite; }

@keyframes g-text-a {
  0%, 92% { opacity: 0; }
  93% { opacity: 1; clip-path: inset(0 0 62% 0); transform: translateX(1px); }
  95% { clip-path: inset(30% 0 40% 0); transform: translateX(-2px); }
  97% { clip-path: inset(70% 0 5% 0); transform: translateX(2px); }
  99%, 100% { opacity: 0; }
}

@keyframes g-text-b {
  0%, 90% { opacity: 0; }
  91% { opacity: 1; clip-path: inset(50% 0 10% 0); transform: translateX(-1px); }
  94% { clip-path: inset(10% 0 70% 0); transform: translateX(2px); }
  96% { clip-path: inset(80% 0 0 0); transform: translateX(-2px); }
  98%, 100% { opacity: 0; }
}

/* 3. a short burst on each answer as it lands: the shared .glitch-tick keyframes */
.glitch-in { animation: text-tick 0.38s steps(1) 1; }

@media (prefers-reduced-motion: reduce) {
  .tw-panes, .g-text::before, .g-text::after, .glitch-in { animation: none !important; }
  .g-text::before, .g-text::after { display: none; }
}

/* ---------------------------------------------------
RESPONSIVE
----------------------------------------------------- */
@media (max-width: 1199px) {
  .tw { width: 58%; min-width: 0; }
}

@media (max-width: 899px) {
  .tw-stage {
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
    padding: 0;
  }
  .tw { width: 100%; max-width: none; height: auto; min-height: 100vh; border-left: 0; }
  .tw-panes, .tw-pane--shell { flex: none; }
  .tw-pane { padding: 18px; }
  .tw-out { flex: none; min-height: 150px; max-height: 50vh; }
  #terminalInput { display: none; }           /* the native field below replaces the fake prompt */
  .tw-mobile { display: flex; }
  .tw-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px -18px 0;
    padding: 0 18px 4px;
    scrollbar-width: none;
  }
  .tw-chips::-webkit-scrollbar { display: none; }
  .tw-chip { flex-shrink: 0; }
  .tw-kv { grid-template-columns: 82px 1fr; gap: 6px 12px; }
  .tw-kv dd.tw-wide { grid-column: 2; }
  .tw-date { min-width: 6em; }
  .tw-sub { padding-left: 6em; }
}

@media (max-width: 767px) {
  .tw-stage { font-size: 13.5px; }
}
