/* zachlove.com: tiling-WM desktop.
   tokens → base → bar → desktop/windows → workspaces → terminal → mobile → motion */

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

:root,
[data-theme="gruvbox"] {
  --wall: #1b1d1e;
  --bar: #252525;
  --surface: #282828;
  --titlebar: #232323;
  --card: #32302f;
  --term-bg: #242424;
  --border: #3c3836;
  --border-strong: #504945;
  --fg: #ebdbb2;
  --fg-bright: #fbf1c7;
  --fg-muted: #a89984;
  --fg-dim: #665c54;
  --accent: #fe8019;
  --on-accent: #1d2021;
  --yellow: #fabd2f;
  --green: #b8bb26;
  --blue: #83a598;
  --purple: #d3869b;
  --orange: #e78a4e;
  --red: #fc6a55;
  --hl: rgb(254 128 25 / 0.1);
}

[data-theme="nord"] {
  --wall: #242933;
  --bar: #2b303b;
  --surface: #2e3440;
  --titlebar: #292e39;
  --card: #353c4a;
  --term-bg: #292e38;
  --border: #3b4252;
  --border-strong: #4c566a;
  --fg: #d8dee9;
  --fg-bright: #eceff4;
  --fg-muted: #a3adc0;
  --fg-dim: #616e88;
  --accent: #88c0d0;
  --on-accent: #242933;
  --yellow: #ebcb8b;
  --green: #a3be8c;
  --blue: #8fb0cf;
  --purple: #c4a3bf;
  --orange: #dc9a85;
  --red: #e0969d;
  --hl: rgb(136 192 208 / 0.1);
}

[data-theme="catppuccin"] {
  --wall: #11111b;
  --bar: #181825;
  --surface: #1e1e2e;
  --titlebar: #181825;
  --card: #26263a;
  --term-bg: #1b1b29;
  --border: #313244;
  --border-strong: #45475a;
  --fg: #bac2de;
  --fg-bright: #cdd6f4;
  --fg-muted: #9399b2;
  --fg-dim: #585b70;
  --accent: #cba6f7;
  --on-accent: #1e1e2e;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --blue: #89b4fa;
  --purple: #f5c2e7;
  --orange: #fab387;
  --red: #f38ba8;
  --hl: rgb(203 166 247 / 0.1);
}

:root {
  color-scheme: dark;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gap: 10px;
  --radius: 8px;
  --radius-sm: 5px;
  --line: 24px;
  --shadow: 0 12px 32px -14px rgb(0 0 0 / 0.55);
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font: 400 14px/1.6 var(--mono);
  color: var(--fg);
  background-color: var(--wall);
  background-image:
    radial-gradient(ellipse 70% 60% at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 60% at 0% 100%, color-mix(in srgb, var(--purple) 8%, transparent), transparent 70%),
    radial-gradient(color-mix(in srgb, var(--fg) 7%, transparent) 1px, transparent 1.5px);
  background-size: auto, auto, 24px 24px;
  background-attachment: fixed;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--fg-bright); }
p { margin: 0; }
kbd {
  font: 600 11px/1 var(--mono);
  padding: 2px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--fg);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.win-body:focus-visible { outline-offset: -3px; border-radius: 0 0 var(--radius) var(--radius); }
.stage:focus, .ln-h:focus { outline: none; }

.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;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 700;
}
.skip:focus { top: 12px; }

.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.c-accent { color: var(--accent); }
.c-yellow { color: var(--yellow); }
.c-green { color: var(--green); }
.c-blue { color: var(--blue); }
.c-purple { color: var(--purple); }
.c-red { color: var(--red); }
.c-bright { color: var(--fg-bright); }

.prose { font-family: var(--sans); font-size: 15px; line-height: 1.65; color: var(--fg); }

/* ---------------------------------------------------------------- bar */

.bar {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--gap) var(--gap) 0;
  padding: 5px 6px;
  background: var(--bar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font: 500 12px/1 var(--mono);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
}
button.pill { cursor: pointer; }
button.pill:hover { border-color: var(--border-strong); color: var(--fg-bright); }
#term-btn.is-on { color: var(--accent); }

.logo {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--on-accent); filter: brightness(1.08); }

.ws-nav { gap: 2px; padding: 0 3px; }
.ws-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--fg-muted);
  text-decoration: none;
}
.ws-nav a:hover { color: var(--fg-bright); background: var(--hl); }
.ws-nav a[aria-current] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.ws-num { opacity: 0.75; }
.ws-nav a[aria-current] .ws-num { opacity: 1; }

.bar-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-right { display: flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.pill-clock { color: var(--fg-bright); font-weight: 600; font-variant-numeric: tabular-nums; }

@media (min-width: 900px) and (max-width: 1099px) {
  .ws-nav a:not([aria-current]) .ws-label, .pill-loc { display: none; }
}

/* ---------------------------------------------------------------- desktop + windows */

@media (min-width: 900px) {
  body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
}

.desktop {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 30vw, 440px);
  gap: var(--gap);
  padding: var(--gap);
}
.desktop.no-term { grid-template-columns: minmax(0, 1fr); }
/* Stage scrolls only when a workspace's minimum tile heights exceed a short viewport.
   The 2px padding keeps the active-window ring from being clipped. */
.stage { min-width: 0; min-height: 0; container-type: inline-size; overflow: hidden auto; padding: 2px; margin: -2px; }

.ws { height: 100%; min-height: 0; display: grid; gap: var(--gap); grid-template-rows: minmax(0, 1fr); }
.ws-about { grid-template-rows: max-content minmax(300px, 1fr); }
.ws-experience { grid-template-rows: max-content minmax(260px, 1fr); }
.ws-contact { grid-template-rows: minmax(200px, 1fr) auto; }

.side { min-width: 0; min-height: 0; display: grid; gap: var(--gap); grid-template-rows: minmax(0, 1fr) auto; }
@media (max-height: 700px) {
  .side > .widget { display: none; }
}

.win {
  --app: var(--accent);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.win.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow);
}

.win-title {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 14px;
  background: var(--titlebar);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-muted);
}
.win-title h2 {
  margin: 0;
  font: 600 12px/1 var(--mono);
  color: var(--fg-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-title h2 .muted { font-weight: 400; }
.win-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--app); }
.win-meta { margin-left: auto; white-space: nowrap; font-size: 11px; }

.win-body { flex: 1; min-height: 0; overflow: auto; padding: 22px 26px; }

.win-body { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.win-body::-webkit-scrollbar { width: 6px; height: 6px; }
.win-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.statusline {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 24px;
  padding-right: 12px;
  background: var(--titlebar);
  border-top: 1px solid var(--border);
  font: 600 11px/1 var(--mono);
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
}
.sl-mode {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--app);
  color: var(--on-accent);
  letter-spacing: 0.05em;
}
.sl-file { color: var(--fg); }
.sl-right { margin-left: auto; font-weight: 400; }

/* shared bits */

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: 12px;
  line-height: 1.4;
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg-bright);
  font: 600 13px/1 var(--mono);
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.08); }

.md h3 { margin: 26px 0 12px; font: 700 13px/1.3 var(--mono); color: var(--fg-bright); }
.md h3:first-child { margin-top: 0; }
.md-mark { color: var(--accent); opacity: 0.75; }
.lead p { margin-bottom: 10px; max-width: 74ch; }
.lead p:first-child { color: var(--fg-bright); font-size: 16px; }

/* ---------------------------------------------------------------- 1 about: neofetch */

.nf { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 36px; }
.nf-art { margin: 0; font: 700 11px/1 var(--mono); color: var(--accent); } /* 36x16 grid from main.js */
.nf-info { flex: 1; min-width: min(100%, 280px); }
.nf-user { font-size: 13px; }
.nf-name {
  margin: 4px 0 6px;
  font: 800 clamp(28px, 3vw, 38px)/1.1 var(--mono);
  letter-spacing: -0.03em;
  color: var(--fg-bright);
}
.nf-role { color: var(--yellow); font-size: 14px; }
.nf-rule { max-width: 560px; margin: 14px 0; border-top: 1px dashed var(--border-strong); }
.nf-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 16px; margin: 0; font-size: 13px; }
.nf-kv dt { color: var(--accent); font-weight: 600; }
.nf-kv dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 1280px) {
  .nf:not(.nf-sm) .nf-kv { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); column-gap: 16px; }
}
.swatches { display: flex; gap: 4px; margin-top: 16px; }
.swatches span { width: 22px; height: 10px; border-radius: 2px; }

.nf-sm { gap: 12px 20px; margin: 4px 0 6px; }
.nf-sm .nf-art { font-size: 7px; }
.nf-sm .nf-kv { font-size: 12px; gap: 0 12px; }
.nf-sm .nf-rule { margin: 6px 0; }
.nf-sm .swatches { margin-top: 8px; }

/* ---------------------------------------------------------------- 2 experience */

.glog-body { padding: 10px 12px; }
.glog { list-style: none; margin: 0; padding: 0; }
.glog li { position: relative; }
.glog li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  bottom: -14px;
  border-left: 2px solid var(--border-strong);
}
.glog-row {
  width: 100%;
  display: grid;
  grid-template-columns: 14px 12ch max-content minmax(0, 1fr);
  align-items: center;
  gap: 4px 14px;
  padding: 6px 12px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: inherit;
  font: 13px/1.5 var(--mono);
  text-align: left;
  cursor: pointer;
}
.glog-row:hover { background: var(--hl); }
.glog-node {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 10px;
  height: 10px;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  background: var(--surface);
}
.glog-node.is-head { background: var(--yellow); }
.glog-date { color: var(--yellow); }
.glog-title { color: var(--fg-bright); font-weight: 600; }
.glog-org { color: var(--fg-muted); }

.buf { counter-reset: ln; font: 13px/var(--line) var(--mono); }
.ln {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  column-gap: 20px;
  margin: 0;
  font: inherit;
}
.ln::before {
  counter-increment: ln;
  content: counter(ln);
  text-align: right;
  color: var(--fg-dim);
  font: 400 12px/var(--line) var(--mono);
}
.ln-list { list-style: none; margin: 0; padding: 0; }
.ln-h { font-size: 15px; font-weight: 700; color: var(--fg-bright); scroll-margin-top: 12px; }
.ln-meta { font-size: 12.5px; }
.ln-b .prose { position: relative; display: block; padding-left: 20px; font-size: 14.5px; line-height: var(--line); max-width: 92ch; }
.ln-b .prose::before { content: "-"; position: absolute; left: 3px; color: var(--accent); font-family: var(--mono); }
.ln-b strong { color: var(--fg-bright); font-weight: 600; }
.ln-kv { white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-kv a { text-decoration: none; }
.ln-kv a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 3 skills: btop */

.btop-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0 0 26px;
  font-size: 12px;
  color: var(--fg-muted);
}
.btop-head b { color: var(--fg-bright); }
.btop-mode { margin-left: auto; }
#win-btop .win-body { display: flex; flex-direction: column; }
.btop { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(min-content, 1fr); gap: 26px 14px; }
@container (min-width: 560px) {
  .btop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .box:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@container (min-width: 820px) {
  .btop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .box:last-child:nth-child(odd) { grid-column: auto; }
  .box:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
  .box:last-child:nth-child(3n + 2) { grid-column: span 2; }
}
.box {
  position: relative;
  padding: 20px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--border));
  border-radius: var(--radius-sm);
}
.box h3, .box-count {
  position: absolute;
  top: -11px;
  margin: 0;
  padding: 0 6px;
  background: var(--surface);
  font: 700 12px/20px var(--mono);
}
.box h3 { left: 10px; color: var(--c); }
.box h3 sup { margin-right: 2px; font-size: 9px; color: var(--fg-muted); }
.box-count { right: 10px; font-weight: 400; color: var(--fg-muted); }
.box .chips li { border-left: 2px solid var(--c); }

/* ---------------------------------------------------------------- 4 highlights */

.p-arrow { color: var(--green); }
.yz-body { padding: 0; }
.yz { display: grid; grid-template-columns: minmax(200px, 30%) minmax(0, 1fr); min-height: 100%; }
.yz-list { padding: 14px 10px; border-right: 1px solid var(--border); background: var(--titlebar); }
.yz-head { margin: 0 8px 10px; font-size: 12px; }
.yz-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.yz-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: 13px/1.4 var(--mono);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.yz-item:hover { background: var(--hl); color: var(--fg-bright); }
.yz-item[aria-current] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.yz-icon { flex: none; opacity: 0.8; }
.yz-name { min-width: 0; }
.yz-dir { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 4px 10px; font: 600 12px/1.4 var(--mono); color: var(--blue); }
.yz-dir:first-child { margin-top: 0; }
.yz-dir ~ li .yz-item:not(.yz-link) { padding-left: 26px; }
.yz-size { margin-left: auto; font-weight: 400; color: var(--fg-dim); white-space: nowrap; }
.yz-link { margin-top: 10px; }

.yz-pane { display: flex; flex-direction: column; padding: clamp(28px, 6vh, 64px) 36px 24px; }
.yz-preview { flex: 1; display: flex; flex-direction: column; max-width: 72ch; }
.yz-preview[hidden] { display: none; }
.file-ls { margin-bottom: 16px; font-size: 12px; overflow-wrap: anywhere; }
.yz-preview h3 { margin: 0 0 8px; font: 800 clamp(22px, 2.4vw, 30px)/1.2 var(--mono); letter-spacing: -0.02em; color: var(--fg-bright); text-wrap: balance; }
.yz-hook { margin: 0 0 10px; font-size: 16.5px; line-height: 1.55; color: var(--accent); text-wrap: pretty; }
.yz-role { margin: 0 0 22px; font-size: 12.5px; }
.yz-stats { display: flex; flex-wrap: wrap; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
.yz-stats div { flex: 1 1 110px; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; padding: 12px 16px; }
.yz-stats div + div { border-left: 1px solid var(--border); }
.yz-stats dt { font-size: 11.5px; color: var(--fg-muted); }
.yz-stats dd { margin: 0; white-space: nowrap; font: 800 24px/1.1 var(--mono); color: var(--yellow); letter-spacing: -0.02em; }
.yz-preview h4 { margin: 0 0 8px; font: 700 12.5px/1.4 var(--mono); color: var(--fg-bright); }
.yz-preview h4 span { color: var(--purple); }
.yz-points { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 6px; }
.yz-points li { position: relative; padding-left: 20px; font-size: 14.5px; line-height: 1.55; }
.yz-points li::before { content: "-"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.yz-preview .chips { margin-bottom: 22px; }
.yz-preview .chips li { font-size: 11.5px; padding: 3px 9px; }
.yz-preview .tags { margin: auto 0 0; padding-top: 12px; border-top: 1px dashed var(--border-strong); font-size: 12px; color: var(--fg-muted); }

/* ---------------------------------------------------------------- 5 contact */

.toml-body { display: flex; flex-direction: column; }
.tildes {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font: 13px/var(--line) var(--mono);
  color: var(--fg-dim);
}
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
#win-links .win-body { padding: 14px; }
.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "k go" "v go";
  row-gap: 4px;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-bright);
  font-size: 14px;
  text-decoration: none;
}
.link-row:hover { border-color: var(--accent); color: var(--fg-bright); }
.link-k { grid-area: k; font-size: 12px; font-weight: 700; }
.link-v { grid-area: v; overflow-wrap: anywhere; }
.link-go { grid-area: go; color: var(--fg-muted); }
.link-row:hover .link-go { color: var(--accent); }

/* ---------------------------------------------------------------- widget: cal + binds */

.widget { --app: var(--yellow); }
.widget-body { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 16px 24px; padding: 14px 16px; font-size: 12px; }
.cal-head { margin-bottom: 6px; text-align: center; font-weight: 700; color: var(--fg-bright); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 24px); gap: 2px; text-align: center; line-height: 22px; font-variant-numeric: tabular-nums; }
.cal-grid b { font-weight: 600; color: var(--yellow); }
.cal-grid .today { background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: 3px; }
.binds { list-style: none; margin: 0; padding: 0; line-height: 22px; white-space: nowrap; }
.binds::before { content: "# binds.conf"; display: block; margin-bottom: 6px; color: var(--fg-muted); }

/* ---------------------------------------------------------------- terminal */

.term { --app: var(--green); }
.term-body {
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
  background: var(--term-bg);
  font: 13px/1.6 var(--mono);
  cursor: text;
}
.t-out { margin-bottom: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-out .nf, .t-grid { white-space: normal; }
.t-cmd { margin-top: 10px; color: var(--fg-bright); }
.t-out:first-child { margin-top: 0; }
.t-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 16px; margin: 2px 0 8px; }
.t-chip {
  padding: 0 6px;
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.t-chip:hover { border-color: var(--accent); }
.term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px -6px 0;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.term-line:focus-within { background: var(--hl); outline: 1px solid var(--accent); }
.prompt { flex: none; white-space: nowrap; }
.p-user { color: var(--accent); font-weight: 600; }
.p-dir { color: var(--blue); }
#term-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg-bright);
  font: inherit;
  caret-color: var(--accent);
}

/* ---------------------------------------------------------------- palette (ctrl/⌘+k) */

.palette {
  --app: var(--purple);
  width: min(440px, calc(100% - 32px));
  margin: 18vh auto auto;
  padding: 0;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow);
  font: 13px/1.6 var(--mono);
}
.palette::backdrop { background: rgb(0 0 0 / 0.5); }
#palette-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: var(--term-bg);
  border: 0;
  border-bottom: 1px solid var(--border);
  outline: none; /* focus is always here while open; the accent frame marks it */
  color: var(--fg-bright);
  font: inherit;
  caret-color: var(--accent);
}
#palette-input::placeholder { color: var(--fg-muted); }
.pal-list { list-style: none; margin: 0; padding: 6px; }
.pal-list li { display: flex; gap: 12px; padding: 5px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.pal-list li:hover { background: var(--hl); }
.pal-n { color: var(--fg-muted); }
.pal-list [aria-selected="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.pal-list [aria-selected="true"] .pal-n { color: inherit; }

/* ---------------------------------------------------------------- mobile: stacked, page scrolls */

@media (max-width: 899px) {
  :root { --gap: 12px; }
  .bar {
    position: sticky;
    top: 0;
    flex-wrap: wrap;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-width: 0 0 1px;
    border-radius: 0;
  }
  .bar-title, .pill-loc, #theme-btn .pill-text { display: none; }
  .bar-right { margin-left: auto; }
  .ws-nav { order: 3; flex-basis: 100%; min-width: 0; height: 34px; justify-content: space-between; }
  .ws-nav a { flex: 1 1 auto; min-width: 0; justify-content: center; height: 26px; padding: 0 4px; font-size: 11.5px; }
  .ws-num { display: none; }

  .desktop { display: flex; flex-direction: column; }
  .stage { overflow: visible; container-type: normal; }
  .ws { height: auto; display: flex; flex-direction: column; }
  .side { display: block; }
  .side > .widget { display: none; }
  .win-body { overflow: visible; padding: 18px 16px; }
  .term { height: 70dvh; }
  .term .win-body { overflow: auto; }
  .tildes, .win-meta { display: none; }
  #term-input { font-size: 16px; } /* stops iOS zoom on focus */

  .ln { column-gap: 12px; grid-template-columns: 2ch minmax(0, 1fr); }
  .ln-b .prose { font-size: 14px; }
  .glog-row { grid-template-columns: 14px minmax(0, 1fr); gap: 0 12px; }
  .glog-date, .glog-title, .glog-org { grid-column: 2; }
  .glog li:not(:last-child)::after { top: 22px; bottom: -22px; }
  .yz { grid-template-columns: minmax(0, 1fr); }
  .yz-list { border-right: 0; border-bottom: 1px solid var(--border); }
  .yz-pane { padding: 20px 16px; }
  .yz-stats div { flex-basis: 70px; padding: 10px 12px; }
  .yz-stats dd { font-size: 20px; }
  .btop-mode { display: none; }
  .link-row { padding: 14px; }
}

@media (max-width: 360px) {
  .ws-nav a { padding: 0 2px; font-size: 10.5px; }
  .yz-stats div { padding: 10px 8px; }
  .yz-stats dd { font-size: 17px; }
}

@media (max-width: 420px) {
  .nf { gap: 14px; }
  .nf-art { font-size: 10px; }
}

/* ---------------------------------------------------------------- motion (opt-in) */

@media (prefers-reduced-motion: no-preference) {
  .win { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
  .pill, .btn, .yz-item, .link-row, .ws-nav a, .glog-row, .t-chip { transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
  .ws.enter { animation: ws-in 0.18s cubic-bezier(0.2, 0.7, 0.2, 1); }
  @keyframes ws-in {
    from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 14px)); }
  }
  .yz-preview:not([hidden]) { animation: yz-in 0.16s ease-out; }
  @keyframes yz-in {
    from { opacity: 0; transform: translateY(4px); }
  }
  .palette[open] { animation: pal-in 0.14s cubic-bezier(0.2, 0.7, 0.2, 1); }
  @keyframes pal-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  }
}

/* ---------------------------------------------------------------- no-js fallback */

.nojs { max-width: 760px; margin: 0 auto; padding: 40px 20px; font-family: var(--sans); line-height: 1.6; }
.nojs h1, .nojs h2 { font-family: var(--mono); color: var(--fg-bright); }
.nojs h3 { color: var(--fg-bright); font-size: 16px; margin-bottom: 4px; }
.nojs p { margin: 0 0 12px; }
.nojs small { display: block; color: var(--fg-muted); font-weight: 400; }
