/* The page is a terminal window, as ritesh's own page: a title bar, the
   terminal edge to edge, and a tmux status line. Chrome colors follow the
   terminal theme. */
:root {
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
[data-theme="brass"] {
  --bg: #17150f; --bar: #1f1c15; --bar-fg: #b5ab95; --rule: #2e2a20;
  --accent: #e0ac4c; --on-accent: #17150f;
  color-scheme: dark;
}
[data-theme="tide"] {
  --bg: #0e1417; --bar: #141c20; --bar-fg: #9fb0b5; --rule: #22303a;
  --accent: #63c1c9; --on-accent: #0e1417;
  color-scheme: dark;
}
[data-theme="dusk"] {
  --bg: #15121b; --bar: #1c1824; --bar-fg: #aaa1b8; --rule: #2b2536;
  --accent: #b6a1e0; --on-accent: #15121b;
  color-scheme: dark;
}
[data-theme="paper"] {
  --bg: #f5eee3;
  --bar: #ebe2d5;
  --bar-fg: #5a4a40;
  --rule: #ddd1c2;
  --accent: #8a5a00;
  --on-accent: #f5eee3;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--bar-fg);
  font: 12px/1 var(--mono);
}
button, a { font: inherit; color: inherit; }

.title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: calc(0.55rem + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 0.55rem max(16px, env(safe-area-inset-left, 0px));
  background: var(--bar);
  border-bottom: 2px solid var(--rule);
  white-space: nowrap;
}
/* The line under the title bar is the focused pane's border, as in tmux. */
body:has(#term:focus-within) .title { border-bottom-color: var(--accent); }
.title h1 { grid-column: 2; margin: 0; font-size: inherit; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.title h1 b { font-weight: 600; }
.title .size { font-variant-numeric: tabular-nums; }
.title button {
  justify-self: end;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}
.title button:hover { border-color: var(--bar-fg); }

#term { min-width: 0; min-height: 0; overflow: hidden; }
/* xterm paints its own black behind the padding and the rows that do not fill a whole line. */
#term, #term .xterm, #term .xterm-viewport { background: var(--bg); }
#term .xterm {
  height: 100%;
  padding: 0.75rem max(16px, env(safe-area-inset-right, 0px)) 0.75rem max(16px, env(safe-area-inset-left, 0px));
}

.status {
  display: flex;
  align-items: stretch;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px));
  background: var(--accent);
  color: var(--on-accent);
  white-space: nowrap;
  line-height: 1.9;
}
.status .session { font-weight: 600; padding-right: 1.25ch; }
.status nav { display: flex; gap: 1.5ch; min-width: 0; overflow: hidden; }
.status nav button, .status nav a {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
.status .right { margin-left: auto; display: flex; gap: 2ch; padding-left: 2ch; }
.status kbd { font: inherit; font-weight: 600; }
.status time { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

@media (max-width: 640px) {
  .title { grid-template-columns: 1fr auto; }
  .title h1 { grid-column: 1; }
  .status .hint, .status .window, .title .app, .title .label { display: none; }
}
