/* ── TERMINAL THEME VARIABLES ── */
:root {
  --bg: #0a0d12;
  --bg-elev: #11151b;
  --bg-card: #161b22;
  --border: #2a323d;
  --border-soft: #1f262f;
  --text: #d4d8de;
  --text-bright: #d4d8de;
  --text-dim: #8b95a5;
  --text-faint: #6b7480;
  --green: #22c55e;
  --green-dim: #16a34a;
  --green-bright: #4ade80;
  --cyan: #3b82f6;
  --cyan-bright: #60a5fa;
  --yellow: #eab308;
  --red: #ef4444;
  --magenta: #a855f7;
  --orange: #f97316;
  --accent: #22c55e;
  --prompt-user: #22c55e;
  --prompt-host: #3b82f6;
  --prompt-path: #eab308;
  --selection: rgba(34, 197, 94, 0.3);
}

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

::selection {
  background: var(--selection);
  color: var(--text-bright);
}

/* Make sure HTML5 [hidden] always wins over display: flex / etc. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body {
  font-family: 'Fira Code', 'Menlo', 'Consolas', monospace;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at top left, rgba(126, 231, 135, 0.04), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(121, 192, 255, 0.04), transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.65;
  font-size: 14px;
  min-height: 100vh;
  padding-bottom: 3rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--green);
}

.keep-together {
  white-space: nowrap;
}

/* ── TERMINAL WINDOW CHROME ── */
.terminal {
  max-width: 1100px;
  margin: 2rem auto 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 24px 60px -20px rgba(0, 0, 0, 0.6),
    0 8px 24px -8px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  background: linear-gradient(180deg, #21262d, #161b22);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.traffic-lights {
  display: flex;
  gap: 0.5rem;
}

.traffic-lights span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.traffic-lights .red { background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.3); }
.traffic-lights .yellow { background: #febc2e; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.3); }
.traffic-lights .green { background: #28c840; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.3); }

.terminal-title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.terminal-body {
  padding: 1.6rem 1.8rem 2rem;
}

/* ── ASCII BANNER ── */
.ascii-banner {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  line-height: 1.15;
  color: var(--green);
  white-space: pre;
  overflow-x: auto;
  margin: 0.4rem 0 1.2rem;
  text-shadow: 0 0 18px rgba(126, 231, 135, 0.25);
}

.welcome-line {
  color: var(--text-faint);
  font-style: italic;
  margin: 0.6rem 0 1.4rem;
  font-size: 0.9rem;
}

/* ── INTERACTIVE PROMPT ── */
.prompt-interactive {
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
}

.prompt-interactive::before {
  display: none;
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: 'Fira Code', monospace;
  font-size: 0.88rem;
  padding: 0;
  margin: 0;
  caret-color: var(--green);
  caret-shape: bar;
  min-width: 0;
  line-height: inherit;
}

.cmd-input::placeholder {
  color: var(--text-faint);
}

/* ── COMMAND AUTOCOMPLETE ── */
.prompt-wrap {
  position: relative;
}

.cmd-suggest {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  max-width: 380px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 5;
}

.cmd-suggest li {
  padding: 0.28rem 0.7rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.cmd-suggest li.active,
.cmd-suggest li:hover {
  background: rgba(126, 231, 135, 0.08);
}

.cmd-suggest li .sg-name {
  color: var(--text-bright);
  font-weight: 500;
}

.cmd-suggest li.active .sg-name,
.cmd-suggest li:hover .sg-name {
  color: var(--green);
}

.cmd-suggest li .sg-prefix {
  color: var(--green);
  font-weight: 600;
}

.cmd-suggest li .sg-desc {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.hint-line {
  font-size: 0.84rem;
  color: var(--text-faint);
  margin: 0 0 0.5rem;
  padding-left: 0;
}

.hint-line .hint::before {
  content: "";
}

.show-all-link,
.show-all-link:hover {
  border-bottom: none;
}

.show-all-link {
  color: var(--green);
  font-weight: 500;
}

.show-all-link:hover {
  color: var(--green-dim);
}

/* ── REVEALABLE SECTIONS ── */
.reveal-section {
  display: none;
}

.revealed-clone {
  animation: fadeIn 0.25s ease-out;
  margin-top: 0.5rem;
}

.reveal-section.revealed {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── HISTORY OUTPUT (echoed commands + responses) ── */
#terminal-history {
  margin-top: 0.4rem;
}

.history-entry {
  margin-bottom: 0.4rem;
}

.history-output {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.05rem 0 0.35rem 0;
  line-height: 1.6;
}

.history-output.error {
  color: var(--red);
}

.history-output .cmd-name {
  color: var(--green);
  font-weight: 600;
}

/* ── PROMPT LINES ── */
.prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5ch;
  margin: 1.8rem 0 0.8rem;
  font-size: 0.88rem;
  color: var(--text);
}

.prompt::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--border-soft), transparent);
  margin-bottom: 0.6rem;
  order: -1;
}

.prompt:first-of-type::before {
  display: none;
}

.prompt .user { color: var(--prompt-user); font-weight: 700; }
.prompt .at { color: var(--text-dim); font-weight: 700; }
.prompt .host { color: var(--prompt-host); font-weight: 700; }
.prompt .path { color: var(--prompt-path); font-weight: 700; }
.prompt .sigil { color: var(--text-dim); font-weight: 700; }
.prompt .cmd { color: var(--cyan); font-weight: 400; }

.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green);
  vertical-align: -2px;
  margin-left: 0.3ch;
  animation: blink 1.05s steps(2, start) infinite;
}

/* Inline typing cursor — thin vertical bar that follows the typed text */
.type-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--green);
  vertical-align: -2px;
  margin-left: 1px;
  animation: blink 1.05s steps(2, start) infinite;
}

.type-cursor.done {
  display: none;
}

@keyframes blink {
  to { visibility: hidden; }
}

/* ── HERO / WHOAMI OUTPUT (plain-text, Yuchen-style) ── */
.whoami-output {
  display: flex;
  gap: 1.6rem;
  padding: 0.4rem 0 0.6rem;
  margin-bottom: 0.4rem;
  align-items: flex-start;
}

.whoami-photo {
  flex: 0 0 180px;
  width: 180px;
  min-height: calc(180px + 0.7rem + 34px);
  position: relative;
  align-self: flex-start;
}

.whoami-photo > img {
  display: block;
}

/* Icon row absolutely positioned below photo so its overflow doesn't push the bio */
.photo-links {
  position: absolute;
  left: 0;
  top: calc(180px + 0.7rem);
  display: flex;
  gap: 0;
  align-items: center;
  flex-wrap: nowrap;
  width: max-content;
}

/* Distribute the 4 icons evenly across the photo's 180px width.
   The quote sits naturally after them as a normal flex sibling. */
.photo-links .icon-btn:nth-of-type(1) { margin-right: calc((180px - 4 * 34px) / 3); }
.photo-links .icon-btn:nth-of-type(2) { margin-right: calc((180px - 4 * 34px) / 3); }
.photo-links .icon-btn:nth-of-type(3) { margin-right: calc((180px - 4 * 34px) / 3); }

.photo-quote {
  display: inline-flex;
  align-items: center;
  height: 34px;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text);
  margin-left: 22rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* Remove obsolete bio-quote rule */
.bio-quote { display: none; }

.whoami-photo img {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  object-fit: cover;
  filter: saturate(0.95);
  display: block;
}

.avatar-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1a2029, #21262d);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3.6rem;
  color: var(--green);
  font-weight: 700;
}

/* ── ICON LINKS UNDER PHOTO ── */
.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.15s;
  font-size: 1.15rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.icon-btn:hover {
  color: var(--green);
  border-color: var(--green);
  background: rgba(126, 231, 135, 0.08);
  border-bottom-color: var(--green);
}

.icon-btn .icon-label {
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translate(0.03em, 0.04em);
  font-family: 'Fira Code', monospace;
}

.icon-btn .fa-orcid {
  font-size: 1.28rem;
}

.whoami-info {
  flex: 1;
  min-width: 0;
}

.whoami-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  transform: translateY(-0.18rem);
  margin-bottom: 0.5rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-shadow: 0 0 14px rgba(126, 231, 135, 0.2);
}

.whoami-info p {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.7rem;
  line-height: 1.6;
}

.research-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}

.research-bullets li {
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.18rem 0 0.18rem 1.4rem;
  position: relative;
  line-height: 1.55;
}

.research-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0.2rem;
  color: var(--green);
}

.research-bullets li strong {
  color: var(--text);
  font-weight: 400;
}

/* ── SECTION HEADINGS ── */
.section-output {
  margin-top: 0.2rem;
}

.section-output h2 {
  display: none;
}

/* Section title — green markdown-style heading with thin underline */
.section-heading {
  color: var(--green);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0.4rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: 0.01em;
}

/* Comment-style heading inside output */
.comment {
  color: var(--text-faint);
  font-size: 0.86rem;
  margin: 0.2rem 0 0.6rem;
}

.comment::before {
  content: "# ";
}

/* ── EDUCATION / CV ROWS (period on left, details on right) ── */
.cv-row {
  display: flex;
  gap: 1.4rem;
  padding: 0.28rem 0;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.45;
}

.cv-period {
  flex: 0 0 8rem;
  color: var(--yellow);
  font-weight: 400;
}

/* Honors variant: years are short (4 digits), use narrower period column */
.cv-row.cv-honors {
  gap: 0.9rem;
}

.cv-row.cv-honors .cv-period {
  flex: 0 0 3rem;
}

/* Teaching variant: semester-year strings (e.g., "Spring 2022") */
.cv-row.cv-teaching {
  gap: 1rem;
  padding: 0.18rem 0;
}

.cv-row.cv-teaching .cv-period {
  flex: 0 0 7rem;
}

/* Subheading inside a CV-style section (e.g., "Teaching Assistant, ...") */
.cv-subheading {
  color: var(--text);
  font-size: 0.88rem;
  margin: 0.7rem 0 0.6rem;
}

.cv-detail {
  flex: 1;
  min-width: 0;
}

.cv-line {
  color: var(--text);
}

.cv-line strong {
  color: var(--magenta);
  font-weight: 400;
}

.cv-line .school {
  color: var(--cyan);
}

.cv-line .role {
  color: var(--green);
}

/* Honors variant: long-form award titles render in default text color, no bold */
.cv-row.cv-honors .cv-line strong {
  color: var(--text);
  font-weight: 400;
}

.cv-row.cv-honors .cv-sub {
  margin-top: -0.08rem;
}

.section-education .cv-sub {
  margin-top: -0.08rem;
}

.cv-sub {
  color: var(--text-faint);
  font-size: 0.82rem;
  font-style: italic;
  margin-top: 0.15rem;
}

/* ── AWARDS / HONORS ── */
.award-row {
  font-size: 0.88rem;
  color: var(--text);
  padding: 0.3rem 0;
  line-height: 1.5;
}

.award-tag {
  color: var(--green);
  font-weight: 600;
  margin-right: 0.5rem;
}

/* ── SERVICE / VENUE LIST ── */
.service-subheading {
  color: var(--text);
  font-weight: 400;
  font-size: 0.95rem;
  margin: 1.4rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--border-soft);
}

.service-subheading:first-of-type {
  margin-top: 0.6rem;
}

.service-row {
  font-size: 0.86rem;
  color: var(--text);
  padding: 0.18rem 0;
  line-height: 1.5;
}

.service-name {
  color: var(--text);
}

.service-name strong {
  color: var(--text);
  font-weight: 400;
}

.service-years {
  color: var(--text-faint);
  margin-left: 0.7rem;
}

/* ── PUBLICATION ITEMS ── */
.pub-filters {
  display: flex;
  gap: 1.6rem;
  margin: 0.15rem 0 0.4rem;
}

.pub-filter {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.2rem 0 0.3rem;
}

.pub-filter:hover {
  color: var(--text);
}

.pub-filter.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.pub-filter:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: 3px;
}

.pub-item {
  display: flex;
  padding: 1rem 0;
}

.pub-item + .pub-item {
  border-top: none;
}

.pub-bar {
  width: 3px;
  background: var(--border);
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 1.1rem;
  align-self: stretch;
}

.pub-body {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-weight: 400;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
  line-height: 1.45;
}

.pub-title a {
  color: var(--text-bright);
  border-bottom: none;
}

.pub-title a:hover {
  color: var(--green);
  border-bottom: none;
}

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
  font-style: italic;
}

.pub-authors strong {
  color: var(--text);
  font-weight: 400;
  font-style: italic;
}

.pub-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 0.1rem;
}

.pub-venue {
  font-size: 0.78rem;
}

.pub-venue strong {
  display: inline-block;
  font-weight: 400;
  color: var(--text);
  background: rgba(139, 149, 165, 0.12);
  border: none;
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.01em;
}

.pub-award {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--cyan);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.pub-award i {
  color: var(--cyan);
}

/* ── PILL BUTTONS (terminal flag style) ── */
.pub-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s;
  font-family: 'Fira Code', monospace;
  line-height: 1;
  border-bottom: none;
}

.pill:hover {
  color: var(--green);
}

.pill:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}

.pill svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.pill-bibtex svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.pill i {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.pill-abstract.open,
.pill-bibtex.open {
  color: var(--green);
}

.bibtex-copy {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  cursor: pointer;
  font-family: 'Fira Code', monospace;
  transition: all 0.15s;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
}

.bibtex-copy::before {
  content: none;
}

.bibtex-copy:hover {
  background: rgba(126, 231, 135, 0.08);
  color: var(--green);
  border-color: var(--green);
}

.bibtex-copy.copied {
  color: var(--green-dim);
  border-color: var(--green-dim);
  background: rgba(126, 231, 135, 0.12);
}

.pill-bibtex.open ~ .bibtex-copy {
  opacity: 1;
  pointer-events: auto;
}

/* ── EXPANDABLE BLOCKS ── */
.expand-block {
  display: none;
  margin-top: 0.6rem;
}

.expand-block.open {
  display: block;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.abstract-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 0.7rem 0.95rem;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.6;
  font-family: 'Fira Code', monospace;
}

.abstract-inner::before {
  content: "// abstract";
  display: block;
  color: var(--text-faint);
  font-size: 0.72rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.bibtex-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 0.7rem 2.8rem 0.7rem 0.95rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
  text-indent: 0;
  tab-size: 2;
}

/* ── CONTACT SECTION ── */
.contact-block {
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.85;
  padding: 0.4rem 0;
}

.contact-block p {
  margin-bottom: 0.35rem;
}

.contact-block .field {
  color: var(--green);
  display: inline-block;
  min-width: 4.5rem;
}

.contact-block .field::before {
  content: "$ ";
  color: var(--text-faint);
}

.contact-block .email-value {
  color: var(--cyan);
}

/* ── EXIT LINE ── */
.exit-prompt {
  margin-top: 1.8rem;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.exit-prompt .typed {
  color: var(--text-bright);
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  body {
    font-size: 13px;
  }

  .terminal {
    margin: 0.6rem;
    border-radius: 6px;
  }

  .terminal-body {
    padding: 1rem 1rem 1.4rem;
  }

  .ascii-banner {
    font-size: 0.5rem;
  }

  .whoami-output {
    flex-direction: column;
    gap: 1.1rem;
    padding: 0.4rem 0;
  }

  .whoami-name {
    transform: none;
  }

  .whoami-photo {
    flex: 0 0 auto;
    width: 100%;
    max-width: 280px;
    min-height: 0;
    position: static;
  }

  .whoami-photo img,
  .avatar-placeholder {
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 1;
  }

  .photo-links {
    position: static;
    margin-top: 0.7rem;
    width: 100%;
    max-width: 280px;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .photo-quote {
    position: static;
    margin-left: 0.4rem;
    height: auto;
  }

  .photo-quote {
    margin-left: 0;
    margin-top: 0.4rem;
    flex-basis: 100%;
  }

  .pub-meta-row {
    gap: 0.4rem 0.7rem;
  }
}

@media (max-width: 480px) {
  .ascii-banner {
    font-size: 0.42rem;
  }

  .terminal-title {
    font-size: 0.7rem;
  }
}
