/* ==========================================================================
   VS Code workbench. Layout is a fixed 100dvh grid; only the editor body and
   the panel scroll. Everything visual comes from themes.css tokens.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Ubuntu, Cantarell, sans-serif;
  --code-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --h-title: 35px;
  --h-status: 22px;
  --h-tabs: 35px;
  --h-crumb: 22px;
  --w-activity: 48px;
  --w-sidebar: 300px;
  --w-minimap: 78px;
  --w-dock: 46px;
  --h-panel: 240px;
  --line: 20px;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--fg);
  font-family: var(--ui-font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--fg-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--focus); outline-offset: -1px; }

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-scroll); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 999;
  background: var(--bg-widget); color: var(--fg-strong);
  padding: 8px 14px; border: 1px solid var(--focus); border-radius: 3px;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }
.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;
}

/* ---------- shell grid ---------- */
.vsc {
  display: grid;
  grid-template-rows: var(--h-title) 1fr var(--h-status);
  height: 100dvh;
}
.vsc__body {
  display: grid;
  grid-template-columns: var(--w-activity) auto 1fr;
  min-height: 0;
}
.vsc.is-sidebar-hidden .vsc__body { grid-template-columns: var(--w-activity) 0 1fr; }

/* ---------- title bar ---------- */
.titlebar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  user-select: none;
  position: relative;
}
.traffic { display: flex; gap: 8px; padding: 0 6px 0 2px; }
.traffic button {
  width: 12px; height: 12px; border-radius: 50%; display: block;
  border: none; padding: 0; cursor: pointer;
}
.traffic .tl-red { background: #ff5f57; }
.traffic .tl-amber { background: #febc2e; }
.traffic .tl-green { background: #28c840; }

.menubar { display: flex; gap: 1px; }
.menubar__item {
  padding: 4px 8px; border-radius: 4px; color: var(--fg); font-size: 12.5px;
  white-space: nowrap;
}
.menubar__item:hover, .menubar__item[aria-expanded="true"] { background: var(--bg-hover); }

.titlebar__title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--fg-muted); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}

.menu-pop {
  position: absolute; top: calc(var(--h-title) - 4px); z-index: 60;
  min-width: 240px; padding: 4px;
  background: var(--bg-widget); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
.menu-pop button {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: 100%; padding: 5px 10px; border-radius: 4px; text-align: left; font-size: 12.5px;
}
.menu-pop button:hover { background: var(--bg-active); color: var(--fg-strong); }
.menu-pop kbd {
  font-family: var(--ui-font); font-size: 11px; color: var(--fg-subtle);
}
.menu-pop hr { border: 0; border-top: 1px solid var(--border-strong); margin: 4px 2px; }

/* ---------- activity bar ---------- */
.activity {
  background: var(--bg-activity);
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0; gap: 2px;
}
.activity__spacer { flex: 1; }
.activity__btn {
  position: relative; width: 48px; height: 48px;
  display: grid; place-items: center;
  color: var(--fg-activity);
  border-left: 2px solid transparent;
}
.activity__btn:hover { color: var(--fg-activity-on); }
.activity__btn[aria-selected="true"] {
  color: var(--fg-activity-on);
  border-left-color: var(--fg-activity-on);
}
.activity__btn svg { width: 24px; height: 24px; }
.activity__badge {
  position: absolute; right: 8px; bottom: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff;
  border-radius: 8px; font-size: 9px; line-height: 16px; text-align: center;
  font-family: var(--ui-font);
}
.activity__avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border-strong);
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  width: var(--w-sidebar);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.vsc.is-sidebar-hidden .sidebar { display: none; }

/* drawer backdrop: only ever visible at the drawer breakpoint (see responsive) */
.sidebar-scrim { display: none; }

.sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px 6px 20px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 400;
}
.sidebar__view { display: none; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar__view.is-active { display: block; }

/* explorer tree */
.tree { padding-bottom: 16px; }
.tree__row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 1px 12px 1px 0;
  height: 22px; font-size: 13px; color: var(--fg);
  text-align: left; white-space: nowrap;
}
.tree__row:hover { background: var(--bg-hover); }
.tree__row.is-open { background: var(--bg-active); color: var(--fg-strong); }
.tree__row:focus-visible { outline: 1px solid var(--focus); outline-offset: -1px; }
.tree__chevron { width: 16px; flex: none; display: grid; place-items: center; color: var(--fg-muted); }
.tree__chevron svg { width: 16px; height: 16px; transition: transform .12s; transform: rotate(90deg); }
.tree__row[aria-expanded="false"] .tree__chevron svg { transform: rotate(0deg); }
.tree__icon { width: 16px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-family: var(--code-font); }
.tree__label { overflow: hidden; text-overflow: ellipsis; }
.tree__meta { margin-left: auto; font-size: 10px; color: var(--fg-subtle); padding-left: 8px; }
.tree__group > .tree__children { display: block; }
.tree__group[data-collapsed="true"] > .tree__children { display: none; }

/* search view */
.search-box { padding: 8px 12px; }
.search-input {
  width: 100%; padding: 5px 8px;
  background: var(--bg-input); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 3px;
  font-size: 13px; font-family: var(--ui-font);
}
.search-input:focus { outline: 1px solid var(--focus); border-color: var(--focus); }
.search-summary { padding: 2px 14px 8px; font-size: 11.5px; color: var(--fg-muted); }
.search-file { padding: 0 0 4px; }
.search-file__name {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 12px; font-size: 12.5px; color: var(--fg-strong);
}
.search-file__count { margin-left: auto; font-size: 10px; color: var(--fg-subtle); }
.search-hit {
  display: block; width: 100%; text-align: left;
  padding: 2px 12px 2px 34px; font-size: 12px; color: var(--fg-muted);
  font-family: var(--code-font);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-hit:hover { background: var(--bg-hover); }
.search-hit mark { background: var(--bg-select); color: var(--fg-strong); border-radius: 2px; }

/* source control */
.scm { padding: 4px 0 20px; }
.scm__commit {
  display: grid; grid-template-columns: 14px 1fr; gap: 10px;
  padding: 0 14px; position: relative;
}
.scm__graph { position: relative; }
.scm__graph::before {
  content: ""; position: absolute; left: 6px; top: 14px; bottom: -6px;
  width: 1px; background: var(--border-strong);
}
.scm__commit:last-child .scm__graph::before { display: none; }
.scm__dot {
  position: absolute; left: 2px; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-sidebar); border: 2px solid var(--fg-subtle);
}
.scm__commit.is-head .scm__dot { border-color: var(--ok); background: var(--ok); }
.scm__body { padding: 4px 0 14px; min-width: 0; }
.scm__msg { font-size: 12.5px; color: var(--fg); text-align: left; display: block; width: 100%; }
.scm__msg:hover { color: var(--fg-strong); text-decoration: underline; }
.scm__meta { font-size: 11px; color: var(--fg-subtle); font-family: var(--code-font); margin-top: 2px; }
.scm__hash { color: var(--syn-fn); }
.scm__stat { color: var(--git-add); }
.scm__tag {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  border: 1px solid var(--ok); color: var(--ok);
  border-radius: 9px; font-size: 9.5px; font-family: var(--ui-font);
}

/* extensions */
.ext { padding: 4px 0 20px; }
.ext__group { padding: 10px 14px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-muted); }
.ext__card {
  display: grid; grid-template-columns: 34px 1fr; gap: 10px;
  width: 100%; text-align: left; padding: 8px 14px;
}
.ext__card:hover { background: var(--bg-hover); }
.ext__icon {
  width: 34px; height: 34px; border-radius: 5px;
  display: grid; place-items: center;
  font-family: var(--code-font); font-weight: 700; font-size: 13px; color: #fff;
}
.ext__icon img { width: 18px; height: 18px; display: block; }
.ext__name { font-size: 12.5px; color: var(--fg-strong); font-weight: 600; }
.ext__desc { font-size: 11.5px; color: var(--fg-muted); line-height: 1.4; margin-top: 1px; }
.ext__foot { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--fg-subtle); }
.ext__pub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext__stars { color: var(--warn); letter-spacing: -1px; flex: none; }

/* run & debug */
.run { padding: 8px 14px 20px; }
.run__label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-muted); margin: 12px 0 6px; }
.run__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border-radius: 4px; font-size: 12.5px; text-align: left;
}
.run__item:hover { background: var(--bg-hover); }
.run__item svg { width: 14px; height: 14px; flex: none; color: var(--ok); }
.run__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- workbench / editor ---------- */
.workbench {
  display: grid; grid-template-rows: 1fr auto;
  min-width: 0; min-height: 0;
  background: var(--bg-editor);
}
.editor-region {
  display: grid;
  grid-template-rows: var(--h-tabs) var(--h-crumb) 1fr;
  min-height: 0; min-width: 0;
}

.tabbar {
  display: flex; align-items: stretch;
  background: var(--bg-tabbar);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { height: 0; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 0 10px 0 12px;
  background: var(--bg-tab-off); color: var(--fg-tab-off);
  border-right: 1px solid var(--border);
  font-size: 13px; white-space: nowrap; flex: none;
  max-width: 220px; position: relative;
}
.tab[aria-selected="true"] {
  background: var(--bg-tab-on); color: var(--fg-tab-on);
}
.tab[aria-selected="true"]::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: var(--focus);
}
.tab:hover { background: var(--bg-tab-on); }
.tab__icon { font-family: var(--code-font); font-size: 10px; font-weight: 700; flex: none; }
.tab__name { overflow: hidden; text-overflow: ellipsis; }
.tab__close {
  width: 18px; height: 18px; border-radius: 4px; flex: none;
  display: grid; place-items: center; opacity: 0; font-size: 14px; line-height: 1;
}
.tab:hover .tab__close, .tab[aria-selected="true"] .tab__close { opacity: .75; }
.tab__close:hover { background: var(--bg-hover); opacity: 1; }

.breadcrumb {
  display: flex; align-items: center; gap: 4px;
  padding: 0 14px; font-size: 12px; color: var(--fg-muted);
  background: var(--bg-editor);
  overflow: hidden; white-space: nowrap;
}
.breadcrumb__sep { opacity: .5; }

.editor-body {
  position: relative; display: grid; grid-template-columns: 1fr auto;
  min-height: 0; overflow: hidden;
}
.editor-scroll {
  overflow-y: auto; overflow-x: hidden; min-width: 0;
  scroll-behavior: smooth;
}
.doc { display: none; }
.doc.is-active { display: block; }

/* line-number gutter: a counter on the wrapper, not real content */
.gutter-doc { display: grid; grid-template-columns: auto 1fr; }
.gutter {
  padding: 18px 14px 60px 18px; text-align: right;
  font-family: var(--code-font); font-size: 12px; line-height: var(--line);
  color: var(--fg-subtle); user-select: none;
  border-right: 1px solid transparent;
  min-width: 56px;
}
.gutter span { display: block; }
.docbody { padding: 16px 32px 80px 20px; max-width: 100ch; min-width: 0; }

/* minimap */
.minimap {
  width: var(--w-minimap); flex: none;
  background: var(--bg-editor); border-left: 1px solid var(--border);
  padding: 6px 6px; overflow: hidden; position: relative;
  cursor: pointer;
}
.minimap__inner { display: flex; flex-direction: column; gap: 2px; }
.minimap__line { height: 2px; border-radius: 1px; background: var(--fg-subtle); opacity: .34; }
.minimap__line.is-head { background: var(--syn-head); opacity: .8; height: 3px; }
.minimap__line.is-code { background: var(--syn-str); opacity: .5; }
.minimap__view {
  position: absolute; left: 0; right: 0;
  background: var(--fg); opacity: .09; pointer-events: none;
  border-radius: 2px;
}
.vsc.is-minimap-hidden .minimap { display: none; }

/* ---------- panel ---------- */
.panel {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  display: grid; grid-template-rows: 30px 1fr;
  height: var(--h-panel);
  min-height: 0;
}
.vsc.is-panel-hidden .panel { display: none; }
.panel__resize {
  position: absolute; left: 0; right: 0; top: -3px; height: 6px;
  cursor: ns-resize; z-index: 5;
}
.panel__head {
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px; border-bottom: 1px solid var(--border);
  position: relative;
}
.panel__tab {
  padding: 6px 9px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-muted); border-bottom: 1px solid transparent;
}
.panel__tab[aria-selected="true"] { color: var(--fg-strong); border-bottom-color: var(--fg); }
.panel__actions { margin-left: auto; display: flex; gap: 2px; }
.panel__action { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--fg-muted); }
.panel__action:hover { background: var(--bg-hover); color: var(--fg); }
.panel__body { overflow: auto; padding: 6px 12px 12px; font-family: var(--code-font); font-size: 12.5px; line-height: 1.55; }
.panel__pane { display: none; }
.panel__pane.is-active { display: block; }

.term__line { white-space: pre-wrap; word-break: break-word; }
.term__line a { text-decoration: underline; }
.term__prompt-user { color: var(--syn-type); }
.term__prompt-path { color: var(--syn-key); }
.term__prompt-mark { color: var(--fg-muted); }
.term__err { color: var(--git-del); }
.term__ok { color: var(--ok); }
.term__dim { color: var(--fg-subtle); }
.term__key { color: var(--syn-fn); }
.term__row { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.term__input {
  flex: 1; min-width: 120px;
  background: none; border: 0; outline: 0; padding: 0;
  color: var(--fg); font-family: var(--code-font); font-size: 12.5px;
  caret-color: var(--fg);
}
.term__ascii { color: var(--syn-key); }

.problems-empty { color: var(--fg-muted); padding: 8px 2px; font-family: var(--ui-font); }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-status); color: var(--fg-status);
  font-size: 12px; padding: 0 2px; user-select: none;
  overflow: hidden;
}
.statusbar__item {
  display: flex; align-items: center; gap: 5px;
  padding: 0 8px; height: var(--h-status); white-space: nowrap;
}
button.statusbar__item:hover { background: rgba(255,255,255,.16); }
.statusbar__spacer { flex: 1; }
.statusbar__remote {
  background: rgba(0,0,0,.22); padding: 0 10px; height: var(--h-status);
  display: flex; align-items: center; gap: 6px;
  flex: none; white-space: nowrap;
}
.statusbar svg { width: 13px; height: 13px; }
@media (max-width: 1100px) { .statusbar__item.is-optional { display: none; } }

/* ---------- overlays: command palette ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.22);
  display: none;
}
.overlay.is-open { display: block; }
.palette {
  width: min(620px, 92vw); margin: 60px auto 0;
  background: var(--bg-widget); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 6px;
  box-shadow: 0 12px 44px rgba(0,0,0,.5);
  overflow: hidden;
}
.palette__input {
  width: 100%; padding: 9px 12px;
  background: var(--bg-input); color: var(--fg);
  border: 1px solid var(--focus); border-radius: 4px;
  margin: 8px; width: calc(100% - 16px);
  font-size: 13px; font-family: var(--ui-font);
}
.palette__input:focus { outline: none; }
.palette__list { max-height: 46vh; overflow-y: auto; padding: 0 4px 6px; }
.palette__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 10px; border-radius: 4px; text-align: left; font-size: 13px;
}
.palette__item[aria-selected="true"] { background: var(--bg-active); color: var(--fg-strong); }
.palette__item mark { background: none; color: var(--fg-link); font-weight: 700; }
.palette__icon { font-family: var(--code-font); font-size: 10px; font-weight: 700; width: 14px; flex: none; }
.palette__desc { margin-left: auto; font-size: 11px; color: var(--fg-subtle); padding-left: 14px; white-space: nowrap; }
.palette__empty { padding: 14px 12px; color: var(--fg-muted); font-size: 12.5px; }

.toast {
  position: fixed; right: 16px; bottom: 40px; z-index: 120;
  background: var(--bg-widget); color: var(--fg);
  border: 1px solid var(--border-strong); border-left: 3px solid var(--focus);
  border-radius: 4px; padding: 10px 14px; font-size: 12.5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .18s, transform .18s;
  max-width: min(360px, 84vw);
}
.toast.is-on { opacity: 1; transform: none; }

/* ==========================================================================
   Document content
   ========================================================================== */
.docbody { font-size: 13.5px; line-height: 1.68; color: var(--fg); }
.docbody > *:first-child { margin-top: 0; }
.docbody h1, .docbody h2, .docbody h3, .docbody h4 {
  color: var(--fg-strong); line-height: 1.3; font-weight: 600;
}
.docbody h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
.docbody h2 {
  font-size: 17px; margin: 30px 0 10px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border-strong);
}
.docbody h3 { font-size: 14.5px; margin: 20px 0 6px; }
.docbody h4 { font-size: 13.5px; margin: 16px 0 4px; color: var(--fg); }
.docbody p { margin: 0 0 12px; }
.docbody ul, .docbody ol { margin: 0 0 12px; padding-left: 22px; }
.docbody li { margin-bottom: 5px; }
.docbody li::marker { color: var(--fg-subtle); }
.docbody strong { color: var(--fg-strong); font-weight: 600; }
.docbody em { color: var(--fg); }
.docbody hr { border: 0; border-top: 1px solid var(--border-strong); margin: 26px 0; }
.docbody blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-strong); color: var(--fg-muted);
}
.docbody img { max-width: 100%; height: auto; }
/* Diagrams carry role="img" and scale; UI glyphs are aria-hidden and must not.
   A viewBox-only <svg> has no intrinsic size, so without this it fills the page. */
.docbody svg[role="img"] { max-width: 100%; height: auto; }
.docbody svg[aria-hidden="true"] {
  width: 13px; height: 13px; vertical-align: -2px; flex: none;
}
.docbody .btn svg[aria-hidden="true"],
.docbody .welcome__link svg[aria-hidden="true"] { width: 14px; height: 14px; }
.docbody code {
  font-family: var(--code-font); font-size: .89em;
  background: var(--bg-code); color: var(--syn-str);
  padding: 1.5px 5px; border-radius: 3px;
  border: 1px solid var(--border);
}
.docbody pre {
  background: var(--bg-code); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 12px 14px; margin: 0 0 14px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.55;
}
.docbody pre code { background: none; border: 0; padding: 0; color: var(--fg); font-size: inherit; }
.docbody table {
  width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 12.5px;
  display: block; overflow-x: auto;
}
.docbody th, .docbody td { border: 1px solid var(--border-strong); padding: 6px 10px; text-align: left; }
.docbody th { background: var(--bg-sidebar); color: var(--fg-strong); font-weight: 600; }

/* syntax tokens */
.t-key { color: var(--syn-key); }
.t-key2 { color: var(--syn-key2); }
.t-str { color: var(--syn-str); }
.t-num { color: var(--syn-num); }
.t-com { color: var(--syn-com); font-style: italic; }
.t-fn  { color: var(--syn-fn); }
.t-type{ color: var(--syn-type); }
.t-var { color: var(--syn-var); }
.t-op  { color: var(--syn-op); }
.t-punc{ color: var(--fg-muted); }

/* doc header block shared by every document */
.dochead { margin-bottom: 22px; }
.dochead__kicker {
  font-family: var(--code-font); font-size: 11.5px; color: var(--syn-com);
  margin-bottom: 6px;
}
.docbody .dochead__title, .dochead__title {
  font-size: 25px; margin: 0 0 6px; padding: 0; border: 0;
  color: var(--fg-strong); font-weight: 600; letter-spacing: -.015em;
}
.dochead__sub { color: var(--fg-muted); margin: 0; font-size: 13.5px; }

/* chips / tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip {
  font-family: var(--code-font); font-size: 11px;
  padding: 2.5px 8px; border-radius: 11px;
  background: var(--bg-code); border: 1px solid var(--border-strong); color: var(--fg-muted);
}
.chip.is-on { border-color: var(--focus); color: var(--fg-link); }

/* action buttons */
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 3px; font-size: 12.5px;
  background: var(--accent); color: #fff; border: 1px solid transparent;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--fg-strong); }
.btn svg { width: 14px; height: 14px; }

/* ---------- welcome ---------- */
.welcome { padding: 40px 32px 80px; max-width: 1080px; }
.docbody .welcome__brand, .welcome__brand {
  font-size: 40px; font-weight: 200; letter-spacing: -.02em;
  color: var(--fg-strong); margin: 0; padding: 0; border: 0; line-height: 1.1;
}
.welcome__brand b { font-weight: 600; }
.welcome__role { font-size: 17px; color: var(--fg-muted); margin: 8px 0 0; font-weight: 300; }
.welcome__pitch { font-size: 14.5px; line-height: 1.7; color: var(--fg); margin: 20px 0 0; max-width: 62ch; }
.welcome__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 34px; margin-top: 38px;
}
.docbody .welcome__h {
  font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--fg-muted); margin: 0 0 12px; font-weight: 500;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.welcome__link {
  display: flex; align-items: baseline; gap: 9px; width: 100%;
  padding: 4px 0; font-size: 13.5px; color: var(--fg-link); text-align: left;
}
.welcome__link:hover { text-decoration: underline; }
.welcome__link svg { width: 14px; height: 14px; flex: none; transform: translateY(2px); }
.welcome__link small { color: var(--fg-subtle); font-size: 11.5px; margin-left: auto; padding-left: 10px; }
.welcome__recent { padding: 4px 0; font-size: 13px; }
.welcome__recent b { display: block; color: var(--fg-strong); font-weight: 500; }
.welcome__recent span { color: var(--fg-subtle); font-size: 11.5px; }
.welcome__hint {
  margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--fg-muted);
}
.welcome__hint kbd {
  font-family: var(--code-font); font-size: 11px;
  background: var(--bg-code); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; color: var(--fg);
}

/* ---------- entries (experience / education) ---------- */
.entry { margin: 0 0 30px; padding-left: 18px; border-left: 2px solid var(--border-strong); }
.entry.is-current { border-left-color: var(--ok); }
.entry__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.docbody .entry__role, .entry__role {
  font-size: 15.5px; color: var(--fg-strong); font-weight: 600;
  margin: 0; padding: 0; border: 0;
}
.entry__when {
  font-family: var(--code-font); font-size: 11.5px; color: var(--fg-subtle);
  margin-left: auto; white-space: nowrap;
}
.entry__org { color: var(--syn-type); font-size: 13.5px; margin: 3px 0 0; }
.entry__where { color: var(--fg-subtle); font-size: 12px; margin: 2px 0 10px; }
.entry__sum { color: var(--fg-muted); font-style: italic; margin: 0 0 12px; }
.entry__hl { margin: 0 0 10px; }
.entry__hl b { color: var(--fg-strong); display: block; font-size: 13px; margin-bottom: 2px; }
.entry__hl p { margin: 0; color: var(--fg); }
.entry__note {
  font-size: 11.5px; color: var(--fg-subtle);
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
}
.badge-now {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ok); border: 1px solid var(--ok); border-radius: 9px; padding: 0 6px;
}

/* ---------- project ---------- */
.proj__art {
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-code); padding: 10px; margin: 4px 0 20px;
  overflow: hidden;
}
.proj__art svg { display: block; width: 100%; height: auto; }
.proj__meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--fg-subtle); margin: 0 0 14px; font-family: var(--code-font); }

/* card grid used by projects/blog index */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; margin: 18px 0 0; }
.card {
  display: block; text-align: left; width: 100%;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-sidebar); overflow: hidden;
  transition: border-color .14s, transform .14s;
}
.card:hover { border-color: var(--focus); transform: translateY(-2px); text-decoration: none; }
.card__art { background: var(--bg-code); border-bottom: 1px solid var(--border); }
.card__art svg { display: block; width: 100%; height: auto; }
.card__body { padding: 11px 13px 13px; }
.card__title { font-size: 13.5px; color: var(--fg-strong); font-weight: 600; margin: 0 0 4px; }
.card__desc { font-size: 12.5px; color: var(--fg-muted); line-height: 1.5; margin: 0; }
.card__foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11px; color: var(--fg-subtle); font-family: var(--code-font); }
.card__star { color: var(--warn); }

/* contact list */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 18px; font-size: 13.5px; }
.kv dt { color: var(--fg-subtle); font-family: var(--code-font); font-size: 12px; }
.kv dd { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --w-sidebar: 260px; --w-minimap: 0px; }
  .minimap { display: none; }
  .docbody { padding: 14px 18px 70px 14px; }
  .gutter { display: none; }
  .gutter-doc { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --h-title: 32px; --h-panel: 200px; }

  /* single column: the workbench fills the space, the activity bar docks
     under it. Both rows are explicit so the editor keeps its own scroll
     instead of stretching the shell past the viewport. */
  .vsc__body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) var(--w-dock);
    position: relative;
  }
  .vsc.is-sidebar-hidden .vsc__body { grid-template-columns: 1fr; }
  .workbench { grid-row: 1; grid-column: 1; }

  /* activity bar becomes a bottom dock */
  .activity {
    grid-row: 2; grid-column: 1;
    flex-direction: row; justify-content: space-around;
    width: 100%; height: var(--w-dock); padding: 0;
    border-top: 1px solid var(--border);
  }
  .activity__spacer { display: none; }
  .activity__btn { width: auto; flex: 1; height: var(--w-dock); border-left: 0; border-top: 2px solid transparent; }
  .activity__btn[aria-selected="true"] { border-left-color: transparent; border-top-color: var(--fg-activity-on); }

  /* sidebar becomes an overlay drawer, stopping above the dock */
  .sidebar {
    position: absolute; inset: 0 auto var(--w-dock) 0; z-index: 40;
    width: min(320px, 86vw);
    box-shadow: 6px 0 26px rgba(0,0,0,.4);
    transition: transform .18s ease, visibility 0s linear .18s;
  }
  /* display stays flex in both states so the slide can animate */
  .vsc.is-sidebar-hidden .sidebar {
    display: flex; transform: translateX(-102%); visibility: hidden;
  }
  .vsc:not(.is-sidebar-hidden) .sidebar {
    display: flex; transform: none; visibility: visible;
    transition: transform .18s ease;
  }

  .sidebar-scrim {
    display: block;
    position: absolute; inset: 0 0 var(--w-dock) 0; z-index: 39;
    background: rgba(0,0,0,.45);
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
  }
  .vsc:not(.is-sidebar-hidden) .sidebar-scrim { opacity: 1; pointer-events: auto; }

  .menubar, .titlebar__title { display: none; }
  .welcome { padding: 26px 18px 60px; }
  .welcome__brand { font-size: 30px; }
  .welcome__grid { gap: 24px; margin-top: 28px; }
  .tab { max-width: 160px; }
}

@media (max-width: 480px) {
  :root { --h-panel: 176px; }
  .welcome__brand { font-size: 25px; }
  .welcome__role { font-size: 14.5px; }
  .docbody { padding: 12px 14px 60px 12px; }
  .dochead__title { font-size: 20px; }
  .cards { grid-template-columns: 1fr; }
  .entry__when { margin-left: 0; width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- no-JS fallback: unwrap the IDE into a plain document ---------- */
.no-js .vsc { display: block; height: auto; }
html.no-js, html.no-js body { overflow: auto; height: auto; }
.no-js .titlebar { position: static; height: auto; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.no-js .titlebar__title { position: static; transform: none; max-width: none; font-size: 14px; color: var(--fg-strong); }
.no-js .activity, .no-js .minimap, .no-js .panel,
.no-js .tabbar, .no-js .breadcrumb, .no-js .statusbar,
.no-js .menubar, .no-js .traffic, .no-js .gutter,
.no-js .sidebar-scrim { display: none !important; }
.no-js .vsc__body { display: block; }
.no-js .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
.no-js .sidebar__view { display: block !important; }
.no-js .editor-body, .no-js .editor-region { display: block; }
.no-js .editor-scroll { overflow: visible; }
.no-js .doc { display: block !important; border-bottom: 1px solid var(--border); padding-bottom: 28px; margin-bottom: 28px; }
.no-js .docbody { max-width: 80ch; padding: 20px; }
.no-js .gutter-doc { display: block; }

@media print {
  .activity, .sidebar, .panel, .statusbar, .titlebar, .tabbar, .minimap, .breadcrumb, .gutter,
  .sidebar-scrim { display: none !important; }
  html, body, .vsc, .editor-scroll { height: auto; overflow: visible; background: #fff; color: #000; }
  .doc { display: block !important; page-break-after: always; }
}
