/* The page frame: top bar (wordmark, project title and picker, Records, theme switch, account),
   the conversation with our team (beside a project page, in the Countdown Line's station panel,
   countdown.css; or as its own page), the footer, and the one-column page used by the account
   screens. Values come from the tokens in app.css. */

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--topbar-height);
  padding: var(--space-1) var(--space-3);
}
.wordmark {
  flex: none;
  font: 600 var(--text-brand)/1 var(--font-head);
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* The project title, alone (<span class="project-title">) or with its menu (the picker of the
   company's paid projects, Delete project): <details class="project-menu"><summary ...> */
.project-menu { position: relative; min-width: 0; }
.project-title {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-half) var(--space-1);
  font: 500 var(--text-lg)/1.3 var(--font-body);
  color: var(--fg);
  list-style: none;
  cursor: pointer;
  border-radius: var(--radius);
}
.project-title::-webkit-details-marker { display: none; }
summary.project-title::after { content: "\25BE"; font-size: var(--text-sm); color: var(--fg-2); }
span.project-title { cursor: default; }
.project-menu-items {
  position: absolute;
  top: calc(100% + var(--space-half));
  left: 0;
  z-index: 10;
  display: grid;
  min-width: 200px;
  padding: var(--space-half);
  background: var(--panel);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.project-menu-items a {
  padding: var(--space-1) var(--space-2);
  color: var(--fg);
  text-decoration: none;
  border-radius: var(--radius);
}
.project-menu-items a:hover { background: var(--panel-2); }
.project-menu-items a[aria-current="page"] { font-weight: 500; }
/* Records, beside the project title on a project page. */
.topbar-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--control);
  padding: 0 var(--space-1);
  font: 500 var(--text-sm)/1 var(--font-body);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.topbar-link:hover { color: var(--fg); }

/* Theme switch: two buttons in one form; the chosen one has aria-pressed="true". */
.theme-switch {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 2px;
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-pill);
}
.theme-option {
  padding: 7px 14px;
  font: 500 var(--text-sm)/1 var(--font-body);
  color: var(--muted);
  background: transparent;
  border: var(--border) solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.theme-option:hover { color: var(--fg); }
.theme-option[aria-pressed="true"] {
  color: var(--switch-on-fg);
  background: var(--switch-on-bg);
  border-color: var(--switch-on-line);
}

/* Signed-in account: the address, Sign out. */
.account {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* The conversation with our team (_messages.html): in the side column of a project page, under
   the station's card (countdown.css places it), and the whole page at /p/<id>/messages.
   One column that may shrink to the aside: the file field's own width must not widen it (13b). */
.messages-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  align-content: start;
}
.messages-panel .panel-title { margin: 0; }
.thread {
  display: grid;
  gap: var(--space-2);
  max-height: 60vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.msg {
  display: grid;
  gap: var(--space-half);
  margin-right: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: var(--panel-2);
  border-radius: var(--radius);
}
.msg.is-ours { margin-right: 0; margin-left: var(--space-3); border: var(--border) solid var(--line); }
.msg-meta { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-ref {
  margin: 0;
  padding-left: var(--space-1);
  border-left: var(--border) solid var(--accent);
  font-size: var(--text-sm);
}
.msg-files { margin: 0; padding-left: var(--space-3); font-size: var(--text-sm); }
.msg-form textarea { width: 100%; }
.msg-form input[type="file"] { max-width: 100%; }
.messages-page { display: grid; gap: var(--space-3); max-width: calc(var(--narrow) * 1.6); }
.messages-page .thread { max-height: none; }
/* A decision screen with no message yet (C120 #9): the conversation is one button under the
   station's card; opened, the panel is under it. */
.messages-fold > summary { list-style: none; white-space: nowrap; }
.messages-fold > summary::-webkit-details-marker { display: none; }
.messages-fold[open] > summary { margin-bottom: var(--space-2); }

/* Footer */
.site-footer {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
}
.site-footer a { color: inherit; }

/* Account pages (sign in, check your inbox, errors): one panel in the middle. */
.narrow {
  max-width: var(--narrow);
  margin: var(--space-5) auto;
  padding: var(--space-4);
  background: var(--panel);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.narrow h1 { margin-bottom: var(--space-2); }
.narrow > p + p { margin-top: var(--space-2); }
.narrow > .callout, .narrow > .error, .narrow > form { margin-top: var(--space-2); }
.narrow > .signup-switch { margin-top: var(--space-3); }

@media (max-width: 860px) {
  .account-email { display: none; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: var(--space-1) var(--space-2); padding-inline: var(--space-2); }
  .topbar-actions { margin-left: 0; }
  .narrow { margin: var(--space-2); padding: var(--space-3); }
}
