/* Hidden way in: the blinking cursor after the name opens a terminal that drops
   down over the portfolio. Signing in there opens the dashboard on the same page. */

/* the cursor itself, styled exactly like the old .cursor::after block */
.cursor-key {
  display: inline-block;
  width: 0.5em;
  height: 0.8em;
  margin-left: 0.12em;
  padding: 0;
  border: 0;
  background: var(--ink);
  vertical-align: -0.04em;
  cursor: text; /* no pointer hint: it should look like plain text */
}
.cursor-key:focus-visible { outline: 1px dashed var(--ink); outline-offset: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .cursor-key { animation: blink 1.1s steps(1) infinite; }
}

/* --------------------------------------------------------------------------
   Drop-down terminal: a floating window, same look as the dashboard's windows
   -------------------------------------------------------------------------- */

.term-scrim {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgb(0 0 0 / 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 180ms;
}
.term-scrim.open { opacity: 1; visibility: visible; transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1); }

.term {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 50;
  width: min(46rem, calc(100% - 32px));
  max-height: min(70vh, 32rem);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  background: rgb(16 16 19 / 0.86);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 2px solid rgb(255 255 255 / 0.22);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
  color: #f2f2f2;
  font-family: 'JetBrains Mono', var(--mono);
  font-stretch: 100%;
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  visibility: hidden;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 180ms;
}
.term.open {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}
@media (prefers-reduced-motion: reduce) {
  .term, .term.open, .term-scrim, .term-scrim.open { transition: none; transform: none; }
}

.term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
  font-size: 13px;
  color: #a8a8ae;
}
.term-head .dots { display: flex; gap: 6px; }
.term-head .dots i { width: 10px; height: 10px; border-radius: 50%; background: rgb(255 255 255 / 0.22); }

.term-close {
  min-width: 2.5rem;
  min-height: 2.25rem;
  background: none;
  border: 0;
  border-radius: 8px;
  color: #a8a8ae;
  font: inherit;
  cursor: pointer;
}
.term-close:hover { color: #fff; background: rgb(255 255 255 / 0.1); }

.term-body { padding: 1rem 1.25rem 1.25rem; overflow-y: auto; }

.term-log { white-space: pre-wrap; word-break: break-word; }
.term-log .dim { color: #a8a8ae; }
.term-log .err { color: #fff; font-weight: 600; }
.term-log .err::before { content: '! '; color: #a8a8ae; }
.term-log .ok { color: #fff; }

.term-line {
  display: flex;
  align-items: center;
  gap: 0.75ch;
  margin-top: 0.75rem;
  padding: 0 0.85rem;
  background: rgb(255 255 255 / 0.07);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 10px;
  transition: border-color 140ms;
}
.term-line:focus-within { border-color: rgb(255 255 255 / 0.6); }
.term-line[hidden] { display: none; }
.term-line label { white-space: nowrap; font-weight: 600; color: #fff; }
.term-line input {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  background: transparent;
  border: 0;
  color: #fff;
  font: inherit;
  caret-color: #fff;
  padding: 0;
}
.term-line input:focus { outline: none; }
/* like a real tty, the password does not echo at all */
.term-line input[type='password'] { color: transparent; }
.term-hint { margin-top: 0.6rem; font-size: 12px; color: #8a8a90; }

/* --------------------------------------------------------------------------
   The dashboard layer, opened in place over the portfolio
   -------------------------------------------------------------------------- */

.dash-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0a0a0a;
  overflow: auto;
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1), transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-layer.open { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .dash-layer { transform: none; }
}

html.dash-open, html.dash-open body { overflow: hidden; }
