/* =============================================================
   style.css — visual design only
   Edit colors and spacing here. Content lives in index.html.
   Theme switching: <html data-theme="light"> or "dark"
   ============================================================= */

/* ---------- Theme tokens ---------- */

:root[data-theme="light"] {
  --bg:            #f5f5f5;
  --panel:         #ffffff;
  --pane-left-bg:  #ffffff;
  --pane-right-bg: #ffffff;
  --ink:           #222222;
  --ink-soft:      #555555;
  --muted:         #888888;
  --rule:          rgba(0, 0, 0, 0.10);
  --rule-strong:   rgba(0, 0, 0, 0.18);
  --accent:        #0050b8;
  --accent-soft:   #2962ff;
  --link:          #0050b8;
  --term-typed:    #888888;     /* past terminal lines (gray) */
  --term-typing:   #555555;     /* active typing line (darker) */
  --term-prompt:   #5c9fd6;     /* blue prompt on the active line */
  --term-output:   #5c9fd6;     /* command help/output text */
  --tmux-bg:       #16332a;
  --tmux-fg:       #d8e6df;
  --btn-bg:        #000000;
  --btn-fg:        #ffffff;
  --btn-hover:     #0050b8;
  --shadow:        0 1px 0 rgba(0,0,0,.04);
  --pane-divider:  2px solid rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] {
  --bg:            #0e1116;
  --panel:         #151a21;
  --pane-left-bg:  #11151b;
  --pane-right-bg: #141a22;
  --ink:           #e6edf3;
  --ink-soft:      #b6c0cc;
  --muted:         #7d8694;
  --rule:          rgba(255, 255, 255, 0.10);
  --rule-strong:   rgba(255, 255, 255, 0.18);
  --accent:        #5c9fd6;
  --accent-soft:   #79b8ff;
  --link:          #79b8ff;
  --term-typed:    #7d8694;
  --term-typing:   #c9d1d9;
  --term-prompt:   #79b8ff;
  --term-output:   #79b8ff;
  --tmux-bg:       #0b2a22;
  --tmux-fg:       #cfe1d9;
  --btn-bg:        #e6edf3;
  --btn-fg:        #0e1116;
  --btn-hover:     #5c9fd6;
  --shadow:        0 1px 0 rgba(255,255,255,.03);
  --pane-divider:  2px solid rgba(255, 255, 255, 0.16);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  height: 100vh;
  overflow: hidden;            /* desktop: no body scroll; right pane scrolls */
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { padding-left: 1.2em; margin: 0.4em 0 0.6em; }
li { margin-bottom: 0.25em; }
p { margin: 0 0 0.8em; }
h1, h2, h3 { margin: 0; font-weight: 500; }

/* ---------- Two-pane layout ---------- */

.layout {
  position: fixed;
  inset: 0 0 24px 0;           /* leave room for tmux bar */
  display: flex;
  align-items: stretch;
}

.pane {
  height: 100%;
  overflow-x: hidden;
}
.pane-left {
  flex: 0 0 42%;
  background: var(--pane-left-bg);
  border-right: var(--pane-divider);
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;             /* never scrolls — terminal shrinks to fit */
}
.pane-left-inner {
  width: 100%;
  max-width: 560px;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
/* Top content keeps its natural height; only the mini-terminal shrinks. */
.pane-left-inner > * { flex: 0 0 auto; }
.pane-left-inner > .interactive-terminal {
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;    /* keep the active typing line visible; older lines clip from the top */
}

.pane-right {
  flex: 1 1 auto;
  background: var(--pane-right-bg);
  scroll-behavior: smooth;
  overflow-y: auto;
}
.pane-right-inner {
  max-width: 840px;
  padding: 48px 32px 80px;
  margin: 0 auto;
}

/* Custom scrollbar (right pane only) */
.pane-right::-webkit-scrollbar { width: 10px; }
.pane-right::-webkit-scrollbar-track { background: transparent; }
.pane-right::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border-radius: 4px;
}
.pane-right::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Terminal lines (Amory-style, inline gray on page bg) ---------- */

.terminal-line {
  background: transparent;
  color: var(--term-typed);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  padding: 0;
  margin: 0 0 14px;
  word-break: break-word;
}
.terminal-line + * { margin-top: 12px; }
.terminal-line h1 {
  font-size: 16px;
  font-weight: 400;
  margin: 0;
  font-family: inherit;
  line-height: 1.5;
  color: var(--term-typed);
  letter-spacing: 0;
  text-transform: none;
}

/* Past lines (already typed): muted gray, normal-weight prompt that inherits color */
.terminal-typed                { color: var(--term-typed); }
.terminal-typed .prompt        { color: inherit; font-weight: 400; }
.terminal-typed .command       { color: var(--term-typed); }
.terminal-typed .output        { color: var(--term-output); }

/* Active typing line: slightly darker text, bold blue prompt (Amory-style) */
.terminal-typing               { color: var(--term-typing); display: inline-block; }
.terminal-typing .prompt       { color: var(--term-prompt); font-weight: 700; }

.terminal-line .cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  background: var(--term-typing);
  vertical-align: text-bottom;
  margin-left: 3px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { background: transparent; } }

.interactive-terminal { cursor: text; margin-top: 16px; }
.terminal-end { margin-top: 28px; }

/* ---------- Left pane (bio) ---------- */

.name {
  font-family: 'Rubik', 'Roboto', sans-serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 4px 0 14px;
  color: var(--ink);
}
.bio {
  font-family: 'Roboto Slab', 'Roboto', serif;
  font-size: 14.5px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--ink);
}
.link { color: var(--link); border-bottom: 1px solid var(--rule); }
.link:hover { text-decoration: none; border-bottom-color: var(--link); }

.divider-soft {
  height: 1px;
  background: var(--rule);
  margin: 18px 0 14px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 8px 14px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 0;
  cursor: pointer;
  transition: background-color .2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); color: #fff; text-decoration: none; }

/* CV (and any "labelled") button: keep some left padding for the icon, then text */
.btn-text { padding: 8px 16px 8px 12px; }
.btn-text .ico { width: 15px; height: 15px; }

/* Icon-only square buttons (LinkedIn, Scholar, GitHub, Twitter, Email, theme) */
.btn-icon-only {
  padding: 8px;
  min-width: 36px;
  width: 36px;
  height: 36px;
  justify-content: center;
}
.btn-icon-only .ico { width: 16px; height: 16px; }

.ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -2px;
  fill: currentColor;
}

/* ---------- Right pane (resume) ---------- */

.section-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 18px;
  color: var(--ink);
}

.divider {
  height: 1px;
  background: var(--rule);
  margin: 28px 0;
}

/* Two-column rows for Summary / Interests only */
.row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: start;
}
.row-left .section-title { margin-bottom: 0; }
.row-right { font-family: 'Roboto Slab', serif; font-weight: 300; font-size: 15px; }

/* ---------- Role timeline ---------- */

.resume-section { padding: 4px 0; scroll-margin-top: 24px; }

.role {
  display: grid;
  grid-template-columns: 170px 22px 1fr;
  gap: 14px;
  align-items: start;
}
.role + .role { margin-top: 0; }

.role-meta {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  padding-top: 2px;
}
.role-head {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}
.flag {
  font-size: 16px;
  margin-right: 6px;
}
.role-loc { color: var(--muted); margin-top: 2px; }
.role-date { color: var(--muted); margin-top: 2px; }

/* The vertical rail of dots / line */
.role-rail {
  position: relative;
  align-self: stretch;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  min-height: 100%;
}
.rail-bullet {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  z-index: 1;
}
.role-rail::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: -28px;
  width: 2px;
  background: var(--ink-soft);
}
.role-rail.role-rail-dots::before {
  background: repeating-linear-gradient(
    to bottom,
    var(--ink-soft) 0 3px,
    transparent 3px 7px
  );
}
.role-rail.role-rail-hidden::before {
  display: none;
}
.role-end .role-rail::before { display: none; }

.role-body {
  padding-bottom: 26px;
  min-width: 0;
}
.role-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  color: var(--ink);
  line-height: 1.3;
}
.role-lede {
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}
.role-body ul {
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  color: var(--ink);
}
.role-body ul li::marker { color: var(--accent); }

/* Roles inside .roles-compact start collapsed: bullets and non-lede paragraphs
   hide; the role-lede one-liner stays visible. The global #role-toggle button
   flips .roles-expanded on <html>, which reveals the hidden content. Only
   active with JS; no-JS shows everything. */
.has-js .roles-compact .role .role-body > ul,
.has-js .roles-compact .role .role-body > p:not(.role-lede) {
  transition: max-height .35s ease, opacity .25s ease, margin .35s ease;
}
.has-js:not(.roles-expanded) .roles-compact .role .role-body > ul,
.has-js:not(.roles-expanded) .roles-compact .role .role-body > p:not(.role-lede) {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
}
.has-js:not(.roles-expanded) .roles-compact .role .role-body { padding-bottom: 14px; }
.has-js.roles-expanded .roles-compact .role .role-body > ul,
.has-js.roles-expanded .roles-compact .role .role-body > p:not(.role-lede) {
  opacity: 1;
  /* max-height is driven inline from JS during the transition; cleared after.
     Default of `none` then applies, so content can grow without being clipped. */
}

/* Resume header row: terminal-style prompt + [less]/[more] mode toggles.
   Sticks to the top of the scroll container so the toggle is always reachable. */
.resume-header-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--pane-right-bg);
  padding: 12px 0;
  margin-top: -12px;
  margin-bottom: 6px;
}
.resume-prompt {
  color: var(--term-typed);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
}
.resume-mode {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  padding: 0 2px 1px;
  color: var(--link);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.resume-mode:hover,
.resume-mode:focus-visible {
  color: var(--accent-soft);
  border-bottom-color: var(--link);
  outline: 0;
}

/* Publications: less mode shows grouped summary, more mode shows full list.
   Without JS, both lists are visible. */
.has-js .pub-full { display: none; }
.has-js.roles-expanded .pub-summary { display: none; }
.has-js.roles-expanded .pub-full { display: block; }
.pub-authors {
  display: block;
  color: var(--muted);
  font-family: 'Roboto', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  margin-top: 3px;
}
.pub-venues {
  display: block;
  color: var(--muted);
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 6px;
}

.role-toggle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0 4px;
  margin-left: 10px;
  vertical-align: middle;
}
.role-toggle:hover { color: var(--accent-soft); }

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 8px;
  column-gap: 18px;
  margin-bottom: 12px;
}
.skills-key {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
  font-size: 13px;
}
.skills-val { color: var(--ink); }
.skills-note { color: var(--muted); font-size: 13px; }

/* ---------- Publications ---------- */

.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pub-list li {
  display: grid;
  grid-template-columns: 140px 70px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--rule);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
}
.pub-list li:last-child { border-bottom: 0; }
.pub-venue {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 12px;
}
.pub-year {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.pub-title { color: var(--ink); }
.pub-link {
  margin-top: 18px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  color: var(--term-typed);
}

/* ---------- Floating theme toggle (top-right) ---------- */

.theme-toggle-fixed {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
  padding: 0;
}
.theme-toggle-fixed:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle-fixed .ico {
  width: 16px;
  height: 16px;
}
:root[data-theme="light"] #theme-icon .sun  { display: none; }
:root[data-theme="dark"]  #theme-icon .moon { display: none; }

/* ---------- Status bar / scroll counter ---------- */

.scroll-counter {
  position: fixed;
  right: 14px;
  bottom: 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--pane-right-bg);
  padding: 2px 6px;
  border: 1px solid var(--rule);
  z-index: 5;
}

.tmux-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--tmux-bg);
  color: var(--tmux-fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 4px 14px;
  display: flex;
  justify-content: space-between;
  z-index: 10;
}
.tmux-right { display: flex; gap: 18px; }
.tmux-info { opacity: 0.85; }
.tmux-date { opacity: 0.65; }

/* ---------- Tablet ---------- */

@media (max-width: 1080px) {
  .pane-left  { flex-basis: 44%; }
  .pane-left-inner { padding: 36px 28px; }
  .pane-right-inner { padding: 36px 28px 80px; }
  .role { grid-template-columns: 160px 22px 1fr; gap: 12px; }
  .pub-list li { grid-template-columns: 130px 60px 1fr; }
}

/* ---------- Mobile: stack panes vertically ---------- */

@media (max-width: 860px) {
  body { overflow: auto; height: auto; }
  .layout {
    position: static;
    inset: auto;
    display: block;
    padding-bottom: 32px;
  }
  .pane { height: auto; overflow: visible; }
  .pane-left {
    flex: none;
    border-right: 0;
    border-bottom: var(--pane-divider);
    display: block;
  }
  .pane-left-inner { max-width: none; padding: 28px 18px 28px; }
  .pane-right-inner { max-width: none; padding: 24px 18px 64px; }

  .name { font-size: 30px; }
  .bio  { font-size: 14.5px; line-height: 1.65; }
  .section-title { font-size: 18px; }

  /* Stack two-column Summary / Interests rows */
  .row { grid-template-columns: 1fr; gap: 6px; }

  /* Stack roles vertically; meta on top, body below; hide rail */
  .role { grid-template-columns: 1fr; gap: 8px; }
  .role-rail { display: none; }
  .role-meta {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 12px;
  }
  .role-body { padding-bottom: 22px; padding-left: 12px; border-left: 1px dashed var(--rule); }

  .skills-grid { grid-template-columns: 1fr; row-gap: 2px; }
  .skills-key { margin-top: 8px; }

  .pub-list li {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 0;
  }
  .pub-venue, .pub-year { display: inline-block; margin-right: 10px; }

  .buttons { gap: 8px; }
  .btn { padding: 7px 12px; font-size: 12.5px; }

  .scroll-counter { display: none; }
  .tmux-bar { font-size: 11px; padding: 4px 8px; }
  .tmux-info { display: none; }
}

@media (max-width: 420px) {
  .name { font-size: 26px; letter-spacing: 0; }
  .terminal-line, .terminal-line h1 { font-size: 12.5px; }
}

/* ---------- Print ---------- */

@media print {
  body { overflow: visible; height: auto; background: #fff; color: #000; }
  .layout { position: static; display: block; }
  .pane { overflow: visible; height: auto; }
  .pane-left { border-right: 0; border-bottom: 1px solid #000; }
  .scroll-counter, .tmux-bar, .interactive-terminal, .buttons { display: none; }
}
