/*
 * CV terminal.
 * Kept separate from styles.css so it always wins over generic page/dialog rules.
 */

dialog.profile-debugger {
  width: min(760px, calc(100vw - 24px)) !important;
  max-width: none !important;
  margin: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--body-text) !important;
  overflow: visible !important;
}

dialog.profile-debugger::backdrop {
  background: rgba(3,4,8,.80);
  backdrop-filter: blur(3px);
}

.profile-terminal-window {
  width: 100%;
  height: 540px;
  display: grid;
  grid-template-rows: 46px 39px minmax(0,1fr) 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top-color: rgba(61,188,194,.48);
  background: var(--bg);
  box-shadow:
    0 28px 85px rgba(0,0,0,.62),
    inset 0 0 0 1px rgba(255,255,255,.012);
}

/* ---------- title bar ---------- */

.profile-terminal-titlebar {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 13px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(17,19,26,.96);
}

.profile-terminal-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.profile-terminal-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px rgba(132,239,155,.28);
}

.profile-terminal-title,
.profile-terminal-path,
.profile-terminal-status,
.profile-terminal-close,
.profile-terminal-tabs,
.profile-terminal-footer {
  font-family: var(--font-ui);
}

.profile-terminal-title {
  color: #c7c1ba;
  font-size: .72rem;
  line-height: 1;
  letter-spacing: .035em;
}

.profile-terminal-path {
  margin-top: 3px;
  color: #686d78;
  font-size: .51rem;
  line-height: 1;
}

.profile-terminal-status {
  display: flex;
  gap: 8px;
  color: #6f7480;
  font-size: .48rem;
}

.profile-terminal-status span::before {
  content: "/";
  margin-right: 2px;
  color: var(--pink);
}

.profile-terminal-close {
  appearance: none;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid var(--line);
  background: #0c0e14;
  color: var(--muted);
  cursor: pointer;
  font-size: .94rem;
  line-height: 20px;
}

.profile-terminal-close:hover,
.profile-terminal-close:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  outline: none;
}

/* ---------- tabs ---------- */

.profile-terminal-tabs {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(17,19,26,.73);
  scrollbar-width: none;
}

.profile-terminal-tabs::-webkit-scrollbar {
  display: none;
}

.profile-terminal-tabs button {
  appearance: none;
  flex: 0 0 112px;
  padding: 0 11px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #858995;
  font: inherit;
  font-size: .58rem;
  cursor: pointer;
  text-align: left;
}

.profile-terminal-tabs button:hover,
.profile-terminal-tabs button:focus-visible {
  color: var(--cyan);
  outline: none;
}

.profile-terminal-tabs button[aria-selected="true"] {
  color: var(--yellow);
  background: rgba(184,135,1,.055);
  box-shadow: inset 0 -1px 0 var(--yellow);
}

/* ---------- fixed terminal viewport ---------- */

.profile-terminal-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  gap: 0;
  overflow: hidden;
  padding: 14px 17px 12px;
  font-family: var(--font-body);
  background:
    linear-gradient(rgba(255,255,255,.008) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.008) 1px, transparent 1px),
    var(--bg);
  background-size: 30px 30px;
}

.profile-terminal-line,
.profile-terminal-ready-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  min-height: 22px;
  color: #b8bac2;
  font-size: .72rem;
  line-height: 1.55;
}

.terminal-user {
  color: var(--cyan);
}

.terminal-colon {
  color: var(--muted);
}

.terminal-path {
  color: var(--violet);
}

.terminal-prompt {
  margin: 0 7px 0 4px;
  color: var(--yellow);
}

.terminal-command {
  color: var(--text);
}

.terminal-cursor {
  display: none;
}

.terminal-idle-cursor {
  margin-left: 2px;
  color: var(--green);
  animation: profile-terminal-blink 1s steps(1,end) infinite;
}

@keyframes profile-terminal-blink {
  0%, 47% { opacity: 1; }
  48%, 100% { opacity: 0; }
}

/*
 * Output owns a fixed area.
 * Content is completely invisible while the command is being typed,
 * but its space remains reserved, so the terminal never changes size.
 */
.profile-terminal-output {
  min-height: 0;
  overflow-y: auto;
  margin: 10px 0 8px;
  padding: 2px 7px 2px 1px;
  opacity: 1;
  visibility: visible;
  transition: opacity 70ms linear;
  scrollbar-width: thin;
  scrollbar-color: #454a56 #11131a;
}

.profile-terminal-output.is-waiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-terminal-ready-line {
  border-top: 1px dashed rgba(255,255,255,.055);
  padding-top: 6px;
  opacity: 1;
  visibility: visible;
}

.profile-terminal-window.is-typing .profile-terminal-ready-line {
  opacity: 0;
  visibility: hidden;
}

/* ---------- rendered command output ---------- */

.profile-terminal-panel[hidden] {
  display: none !important;
}

.profile-terminal-panel {
  color: var(--body-text);
  font-size: .67rem;
  line-height: 1.55;
}

.profile-terminal-panel h2,
.profile-terminal-panel h3,
.profile-terminal-panel p {
  margin-top: 0;
}

.profile-terminal-panel h2 {
  margin-bottom: 1px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .94rem;
  font-weight: 500;
}

.profile-terminal-panel h3 {
  margin-bottom: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .66rem;
  font-weight: 500;
}

.profile-terminal-panel h3 span {
  color: #787d88;
  font-weight: 400;
}

.profile-terminal-panel > p {
  max-width: 630px;
}

.terminal-role {
  margin-bottom: 12px;
  color: var(--cyan);
}

.terminal-comment {
  margin-bottom: 8px;
  color: #626875;
  font: .54rem var(--font-body);
}

.terminal-comment::first-letter {
  color: var(--pink);
}

.terminal-comment-spaced {
  margin-top: 17px;
}

.terminal-kv {
  display: grid;
  gap: 4px;
  margin: 14px 0 0;
}

.terminal-kv > div {
  display: grid;
  grid-template-columns: 84px minmax(0,1fr);
  gap: 8px;
}

.terminal-kv dt,
.terminal-kv dd {
  margin: 0;
}

.terminal-kv dt {
  color: var(--yellow);
}

.terminal-kv dd {
  color: #bfc1c7;
}

.terminal-experience {
  display: grid;
  gap: 12px;
}

.terminal-experience article {
  display: grid;
  grid-template-columns: 82px minmax(0,1fr);
  gap: 11px;
}

.terminal-experience time {
  color: var(--yellow);
  font-size: .58rem;
}

.terminal-experience p {
  margin: 2px 0 1px;
  color: #aeb1b9;
  font-size: .62rem;
}

.terminal-experience small {
  display: block;
  color: #777c87;
  font: .52rem/1.4 var(--font-body);
}

.terminal-config {
  display: grid;
  gap: 6px;
}

.terminal-config p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #b9bbc2;
}

.terminal-config p span {
  color: var(--cyan);
}

.terminal-education {
  display: grid;
  gap: 9px;
}

.terminal-education p {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr);
  gap: 11px;
  margin: 0;
}

.terminal-education time {
  color: var(--yellow);
}

/* ---------- footer ---------- */

.profile-terminal-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px;
  border-top: 1px solid var(--line);
  background: rgba(17,19,26,.90);
  transition: opacity 70ms linear;
}

.profile-terminal-window.is-typing .profile-terminal-footer {
  opacity: 0;
  pointer-events: none;
}

.profile-terminal-footer a {
  padding: 3px 6px;
  border: 1px solid var(--line);
  color: var(--cyan);
  font-size: .51rem;
}

.profile-terminal-footer a:hover,
.profile-terminal-footer a:focus-visible {
  color: #d9ffff;
  border-color: var(--cyan);
  outline: none;
}

.profile-terminal-footer-status {
  margin-left: auto;
  color: #5f6470;
  font-size: .46rem;
}

/* ---------- mobile ---------- */

@media (max-width: 700px) {
  dialog.profile-debugger {
    width: min(100% - 12px, 560px) !important;
  }

  .profile-terminal-window {
    height: min(610px, calc(100dvh - 20px));
    min-height: 500px;
    grid-template-rows: 46px 39px minmax(0,1fr) 56px;
  }

  .profile-terminal-titlebar {
    grid-template-columns: minmax(0,1fr) auto;
    gap: 8px;
  }

  .profile-terminal-status {
    display: none;
  }

  .profile-terminal-tabs button {
    flex-basis: 104px;
  }

  .profile-terminal-body {
    padding: 12px 12px 10px;
  }

  .profile-terminal-panel {
    font-size: .64rem;
  }

  .profile-terminal-footer {
    align-content: center;
    flex-wrap: wrap;
  }

  .profile-terminal-footer-status {
    flex-basis: 100%;
    margin-left: 0;
  }
}

@media (max-width: 390px) {
  .profile-terminal-tabs button {
    flex-basis: 96px;
    padding-inline: 8px;
    font-size: .53rem;
  }

  .terminal-experience article {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .terminal-kv > div {
    grid-template-columns: 1fr;
    gap: 1px;
    margin-bottom: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-cursor,
  .terminal-idle-cursor {
    animation: none;
  }
}
