/* ── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #1e1e1e;
  --sidebar: #252526;
  --activity: #333333;
  --tabbar: #2d2d2d;
  --tab-active: #1e1e1e;
  --border: #1c1c1c;
  --statusbar: #0a7aca;
  --titlebar: #323233;
  --text: #cccccc;
  --dim: #858585;
  --accent: #4ec9b0;
  --amber: #ffae6b;
  --violet: #9678ff;
  --k: #569cd6;
  --imp: #c586c0;
  --str: #ce9178;
  --com: #6a9955;
  --fn: #dcdcaa;
  --prop: #9cdcfe;
  --num: #b5cea8;
  --type: #4ec9b0;
  --op: #d4d4d4;
  --link: #4ea1ff;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', sans-serif;
}
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
}
button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

/* ── Scrollbars ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
*:hover > ::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb { background: #3e3e3e; }
::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }

/* ── App Shell ──────────────────────────────────── */
body {
  display: grid;
  grid-template-rows: 36px 1fr 22px;
  height: 100vh;
  width: 100vw;
}

/* ── Title Bar ──────────────────────────────────── */
.titlebar {
  background: var(--titlebar);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  user-select: none;
  -webkit-app-region: drag;
  border-bottom: 1px solid var(--border);
  height: 36px;
  z-index: 100;
}
.titlebar-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  -webkit-app-region: no-drag;
}
.traffic {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
}
.traffic.red    { background: #ff5f57; }
.traffic.yellow { background: #ffbd2e; }
.traffic.green  { background: #28ca41; }
.titlebar-menu {
  display: flex;
  gap: 2px;
  -webkit-app-region: no-drag;
}
.titlebar-menu span {
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
}
.titlebar-menu span:hover { background: rgba(255,255,255,.08); }
.titlebar-title {
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titlebar-right { padding-right: 8px; }

/* ── Main Layout ─────────────────────────────────── */
.main-layout {
  display: flex;
  overflow: hidden;
  height: 100%;
}

/* ── Activity Bar ────────────────────────────────── */
.activity-bar {
  background: var(--activity);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border-right: 1px solid var(--border);
  z-index: 50;
}
.act-icon {
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  border-left: 2px solid transparent;
  transition: color 0.15s;
  position: relative;
  border-radius: 0;
}
.act-icon:hover { color: var(--text); }
.act-icon.active { color: var(--text); border-left-color: var(--text); }
.act-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  min-width: 14px;
  text-align: center;
  line-height: 14px;
  font-family: var(--font-mono);
}
.act-spacer { flex: 1; }
.act-bottom { margin-bottom: 4px; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 250px;
  min-width: 0;
  transition: width 0.18s ease;
}
.sidebar.collapsed { width: 0 !important; min-width: 0; overflow: hidden; }
.sidebar-panel { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0; }
.sidebar-panel.hidden { display: none; }
.sidebar-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--dim);
  padding: 10px 20px 4px;
  user-select: none;
}
.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
}
.sidebar-section-title:hover { background: rgba(255,255,255,.05); }
.sidebar-section-title .chevron {
  transition: transform 0.15s;
  flex-shrink: 0;
}
.sidebar-section-title.open .chevron { transform: rotate(90deg); }
.file-tree {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: 4px;
}
.file-tree.indent { padding-left: 14px; }
.file-tree.collapsed { display: none; }
.file-row, .folder-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 20px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
}
.file-row:hover, .folder-row:hover { background: rgba(255,255,255,.06); }
.file-row.active { background: rgba(255,255,255,.1); }
.folder-row { padding-left: 8px; }
.folder-row .chevron { transition: transform 0.15s; }
.folder-row.open .chevron { transform: rotate(90deg); }
.fname { overflow: hidden; text-overflow: ellipsis; }
.ficon {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 2px;
  padding: 0 3px;
  line-height: 16px;
  flex-shrink: 0;
  display: inline-block;
  min-width: 20px;
  text-align: center;
}
.ficon-md   { background: #519aba; color: #fff; }
.ficon-js   { background: #e8c84d; color: #000; }
.ficon-ts   { background: #3178c6; color: #fff; }
.ficon-json { background: #89ca78; color: #000; }
.ficon-py   { background: #3572a5; color: #fff; }

/* Search panel */
.search-box-wrap { padding: 8px 12px; }
.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid #3c3c3c;
  color: var(--text);
  padding: 5px 8px;
  border-radius: 2px;
  font: 13px var(--font-mono);
}
.search-results { padding: 4px 0; overflow-y: auto; flex: 1; }
.search-result-item {
  padding: 3px 16px;
  cursor: pointer;
  font-size: 12px;
  color: var(--dim);
}
.search-result-item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.search-result-item em { color: var(--accent); font-style: normal; font-weight: 600; }

/* ── Editor Column ───────────────────────────────── */
.editor-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* ── Tab Bar ─────────────────────────────────────── */
.tabbar {
  display: flex;
  align-items: stretch;
  background: var(--tabbar);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  min-height: 36px;
  max-height: 36px;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px 0 14px;
  min-width: 120px;
  max-width: 200px;
  background: var(--tabbar);
  border-right: 1px solid var(--border);
  cursor: pointer;
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
  position: relative;
  transition: color 0.1s;
  flex-shrink: 0;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab.active {
  background: var(--tab-active);
  color: var(--text);
}
.tab.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}
.tab-close {
  opacity: 0;
  border-radius: 3px;
  padding: 1px 3px;
  margin-left: auto;
  font-size: 14px;
  line-height: 1;
  transition: opacity 0.1s, background 0.1s;
}
.tab:hover .tab-close, .tab.active .tab-close { opacity: 0.6; }
.tab-close:hover { opacity: 1 !important; background: rgba(255,255,255,.15); }

/* ── Editor Pane ─────────────────────────────────── */
.editor-pane {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--bg);
  position: relative;
  min-height: 0;
}
.editor-pane:focus { outline: none; }
/* home-wrapper stretches to fill the pane via absolute positioning */
.editor-pane:has(.home-wrapper) {
  overflow: hidden;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--dim);
  gap: 12px;
}
.empty-state svg { opacity: 0.3; }
.empty-state p { font-size: 18px; }
.empty-state small { font-size: 12px; }

/* ── Home (Welcome) — full-height centered ───────── */
.home-wrapper {
  position: absolute;
  inset: 0;
  background: #0d0f1a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#clifford-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

/* Dark vignette so text pops */
.home-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(13,15,26,.15) 0%, rgba(13,15,26,.75) 70%, rgba(13,15,26,.95) 100%);
  pointer-events: none;
}

/* Centered card */
.home-center {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 40px 24px;
  max-width: 680px;
  width: 100%;
}

/* </> icon */
.home-tag {
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 28px;
  opacity: 0.9;
}

/* HELLO, I'M */
.home-hello {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .25em;
  color: var(--dim);
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* Name */
.home-name {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 80px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.05;
  margin-bottom: 14px;
  letter-spacing: -.02em;
}

/* Role subtitle */
.home-role {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 16px);
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: .04em;
}

/* Divider */
.home-divider {
  width: 48px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0 auto 24px;
  opacity: 0.7;
}

/* Description */
.home-desc {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: rgba(204,204,204,.65);
  line-height: 1.85;
  margin-bottom: 36px;
  max-width: 520px;
}

/* CTA buttons */
.home-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.home-btn-primary {
  background: var(--accent);
  color: #0d0f1a;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 28px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid var(--accent);
  transition: background 0.15s, color 0.15s, transform 0.1s;
  letter-spacing: .04em;
}
.home-btn-primary:hover {
  background: transparent;
  color: var(--accent);
  transform: translateY(-1px);
}
.home-btn-secondary {
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 28px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.2);
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
  letter-spacing: .04em;
}
.home-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Bottom links */
.home-links {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.home-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s;
}
.home-links a:hover { color: var(--accent); }
.home-link-sep { color: #3c3c3c; }

/* Responsive */
@media (max-width: 600px) {
  .home-name { font-size: 44px; }
  .home-btns { flex-direction: column; align-items: center; }
  .home-btn-primary, .home-btn-secondary { width: 200px; }
}

/* ── Terminal hint widget (in sidebar) ──────────── */
.term-hint-widget {
  margin: 10px 10px 14px;
  background: rgba(78,201,176,.06);
  border: 1px solid rgba(78,201,176,.18);
  border-radius: 6px;
  padding: 12px 12px 10px;
  flex-shrink: 0;
}
.term-hint-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 7px;
  font-family: var(--font-mono);
}
.term-hint-sub {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 7px;
  font-family: var(--font-mono);
}
.term-hint-examples {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.term-hint-cmd {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(204,204,204,.65);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-hint-cmd::before { content: '> '; color: var(--accent); }
.term-hint-cmd:hover { background: rgba(78,201,176,.12); color: var(--text); border-color: rgba(78,201,176,.3); }
.term-hint-open {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  padding: 5px;
  border-radius: 4px;
  border: 1px solid rgba(78,201,176,.3);
  background: rgba(78,201,176,.08);
  cursor: pointer;
  transition: background .12s;
}
.term-hint-open:hover { background: rgba(78,201,176,.18); }

/* ── Terminal line types ─────────────────────────── */
.term-line.accent { color: var(--accent); }
.term-line.hint   { color: rgba(78,201,176,.7); font-style: italic; }

/* ── Skills chips (used in about files etc) ─────── */
.chip {
  background: rgba(78,201,176,.12);
  border: 1px solid rgba(78,201,176,.3);
  color: var(--accent);
  font-size: 11.5px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── Code Editor ─────────────────────────────────── */
.code-view {
  display: flex;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 21px;
  color: var(--text);
  min-height: 100%;
}
.line-numbers {
  padding: 16px 16px 16px 12px;
  color: var(--dim);
  text-align: right;
  user-select: none;
  min-width: 52px;
  border-right: 1px solid rgba(255,255,255,.05);
  background: var(--bg);
  flex-shrink: 0;
  line-height: 21px;
}
.line-numbers span { display: block; }
.code-lines {
  padding: 16px 24px 16px 20px;
  white-space: pre;
  flex: 1;
  overflow-x: auto;
  line-height: 21px;
}
/* Syntax tokens */
.k   { color: var(--k); }
.imp { color: var(--imp); }
.str { color: var(--str); }
.com { color: var(--com); font-style: italic; }
.fn  { color: var(--fn); }
.prop{ color: var(--prop); }
.num { color: var(--num); }
.tp  { color: var(--type); }
.op  { color: var(--op); }
.lnk { color: var(--link); }
.link-inline { color: var(--link); text-decoration: underline; cursor: pointer; }

/* ── Terminal Resize Handle ──────────────────────── */
.terminal-resize-handle {
  height: 4px;
  background: transparent;
  cursor: ns-resize;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}
.terminal-resize-handle:hover { background: var(--accent); }

/* ── Terminal Panel ──────────────────────────────── */
.terminal-panel {
  background: #111111;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 240px;
  min-height: 100px;
  max-height: 60vh;
  overflow: hidden;
}
.terminal-panel.collapsed { height: 0; min-height: 0; border-top: none; }
.terminal-tabs {
  display: flex;
  align-items: center;
  background: var(--tabbar);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-shrink: 0;
  height: 32px;
}
.term-tab {
  font-size: 11px;
  font-weight: 600;
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  color: var(--dim);
  cursor: pointer;
  user-select: none;
  border-bottom: 2px solid transparent;
  letter-spacing: .05em;
}
.term-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.term-tabs-spacer { flex: 1; }
.term-icon-btn {
  padding: 4px;
  border-radius: 3px;
  color: var(--dim);
}
.term-icon-btn:hover { background: rgba(255,255,255,.1); color: var(--text); }
.terminal-body {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  cursor: text;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 21px;
}
.term-output { display: flex; flex-direction: column; gap: 1px; }
.term-line { color: var(--text); white-space: pre-wrap; word-break: break-all; }
.term-line.dim { color: var(--dim); }
.term-line.success { color: var(--accent); }
.term-line.error { color: #f44747; }
.term-line.thinking { color: var(--amber); }
.term-answer {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0;
}
.term-input-row {
  display: flex;
  align-items: center;
  margin-top: 4px;
}
.term-prompt { color: var(--accent); flex-shrink: 0; }
.term-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: 13.5px/21px var(--font-mono);
  flex: 1;
  caret-color: var(--accent);
}
.term-echo { color: var(--dim); }

/* ── Status Bar ──────────────────────────────────── */
.statusbar {
  background: var(--statusbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,.85);
  height: 22px;
}
.statusbar-left, .statusbar-right { display: flex; align-items: center; gap: 12px; }
.sb-item { white-space: nowrap; }

/* ── Quick Open ──────────────────────────────────── */
.quick-open-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-top: 80px;
}
.quick-open-overlay.hidden { display: none; }
.quick-open-box {
  background: var(--sidebar);
  border: 1px solid #3c3c3c;
  border-radius: 6px;
  width: 560px;
  max-width: 90vw;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  overflow: hidden;
}
.quick-open-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #3c3c3c;
  color: var(--text);
  font: 14px var(--font-mono);
  padding: 12px 16px;
  outline: none;
}
.quick-open-list { max-height: 320px; overflow-y: auto; }
.quick-open-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--dim);
}
.quick-open-item:hover, .quick-open-item.selected {
  background: rgba(255,255,255,.07);
  color: var(--text);
}
.quick-open-item .ficon { font-size: 8px; }

/* ── Mobile Layout ───────────────────────────────── */
/* ══════════════════════════════════════════════════════
   MOBILE  ≤ 760px
   ══════════════════════════════════════════════════════ */
@media (max-width: 760px) {

  /* Title bar — switch to flex so hidden children don't mess up grid placement */
  .titlebar { display: flex; overflow: hidden; }
  .titlebar-title {
    flex: 1; min-width: 0; overflow: hidden;
    font-size: 11px; text-align: left; padding-left: 8px;
  }
  .titlebar-menu { display: none; }
  .titlebar-right { display: none; }

  /* Body grid: explicit column so no implicit column inflation from content */
  body { grid-template-rows: 28px 1fr 22px; grid-template-columns: minmax(0, 1fr); }

  /* Activity bar: slimmer on mobile */
  .activity-bar { width: 44px; }
  .act-icon { width: 44px; height: 44px; }

  /* Sidebar: slides in as overlay from left of activity bar */
  .main-layout { position: relative; overflow: hidden; }
  .sidebar {
    position: absolute;
    left: 44px;
    top: 0; bottom: 0;
    z-index: 200;
    width: 280px !important;
    max-width: calc(100vw - 44px);
    transform: translateX(-110%);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1);
    box-shadow: 6px 0 24px rgba(0,0,0,.55);
  }
  .sidebar.mobile-open,
  .sidebar:not(.collapsed) { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-110%) !important; }

  /* Tap-outside scrim */
  .sidebar.mobile-open::after {
    content: '';
    position: fixed;
    inset: 0;
    left: calc(44px + 280px);
    background: transparent;
    z-index: -1;
  }

  /* Terminal */
  .terminal-panel { height: 200px; min-height: 120px; }
  .terminal-resize-handle { display: none; }

  /* Status bar: hide extra items that cause overflow */
  .statusbar { font-size: 10px; overflow: hidden; }
  .sb-item { padding: 0 4px; white-space: nowrap; }
  /* Hide low-priority statusbar items to prevent overflow */
  .statusbar-right .sb-item:nth-child(n+3) { display: none; }
  .statusbar-right { min-width: 0; overflow: hidden; flex-shrink: 1; }
  .statusbar-left { flex-shrink: 0; }

  /* Terminal panel: ensure collapsed state never overflows horizontally */
  .terminal-panel { overflow: hidden; }

  /* Tab bar: smaller tabs */
  .tab { min-width: 80px; max-width: 130px; font-size: 12px; padding: 0 8px; }
}

/* ══════════════════════════════════════════════════════
   SMALL MOBILE  ≤ 480px
   ══════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* Prevent any horizontal overflow */
  body, .main-layout, .editor-column, .editor-pane { overflow-x: hidden; }

  /* Home page */
  .home-wrapper { overflow: hidden; }
  .home-center { padding: 20px 16px; max-width: 100%; }
  .home-tag { font-size: 22px; margin-bottom: 18px; }
  .home-hello { font-size: 10px; }
  .home-name { font-size: 34px; letter-spacing: -.01em; }
  .home-role { font-size: 12px; }
  .home-desc { font-size: 12px; line-height: 1.75; padding: 0 4px; }
  .home-btns { gap: 10px; flex-direction: column; align-items: center; }
  .home-btn-primary, .home-btn-secondary { padding: 10px 20px; font-size: 12px; width: 200px; }
  /* Wrap links so Resume doesn't overflow */
  .home-links { flex-wrap: wrap; justify-content: center; font-size: 11px; gap: 8px 12px; }
  .home-link-sep { display: none; }

  /* About page */
  .about-page { padding: 0 0 40px; }
  .ap-hero { padding: 20px 16px; flex-direction: column; gap: 14px; }
  .ap-photo { width: 80px; height: 80px; }
  .ap-name { font-size: 22px; }
  .ap-role { font-size: 11px; }
  /* hero-text fills container so children wrap within it */
  .ap-hero-text { overflow: hidden; }
  .ap-links { gap: 6px; flex-wrap: wrap; }
  .ap-link { padding: 3px 8px; font-size: 10.5px; }
  .ap-section { padding: 20px 16px 0; }
  .ap-section-title { font-size: 17px; }
  .ap-skill-group { flex-direction: column; gap: 4px; }
  .ap-skill-cat { text-align: left; min-width: unset; }
  .ap-edu-grid { grid-template-columns: 1fr; }
  .ap-bio { font-size: 13px; }
  .ap-exp-period { font-size: 10px; }

  /* Experience / Project pages */
  .exp-page { padding: 0 0 40px; }
  .ep-header { flex-direction: column; padding: 20px 16px; gap: 12px; }
  .ep-icon { width: 44px; height: 44px; }
  .ep-company { font-size: 18px; }
  .ep-role { font-size: 12px; }
  .ep-meta { flex-wrap: wrap; gap: 6px; }
  .ep-section { padding: 20px 16px 0; }
  .ep-bullet { font-size: 12.5px; }
  .pp-desc { font-size: 12.5px; }

  /* Research page */
  .md-preview { padding: 20px 16px; }
  .md-preview h1 { font-size: 22px; }
  .md-preview h2 { font-size: 16px; }

  /* Terminal hint */
  .term-hint-cmd { font-size: 10px; }
}

/* ── Reduced Motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .tab, .act-icon { transition: none; }
}

/* ── Markdown Preview (research.md) ──────────────── */
.md-preview {
  padding: 32px 48px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.75;
  max-width: 860px;
  margin: 0 auto;
}
.md-preview h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  border-bottom: 1px solid #2d2d2d;
  padding-bottom: 10px;
}
.md-preview h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}
.md-preview h3 { font-size: 15px; color: var(--prop); margin: 20px 0 8px; }
.md-preview p { color: var(--dim); margin-bottom: 12px; }
.md-preview .badge {
  display: inline-block;
  background: rgba(150,120,255,.15);
  border: 1px solid rgba(150,120,255,.3);
  color: var(--violet);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 3px;
  margin: 2px;
}
.md-preview blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 16px;
  margin: 12px 0;
  color: var(--dim);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════
   ABOUT PAGE
   ═══════════════════════════════════════════════════ */
.about-page {
  padding: 0 0 60px;
  font-family: var(--font-ui);
  max-width: 860px;
  margin: 0 auto;
}

/* ── Hero strip ──────────────────────────────────── */
.ap-hero {
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 40px 48px 36px;
  border-bottom: 1px solid #2a2a2a;
}
.ap-photo-wrap {
  position: relative;
  flex-shrink: 0;
}
.ap-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid #2a2a2a;
}
.ap-photo-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.6;
}
.ap-hero-text { flex: 1; min-width: 0; }
.ap-hello {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--dim);
  margin-bottom: 4px;
}
.ap-name {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.1;
}
.ap-role {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
}
.ap-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.ap-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ap-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 10px;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.ap-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.ap-link-resume {
  background: rgba(78,201,176,.1);
  border-color: rgba(78,201,176,.35);
  color: var(--accent);
}
.ap-link-resume:hover { background: rgba(78,201,176,.2); }

/* ── Sections ────────────────────────────────────── */
.ap-section {
  padding: 36px 48px 0;
}
.ap-section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ap-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2a2a;
  margin-left: 8px;
}
.ap-section-num {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
}

/* Bio */
.ap-bio {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(204,204,204,.75);
  margin-bottom: 14px;
}
.ap-bio strong { color: var(--text); font-weight: 600; }
.ap-accent { color: var(--accent); font-weight: 600; }

/* Education */
.ap-edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) { .ap-edu-grid { grid-template-columns: 1fr; } }
.ap-edu-card {
  background: #252526;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color .15s;
}
.ap-edu-card:hover { border-color: rgba(78,201,176,.4); }
.ap-edu-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.ap-edu-degree {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.ap-edu-school {
  font-size: 12.5px;
  color: var(--accent);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
.ap-edu-years {
  font-size: 11.5px;
  color: var(--dim);
  font-family: var(--font-mono);
}

/* Skills */
.ap-skills { display: flex; flex-direction: column; gap: 12px; }
.ap-skill-group {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.ap-skill-cat {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
  min-width: 90px;
  padding-top: 4px;
  flex-shrink: 0;
  text-align: right;
}
.ap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-chip {
  background: rgba(78,201,176,.1);
  border: 1px solid rgba(78,201,176,.25);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 20px;
  transition: background .15s, border-color .15s;
}
.ap-chip:hover { background: rgba(78,201,176,.2); border-color: rgba(78,201,176,.5); }

/* Experience timeline */
.ap-timeline { display: flex; flex-direction: column; gap: 0; }
.ap-exp-item {
  display: flex;
  gap: 20px;
  padding-bottom: 28px;
  position: relative;
}
.ap-exp-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: #2a2a2a;
}
.ap-exp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #0d0f1a;
  flex-shrink: 0;
  margin-top: 4px;
}
.ap-exp-body { flex: 1; min-width: 0; }
.ap-exp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 3px;
}
.ap-exp-company {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}
.ap-exp-period {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}
.ap-exp-role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
}
.ap-exp-desc {
  font-size: 13px;
  color: rgba(204,204,204,.6);
  line-height: 1.65;
}

/* Mobile about */
@media (max-width: 640px) {
  .ap-hero { flex-direction: column; align-items: flex-start; padding: 24px 20px; gap: 20px; }
  /* In column layout hero-text must fill container width, not size to content */
  .ap-hero-text { width: 100%; min-width: 0; }
  .ap-section { padding: 28px 20px 0; }
  .ap-skill-group { flex-direction: column; gap: 6px; }
  .ap-skill-cat { text-align: left; min-width: unset; }
}

/* ═══════════════════════════════════════════════════
   HOME ROLE CYCLING ANIMATION
   ═══════════════════════════════════════════════════ */
#home-role-text {
  display: inline-block;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ═══════════════════════════════════════════════════
   EXPERIENCE PAGE
   ═══════════════════════════════════════════════════ */
.exp-page {
  padding: 0 0 60px;
  font-family: var(--font-ui);
  max-width: 780px;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────── */
.ep-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 36px 48px 28px;
  border-bottom: 1px solid #2a2a2a;
}
.ep-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ep-header-text { flex: 1; min-width: 0; }
.ep-company {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.15;
}
.ep-role {
  font-family: var(--font-mono);
  font-size: 14px;
  margin-bottom: 12px;
}
.ep-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ep-badge {
  background: rgba(78,201,176,.12);
  border: 1px solid rgba(78,201,176,.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .04em;
}
.ep-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}
.ep-loc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}

/* ── Sections ────────────────────────────────────── */
.ep-section {
  padding: 32px 48px 0;
}
.ep-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ep-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2a2a;
}

/* ── Bullets ─────────────────────────────────────── */
.ep-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ep-bullet {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(204,204,204,.8);
  line-height: 1.7;
}
.ep-bullet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 7px;
  opacity: 0.8;
}

/* Project page link buttons */
.pp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  letter-spacing: .03em;
}
.pp-link:hover { opacity: 0.8; transform: translateY(-1px); text-decoration: none; }

/* Project overview description */
.pp-desc {
  font-size: 14px;
  color: rgba(204,204,204,.78);
  line-height: 1.8;
  margin-top: 12px;
}

/* Mobile experience page */
@media (max-width: 640px) {
  .ep-header { flex-direction: column; padding: 24px 20px; gap: 16px; }
  .ep-icon { width: 48px; height: 48px; }
  .ep-section { padding: 24px 20px 0; }
}

/* ── OVERVIEW PAGES (projects.ts / experience.ts) ─────────────── */
.ov-page {
  padding: 40px 48px 60px;
  max-width: 960px;
  margin: 0 auto;
}
.ov-header { margin-bottom: 32px; }
.ov-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 8px;
}
.ov-desc {
  font-size: 14px;
  color: rgba(204,204,204,.65);
  line-height: 1.7;
}

/* Cards */
.ov-card {
  display: flex;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.ov-card:hover {
  background: rgba(255,255,255,.06);
  border-color: color-mix(in srgb, var(--card-color, #4ec9b0) 40%, transparent);
  transform: translateY(-2px);
}
.ov-card-accent {
  width: 4px;
  flex-shrink: 0;
}
.ov-card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.ov-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ov-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.ov-card-sub {
  font-size: 12px;
  color: rgba(204,204,204,.6);
  margin: 0;
}
.ov-card-loc {
  font-size: 12px;
  color: rgba(204,204,204,.5);
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.ov-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}
.ov-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.ov-card-cta {
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .15s;
}
.ov-card:hover .ov-card-cta { opacity: 1; }

/* Projects grid */
.ov-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Experience timeline */
.ov-exp-list { display: flex; flex-direction: column; }
.ov-exp-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.ov-exp-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  flex-shrink: 0;
  width: 18px;
}
.ov-exp-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ov-exp-connector {
  width: 2px;
  flex: 1;
  min-height: 40px;
  background: rgba(255,255,255,.1);
  margin-top: 6px;
}

/* Mobile overrides */
@media (max-width: 640px) {
  .ov-page { padding: 24px 20px 40px; }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-title { font-size: 22px; }
}
