/* web/styles/dialog-box.css */
/* Every dialog's box, the application's and a published page's alike: a bordered, shadowed panel
   in the page's colours over a dimmed page, its heading at one size. The dialog's shape is the
   shell's (`dialog-shell.css`); what it holds is its own. */
.dialog-box {
  padding: 1.1rem 1.2rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--background);
  color: var(--text);
  box-shadow: 0 16px 48px var(--shadow);
}

.dialog-box::backdrop {
  background: color-mix(in srgb, var(--text) 35%, transparent);
}

.dialog-box h2 {
  margin: 0;
  font-size: 1.1rem;
}
/* web/styles/question-dialog.css */
/* A question the application asks, and the answer it gives to one: a change to a page is a commit,
   so it is asked for before it is made, and a refusal is said where the question was. A published
   page asks its questions with the same dialog (`ui/dialog.mjs`).

   A question that names what it acts on is a heading, a lead, the list of what it is about, and its
   answers: the list is the one part that scrolls, so a long one cannot push the answers out of the
   dialog or the window, and the lead stays above it. The dialog's own box is the form's: the rows
   below are the form's, bounded by the dialog's height. */

.haiyo-dialog h2 {
  margin: 0 0 0.6rem;
}

.haiyo-dialog-message {
  margin: 0;
  color: var(--muted);
}

/* What the question acts on, one line each: a page's name, and the one in view marked. A line is as
   wide as the dialog, so a name too long for it ends in an ellipsis rather than wrapping. */
.haiyo-dialog-pages {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 22rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.haiyo-dialog-pages > li {
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.haiyo-dialog-pages > li.is-current {
  background: var(--raised);
  font-weight: 600;
}

.haiyo-dialog-field {
  display: block;
  margin-top: 0.9rem;
}

.haiyo-dialog-field span {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.haiyo-dialog-field input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

.haiyo-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.haiyo-dialog-dismiss {
  background: transparent;
  color: var(--muted);
}

.haiyo-dialog-dismiss:hover {
  background: var(--raised);
  color: var(--text);
}

/* A question with a second way to agree stacks its answers, the main one first, each across the
   dialog on one line: three answers side by side do not fit its width. */
.haiyo-dialog footer:has(.haiyo-dialog-other:not([hidden])) {
  flex-direction: column-reverse;
  align-items: stretch;
}

/* The second way to agree is drawn apart from the main one: outlined, the main one filled. Its
   outline is drawn inside its box, so it stands at the main answer's size. */
.haiyo-dialog-other {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.haiyo-dialog-other:hover {
  background: var(--raised);
}

/* What the second way to agree leaves as it is, said under it, of it alone. */
.haiyo-dialog-other-note {
  margin: -0.15rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}
/* web/styles/dialog-shell.css */
/* Every dialog's shape, from the one shell they are all bound through: a box set from the window
   and never from what it holds, the heading and the actions standing still, and the part marked
   for it scrolling inside. A dialog states its own size with the two properties; at phone width
   every dialog is the window. Only an open dialog is laid out, so a closed one keeps the user
   agent's display: none. */
.dialog-shell[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  box-sizing: border-box;
  width: min(var(--dialog-width, 32rem), calc(100vw - 2rem));
  height: min(var(--dialog-height, 34rem), calc(100dvh - 2rem));
  max-width: none;
  max-height: none;
  overflow: hidden;
}

.dialog-shell [data-dialog-scroll] {
  min-height: 0;
  overflow-y: auto;
}

#members-panel {
  min-height: 0;
}

/* A question is as tall as what it asks; its message scrolls when that is longer than the window.
   A modal dialog is fixed with both block insets at 0, so an auto height fills the window;
   fit-content keeps it at its content. */
.haiyo-dialog {
  --dialog-width: 26rem;
}

.haiyo-dialog[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: fit-content;
  max-height: calc(100dvh - 2rem);
}

#trash-modal[open] {
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(35rem, calc(100dvh - 2rem));
}

.haiyo-dialog > form {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  min-height: 0;
}

@media (max-width: 560px) {
  .dialog-shell[open] {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  #trash-modal.dialog-shell[open] {
    height: 100dvh;
    max-height: none;
  }
}
/* web/styles/shell.css */
/* The surfaces the application is made of, in whichever palette is chosen: `styles/palette.css`
 * states the colours, this states what is made of them. */
:root {
  --focus-outline-width: 3px;
  --focus-outline-offset: 3px;
  --focus-outline-reach: calc(var(--focus-outline-width) + var(--focus-outline-offset));
  font:
    15px/1.5 system-ui,
    sans-serif;
  color: var(--text);
  background: var(--background);
}

/* A control's drawn mark, wherever a control is drawn: the bar, a card, a published page. */
.control-glyph {
  width: 1.25rem;
  height: 1.25rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: var(--focus-outline-width) solid var(--focus);
  outline-offset: var(--focus-outline-offset);
}

button,
input,
select {
  font: inherit;
}

/* An author `display` outranks the hidden attribute's user-agent rule, so any element given one
   above stays visible while hidden. Restore the attribute's meaning for the whole shell. */
[hidden] {
  display: none !important;
}

/* Words for assistive technology alone, not drawn: a control's name beside its icon, a status
   read out as it changes. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button,
.primary {
  display: inline-block;
  background: var(--accent);
  color: var(--background);
  border: 0;
  border-radius: 6px;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

input,
select {
  display: block;
  width: 100%;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--background);
  margin: 0.4rem 0 1rem;
}

label {
  display: block;
  font-weight: 600;
}

code {
  font:
    0.85em ui-monospace,
    monospace;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.2rem;
}

.welcome {
  max-width: 760px;
  margin: 8vh auto;
  padding: 2rem;
}

.eyebrow {
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.7rem;
  margin: 2rem 0;
  background: var(--background);
}

.workspace-list {
  padding: 0;
  list-style: none;
  margin-top: 2rem;
}

.workspace-list a {
  display: block;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

/* The branch under the workspace's name. Named rather than taken as every span in the row, so
   what the workspace is shown by keeps its own drawing. */
.workspace-list .workspace-branch {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  background: var(--raised);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-weight: 600;
}

/* The line above every page outside a workspace: the application on the left, the account on the
   right, and what the page is about below them. */
.welcome-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.welcome-top .account {
  margin: 0 0 0 auto;
  padding: 0;
}

/* In a pane the application stands in the middle of a line of controls, placed over it. On a page
   of its own it stands where it is written, at the start of the line it is on. */
.welcome .brand {
  position: static;
  transform: none;
  inset: auto;
}

.welcome-top .brand {
  display: flex;
  align-items: center;
}

.welcome-top .brand-lockup {
  width: 5.4rem;
}

.welcome-line,
.welcome-empty {
  color: var(--muted);
  max-width: 44ch;
}

/* The page someone arrives at: the application, one line about it, and the way in. */
.landing {
  display: grid;
  justify-items: start;
  gap: 1.4rem;
  margin-top: 16vh;
}

.landing .brand {
  display: flex;
  align-items: center;
}

.landing .brand-lockup {
  width: 11rem;
}

.landing-line {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.2;
  max-width: 18ch;
}

.landing-under {
  margin: -0.6rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 44ch;
}

.landing form {
  margin: 0;
}

.workspace-list li {
  border-bottom: 1px solid var(--line);
}

.workspace-list a:hover {
  background: var(--raised);
  text-decoration: none;
}

.workspace-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.4rem;
}

.workspace-add svg {
  width: 1rem;
  height: 1rem;
}

.invitation-list {
  padding: 0;
  list-style: none;
}

.invitation-list form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.4rem 0;
}

/* Choosing the folder a workspace reads: what was chosen, where it is, and what is inside it. */
.picker-choice {
  display: flex;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}

.picker-choice p {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  min-width: 0;
}

.picker-choice select {
  max-width: 100%;
}

.picker-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.6rem 0;
  color: var(--muted);
}

/* One choice: what is chosen, and what it could be, in a panel that opens under it. */
.chooser-field {
  display: grid;
  gap: 0.25rem;
  margin: 0 0 1rem;
  max-width: 26rem;
}

.chooser-label {
  font-size: 0.8rem;
  font-weight: 600;
}

.chooser {
  position: relative;
}

.chooser > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--background);
  cursor: pointer;
  list-style: none;
}

.chooser > summary::-webkit-details-marker,
.chooser > summary::marker {
  display: none;
}

.chooser > summary::after {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}

.chooser[open] > summary {
  border-color: var(--text);
}

.chooser-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}

.chooser-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px var(--shadow);
}

/* Where the folder being looked at stands, above the folders inside it. It says nothing about a
   folder found by name, so it goes while one is being looked for. */
.chooser-panel .picker-trail {
  margin: 0 0 0.35rem;
  padding: 0 0.6rem;
  font-size: 0.8rem;
}

.chooser[data-searching='true'] .picker-trail {
  display: none;
}

.chooser-field-input {
  width: 100%;
  margin: 0 0 0.35rem;
}

.chooser-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  /* Looked through, not scrolled past: eight rows, and the rest behind the scrollbar. */
  max-height: 17rem;
  overflow: auto;
}

.chooser-rows :is(a, button) {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chooser-rows :is(a, button):hover,
.chooser-rows :is(a, button).is-active {
  background: var(--raised);
  text-decoration: none;
}

.chooser-rows :is(a, button)[aria-current='true'] {
  font-weight: 700;
}

.chooser-empty {
  padding: 0.5rem 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.picker-find {
  display: grid;
  gap: 0.25rem;
  margin: 0.6rem 0 0.5rem;
}

.picker-find input {
  width: 100%;
  max-width: 22rem;
}

.picker-more {
  margin: -0.8rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.folder-picker {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 22rem;
}

.folder-picker li + li {
  border-top: 1px solid var(--line);
}

.folder-picker a {
  display: block;
  padding: 0.7rem 0.9rem;
}

.folder-picker a:hover {
  background: var(--raised);
  text-decoration: none;
}

.folder-empty {
  padding: 0.7rem 0.9rem;
  color: var(--muted);
}

.picker-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* While a folder is being asked for, what is on screen is the folder that was asked for last. */
#picker[data-asking='true'] .folder-picker {
  opacity: 0.55;
}

.picker-install {
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .welcome {
    margin: 1rem auto;
    padding: 1.2rem;
  }

  h1 {
    font-size: 2rem;
  }

  .landing {
    margin-top: 8vh;
  }

  /* A choice each to a line: a phone has no room for two, and they are read in order anyway. */
  .picker-choice {
    display: grid;
    gap: 0.8rem;
  }

  .picker-choice p {
    width: 100%;
  }

  .card {
    padding: 1.1rem;
    margin: 1.2rem 0;
  }

  .welcome-top {
    margin-bottom: 1.4rem;
  }
}

.account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  margin: -0.5rem 0 1rem;
  background: transparent;
  border: 0;
  overflow: visible;
  font-size: 0.8rem;
}

.account span {
  color: var(--muted);
}

.account form {
  margin-left: auto;
}

/* Every workspace in the list is shown by what it carries, beside what it is called. */
.workspace-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.7rem;
  align-items: center;
}

.workspace-list .workspace-icon {
  grid-row: span 2;
  width: 2rem;
  height: 2rem;
  margin: 0;
  font-size: 2rem;
  border-radius: 6px;
}

.workspace-list .workspace-icon .page-glyph {
  width: 1.5rem;
  height: 1.5rem;
}

.workspace-list .workspace-icon .page-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

/* The invitations addressed to the reader, above everything else the panel shows, and on the
   workspace list page for a person who has no workspace yet. */
.organization-inbox [data-inbox-invitation] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.6rem;
  border-block-start: 1px solid var(--line);
}
.organization-inbox [data-inbox-invitation] p {
  flex-basis: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}
.organization-inbox-page {
  margin-block: 1rem 1.5rem;
}

/* What the application says about something asked of it: under way, done, refused, or a warning.
   A notice is plain words beside what it is about, with no box of its own: its kind is told by
   its colour roles, legible on every field in every theme. Under way is muted, done is in the
   text colour, refused in the alert colour. */
.notice {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.notice[data-notice='done'] {
  color: var(--text);
}

.notice[data-notice='refused'] {
  color: var(--alert);
}

/* A warning is something to act on, not something that failed: its words are in the text colour,
   marked by a rule in the alert colour on their left. */
.notice[data-notice='warning'] {
  padding-left: 0.45rem;
  border-left: 3px solid var(--alert);
  color: var(--text);
}

/* A refused page's way out (`errors.rs`, `a.refusal-recovery`) is pressed by a finger under
   touch: its link is 44 px tall there, its words drawn as before. */
@media (max-width: 760px), (pointer: coarse) {
  .refusal-recovery {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* A recovery action stays beside the refusal that explains it. */
.notice a,
.notice button {
  color: inherit;
  text-decoration: underline;
}

.notice button {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* A form that says something under its controls gives the notice a line of its own. */
form:has(> .notice) {
  flex-wrap: wrap;
}

form > .notice {
  flex-basis: 100%;
}

/* A time keeps one width for its format whatever its digits: unkerned tabular digits. A list of
   times lines up, and a time that changes does not move what follows it. */
time {
  font-variant-numeric: tabular-nums;
  font-kerning: none;
}
