/* Session controls — the current conversation's title in the main bar, with
   its pin and new-session buttons. The title is renamed where it stands:
   chat.js swaps it for the field below. The list of sessions is part of the
   sidebar (shell.css). */
.chat-session-float {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .15rem;
  padding: 0 .3rem;
}
/* :where() keeps this reset at a bare class's weight, so .session-pill
   below still sets its own type; an :is() here outranked it and the
   project's name (then beside the title) fell back to the page's 15px
   regular. */
.chat-session-float :where(button, a) {
  cursor: pointer;
  font: inherit;
  outline: none;
  /* Defeat the global button:active translateY(1px) — these buttons carry
     no chrome, so a 1px nudge on click feels like a glitch, not a press. */
  transition: color .18s ease, opacity .18s ease, background .18s ease;
}
.chat-session-float :is(button, a):active { transform: none }
.chat-session-float :is(button, a):hover {
  border: 0;
  box-shadow: none;
}
.chat-session-float :is(button, a):focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
}

/* The project the conversation works in (projects.js). The main bar holds
   the session's title alone; the project's name stands under the sidebar
   opener instead, turned a quarter (writing-mode: it reads downwards), in
   the gutter left of the conversation (Mart 04.11.2026: "mintbot / title"
   on one line did not work). The sidebar's switcher names it, so this
   shows only while the sidebar is put away on a wide screen (a phone has
   the drawer), and only for a project of its own -- the main one goes
   unnamed, but for a while after it is picked here, and then slides up in
   behind the opener's drawing (projects.js animates it). The name alone, in
   the title's own type and ink; a click opens the switcher's menu. */
.session-project { display: none }
@media (min-width: 821px) {
  :root[data-sidebar="collapsed"] .session-project:not([hidden]) { display: inline-flex }
}
.shell:not([data-main="chat"]) .session-project { visibility: hidden }
.session-project {
  position: absolute;
  top: calc(var(--topbar-height) - 6px);
  /* Physical, not inset-inline-start: logical insets follow the element's
     own writing mode, where inline-start is the top. */
  left: .6rem;
  width: 32px;
  max-height: 16rem;
  min-height: 0;
  writing-mode: vertical-rl;
  align-items: center;
  justify-content: flex-start;
  padding: .45rem 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  outline: none;
  transition: color .18s ease, background .18s ease;
}
[dir="rtl"] .session-project { left: auto; right: .6rem }
.session-project:hover,
.session-project[aria-expanded="true"] {
  background: var(--shell-hover);
  color: var(--text);
  border: 0;
  box-shadow: none;
}
.session-project:active { transform: none }
.session-project:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
}
.session-project-name {
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The title — a click renames. */
.session-pill {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  max-width: 28rem;
  height: 1.85rem;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0 .5rem;
  font-weight: 500;
  font-size: .95rem;
  line-height: 1.2;
  color: var(--muted);
}
.session-pill:hover {
  background: var(--shell-hover);
  color: var(--text);
}
.session-pill[hidden] { display: none }
.session-pill .ct-id {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: .95rem;
  font-weight: 500;
  letter-spacing: 0;
}

/* The field the title turns into: the title's own box and type, as wide as
   what is written in it (chat.js sizes it where the browser cannot). */
.session-title-input {
  flex: 0 1 auto;
  field-sizing: content;
  width: auto;
  min-width: 6rem;
  max-width: min(28rem, 100%);
  height: 1.85rem;
  padding: 0 .5rem;
  border: 0;
  border-radius: 8px;
  background: var(--shell-hover);
  box-shadow: inset 0 0 0 1px var(--border2);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
}
.session-title-input:focus {
  outline: none;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--outline-hover);
}
.session-title-input:disabled {
  opacity: .6;
  cursor: progress;
}
.session-title-input[hidden] { display: none }

/* Pin and new-session — bare icon buttons; chat.js shows them once there is
   a session to pin or to leave. New-session is a link, so it opens in a new
   tab too. */
.session-pin-pill,
.session-new-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted2);
}
.session-pin-pill svg,
.session-new-pill svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
}
.session-pin-pill:hover,
.session-new-pill:hover {
  background: var(--shell-hover);
  color: var(--text);
}
.session-pin-pill[aria-pressed="true"] { color: var(--accent) }
.session-pin-pill[aria-pressed="true"] svg { fill: currentColor }
.session-pin-pill[hidden],
.session-new-pill[hidden] { display: none }

@media (max-width: 680px) {
  .chat-session-float { padding: 0 .1rem }
  .session-pill .ct-id { font-size: .9rem }
}
