/* ── theme ── */
:root {
  --accent: #bd93f9;
  --bg: #1a1b26;
  --bg-alt: #16161e;
  --border: #292b3a;
  --border-strong: #44475a;
  --fg: #f8f8f2;
  --muted: #6272a4;
  --cyan: #8be9fd;
  --green: #50fa7b;
  --purple: #bd93f9;
  --yellow: #f1fa8c;
  --orange: #ffb86c;
  --pink: #ff79c6;
  --red: #ff5555;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', 'Noto Sans SC', ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--border-strong); color: var(--fg); }

/* Visually hidden, but available to screen readers and text parsers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#tui-main::-webkit-scrollbar { width: 10px; }
#tui-main::-webkit-scrollbar-track { background: var(--bg); }
#tui-main::-webkit-scrollbar-thumb { background: var(--border-strong); border: 2px solid var(--bg); }
#tui-main::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

.caret {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -3px;
  animation: blink 1s steps(1) infinite;
}

/* ── shell ── */
#tui-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

/* ── boot splash ── */
#tui-boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity .5s ease;
}
.boot-logo {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.15;
  text-shadow: 0 0 9px var(--accent);
}
.boot-log { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 2; }
.boot-log .ok { color: var(--green); }
.boot-log .path { color: var(--cyan); }
.boot-prompt { font-size: 13px; color: var(--fg); }
.boot-caret {
  display: inline-block;
  width: .5em;
  height: 1em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}

/* ── CRT scanlines overlay ── */
#tui-scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  display: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,.13) 3px, rgba(0,0,0,0) 4px);
}
#tui-shell.crt-glow #tui-scan { display: block; }
#tui-shell.crt-glow { text-shadow: 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ── tmux status strip ── */
.tmux-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  height: 26px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.tmux-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tmux-badge { background: var(--green); color: var(--bg-alt); font-weight: 700; padding: 2px 8px; }
.tmux-path { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmux-path .role { color: var(--purple); }
.tmux-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; color: var(--muted); }
.tmux-session { color: var(--fg); }
.tmux-online { color: var(--green); }
#tui-clock { color: var(--cyan); }

/* ── k9s header ── */
.tui-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(220px, 1fr);
  gap: 28px;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.header-info, .tui-hints {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  line-height: 1.5;
}
.header-info { font-size: 12.5px; }
.header-info dt, .header-info .k { color: var(--cyan); }
.header-info dd, .header-info .v { color: var(--fg); margin: 0; }
.header-info .status { color: var(--green); }
.tui-hints { font-size: 12px; }
.tui-hints .key { color: var(--orange); }
.tui-hints .desc { color: var(--muted); }

/* ── body: nav pane + main ── */
.tui-body { flex: 1 1 auto; display: flex; min-height: 0; }

.tui-nav {
  flex: 0 0 232px;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 16px 0;
  overflow-y: auto;
}
.nav-label { padding: 0 16px 10px; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  background: transparent;
  transition: background .12s ease, color .12s ease;
}
.nav-marker { color: var(--bg-alt); opacity: 0; }
.nav-num { color: var(--orange); }
.nav-link:hover:not(.active) { background: #21222c; }
.nav-link.active { background: var(--accent); color: var(--bg-alt); font-weight: 700; }
.nav-link.active .nav-marker { opacity: 1; }
.nav-link.active .nav-num { color: inherit; }

.nav-section-label { padding: 22px 16px 8px; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.nav-export-link { display: block; padding: 0 16px; font-size: 12px; color: var(--cyan); }

/* ── main scroll area ── */
#tui-main { position: relative; flex: 1 1 auto; overflow-y: auto; padding: 26px 26px 40px; scroll-behavior: smooth; }

.tui-section {
  border: 1px solid var(--border-strong);
  padding: 26px 26px 24px;
  position: relative;
  margin: 0 0 24px;
}
.section-tag {
  position: absolute;
  top: -9px;
  left: 18px;
  margin: 0;
  font-weight: 400;
  line-height: 1;
  background: var(--bg);
  padding: 0 8px;
  font-size: 12px;
  color: var(--cyan);
}
.section-tag .path { color: var(--muted); }
.section-tag .num { color: var(--accent); }

/* ── whoami ── */
#sec-whoami { padding: 24px 26px 26px; }
.whoami-grid { display: block; }
.echo-line { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.echo-line .dollar { color: var(--green); }
.echo-line .var { color: var(--yellow); }
.greet-line { font-size: 22px; margin-bottom: 16px; }
#tui-greet { color: var(--cyan); }
.whoami-name { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -.01em; color: var(--fg); }
.whoami-role { margin: 0 0 14px; font-size: 15px; color: var(--purple); }
.whoami-role .loc { color: var(--muted); }
.whoami-tagline { margin: 0 0 10px; font-size: 14.5px; color: var(--fg); max-width: 52ch; }
.whoami-tagline .hl { color: var(--green); }
.whoami-sub { margin: 0 0 20px; font-size: 13px; color: var(--muted); max-width: 58ch; text-wrap: pretty; }
.whoami-actions { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.btn-primary { border: 1px solid var(--accent); color: var(--accent); padding: 5px 14px; }
.btn-secondary { border: 1px solid var(--border-strong); color: var(--cyan); padding: 5px 14px; }

/* ── experience ── */
#sec-experience { padding: 26px 26px 22px; }
.exp-article { padding: 6px 0 22px; }
.exp-article + .exp-article { border-top: 1px solid var(--border); padding: 22px 0; }
.exp-article:last-of-type { padding-bottom: 6px; }
.exp-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.exp-now { color: var(--green); font-size: 11px; }
.exp-now-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.2s ease-in-out infinite;
  vertical-align: middle;
}
.exp-dot { color: var(--muted); font-size: 11px; }
.exp-company { margin: 0; font-size: 17px; font-weight: 700; color: var(--cyan); }
.exp-title { color: var(--purple); font-size: 14px; }
.exp-title .prev { color: var(--muted); }
.exp-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.exp-meta .sep { color: var(--border-strong); }
.exp-desc { margin: 10px 0 12px; color: var(--fg); font-size: 13.5px; max-width: 92ch; text-wrap: pretty; }
.exp-bullets { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.exp-bullets li { font-size: 13px; color: var(--fg); }
.exp-bullets .marker { color: var(--green); }
.exp-tags { display: flex; gap: 7px; flex-wrap: wrap; font-size: 11.5px; }
.tag-pill { border: 1px solid var(--border-strong); color: var(--cyan); padding: 2px 9px; }
.exp-earlier { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.exp-earlier .hash { color: var(--border-strong); }

/* ── skills ── */
.skills-cmd { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.skills-cmd .dollar { color: var(--green); }
.skills-cmd .flag { color: var(--border-strong); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 40px; }
.skills-group-title { color: var(--yellow); font-size: 12px; margin-bottom: 9px; }
.skills-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.skill-pill { border: 1px solid var(--border-strong); background: var(--bg-alt); color: var(--fg); padding: 3px 9px; font-size: 12px; line-height: 1.4; }

/* ── projects ── */
.proj-cmd { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.proj-cmd .dollar { color: var(--green); }
.proj-cmd .flag { color: var(--border-strong); }
.proj-list { display: flex; flex-direction: column; }
.proj-item { padding: 4px 0 16px; }
.proj-item + .proj-item { border-top: 1px solid var(--border); padding-top: 16px; }
.proj-item:last-child { padding-bottom: 2px; }
.proj-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.proj-marker { color: var(--green); }
.proj-name { margin: 0; font-size: 15px; font-weight: 700; color: var(--cyan); }
.proj-tags { margin-left: auto; color: var(--purple); font-size: 11.5px; }
.proj-desc { margin: 8px 0 0; font-size: 13px; color: var(--fg); max-width: 92ch; text-wrap: pretty; }

/* ── languages ── */
.lang-cmd { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.lang-cmd .dollar { color: var(--green); }
.lang-cmd .flag { color: var(--border-strong); }
.lang-list { display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.lang-row { display: grid; grid-template-columns: 34px 118px 1fr 152px; gap: 14px; align-items: center; }
.lang-code { color: var(--cyan); }
.lang-name { color: var(--fg); }
.lang-bar { letter-spacing: 1px; }
.lang-bar .fill { color: var(--green); }
.lang-bar .fill--mid { color: var(--yellow); }
.lang-bar .fill--low { color: var(--orange); }
.lang-bar .fill--study { color: var(--pink); }
.lang-bar .empty { color: var(--border-strong); }
.lang-level { color: var(--green); }
.lang-level--mid { color: var(--yellow); }
.lang-level--low { color: var(--orange); }
.lang-level--study { color: var(--pink); }
.lang-level .note { color: var(--muted); }

/* ── education ── */
.edu-cmd { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.edu-cmd .dollar { color: var(--green); }
.edu-label { color: var(--muted); font-size: 11px; letter-spacing: .14em; margin-bottom: 8px; }
.edu-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.edu-school { margin: 0; font-size: 15px; font-weight: 700; color: var(--cyan); }
.edu-loc { color: var(--muted); font-size: 12px; }
.edu-date { margin-left: auto; color: var(--muted); font-size: 12px; }
.edu-degree { margin: 4px 0 0; font-size: 13px; color: var(--fg); }

/* ── contact ── */
#sec-contact { margin: 0 0 4px; }
.contact-lead { margin: 0 0 18px; font-size: 16px; color: var(--fg); max-width: 44ch; text-wrap: balance; }
.contact-list { display: flex; flex-direction: column; font-size: 14px; max-width: 560px; }
.contact-row {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  transition: padding-left .15s ease;
}
.contact-list .contact-row:last-of-type { border-bottom: 1px solid var(--border); }
.contact-row:hover { padding-left: 8px; }
.contact-key { color: var(--muted); font-size: 12px; }
.contact-val { color: var(--fg); transition: color .15s ease; }
.contact-row:hover .contact-val { color: var(--accent); }
.contact-arrow { color: var(--muted); }
.contact-footer { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.contact-footer .arrow { color: var(--green); }

/* ── statusline ── */
.tui-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 30px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  overflow: hidden;
}
.mode-badge { background: var(--accent); color: var(--bg-alt); font-weight: 700; padding: 2px 10px; }
.prompt-line { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 12.5px; }
.prompt-user { color: var(--green); }
.prompt-path { color: var(--cyan); }
#tui-cmd {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font: inherit;
  font-size: 12.5px;
  caret-color: var(--accent);
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
}
.status-utf8 { color: var(--green); flex: 0 0 auto; }
.status-branch { color: var(--muted); flex: 0 0 auto; }
.status-copyright { color: var(--purple); flex: 0 0 auto; }

/* ── responsive additions (appended; original rules above untouched) ── */
@supports (height: 100dvh) { #tui-shell { height: 100dvh; } }

@media (max-width: 860px) {
  .tui-header { grid-template-columns: 1fr; gap: 8px; }
  .tui-hints { display: none; }
  .tmux-session { display: none; }
  .status-copyright { display: none; }

  .tui-body { flex-direction: column; }
  .tui-nav {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
  }
  .nav-label, .nav-section-label, .nav-marker { display: none; }
  .nav-link { padding: 4px 10px; white-space: nowrap; }
  .nav-export-link { margin-left: auto; white-space: nowrap; padding: 0 6px; }

  #tui-main { padding: 16px 12px 30px; }
  .tui-section, #sec-whoami, #sec-experience { padding: 20px 14px 18px; }

  .exp-meta { margin-left: 0; width: 100%; }
  .proj-tags { margin-left: 0; width: 100%; }
  .edu-date { margin-left: 0; }

  .lang-row { grid-template-columns: 34px 1fr auto; gap: 4px 12px; }
  .lang-bar { grid-column: 1 / -1; overflow: hidden; white-space: nowrap; }

  .contact-row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .contact-key { grid-column: 1 / -1; }
  .contact-val { overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
  .status-branch { display: none; }
  .tmux-path { font-size: 11px; }
}

/* ──────────────────────────────────────────────────────────────────
   Print / "Save as PDF" — clean, light, linear, fully selectable text.
   Strips the terminal chrome so recruiters, ATS, and AI get a plain,
   high-contrast, single-column document with real, extractable text.
   ────────────────────────────────────────────────────────────────── */
@media print {
  @page { size: A4; margin: 14mm; }

  html, body, #tui-shell, #tui-main {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    display: block !important;
  }
  body {
    color: #111 !important;
    font-size: 10.5pt;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Force dark, readable text everywhere; drop glows/shadows */
  #tui-shell *, #tui-main * { color: #111 !important; text-shadow: none !important; }

  /* Remove terminal chrome and decorative/interactive-only bits */
  #tui-boot, #tui-scan, .tmux-bar, .tui-header, .tui-nav, .tui-footer,
  .whoami-actions, .echo-line, .greet-line, .caret,
  .lang-bar,
  .skills-cmd, .lang-cmd, .edu-cmd, .proj-cmd,
  .section-tag .path, .section-tag .num {
    display: none !important;
  }

  .tui-body { display: block !important; }
  #tui-main { padding: 0 !important; }

  /* Sections become simple stacked blocks with a plain heading */
  .tui-section {
    border: 0 !important;
    border-top: 1.5px solid #999 !important;
    padding: 12px 0 6px !important;
    margin: 0 0 6px !important;
    break-inside: auto;
  }
  #sec-whoami { border-top: 0 !important; }
  .section-tag {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 0 6px !important;
    font-size: 13pt !important;
    font-weight: 700 !important;
    text-transform: capitalize;
    letter-spacing: .02em;
  }

  /* whoami header block */
  .whoami-grid { display: block !important; }
  .whoami-name { font-size: 20pt !important; margin: 0 0 2px !important; }
  .whoami-role { font-size: 11pt !important; margin: 0 0 6px !important; }
  .whoami-tagline, .whoami-sub { max-width: none !important; }

  /* Experience: keep tightly grouped, avoid mid-entry page breaks */
  .exp-article { break-inside: avoid; padding: 8px 0 !important; }
  .exp-desc, .exp-bullets li { max-width: none !important; }
  .proj-item { break-inside: avoid; padding: 6px 0 !important; }
  .proj-desc { max-width: none !important; }
  .proj-tags { margin-left: auto; }
  .exp-meta { margin-left: auto; }
  a { color: #114393 !important; text-decoration: underline; }

  /* Tag pills & language rows as plain, legible text */
  .tag-pill, .skill-pill { border: 1px solid #bbb !important; padding: 1px 6px !important; background: none !important; }
  .lang-row { display: flex !important; gap: 10px !important; align-items: baseline; }
  .contact-arrow { display: none !important; }
  .contact-row { padding: 4px 0 !important; }
}
